apply_list.vue 22 KB

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