index.vue 20 KB

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