Examine.vue 31 KB

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