index.vue 22 KB

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