details.vue 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531
  1. <template>
  2. <div class="">
  3. <div v-if="isEdit == 1">
  4. <div>
  5. <div class="diy-table-1">
  6. <el-row>
  7. <el-col :span="8" class="item">
  8. <div class="label">销售政策编号</div>
  9. <div class="value">{{ detail.code }}</div>
  10. </el-col>
  11. <el-col :span="8" class="item">
  12. <div class="label">销售政策类型</div>
  13. <div class="value">
  14. {{ detail.type == 'PROVISION' ? '配提' : '限量' }}
  15. </div>
  16. </el-col>
  17. <el-col :span="8" class="item">
  18. <div class="label">状态</div>
  19. <div class="value">
  20. {{ detail.status == 1 ? '已生效' : '未生效' }}
  21. </div>
  22. </el-col>
  23. <el-col :span="24" class="item">
  24. <div class="label">销售政策名称</div>
  25. <div class="value">
  26. <el-input v-model="detail.title" disabled placeholder="请输入销售政策名称" />
  27. </div>
  28. </el-col>
  29. <el-col :span="24" class="item">
  30. <div class="label">表头备注</div>
  31. <div class="value">
  32. {{ detail.remark }}
  33. </div>
  34. </el-col>
  35. <el-col v-if="(detail.examineStatus = 'SAVE' && detail.examineTime != null)" :span="24" class="item">
  36. <div class="label">驳回原因</div>
  37. <div class="value">
  38. {{ detail.examineRemark }}
  39. </div>
  40. </el-col>
  41. <el-col :span="8" class="item">
  42. <div class="label">制单人</div>
  43. <div class="value">{{ detail.createBy }}</div>
  44. </el-col>
  45. <el-col :span="8" class="item">
  46. <div class="label">制单日期</div>
  47. <div class="value">
  48. {{ detail.createTime }}
  49. </div>
  50. </el-col>
  51. <el-col :span="8" class="item">
  52. <div class="label">生效日期</div>
  53. <div class="value">
  54. {{ detail.startTime }}
  55. </div>
  56. </el-col>
  57. <el-col :span="24" class="item">
  58. <div class="label">失效日期</div>
  59. <div class="value">
  60. {{ detail.endTime }}
  61. </div>
  62. </el-col>
  63. <template v-if="detail.type === 'LIMIT'">
  64. <el-col :span="12" class="item">
  65. <div class="label">商家最少起提数量</div>
  66. <div class="value">
  67. {{ detail.minBuyNum }}
  68. </div>
  69. </el-col>
  70. <el-col :span="12" class="item">
  71. <div class="label">商家最大提货组数</div>
  72. <div class="value">
  73. {{ detail.maxBuyNum }}
  74. </div>
  75. </el-col>
  76. </template>
  77. </el-row>
  78. <el-row v-if="detail.imgSrc && isShow !== 5" class="img-box">
  79. <el-col :span="24" class="item">
  80. <div class="label" style="height: 150px">政策封面图</div>
  81. <div class="value" style="height: 150px">
  82. <template v-for="item in detail.imgSrc">
  83. <el-image
  84. v-if="checkFileType(item) == 'image'"
  85. ref="img"
  86. :src="$imageUrl + item"
  87. style="width: 120px; height: 120px; margin-right: 20px"
  88. fit="cover"
  89. :preview-src-list="[$imageUrl + item]"
  90. class="elImageClose"
  91. />
  92. <img v-if="checkFileType(item) == 'word'" class="file" src="@/assets/common/word.png">
  93. <img v-if="checkFileType(item) == 'excel'" class="file" src="@/assets/common/excel.png">
  94. <img v-if="checkFileType(item) == 'ppt'" class="file" src="@/assets/common/ppt.png">
  95. <img
  96. v-if="checkFileType(item) == 'pdf'"
  97. class="file"
  98. style="cursor: pointer"
  99. src="@/assets/common/pdf.png"
  100. @click="openPdf(item)"
  101. >
  102. <img v-if="checkFileType(item) == 'file'" class="file aaa" src="@/assets/common/zip.jpeg">
  103. </template>
  104. <!-- <el-image
  105. v-for="item in detail.imgSrc"
  106. style="height: 120px; widht: 120px;margin-left: 20px"
  107. :src="$imageUrl + item"
  108. fit="fill"
  109. :preview-src-list="srcList"
  110. /> -->
  111. </div>
  112. </el-col>
  113. </el-row>
  114. <el-row v-if="isShow == 5">
  115. <el-col :span="24" class="item">
  116. <div class="label" style="height: 150px">政策封面图</div>
  117. <div class="value" style="height: 150px">
  118. <image-upload :file-list="fileList" :multiple="false" />
  119. </div>
  120. </el-col>
  121. </el-row>
  122. <el-row v-if="this.isShow == 4">
  123. <el-col :span="8" class="item">
  124. <div class="label">审核人</div>
  125. <div class="value">{{ detail.examineBy }}</div>
  126. </el-col>
  127. <el-col :span="16" class="item">
  128. <div class="label">审核日期</div>
  129. <div class="value">{{ detail.examineTime }}</div>
  130. </el-col>
  131. <el-col :span="12" class="item">
  132. <div class="label">返利使用金额需满额使用</div>
  133. <div class="value">
  134. <el-checkbox v-model="detail.isFullRebate" disabled>{{
  135. detail.isFullRebate ? '是' : '否'
  136. }}</el-checkbox>
  137. </div>
  138. </el-col>
  139. <el-col :span="12" class="item">
  140. <div class="label">商用空调政策</div>
  141. <div class="value">
  142. <el-checkbox v-model="detail.commercialType" disabled>{{
  143. detail.commercialType ? '是' : '否'
  144. }}</el-checkbox>
  145. </div>
  146. </el-col>
  147. <!-- <el-col :span="8" class="item">-->
  148. <!-- <div class="label">关闭人</div>-->
  149. <!-- <div class="value"></div>-->
  150. <!-- </el-col>-->
  151. <!-- <el-col :span="24" class="item">-->
  152. <!-- <div class="label">关闭日期</div>-->
  153. <!-- <div class="value"></div>-->
  154. <!-- </el-col>-->
  155. </el-row>
  156. </div>
  157. <div class="mymain-container">
  158. <el-row>
  159. <el-divider />
  160. <el-row type="flex">
  161. <el-col :span="12">
  162. <h4 style="display: inline-block; margin-right: 20px">货品信息</h4>
  163. <ExportButton
  164. v-if="isShow === 4"
  165. style="display: inline-block"
  166. :ex-url="'policy/material/export'"
  167. ex-text="导出货品"
  168. :ex-params="{ policyId: detail.code }"
  169. />
  170. <el-upload
  171. v-if="isShow == 5"
  172. class="import-btn"
  173. :action="baseURL + 'student/import'"
  174. :http-request="handleImport"
  175. :file-list="importFileList"
  176. :show-file-list="false"
  177. >
  178. <el-button size="mini">导入货品价格表</el-button>
  179. </el-upload>
  180. </el-col>
  181. <el-col :span="12" class="tr" />
  182. </el-row>
  183. <el-divider />
  184. </el-row>
  185. <div class="table">
  186. <el-table
  187. v-loading="listLoading"
  188. :data="dataList"
  189. element-loading-text="Loading"
  190. border
  191. max-height="700"
  192. fit
  193. highlight-current-row
  194. stripe
  195. >
  196. <el-table-column fixed type="index" label="序号" width="50" align="left" />
  197. <el-table-column
  198. prop="materialNumber"
  199. label="物料编码"
  200. min-width="160"
  201. show-overflow-tooltip
  202. align="left"
  203. >
  204. <template slot-scope="scope">
  205. <CopyButton :copy-text="scope.row.materialNumber" />
  206. <span>{{ scope.row.materialNumber }}</span>
  207. </template>
  208. </el-table-column>
  209. <el-table-column prop="materialName" label="产品名称" min-width="160" show-overflow-tooltip align="left">
  210. <template slot-scope="scope">
  211. <CopyButton :copy-text="scope.row.materialName" />
  212. <span>{{ scope.row.materialName }}</span>
  213. </template>
  214. </el-table-column>
  215. <el-table-column prop="specification" label="规格型号" min-width="300" show-overflow-tooltip align="left">
  216. <template slot-scope="scope">
  217. <CopyButton :copy-text="scope.row.specification" />
  218. <span>{{ scope.row.specification }}</span>
  219. </template>
  220. </el-table-column>
  221. <el-table-column
  222. prop="saleTypeCode"
  223. label="销售类型编码"
  224. min-width="160"
  225. show-overflow-tooltip
  226. align="left"
  227. />
  228. <el-table-column
  229. prop="saleTypeName"
  230. label="销售类型"
  231. min-width="160"
  232. show-overflow-tooltip
  233. align="left"
  234. />
  235. <el-table-column prop="discAmount" label="格力折扣" align="right" />
  236. <el-table-column prop="price" label="单价" align="right" />
  237. <el-table-column prop="orgPrice" label="原供价" align="right" min-width="150">
  238. <template slot-scope="scope">
  239. {{ scope.row.orgPrice }}
  240. </template>
  241. </el-table-column>
  242. <el-table-column prop="priceType" label="价格类型" align="left" min-width="150">
  243. <template slot-scope="scope">
  244. {{ scope.row.priceType }}
  245. </template>
  246. </el-table-column>
  247. <el-table-column label="返利钱包" align="left" min-width="200" show-overflow-tooltip>
  248. <template slot-scope="scope">
  249. <template v-for="item in scope.row.walletRelaList">
  250. <el-tag v-if="item.type === 'REBATE'" style="margin: 5px" type="success" size="mini">{{
  251. item.walletName
  252. }}</el-tag>
  253. </template>
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="现金钱包" align="left" min-width="200" show-overflow-tooltip>
  257. <template slot-scope="scope">
  258. <template v-for="item in scope.row.walletRelaList">
  259. <el-tag v-if="item.type === 'COMMONLY'" style="margin: 5px" type="success" size="mini">{{
  260. item.walletName
  261. }}</el-tag>
  262. </template>
  263. </template>
  264. </el-table-column>
  265. <el-table-column prop="status" label="状态" align="left" show-overflow-tooltip min-width="150">
  266. <template slot-scope="scope">
  267. {{ scope.row.status ? '启用' : '作废' }}
  268. </template>
  269. </el-table-column>
  270. </el-table>
  271. </div>
  272. <!-- 分页 -->
  273. <div style="margin: 20px 0">
  274. <el-pagination
  275. :current-page="dcurrentPage"
  276. :page-sizes="[10, 20, 30, 50]"
  277. :page-size="10"
  278. layout="total, sizes, prev, pager, next, jumper"
  279. :total="dlistTotal"
  280. @size-change="handleSizeChange2"
  281. @current-change="handleCurrentChange2"
  282. />
  283. </div>
  284. <el-row>
  285. <el-divider />
  286. <el-row type="flex">
  287. <el-col :span="12">
  288. <h4 style="display: inline-block; margin-right: 20px">条件信息</h4>
  289. </el-col>
  290. </el-row>
  291. <el-divider />
  292. </el-row>
  293. <div class="table">
  294. <el-table :data="conditionList" element-loading-text="Loading" border fit highlight-current-row stripe>
  295. <el-table-column fixed type="index" label="序号" width="50" align="left" />
  296. <el-table-column prop="name" label="限定条件" align="left">
  297. <template slot-scope="scope">
  298. {{ scope.row.name }}
  299. </template>
  300. </el-table-column>
  301. <el-table-column label="操作" align="left" width="150">
  302. <template slot-scope="scope">
  303. <template v-if="isShow == 5">
  304. <el-button type="text" size="mini" @click="getCommonApi(scope.row)">编辑</el-button>
  305. <el-popconfirm
  306. confirm-button-text="好的"
  307. cancel-button-text="不用了"
  308. icon="el-icon-info"
  309. icon-color="red"
  310. title="内容确定删除吗?"
  311. @onConfirm="handleCondition(scope.row.id, scope.$index)"
  312. >
  313. <el-button slot="reference" type="text" class="textColor el-popover-left">删除</el-button>
  314. </el-popconfirm>
  315. </template>
  316. <el-button v-else type="text" size="mini" @click="getCommonApi(scope.row)">查看条件</el-button>
  317. </template>
  318. </el-table-column>
  319. </el-table>
  320. </div>
  321. <el-row>
  322. <el-divider />
  323. <el-row type="flex">
  324. <el-col :span="12">
  325. <h4 style="display: inline-block; margin-right: 20px">经销商使用范围</h4>
  326. <template v-if="detail.flag == 0">
  327. <ExportButton
  328. v-if="isShow === 4"
  329. style="display: inline-block"
  330. :ex-url="'policy/customer/export'"
  331. ex-text="导出经销商"
  332. :ex-params="{ policyId: detail.code }"
  333. />
  334. </template>
  335. </el-col>
  336. </el-row>
  337. <el-divider />
  338. <el-radio-group v-model="detail.flag">
  339. <el-radio label="0" :disabled="detail.flag != 0">指定经销商</el-radio>
  340. <el-radio label="1" :disabled="detail.flag != 1">广州经销商</el-radio>
  341. <el-radio label="2" :disabled="detail.flag != 2">佛山经销商</el-radio>
  342. </el-radio-group>
  343. </el-row>
  344. <div class="table">
  345. <template v-if="isShow != 5">
  346. <template v-if="detail.flag == 0">
  347. <el-table
  348. v-loading="listLoading"
  349. :data="custoList"
  350. element-loading-text="Loading"
  351. border
  352. fit
  353. highlight-current-row
  354. stripe
  355. >
  356. <el-table-column fixed type="index" label="序号" width="50" align="left" />
  357. <el-table-column prop="customerNumber" label="经销商编码" align="left">
  358. <template slot-scope="scope">
  359. <CopyButton :copy-text="scope.row.customerNumber" />
  360. <span>{{ scope.row.customerNumber }}</span>
  361. </template></el-table-column>
  362. <el-table-column prop="customerName" label="经销商名称" align="left">
  363. <template slot-scope="scope">
  364. <CopyButton :copy-text="scope.row.customerName" />
  365. <span>{{ scope.row.customerName }}</span>
  366. </template>
  367. </el-table-column>
  368. </el-table>
  369. <!-- 分页 -->
  370. <div style="margin: 20px 0">
  371. <el-pagination
  372. :current-page="currentPages"
  373. :page-sizes="[10, 20, 30, 50]"
  374. :page-size="10"
  375. layout="total, sizes, prev, pager, next, jumper"
  376. :total="clistTotals"
  377. @size-change="handleSizeChanges"
  378. @current-change="handleCurrentChanges"
  379. />
  380. </div>
  381. </template>
  382. </template>
  383. <template v-else>
  384. <el-row :gutter="20">
  385. <el-col :span="10" :offset="0">
  386. <h5>未选经销商</h5>
  387. <el-divider direction="horizontal" content-position="left" />
  388. <el-table
  389. ref="multipleTable"
  390. :data="dataL"
  391. element-loading-text="Loading"
  392. border
  393. height="480px"
  394. fit
  395. highlight-current-row
  396. @select-all="handleSelectionAllChange"
  397. @selection-change="handleSelectionChange"
  398. >
  399. <el-table-column type="selection" width="55" :selectable="selectable" align="left" />
  400. <el-table-column prop="number" label="经销商编码" align="left">
  401. <template slot-scope="scope">
  402. <CopyButton :copy-text="scope.row.number" />
  403. <span>{{ scope.row.number }}</span>
  404. </template>
  405. </el-table-column>
  406. <el-table-column prop="name" label="经销商名称" align="left">
  407. <template slot-scope="scope">
  408. <CopyButton :copy-text="scope.row.name" />
  409. <span>{{ scope.row.name }}</span>
  410. </template>
  411. </el-table-column>
  412. </el-table>
  413. <!-- 分页 -->
  414. <div style="margin: 20px 0">
  415. <el-pagination
  416. :current-page="currentPages"
  417. :page-sizes="[10, 20, 30, 50]"
  418. :page-size="10"
  419. layout="total, sizes, prev, pager, next, jumper"
  420. :total="clistTotal"
  421. @size-change="handleSizeChanges"
  422. @current-change="handleCurrentChanges"
  423. />
  424. </div>
  425. </el-col>
  426. <el-col :span="4" class="middle_box" :offset="0">
  427. <el-col>
  428. <el-button size="mini" :disabled="type == 2" @click="handleAllAdd">全部添加</el-button></el-col>
  429. <el-col> <el-button size="mini" :disabled="type == 2" @click="handleAdd">增加</el-button></el-col>
  430. <el-col> <el-button size="mini" :disabled="type == 1" @click="handleDelete">删除</el-button></el-col>
  431. <el-col>
  432. <el-button size="mini" :disabled="type == 1" @click="handleAllDelete">全部删除</el-button></el-col>
  433. </el-col>
  434. <el-col :span="10" :offset="0">
  435. <h5>已选经销商</h5>
  436. <el-divider direction="horizontal" content-position="left" />
  437. <el-table
  438. v-loading="listLoading"
  439. :data="custoList"
  440. element-loading-text="Loading"
  441. border
  442. height="480px"
  443. fit
  444. highlight-current-row
  445. stripe
  446. @select-all="handleSelectionAllChange2"
  447. @selection-change="handleSelectionChange2"
  448. >
  449. <el-table-column type="selection" width="55" align="left" />
  450. <el-table-column prop="customerNumber" label="经销商编码" align="left">
  451. <template slot-scope="scope">
  452. <CopyButton :copy-text="scope.row.customerNumber" />
  453. <span>{{ scope.row.customerNumber }}</span>
  454. </template>
  455. </el-table-column>
  456. <el-table-column prop="customerName" label="经销商名称" align="left">
  457. <template slot-scope="scope">
  458. <CopyButton :copy-text="scope.row.customerName" />
  459. <span>{{ scope.row.customerName }}</span>
  460. </template>
  461. </el-table-column>
  462. </el-table>
  463. <!-- 分页 -->
  464. <!-- <div style="margin: 20px 0">
  465. <el-pagination
  466. @size-change="handleSizeChanges"
  467. @current-change="handleCurrentChanges"
  468. :current-page="currentPages"
  469. :page-sizes="[10, 20, 30, 50]"
  470. :page-size="10"
  471. layout="total, sizes, prev, pager, next, jumper"
  472. :total="clistTotals"
  473. >
  474. </el-pagination>
  475. </div> -->
  476. </el-col>
  477. </el-row>
  478. </template>
  479. <template>
  480. <div style="dispaly: flex">
  481. <h4 style="display: inline-block; margin-right: 20px">经销商上限</h4>
  482. <ExportButton
  483. style="display: inline-block; margin-right: 20px"
  484. :ex-url="'policy/limit/export'"
  485. :ex-params="exParams"
  486. />
  487. <el-button
  488. v-if="detail.type !== 'PROVISION' && list.length"
  489. type="primary"
  490. size="mini"
  491. @click="()=>{
  492. visible = true
  493. handelBatchData()
  494. }"
  495. >批量修改</el-button>
  496. <el-divider />
  497. </div>
  498. <div>
  499. <div class="table">
  500. <el-table
  501. v-if="detail.type == 'PROVISION'"
  502. v-loading="clistLoading"
  503. :data="list"
  504. element-loading-text="Loading"
  505. border
  506. fit
  507. highlight-current-row
  508. stripe
  509. @select-all="handleSelectionAllChange2"
  510. @selection-change="handleSelectionChange2"
  511. >
  512. <el-table-column prop="customerName" label="经销商名称" align="left" width="300">
  513. <template slot-scope="scope">
  514. <CopyButton :copy-text="scope.row.customerName" />
  515. <span>{{ scope.row.customerName }}</span>
  516. </template>
  517. </el-table-column>
  518. <el-table-column prop="maxBuyNum" label="最大提货套数" align="left">
  519. <template slot-scope="scope">
  520. {{ scope.row.maxBuyNum }}
  521. </template>
  522. </el-table-column>
  523. <el-table-column prop="materialName" label="物料名称" align="left">
  524. <template slot-scope="scope">
  525. {{ scope.row.materialName }}
  526. </template>
  527. </el-table-column>
  528. <el-table-column prop="materialNumber" label="物料编号" align="left">
  529. <template slot-scope="scope">
  530. {{ scope.row.materialNumber }}
  531. </template>
  532. </el-table-column>
  533. <el-table-column prop="limitQty" label="订货上限" align="left">
  534. <template slot-scope="scope">
  535. {{ scope.row.limitQty }}
  536. </template>
  537. </el-table-column>
  538. <el-table-column prop="orderNums" label="已下订单数" align="left">
  539. <template slot-scope="scope">
  540. {{ scope.row.orderNums }}
  541. </template>
  542. </el-table-column>
  543. <el-table-column prop="examineOrderNums" label="已审订单数" align="left">
  544. <template slot-scope="scope">
  545. {{ scope.row.examineOrderNums }}
  546. </template>
  547. </el-table-column>
  548. </el-table>
  549. <el-table
  550. v-else
  551. v-loading="clistLoading"
  552. :data="list"
  553. element-loading-text="Loading"
  554. border
  555. fit
  556. highlight-current-row
  557. stripe
  558. @select-all="handleSelectionAllChange2"
  559. @selection-change="handleSelectionChange2"
  560. >
  561. <el-table-column type="index" label="序号" align="left" />
  562. <el-table-column prop="customerNumber" label="经销商编号" align="left" width="300">
  563. <template slot-scope="scope">
  564. <CopyButton :copy-text="scope.row.customerNumber" />
  565. <span>{{ scope.row.customerNumber }}</span>
  566. </template>
  567. </el-table-column>
  568. <el-table-column prop="customerName" label="经销商名称" align="left" width="300">
  569. <template slot-scope="scope">
  570. <CopyButton :copy-text="scope.row.customerName" />
  571. <span>{{ scope.row.customerName }}</span>
  572. </template>
  573. </el-table-column>
  574. <el-table-column prop="minBuyNum" label="最少起提数" align="left">
  575. <template slot-scope="scope">
  576. <span>{{ scope.row.minBuyNum }}</span>
  577. </template>
  578. </el-table-column>
  579. <el-table-column prop="maxBuyNum" label="最大提货组数" align="left">
  580. <template slot-scope="scope">
  581. <span>{{ scope.row.maxBuyNum }}</span>
  582. </template>
  583. </el-table-column>
  584. <el-table-column prop="orderNums" label="已下订单数" align="left">
  585. <template slot-scope="scope">
  586. <span>{{ scope.row.orderNums }}</span>
  587. </template>
  588. </el-table-column>
  589. <el-table-column prop="examineOrderNums" label="已审订单数" align="left">
  590. <template slot-scope="scope">
  591. <span>{{ scope.row.examineOrderNums }}</span>
  592. </template>
  593. </el-table-column>
  594. </el-table>
  595. </div>
  596. <!-- 分页 -->
  597. <div style="margin: 20px 0">
  598. <el-pagination
  599. :current-page="policyList.currentPages"
  600. :page-sizes="[10, 20, 30, 50]"
  601. :page-size="10"
  602. layout="total, sizes, prev, pager, next, jumper"
  603. :total="cTotal"
  604. @size-change="handleSizeChanges4"
  605. @current-change="handleCurrentChanges4"
  606. />
  607. </div>
  608. </div>
  609. </template>
  610. <div v-if=" detail && detail.type == 'PROVISION'">
  611. <div>
  612. <h4 style="display: inline-block; margin-right: 20px">经销商配提套数上限</h4>
  613. <el-divider />
  614. </div>
  615. <div style="margin: 20px 0">
  616. <!-- <el-upload
  617. class="import-btn cus-btn"
  618. :action="baseURL + 'policy/limit/group/import'"
  619. :http-request="handleImportPolicyLimitGroupPolicy"
  620. :file-list="importFileList"
  621. :show-file-list="false"
  622. >
  623. <el-button type="primary" size="mini">导入经销商配提套数</el-button>
  624. </el-upload> -->
  625. <ExportButton
  626. style="display: inline-block; margin-right: 10px"
  627. :ex-url="'policy/limit/group/export'"
  628. ex-text="导出经销商配提套数"
  629. :ex-params="{ policyId: detail.code }"
  630. />
  631. <!-- <el-button type="primary" size="mini" @click="hanleDownloadFilesPolicyLimitGroupPolicy"
  632. >下载模板</el-button
  633. > -->
  634. </div>
  635. <!-- <el-row style="margin: 20px 0">
  636. <el-col :span="12">
  637. <el-input v-model="policyKeyWord" placeholder="查找经销商" size="mini" />
  638. </el-col>
  639. <el-col :span="10" style="margin-left: 20px">
  640. <el-button size="mini" @click="getPolicyLimitGroupList">确定</el-button>
  641. <el-button size="mini" @click="onPolicyReset">重置</el-button>
  642. </el-col>
  643. </el-row> -->
  644. <div>
  645. <div class="table">
  646. <el-table
  647. v-loading="policyLoading"
  648. :data="policyLimitGroupList"
  649. element-loading-text="Loading"
  650. border
  651. fit
  652. highlight-current-row
  653. stripe
  654. >
  655. <el-table-column type="index" width="50" />
  656. <el-table-column
  657. prop="customerNumber"
  658. label="经销商编号
  659. "
  660. align="left"
  661. width="300"
  662. >
  663. <template slot-scope="scope">
  664. <CopyButton :copy-text="scope.row.customerNumber" />
  665. <span>{{ scope.row.customerNumber }}</span>
  666. </template>
  667. </el-table-column>
  668. <el-table-column prop="customerName" label="经销商名称" align="left" width="300">
  669. <template slot-scope="scope">
  670. <CopyButton :copy-text="scope.row.customerName" />
  671. <span>{{ scope.row.customerName }}</span>
  672. </template>
  673. </el-table-column>
  674. <el-table-column prop="groupLimitNum" label="配提上限组数" align="left" width="200">
  675. <template slot-scope="scope">
  676. {{ scope.row.groupLimitNum }}
  677. </template>
  678. </el-table-column>
  679. <el-table-column prop="orderNums" label="配提上限已下订单数" align="left" width="200">
  680. <template slot-scope="scope">
  681. {{ scope.row.orderNums }}
  682. </template>
  683. </el-table-column>
  684. <el-table-column prop="examineOrderNums" label="配提上限已审订单数" align="left" width="200">
  685. <template slot-scope="scope">
  686. {{ scope.row.examineOrderNums }}
  687. </template>
  688. </el-table-column>
  689. </el-table>
  690. </div>
  691. <!-- 分页 -->
  692. <div style="margin: 20px 0">
  693. <el-pagination
  694. :current-page="policyCurrentPages"
  695. :page-sizes="[10, 20, 30, 50]"
  696. :page-size="10"
  697. layout="total, sizes, prev, pager, next, jumper"
  698. :total="policyListTotal"
  699. @size-change="handlePolicySizeChanges"
  700. @current-change="handlePolicyCurrentChanges"
  701. />
  702. </div>
  703. </div>
  704. </div>
  705. </div>
  706. <div v-if="isShow == 8 && detail.examineStatus == 'WAIT'" class="descriptions diy-table-1">
  707. <el-row>
  708. <el-col :span="6">审核人</el-col>
  709. <el-col :span="6">{{ $store.getters.name }}</el-col>
  710. <el-col :span="6">审核结果</el-col>
  711. <el-col :span="6">
  712. <template>
  713. <el-radio-group v-model="examineStatus">
  714. <el-radio :label="'OK'">通过</el-radio>
  715. <el-radio :label="'FAIL'">驳回</el-radio>
  716. </el-radio-group>
  717. </template>
  718. </el-col>
  719. </el-row>
  720. <el-row class="item">
  721. <el-col :span="4">审批说明</el-col>
  722. <el-col :span="20" class="col value" style="padding-left: 10px">
  723. <el-input v-model="remark" size="mini" placeholder="请输入内容" />
  724. </el-col>
  725. </el-row>
  726. <el-row>
  727. <el-button type="primary" size="mini" @click="handleSubmit">审核通过</el-button>
  728. </el-row>
  729. </div>
  730. </div>
  731. <div>
  732. <el-button v-if="isShow == 5" type="primary" size="default" @click="handleSave">保存</el-button>
  733. </div>
  734. </div>
  735. <operation-records v-if="detail && detail.code" :policy-id="detail.code" />
  736. <el-dialog
  737. title="批量修改"
  738. :visible.sync="visible"
  739. width="50%"
  740. :append-to-body="true"
  741. :close-on-click-modal="false"
  742. @close="handleDialogVisible"
  743. >
  744. <el-row :gutter="20">
  745. <el-col :span="24" style="display: flex; align-items: center; margin-bottom: 20px">
  746. <el-col :span="4" :offset="0"> 最小起起提数 </el-col>
  747. <el-col :span="8" :offset="0"> <el-input v-model="minBuyNum" size="mini" /></el-col>
  748. <el-col :span="4" :offset="0"> 最大可提组数 </el-col>
  749. <el-col :span="8" :offset="0"> <el-input v-model="maxBuyNum" size="mini" /></el-col>
  750. </el-col>
  751. <el-col :span="24" :offset="0" style="margin-bottom: 20px">
  752. <div style="display: flex">
  753. <el-input v-model="buyNumKeyWord" placeholder="输入关键字搜索" size="mini" />
  754. <el-button
  755. style="margin-left: 20px"
  756. type="primary"
  757. size="mini"
  758. @click="handelBatchData('search')"
  759. >查询</el-button>
  760. <el-button size="mini" @click="onReset">重置</el-button>
  761. </div>
  762. </el-col>
  763. </el-row>
  764. <zj-table
  765. :table-attributes="tableAttributes"
  766. :table-events="tableEvents"
  767. :is-drop="true"
  768. :columns="columns"
  769. :table-data="tableData"
  770. />
  771. <div style="margin: 20px 0">
  772. <el-pagination
  773. :current-page="batchCurrentPages"
  774. :page-sizes="[10, 20, 30, 50]"
  775. :page-size="10"
  776. layout="total, sizes, prev, pager, next, jumper"
  777. :total="batchTotal"
  778. @size-change="handleBatchSizeChanges"
  779. @current-change="handleBatchCurrentChanges"
  780. />
  781. </div>
  782. <span slot="footer">
  783. <el-button @click="handleDialogVisible">取消</el-button>
  784. <el-button type="primary" @click="onSubmit('limit')">确定</el-button>
  785. </span>
  786. </el-dialog>
  787. </div>
  788. <add-condition
  789. v-else
  790. :id="cid"
  791. :is-edit="isEdit"
  792. :is-show="isShow"
  793. @close="handleConditionClose"
  794. @back="handleBack"
  795. />
  796. </div>
  797. </template>
  798. <script>
  799. import {
  800. deleteCondition,
  801. deleteMaterialPolicy,
  802. getConditionList,
  803. getCrList,
  804. getCustomerList,
  805. getMaterialList,
  806. getPolicyDetail,
  807. toExamine,
  808. updatePolicy,
  809. getPolicyList,
  810. updateLimitBatchupdate,
  811. getPolicyLimitGroupList
  812. } from '@/api/policy_list'
  813. import { downloadFiles, handleImport } from '@/utils/util'
  814. import AddCondition from './AddCondition'
  815. import ImageUpload from '@/components/Common/image-upload.vue'
  816. import OperationRecords from './OperationRecords.vue'
  817. import Minxin from '@/mixin'
  818. export default {
  819. name: 'Examine',
  820. components: {
  821. AddCondition,
  822. ImageUpload,
  823. OperationRecords
  824. },
  825. mixins: [Minxin],
  826. props: ['id', 'isShow'],
  827. data() {
  828. return {
  829. baseURL: '',
  830. dcurrentPage: 1,
  831. dpageSize: 10,
  832. dlistTotal: 0,
  833. currentPages: 1, // 当前页码
  834. pageSizes: 10, // 每页数量
  835. clistTotal: 0,
  836. input: '',
  837. remark: '',
  838. fileList: [],
  839. listLoading: false,
  840. imageUrl: '',
  841. dataList: [],
  842. examineStatus: 'OK',
  843. options: {},
  844. value: '',
  845. detail: {},
  846. srcList: [],
  847. screenForm: {
  848. code: '',
  849. createBy: '',
  850. endCreateTime: '',
  851. endTime1: '',
  852. endTime2: '',
  853. examineBy: '',
  854. remark: '',
  855. startCreateTime: '',
  856. startTime1: '',
  857. startTime2: '',
  858. status: '',
  859. title: '',
  860. type: ''
  861. },
  862. conditionList: [],
  863. custoList: [],
  864. isEdit: 1,
  865. cid: '',
  866. cpolicyId: '',
  867. dataL: [],
  868. clistTotal: 0,
  869. clistTotals: 0,
  870. type: 1,
  871. fileList: [],
  872. importFileList: [],
  873. leftData: [],
  874. rightData: [],
  875. typeOptions: [
  876. {
  877. value: 'PROVISION',
  878. label: '配提'
  879. },
  880. {
  881. value: 'LIMIT',
  882. label: '限量'
  883. }
  884. ],
  885. detailFang: false,
  886. policyList: {
  887. pageNum: 1,
  888. pageSize: 10,
  889. policyId: '',
  890. keyword: '',
  891. currentPages: 1
  892. },
  893. list: [],
  894. cTotal: 1,
  895. clistLoading: false,
  896. visible: false,
  897. maxBuyNumVisible: false,
  898. tableData: [],
  899. tableAttributes: {
  900. selectColumn: true
  901. },
  902. tableEvents: {
  903. 'selection-change': this.selectionChange
  904. },
  905. limitQty: 0,
  906. maxBuyNum: 0,
  907. minBuyNum: 0,
  908. limitQtyKeyWord: '',
  909. buyNumKeyWord: '',
  910. selectedData: [],
  911. batchCurrentPages: 1,
  912. batchPageSizes: 10,
  913. batchTotal: 0,
  914. policyLimitGroupList: [],
  915. policyLoading: false,
  916. policyCurrentPages: 1,
  917. policyPageSize: 10,
  918. policyListTotal: 0,
  919. policyKeyWord: ''
  920. }
  921. },
  922. computed: {
  923. exParams() {
  924. return {
  925. policyId: this.detail.code
  926. }
  927. },
  928. columns() {
  929. return [
  930. {
  931. columnAttributes: {
  932. label: '经销商编码',
  933. prop: 'customerNumber'
  934. }
  935. },
  936. {
  937. columnAttributes: {
  938. label: '经销商名称',
  939. prop: 'customerName'
  940. }
  941. }
  942. ]
  943. }
  944. },
  945. created() {},
  946. methods: {
  947. handleConditionClose() {
  948. this.isEdit = 1
  949. },
  950. funTitle() {
  951. const title = '详情页'
  952. return title
  953. },
  954. handleBack() {
  955. this.isEdit = 1
  956. },
  957. getList() {
  958. this.listLoading = true
  959. getPolicyDetail({ policyId: this.id }).then(res => {
  960. this.detail = res.data
  961. this.detail.flag = this.detail.flag + ''
  962. this.detail.imgSrc = this.detail.imgSrc.split(',')
  963. this.detail.imgSrc.forEach(k => {
  964. this.srcList.push(this.$imageUrl + k)
  965. })
  966. // this.srcList = [this.$imageUrl + this.detail.imgSrc]
  967. if (this.isShow == 5 && this.detail.imgSrc) {
  968. this.fileList = [
  969. {
  970. hover: '',
  971. url: this.detail.imgSrc
  972. }
  973. ]
  974. }
  975. this.handletwoList()
  976. // 获取条件政策
  977. this.getConditionList()
  978. this.getCond()
  979. this.getPolicyList()
  980. this.getPolicyLimitGroupList()
  981. })
  982. },
  983. getPolicyList() {
  984. this.clistLoading = true
  985. getPolicyList({
  986. pageNum: this.policyList.currentPages,
  987. pageSize: this.policyList.pageSize,
  988. policyId: this.id,
  989. keyword: this.policyList.keyword
  990. }).then(res => {
  991. this.list = res.data.records
  992. console.log(this.list, '785787')
  993. this.cTotal = res.data.total
  994. this.clistLoading = false
  995. })
  996. },
  997. // 检查文件类型
  998. checkFileType(url) {
  999. if (!url) return ''
  1000. const fileSuffix = url.substring(url.lastIndexOf('.') + 1)
  1001. if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
  1002. return 'image'
  1003. } else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
  1004. return 'word'
  1005. } else if (['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
  1006. return 'excel'
  1007. } else if (['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
  1008. return 'ppt'
  1009. } else if (['pdf'].includes(fileSuffix)) {
  1010. return 'pdf'
  1011. } else if (['zip', 'rar', 'gz', 'apk'].includes(fileSuffix)) {
  1012. return 'file'
  1013. } else {
  1014. return ''
  1015. }
  1016. },
  1017. openPdf(pdfUrl) {
  1018. window.open(this.$imageUrl + pdfUrl)
  1019. },
  1020. getCrList() {
  1021. const customerParams = {
  1022. pageNum: this.currentPage,
  1023. pageSize: this.pageSize,
  1024. keyword: this.region == 1 || this.region == '' ? '' : this.keyword,
  1025. region: this.region == 1 ? this.keyword : ''
  1026. }
  1027. // 获取经销商列表
  1028. getCrList(customerParams).then(res => {
  1029. for (let j = 0; j < this.custoList.length; j++) {
  1030. for (let i = 0; i < res.data.records.length; i++) {
  1031. if (res.data.records[i].id == this.custoList[j].customerId) {
  1032. res.data.records[i].disabled = true
  1033. }
  1034. }
  1035. }
  1036. this.dataL = res.data.records
  1037. for (let k = 0; k < this.dataL.length; k++) {
  1038. (this.dataL[k].customerId = this.dataL[k].id),
  1039. (this.dataL[k].customerName = this.dataL[k].name),
  1040. (this.dataL[k].customerNumber = this.dataL[k].number)
  1041. }
  1042. console.log(this.dataL, '获取经销商列表')
  1043. this.clistTotal = res.data.total
  1044. })
  1045. },
  1046. // 更改每页数量
  1047. handleSizeChanges(val) {
  1048. this.pageSizes = val
  1049. this.currentPages = 1
  1050. this.getCond()
  1051. },
  1052. // 更改当前页
  1053. handleCurrentChanges(val) {
  1054. this.currentPages = val
  1055. this.getCond()
  1056. },
  1057. // 更改每页数量
  1058. handleSizeChange2(val) {
  1059. this.dpageSize = val
  1060. this.dcurrentPage = 1
  1061. this.handletwoList()
  1062. },
  1063. // 更改当前页
  1064. handleCurrentChange2(val) {
  1065. this.dcurrentPage = val
  1066. this.handletwoList()
  1067. },
  1068. getCommonApi(row) {
  1069. this.isEdit = 2
  1070. this.cid = row.id
  1071. this.cpolicyId = row.policyId
  1072. },
  1073. getCond() {
  1074. this.listLoading = true
  1075. const custoParams = {
  1076. pageNum: this.currentPages,
  1077. pageSize: this.pageSizes,
  1078. policyId: this.detail.code
  1079. }
  1080. getCustomerList(custoParams).then(res => {
  1081. this.custoList = res.data.records
  1082. this.clistTotals = res.data.total
  1083. this.listLoading = false
  1084. this.getCrList()
  1085. })
  1086. },
  1087. handleSubmit() {
  1088. toExamine({
  1089. examineStatus: this.examineStatus,
  1090. policyId: this.id,
  1091. examineRemark: this.remark
  1092. }).then(res => {
  1093. this.$successMsg('已提交审核')
  1094. this.isShow = 1
  1095. this.$emit('close')
  1096. })
  1097. },
  1098. // 获取货品信息
  1099. handletwoList() {
  1100. // this.searchForm.type
  1101. const paramss = {
  1102. pageNum: this.dcurrentPage,
  1103. pageSize: this.dpageSize,
  1104. policyId: this.detail.code,
  1105. saleTypeCode: ''
  1106. }
  1107. getMaterialList(paramss)
  1108. .then(result => {
  1109. this.dataList = result.data.records
  1110. this.dlistTotal = result.data.total
  1111. this.listLoading = false
  1112. })
  1113. .catch(err => {
  1114. console.error(err)
  1115. })
  1116. },
  1117. // 更改每页数量
  1118. handleSizeChanges4(val) {
  1119. this.policyList.pageSizes = val
  1120. this.policyList.currentPages = 1
  1121. this.getPolicyList()
  1122. },
  1123. // 更改当前页
  1124. handleCurrentChanges4(val) {
  1125. this.policyList.currentPages = val
  1126. this.getPolicyList()
  1127. },
  1128. // 导入
  1129. async handleImport(param) {
  1130. this.importLoading = true
  1131. const file = param.file
  1132. console.log(file, 123)
  1133. const formData = new FormData()
  1134. formData.append('file', file)
  1135. formData.append('policyId', this.detail.code)
  1136. // formData.append("mainId", this.detail.mainId);
  1137. const result = await handleImport('/policy/material/import', formData)
  1138. this.importLoading = false
  1139. this.importFileList = []
  1140. if (result.code == 200) {
  1141. this.$alert(result.message, '导入成功', {
  1142. confirmButtonText: '确定'
  1143. })
  1144. this.handletwoList()
  1145. } else {
  1146. this.$alert(result.message, '导入失败', {
  1147. confirmButtonText: '确定'
  1148. })
  1149. }
  1150. },
  1151. handleCondition(id, index) {
  1152. deleteCondition({ id }).then(res => {
  1153. // this.conditionList.splice(index, 1);
  1154. // Object.assign(
  1155. // this.$children[9].$data,
  1156. // this.$children[9].$options.data()
  1157. // );
  1158. this.getConditionList()
  1159. this.$successMsg('删除成功')
  1160. })
  1161. },
  1162. getConditionList() {
  1163. const condParams = {
  1164. policyId: this.detail.code
  1165. }
  1166. getConditionList(condParams).then(res => {
  1167. this.conditionList = res.data
  1168. })
  1169. },
  1170. // 删除
  1171. hanleDelete(id) {
  1172. const params = { policyMaterialId: id }
  1173. deleteMaterialPolicy(params).then(res => {
  1174. this.$successMsg('删除成功')
  1175. this.handletwoList()
  1176. })
  1177. },
  1178. /**
  1179. * 根据条件禁用行复选框
  1180. * 函数返回值为false则禁用选择(反之亦然)
  1181. * @param {Object} row - 行数据
  1182. * @param {String} index - 索引值
  1183. * @return Boolean
  1184. */
  1185. selectable: function(row, index) {
  1186. // row.disabled == undefined 才能被选中
  1187. if (row.disabled == undefined || row.disabled == false) {
  1188. return true
  1189. } else {
  1190. return false
  1191. }
  1192. // 函数必须有返回值且是布尔值
  1193. // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
  1194. // 如果没有返回值则默认返回false(全部无法选中)
  1195. },
  1196. handleSelectionAllChange(e) {
  1197. this.leftData = e
  1198. this.type = 1
  1199. },
  1200. handleSelectionChange(e) {
  1201. this.leftData = e
  1202. this.type = 1
  1203. },
  1204. handleSelectionAllChange2(e) {
  1205. this.rightData = e
  1206. this.type = 2
  1207. },
  1208. handleSelectionChange2(e) {
  1209. this.rightData = e
  1210. this.type = 2
  1211. },
  1212. handleLeft(e) {
  1213. this.type = 1
  1214. },
  1215. handleRight(e) {
  1216. this.type = 2
  1217. },
  1218. handleAllAdd() {
  1219. if (this.type == 1 && this.leftData.length) {
  1220. for (let i = 0; i < this.dataL.length; i++) {
  1221. for (let j = 0; j < this.leftData.length; j++) {
  1222. if (this.dataL[i].id == this.leftData[j].id) {
  1223. this.dataL[i].disabled = true
  1224. }
  1225. }
  1226. }
  1227. this.custoList = [...this.custoList, ...this.leftData]
  1228. this.$refs.multipleTable.clearSelection()
  1229. } else {
  1230. this.$errorMsg('请选择要添加的经销商')
  1231. }
  1232. },
  1233. handleAllDelete() {
  1234. if (this.type == 2 && this.rightData.length) {
  1235. for (let i = 0; i < this.dataL.length; i++) {
  1236. for (let j = 0; j < this.rightData.length; j++) {
  1237. if (this.dataL[i].id == this.rightData[j].customerId) {
  1238. this.$set(this.dataL[i], 'disabled', false)
  1239. }
  1240. }
  1241. }
  1242. const arr = this.resArr(this.custoList, this.rightData)
  1243. this.custoList = arr
  1244. } else {
  1245. this.$errorMsg('请选择要删除的经销商')
  1246. }
  1247. },
  1248. handleAdd() {
  1249. if (this.type == 1 && this.leftData.length) {
  1250. for (let i = 0; i < this.dataL.length; i++) {
  1251. for (let j = 0; j < this.leftData.length; j++) {
  1252. if (this.dataL[i].id == this.leftData[j].id) {
  1253. this.dataL[i].disabled = true
  1254. }
  1255. }
  1256. }
  1257. this.custoList = [...this.custoList, ...this.leftData]
  1258. this.leftData = []
  1259. this.$refs.multipleTable.clearSelection()
  1260. } else {
  1261. this.$errorMsg('请选择要添加的经销商')
  1262. }
  1263. },
  1264. handleDelete() {
  1265. if (this.type == 2 && this.rightData.length) {
  1266. for (let i = 0; i < this.dataL.length; i++) {
  1267. for (let j = 0; j < this.rightData.length; j++) {
  1268. if (this.dataL[i].id == this.rightData[j].customerId) {
  1269. this.$set(this.dataL[i], 'disabled', false)
  1270. }
  1271. }
  1272. }
  1273. const arr = this.resArr(this.custoList, this.rightData)
  1274. this.custoList = arr
  1275. } else {
  1276. this.$errorMsg('请选择要删除的经销商')
  1277. }
  1278. },
  1279. // 去掉相同数据
  1280. resArr(arr1, arr2) {
  1281. return arr1.filter(v => arr2.every(val => val.id != v.id))
  1282. },
  1283. async handleSave() {
  1284. if (this.custoList.length) {
  1285. var arr = []
  1286. this.custoList.forEach(el => {
  1287. arr.push({
  1288. customerId: el.customerId,
  1289. customerName: el.customerName,
  1290. customerNumber: el.customerNumber,
  1291. lastOrderTime: '',
  1292. limitTakeNum: 0,
  1293. policyId: this.detail.code,
  1294. policyTitle: '',
  1295. remark: ''
  1296. })
  1297. })
  1298. const params = {
  1299. ...this.detail,
  1300. policyCustomers: arr,
  1301. imgSrc: this.fileList.length ? this.fileList[0].url : ''
  1302. }
  1303. await updatePolicy(params)
  1304. await this.getCond()
  1305. this.$successMsg('编辑成功')
  1306. this.fileList = []
  1307. this.isShow = 1
  1308. }
  1309. },
  1310. selectionChange(data) {
  1311. this.selectedData = data
  1312. },
  1313. handelBatchData(search) {
  1314. if (search) {
  1315. this.batchCurrentPages = 1
  1316. }
  1317. getPolicyList({
  1318. pageNum: this.batchCurrentPages,
  1319. pageSize: this.batchPageSizes,
  1320. policyId: this.id,
  1321. keyword: this.buyNumKeyWord
  1322. }).then(res => {
  1323. this.tableData = res.data.records
  1324. this.batchTotal = res.data.total
  1325. })
  1326. },
  1327. handelBatchData2() {
  1328. this.maxBuyNumVisible = true
  1329. },
  1330. handleDialogVisible() {
  1331. this.visible = false
  1332. this.maxBuyNumVisible = false
  1333. this.batchCurrentPages = 1
  1334. this.batchPageSizes = 10
  1335. this.limitQty = 0
  1336. this.maxBuyNum = 0
  1337. this.minBuyNum = 0
  1338. this.limitQtyKeyWord = ''
  1339. this.buyNumKeyWord = ''
  1340. },
  1341. onSubmit(type) {
  1342. if (!this.selectedData.length) {
  1343. this.$errorMsg('不能为空,请选择')
  1344. return
  1345. }
  1346. if (this.minBuyNum <= 0) {
  1347. this.$errorMsg('最小起起提数不能小于0')
  1348. return
  1349. }
  1350. const customerIds = this.selectedData
  1351. .map(k => {
  1352. return k.customerId
  1353. })
  1354. .join(',')
  1355. const ids = this.selectedData
  1356. .map(k => {
  1357. return k.id
  1358. })
  1359. .join(',')
  1360. const params = {
  1361. customerIds,
  1362. ids,
  1363. minBuyNum: this.minBuyNum,
  1364. maxBuyNum: this.maxBuyNum
  1365. }
  1366. updateLimitBatchupdate(params).then(res => {
  1367. this.handleDialogVisible()
  1368. this.$successMsg('批量修改成功')
  1369. })
  1370. },
  1371. handleBatchSizeChanges(val) {
  1372. this.batchCurrentPages = 1
  1373. this.batchPageSizes = val
  1374. this.handelBatchData()
  1375. },
  1376. handleBatchCurrentChanges(val) {
  1377. this.batchCurrentPages = val
  1378. this.handelBatchData()
  1379. },
  1380. onReset() {
  1381. this.handleDialogVisible()
  1382. this.handelBatchData()
  1383. },
  1384. getPolicyLimitGroupList() {
  1385. this.policyLoading = true
  1386. getPolicyLimitGroupList({
  1387. pageNum: this.policyCurrentPages,
  1388. pageSize: this.policyPageSize,
  1389. policyId: this.detail.code,
  1390. keyword: this.policyKeyWord
  1391. }).then(res => {
  1392. this.policyLimitGroupList = res.data.records
  1393. this.policyListTotal = res.data.total
  1394. this.policyLoading = false
  1395. })
  1396. },
  1397. handlePolicySizeChanges(val) {
  1398. this.policyCurrentPages = 1
  1399. this.policyPageSize = val
  1400. this.getPolicyLimitGroupList()
  1401. },
  1402. onPolicyReset() {
  1403. this.policyCurrentPages = 1
  1404. this.policyPageSize = 10
  1405. this.policyKeyWord = ''
  1406. this.getPolicyLimitGroupList()
  1407. },
  1408. handlePolicyCurrentChanges(val) {
  1409. this.policyCurrentPages = val
  1410. this.getPolicyLimitGroupList()
  1411. },
  1412. hanleDownloadFilesPolicyLimitGroupPolicy() {
  1413. downloadFiles('policy/limit/group/download')
  1414. },
  1415. async handleImportPolicyLimitGroupPolicy(param) {
  1416. this.importLoading = true
  1417. const file = param.file
  1418. const formData = new FormData()
  1419. formData.append('file', file)
  1420. formData.append('policyId', this.detail.code)
  1421. // formData.append('type', this.policyType)
  1422. // formData.append("mainId", this.searchForm.mainId);
  1423. const result = await handleImport('policy/limit/group/import', formData)
  1424. this.importLoading = false
  1425. this.importFileList = []
  1426. if (result.code === 200) {
  1427. await this.$alert(result.message, '导入成功', {
  1428. confirmButtonText: '确定'
  1429. })
  1430. // this.policyLimitGroupList = result.data
  1431. this.getPolicyLimitGroupList()
  1432. } else {
  1433. await this.$alert(result.message, '导入失败', {
  1434. confirmButtonText: '确定'
  1435. })
  1436. }
  1437. }
  1438. }
  1439. }
  1440. </script>
  1441. <style lang="scss" scoped>
  1442. ::v-deep .elImageClose .el-image-viewer__wrapper span[class='el-image-viewer__btn el-image-viewer__close'] {
  1443. top: 100px;
  1444. }
  1445. .file {
  1446. margin-right: 20px;
  1447. }
  1448. .el-col {
  1449. overflow: hidden;
  1450. }
  1451. .value {
  1452. ::v-deep .el-input__prefix {
  1453. display: none;
  1454. }
  1455. }
  1456. .descriptions {
  1457. // border: #EBEEF5;
  1458. border: 1px solid #ebeef5;
  1459. border-bottom: none;
  1460. .el-row {
  1461. height: 40px;
  1462. line-height: 40px;
  1463. }
  1464. .el-col:nth-child(odd) {
  1465. background-color: #ebeef5;
  1466. }
  1467. .el-col {
  1468. padding: 0 15px;
  1469. height: 100%;
  1470. border-bottom: 1px solid #ebeef5;
  1471. }
  1472. }
  1473. .el-divider--horizontal {
  1474. margin: 20px 0;
  1475. }
  1476. .col {
  1477. height: 100px;
  1478. }
  1479. .import-btn {
  1480. margin-right: 10px;
  1481. display: inline-block;
  1482. }
  1483. ::v-deep .el-input__icon .el-icon-time {
  1484. display: none;
  1485. }
  1486. .middle_box {
  1487. margin-top: 80px;
  1488. text-align: center;
  1489. height: 430px;
  1490. display: flex;
  1491. flex-direction: column;
  1492. align-content: center;
  1493. justify-content: space-between;
  1494. align-items: center;
  1495. }
  1496. .img-box {
  1497. height: 150px;
  1498. display: flex;
  1499. align-items: center;
  1500. }
  1501. </style>