Examine.vue 35 KB

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