index.vue 21 KB

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