index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  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 == '外部销售'"
  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: 24,
  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. // type: 'select',
  262. // filterable: true,
  263. // props: {
  264. // label: 'cname',
  265. // value: 'cname',
  266. // res: 'data.records'
  267. // },
  268. // dicUrl: '/api/blade-sales-part/corpsDesc/list?current=1&size=20&corpType=KH&cname={{key}}',
  269. },
  270. {
  271. label: '业务员',
  272. disabled: false,
  273. prop: "salerName",
  274. search: true,
  275. type: "select",
  276. props: {
  277. label: "name",
  278. value: "name"
  279. },
  280. dicUrl: "/api/blade-user/salerList",
  281. filterable: true,
  282. rules: [{
  283. required: true,
  284. message: " ",
  285. trigger: "blur"
  286. }]
  287. }, {
  288. label: '仓库',
  289. prop: "storageName",
  290. search: true,
  291. overHidden: true,
  292. // remote: true,
  293. type: 'select',
  294. props: {
  295. label: 'cname',
  296. value: 'cname'
  297. },
  298. dicUrl: '/api/blade-sales-part/storageDesc/listAll?cname={{key}}',
  299. }, {
  300. label: '行数',
  301. prop: "numberRows",
  302. overHidden: true,
  303. }, {
  304. label: '商品名称',
  305. prop: "goodsNameJoin",
  306. search: true,
  307. overHidden: true,
  308. // filterable: true,
  309. // remote:true,
  310. // type: 'select',
  311. // props: {
  312. // label: 'cname',
  313. // value: 'cname',
  314. // res: 'data.records'
  315. // },
  316. // dicUrl: "/api/blade-sales-part/goodsDesc/list?current=1&size=20&cname={{key}}"
  317. }, {
  318. label: '数量',
  319. prop: "goodsTotalNum",
  320. overHidden: true,
  321. }, {
  322. label: '金额',
  323. prop: "totalMoney",
  324. overHidden: true,
  325. }, {
  326. label: '已收金额',
  327. prop: "paymentAmountTl",
  328. overHidden: true,
  329. }, {
  330. label: '退货数量',
  331. prop: "returnsNumber",
  332. overHidden: true,
  333. }, {
  334. label: '退货金额',
  335. prop: "returnsAmount",
  336. overHidden: true,
  337. }, {
  338. label: '状态',
  339. prop: "status",
  340. search: true,
  341. overHidden: true,
  342. type: 'select',
  343. dicUrl: "/api/blade-system/dict-biz/dictionary?code=sales_Status",
  344. props: {
  345. label: "dictValue",
  346. value: "dictKey"
  347. },
  348. }, {
  349. label: '结算状态',
  350. prop: "actualPaymentStatus",
  351. searchProp: 'actualPaymentType',
  352. search: true,
  353. overHidden: true,
  354. type: 'select',
  355. dicData: [
  356. {
  357. label: "待收款",
  358. value: 1,
  359. },
  360. {
  361. label: "已收款",
  362. value: 2,
  363. },
  364. {
  365. label: "尾款",
  366. value: 3,
  367. },
  368. {
  369. label: "已退款",
  370. value: 4,
  371. }
  372. ],
  373. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=settlement_Status",
  374. // props: {
  375. // label: "dictValue",
  376. // value: "dictKey"
  377. // }
  378. },
  379. {
  380. label: '退货状态',
  381. prop: "returnsStatus",
  382. overHidden: true,
  383. },
  384. {
  385. label: '应结日期',
  386. prop: "dueDate",
  387. overHidden: true,
  388. },
  389. {
  390. label: '业务日期',
  391. prop: "businesDate",
  392. searchProp: "businesDateList",
  393. type: "date",
  394. overHidden: true,
  395. search: true,
  396. width: 100,
  397. unlinkPanels: true,
  398. searchRange: true,
  399. searchDefaultTime: ["00:00:00", "23:59:59"],
  400. format: "yyyy-MM-dd",
  401. valueFormat: "yyyy-MM-dd HH:mm:ss"
  402. }, {
  403. label: '收费日期',
  404. prop: "paymentDate",
  405. searchProp: "paymentDateList",
  406. type: "date",
  407. overHidden: true,
  408. search: true,
  409. width: 100,
  410. unlinkPanels: true,
  411. searchRange: true,
  412. searchDefaultTime: ["00:00:00", "23:59:59"],
  413. format: "yyyy-MM-dd",
  414. valueFormat: "yyyy-MM-dd HH:mm:ss"
  415. }, {
  416. label: "制单人",
  417. prop: "createUserName",
  418. searchProp: "createUser",
  419. overHidden: true,
  420. width: 100,
  421. filterable: true,
  422. remote: true,
  423. type: "select",
  424. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  425. props: {
  426. label: "account",
  427. value: "id",
  428. res: 'data.records'
  429. }
  430. }, {
  431. label: "制单日期",
  432. prop: "createTime",
  433. searchProp: "createTimeList",
  434. type: "date",
  435. overHidden: true,
  436. width: 100,
  437. searchRange: true,
  438. searchDefaultTime: ["00:00:00", "23:59:59"],
  439. format: "yyyy-MM-dd",
  440. valueFormat: "yyyy-MM-dd HH:mm:ss"
  441. }, {
  442. label: "更新人",
  443. prop: "updateUserName",
  444. searchProp: "updateUser",
  445. overHidden: true,
  446. width: 100,
  447. filterable: true,
  448. remote: true,
  449. type: "select",
  450. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  451. props: {
  452. label: "account",
  453. value: "id",
  454. res: 'data.records'
  455. }
  456. }, {
  457. label: "更新日期",
  458. prop: "updateTime",
  459. searchProp: "updateTimeList",
  460. type: "date",
  461. overHidden: true,
  462. width: 100,
  463. searchRange: true,
  464. searchDefaultTime: ["00:00:00", "23:59:59"],
  465. format: "yyyy-MM-dd",
  466. valueFormat: "yyyy-MM-dd HH:mm:ss"
  467. }]
  468. }
  469. }
  470. },
  471. activated() {
  472. setTimeout(() => {
  473. console.log(this.$route.query, 400)
  474. // 主页快捷跳转来的 直接打开新建订单
  475. if (this.$route.query.showTrue) {
  476. this.$store.commit("IN_LTXS_STATUS");
  477. this.detailsOpen = true;
  478. }
  479. if (this.$route.query.check) {
  480. this.editOpen({ id: this.$route.query.check.srcBillId }, 1)
  481. this.$store.commit("IN_LTXS_STATUS");
  482. }
  483. if (this.$route.query.type == 'S') {
  484. this.editOpen({ id: this.$route.query.detail.srcParentId }, 1)
  485. }
  486. if (this.$route.query.jumpId) {
  487. this.editOpen({ id: this.$route.query.jumpId }, 1)
  488. }
  489. this.detailData = {
  490. id: this.$route.query.check.billId,
  491. check: this.$route.query.check,
  492. auditId: this.$route.query.check.id
  493. };
  494. }, 100);
  495. },
  496. async created() {
  497. this.option = await this.getColumnData(this.getColumnName(269), this.optionList);
  498. this.key++
  499. let i = 0;
  500. this.option.column.forEach(item => {
  501. if (item.search) i++
  502. })
  503. // if (i % 3 !== 0) {
  504. // const num = 3 - Number(i % 3)
  505. // this.option.searchMenuSpan = num * 8;
  506. // this.option.searchMenuPosition = "right";
  507. // }
  508. this.getWorkDicts("sales_Status").then(res => {
  509. this.orderStatusList = res.data.data
  510. console.log(this.orderStatusList);
  511. });
  512. this.getWorkDicts("settlement_Status").then(res => {
  513. this.actualStatusList = res.data.data
  514. });
  515. this.getWorkDicts("return_Status").then(res => {
  516. this.returnStatusList = res.data.data
  517. });
  518. },
  519. methods: {
  520. // 导出
  521. outExport() {
  522. console.log(this.search, 412)
  523. let config = { params: { ...this.search } }
  524. if (config.params) {
  525. for (const propName of Object.keys(config.params)) {
  526. const value = config.params[propName];
  527. if (value !== null && typeof (value) !== "undefined") {
  528. if (value instanceof Array) {
  529. for (const key of Object.keys(value)) {
  530. let params = propName + '[' + key + ']';
  531. config.params[params] = value[key]
  532. }
  533. delete config.params[propName]
  534. }
  535. }
  536. }
  537. }
  538. console.log(config, 427)
  539. config.params.bsType = 'XS'
  540. const routeData = this.$router.resolve({
  541. path: '/api/blade-sales-part/order/listExport', //跳转目标下载地址
  542. query: {
  543. ...config.params //括号内是要传递给新窗口的参数
  544. }
  545. })
  546. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  547. },
  548. check(row) {
  549. this.form = row
  550. this.detailsOpen = true
  551. },
  552. backToList(type) {
  553. if (JSON.stringify(this.$route.query) != "{}") {
  554. this.$router.$avueRouter.closeTag();
  555. this.$router.push({
  556. path: "/tirePartsMall/salesManagement/saleOrder/index"
  557. });
  558. }
  559. this.form = {}
  560. this.detailsOpen = false
  561. if (type === 0) {
  562. this.detailData = {}
  563. }
  564. this.onLoad(this.page, this.search)
  565. this.$store.commit("OUT_LTXS_STATUS");
  566. },
  567. editOpen(row, status) {
  568. this.form = row
  569. this.detailData = {
  570. id: row.id,
  571. status: status
  572. };
  573. console.log(status);
  574. this.$store.commit("IN_LTXS_STATUS");
  575. this.detailsOpen = true;
  576. },
  577. //刷新
  578. refreshChange() {
  579. this.onLoad(this.page, this.search)
  580. },
  581. expandChange(row) {
  582. if (!row.itemData) {
  583. getDetails({ id: row.id })
  584. .then(res => {
  585. this.dataList[row.$index].itemData = res.data.data.orderItemsList;
  586. })
  587. .finally(() => {
  588. this.dataList[row.$index].itemLoading = false;
  589. });
  590. }
  591. },
  592. rowDel(form, index) {
  593. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  594. confirmButtonText: '确定',
  595. cancelButtonText: '取消',
  596. type: 'warning'
  597. }).then(() => {
  598. remove({ id: form.id }).then(res => {
  599. this.$message({
  600. type: 'success',
  601. message: '删除成功!'
  602. });
  603. this.dataList.splice(index, 1);
  604. this.onLoad(this.page)
  605. })
  606. }).catch(() => {
  607. });
  608. },
  609. searchChange(params, done) {
  610. this.page.currentPage = 1
  611. params.notComplete = 1
  612. this.onLoad(this.page, params)
  613. done();
  614. },
  615. onLoad(page, params = {}) {
  616. params = {
  617. ...params,
  618. current: page.currentPage,
  619. size: page.pageSize,
  620. bsType: "XS",
  621. ...Object.assign(params, this.search)
  622. }
  623. this.loading = true
  624. this.dataList.forEach(item => {
  625. this.$refs.crud.toggleRowExpansion(item, false);
  626. });
  627. getList(params).then(res => {
  628. if (res.data.data.records) {
  629. res.data.data.records.forEach(e => {
  630. e.itemLoading = true;
  631. });
  632. }
  633. this.dataList = res.data.data.records
  634. this.page.total = res.data.data.total
  635. this.$nextTick(() => {
  636. this.$refs.crud.doLayout()
  637. this.$refs.crud.dicInit()
  638. })
  639. this.loading = false
  640. }).finally(() => {
  641. this.loading = false
  642. })
  643. },
  644. //自定义列保存
  645. async saveColumnTwo(ref, option, optionBack, code) {
  646. /**
  647. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  648. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  649. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  650. */
  651. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  652. if (inSave) {
  653. this.$message.success("保存成功");
  654. //关闭窗口
  655. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  656. }
  657. },
  658. //自定义列重置
  659. async resetColumnTwo(ref, option, optionBack, code) {
  660. this[option] = this[optionBack];
  661. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  662. if (inSave) {
  663. this.$message.success("重置成功");
  664. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  665. }
  666. }
  667. }
  668. }
  669. </script>
  670. <style scoped>
  671. .itemTable ::v-deep .el-table {
  672. margin-left: 50px;
  673. width: 100%;
  674. }
  675. .bottomBox {
  676. padding: 3px 6px;
  677. border-radius: 12px;
  678. color: #fff;
  679. font-size: 10px;
  680. }
  681. /deep/ .el-col-md-8 {
  682. width: 24.33333%;
  683. }
  684. </style>