sales_list.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. <template>
  2. <div class="app-container">
  3. <div v-show="!isShowDetail && !isShowExamine && !isShowReturnForm">
  4. <!-- 筛选条件 -->
  5. <div class="screen-container">
  6. <el-form
  7. ref="screenForm"
  8. :model="screenForm"
  9. label-width="85px"
  10. size="mini"
  11. label-position="left"
  12. >
  13. <el-row :gutter="20">
  14. <el-col :xs="24" :sm="24" :lg="24">
  15. <el-form-item prop="orderNum" label-width="0">
  16. <el-radio-group v-model="screenForm.status" @change="getList()">
  17. <el-radio-button label="">全部</el-radio-button>
  18. <el-radio-button
  19. v-for="(item, index) in statusList"
  20. :key="index"
  21. :label="item.value"
  22. >{{ item.label }}</el-radio-button
  23. >
  24. </el-radio-group>
  25. </el-form-item>
  26. </el-col>
  27. <el-col :xs="24" :sm="12" :lg="6">
  28. <el-form-item label="发货单号" prop="orderNum">
  29. <el-input
  30. v-model="screenForm.orderNum"
  31. placeholder="请输入发货单号"
  32. ></el-input>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :xs="24" :sm="12" :lg="6">
  36. <el-form-item label="订单号" prop="mainOrderId">
  37. <el-input
  38. v-model="screenForm.mainOrderId"
  39. placeholder="请输入订单号"
  40. ></el-input>
  41. </el-form-item>
  42. </el-col>
  43. <el-col :xs="24" :sm="12" :lg="6">
  44. <el-form-item label="经销商名称" prop="jxsName">
  45. <el-input
  46. v-model="screenForm.jxsName"
  47. placeholder="请输入经销商名称"
  48. ></el-input>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :xs="24" :sm="12" :lg="6">
  52. <el-form-item label="经销商编号" prop="jxsNum">
  53. <el-input
  54. v-model="screenForm.jxsNum"
  55. placeholder="请输入规格型号"
  56. ></el-input>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :xs="24" :sm="12" :lg="6">
  60. <el-form-item label="产品名称" prop="chName">
  61. <el-input
  62. v-model="screenForm.chName"
  63. placeholder="请输入产品名称"
  64. ></el-input>
  65. </el-form-item>
  66. </el-col>
  67. <el-col :xs="24" :sm="12" :lg="6">
  68. <el-form-item label="物料编码" prop="chNum">
  69. <el-input
  70. v-model="screenForm.chNum"
  71. placeholder="请输入物料编码"
  72. ></el-input>
  73. </el-form-item>
  74. </el-col>
  75. <el-col :xs="24" :sm="12" :lg="6">
  76. <el-form-item label="规格型号" prop="model">
  77. <el-input
  78. v-model="screenForm.model"
  79. placeholder="请输入规格型号"
  80. ></el-input>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :xs="24" :sm="12" :lg="6">
  84. <el-form-item label="仓库名称" prop="warehouse">
  85. <el-input
  86. v-model="screenForm.warehouse"
  87. placeholder="请输入仓库名称"
  88. ></el-input>
  89. </el-form-item>
  90. </el-col>
  91. <el-col :xs="24" :sm="12" :lg="6">
  92. <el-form-item label="单据日期" prop="date">
  93. <el-date-picker
  94. v-model="screenForm.date"
  95. type="datetimerange"
  96. range-separator="至"
  97. style="width: 100%"
  98. value-format="yyyy-MM-dd HH:mm:ss"
  99. start-placeholder="开始日期"
  100. end-placeholder="结束日期"
  101. >
  102. </el-date-picker>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :xs="24" :sm="12" :lg="6">
  106. <el-form-item label="审核日期" prop="approval">
  107. <el-date-picker
  108. v-model="screenForm.approval"
  109. type="datetimerange"
  110. range-separator="至"
  111. style="width: 100%"
  112. value-format="yyyy-MM-dd HH:mm:ss"
  113. start-placeholder="开始日期"
  114. end-placeholder="结束日期"
  115. >
  116. </el-date-picker>
  117. </el-form-item>
  118. </el-col>
  119. <el-col :xs="24" :sm="12" :lg="6">
  120. <el-form-item label="出库单号" prop="id">
  121. <el-input
  122. v-model="screenForm.id"
  123. placeholder="请输入出库单号"
  124. ></el-input>
  125. </el-form-item>
  126. </el-col>
  127. <el-col :xs="24" :sm="12" :lg="6" class="tr">
  128. <el-form-item label="">
  129. <el-button @click="resetScreenForm">清空</el-button>
  130. <el-button type="primary" @click="submitScreenForm"
  131. >搜索</el-button
  132. >
  133. </el-form-item>
  134. </el-col>
  135. </el-row>
  136. </el-form>
  137. </div>
  138. <div class="mymain-container">
  139. <div class="btn-group clearfix">
  140. <div class="fl">
  141. <el-button
  142. size="mini"
  143. type="primary"
  144. icon="el-icon-plus"
  145. @click="toReturnForm()"
  146. v-if="$checkBtnRole('refund', $route.meta.roles)"
  147. >退货申请</el-button
  148. >
  149. <el-button
  150. size="mini"
  151. type="warning"
  152. icon="el-icon-finished"
  153. @click="batchExamine"
  154. :disabled="multipleSelection.length < 1"
  155. v-if="$checkBtnRole('examine', $route.meta.roles)"
  156. >批量审批</el-button
  157. >
  158. </div>
  159. <div class="fr">
  160. <ExportButton :exUrl="'sale/order/export'" :exParams="exParams" />
  161. </div>
  162. </div>
  163. <div class="table">
  164. <el-table
  165. v-loading="listLoading"
  166. :data="dataList"
  167. element-loading-text="Loading"
  168. border
  169. fit
  170. highlight-current-row
  171. stripe
  172. @selection-change="handleSelectionChange"
  173. show-summary
  174. :summary-method="$getSummaries"
  175. >
  176. <el-table-column
  177. align="center"
  178. type="selection"
  179. width="55"
  180. ></el-table-column>
  181. <el-table-column
  182. align="left"
  183. label="状态"
  184. prop="examineStatus"
  185. min-width="100"
  186. show-overflow-tooltip
  187. >
  188. <template slot-scope="scope">
  189. {{ scope.row.examineStatus | statusFilter }}
  190. </template>
  191. </el-table-column>
  192. <!-- <el-table-column
  193. align="left"
  194. label="发票号"
  195. prop="billReceipt"
  196. min-width="250"
  197. show-overflow-tooltip
  198. >
  199. <template slot-scope="scope">
  200. {{ scope.row.billReceipt }}
  201. </template>
  202. </el-table-column> -->
  203. <!-- <el-table-column
  204. align="left"
  205. label="出库单号"
  206. prop="id"
  207. min-width="110"
  208. show-overflow-tooltip
  209. >
  210. <template slot-scope="scope">
  211. <CopyButton :copyText="scope.row.id" />
  212. <span>{{ scope.row.id }}</span>
  213. </template>
  214. </el-table-column> -->
  215. <el-table-column align="left" label="发货单号" prop="orderNo" min-width="130" show-overflow-tooltip>
  216. <template slot-scope="scope">
  217. <CopyButton :copyText="scope.row.orderNo" />
  218. <span>{{scope.row.orderNo}}</span>
  219. </template>
  220. </el-table-column>
  221. <!-- <el-table-column align="left" label="订单号" prop="orderNo" min-width="140" show-overflow-tooltip>-->
  222. <!-- <template slot-scope="scope">-->
  223. <!-- <CopyButton :copyText="scope.row.orderType === 'TRADE' ? scope.row.enginOrderNo : scope.row.mainOrderId" />-->
  224. <!-- <span>{{scope.row.orderType === 'TRADE' || scope.row.orderType === 'HOME' ? scope.row.enginOrderNo : scope.row.mainOrderId}}</span>-->
  225. <!-- </template>-->
  226. <!-- </el-table-column>-->
  227. <el-table-column
  228. align="left"
  229. label="仓库"
  230. prop="correspondName"
  231. min-width="100"
  232. show-overflow-tooltip
  233. ></el-table-column>
  234. <el-table-column
  235. align="left"
  236. label="经销商编码"
  237. prop="customerNumber"
  238. min-width="100"
  239. show-overflow-tooltip
  240. >
  241. <template slot-scope="scope">
  242. <CopyButton :copyText="scope.row.customerNumber" />
  243. <span>{{ scope.row.customerNumber }}</span>
  244. </template>
  245. </el-table-column>
  246. <el-table-column
  247. align="left"
  248. label="经销商名称"
  249. prop="customerName"
  250. min-width="250"
  251. show-overflow-tooltip
  252. >
  253. <template slot-scope="scope">
  254. <CopyButton :copyText="scope.row.customerName" />
  255. <span>{{ scope.row.customerName }}</span>
  256. </template>
  257. </el-table-column>
  258. <el-table-column
  259. align="left"
  260. label="物料编码"
  261. prop="materialCode"
  262. min-width="120"
  263. show-overflow-tooltip
  264. >
  265. <template slot-scope="scope">
  266. <CopyButton :copyText="scope.row.materialCode" />
  267. <span>{{ scope.row.materialCode }}</span>
  268. </template>
  269. </el-table-column>
  270. <el-table-column
  271. align="left"
  272. label="产品编码"
  273. prop="materialOldNumber"
  274. min-width="140"
  275. show-overflow-tooltip
  276. >
  277. <template slot-scope="scope">
  278. <CopyButton :copyText="scope.row.materialOldNumber" />
  279. <span>{{ scope.row.materialOldNumber }}</span>
  280. </template>
  281. </el-table-column>
  282. <el-table-column
  283. align="left"
  284. label="产品名称"
  285. prop="materialName"
  286. min-width="160"
  287. show-overflow-tooltip
  288. >
  289. <template slot-scope="scope">
  290. <CopyButton :copyText="scope.row.materialName" />
  291. <span>{{ scope.row.materialName }}</span>
  292. </template>
  293. </el-table-column>
  294. <el-table-column
  295. align="left"
  296. label="规格型号"
  297. prop="specification"
  298. min-width="350"
  299. show-overflow-tooltip
  300. >
  301. <template slot-scope="scope">
  302. <CopyButton :copyText="scope.row.specification" />
  303. <span>{{ scope.row.specification }}</span>
  304. </template>
  305. </el-table-column>
  306. <el-table-column
  307. align="left"
  308. label="单位"
  309. prop="unit"
  310. min-width="100"
  311. show-overflow-tooltip
  312. ></el-table-column>
  313. <el-table-column
  314. align="right"
  315. label="数量"
  316. prop="refundableQty"
  317. min-width="100"
  318. show-overflow-tooltip
  319. ></el-table-column>
  320. <!-- <el-table-column align="right" label="单价" prop="price" min-width="100" show-overflow-tooltip>-->
  321. <!-- <template slot-scope="scope">-->
  322. <!-- {{ scope.row.price | numToFixed }}-->
  323. <!-- </template>-->
  324. <!-- </el-table-column>-->
  325. <!-- <el-table-column align="right" label="订单金额" prop="payAmount" min-width="100" show-overflow-tooltip>-->
  326. <!-- <template slot-scope="scope">-->
  327. <!-- {{ scope.row.payAmount | numToFixed }}-->
  328. <!-- </template>-->
  329. <!-- </el-table-column>-->
  330. <!-- <el-table-column align="left" label="订单备注" prop="headerRemark" min-width="160" show-overflow-tooltip></el-table-column> -->
  331. <!-- <el-table-column align="left" label="发货申请备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>-->
  332. <!-- <el-table-column align="left" label="表体备注" prop="invoiceRemark" min-width="160" show-overflow-tooltip></el-table-column>-->
  333. <!-- <el-table-column align="left" label="业务员" prop="serviceName" min-width="100" show-overflow-tooltip></el-table-column>-->
  334. <!-- <el-table-column align="left" label="表头业务员" prop="k3ServiceName" min-width="100" show-overflow-tooltip></el-table-column>-->
  335. <el-table-column
  336. align="center"
  337. label="操作"
  338. width="120"
  339. fixed="right"
  340. >
  341. <template slot-scope="scope">
  342. <el-button type="text" @click="toDetail(scope.row)"
  343. >详情</el-button
  344. >
  345. <el-button type="text" v-if="scope.row.type ===2 && scope.row.examineStatus!=='OK'"
  346. @click="toDetail(scope.row),edit = true"
  347. >编辑</el-button
  348. >
  349. <el-button
  350. type="text"
  351. @click="toExamine(scope.row)"
  352. v-if="
  353. $checkBtnRole('examine', $route.meta.roles) &&
  354. scope.row.examineStatus === 'WAIT'
  355. "
  356. >审批</el-button
  357. >
  358. <el-popconfirm
  359. style="margin-left: 10px"
  360. title="确定弃审吗?"
  361. @onConfirm="handleAbandon(scope.row.id)"
  362. v-if="
  363. $checkBtnRole('examine', $route.meta.roles) &&
  364. scope.row.examineStatus === 'OK'
  365. "
  366. >
  367. <el-button slot="reference" type="text">弃审</el-button>
  368. </el-popconfirm>
  369. </template>
  370. </el-table-column>
  371. </el-table>
  372. </div>
  373. </div>
  374. <div class="pagination clearfix">
  375. <div class="fr">
  376. <el-pagination
  377. @size-change="handleSizeChange"
  378. @current-change="handleCurrentChange"
  379. :current-page="currentPage"
  380. :page-sizes="[10, 20, 30, 50]"
  381. :page-size="10"
  382. layout="total, sizes, prev, pager, next, jumper"
  383. :total="listTotal"
  384. >
  385. </el-pagination>
  386. </div>
  387. </div>
  388. </div>
  389. <ExamineDialog
  390. :isShow.sync="isShowExamineDialog"
  391. :examineForm.sync="examineForm"
  392. />
  393. <SalesDetail
  394. :listItem="queryItem"
  395. :edit ='edit'
  396. v-if="isShowDetail"
  397. @backListFormDetail="backList"
  398. />
  399. <SalesExamine
  400. :listItem="queryItem"
  401. v-if="isShowExamine"
  402. @backListFormExamine="backList"
  403. />
  404. <SalesReturnForm
  405. :listItem="queryItem"
  406. v-if="isShowReturnForm"
  407. @backListFormDetail="backList"
  408. />
  409. </div>
  410. </template>
  411. <script>
  412. import {
  413. abandonData,
  414. examineBatch,
  415. examineJudge,
  416. getList,
  417. updateNum,
  418. } from "@/api/supply/sales";
  419. import SalesDetail from "@/views/supply/sales/components/sales_detail";
  420. import SalesExamine from "@/views/supply/sales/components/sales_examine";
  421. import SalesReturnForm from "@/views/supply/sales/components/sales_return_form";
  422. import ExamineDialog from "@/components/Common/examine-dialog";
  423. let that;
  424. export default {
  425. components: {
  426. SalesDetail,
  427. SalesExamine,
  428. SalesReturnForm,
  429. ExamineDialog,
  430. },
  431. filters: {
  432. statusFilter(val) {
  433. let obj = that.statusList.find((o) => o.value == val);
  434. return obj ? obj.label : "";
  435. },
  436. billStatusFilter(val) {
  437. const MAP = {
  438. 1: "已开票",
  439. 0: "未开票",
  440. };
  441. return MAP[val];
  442. },
  443. },
  444. data() {
  445. return {
  446. currentPage: 1, // 当前页码
  447. pageSize: 10, // 每页数量
  448. listTotal: 0, // 列表总数
  449. dataList: null, // 列表数据
  450. listLoading: false, // 列表加载loading
  451. screenForm: {
  452. // 筛选表单数据
  453. orderNum: "",
  454. jxsName: "",
  455. jxsNum: "",
  456. chName: "",
  457. chNum: "",
  458. model: "",
  459. warehouse: "",
  460. date: "",
  461. status: "",
  462. mainOrderId: "",
  463. approval:'',
  464. id:''
  465. },
  466. statusList: [
  467. { label: "已保存", value: "SAVE" },
  468. { label: "待审核", value: "WAIT" },
  469. { label: "审核通过", value: "OK" },
  470. // { label: '审核驳回', value: 'FAIL' },,
  471. ],
  472. centerDialogVisible:false,
  473. cid:'',
  474. queryItem: {},
  475. isShowDetail: false,
  476. isShowExamine: false,
  477. isShowReturnForm: false,
  478. value1: "",
  479. qty:'',
  480. edit:false,
  481. choiceDate: "",
  482. multipleSelection: [],
  483. isShowExamineDialog: false,
  484. examineForm: {
  485. status: "",
  486. remark: "",
  487. },
  488. setDisabled: {
  489. disabledDate: (time) => {
  490. if (this.choiceDate) {
  491. const res = 13 * 24 * 3600 * 1000;
  492. const minTime = this.choiceDate - res;
  493. const maxTime = this.choiceDate + res;
  494. return time.getTime() < minTime || time.getTime() > maxTime;
  495. }
  496. },
  497. onPick: ({ maxDate, minDate }) => {
  498. this.choiceDate = minDate.getTime();
  499. if (maxDate) this.choiceDate = "";
  500. },
  501. },
  502. };
  503. },
  504. computed: {
  505. exParams() {
  506. return {
  507. examineStatus: this.screenForm.status,
  508. orderNo: this.screenForm.orderNum,
  509. customerName: this.screenForm.jxsName,
  510. customerNumber: this.screenForm.jxsNum,
  511. materialName: this.screenForm.chName,
  512. materialNumber: this.screenForm.chNum,
  513. specification: this.screenForm.model,
  514. correspondName: this.screenForm.warehouse,
  515. startTime: this.screenForm.date ? this.screenForm.date[0] : "",
  516. endTime: this.screenForm.date ? this.screenForm.date[1] : "",
  517. approvalStartTime: this.screenForm.approval ? this.screenForm.approval[0] : "",
  518. approvalEndTime: this.screenForm.approval ? this.screenForm.approval[1] : "",
  519. mainOrderId: this.screenForm.mainOrderId,
  520. id: this.screenForm.id
  521. };
  522. },
  523. },
  524. beforeCreate() {
  525. that = this;
  526. },
  527. created() {
  528. this.getList();
  529. },
  530. methods: {
  531. // 查询列表
  532. getList() {
  533. this.listLoading = true;
  534. let params = {
  535. pageNum: this.currentPage,
  536. pageSize: this.pageSize,
  537. examineStatus: this.screenForm.status,
  538. orderNo: this.screenForm.orderNum,
  539. customerName: this.screenForm.jxsName,
  540. customerNumber: this.screenForm.jxsNum,
  541. materialName: this.screenForm.chName,
  542. materialNumber: this.screenForm.chNum,
  543. specification: this.screenForm.model,
  544. correspondName: this.screenForm.warehouse,
  545. startTime: this.screenForm.date ? this.screenForm.date[0] : "",
  546. endTime: this.screenForm.date ? this.screenForm.date[1] : "",
  547. approvalStartTime: this.screenForm.approval ? this.screenForm.approval[0] : "",
  548. approvalEndTime: this.screenForm.approval ? this.screenForm.approval[1] : "",
  549. mainOrderId: this.screenForm.mainOrderId,
  550. id: this.screenForm.id
  551. };
  552. getList(params).then((res) => {
  553. res.data.records.forEach((item) => {
  554. item.sums1 = ["refundableQty"];
  555. item.sums2 = ["price", "payAmount"];
  556. });
  557. this.dataList = res.data.records;
  558. this.listTotal = res.data.total;
  559. this.listLoading = false;
  560. });
  561. },
  562. updateReceipt() {
  563. if (!this.value1) {
  564. this.$errorMsg('请选择时间')
  565. return
  566. }
  567. // updateReceipt({
  568. // startTime:this.value1[0],
  569. // endTime:this.value1[1]
  570. // }).then(res=>{
  571. // this.getList();
  572. // this.$successMsg("已更新");
  573. // this.value1 = ''
  574. // })
  575. },
  576. // 提交筛选表单
  577. submitScreenForm() {
  578. this.currentPage = 1;
  579. this.getList();
  580. },
  581. // 重置筛选表单
  582. resetScreenForm() {
  583. this.$refs.screenForm.resetFields();
  584. this.currentPage = 1;
  585. this.getList();
  586. },
  587. // 更改每页数量
  588. handleSizeChange(val) {
  589. this.pageSize = val;
  590. this.currentPage = 1;
  591. this.getList();
  592. },
  593. // 更改当前页
  594. handleCurrentChange(val) {
  595. this.currentPage = val;
  596. this.getList();
  597. },
  598. // 判断是否可以审批
  599. async examineJudge(item) {
  600. // 获取页面模版
  601. const result = await new Promise((resolve, reject) => {
  602. examineJudge({ id: item.id })
  603. .then((res) => {
  604. resolve(res.code == 200);
  605. })
  606. .catch((res) => {
  607. resolve(0);
  608. });
  609. });
  610. return result;
  611. },
  612. // 进入表单
  613. toReturnForm(item) {
  614. this.queryItem = item;
  615. this.isShowReturnForm = true;
  616. },
  617. // 进入详情
  618. toDetail(item) {
  619. this.queryItem = item;
  620. this.isShowDetail = true;
  621. },
  622. // 进入审批
  623. async toExamine(item) {
  624. const canExamine = await this.examineJudge(item);
  625. if (!canExamine) {
  626. return false;
  627. }
  628. this.queryItem = item;
  629. this.isShowExamine = true;
  630. },
  631. backList() {
  632. this.queryItem = {};
  633. this.isShowDetail = false;
  634. this.isShowExamine = false;
  635. this.isShowReturnForm = false;
  636. },
  637. handleSelectionChange(val) {
  638. this.multipleSelection = val;
  639. },
  640. // 打开 批量审批
  641. batchExamine() {
  642. this.isShowExamineDialog = true;
  643. },
  644. // 提交 批量审批
  645. submitExamineForm() {
  646. let ids = this.multipleSelection.map((item) => {
  647. return item.id;
  648. });
  649. examineBatch({
  650. ids: ids.join(","),
  651. examineStatus: this.examineForm.status,
  652. approvalRemark: this.examineForm.remark,
  653. }).then((res) => {
  654. this.isShowExamineDialog = false;
  655. this.getList();
  656. this.$successMsg("修改成功");
  657. });
  658. },
  659. // 弃审
  660. handleAbandon(id) {
  661. abandonData({ id }).then((res) => {
  662. this.$successMsg();
  663. this.getList();
  664. });
  665. },
  666. },
  667. };
  668. </script>
  669. <style lang="scss" scoped></style>