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