index.vue 19 KB

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