index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. <template>
  2. <div>
  3. <basic-container v-show="isShow">
  4. <avue-crud :option="option" :data="dataList" ref="crud" v-model="form" :page.sync="page" :search.sync="search"
  5. :table-loading="loading" @row-del="rowDel" :before-open="beforeOpen" :before-close="beforeClose"
  6. @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
  7. @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"
  8. @tree-load="treeLoad" @saveColumn="saveColumn" @resetColumn="resetColumn"
  9. @search-criteria-switch="searchCriteriaSwitch" :cell-style="cellStyle">
  10. <template slot="menuLeft" slot-scope="{size}">
  11. <el-button type="success" :size="size" icon="el-icon-copy-document" @click="copyOrder" :disabled="single">复制单据
  12. </el-button>
  13. <el-button type="info" :size="size" icon="el-icon-printer" @click="outExport">导出</el-button>
  14. <el-button type="warning" :size="size" icon="el-icon-thumb" :disabled="multiple" @click="applyPayment">申请货款
  15. </el-button>
  16. </template>
  17. <template slot-scope="scope" slot="orgOrderNo">
  18. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row, scope.index)">{{ scope.row.orgOrderNo }}</span>
  19. </template>
  20. <template slot="corpIdSearch">
  21. <crop-select v-model="search.corpId" corpType="GYS"></crop-select>
  22. </template>
  23. <template slot-scope="scope" slot="corpId">
  24. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row, scope.index)">{{ scope.row.strCorpName }}</span>
  25. </template>
  26. <template slot-scope="scope" slot="orderNo">
  27. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row, scope.index)">{{ scope.row.orderNo }}</span>
  28. </template>
  29. <template slot-scope="scope" slot="createUser">
  30. {{ scope.row.createUserName }}
  31. </template>
  32. <template slot-scope="scope" slot="createFreight">
  33. {{ scope.row.createFreight == 1 ? '是' : '否' }}
  34. </template>
  35. <template slot-scope="scope" slot="menu">
  36. <el-button type="text" icon="el-icon-delete" size="small" v-debounce @click.stop="createPlant(scope.row, scope.index)"
  37. :disabled="scope.row.status > 0 || scope.row.createFreight == 1">生成工厂发货
  38. </el-button>
  39. <!-- <el-button-->
  40. <!-- type="text"-->
  41. <!-- icon="el-icon-edit"-->
  42. <!-- size="small"-->
  43. <!-- @click.stop="editOpen(scope.row,scope.index)"-->
  44. <!-- >编辑-->
  45. <!-- </el-button>-->
  46. <el-button type="text" icon="el-icon-delete" size="small" @click.stop="rowDel(scope.row, scope.index)"
  47. :disabled="(scope.row.itemsList && scope.row.itemsList.length == 0) || scope.row.createFreight == 1">删除
  48. </el-button>
  49. </template>
  50. </avue-crud>
  51. </basic-container>
  52. <detail-page ref="detail" @goBack="goBack" :detailData="detailData" v-if="!isShow"></detail-page>
  53. <el-dialog title="账单" append-to-body class="el-dialogDeep" :visible.sync="applyPaymentDialog" width="60%"
  54. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  55. <apply-payment v-if="applyPaymentDialog" :billType="billType" :billData="billData" :arrList="applyPaymentList"
  56. @choceFun="choceFun">
  57. </apply-payment>
  58. </el-dialog>
  59. <el-dialog append-to-body title="账单" class="el-dialogDeep" :visible.sync="financialAccountDialog" width="70%"
  60. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  61. <financial-account v-if="financialAccountDialog" :billType="billType" :billData="billData"
  62. :checkData="financeData" :arrList="applyPaymentList" @choceFun="choceFun" tradeType="GN" @submit="feeSubmit"
  63. :addBut="false">
  64. </financial-account>
  65. </el-dialog>
  66. </div>
  67. </template>
  68. <script>
  69. import option from "./configuration/mainList.json";
  70. import { customerList, deleteDetails, generateShipment, genfactory, getApplyAmount } from "@/api/basicData/purchaseOrder"
  71. import detailPage from "./detailsPageEdit";
  72. import { defaultDate } from "@/util/date";
  73. import ApplyPayment from "@/components/finance/applyPayment";
  74. import financialAccount from "../../../components/finance/financialAccount";
  75. import { gainUser } from "@/api/basicData/customerInquiry";
  76. import { customerList as feeList } from "@/api/basicData/basicFeesDesc";
  77. import { getCurrentDate } from "@/util/date";
  78. import {getToken} from "@/util/auth";
  79. export default {
  80. name: "customerInformation",
  81. props: {
  82. detailData: {
  83. type: Object
  84. }
  85. },
  86. components: {
  87. detailPage,
  88. ApplyPayment,
  89. financialAccount
  90. },
  91. data() {
  92. return {
  93. configuration: {
  94. multipleChoices: false,
  95. multiple: false,
  96. collapseTags: false,
  97. placeholder: "请点击右边按钮选择",
  98. dicData: [],
  99. clearable: true,
  100. },
  101. search: {},
  102. loading: false,
  103. form: {},
  104. option: {},
  105. parentId: 0,
  106. dataList: [],
  107. page: {
  108. pageSize: 10,
  109. currentPage: 1,
  110. total: 0,
  111. pageSizes: [10, 50, 100, 200, 300]
  112. },
  113. // 非单个禁用
  114. single: true,
  115. // 非多个禁用
  116. multiple: true,
  117. selection: [],
  118. isShow: true,
  119. detailData: {},
  120. billType: "申请", //账单类型
  121. billData: {}, //账单需要数据
  122. financeData: {
  123. url: "/financialManagement/paymentRequest/index",
  124. pageStatus: "this.$store.getters.pqStatus",
  125. pageLabel: "付费申请",
  126. checkType: 'ffsq'
  127. }, // 账单请核需要的路由
  128. applyPaymentDialog: false,//生成账单组件
  129. financialAccountDialog: false,
  130. applyPaymentList: [],
  131. feesOption: [],
  132. }
  133. },
  134. async created() {
  135. // this.search.requiredArrivalDate = defaultDate(1)
  136. this.search.createTime = defaultDate(3)
  137. // this.option = option
  138. this.option = await this.getColumnData(this.getColumnName(17), option);
  139. this.getWorkDicts("payment_term").then(res => {
  140. this.findObject(this.option.column, "paymentType").dicData =
  141. res.data.data;
  142. });
  143. gainUser().then(res => {
  144. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  145. })
  146. feeList().then(res => {
  147. this.feesOption = res.data.data.records
  148. })
  149. let i = 0;
  150. this.option.column.forEach(item => {
  151. if (item.search) i++
  152. })
  153. if (i % 3 !== 0) {
  154. const num = 3 - Number(i % 3)
  155. this.option.searchMenuSpan = num * 8;
  156. this.option.searchMenuPosition = "right";
  157. }
  158. this.option.column.forEach(item => {
  159. if (item.pickerOptions) {
  160. item.pickerOptions = {
  161. shortcuts: [{
  162. text: '最近一周',
  163. onClick(picker) {
  164. const end = new Date();
  165. const start = new Date();
  166. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  167. picker.$emit('pick', [start, end]);
  168. }
  169. }, {
  170. text: '最近一个月',
  171. onClick(picker) {
  172. const end = new Date();
  173. const start = new Date();
  174. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  175. picker.$emit('pick', [start, end]);
  176. }
  177. }, {
  178. text: '最近三个月',
  179. onClick(picker) {
  180. const end = new Date();
  181. const start = new Date();
  182. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  183. picker.$emit('pick', [start, end]);
  184. }
  185. }]
  186. }
  187. }
  188. })
  189. },
  190. activated() {
  191. if (this.$route.query.check) {
  192. this.isShow = true
  193. // this.beforeOpenPage({id: this.$route.query.check.billId})
  194. this.detailData = {
  195. id: this.$route.query.check.billId,
  196. check: this.$route.query.check,
  197. };
  198. this.isShow = false;
  199. this.$store.commit("DOMCG_IN_DETAIL");
  200. }
  201. if (this.$route.query.params) {
  202. this.beforeOpenPage({ id: this.$route.query.params })
  203. }
  204. },
  205. methods: {
  206. cellStyle() {
  207. return "padding:0;height:40px;";
  208. },
  209. searchCriteriaSwitch(type) {
  210. if (type) {
  211. this.option.height = this.option.height - 90
  212. } else {
  213. this.option.height = this.option.height + 90
  214. }
  215. this.$refs.crud.getTableHeight()
  216. },
  217. //删除列表后面的删除按钮触发触发(row, index, done)
  218. rowDel(row, index, done) {
  219. this.$confirm("确定将选择数据删除?", {
  220. confirmButtonText: "确定",
  221. cancelButtonText: "取消",
  222. type: "warning"
  223. }).then(() => {
  224. return deleteDetails(row.id);
  225. }).then(() => {
  226. this.$message({
  227. type: "success",
  228. message: "操作成功!"
  229. });
  230. this.page.currentPage = 1;
  231. this.onLoad(this.page, { parentId: 0 });
  232. });
  233. },
  234. //查询全部
  235. initData() {
  236. customerList().then(res => {
  237. const column = this.findObject(this.option.column, "parentId");
  238. column.dicData = res.data.data.records;
  239. });
  240. },
  241. //新增子项触发
  242. handleAdd(row) {
  243. this.parentId = row.id;
  244. const column = this.findObject(this.option.column, "parentId");
  245. column.value = row.id;
  246. column.addDisabled = true;
  247. this.$refs.crud.rowAdd();
  248. },
  249. //查看跳转页面
  250. beforeOpenPage(row, index) {
  251. const data = {
  252. moduleName: 'cg',
  253. tableName: 'business_order',
  254. billId: row.id,
  255. no: localStorage.getItem('browserID')
  256. }
  257. this.checkLock(data).then(res => {
  258. if (res.data.code == 200) {
  259. this.detailData = {
  260. seeDisabled: true,
  261. id: row.id,
  262. };
  263. this.isShow = false;
  264. this.$store.commit("DOMCG_IN_DETAIL");
  265. }
  266. }).catch(err => {
  267. this.detailData = {
  268. id: row.id,
  269. seeDisabled: true,
  270. opDisabled: true
  271. };
  272. this.isShow = false;
  273. this.$store.commit("DOMCG_IN_DETAIL");
  274. })
  275. },
  276. //新增跳转页面
  277. beforeOpen(row, index) {
  278. this.detailData = {
  279. id: row.id,
  280. };
  281. this.isShow = false;
  282. this.$store.commit("DOMCG_IN_DETAIL");
  283. },
  284. editOpen(row, index) {
  285. const data = {
  286. moduleName: 'cg',
  287. tableName: 'business_order',
  288. billId: row.id,
  289. no: localStorage.getItem('browserID')
  290. }
  291. this.checkLock(data).then(res => {
  292. if (res.data.code == 200) {
  293. this.detailData = {
  294. seeDisabled: true,
  295. id: row.id,
  296. };
  297. this.isShow = false;
  298. this.$store.commit("DOMCG_IN_DETAIL");
  299. }
  300. }).catch(err => {
  301. this.detailData = {
  302. id: row.id,
  303. seeDisabled: true,
  304. opDisabled: true
  305. };
  306. this.isShow = false;
  307. this.$store.commit("DOMCG_IN_DETAIL");
  308. })
  309. },
  310. // 复制新单
  311. copyOrder() {
  312. const id = this.selection[0].id;
  313. this.detailData = {
  314. copyId: id,
  315. };
  316. this.isShow = false;
  317. this.$store.commit("DOMCG_IN_DETAIL");
  318. },
  319. //导出
  320. outExport() {
  321. this.$confirm('是否导出数据明细?', '提示', {
  322. confirmButtonText: '确定',
  323. cancelButtonText: '取消',
  324. type: 'warning'
  325. }).then(() => {
  326. let queryParams = JSON.parse(JSON.stringify(this.search))
  327. console.log(this.search)
  328. if (queryParams.requiredArrivalDate) {
  329. this.$set(queryParams, 'requiredArrivalStartDate', queryParams.requiredArrivalDate[0] + " " + "00:00:00")
  330. this.$set(queryParams, 'requiredArrivalEndDate', queryParams.requiredArrivalDate[1] + " " + "23:59:59")
  331. delete queryParams.requiredArrivalDate
  332. }else {
  333. delete queryParams.requiredArrivalDate
  334. delete queryParams.requiredArrivalStartDate
  335. delete queryParams.requiredArrivalEndDate
  336. }
  337. if (queryParams.createTime.length>1) {
  338. queryParams.createStartTime = queryParams.createTime[0] + " " + "00:00:00"
  339. queryParams.createEndTime = queryParams.createTime[1] + " " + "23:59:59"
  340. delete queryParams.createTime
  341. }else {
  342. delete queryParams.createTime
  343. delete queryParams.createStartTime
  344. delete queryParams.createEndTime
  345. }
  346. const routeData = this.$router.resolve({
  347. path: '/api/trade-purchase/purchase-order/selOrderExport', //跳转目标窗口的地址
  348. query: {
  349. ...queryParams //括号内是要传递给新窗口的参数
  350. }
  351. })
  352. window.open(routeData.href.slice(1,routeData.href.length)+'&'+`${this.website.tokenHeader}=${getToken()}`);
  353. }).catch(() => {
  354. this.$message({
  355. type: 'info',
  356. message: '已取消' //
  357. });
  358. })
  359. },
  360. //点击新增时触发
  361. beforeClose(done) {
  362. this.parentId = "";
  363. const column = this.findObject(this.option.column, "parentId");
  364. column.value = "";
  365. column.addDisabled = false;
  366. done();
  367. },
  368. //点击搜索按钮触发
  369. searchChange(params, done) {
  370. if (params.requiredArrivalDate) {
  371. this.$set(params, 'requiredArrivalStartDate', params.requiredArrivalDate[0] + " " + "00:00:00")
  372. this.$set(params, 'requiredArrivalEndDate', params.requiredArrivalDate[1] + " " + "23:59:59")
  373. this.$delete(params, 'requiredArrivalDate')
  374. }
  375. if (params.createTime) {
  376. params.createStartTime = params.createTime[0] + " " + "00:00:00"
  377. params.createEndTime = params.createTime[1] + " " + "23:59:59"
  378. this.$delete(params, 'createTime')
  379. }
  380. this.page.currentPage = 1;
  381. this.onLoad(this.page, params);
  382. done()
  383. },
  384. searchReset() {
  385. },
  386. selectionChange(list) {
  387. this.selection = []
  388. this.selection = list;
  389. this.single = list.length !== 1;
  390. this.multiple = list.length == 0
  391. },
  392. currentChange(currentPage) {
  393. this.page.currentPage = currentPage;
  394. },
  395. sizeChange(pageSize) {
  396. this.page.pageSize = pageSize;
  397. },
  398. refreshChange() {
  399. this.page.currentPage = 1;
  400. this.onLoad(this.page, this.search);
  401. },
  402. onLoad(page, params) {
  403. let data = this.gobackSearch(params)
  404. let queryParams = Object.assign({ tradeType: 'GN' }, data, {
  405. size: page.pageSize,
  406. current: page.currentPage,
  407. // billType:'CG',
  408. // corpsTypeId: this.treeDeptId
  409. })
  410. this.loading = true;
  411. customerList(queryParams).then(res => {
  412. this.dataList = res.data.data.records
  413. this.page.total = res.data.data.total
  414. this.option.height = window.innerHeight - 240;
  415. }).finally(() => {
  416. this.loading = false;
  417. })
  418. },
  419. //树桩列点击展开触发
  420. treeLoad(tree, treeNode, resolve) {
  421. const parentId = tree.id;
  422. customerList({ parentId: parentId }).then(res => {
  423. resolve(res.data.data.records);
  424. });
  425. },
  426. goBack() {
  427. this.selection = []
  428. this.applyPaymentList = []
  429. this.single = true
  430. this.multiple = true
  431. this.detailData = this.$options.data().detailData
  432. this.isShow = true;
  433. this.onLoad(this.page, this.search);
  434. },
  435. gobackSearch(params) {
  436. params = Object.assign({}, this.search)
  437. if (params.requiredArrivalDate && params.requiredArrivalDate != '') {
  438. params.requiredArrivalStartDate = params.requiredArrivalDate[0] + " " + "00:00:00"
  439. params.requiredArrivalEndDate = params.requiredArrivalDate[1] + " " + "23:59:59"
  440. this.$delete(params, 'requiredArrivalDate')
  441. }
  442. if (params.createTime && params.createTime != '') {
  443. params.createStartTime = params.createTime[0] + " " + "00:00:00"
  444. params.createEndTime = params.createTime[1] + " " + "23:59:59"
  445. this.$delete(params, 'createTime')
  446. }
  447. return params
  448. },
  449. //列保存触发
  450. async saveColumn() {
  451. /**
  452. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  453. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  454. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  455. */
  456. const inSave = await this.saveColumnData(
  457. this.getColumnName(17),
  458. this.option
  459. );
  460. if (inSave) {
  461. this.$message.success("保存成功");
  462. //关闭窗口
  463. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  464. this.$nextTick(() => {
  465. this.$refs.crud.doLayout()
  466. })
  467. }
  468. },
  469. async resetColumn() {
  470. this.option = option;
  471. const inSave = await this.delColumnData(
  472. this.getColumnName(17),
  473. option
  474. );
  475. if (inSave) {
  476. this.$nextTick(() => {
  477. this.$refs.crud.doLayout()
  478. })
  479. this.$message.success("重置成功");
  480. //关闭窗口
  481. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  482. }
  483. },
  484. // 申请货款
  485. async applyPayment() {
  486. this.applyPaymentList = []
  487. if (this.selection.length > 1) {
  488. for (let item in this.selection) {
  489. if (this.selection[0].corpId !== this.selection[item].corpId) {
  490. return this.$message.error('批量结算供应商必须一致')
  491. }
  492. }
  493. }
  494. // let forData = await this.forData()
  495. // if (forData) {
  496. // return this.$message.error('订单号:' + forData + '货款余额不足')
  497. // }
  498. let a = []
  499. this.selection.forEach(item => {
  500. item.itemsList = item.itemsList ? item.itemsList : [];
  501. let amount = Number(item.debitAmount) - Number(item.settlmentAmount);
  502. let quantity = 0;
  503. item.itemsList.map(e => {
  504. if (e.submitPay != 1) {
  505. // amount += Number(e.amount)
  506. quantity += Number(e.orderQuantity)
  507. }
  508. })
  509. const price = quantity === 0 ? 0 : Number(amount) / Number(quantity)
  510. let form = {
  511. belongCompany: item.belongCompany,
  512. srcOrderno: item.orderNo,
  513. itemType: "采购",
  514. corpsName: [{ cname: item.strCorpName, id: item.id }],
  515. corpId: item.corpId,
  516. srcParentId: item.id,
  517. currency: 'CNY',
  518. exchangeRate: '1',
  519. taxRate: '0',
  520. accDate: item.businesDate,
  521. srcType: 1,
  522. tradeType: 'GN',
  523. optionType: 'GN',
  524. costType: this.feesOption.find(e => e.cname == '货款') ? this.feesOption.find(e => e.cname == '货款').id : null,
  525. amount,
  526. quantity,
  527. price,
  528. unit: '条',
  529. remarks: item.orderRemark,
  530. itemorderAmount: item.orderAmount,
  531. itemId: item.id
  532. }
  533. a.push(form)
  534. // item.itemsList.forEach(e => {
  535. // let form = {
  536. // srcOrderno:item.orderNo,
  537. // itemType:"采购",
  538. // optionType:"GN",
  539. // corpsName: [{cname: item.strCorpName, id: item.id}],
  540. // corpId:item.corpId,
  541. // srcParentId: item.id,
  542. // currency: 'CNY',
  543. // exchangeRate: '1',
  544. // taxRate: '0',
  545. // accDate: item.businesDate,
  546. // srcType: 1,
  547. // tradeType: 'GN',
  548. // costType: this.feesOption.find(e => e.cname == '货款')? this.feesOption.find(e => e.cname == '货款').id: null,
  549. // goodName: e.goodsName,
  550. // price: e.price,
  551. // quantity: e.orderQuantity,
  552. // unit: e.unit,
  553. // amount: e.amount,
  554. // }
  555. // a.push(form)
  556. // })
  557. })
  558. this.applyPaymentList = [...a]
  559. // this.beforeBillData(true);
  560. this.financialAccountDialog = true;
  561. },
  562. async forData() {
  563. for (let item in this.selection) {
  564. let res = await getApplyAmount({ srcBillId: this.selection[item].id, billType: "申请" })
  565. if (this.selection[item].orderAmount <= res.data.data) {
  566. return this.selection[item].orderNo
  567. }
  568. }
  569. },
  570. beforeBillData(type) {
  571. if (type) { //申请货款
  572. // this.billData.srcId = -1
  573. }
  574. },
  575. //关闭账单
  576. choceFun() {
  577. this.financialAccountDialog = false
  578. },
  579. feeSubmit() {
  580. this.onLoad(this.page, this.search)
  581. },
  582. // 生成工厂发货
  583. createPlant(row, index) {
  584. console.log(111)
  585. let ids = [];
  586. row.itemsList.forEach(item => {
  587. ids.push(item.id)
  588. })
  589. let data = {
  590. id: row.id,
  591. orderItemIds: ids
  592. }
  593. generateShipment(data).then(res => {
  594. this.$confirm("此操作将生成工厂发货,是否继续?", {
  595. confirmButtonText: "确定",
  596. cancelButtonText: "取消",
  597. type: "warning"
  598. }).then(() => {
  599. this.loading = true
  600. res.data.data.orgId = res.data.data.id
  601. res.data.data.deliveryStatus = '录入'
  602. res.data.data.salesCompany = res.data.data.belongToCorpId
  603. res.data.data.totalWeight = res.data.data.cartonWeight
  604. res.data.data.totalVolumn = res.data.data.cntrVolumn
  605. res.data.data.deliveryAmount = 0
  606. res.data.data.totalQuantity = 0
  607. res.data.data.purchaseAmount = 0
  608. res.data.data.orderItemsList.forEach(item => {
  609. item.containerVolume = item.cntrVolumn
  610. item.actualWeight = item.cartonWeight
  611. item.specificationAndModel = item.itemType
  612. item.orgOrderNo = res.data.data.orgOrderNo
  613. item.inventoryNumber = item.storageQuantity
  614. item.srcId = item.id
  615. item.purchaseAmount = item.purchaseAmount
  616. item.purchaseQuantity = Number(item.orderQuantity)
  617. item.actualQuantity = (Number(item.orderQuantity) - Number(item.actualQuantity))
  618. res.data.data.deliveryAmount = Number(res.data.data.deliveryAmount) + Number(item.deliveryAmount)
  619. res.data.data.totalQuantity = Number(res.data.data.totalQuantity) + Number(item.actualQuantity)
  620. res.data.data.purchaseAmount = Number(res.data.data.purchaseAmount) + Number(item.deliveryAmount)
  621. res.data.data.deliveryAmount = Number(res.data.data.deliveryAmount ? res.data.data.deliveryAmount : 0).toFixed(2)
  622. res.data.data.purchaseAmount = Number(res.data.data.purchaseAmount ? res.data.data.purchaseAmount : 0).toFixed(2)
  623. delete item.id
  624. delete item.pid
  625. })
  626. res.data.data.deliveryItemsList = res.data.data.orderItemsList
  627. res.data.data.businessDate = getCurrentDate()
  628. delete res.data.data.createTime
  629. delete res.data.data.id
  630. delete res.data.data.sysNo
  631. delete res.data.data.orderItemsList
  632. delete res.data.data.corpName
  633. delete res.data.data.belongToCorpList
  634. res.data.data.deliveryAmount = res.data.data.debitAmount
  635. res.data.data.srcOrderNo = res.data.data.orgOrderNo
  636. delete res.data.data.debitAmount
  637. res.data.data.deliveryItemsList.forEach(item => item.deliveryAmount = item.amount)
  638. genfactory(res.data.data).then(() => {
  639. this.$message.success('生成工厂发货成功')
  640. this.onLoad(this.page, this.search);
  641. })
  642. });
  643. // this.$router.$avueRouter.closeTag("/businessManagement/receipt/index");
  644. // this.$router.push({
  645. // path: "/businessManagement/receipt/index",
  646. // query: { form: JSON.stringify(res.data.data) },
  647. // });
  648. })
  649. },
  650. }
  651. }
  652. </script>
  653. <style scoped>
  654. </style>