apply_list.vue 31 KB

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