apply_list.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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">{{item.label}}</el-radio-button>
  13. </el-radio-group>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :xs="24" :sm="12" :lg="6">
  17. <el-form-item label="发货申请单" prop="orderNum">
  18. <el-input v-model="screenForm.orderNum" placeholder="请输入发货申请单"></el-input>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :xs="24" :sm="12" :lg="6">
  22. <el-form-item label="仓库名称" prop="warehouse">
  23. <el-input v-model="screenForm.warehouse" placeholder="请输入仓库名称"></el-input>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :xs="24" :sm="12" :lg="6">
  27. <el-form-item label="经销商编码" prop="jxsNum">
  28. <el-input v-model="screenForm.jxsNum" placeholder="请输入经销商编码"></el-input>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :xs="24" :sm="12" :lg="6">
  32. <el-form-item label="经销商名称" prop="jxsName">
  33. <el-input v-model="screenForm.jxsName" placeholder="请输入经销商名称"></el-input>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :xs="24" :sm="12" :lg="6">
  37. <el-form-item label="发货申请日期" prop="date">
  38. <el-date-picker
  39. v-model="screenForm.date"
  40. type="datetimerange"
  41. range-separator="至"
  42. style="width: 100%;"
  43. value-format="yyyy-MM-dd HH:mm:ss"
  44. start-placeholder="开始日期"
  45. end-placeholder="结束日期">
  46. </el-date-picker>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :xs="24" :sm="12" :lg="6">
  50. <el-form-item label="产品名称" prop="chName">
  51. <el-input v-model="screenForm.chName" placeholder="请输入产品名称"></el-input>
  52. </el-form-item>
  53. </el-col>
  54. <el-col :xs="24" :sm="12" :lg="6">
  55. <el-form-item label="规格型号" prop="model">
  56. <el-input v-model="screenForm.model" placeholder="请输入规格型号"></el-input>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :xs="24" :sm="12" :lg="6">
  60. <el-form-item label="业务员" prop="salesMan">
  61. <el-select v-model="screenForm.salesMan" placeholder="选择业务员" clearable filterable style="width: 100%">
  62. <el-option
  63. v-for="item in salesmanList"
  64. :key="item.adminUserId"
  65. :label="item.nickName"
  66. :value="item.adminUserId">
  67. </el-option>
  68. </el-select>
  69. </el-form-item>
  70. </el-col>
  71. <el-col :xs="24" :sm="12" :lg="6">
  72. <el-form-item label="订单类型" prop="orderType">
  73. <el-select v-model="screenForm.orderType" placeholder="请选择" clearable>
  74. <el-option
  75. v-for="item in orderTypeList"
  76. :key="item.value"
  77. :label="item.label"
  78. :value="item.value">
  79. </el-option>
  80. </el-select>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :xs="24" :sm="12" :lg="18" class="tr">
  84. <el-form-item label="">
  85. <el-button @click="resetScreenForm">清空</el-button>
  86. <el-button type="primary" @click="submitScreenForm">搜索</el-button>
  87. </el-form-item>
  88. </el-col>
  89. </el-row>
  90. </el-form>
  91. </div>
  92. <div class="mymain-container">
  93. <div class="btn-group clearfix">
  94. <div class="fl">
  95. <el-button size="mini" type="primary" icon="el-icon-plus" @click="toForm()" v-if="$checkBtnRole('add', $route.meta.roles)">发货申请</el-button>
  96. <el-button size="mini" type="primary" icon="el-icon-plus" @click="toReturnForm()" v-if="$checkBtnRole('add', $route.meta.roles)">退货申请</el-button>
  97. <el-button size="mini" type="warning" icon="el-icon-finished" @click="batchExamine" :disabled="multipleSelection.length < 1" v-if="$checkBtnRole('examine', $route.meta.roles)">批量审批</el-button>
  98. </div>
  99. <div class="fr">
  100. <ExportButton :exUrl="'invoice/listExport'" :exParams="exParams" />
  101. </div>
  102. </div>
  103. <div class="table">
  104. <el-table
  105. v-loading="listLoading"
  106. :data="dataList"
  107. element-loading-text="Loading"
  108. border
  109. fit
  110. highlight-current-row
  111. stripe
  112. @selection-change="handleSelectionChange"
  113. show-summary
  114. :summary-method="$getSummaries">
  115. <el-table-column align="center" type="selection" width="55"></el-table-column>
  116. <el-table-column align="left" label="订单类型" prop="type" min-width="100" show-overflow-tooltip>
  117. <template slot-scope="scope">
  118. {{scope.row.type | orderTypeFilter}}
  119. </template>
  120. </el-table-column>
  121. <el-table-column align="left" label="发货申请单" prop="id" min-width="120" show-overflow-tooltip>
  122. <template slot-scope="scope">
  123. <CopyButton :copyText="scope.row.id" />
  124. <span>{{scope.row.id}}</span>
  125. </template>
  126. </el-table-column>
  127. <el-table-column align="left" label="发货申请日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  128. <el-table-column align="left" label="仓库" prop="correspondName" min-width="100" show-overflow-tooltip>
  129. <template slot-scope="scope">
  130. {{scope.row.type === 3 ? scope.row.stockName : scope.row.correspondName}}
  131. </template>
  132. </el-table-column>
  133. <el-table-column align="left" label="订单号" prop="mainOrderId" min-width="140" show-overflow-tooltip>
  134. <template slot-scope="scope">
  135. <CopyButton :copyText="scope.row.mainOrderId" />
  136. <span>{{scope.row.mainOrderId}}</span>
  137. </template>
  138. </el-table-column>
  139. <el-table-column align="left" label="经销商编码" prop="customerNumber" min-width="100" show-overflow-tooltip>
  140. <template slot-scope="scope">
  141. <CopyButton :copyText="scope.row.customerNumber" />
  142. <span>{{scope.row.customerNumber}}</span>
  143. </template>
  144. </el-table-column>
  145. <el-table-column align="left" label="经销商名称" prop="customerName" min-width="250" show-overflow-tooltip>
  146. <template slot-scope="scope">
  147. <CopyButton :copyText="scope.row.customerName" />
  148. <span>{{scope.row.customerName}}</span>
  149. </template>
  150. </el-table-column>
  151. <el-table-column align="left" label="物料编码" prop="materialCode" min-width="120" show-overflow-tooltip>
  152. <template slot-scope="scope">
  153. <CopyButton :copyText="scope.row.materialCode" />
  154. <span>{{scope.row.materialCode}}</span>
  155. </template>
  156. </el-table-column>
  157. <el-table-column align="left" label="产品编码" prop="materialOldNumber" min-width="140" show-overflow-tooltip>
  158. <template slot-scope="scope">
  159. <CopyButton :copyText="scope.row.materialOldNumber" />
  160. <span>{{scope.row.materialOldNumber}}</span>
  161. </template>
  162. </el-table-column>
  163. <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip>
  164. <template slot-scope="scope">
  165. <CopyButton :copyText="scope.row.materialName" />
  166. <span>{{scope.row.materialName}}</span>
  167. </template>
  168. </el-table-column>
  169. <el-table-column align="left" label="规格型号" prop="specification" min-width="350" show-overflow-tooltip>
  170. <template slot-scope="scope">
  171. <CopyButton :copyText="scope.row.specification" />
  172. <span>{{scope.row.specification}}</span>
  173. </template>
  174. </el-table-column>
  175. <el-table-column align="left" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  176. <el-table-column align="right" label="实付金额" prop="payAmount" min-width="100" show-overflow-tooltip>
  177. <template slot-scope="scope">
  178. {{scope.row.payAmount | numToFixed}}
  179. </template>
  180. </el-table-column>
  181. <el-table-column align="right" label="返利金额" prop="payRebateAmount" min-width="100" show-overflow-tooltip>
  182. <template slot-scope="scope">
  183. {{scope.row.payRebateAmount | numToFixed}}
  184. </template>
  185. </el-table-column>
  186. <el-table-column align="right" label="格力折扣" prop="totalDiscAmount" min-width="100" show-overflow-tooltip>
  187. <template slot-scope="scope">
  188. {{scope.row.totalDiscAmount | numToFixed}}
  189. </template>
  190. </el-table-column>
  191. <el-table-column align="right" label="数量" prop="refundableQty" min-width="100" show-overflow-tooltip></el-table-column>
  192. <el-table-column align="right" label="已退数量" prop="retiredQty" min-width="100" show-overflow-tooltip></el-table-column>
  193. <el-table-column align="left" label="备注信息" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
  194. <el-table-column align="left" label="制单人" prop="createBy" min-width="100" show-overflow-tooltip></el-table-column>
  195. <el-table-column align="left" label="制单日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  196. <el-table-column align="left" label="审核人" prop="approvalName" min-width="100" show-overflow-tooltip></el-table-column>
  197. <el-table-column align="left" label="审核日期" prop="approvalTime" min-width="160" show-overflow-tooltip></el-table-column>
  198. <el-table-column align="left" label="审核状态" prop="examineStatus" min-width="100" show-overflow-tooltip>
  199. <template slot-scope="scope">
  200. {{scope.row.examineStatus | statusFilter}}
  201. </template>
  202. </el-table-column>
  203. <el-table-column align="center" label="操作" width="180" fixed="right">
  204. <template slot-scope="scope">
  205. <el-popconfirm
  206. style="margin-right: 10px;"
  207. title="确定申请吗?"
  208. @onConfirm="handleSubmit(scope.row.id, 'WAIT')"
  209. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'SAVE'" >
  210. <el-button slot="reference" type="text">申请</el-button>
  211. </el-popconfirm>
  212. <el-popconfirm
  213. style="margin-right: 10px;"
  214. title="确定撤回吗?"
  215. @onConfirm="handleSubmit(scope.row.id, 'SAVE')"
  216. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'WAIT'" >
  217. <el-button slot="reference" type="text">撤回</el-button>
  218. </el-popconfirm>
  219. <el-popconfirm
  220. style="margin-right: 10px;"
  221. title="确定弃审吗?"
  222. @onConfirm="handleAbandon(scope.row.id)"
  223. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK'" >
  224. <el-button slot="reference" type="text">弃审</el-button>
  225. </el-popconfirm>
  226. <el-button
  227. type="text"
  228. @click="toForm(scope.row)"
  229. v-if="$checkBtnRole('edit', $route.meta.roles) && (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'FAIL') && scope.row.type === 1">
  230. 编辑
  231. </el-button>
  232. <el-button
  233. type="text"
  234. @click="toReturnForm(scope.row)"
  235. v-if="$checkBtnRole('edit', $route.meta.roles) && (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'FAIL') && scope.row.type === 2">
  236. 编辑
  237. </el-button>
  238. <el-button
  239. type="text"
  240. @click="toExamine(scope.row)"
  241. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'WAIT'">
  242. 审单
  243. </el-button>
  244. <el-button
  245. type="text"
  246. @click="toDetail(scope.row)">
  247. 详情
  248. </el-button>
  249. <el-popconfirm
  250. style="margin-left: 10px;"
  251. title="确定删除吗?"
  252. @onConfirm="handleDelete(scope.row.id)"
  253. v-if="$checkBtnRole('del', $route.meta.roles) && scope.row.examineStatus !== 'OK'">
  254. <el-button slot="reference" type="text" style="color: #f56c6c;">删除</el-button>
  255. </el-popconfirm>
  256. </template>
  257. </el-table-column>
  258. </el-table>
  259. </div>
  260. </div>
  261. <div class="pagination clearfix">
  262. <div class="fr">
  263. <el-pagination
  264. @size-change="handleSizeChange"
  265. @current-change="handleCurrentChange"
  266. :current-page="currentPage"
  267. :page-sizes="[10, 20, 30, 50]"
  268. :page-size="10"
  269. layout="total, sizes, prev, pager, next, jumper"
  270. :total="listTotal">
  271. </el-pagination>
  272. </div>
  273. </div>
  274. </div>
  275. <ExamineDialog :isShow.sync="isShowExamineDialog" :examineForm.sync="examineForm" />
  276. <ApplyDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  277. <ApplyExamine :listItem="queryItem" v-if="isShowExamine" @backListFormDetail="backList" />
  278. <ApplyForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
  279. <ApplyReturnForm :listItem="queryItem" v-if="isShowReturnForm" @backListFormDetail="backList" />
  280. </div>
  281. </template>
  282. <script>
  283. import { getApplyList, submitApply, deleteApply, abandonApply, examineBatchApply } from "@/api/supply/apply";
  284. import { getSalesmanList } from '@/api/common'
  285. import ApplyDetail from "@/views/supply/apply/components/apply_detail";
  286. import ApplyExamine from "@/views/supply/apply/components/apply_examine";
  287. import ApplyForm from "@/views/supply/apply/components/apply_form";
  288. import ApplyReturnForm from "@/views/supply/apply/components/apply_return_form";
  289. import ExamineDialog from "@/components/Common/examine-dialog";
  290. let that
  291. export default {
  292. components: {
  293. ApplyDetail,
  294. ApplyExamine,
  295. ApplyForm,
  296. ApplyReturnForm,
  297. ExamineDialog,
  298. },
  299. filters: {
  300. statusFilter(val) {
  301. let obj = that.statusList.find(o => o.value == val);
  302. return obj ? obj.label : ''
  303. },
  304. orderTypeFilter(val) {
  305. let obj = that.orderTypeList.find(o => o.value == val);
  306. return obj ? obj.label : ''
  307. },
  308. },
  309. data() {
  310. return {
  311. currentPage: 1, // 当前页码
  312. pageSize: 10, // 每页数量
  313. listTotal: 0, // 列表总数
  314. dataList: null, // 列表数据
  315. listLoading: false, // 列表加载loading
  316. screenForm: { // 筛选表单数据
  317. status: '',
  318. orderNum: '',
  319. warehouse: '',
  320. jxsNum: '',
  321. jxsName: '',
  322. date: '',
  323. chName: '',
  324. model: '',
  325. salesMan: '',
  326. orderType: '',
  327. },
  328. statusList: [
  329. { label: '已保存', value: 'SAVE' },
  330. { label: '待审核', value: 'WAIT' },
  331. { label: '审核通过', value: 'OK' },
  332. { label: '审核驳回', value: 'FAIL' },
  333. { label: '已关闭', value: 'CLOSE' },
  334. ],
  335. orderTypeList: [
  336. { label: '发货申请单', value: 1 },
  337. { label: '退货申请单', value: 2 },
  338. { label: '直调发货单', value: 3 },
  339. ],
  340. salesmanList: [],
  341. queryItem: {},
  342. isShowDetail: false,
  343. isShowExamine: false,
  344. isShowForm: false,
  345. isShowReturnForm: false,
  346. multipleSelection: [],
  347. isShowExamineDialog: false,
  348. examineForm: {
  349. status: '',
  350. remark: '',
  351. },
  352. }
  353. },
  354. computed: {
  355. exParams() {
  356. return {
  357. id: this.screenForm.orderNum,
  358. correspondName: this.screenForm.warehouse,
  359. customerNumber: this.screenForm.jxsNum,
  360. customerName: this.screenForm.jxsName,
  361. productName: this.screenForm.chName,
  362. specification: this.screenForm.model,
  363. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  364. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  365. examineStatus: this.screenForm.status,
  366. serviceId: this.screenForm.salesMan,
  367. type: this.screenForm.orderType,
  368. }
  369. },
  370. },
  371. beforeCreate() {
  372. that = this;
  373. },
  374. created() {
  375. this.getSalesmanList();
  376. this.getList();
  377. },
  378. methods: {
  379. // 获取业务员列表
  380. getSalesmanList() {
  381. getSalesmanList({
  382. pageNum: 1,
  383. pageSize: -1,
  384. isCustomer: 0,
  385. status: true,
  386. }).then(res => {
  387. this.salesmanList = res.data.records;
  388. })
  389. },
  390. // 查询列表
  391. getList() {
  392. this.listLoading = true;
  393. let params = {
  394. pageNum: this.currentPage,
  395. pageSize: this.pageSize,
  396. id: this.screenForm.orderNum,
  397. correspondName: this.screenForm.warehouse,
  398. customerNumber: this.screenForm.jxsNum,
  399. customerName: this.screenForm.jxsName,
  400. productName: this.screenForm.chName,
  401. specification: this.screenForm.model,
  402. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  403. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  404. examineStatus: this.screenForm.status,
  405. serviceId: this.screenForm.salesMan,
  406. type: this.screenForm.orderType,
  407. };
  408. getApplyList(params).then((res) => {
  409. res.data.records.forEach(item => {
  410. item.sums1 = ['refundableQty', 'retiredQty'];
  411. item.sums2 = ['payAmount', 'payRebateAmount', 'totalDiscAmount'];
  412. })
  413. this.dataList = res.data.records;
  414. this.listTotal = res.data.total;
  415. this.listLoading = false;
  416. })
  417. },
  418. // 提交筛选表单
  419. submitScreenForm() {
  420. this.currentPage = 1;
  421. this.getList();
  422. },
  423. // 重置筛选表单
  424. resetScreenForm() {
  425. this.$refs.screenForm.resetFields();
  426. this.currentPage = 1;
  427. this.getList();
  428. },
  429. // 更改每页数量
  430. handleSizeChange(val) {
  431. this.pageSize = val;
  432. this.currentPage = 1;
  433. this.getList();
  434. },
  435. // 更改当前页
  436. handleCurrentChange(val) {
  437. this.currentPage = val;
  438. this.getList();
  439. },
  440. // 进入表单
  441. toForm(item) {
  442. this.queryItem = item;
  443. this.isShowForm = true;
  444. },
  445. // 进入表单
  446. toReturnForm(item) {
  447. this.queryItem = item;
  448. this.isShowReturnForm = true;
  449. },
  450. // 进入审批
  451. toExamine(item) {
  452. this.queryItem = item;
  453. this.isShowExamine = true;
  454. },
  455. // 进入详情
  456. toDetail(item) {
  457. this.queryItem = item;
  458. this.isShowDetail = true;
  459. },
  460. backList() {
  461. this.queryItem = {};
  462. this.isShowDetail = false;
  463. this.isShowExamine = false;
  464. this.isShowForm = false;
  465. this.isShowReturnForm = false;
  466. },
  467. handleDelete(id) {
  468. deleteApply({id}).then(res => {
  469. this.$successMsg();
  470. this.getList();
  471. })
  472. },
  473. // 申请/撤回
  474. handleSubmit(id, examineStatus) {
  475. submitApply({id, examineStatus}).then(res => {
  476. this.$successMsg();
  477. this.getList();
  478. })
  479. },
  480. // 弃审
  481. handleAbandon(id) {
  482. abandonApply({id}).then(res => {
  483. this.$successMsg();
  484. this.getList();
  485. })
  486. },
  487. handleSelectionChange(val) {
  488. this.multipleSelection = val;
  489. },
  490. // 打开 批量审批
  491. batchExamine() {
  492. this.isShowExamineDialog = true;
  493. },
  494. // 提交 批量审批
  495. submitExamineForm() {
  496. let ids = this.multipleSelection.map(item => {
  497. return item.id;
  498. });
  499. ids = Array.from(new Set(ids));
  500. examineBatchApply({
  501. ids: ids.join(','),
  502. examineStatus: this.examineForm.status,
  503. approvalRemark: this.examineForm.remark,
  504. }).then(res => {
  505. this.isShowExamineDialog = false;
  506. this.getList();
  507. this.$successMsg('审批成功');
  508. })
  509. },
  510. }
  511. }
  512. </script>
  513. <style lang="scss" scoped>
  514. </style>