apply_list.vue 29 KB

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