apply_list.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  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('refund', $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="headerRemark" min-width="160" show-overflow-tooltip></el-table-column>
  204. <el-table-column align="left" label="发货申请备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
  205. <el-table-column align="left" label="表体备注" prop="invoiceRemark" min-width="160" show-overflow-tooltip></el-table-column>
  206. <el-table-column align="left" label="审批说明" prop="approvalRemark" min-width="160" show-overflow-tooltip></el-table-column>
  207. <el-table-column align="left" label="业务员" prop="serviceName" min-width="100" show-overflow-tooltip></el-table-column>
  208. <el-table-column align="left" label="表头业务员" prop="k3ServiceName" min-width="100" show-overflow-tooltip></el-table-column>
  209. <el-table-column align="left" label="制单人" prop="createBy" min-width="100" show-overflow-tooltip></el-table-column>
  210. <el-table-column align="left" label="制单日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  211. <el-table-column align="left" label="审核人" prop="approvalName" min-width="100" show-overflow-tooltip></el-table-column>
  212. <el-table-column align="left" label="审核日期" prop="approvalTime" min-width="160" show-overflow-tooltip></el-table-column>
  213. <el-table-column align="left" label="审核状态" prop="examineStatus" min-width="100" show-overflow-tooltip>
  214. <template slot-scope="scope">
  215. {{scope.row.examineStatus | statusFilter}}
  216. </template>
  217. </el-table-column>
  218. <el-table-column align="center" label="操作" width="180" fixed="right">
  219. <template slot-scope="scope">
  220. <el-popconfirm
  221. style="margin-right: 10px;"
  222. title="确定申请吗?"
  223. @onConfirm="handleSubmit(scope.row.id, 'WAIT')"
  224. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'SAVE'" >
  225. <el-button slot="reference" type="text">申请</el-button>
  226. </el-popconfirm>
  227. <el-popconfirm
  228. style="margin-right: 10px;"
  229. title="确定撤回吗?"
  230. @onConfirm="handleSubmit(scope.row.id, 'SAVE')"
  231. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'WAIT'" >
  232. <el-button slot="reference" type="text">撤回</el-button>
  233. </el-popconfirm>
  234. <el-popconfirm
  235. style="margin-right: 10px;"
  236. title="确定弃审吗?"
  237. @onConfirm="handleAbandon(scope.row.id)"
  238. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK'" >
  239. <el-button slot="reference" type="text">弃审</el-button>
  240. </el-popconfirm>
  241. <el-button
  242. type="text"
  243. @click="toForm(scope.row)"
  244. v-if="$checkBtnRole('edit', $route.meta.roles) && (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'FAIL') && scope.row.type === 1">
  245. 编辑
  246. </el-button>
  247. <el-button
  248. type="text"
  249. @click="toReturnForm(scope.row)"
  250. v-if="$checkBtnRole('edit', $route.meta.roles) && (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'FAIL') && scope.row.type === 2">
  251. 编辑
  252. </el-button>
  253. <el-button
  254. type="text"
  255. @click="toExamine(scope.row)"
  256. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'WAIT'">
  257. 审单
  258. </el-button>
  259. <el-button
  260. type="text"
  261. @click="toDetail(scope.row)">
  262. 详情
  263. </el-button>
  264. <el-popconfirm
  265. style="margin-left: 10px;"
  266. title="确定删除吗?"
  267. @onConfirm="handleDelete(scope.row.id)"
  268. v-if="$checkBtnRole('del', $route.meta.roles) && scope.row.examineStatus !== 'OK'">
  269. <el-button slot="reference" type="text" style="color: #f56c6c;">删除</el-button>
  270. </el-popconfirm>
  271. </template>
  272. </el-table-column>
  273. </el-table>
  274. </div>
  275. </div>
  276. <div class="pagination clearfix">
  277. <div class="fr">
  278. <el-pagination
  279. @size-change="handleSizeChange"
  280. @current-change="handleCurrentChange"
  281. :current-page="currentPage"
  282. :page-sizes="[10, 20, 30, 50]"
  283. :page-size="10"
  284. layout="total, sizes, prev, pager, next, jumper"
  285. :total="listTotal">
  286. </el-pagination>
  287. </div>
  288. </div>
  289. </div>
  290. <ExamineDialog :isShow.sync="isShowExamineDialog" :examineForm.sync="examineForm" />
  291. <ApplyDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  292. <ApplyExamine :listItem="queryItem" v-if="isShowExamine" @backListFormDetail="backList" />
  293. <ApplyForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
  294. <ApplyReturnForm :listItem="queryItem" v-if="isShowReturnForm" @backListFormDetail="backList" />
  295. </div>
  296. </template>
  297. <script>
  298. import { getApplyList, submitApply, deleteApply, abandonApply, examineBatchApply } from "@/api/supply/apply";
  299. import { getSalesmanList } from '@/api/common'
  300. import ApplyDetail from "@/views/supply/apply/components/apply_detail";
  301. import ApplyExamine from "@/views/supply/apply/components/apply_examine";
  302. import ApplyForm from "@/views/supply/apply/components/apply_form";
  303. import ApplyReturnForm from "@/views/supply/apply/components/apply_return_form";
  304. import ExamineDialog from "@/components/Common/examine-dialog";
  305. let that
  306. export default {
  307. components: {
  308. ApplyDetail,
  309. ApplyExamine,
  310. ApplyForm,
  311. ApplyReturnForm,
  312. ExamineDialog,
  313. },
  314. filters: {
  315. statusFilter(val) {
  316. let obj = that.statusList.find(o => o.value == val);
  317. return obj ? obj.label : ''
  318. },
  319. orderTypeFilter(val) {
  320. let obj = that.orderTypeList.find(o => o.value == val);
  321. return obj ? obj.label : ''
  322. },
  323. },
  324. data() {
  325. return {
  326. currentPage: 1, // 当前页码
  327. pageSize: 10, // 每页数量
  328. listTotal: 0, // 列表总数
  329. dataList: null, // 列表数据
  330. listLoading: false, // 列表加载loading
  331. screenForm: { // 筛选表单数据
  332. status: '',
  333. orderNum: '',
  334. warehouse: '',
  335. jxsNum: '',
  336. jxsName: '',
  337. date: '',
  338. chName: '',
  339. model: '',
  340. salesMan: '',
  341. orderType: '',
  342. mainOrderId: '',
  343. },
  344. statusList: [
  345. { label: '已保存', value: 'SAVE' },
  346. { label: '待审核', value: 'WAIT' },
  347. { label: '审核通过', value: 'OK' },
  348. // { label: '审核驳回', value: 'FAIL' },
  349. { label: '已关闭', value: 'CLOSE' },
  350. ],
  351. orderTypeList: [
  352. { label: '发货申请单', value: 1 },
  353. { label: '退货申请单', value: 2 },
  354. { label: '直调发货单', value: 3 },
  355. ],
  356. salesmanList: [],
  357. queryItem: {},
  358. isShowDetail: false,
  359. isShowExamine: false,
  360. isShowForm: false,
  361. isShowReturnForm: false,
  362. multipleSelection: [],
  363. isShowExamineDialog: false,
  364. examineForm: {
  365. status: '',
  366. remark: '',
  367. },
  368. }
  369. },
  370. computed: {
  371. exParams() {
  372. return {
  373. id: this.screenForm.orderNum,
  374. correspondName: this.screenForm.warehouse,
  375. customerNumber: this.screenForm.jxsNum,
  376. customerName: this.screenForm.jxsName,
  377. productName: this.screenForm.chName,
  378. specification: this.screenForm.model,
  379. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  380. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  381. examineStatus: this.screenForm.status,
  382. serviceId: this.screenForm.salesMan,
  383. type: this.screenForm.orderType,
  384. mainOrderId: this.screenForm.mainOrderId,
  385. }
  386. },
  387. },
  388. beforeCreate() {
  389. that = this;
  390. },
  391. created() {
  392. this.getSalesmanList();
  393. this.getList();
  394. },
  395. methods: {
  396. // 获取业务员列表
  397. getSalesmanList() {
  398. getSalesmanList({
  399. pageNum: 1,
  400. pageSize: -1,
  401. isCustomer: 0,
  402. status: true,
  403. }).then(res => {
  404. this.salesmanList = res.data.records;
  405. })
  406. },
  407. // 查询列表
  408. getList() {
  409. this.listLoading = true;
  410. let params = {
  411. pageNum: this.currentPage,
  412. pageSize: this.pageSize,
  413. id: this.screenForm.orderNum,
  414. correspondName: this.screenForm.warehouse,
  415. customerNumber: this.screenForm.jxsNum,
  416. customerName: this.screenForm.jxsName,
  417. productName: this.screenForm.chName,
  418. specification: this.screenForm.model,
  419. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  420. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  421. examineStatus: this.screenForm.status,
  422. serviceId: this.screenForm.salesMan,
  423. type: this.screenForm.orderType,
  424. mainOrderId: this.screenForm.mainOrderId,
  425. };
  426. getApplyList(params).then((res) => {
  427. res.data.records.forEach(item => {
  428. item.sums1 = ['refundableQty', 'retiredQty'];
  429. item.sums2 = ['singlePayPrice', 'payAmount', 'payRebateAmount', 'totalDiscAmount'];
  430. })
  431. this.dataList = res.data.records;
  432. this.listTotal = res.data.total;
  433. this.listLoading = false;
  434. })
  435. },
  436. // 提交筛选表单
  437. submitScreenForm() {
  438. this.currentPage = 1;
  439. this.getList();
  440. },
  441. // 重置筛选表单
  442. resetScreenForm() {
  443. this.$refs.screenForm.resetFields();
  444. this.currentPage = 1;
  445. this.getList();
  446. },
  447. // 更改每页数量
  448. handleSizeChange(val) {
  449. this.pageSize = val;
  450. this.currentPage = 1;
  451. this.getList();
  452. },
  453. // 更改当前页
  454. handleCurrentChange(val) {
  455. this.currentPage = val;
  456. this.getList();
  457. },
  458. // 进入表单
  459. toForm(item) {
  460. this.queryItem = item;
  461. this.isShowForm = true;
  462. },
  463. // 进入表单
  464. toReturnForm(item) {
  465. this.queryItem = item;
  466. this.isShowReturnForm = true;
  467. },
  468. // 进入审批
  469. toExamine(item) {
  470. this.queryItem = item;
  471. this.isShowExamine = true;
  472. },
  473. // 进入详情
  474. toDetail(item) {
  475. this.queryItem = item;
  476. this.isShowDetail = true;
  477. },
  478. backList() {
  479. this.queryItem = {};
  480. this.isShowDetail = false;
  481. this.isShowExamine = false;
  482. this.isShowForm = false;
  483. this.isShowReturnForm = false;
  484. },
  485. handleDelete(id) {
  486. deleteApply({id}).then(res => {
  487. this.$successMsg();
  488. this.getList();
  489. })
  490. },
  491. // 申请/撤回
  492. handleSubmit(id, examineStatus) {
  493. submitApply({id, examineStatus}).then(res => {
  494. this.$successMsg();
  495. this.getList();
  496. })
  497. },
  498. // 弃审
  499. handleAbandon(id) {
  500. abandonApply({id}).then(res => {
  501. this.$successMsg();
  502. this.getList();
  503. })
  504. },
  505. handleSelectionChange(val) {
  506. this.multipleSelection = val;
  507. },
  508. // 打开 批量审批
  509. batchExamine() {
  510. this.isShowExamineDialog = true;
  511. },
  512. // 提交 批量审批
  513. submitExamineForm() {
  514. let ids = this.multipleSelection.map(item => {
  515. return item.id;
  516. });
  517. ids = Array.from(new Set(ids));
  518. examineBatchApply({
  519. ids: ids.join(','),
  520. examineStatus: this.examineForm.status,
  521. approvalRemark: this.examineForm.remark,
  522. }).then(res => {
  523. this.isShowExamineDialog = false;
  524. this.getList();
  525. this.$successMsg('审批成功');
  526. })
  527. },
  528. }
  529. }
  530. </script>
  531. <style lang="scss" scoped>
  532. </style>