Examine.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117
  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. <el-select v-model="detail.type" size="small" disabled placeholder="销售政策类型" class="select_height">
  15. <el-option
  16. v-for="(item, index) in typeOptions"
  17. :key="index"
  18. :label="item.label"
  19. :value="item.value"
  20. />
  21. </el-select>
  22. </div>
  23. </el-col>
  24. <el-col :span="8" class="item">
  25. <div class="label">状态</div>
  26. <div class="value">
  27. {{ detail.status == 1 ? '已生效' : '未生效' }}
  28. </div>
  29. </el-col>
  30. <el-col :span="24" class="item">
  31. <div class="label">销售政策名称</div>
  32. <div class="value">
  33. <el-input v-model="detail.title" disabled placeholder="请输入政策名称" />
  34. </div>
  35. </el-col>
  36. <el-col :span="24" class="item">
  37. <div class="label">表头备注</div>
  38. <div class="value">
  39. <el-input v-model="detail.remark" disabled placeholder="请输入表头备注" />
  40. </div>
  41. </el-col>
  42. <el-col :span="8" class="item">
  43. <div class="label">制单人</div>
  44. <div class="value">{{ detail.createBy }}</div>
  45. </el-col>
  46. <el-col :span="8" class="item">
  47. <div class="label">制单日期</div>
  48. <div class="value">
  49. <el-date-picker
  50. v-model="detail.createTime"
  51. disabled
  52. type="datetime"
  53. placeholder="制单日期"
  54. default-time="00:00:00"
  55. value-format="yyyy-MM-dd HH:mm:ss"
  56. />
  57. </div>
  58. </el-col>
  59. <el-col :span="8" class="item">
  60. <div class="label">生效日期</div>
  61. <div class="value">
  62. <el-date-picker
  63. v-model="detail.startTime"
  64. disabled
  65. type="datetime"
  66. placeholder="生效日期"
  67. default-time="00:00:00"
  68. value-format="yyyy-MM-dd HH:mm:ss"
  69. />
  70. </div>
  71. </el-col>
  72. <el-col :span="24" class="item">
  73. <div class="label">失效日期</div>
  74. <div class="value">
  75. <el-date-picker
  76. v-model="detail.endTime"
  77. disabled
  78. type="datetime"
  79. placeholder="生效日期"
  80. default-time="00:00:00"
  81. value-format="yyyy-MM-dd HH:mm:ss"
  82. />
  83. </div>
  84. </el-col>
  85. </el-row>
  86. <el-row v-if="detail.imgSrc" class="img-box">
  87. <el-col :span="24" class="item">
  88. <div class="label" style="height: 150px">政策封面图</div>
  89. <div class="value" style="height: 150px">
  90. <template v-for="item in detail.imgSrc">
  91. <el-image
  92. v-if="checkFileType(item) == 'image'"
  93. ref="img"
  94. :src="$imageUrl + item"
  95. style="width: 120px; height: 120px; margin-right: 20px"
  96. fit="cover"
  97. :preview-src-list="[$imageUrl + item]"
  98. class="elImageClose"
  99. />
  100. <img v-if="checkFileType(item) == 'word'" class="file" src="@/assets/common/word.png" />
  101. <img v-if="checkFileType(item) == 'excel'" class="file" src="@/assets/common/excel.png" />
  102. <img v-if="checkFileType(item) == 'ppt'" class="file" src="@/assets/common/ppt.png" />
  103. <img
  104. v-if="checkFileType(item) == 'pdf'"
  105. class="file"
  106. style="cursor: pointer"
  107. src="@/assets/common/pdf.png"
  108. @click="openPdf(item)"
  109. />
  110. <img v-if="checkFileType(item) == 'file'" class="file aaa" src="@/assets/common/zip.jpeg" />
  111. </template>
  112. </div>
  113. </el-col>
  114. </el-row>
  115. <el-row v-if="this.isShow == 4">
  116. <el-col :span="8" class="item">
  117. <div class="label">审核人</div>
  118. <div class="value">{{ detail.examineBy }}</div>
  119. </el-col>
  120. <el-col :span="16" class="item">
  121. <div class="label">审核日期</div>
  122. <div class="value">{{ detail.examineTime }}</div>
  123. </el-col>
  124. <!-- <el-col :span="8" class="item">-->
  125. <!-- <div class="label">关闭人</div>-->
  126. <!-- <div class="value"></div>-->
  127. <!-- </el-col>-->
  128. <!-- <el-col :span="24" class="item">-->
  129. <!-- <div class="label">关闭日期</div>-->
  130. <!-- <div class="value"></div>-->
  131. <!-- </el-col>-->
  132. </el-row>
  133. <el-row>
  134. <el-col :span="12" class="item">
  135. <div class="label">返利使用金额需满额使用</div>
  136. <div class="value">
  137. <el-checkbox v-model="detail.isFullRebate" disabled>{{
  138. detail.isFullRebate ? '是' : '否'
  139. }}</el-checkbox>
  140. </div>
  141. </el-col>
  142. <el-col :span="12" class="item">
  143. <div class="label">商用空调政策</div>
  144. <div class="value">
  145. <el-checkbox v-model="detail.commercialType" disabled>{{
  146. detail.commercialType ? '是' : '否'
  147. }}</el-checkbox>
  148. </div>
  149. </el-col>
  150. </el-row>
  151. </div>
  152. <div class="mymain-container">
  153. <el-row>
  154. <el-divider />
  155. <el-row type="flex">
  156. <el-col :span="12">
  157. <h4 style="display: inline-block; margin-right: 20px">货品信息</h4>
  158. <ExportButton
  159. v-if="isShow === 4"
  160. style="display: inline-block"
  161. :ex-url="'policy/material/export'"
  162. ex-text="导出货品"
  163. :ex-params="{ policyId: detail.code }"
  164. />
  165. </el-col>
  166. <el-col :span="12" class="tr">
  167. <!-- <el-button size="small" @click="$parent.isShow = 10"
  168. >查看条件</el-button
  169. > -->
  170. </el-col>
  171. </el-row>
  172. <el-divider />
  173. </el-row>
  174. <el-table
  175. v-loading="listLoading"
  176. :data="dataList"
  177. element-loading-text="Loading"
  178. border
  179. max-height="700"
  180. fit
  181. highlight-current-row
  182. stripe
  183. >
  184. <el-table-column fixed type="index" label="序号" width="50" align="left" />
  185. <el-table-column prop="materialNumber" label="物料编码" min-width="160" show-overflow-tooltip align="left">
  186. <template slot-scope="scope">
  187. <CopyButton :copy-text="scope.row.materialNumber" />
  188. <span>{{ scope.row.materialNumber }}</span>
  189. </template>
  190. </el-table-column>
  191. <el-table-column prop="materialName" label="产品名称" min-width="160" show-overflow-tooltip align="left">
  192. <template slot-scope="scope">
  193. <CopyButton :copy-text="scope.row.materialName" />
  194. <span>{{ scope.row.materialName }}</span>
  195. </template>
  196. </el-table-column>
  197. <el-table-column prop="specification" label="规格型号" min-width="300" show-overflow-tooltip align="left">
  198. <template slot-scope="scope">
  199. <CopyButton :copy-text="scope.row.specification" />
  200. <span>{{ scope.row.specification }}</span>
  201. </template>
  202. </el-table-column>
  203. <el-table-column
  204. prop="saleTypeCode"
  205. label="销售类型编码"
  206. min-width="160"
  207. show-overflow-tooltip
  208. align="left"
  209. />
  210. <el-table-column prop="saleTypeName" label="销售类型" min-width="160" show-overflow-tooltip align="left" />
  211. <el-table-column prop="discAmount" label="格力折扣" align="right" />
  212. <el-table-column prop="price" label="单价" align="right" />
  213. <el-table-column prop="orgPrice" label="原供价" align="right" min-width="150">
  214. <template slot-scope="scope">
  215. {{ scope.row.orgPrice }}
  216. </template>
  217. </el-table-column>
  218. <el-table-column prop="priceType" label="价格类型" align="left" min-width="150">
  219. <template slot-scope="scope">
  220. {{ scope.row.priceType }}
  221. </template>
  222. </el-table-column>
  223. <el-table-column label="返利钱包" align="left" min-width="200" show-overflow-tooltip>
  224. <template slot-scope="scope">
  225. <template v-for="item in scope.row.walletRelaList">
  226. <el-tag v-if="item.type === 'REBATE'" style="margin: 5px" type="success" size="small">{{
  227. item.walletName
  228. }}</el-tag>
  229. </template>
  230. </template>
  231. </el-table-column>
  232. <el-table-column label="现金钱包" align="left" min-width="200" show-overflow-tooltip>
  233. <template slot-scope="scope">
  234. <template v-for="item in scope.row.walletRelaList">
  235. <el-tag v-if="item.type === 'COMMONLY'" style="margin: 5px" type="success" size="small">{{
  236. item.walletName
  237. }}</el-tag>
  238. </template>
  239. </template>
  240. </el-table-column>
  241. <el-table-column prop="status" label="状态" align="left" show-overflow-tooltip min-width="150">
  242. <template slot-scope="scope">
  243. {{ scope.row.status ? '启用' : '作废' }}
  244. </template>
  245. </el-table-column>
  246. </el-table>
  247. <!-- 分页 -->
  248. <div style="margin: 20px 0">
  249. <el-pagination
  250. :current-page="dcurrentPage"
  251. :page-sizes="[10, 20, 30, 50]"
  252. :page-size="10"
  253. layout="total, sizes, prev, pager, next, jumper"
  254. :total="dlistTotal"
  255. @size-change="handleSizeChange2"
  256. @current-change="handleCurrentChange2"
  257. />
  258. </div>
  259. <el-row>
  260. <el-divider />
  261. <el-row type="flex">
  262. <el-col :span="12">
  263. <h4 style="display: inline-block; margin-right: 20px">条件信息</h4>
  264. </el-col>
  265. </el-row>
  266. <el-divider />
  267. </el-row>
  268. <el-table :data="conditionList" element-loading-text="Loading" border fit highlight-current-row stripe>
  269. <el-table-column fixed type="index" label="序号" width="50" align="left" />
  270. <el-table-column prop="name" label="限定条件" align="left">
  271. <template slot-scope="scope">
  272. {{ scope.row.name }}
  273. </template>
  274. </el-table-column>
  275. <el-table-column label="操作" align="left" width="150">
  276. <template slot-scope="scope">
  277. <el-button type="text" size="small" @click="getCommonApi(scope.row)">查看条件</el-button>
  278. </template>
  279. </el-table-column>
  280. </el-table>
  281. <el-row>
  282. <el-divider />
  283. <el-row type="flex">
  284. <el-col :span="12">
  285. <h4 style="display: inline-block; margin-right: 20px">经销商使用范围</h4>
  286. <template v-if="detail.flag == 0">
  287. <ExportButton
  288. v-if="isShow === 4"
  289. style="display: inline-block"
  290. :ex-url="'policy/customer/export'"
  291. ex-text="导出经销商"
  292. :ex-params="{ policyId: detail.code }"
  293. />
  294. </template>
  295. </el-col>
  296. </el-row>
  297. <el-divider />
  298. </el-row>
  299. <div style="margin-bottom: 20px">
  300. <el-radio-group v-model="detail.flag">
  301. <el-radio :label="0" :disabled="detail.flag != 0">指定经销商</el-radio>
  302. <el-radio :label="1" :disabled="detail.flag != 1">广州经销商</el-radio>
  303. <el-radio :label="2" :disabled="detail.flag != 2">佛山经销商</el-radio>
  304. </el-radio-group>
  305. </div>
  306. <template v-if="isShow != 5">
  307. <template v-if="detail.flag == 0">
  308. <el-table
  309. v-loading="listLoading"
  310. :data="custoList"
  311. element-loading-text="Loading"
  312. border
  313. fit
  314. highlight-current-row
  315. stripe
  316. >
  317. <el-table-column fixed type="index" label="序号" width="50" align="left" />
  318. <el-table-column prop="customerNumber" label="经销商编码" align="left">
  319. <template slot-scope="scope">
  320. <CopyButton :copy-text="scope.row.customerNumber" />
  321. <span>{{ scope.row.customerNumber }}</span>
  322. </template></el-table-column
  323. >
  324. <el-table-column prop="customerName" label="经销商名称" align="left">
  325. <template slot-scope="scope">
  326. <CopyButton :copy-text="scope.row.customerName" />
  327. <span>{{ scope.row.customerName }}</span>
  328. </template>
  329. </el-table-column>
  330. </el-table>
  331. <!-- 分页 -->
  332. <div style="margin: 20px 0">
  333. <el-pagination
  334. :current-page="currentPages"
  335. :page-sizes="[10, 20, 30, 50]"
  336. :page-size="10"
  337. layout="total, sizes, prev, pager, next, jumper"
  338. :total="clistTotals"
  339. @size-change="handleSizeChanges"
  340. @current-change="handleCurrentChanges"
  341. />
  342. </div>
  343. </template>
  344. </template>
  345. <template v-else>
  346. <el-row :gutter="20">
  347. <el-col :span="10" :offset="0">
  348. <h5>未选经销商</h5>
  349. <el-divider direction="horizontal" content-position="left" />
  350. <el-table
  351. ref="multipleTable"
  352. :data="dataL"
  353. element-loading-text="Loading"
  354. border
  355. height="480px"
  356. fit
  357. highlight-current-row
  358. @select-all="handleSelectionAllChange"
  359. @selection-change="handleSelectionChange"
  360. >
  361. <el-table-column type="selection" width="55" :selectable="selectable" align="left" />
  362. <el-table-column prop="number" label="经销商编码" align="left">
  363. <template slot-scope="scope">
  364. <CopyButton :copy-text="scope.row.number" />
  365. <span>{{ scope.row.number }}</span>
  366. </template>
  367. </el-table-column>
  368. <el-table-column prop="name" label="经销商名称" align="left">
  369. <template slot-scope="scope">
  370. <CopyButton :copy-text="scope.row.name" />
  371. <span>{{ scope.row.name }}</span>
  372. </template>
  373. </el-table-column>
  374. </el-table>
  375. <!-- 分页 -->
  376. <div style="margin: 20px 0">
  377. <el-pagination
  378. :current-page="currentPages"
  379. :page-sizes="[10, 20, 30, 50]"
  380. :page-size="10"
  381. layout="total, sizes, prev, pager, next, jumper"
  382. :total="clistTotal"
  383. @size-change="handleSizeChanges"
  384. @current-change="handleCurrentChanges"
  385. />
  386. </div>
  387. </el-col>
  388. <el-col :span="4" class="middle_box" :offset="0">
  389. <el-col>
  390. <el-button size="small" :disabled="type == 2" @click="handleAllAdd">全部添加</el-button></el-col
  391. >
  392. <el-col> <el-button size="small" :disabled="type == 2" @click="handleAdd">增加</el-button></el-col>
  393. <el-col> <el-button size="small" :disabled="type == 1" @click="handleDelete">删除</el-button></el-col>
  394. <el-col>
  395. <el-button size="small" :disabled="type == 1" @click="handleAllDelete">全部删除</el-button></el-col
  396. >
  397. </el-col>
  398. <el-col :span="10" :offset="0">
  399. <h5>已选经销商</h5>
  400. <el-divider direction="horizontal" content-position="left" />
  401. <el-table
  402. v-loading="listLoading"
  403. :data="custoList"
  404. element-loading-text="Loading"
  405. border
  406. height="480px"
  407. fit
  408. highlight-current-row
  409. stripe
  410. @select-all="handleSelectionAllChange2"
  411. @selection-change="handleSelectionChange2"
  412. >
  413. <el-table-column type="selection" width="55" align="left" />
  414. <el-table-column prop="customerNumber" label="经销商编码" align="left">
  415. <template slot-scope="scope">
  416. <CopyButton :copy-text="scope.row.customerNumber" />
  417. <span>{{ scope.row.customerNumber }}</span>
  418. </template>
  419. </el-table-column>
  420. <el-table-column prop="customerName" label="经销商名称" align="left">
  421. <template slot-scope="scope">
  422. <CopyButton :copy-text="scope.row.customerName" />
  423. <span>{{ scope.row.customerName }}</span>
  424. </template>
  425. </el-table-column>
  426. </el-table>
  427. <!-- 分页 -->
  428. <!-- <div style="margin: 20px 0">
  429. <el-pagination
  430. @size-change="handleSizeChanges"
  431. @current-change="handleCurrentChanges"
  432. :current-page="currentPages"
  433. :page-sizes="[10, 20, 30, 50]"
  434. :page-size="10"
  435. layout="total, sizes, prev, pager, next, jumper"
  436. :total="clistTotals"
  437. >
  438. </el-pagination>
  439. </div> -->
  440. </el-col>
  441. </el-row>
  442. </template>
  443. <div>
  444. <h4 style="display: inline-block; margin-right: 20px">经销商上限</h4>
  445. <el-divider />
  446. </div>
  447. <div>
  448. <div class="table">
  449. <el-table
  450. v-loading="clistLoading"
  451. :data="list"
  452. element-loading-text="Loading"
  453. border
  454. fit
  455. highlight-current-row
  456. stripe
  457. @select-all="handleSelectionAllChange2"
  458. @selection-change="handleSelectionChange2"
  459. >
  460. <!-- <el-table-column type="selection" width="55" align="left" /> -->
  461. <el-table-column
  462. prop="customerNumber"
  463. label="经销商编号
  464. "
  465. align="left"
  466. >
  467. <template slot-scope="scope">
  468. <CopyButton :copy-text="scope.row.customerNumber" />
  469. <span>{{ scope.row.customerNumber }}</span>
  470. </template>
  471. </el-table-column>
  472. <el-table-column prop="customerName" label="经销商名称" align="left">
  473. <template slot-scope="scope">
  474. <CopyButton :copy-text="scope.row.customerName" />
  475. <span>{{ scope.row.customerName }}</span>
  476. </template>
  477. </el-table-column>
  478. <el-table-column
  479. prop="materialName"
  480. label="物料名称
  481. "
  482. align="left"
  483. >
  484. <template slot-scope="scope">
  485. <CopyButton :copy-text="scope.row.materialName" />
  486. <span>{{ scope.row.materialName }}</span>
  487. </template>
  488. </el-table-column>
  489. <el-table-column
  490. prop="materialNumber"
  491. label="物料编号
  492. "
  493. align="left"
  494. >
  495. <template slot-scope="scope">
  496. <CopyButton :copy-text="scope.row.materialNumber" />
  497. <span>{{ scope.row.materialNumber }}</span>
  498. </template>
  499. </el-table-column>
  500. <el-table-column
  501. prop="examineOrderNums"
  502. label="已审订单数
  503. "
  504. align="left"
  505. >
  506. <template slot-scope="scope">
  507. {{ scope.row.examineOrderNums | numToFixed }}
  508. </template>
  509. </el-table-column>
  510. <el-table-column
  511. prop="limitQty"
  512. label="购买量上限
  513. "
  514. align="left"
  515. >
  516. <template slot-scope="scope">
  517. {{ scope.row.limitQty | numToFixed }}
  518. </template>
  519. </el-table-column>
  520. </el-table>
  521. </div>
  522. <!-- 分页 -->
  523. <div style="margin: 20px 0">
  524. <el-pagination
  525. :current-page="policyList.currentPages"
  526. :page-sizes="[10, 20, 30, 50]"
  527. :page-size="10"
  528. layout="total, sizes, prev, pager, next, jumper"
  529. :total="cTotal"
  530. @size-change="handleSizeChanges4"
  531. @current-change="handleCurrentChanges4"
  532. />
  533. </div>
  534. </div>
  535. <div v-if="isShow == 5 && detail.examineStatus == 'WAIT'" class="descriptions diy-table-1">
  536. <el-row>
  537. <el-col :span="6">审核人</el-col>
  538. <el-col :span="6">{{ $store.getters.name }}</el-col>
  539. <el-col :span="6">审核结果</el-col>
  540. <el-col :span="6">
  541. <template>
  542. <el-radio-group v-model="examineStatus">
  543. <el-radio :label="'OK'">通过</el-radio>
  544. <el-radio :label="'FAIL'">驳回</el-radio>
  545. </el-radio-group>
  546. </template>
  547. </el-col>
  548. </el-row>
  549. <el-row class="item">
  550. <el-col :span="4">审批说明</el-col>
  551. <el-col :span="20" class="col value" style="padding-left: 10px">
  552. <el-input v-model="remark" size="small" placeholder="请输入内容" />
  553. </el-col>
  554. </el-row>
  555. <el-row>
  556. <el-button type="primary" size="small" @click="handleSubmit">审核</el-button>
  557. </el-row>
  558. </div>
  559. </div>
  560. </div>
  561. </div>
  562. <AddCondition v-else :id="cid" @close="handleConditionClose" />
  563. </div>
  564. </template>
  565. <script>
  566. import {
  567. deleteCondition,
  568. deleteMaterialPolicy,
  569. getConditionList,
  570. getCrList,
  571. getCustomerList,
  572. getMaterialList,
  573. getPolicyDetail,
  574. toExamine,
  575. updatePolicy,
  576. getPolicyList
  577. } from '@/api/policy_list'
  578. import AddCondition from './AddCondition'
  579. import ImageUpload from '@/components/Common/image-upload.vue'
  580. import { handleImport } from '@/utils/util'
  581. import Minxin from '@/mixin'
  582. export default {
  583. name: 'Examine',
  584. props: {
  585. id: {
  586. type: String,
  587. default: ''
  588. },
  589. isShow: {
  590. type: Number
  591. }
  592. },
  593. components: {
  594. AddCondition,
  595. ImageUpload
  596. },
  597. mixins: [Minxin],
  598. data() {
  599. return {
  600. baseURL: '',
  601. dcurrentPage: 1,
  602. dpageSize: 10,
  603. dlistTotal: 0,
  604. currentPages: 1, // 当前页码
  605. pageSizes: 10, // 每页数量
  606. clistTotal: 0,
  607. input: '',
  608. remark: '',
  609. fileList: [],
  610. listLoading: false,
  611. imageUrl: '',
  612. dataList: [],
  613. examineStatus: 'OK',
  614. options: {},
  615. value: '',
  616. detail: {},
  617. srcList: [],
  618. screenForm: {
  619. code: '',
  620. createBy: '',
  621. endCreateTime: '',
  622. endTime1: '',
  623. endTime2: '',
  624. examineBy: '',
  625. remark: '',
  626. startCreateTime: '',
  627. startTime1: '',
  628. startTime2: '',
  629. status: '',
  630. title: '',
  631. type: ''
  632. },
  633. conditionList: [],
  634. custoList: [],
  635. isEdit: 1,
  636. cid: '',
  637. cpolicyId: '',
  638. dataL: [],
  639. clistTotal: 0,
  640. clistTotals: 0,
  641. type: 1,
  642. fileList: [],
  643. importFileList: [],
  644. leftData: [],
  645. rightData: [],
  646. typeOptions: [
  647. {
  648. value: 'PROVISION',
  649. label: '配提'
  650. },
  651. {
  652. value: 'LIMIT',
  653. label: '限量'
  654. }
  655. ],
  656. detailFang: false,
  657. policyList: {
  658. pageNum: 1,
  659. pageSize: 10,
  660. policyId: '',
  661. keyword: '',
  662. currentPages: 1
  663. },
  664. list: [],
  665. cTotal: 1,
  666. clistLoading: false
  667. }
  668. },
  669. computed: {
  670. comTitle() {
  671. let title = '详情页'
  672. if (this.isShow == 5) {
  673. title = '编辑页'
  674. } else if (this.isShow == 8 && !this.detailFang) {
  675. title = '审核页'
  676. } else {
  677. title = '详情页'
  678. }
  679. return title
  680. }
  681. },
  682. created() {},
  683. methods: {
  684. handleConditionClose() {
  685. this.isEdit = 1
  686. },
  687. getList() {
  688. this.listLoading = true
  689. getPolicyDetail({ policyId: this.id }).then(res => {
  690. this.detail = res.data
  691. this.detail.imgSrc = this.detail.imgSrc.split(',')
  692. this.detail.imgSrc.forEach(k => {
  693. this.srcList.push(this.$imageUrl + k)
  694. })
  695. if (this.isShow == 5 && this.detail.imgSrc) {
  696. this.fileList = [
  697. {
  698. hover: '',
  699. url: this.detail.imgSrc
  700. }
  701. ]
  702. }
  703. this.handletwoList()
  704. // 获取条件政策
  705. this.getConditionList()
  706. this.getCond()
  707. this.getPolicyList()
  708. })
  709. },
  710. getPolicyList() {
  711. this.clistLoading = true
  712. getPolicyList({
  713. pageNum: this.policyList.currentPages,
  714. pageSize: this.policyList.pageSize,
  715. policyId: this.id,
  716. keyword: this.policyList.keyword
  717. }).then(res => {
  718. this.list = res.data.records
  719. this.cTotal = res.data.total
  720. this.clistLoading = false
  721. })
  722. },
  723. // 更改每页数量
  724. handleSizeChanges4(val) {
  725. this.policyList.pageSizes = val
  726. this.policyList.currentPages = 1
  727. this.getPolicyList()
  728. },
  729. // 更改当前页
  730. handleCurrentChanges4(val) {
  731. this.policyList.currentPages = val
  732. this.getPolicyList()
  733. },
  734. getCrList() {
  735. const customerParams = {
  736. pageNum: this.currentPage,
  737. pageSize: this.pageSize,
  738. keyword: this.region == 1 || this.region == '' ? '' : this.keyword,
  739. region: this.region == 1 ? this.keyword : ''
  740. }
  741. // 获取经销商列表
  742. getCrList(customerParams).then(res => {
  743. for (let j = 0; j < this.custoList.length; j++) {
  744. for (let i = 0; i < res.data.records.length; i++) {
  745. if (res.data.records[i].id == this.custoList[j].customerId) {
  746. res.data.records[i].disabled = true
  747. }
  748. }
  749. }
  750. this.dataL = res.data.records
  751. for (let k = 0; k < this.dataL.length; k++) {
  752. ;(this.dataL[k].customerId = this.dataL[k].id),
  753. (this.dataL[k].customerName = this.dataL[k].name),
  754. (this.dataL[k].customerNumber = this.dataL[k].number)
  755. }
  756. console.log(this.dataL, '获取经销商列表')
  757. this.clistTotal = res.data.total
  758. })
  759. },
  760. // 更改每页数量
  761. handleSizeChanges(val) {
  762. this.pageSizes = val
  763. this.currentPages = 1
  764. this.getCond()
  765. },
  766. // 检查文件类型
  767. checkFileType(url) {
  768. if (!url) return ''
  769. const fileSuffix = url.substring(url.lastIndexOf('.') + 1)
  770. if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
  771. return 'image'
  772. } else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
  773. return 'word'
  774. } else if (['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
  775. return 'excel'
  776. } else if (['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
  777. return 'ppt'
  778. } else if (['pdf'].includes(fileSuffix)) {
  779. return 'pdf'
  780. } else if (['zip', 'rar', 'gz', 'apk'].includes(fileSuffix)) {
  781. return 'file'
  782. } else {
  783. return ''
  784. }
  785. },
  786. openPdf(pdfUrl) {
  787. window.open(this.$imageUrl + pdfUrl)
  788. },
  789. // 更改当前页
  790. handleCurrentChanges(val) {
  791. this.currentPages = val
  792. this.getCond()
  793. },
  794. // 更改每页数量
  795. handleSizeChange2(val) {
  796. this.dpageSize = val
  797. this.dcurrentPage = 1
  798. this.handletwoList()
  799. },
  800. // 更改当前页
  801. handleCurrentChange2(val) {
  802. this.dcurrentPage = val
  803. this.handletwoList()
  804. },
  805. getCommonApi(row) {
  806. this.isEdit = 2
  807. this.cid = row.id
  808. this.cpolicyId = row.policyId
  809. },
  810. getCond() {
  811. this.listLoading = true
  812. const custoParams = {
  813. pageNum: this.currentPages,
  814. pageSize: this.pageSizes,
  815. policyId: this.detail.code
  816. }
  817. getCustomerList(custoParams).then(res => {
  818. this.custoList = res.data.records
  819. this.clistTotals = res.data.total
  820. this.listLoading = false
  821. this.getCrList()
  822. })
  823. },
  824. handleSubmit() {
  825. toExamine({
  826. examineStatus: this.examineStatus,
  827. policyId: this.id,
  828. examineRemark: this.remark
  829. }).then(res => {
  830. this.$successMsg('已提交审核')
  831. this.$emit('close')
  832. })
  833. },
  834. // 获取货品信息
  835. handletwoList() {
  836. // this.searchForm.type
  837. const paramss = {
  838. pageNum: this.dcurrentPage,
  839. pageSize: this.dpageSize,
  840. policyId: this.detail.code,
  841. saleTypeCode: ''
  842. }
  843. getMaterialList(paramss)
  844. .then(result => {
  845. this.dataList = result.data.records
  846. this.dlistTotal = result.data.total
  847. this.listLoading = false
  848. })
  849. .catch(err => {
  850. console.error(err)
  851. })
  852. },
  853. // 导入
  854. async handleImport(param) {
  855. this.importLoading = true
  856. const file = param.file
  857. console.log(file, 123)
  858. const formData = new FormData()
  859. formData.append('file', file)
  860. formData.append('policyId', this.detail.code)
  861. // formData.append("mainId", this.detail.mainId);
  862. const result = await handleImport('/policy/material/import', formData)
  863. this.importLoading = false
  864. this.importFileList = []
  865. if (result.code == 200) {
  866. this.$alert(result.message, '导入成功', {
  867. confirmButtonText: '确定'
  868. })
  869. this.handletwoList()
  870. } else {
  871. this.$alert(result.message, '导入失败', {
  872. confirmButtonText: '确定'
  873. })
  874. }
  875. },
  876. handleCondition(id, index) {
  877. deleteCondition({ id }).then(res => {
  878. // this.conditionList.splice(index, 1);
  879. // Object.assign(
  880. // this.$children[9].$data,
  881. // this.$children[9].$options.data()
  882. // );
  883. this.getConditionList()
  884. this.$successMsg('删除成功')
  885. })
  886. },
  887. getConditionList() {
  888. const condParams = {
  889. policyId: this.detail.code
  890. }
  891. getConditionList(condParams).then(res => {
  892. this.conditionList = res.data
  893. })
  894. },
  895. // 删除
  896. hanleDelete(id) {
  897. const params = { policyMaterialId: id }
  898. deleteMaterialPolicy(params).then(res => {
  899. this.$successMsg('删除成功')
  900. this.handletwoList()
  901. })
  902. },
  903. /**
  904. * 根据条件禁用行复选框
  905. * 函数返回值为false则禁用选择(反之亦然)
  906. * @param {Object} row - 行数据
  907. * @param {String} index - 索引值
  908. * @return Boolean
  909. */
  910. selectable: function (row, index) {
  911. // row.disabled == undefined 才能被选中
  912. if (row.disabled == undefined || row.disabled == false) {
  913. return true
  914. } else {
  915. return false
  916. }
  917. // 函数必须有返回值且是布尔值
  918. // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
  919. // 如果没有返回值则默认返回false(全部无法选中)
  920. },
  921. handleSelectionAllChange(e) {
  922. this.leftData = e
  923. this.type = 1
  924. },
  925. handleSelectionChange(e) {
  926. this.leftData = e
  927. this.type = 1
  928. },
  929. handleSelectionAllChange2(e) {
  930. this.rightData = e
  931. this.type = 2
  932. },
  933. handleSelectionChange2(e) {
  934. this.rightData = e
  935. this.type = 2
  936. },
  937. handleLeft(e) {
  938. this.type = 1
  939. },
  940. handleRight(e) {
  941. this.type = 2
  942. },
  943. handleAllAdd() {
  944. if (this.type == 1 && this.leftData.length) {
  945. for (let i = 0; i < this.dataL.length; i++) {
  946. for (let j = 0; j < this.leftData.length; j++) {
  947. if (this.dataL[i].id == this.leftData[j].id) {
  948. this.dataL[i].disabled = true
  949. }
  950. }
  951. }
  952. this.custoList = [...this.custoList, ...this.leftData]
  953. this.$refs.multipleTable.clearSelection()
  954. } else {
  955. this.$errorMsg('请选择要添加的经销商')
  956. }
  957. },
  958. handleAllDelete() {
  959. if (this.type == 2 && this.rightData.length) {
  960. for (let i = 0; i < this.dataL.length; i++) {
  961. for (let j = 0; j < this.rightData.length; j++) {
  962. if (this.dataL[i].id == this.rightData[j].customerId) {
  963. this.$set(this.dataL[i], 'disabled', false)
  964. }
  965. }
  966. }
  967. const arr = this.resArr(this.custoList, this.rightData)
  968. this.custoList = arr
  969. } else {
  970. this.$errorMsg('请选择要删除的经销商')
  971. }
  972. },
  973. handleAdd() {
  974. if (this.type == 1 && this.leftData.length) {
  975. for (let i = 0; i < this.dataL.length; i++) {
  976. for (let j = 0; j < this.leftData.length; j++) {
  977. if (this.dataL[i].id == this.leftData[j].id) {
  978. this.dataL[i].disabled = true
  979. }
  980. }
  981. }
  982. this.custoList = [...this.custoList, ...this.leftData]
  983. this.leftData = []
  984. this.$refs.multipleTable.clearSelection()
  985. } else {
  986. this.$errorMsg('请选择要添加的经销商')
  987. }
  988. },
  989. handleDelete() {
  990. if (this.type == 2 && this.rightData.length) {
  991. for (let i = 0; i < this.dataL.length; i++) {
  992. for (let j = 0; j < this.rightData.length; j++) {
  993. if (this.dataL[i].id == this.rightData[j].customerId) {
  994. this.$set(this.dataL[i], 'disabled', false)
  995. }
  996. }
  997. }
  998. const arr = this.resArr(this.custoList, this.rightData)
  999. this.custoList = arr
  1000. } else {
  1001. this.$errorMsg('请选择要删除的经销商')
  1002. }
  1003. },
  1004. // 去掉相同数据
  1005. resArr(arr1, arr2) {
  1006. return arr1.filter(v => arr2.every(val => val.id != v.id))
  1007. },
  1008. async handleSave() {
  1009. if (this.custoList.length) {
  1010. var arr = []
  1011. this.custoList.forEach(el => {
  1012. arr.push({
  1013. customerId: el.customerId,
  1014. customerName: el.customerName,
  1015. customerNumber: el.customerNumber,
  1016. lastOrderTime: '',
  1017. limitTakeNum: 0,
  1018. policyId: this.detail.code,
  1019. policyTitle: '',
  1020. remark: ''
  1021. })
  1022. })
  1023. const params = {
  1024. ...this.detail,
  1025. policyCustomers: arr,
  1026. imgSrc: this.fileList.length ? this.fileList[0].url : ''
  1027. }
  1028. await updatePolicy(params)
  1029. await this.getCond()
  1030. this.$successMsg('编辑成功')
  1031. this.fileList = []
  1032. this.isShow = 1
  1033. }
  1034. }
  1035. }
  1036. }
  1037. </script>
  1038. <style lang="scss" scoped>
  1039. ::v-deep .elImageClose .el-image-viewer__wrapper span[class='el-image-viewer__btn el-image-viewer__close'] {
  1040. top: 100px;
  1041. }
  1042. .el-col {
  1043. overflow: hidden;
  1044. }
  1045. .value {
  1046. ::v-deep .el-input__prefix {
  1047. display: none;
  1048. }
  1049. }
  1050. .descriptions {
  1051. // border: #EBEEF5;
  1052. border: 1px solid #ebeef5;
  1053. border-bottom: none;
  1054. .el-row {
  1055. height: 40px;
  1056. line-height: 40px;
  1057. }
  1058. .el-col:nth-child(odd) {
  1059. background-color: #ebeef5;
  1060. }
  1061. .el-col {
  1062. padding: 0 15px;
  1063. height: 100%;
  1064. border-bottom: 1px solid #ebeef5;
  1065. }
  1066. }
  1067. .el-divider--horizontal {
  1068. margin: 20px 0;
  1069. }
  1070. .col {
  1071. height: 100px;
  1072. }
  1073. .import-btn {
  1074. margin-right: 10px;
  1075. display: inline-block;
  1076. }
  1077. ::v-deep .el-input__icon .el-icon-time {
  1078. display: none;
  1079. }
  1080. .middle_box {
  1081. margin-top: 80px;
  1082. text-align: center;
  1083. height: 430px;
  1084. display: flex;
  1085. flex-direction: column;
  1086. align-content: center;
  1087. justify-content: space-between;
  1088. align-items: center;
  1089. }
  1090. .img-box {
  1091. height: 150px;
  1092. display: flex;
  1093. align-items: center;
  1094. }
  1095. </style>