index.vue 17 KB

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