Examine.vue 32 KB

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