index.vue 21 KB

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