index.vue 19 KB

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