index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. <template>
  2. <div>
  3. <basic-container v-show="!detailsOpen">
  4. <avue-crud :option="option" :search.sync="search" v-model="form" :table-loading="loading" :data="dataList"
  5. ref="crud" :key="key" @on-load="onLoad" @search-change="searchChange" @row-del="rowDel"
  6. @expand-change="expandChange" @refresh-change="refreshChange"
  7. @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 269)"
  8. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 269)" :page.sync="page">
  9. <!-- <template slot-scope="{ row }" slot="status">
  10. <span v-for="(item, index) in orderStatusList" :key="index">
  11. <span v-if="item.dictKey == row.status" :style="{ background: item.colour }" class="bottomBox">
  12. {{ item.dictValue }}
  13. </span>
  14. </span>
  15. </template> -->
  16. <!-- <template slot-scope="{ row }" slot="actualPaymentStatus">
  17. <span v-for="(item, index) in actualStatusList" :key="index">
  18. <span v-if="item.dictKey == row.actualPaymentStatus" :style="{ background: item.colour }" class="bottomBox">
  19. {{ item.dictValue }}
  20. </span>
  21. </span>
  22. </template> -->
  23. <!-- <template slot-scope="{ row }" slot="returnsStatus">
  24. <span v-for="(item, index) in returnStatusList" :key="index">
  25. <span v-if="item.dictKey == row.returnsStatus" :style="{ background: item.colour }" class="bottomBox">
  26. {{ item.dictValue }}
  27. </span>
  28. </span>
  29. </template> -->
  30. <!--actualPaymentStatus-->
  31. <template slot-scope="{ row }" slot="expand">
  32. <avue-crud :data="row.itemData" :option="itemOption" :table-loading="row.itemLoading" :cell-style="cellStyle"
  33. class="itemTable"></avue-crud>
  34. </template>
  35. <template slot-scope="{type,size,row,index}" slot="menu">
  36. <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
  37. <el-button :size="size" :type="type"
  38. :disabled="row.status != '录入' && row.status != '待确认' && row.item >= 1 || row.businessSource == '外部销售' || row.billType == 1"
  39. @click="$refs.crud.rowDel(row, index)">删除</el-button>
  40. </template>
  41. <template slot="notCompleteSearch">
  42. <el-checkbox v-model="search.notComplete" true-label="1"></el-checkbox>
  43. </template>
  44. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  45. <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新建订单</el-button>
  46. <el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>
  47. </template>
  48. <template slot-scope="{ row, index }" slot="ordNo">
  49. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.ordNo }}
  50. </span>
  51. </template>
  52. <template slot-scope="{ row, index }" slot="srcOrdNo">
  53. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 3)">{{ row.srcOrdNo }}
  54. </span>
  55. </template>
  56. </avue-crud>
  57. </basic-container>
  58. <detailsPage v-if="detailsOpen" @goBack="goBack" :onLoad="form" :detailData="detailData" @backToList="backToList">
  59. </detailsPage>
  60. </div>
  61. </template>
  62. <script>
  63. // @ts-nocheck
  64. import { getList, remove,getDetails } from "@/api/salesManagement/saleOrder";
  65. import detailsPage from "./detailsPage"
  66. import { getToken } from "@/util/auth";
  67. export default {
  68. name: "index",
  69. components: {
  70. detailsPage
  71. },
  72. data() {
  73. return {
  74. detailsOpen: false,
  75. orderStatusList: [],
  76. actualStatusList: [],
  77. returnStatusList: [],
  78. loading: false,
  79. search: {},
  80. form: {},
  81. dataList: [],
  82. detailData: {},
  83. page: {
  84. pageSize: 20,
  85. currentPage: 1,
  86. total: 0,
  87. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  88. },
  89. key: 0,
  90. itemOption: {
  91. align: "center",
  92. header: false,
  93. border: true,
  94. menu: false,
  95. column: [
  96. {
  97. label: '商品名称',
  98. prop: 'goodsName',
  99. width: 200,
  100. overHidden: true,
  101. // dicData: [],
  102. // props: {
  103. // label: 'cname',
  104. // value: 'cname'
  105. // },
  106. // dicUrl: "/api/gubersail-admin/goodsDesc/goodsListAll"
  107. }, {
  108. label: '数量',
  109. prop: 'goodsNum',
  110. overHidden: true,
  111. width: 100,
  112. },
  113. {
  114. label: '价格',
  115. prop: 'price',
  116. overHidden: true,
  117. width: 100,
  118. },
  119. {
  120. label: '批次号',
  121. prop: 'dot',
  122. type: "select",
  123. disabled: true,
  124. allowCreate: true,
  125. filterable: true,
  126. width: 150,
  127. dicData: [],
  128. props: {
  129. label: "dot",
  130. value: "dot"
  131. },
  132. dicUrl: "/api/gubersail-admin/tireStockDesc/dotList",
  133. overHidden: true,
  134. }, {
  135. label: '商品编码',
  136. prop: 'goodsNo',
  137. overHidden: true,
  138. width: 150
  139. },
  140. // {
  141. // label: '品牌',
  142. // prop: 'brandId',
  143. // disabled: false,
  144. // width: 100,
  145. // overHidden: true,
  146. // props: {
  147. // label: 'cname',
  148. // value: 'id'
  149. // },
  150. // dicUrl: '/api/gubersail-admin/brandDesc/listAll?type=PP'
  151. // },
  152. {
  153. label: '品牌',
  154. prop: 'brandName',
  155. overHidden: true,
  156. disabled: false,
  157. width: 150
  158. },
  159. {
  160. label: '规格型号',
  161. prop: 'propertyName',
  162. overHidden: true,
  163. disabled: false,
  164. width: 150
  165. },
  166. {
  167. label: '花纹',
  168. prop: 'pattern',
  169. overHidden: true,
  170. disabled: false,
  171. width: 150
  172. },
  173. {
  174. label: '发货数量',
  175. prop: 'sendNum',
  176. disabled: false,
  177. overHidden: true,
  178. width: 100,
  179. }]
  180. },
  181. option: {
  182. viewBtn: false,
  183. editBtn: false,
  184. delBtn: false,
  185. addBtn: false,
  186. index: true,
  187. span: 6,
  188. border: true,
  189. height: "auto",
  190. searchMenuPosition: "right",
  191. align: "center",
  192. size: "small",
  193. menuWidth: 50,
  194. searchSpan: 6,
  195. searchMenuSpan: 18,
  196. searchIcon: true,
  197. expand: true,
  198. expandWidth: 60,
  199. searchIndex: 3,
  200. highlightCurrentRow: true,
  201. dialogWidth: "70%",
  202. summaryText:"合计",
  203. showSummary: true,
  204. sumColumnList: [{
  205. name: 'goodsTotalNum',
  206. type: 'sum',
  207. decimals: 0
  208. }, {
  209. name: 'totalMoney',
  210. type: 'sum',
  211. }, {
  212. name: 'returnsNumber',
  213. type: 'sum',
  214. }],
  215. column: [{
  216. label: '销售单号',
  217. prop: "ordNo",
  218. search: true,
  219. overHidden: true,
  220. }, {
  221. label: '来源单号',
  222. prop: "srcOrdNo",
  223. search: true,
  224. overHidden: true,
  225. },
  226. {
  227. label: '显示已完成',
  228. prop: 'notComplete',
  229. overHidden: true,
  230. hide: true,
  231. search: true,
  232. searchslot: true
  233. },
  234. {
  235. label: "业务来源",
  236. prop: "businessSource",
  237. overHidden: true,
  238. search: true,
  239. type: 'select',
  240. dicUrl: "/api/blade-system/dict-biz/dictionary?code=business_Source",
  241. props: {
  242. label: "dictValue",
  243. value: "dictKey"
  244. }
  245. },
  246. // {
  247. // label: '所属公司',
  248. // prop: "salesCompanyName",
  249. // overHidden: true,
  250. // },
  251. {
  252. label: '店铺名称',
  253. prop: "customerName",
  254. search: true,
  255. remote: true,
  256. overHidden: true,
  257. cell: true,
  258. width: 140,
  259. // type: 'select',
  260. // filterable: true,
  261. // props: {
  262. // label: 'cname',
  263. // value: 'cname',
  264. // res: 'data.records'
  265. // },
  266. // dicUrl: '/api/gubersail-admin/corpsDesc/list?current=1&size=20&corpType=KH&cname={{key}}',
  267. },
  268. {
  269. label: '业务员',
  270. disabled: false,
  271. prop: "salerName",
  272. search: true,
  273. type: "select",
  274. props: {
  275. label: "name",
  276. value: "name"
  277. },
  278. dicUrl: "/api/blade-user/salerList",
  279. filterable: true,
  280. rules: [{
  281. required: true,
  282. message: " ",
  283. trigger: "blur"
  284. }]
  285. }, {
  286. label: '仓库',
  287. prop: "storageName",
  288. search: true,
  289. overHidden: true,
  290. // remote: true,
  291. type: 'select',
  292. props: {
  293. label: 'cname',
  294. value: 'cname'
  295. },
  296. dicUrl: '/api/gubersail-admin/storageDesc/listAll?cname={{key}}',
  297. }, {
  298. label: '行数',
  299. prop: "numberRows",
  300. overHidden: true,
  301. }, {
  302. label: '商品名称',
  303. prop: "goodsNameJoin",
  304. search: true,
  305. overHidden: true,
  306. // filterable: true,
  307. // remote:true,
  308. // type: 'select',
  309. // props: {
  310. // label: 'cname',
  311. // value: 'cname',
  312. // res: 'data.records'
  313. // },
  314. // dicUrl: "/api/gubersail-admin/goodsDesc/list?current=1&size=20&cname={{key}}"
  315. }, {
  316. label: '数量',
  317. prop: "goodsTotalNum",
  318. overHidden: true,
  319. }, {
  320. label: '总金额',
  321. prop: "totalMoney",
  322. overHidden: true,
  323. }, {
  324. label: '已收金额',
  325. prop: "paymentAmountTl",
  326. overHidden: true,
  327. }, {
  328. label: '余额抵扣',
  329. prop: "paymentRecoveredBalance",
  330. overHidden: true,
  331. }, {
  332. label: '退货数量',
  333. prop: "returnsNumber",
  334. overHidden: true,
  335. }, {
  336. label: '退货金额',
  337. prop: "returnsAmount",
  338. overHidden: true,
  339. }, {
  340. label: '状态',
  341. prop: "status",
  342. search: true,
  343. overHidden: true,
  344. type: 'select',
  345. dicUrl: "/api/blade-system/dict-biz/dictionary?code=sales_Status",
  346. props: {
  347. label: "dictValue",
  348. value: "dictKey"
  349. },
  350. }, {
  351. label: '结算状态',
  352. prop: "actualPaymentStatus",
  353. searchProp: 'actualPaymentType',
  354. search: true,
  355. overHidden: true,
  356. type: 'select',
  357. dicData: [
  358. {
  359. label: "待收款",
  360. value: 1,
  361. },
  362. {
  363. label: "已收款",
  364. value: 2,
  365. },
  366. {
  367. label: "尾款",
  368. value: 3,
  369. },
  370. {
  371. label: "已退款",
  372. value: 4,
  373. }
  374. ],
  375. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=settlement_Status",
  376. // props: {
  377. // label: "dictValue",
  378. // value: "dictKey"
  379. // }
  380. },
  381. {
  382. label: '退货状态',
  383. prop: "returnsStatus",
  384. overHidden: true,
  385. },
  386. {
  387. label: '备注',
  388. prop: "remarks",
  389. overHidden: true,
  390. },
  391. {
  392. label: '应结日期',
  393. prop: "dueDate",
  394. overHidden: true,
  395. },
  396. {
  397. label: '业务日期',
  398. prop: "businesDate",
  399. searchProp: "businesDateList",
  400. type: "date",
  401. overHidden: true,
  402. search: true,
  403. width: 100,
  404. unlinkPanels: true,
  405. searchRange: true,
  406. searchDefaultTime: ["00:00:00", "23:59:59"],
  407. format: "yyyy-MM-dd",
  408. valueFormat: "yyyy-MM-dd HH:mm:ss"
  409. },
  410. {
  411. label: '出库日期',
  412. prop: "deliveryBusinesDate",
  413. searchProp: "deliveryBusinesDateList",
  414. type: "date",
  415. overHidden: true,
  416. search: true,
  417. width: 100,
  418. unlinkPanels: true,
  419. searchRange: true,
  420. searchDefaultTime: ["00:00:00", "23:59:59"],
  421. format: "yyyy-MM-dd",
  422. valueFormat: "yyyy-MM-dd HH:mm:ss"
  423. }, {
  424. label: '收费日期',
  425. prop: "paymentDate",
  426. searchProp: "paymentDateList",
  427. type: "date",
  428. overHidden: true,
  429. search: true,
  430. width: 100,
  431. unlinkPanels: true,
  432. searchRange: true,
  433. searchDefaultTime: ["00:00:00", "23:59:59"],
  434. format: "yyyy-MM-dd",
  435. valueFormat: "yyyy-MM-dd HH:mm:ss"
  436. }, {
  437. label: "制单人",
  438. prop: "createUserName",
  439. searchProp: "createUser",
  440. overHidden: true,
  441. width: 100,
  442. filterable: true,
  443. remote: true,
  444. type: "select",
  445. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  446. props: {
  447. label: "account",
  448. value: "id",
  449. res: 'data.records'
  450. }
  451. }, {
  452. label: "制单日期",
  453. prop: "createTime",
  454. searchProp: "createTimeList",
  455. type: "date",
  456. overHidden: true,
  457. width: 100,
  458. searchRange: true,
  459. searchDefaultTime: ["00:00:00", "23:59:59"],
  460. format: "yyyy-MM-dd",
  461. valueFormat: "yyyy-MM-dd HH:mm:ss"
  462. }, {
  463. label: "更新人",
  464. prop: "updateUserName",
  465. searchProp: "updateUser",
  466. overHidden: true,
  467. width: 100,
  468. filterable: true,
  469. remote: true,
  470. type: "select",
  471. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  472. props: {
  473. label: "account",
  474. value: "id",
  475. res: 'data.records'
  476. }
  477. }, {
  478. label: "更新日期",
  479. prop: "updateTime",
  480. searchProp: "updateTimeList",
  481. type: "date",
  482. overHidden: true,
  483. width: 100,
  484. searchRange: true,
  485. searchDefaultTime: ["00:00:00", "23:59:59"],
  486. format: "yyyy-MM-dd",
  487. valueFormat: "yyyy-MM-dd HH:mm:ss"
  488. }]
  489. }
  490. }
  491. },
  492. activated() {
  493. setTimeout(() => {
  494. console.log(this.$route.query, 400)
  495. // 主页快捷跳转来的 直接打开新建订单
  496. if (this.$route.query.showTrue) {
  497. this.$store.commit("IN_LTXS_STATUS");
  498. this.detailsOpen = true;
  499. }
  500. if (this.$route.query.check) {
  501. this.editOpen({ id: this.$route.query.check.srcBillId }, 1)
  502. this.$store.commit("IN_LTXS_STATUS");
  503. }
  504. if (this.$route.query.type == 'S') {
  505. this.editOpen({ id: this.$route.query.detail.srcParentId }, 1)
  506. }
  507. if (this.$route.query.jumpId) {
  508. this.editOpen({ id: this.$route.query.jumpId }, 1)
  509. }
  510. this.detailData = {
  511. id: this.$route.query.check.billId,
  512. check: this.$route.query.check,
  513. auditId: this.$route.query.check.id
  514. };
  515. }, 100);
  516. },
  517. created() {
  518. // if (i % 3 !== 0) {
  519. // const num = 3 - Number(i % 3)
  520. // this.option.searchMenuSpan = num * 8;
  521. // this.option.searchMenuPosition = "right";
  522. // }
  523. this.getWorkDicts("sales_Status").then(res => {
  524. this.orderStatusList = res.data.data
  525. });
  526. this.getWorkDicts("settlement_Status").then(res => {
  527. this.actualStatusList = res.data.data
  528. });
  529. this.getWorkDicts("return_Status").then(res => {
  530. this.returnStatusList = res.data.data
  531. });
  532. },
  533. methods: {
  534. // 导出
  535. outExport() {
  536. console.log(this.search, 412)
  537. let config = { params: { ...this.search } }
  538. if (config.params) {
  539. for (const propName of Object.keys(config.params)) {
  540. const value = config.params[propName];
  541. if (value !== null && typeof (value) !== "undefined") {
  542. if (value instanceof Array) {
  543. for (const key of Object.keys(value)) {
  544. let params = propName + '[' + key + ']';
  545. config.params[params] = value[key]
  546. }
  547. delete config.params[propName]
  548. }
  549. }
  550. }
  551. }
  552. console.log(config, 427)
  553. config.params.bsType = 'XS'
  554. const routeData = this.$router.resolve({
  555. path: '/api/gubersail-admin/order/listExport', //跳转目标下载地址
  556. query: {
  557. ...config.params //括号内是要传递给新窗口的参数
  558. }
  559. })
  560. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  561. },
  562. check(row) {
  563. this.form = row
  564. this.detailsOpen = true
  565. },
  566. backToList(type) {
  567. if (JSON.stringify(this.$route.query) != "{}") {
  568. this.$router.$avueRouter.closeTag();
  569. this.$router.push({
  570. path: "/tirePartsMall/salesManagement/saleOrder/index"
  571. });
  572. }
  573. this.form = {}
  574. this.detailsOpen = false
  575. if (type === 0) {
  576. this.detailData = {}
  577. }
  578. this.onLoad(this.page, this.search)
  579. this.$store.commit("OUT_LTXS_STATUS");
  580. },
  581. editOpen(row, status) {
  582. this.form = row
  583. this.detailData = {
  584. id: row.id,
  585. status: status
  586. };
  587. console.log(status);
  588. this.$store.commit("IN_LTXS_STATUS");
  589. this.detailsOpen = true;
  590. },
  591. //刷新
  592. refreshChange() {
  593. this.onLoad(this.page, this.search)
  594. },
  595. expandChange(row) {
  596. if (!row.itemData) {
  597. getDetails({ id: row.id })
  598. .then(res => {
  599. this.dataList[row.$index].itemData = res.data.data.orderItemsList;
  600. })
  601. .finally(() => {
  602. this.dataList[row.$index].itemLoading = false;
  603. });
  604. }
  605. },
  606. rowDel(form, index) {
  607. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  608. confirmButtonText: '确定',
  609. cancelButtonText: '取消',
  610. type: 'warning'
  611. }).then(() => {
  612. remove({ id: form.id }).then(res => {
  613. this.$message({
  614. type: 'success',
  615. message: '删除成功!'
  616. });
  617. this.dataList.splice(index, 1);
  618. this.onLoad(this.page)
  619. })
  620. }).catch(() => {
  621. });
  622. },
  623. searchChange(params, done) {
  624. this.page.currentPage = 1
  625. params.notComplete = 1
  626. this.onLoad(this.page, params)
  627. done();
  628. },
  629. onLoad(page, params = {}) {
  630. params = {
  631. ...params,
  632. current: page.currentPage,
  633. size: page.pageSize,
  634. bsType: "XS",
  635. ...Object.assign(params, this.search)
  636. }
  637. this.loading = true
  638. this.dataList.forEach(item => {
  639. this.$refs.crud.toggleRowExpansion(item, false);
  640. });
  641. getList(params).then(res => {
  642. if (res.data.data.records) {
  643. res.data.data.records.forEach(e => {
  644. e.itemLoading = true;
  645. });
  646. }
  647. this.dataList = res.data.data.records
  648. this.page.total = res.data.data.total
  649. this.$nextTick(() => {
  650. this.$refs.crud.doLayout()
  651. this.$refs.crud.dicInit()
  652. })
  653. this.loading = false
  654. }).finally(() => {
  655. this.loading = false
  656. })
  657. },
  658. //自定义列保存
  659. async saveColumnTwo(ref, option, optionBack, code) {
  660. /**
  661. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  662. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  663. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  664. */
  665. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  666. if (inSave) {
  667. this.$message.success("保存成功");
  668. //关闭窗口
  669. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  670. }
  671. },
  672. //自定义列重置
  673. async resetColumnTwo(ref, option, optionBack, code) {
  674. this[option] = this[optionBack];
  675. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  676. if (inSave) {
  677. this.$message.success("重置成功");
  678. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  679. }
  680. }
  681. }
  682. }
  683. </script>
  684. <style scoped>
  685. .itemTable ::v-deep .el-table {
  686. margin-left: 50px;
  687. width: 100%;
  688. }
  689. .bottomBox {
  690. padding: 3px 6px;
  691. border-radius: 12px;
  692. color: #fff;
  693. font-size: 10px;
  694. }
  695. /deep/ .el-col-md-8 {
  696. width: 24.33333%;
  697. }
  698. </style>