index.vue 20 KB

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