apply_list.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065
  1. <template>
  2. <div class="app-container">
  3. <div
  4. v-show="
  5. !isShowDetail && !isShowExamine && !isShowForm && !isShowReturnForm
  6. "
  7. >
  8. <!-- 筛选条件 -->
  9. <div class="screen-container">
  10. <el-form
  11. ref="screenForm"
  12. :model="screenForm"
  13. label-width="100px"
  14. size="mini"
  15. label-position="left"
  16. >
  17. <el-row :gutter="20">
  18. <el-col :xs="24" :sm="24" :lg="24">
  19. <el-form-item prop="status" label-width="0">
  20. <el-radio-group v-model="screenForm.status" @change="getList()">
  21. <el-radio-button label="">全部</el-radio-button>
  22. <el-radio-button
  23. v-for="(item, index) in statusList"
  24. :key="index"
  25. :label="item.value"
  26. >{{ item.label }}</el-radio-button
  27. >
  28. </el-radio-group>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :xs="24" :sm="12" :lg="6">
  32. <el-form-item label="发货申请单" prop="orderNum">
  33. <el-input
  34. v-model="screenForm.orderNum"
  35. placeholder="请输入发货申请单"
  36. />
  37. </el-form-item>
  38. </el-col>
  39. <el-col :xs="24" :sm="12" :lg="6">
  40. <el-form-item label="仓库名称" prop="warehouse">
  41. <el-input
  42. v-model="screenForm.warehouse"
  43. placeholder="请输入仓库名称"
  44. />
  45. </el-form-item>
  46. </el-col>
  47. <el-col :xs="24" :sm="12" :lg="6">
  48. <el-form-item label="经销商编码" prop="jxsNum">
  49. <el-input
  50. v-model="screenForm.jxsNum"
  51. placeholder="请输入经销商编码"
  52. />
  53. </el-form-item>
  54. </el-col>
  55. <el-col :xs="24" :sm="12" :lg="6">
  56. <el-form-item label="经销商名称" prop="jxsName">
  57. <el-input
  58. v-model="screenForm.jxsName"
  59. placeholder="请输入经销商名称"
  60. />
  61. </el-form-item>
  62. </el-col>
  63. <el-col :xs="24" :sm="12" :lg="6">
  64. <el-form-item label="发货申请日期" prop="date">
  65. <el-date-picker
  66. v-model="screenForm.date"
  67. type="datetimerange"
  68. range-separator="至"
  69. style="width: 100%"
  70. value-format="yyyy-MM-dd HH:mm:ss"
  71. start-placeholder="开始日期"
  72. end-placeholder="结束日期"
  73. />
  74. </el-form-item>
  75. </el-col>
  76. <el-col :xs="24" :sm="12" :lg="6">
  77. <el-form-item label="产品名称" prop="chName">
  78. <el-input
  79. v-model="screenForm.chName"
  80. placeholder="请输入产品名称"
  81. />
  82. </el-form-item>
  83. </el-col>
  84. <el-col :xs="24" :sm="12" :lg="6">
  85. <el-form-item label="规格型号" prop="model">
  86. <el-input
  87. v-model="screenForm.model"
  88. placeholder="请输入规格型号"
  89. />
  90. </el-form-item>
  91. </el-col>
  92. <el-col :xs="24" :sm="12" :lg="6">
  93. <el-form-item label="表头业务员" prop="k3ServiceId">
  94. <el-select
  95. v-model="screenForm.k3ServiceId"
  96. placeholder="选择表头业务员"
  97. size="small"
  98. clearable
  99. filterable
  100. style="width: 100%"
  101. >
  102. <el-option
  103. v-for="item in salesmanList"
  104. :key="item.adminUserId"
  105. :label="item.nickName"
  106. :value="item.adminUserId"
  107. />
  108. </el-select>
  109. </el-form-item>
  110. </el-col>
  111. <el-col :xs="24" :sm="12" :lg="6">
  112. <el-form-item label="表体业务员" prop="serviceId">
  113. <el-select
  114. v-model="screenForm.serviceId"
  115. placeholder="选择表体业务员"
  116. size="mini"
  117. clearable
  118. filterable
  119. style="width: 100%"
  120. >
  121. <el-option
  122. v-for="item in salesmanList"
  123. :key="item.adminUserId"
  124. :label="item.nickName"
  125. :value="item.adminUserId"
  126. />
  127. </el-select>
  128. </el-form-item>
  129. </el-col>
  130. <el-col :xs="24" :sm="12" :lg="6">
  131. <el-form-item label="订单类型" prop="orderType">
  132. <el-select
  133. v-model="screenForm.orderType"
  134. placeholder="请选择"
  135. clearable
  136. >
  137. <el-option
  138. v-for="item in orderTypeList"
  139. :key="item.value"
  140. :label="item.label"
  141. :value="item.value"
  142. />
  143. </el-select>
  144. </el-form-item>
  145. </el-col>
  146. <el-col :xs="24" :sm="12" :lg="6">
  147. <el-form-item label="订单号" prop="mainOrderId">
  148. <el-input
  149. v-model="screenForm.mainOrderId"
  150. placeholder="请输入订单号"
  151. />
  152. </el-form-item>
  153. </el-col>
  154. <el-col :xs="24" :sm="12" :lg="6">
  155. <el-form-item label="产品类别">
  156. <el-select
  157. v-model="screenForm.categoryId"
  158. style="width: 100%"
  159. placeholder="选择产品类别"
  160. filterable
  161. clearable
  162. >
  163. <el-option
  164. v-for="item in categoryList"
  165. :key="item.name"
  166. :label="item.name"
  167. :value="item.id"
  168. />
  169. </el-select>
  170. </el-form-item>
  171. </el-col>
  172. <el-col :xs="24" :sm="12" :lg="6">
  173. <el-form-item label="审核人" prop="approvalName">
  174. <el-input
  175. v-model="screenForm.approvalName"
  176. placeholder="请输入审核人"
  177. />
  178. </el-form-item>
  179. </el-col>
  180. <el-col :xs="24" :sm="12" :lg="6">
  181. <el-form-item label="制单人" prop="createBy">
  182. <el-input
  183. v-model="screenForm.createBy"
  184. placeholder="请输入制单人"
  185. />
  186. </el-form-item>
  187. </el-col>
  188. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  189. <el-form-item label="">
  190. <el-button @click="resetScreenForm">清空</el-button>
  191. <el-button type="primary" @click="submitScreenForm"
  192. >搜索</el-button
  193. >
  194. </el-form-item>
  195. </el-col>
  196. </el-row>
  197. </el-form>
  198. </div>
  199. <div class="mymain-container">
  200. <div class="btn-group clearfix">
  201. <div class="fl">
  202. <el-button
  203. v-if="$checkBtnRole('add', $route.meta.roles)"
  204. size="mini"
  205. type="primary"
  206. icon="el-icon-plus"
  207. @click="toForm()"
  208. >发货申请</el-button
  209. >
  210. <el-button
  211. v-if="$checkBtnRole('refund', $route.meta.roles)"
  212. size="mini"
  213. type="primary"
  214. icon="el-icon-plus"
  215. @click="toReturnForm()"
  216. >退货申请</el-button
  217. >
  218. <el-button
  219. v-if="$checkBtnRole('examine', $route.meta.roles)"
  220. size="mini"
  221. type="warning"
  222. icon="el-icon-finished"
  223. :disabled="multipleSelection.length < 1"
  224. @click="batchExamine"
  225. >批量审批</el-button
  226. >
  227. </div>
  228. <div class="fr">
  229. <ExportButton
  230. :ex-url="'invoice/listExport'"
  231. :ex-params="exParams"
  232. />
  233. </div>
  234. </div>
  235. <div class="table">
  236. <el-table
  237. v-loading="listLoading"
  238. :data="dataList"
  239. element-loading-text="Loading"
  240. border
  241. fit
  242. :row-style="rowClass"
  243. show-summary
  244. :summary-method="$getSummaries"
  245. @selection-change="handleSelectionChange"
  246. >
  247. <el-table-column
  248. align="center"
  249. type="selection"
  250. width="55"
  251. fixed="left"
  252. />
  253. <el-table-column
  254. align="left"
  255. label="订单类型"
  256. prop="type"
  257. min-width="100"
  258. show-overflow-tooltip
  259. >
  260. <template slot-scope="scope">
  261. {{ scope.row.type | orderTypeFilter }}
  262. </template>
  263. </el-table-column>
  264. <el-table-column
  265. align="left"
  266. label="发货申请单"
  267. prop="id"
  268. min-width="130"
  269. show-overflow-tooltip
  270. >
  271. <template slot-scope="scope">
  272. <CopyButton :copy-text="scope.row.id" />
  273. <span>{{ scope.row.id }}</span>
  274. </template>
  275. </el-table-column>
  276. <el-table-column
  277. align="left"
  278. label="发货申请日期"
  279. prop="createTime"
  280. min-width="160"
  281. show-overflow-tooltip
  282. />
  283. <el-table-column
  284. align="left"
  285. label="仓库"
  286. prop="correspondName"
  287. min-width="100"
  288. show-overflow-tooltip
  289. >
  290. <template slot-scope="scope">
  291. {{
  292. scope.row.type === 3
  293. ? scope.row.stockName
  294. : scope.row.correspondName
  295. }}
  296. </template>
  297. </el-table-column>
  298. <el-table-column
  299. align="left"
  300. label="订单号"
  301. prop="mainOrderId"
  302. min-width="140"
  303. show-overflow-tooltip
  304. >
  305. <template slot-scope="scope">
  306. <CopyButton :copy-text="scope.row.mainOrderId" />
  307. <span>{{ scope.row.mainOrderId }}</span>
  308. </template>
  309. </el-table-column>
  310. <el-table-column
  311. align="left"
  312. label="经销商编码"
  313. prop="customerNumber"
  314. min-width="100"
  315. show-overflow-tooltip
  316. >
  317. <template slot-scope="scope">
  318. <CopyButton :copy-text="scope.row.customerNumber" />
  319. <span>{{ scope.row.customerNumber }}</span>
  320. </template>
  321. </el-table-column>
  322. <el-table-column
  323. align="left"
  324. label="经销商名称"
  325. prop="customerName"
  326. min-width="250"
  327. show-overflow-tooltip
  328. >
  329. <template slot-scope="scope">
  330. <CopyButton :copy-text="scope.row.customerName" />
  331. <span>{{ scope.row.customerName }}</span>
  332. </template>
  333. </el-table-column>
  334. <el-table-column
  335. align="left"
  336. label="物料编码"
  337. prop="materialCode"
  338. min-width="120"
  339. show-overflow-tooltip
  340. >
  341. <template slot-scope="scope">
  342. <CopyButton :copy-text="scope.row.materialCode" />
  343. <span>{{ scope.row.materialCode }}</span>
  344. </template>
  345. </el-table-column>
  346. <el-table-column
  347. align="left"
  348. label="产品编码"
  349. prop="materialOldNumber"
  350. min-width="140"
  351. show-overflow-tooltip
  352. >
  353. <template slot-scope="scope">
  354. <CopyButton :copy-text="scope.row.materialOldNumber" />
  355. <span>{{ scope.row.materialOldNumber }}</span>
  356. </template>
  357. </el-table-column>
  358. <el-table-column
  359. align="left"
  360. label="产品名称"
  361. prop="materialName"
  362. min-width="160"
  363. show-overflow-tooltip
  364. >
  365. <template slot-scope="scope">
  366. <CopyButton :copy-text="scope.row.materialName" />
  367. <span>{{ scope.row.materialName }}</span>
  368. </template>
  369. </el-table-column>
  370. <el-table-column
  371. align="left"
  372. label="规格型号"
  373. prop="specification"
  374. min-width="350"
  375. show-overflow-tooltip
  376. >
  377. <template slot-scope="scope">
  378. <CopyButton :copy-text="scope.row.specification" />
  379. <span>{{ scope.row.specification }}</span>
  380. </template>
  381. </el-table-column>
  382. <el-table-column
  383. align="left"
  384. label="产品类别"
  385. prop="categoryName"
  386. min-width="100"
  387. show-overflow-tooltip
  388. >
  389. <template slot-scope="scope">
  390. <span>{{ scope.row.categoryName }}</span>
  391. </template>
  392. </el-table-column>
  393. <el-table-column
  394. align="left"
  395. label="销售政策名称"
  396. prop="policyTitle"
  397. min-width="100"
  398. show-overflow-tooltip
  399. />
  400. <el-table-column
  401. align="left"
  402. label="文件编号"
  403. prop="itemFileNo"
  404. min-width="100"
  405. show-overflow-tooltip
  406. />
  407. <el-table-column
  408. align="left"
  409. label="单位"
  410. prop="unit"
  411. min-width="100"
  412. show-overflow-tooltip
  413. />
  414. <el-table-column
  415. align="right"
  416. label="数量"
  417. prop="refundableQty"
  418. min-width="100"
  419. show-overflow-tooltip
  420. />
  421. <el-table-column
  422. align="right"
  423. label="已退数量"
  424. prop="retiredQty"
  425. min-width="100"
  426. show-overflow-tooltip
  427. />
  428. <el-table-column
  429. align="right"
  430. label="含税单价"
  431. prop="singlePayPrice"
  432. min-width="100"
  433. show-overflow-tooltip
  434. >
  435. <template slot-scope="scope">
  436. {{ scope.row.singlePayPrice | numToFixed }}
  437. </template>
  438. </el-table-column>
  439. <el-table-column
  440. align="right"
  441. label="价税合计"
  442. prop="payAmount"
  443. min-width="100"
  444. show-overflow-tooltip
  445. >
  446. <template slot-scope="scope">
  447. {{ scope.row.payAmount | numToFixed }}
  448. </template>
  449. </el-table-column>
  450. <el-table-column
  451. align="right"
  452. label="返利金额"
  453. prop="payRebateAmount"
  454. min-width="100"
  455. show-overflow-tooltip
  456. >
  457. <template slot-scope="scope">
  458. {{ scope.row.payRebateAmount | numToFixed }}
  459. </template>
  460. </el-table-column>
  461. <el-table-column
  462. align="right"
  463. label="格力折扣"
  464. prop="totalDiscAmount"
  465. min-width="100"
  466. show-overflow-tooltip
  467. >
  468. <template slot-scope="scope">
  469. {{ scope.row.totalDiscAmount | numToFixed }}
  470. </template>
  471. </el-table-column>
  472. <el-table-column
  473. align="left"
  474. label="订单备注"
  475. prop="headerRemark"
  476. min-width="160"
  477. show-overflow-tooltip
  478. />
  479. <el-table-column
  480. align="left"
  481. label="发货申请备注"
  482. prop="remark"
  483. min-width="160"
  484. show-overflow-tooltip
  485. />
  486. <el-table-column
  487. align="left"
  488. label="表体备注"
  489. prop="invoiceRemark"
  490. min-width="160"
  491. show-overflow-tooltip
  492. />
  493. <el-table-column
  494. align="left"
  495. label="审批说明"
  496. prop="approvalRemark"
  497. min-width="160"
  498. show-overflow-tooltip
  499. />
  500. <el-table-column
  501. align="left"
  502. label="业务员"
  503. prop="serviceName"
  504. min-width="100"
  505. show-overflow-tooltip
  506. />
  507. <el-table-column
  508. align="left"
  509. label="表头业务员"
  510. prop="k3ServiceName"
  511. min-width="100"
  512. show-overflow-tooltip
  513. />
  514. <el-table-column
  515. align="left"
  516. label="制单人"
  517. prop="createBy"
  518. min-width="100"
  519. show-overflow-tooltip
  520. />
  521. <el-table-column
  522. align="left"
  523. label="制单日期"
  524. prop="createTime"
  525. min-width="160"
  526. show-overflow-tooltip
  527. />
  528. <el-table-column
  529. align="left"
  530. label="审核人"
  531. prop="approvalName"
  532. min-width="100"
  533. show-overflow-tooltip
  534. />
  535. <el-table-column
  536. align="left"
  537. label="审核日期"
  538. prop="approvalTime"
  539. min-width="160"
  540. show-overflow-tooltip
  541. />
  542. <el-table-column
  543. align="left"
  544. label="审核状态"
  545. prop="examineStatus"
  546. min-width="100"
  547. show-overflow-tooltip
  548. >
  549. <template slot-scope="scope">
  550. {{ scope.row.examineStatus | statusFilter }}
  551. </template>
  552. </el-table-column>
  553. <el-table-column
  554. v-if="
  555. this.$store.getters.customerNumber === '100093' ||
  556. this.$store.getters.customerNumber === '600023'
  557. "
  558. align="left"
  559. label="同步到格匠采购入库单"
  560. prop="gejiangSync"
  561. min-width="160"
  562. show-overflow-tooltip
  563. >
  564. <template slot-scope="scope">
  565. {{
  566. scope.row.gejiangSync === 1
  567. ? "同步成功"
  568. : scope.row.gejiangSync === 0
  569. ? "待同步"
  570. : "同步失败"
  571. }}
  572. </template>
  573. </el-table-column>
  574. <el-table-column
  575. align="left"
  576. v-if="
  577. this.$store.getters.customerNumber === '100093' ||
  578. this.$store.getters.customerNumber === '600023'
  579. "
  580. label="同步格匠失败原因"
  581. prop="gejiangSyncRemark"
  582. min-width="160"
  583. show-overflow-tooltip
  584. />
  585. <el-table-column
  586. align="center"
  587. label="操作"
  588. width="180"
  589. fixed="right"
  590. >
  591. <template slot-scope="scope">
  592. <el-popconfirm
  593. v-if="
  594. $checkBtnRole('apply', $route.meta.roles) &&
  595. scope.row.examineStatus === 'SAVE'
  596. "
  597. style="margin-right: 10px"
  598. title="确定申请吗?"
  599. @onConfirm="handleSubmit(scope.row.id, 'WAIT')"
  600. >
  601. <el-button slot="reference" type="text">申请</el-button>
  602. </el-popconfirm>
  603. <el-popconfirm
  604. v-if="
  605. $checkBtnRole('apply', $route.meta.roles) &&
  606. scope.row.examineStatus === 'WAIT'
  607. "
  608. style="margin-right: 10px"
  609. title="确定撤回吗?"
  610. @onConfirm="handleSubmit(scope.row.id, 'SAVE')"
  611. >
  612. <el-button slot="reference" type="text">撤回</el-button>
  613. </el-popconfirm>
  614. <el-popconfirm
  615. v-if="
  616. $checkBtnRole('examine', $route.meta.roles) &&
  617. scope.row.examineStatus === 'OK'
  618. "
  619. style="margin-right: 10px"
  620. title="确定弃审吗?"
  621. @onConfirm="handleAbandon(scope.row.id)"
  622. >
  623. <el-button slot="reference" type="text">弃审</el-button>
  624. </el-popconfirm>
  625. <el-button
  626. v-if="
  627. $checkBtnRole('edit', $route.meta.roles) &&
  628. (scope.row.examineStatus === 'SAVE' ||
  629. scope.row.examineStatus === 'FAIL') &&
  630. scope.row.type === 1
  631. "
  632. type="text"
  633. @click="toForm(scope.row)"
  634. >
  635. 编辑
  636. </el-button>
  637. <el-button
  638. v-if="
  639. $checkBtnRole('edit', $route.meta.roles) &&
  640. (scope.row.examineStatus === 'SAVE' ||
  641. scope.row.examineStatus === 'FAIL') &&
  642. scope.row.type === 2
  643. "
  644. type="text"
  645. @click="toReturnForm(scope.row)"
  646. >
  647. 编辑
  648. </el-button>
  649. <el-button
  650. v-if="
  651. $checkBtnRole('examine', $route.meta.roles) &&
  652. scope.row.examineStatus === 'WAIT'
  653. "
  654. type="text"
  655. @click="toExamine(scope.row)"
  656. >
  657. 审单
  658. </el-button>
  659. <el-button type="text" @click="toDetail(scope.row)">
  660. 详情
  661. </el-button>
  662. <el-popconfirm
  663. v-if="
  664. $checkBtnRole('del', $route.meta.roles) &&
  665. scope.row.examineStatus !== 'OK'
  666. "
  667. style="margin-left: 10px"
  668. title="确定删除吗?"
  669. @onConfirm="handleDelete(scope.row.id)"
  670. >
  671. <el-button slot="reference" type="text" style="color: #f56c6c"
  672. >删除</el-button
  673. >
  674. </el-popconfirm>
  675. </template>
  676. </el-table-column>
  677. </el-table>
  678. </div>
  679. </div>
  680. <div class="pagination clearfix">
  681. <div class="fr">
  682. <el-pagination
  683. :current-page="currentPage"
  684. :page-sizes="[10, 20, 30, 50]"
  685. :page-size="10"
  686. layout="total, sizes, prev, pager, next, jumper"
  687. :total="listTotal"
  688. @size-change="handleSizeChange"
  689. @current-change="handleCurrentChange"
  690. />
  691. </div>
  692. </div>
  693. </div>
  694. <ExamineDialog
  695. :is-show.sync="isShowExamineDialog"
  696. :examine-form.sync="examineForm"
  697. />
  698. <ApplyDetail
  699. v-if="isShowDetail"
  700. ref="refDetail"
  701. :list-item="queryItem"
  702. @backListFormDetail="backList"
  703. />
  704. <ApplyExamine
  705. v-if="isShowExamine"
  706. :list-item="queryItem"
  707. @backListFormDetail="backList"
  708. />
  709. <ApplyForm
  710. v-if="isShowForm"
  711. :list-item="queryItem"
  712. @backListFormDetail="backList"
  713. />
  714. <ApplyReturnForm
  715. v-if="isShowReturnForm"
  716. :list-item="queryItem"
  717. :is-show="isShow"
  718. @backListFormDetail="backList"
  719. />
  720. </div>
  721. </template>
  722. <script>
  723. import {
  724. getApplyList,
  725. submitApply,
  726. deleteApply,
  727. abandonApply,
  728. examineBatchApply,
  729. } from "@/api/supply/apply";
  730. import { getCategoryList, getSalesmanList } from "@/api/common";
  731. import ApplyDetail from "@/views/supply/apply/components/apply_detail";
  732. import ApplyExamine from "@/views/supply/apply/components/apply_examine";
  733. import ApplyForm from "@/views/supply/apply/components/apply_form";
  734. import ApplyReturnForm from "@/views/supply/apply/components/apply_return_form";
  735. import ExamineDialog from "@/components/Common/examine-dialog";
  736. let that;
  737. export default {
  738. components: {
  739. ApplyDetail,
  740. ApplyExamine,
  741. ApplyForm,
  742. ApplyReturnForm,
  743. ExamineDialog,
  744. },
  745. filters: {
  746. statusFilter(val) {
  747. const obj = that.statusList.find((o) => o.value == val);
  748. return obj ? obj.label : "";
  749. },
  750. orderTypeFilter(val) {
  751. const obj = that.orderTypeList.find((o) => o.value == val);
  752. return obj ? obj.label : "";
  753. },
  754. },
  755. data() {
  756. return {
  757. currentPage: 1, // 当前页码
  758. pageSize: 10, // 每页数量
  759. listTotal: 0, // 列表总数
  760. dataList: null, // 列表数据
  761. listLoading: false, // 列表加载loading
  762. screenForm: {
  763. // 筛选表单数据
  764. status: "",
  765. orderNum: "",
  766. warehouse: "",
  767. jxsNum: "",
  768. jxsName: "",
  769. date: "",
  770. chName: "",
  771. model: "",
  772. salesMan: "",
  773. orderType: "",
  774. mainOrderId: "",
  775. k3ServiceId: "",
  776. serviceId: "",
  777. categoryId: "",
  778. approvalName: "",
  779. createBy: "",
  780. },
  781. statusList: [
  782. { label: "已保存", value: "SAVE" },
  783. { label: "待审核", value: "WAIT" },
  784. { label: "审核通过", value: "OK" },
  785. // // { label: '审核驳回', value: 'FAIL' },,
  786. { label: "已关闭", value: "CLOSE" },
  787. ],
  788. orderTypeList: [
  789. { label: "发货申请单", value: 1 },
  790. { label: "退货申请单", value: 2 },
  791. { label: "直调发货单", value: 3 },
  792. ],
  793. salesmanList: [],
  794. queryItem: {},
  795. isShowDetail: false,
  796. isShowExamine: false,
  797. isShowForm: false,
  798. isShowReturnForm: false,
  799. selectRow: [],
  800. multipleSelection: [],
  801. isShowExamineDialog: false,
  802. examineForm: {
  803. status: "",
  804. remark: "",
  805. },
  806. categoryList: [],
  807. };
  808. },
  809. computed: {
  810. exParams() {
  811. return {
  812. id: this.screenForm.orderNum,
  813. correspondName: this.screenForm.warehouse,
  814. customerNumber: this.screenForm.jxsNum,
  815. customerName: this.screenForm.jxsName,
  816. productName: this.screenForm.chName,
  817. specification: this.screenForm.model,
  818. startTime: this.screenForm.date ? this.screenForm.date[0] : "",
  819. endTime: this.screenForm.date ? this.screenForm.date[1] : "",
  820. examineStatus: this.screenForm.status,
  821. k3ServiceId: this.screenForm.k3ServiceId,
  822. serviceId: this.screenForm.serviceId,
  823. createBy: this.screenForm.createBy,
  824. type: this.screenForm.orderType,
  825. mainOrderId: this.screenForm.mainOrderId,
  826. categoryId: this.screenForm.categoryId,
  827. approvalName: this.screenForm.approvalName,
  828. };
  829. },
  830. },
  831. watch: {
  832. multipleSelection(data) {
  833. // 监听选中状态
  834. this.selectRow = [];
  835. if (data.length > 0) {
  836. data.forEach((item, index) => {
  837. this.selectRow.push(item.id);
  838. });
  839. }
  840. },
  841. },
  842. beforeCreate() {
  843. that = this;
  844. },
  845. created() {
  846. this.getSalesmanList();
  847. this.getList();
  848. this.getCategoryList();
  849. this.isShow = false;
  850. if (this.$route.query && this.$route.query.isShow) {
  851. this.isShow = this.$route.query.isShow;
  852. this.toReturnForm();
  853. }
  854. },
  855. // activated() {
  856. // this.isShow = false
  857. // if (this.$route.query && this.$route.query.isShow) {
  858. // this.isShow = this.$route.query.isShow
  859. // this.toReturnForm()
  860. // }
  861. // },
  862. methods: {
  863. // 获取业务员列表
  864. getSalesmanList() {
  865. getSalesmanList({
  866. pageNum: 1,
  867. pageSize: -1,
  868. isCustomer: 0,
  869. status: true,
  870. }).then((res) => {
  871. this.salesmanList = res.data.records;
  872. });
  873. },
  874. // 查询列表
  875. getList() {
  876. this.listLoading = true;
  877. const params = {
  878. pageNum: this.currentPage,
  879. pageSize: this.pageSize,
  880. id: this.screenForm.orderNum,
  881. correspondName: this.screenForm.warehouse,
  882. customerNumber: this.screenForm.jxsNum,
  883. createBy: this.screenForm.createBy,
  884. customerName: this.screenForm.jxsName,
  885. productName: this.screenForm.chName,
  886. specification: this.screenForm.model,
  887. startTime: this.screenForm.date ? this.screenForm.date[0] : "",
  888. endTime: this.screenForm.date ? this.screenForm.date[1] : "",
  889. examineStatus: this.screenForm.status,
  890. serviceId: this.screenForm.salesMan,
  891. type: this.screenForm.orderType,
  892. k3ServiceId: this.screenForm.k3ServiceId,
  893. mainOrderId: this.screenForm.mainOrderId,
  894. categoryId: this.screenForm.categoryId,
  895. approvalName: this.screenForm.approvalName,
  896. };
  897. getApplyList(params).then((res) => {
  898. res.data.records.forEach((item) => {
  899. item.sums1 = ["refundableQty", "retiredQty"];
  900. item.sums2 = [
  901. "singlePayPrice",
  902. "payAmount",
  903. "payRebateAmount",
  904. "totalDiscAmount",
  905. ];
  906. });
  907. this.dataList = res.data.records;
  908. this.listTotal = res.data.total;
  909. this.listLoading = false;
  910. });
  911. },
  912. // 提交筛选表单
  913. submitScreenForm() {
  914. this.currentPage = 1;
  915. this.getList();
  916. },
  917. // 重置筛选表单
  918. resetScreenForm() {
  919. this.$refs.screenForm.resetFields();
  920. this.currentPage = 1;
  921. this.getList();
  922. },
  923. // 更改每页数量
  924. handleSizeChange(val) {
  925. this.pageSize = val;
  926. this.currentPage = 1;
  927. this.getList();
  928. },
  929. // 更改当前页
  930. handleCurrentChange(val) {
  931. this.currentPage = val;
  932. this.getList();
  933. },
  934. // 进入表单
  935. toForm(item) {
  936. this.queryItem = item;
  937. this.isShowForm = true;
  938. },
  939. // 进入表单
  940. toReturnForm(item) {
  941. this.queryItem = item;
  942. this.isShowReturnForm = true;
  943. },
  944. // 进入审批
  945. toExamine(item) {
  946. this.queryItem = item;
  947. this.isShowExamine = true;
  948. },
  949. // 进入详情
  950. toDetail(item) {
  951. this.queryItem = item;
  952. this.isShowDetail = true;
  953. this.$nextTick(() => {
  954. this.$refs.refDetail.initPrint();
  955. });
  956. // this.$refs.refDetail.initPrint()
  957. },
  958. backList() {
  959. this.queryItem = {};
  960. this.isShowDetail = false;
  961. this.isShowExamine = false;
  962. this.isShowForm = false;
  963. this.isShowReturnForm = false;
  964. },
  965. handleDelete(id) {
  966. deleteApply({ id }).then((res) => {
  967. this.$successMsg();
  968. this.getList();
  969. });
  970. },
  971. // 申请/撤回
  972. handleSubmit(id, examineStatus) {
  973. submitApply({ id, examineStatus }).then((res) => {
  974. this.$successMsg();
  975. this.getList();
  976. });
  977. },
  978. // 弃审
  979. handleAbandon(id) {
  980. abandonApply({ id }).then((res) => {
  981. this.$successMsg();
  982. this.getList();
  983. });
  984. },
  985. handleSelectionChange(val) {
  986. this.multipleSelection = val;
  987. if (val) {
  988. this.selections = val;
  989. } else {
  990. this.selections = [];
  991. }
  992. },
  993. rowClass({ row, rowIndex }) {
  994. if (this.selectRow.includes(row.id)) {
  995. return { "background-color": "#ecf5ff" };
  996. }
  997. },
  998. // 打开 批量审批
  999. batchExamine() {
  1000. this.isShowExamineDialog = true;
  1001. },
  1002. // 提交 批量审批
  1003. submitExamineForm() {
  1004. let ids = this.multipleSelection.map((item) => {
  1005. return item.id;
  1006. });
  1007. ids = Array.from(new Set(ids));
  1008. examineBatchApply({
  1009. ids: ids.join(","),
  1010. examineStatus: this.examineForm.status,
  1011. approvalRemark: this.examineForm.remark,
  1012. }).then((res) => {
  1013. this.isShowExamineDialog = false;
  1014. this.getList();
  1015. this.$successMsg("审批成功");
  1016. });
  1017. },
  1018. // 获取存货类别列表
  1019. getCategoryList() {
  1020. getCategoryList({
  1021. pageNum: 1,
  1022. pageSize: -1,
  1023. }).then((res) => {
  1024. this.categoryList = res.data.records;
  1025. });
  1026. },
  1027. },
  1028. };
  1029. </script>
  1030. <style lang="scss" scoped></style>