apply_list.vue 32 KB

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