index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  1. <template>
  2. <div>
  3. <basic-container v-show="!detailsOpen">
  4. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  5. <el-tab-pane label="待生成" name="待生成"></el-tab-pane>
  6. <el-tab-pane label="待出库" name="待出库"></el-tab-pane>
  7. <el-tab-pane label="已出库" name="已出库"></el-tab-pane>
  8. <el-tab-pane label="全部" name=""></el-tab-pane>
  9. </el-tabs>
  10. <avue-crud
  11. v-show="activeName == '待生成'"
  12. ref="crud2"
  13. :option="option2"
  14. :table-loading="loading2"
  15. :data="dataList2"
  16. :page.sync="page2"
  17. :search.sync="query"
  18. @search-change="searchChange2"
  19. @search-reset="searchReset2"
  20. @refresh-change="refreshChange2"
  21. @on-load="onLoad2"
  22. >
  23. <template slot="menu" slot-scope="{ row, index }">
  24. <el-button size="small" type="text" @click="rowEdit(row)">生成发货单</el-button>
  25. </template>
  26. <template slot="claimNo" slot-scope="{ row }">
  27. <span style="color: #1e9fff; cursor: pointer" @click="rowEdit(row)">
  28. {{ row.claimNo }}
  29. </span>
  30. </template>
  31. </avue-crud>
  32. <avue-crud
  33. v-show="activeName != '待生成'"
  34. :option="option"
  35. :search.sync="search"
  36. v-model="form"
  37. :table-loading="loading"
  38. :data="dataList"
  39. ref="crud"
  40. :key="key"
  41. @on-load="onLoad"
  42. @search-change="searchChange"
  43. @row-del="rowDel"
  44. @expand-change="expandChange"
  45. @refresh-change="refreshChange"
  46. :page.sync="page"
  47. >
  48. <template slot-scope="{ row }" slot="expand">
  49. <avue-crud
  50. :data="row.itemData"
  51. :option="itemOption"
  52. :table-loading="row.itemLoading"
  53. :cell-style="cellStyle"
  54. class="itemTable"
  55. ></avue-crud>
  56. </template>
  57. <template slot-scope="{ type, size, row, index }" slot="menu">
  58. <el-button
  59. :size="size"
  60. :disabled="row.status !== '待出库' && row.item >= 1"
  61. :type="type"
  62. @click="$refs.crud.rowDel(row, index)"
  63. >删除</el-button
  64. >
  65. </template>
  66. <template slot="corpNameSearch">
  67. <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
  68. </template>
  69. <template slot-scope="{ row, index }" slot="billno">
  70. <span style="color: #409eff; cursor: pointer" @click.stop="editOpen(row, 1)">{{ row.billno }} </span>
  71. </template>
  72. <template slot-scope="{ row, index }" slot="ordNo">
  73. <span style="color: #409eff; cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.ordNo }} </span>
  74. </template>
  75. <template slot-scope="{ row, index }" slot="statusName">
  76. <span
  77. v-for="item in statusNameData"
  78. :style="{ background: item.colour }"
  79. class="bottomBox"
  80. v-if="item.dictKey == row.statusName"
  81. >
  82. {{ item.dictValue }}
  83. </span>
  84. </template>
  85. </avue-crud>
  86. </basic-container>
  87. <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
  88. <el-dialog
  89. title="发货"
  90. :visible.sync="dialogVisible"
  91. append-to-body
  92. close-on-click-modal
  93. close-on-press-escape
  94. width="40%"
  95. >
  96. <div class="elForm">
  97. <el-form :model="dialogForm" label-position="right">
  98. <el-col :span="24">
  99. <el-form-item label="收货人姓名:" label-width="100px">
  100. <span>{{ dialogForm.contacts }}</span>
  101. </el-form-item>
  102. <el-form-item label="收货人电话:" label-width="100px">
  103. <span>{{ dialogForm.phone }}</span>
  104. </el-form-item>
  105. <el-form-item label="收货人地址:" label-width="100px">
  106. <span>{{ dialogForm.recAddress }}</span>
  107. </el-form-item>
  108. </el-col>
  109. <el-form-item label="配送方式" label-width="100px">
  110. <el-select
  111. v-model="dialogForm.shipType"
  112. @change="courierTypeChange"
  113. style="width: 90%"
  114. placeholder="请选择运输类型"
  115. >
  116. <el-option
  117. v-for="item in courierTypeList"
  118. :key="item.dictKey"
  119. :label="item.dictValue"
  120. :value="item.dictValue"
  121. >
  122. </el-option>
  123. </el-select>
  124. </el-form-item>
  125. <el-form-item label="货运公司" label-width="100px">
  126. <el-select
  127. v-model="dialogForm.logisticsCorpName"
  128. filterable
  129. allow-create
  130. default-first-option
  131. style="width: 90%"
  132. placeholder="请选择货运公司"
  133. >
  134. <el-option
  135. v-for="item in courierList"
  136. :key="item.dictKey"
  137. :label="item.dictValue"
  138. :value="item.dictValue"
  139. >
  140. </el-option>
  141. </el-select>
  142. </el-form-item>
  143. <el-form-item label="货运单号" label-width="100px">
  144. <el-input v-model="dialogForm.expressNo" style="width: 90%" placeholder="请输入货运单号"></el-input>
  145. </el-form-item>
  146. </el-form>
  147. </div>
  148. <span slot="footer" class="dialog-footer">
  149. <el-button size="small" @click="dialogVisible = false">取 消</el-button>
  150. <el-button size="small" type="primary" @click="confirmShipment">确认发货</el-button>
  151. </span>
  152. </el-dialog>
  153. <el-dialog
  154. title="生成发货单"
  155. :visible.sync="generateVisible"
  156. append-to-body
  157. close-on-click-modal
  158. close-on-press-escape
  159. width="60%"
  160. >
  161. <div>
  162. <avue-crud v-if="generateVisible" :data="generateData" :option="generateOption">
  163. <template slot-scope="{ row, index }" slot="sendNum">
  164. <el-input-number
  165. v-model="row.sendNum"
  166. placeholder="请输入发数量"
  167. :controls="false"
  168. :precision="0"
  169. size="small"
  170. style="width: 100%"
  171. @blur="sendNumChange(row, index)"
  172. ></el-input-number>
  173. </template>
  174. </avue-crud>
  175. </div>
  176. <span slot="footer" class="dialog-footer">
  177. <el-button size="small" @click="generateVisible = false">取 消</el-button>
  178. <el-button size="small" type="primary" @click="generate">生成发货</el-button>
  179. </span>
  180. </el-dialog>
  181. </div>
  182. </template>
  183. <script>
  184. // @ts-nocheck
  185. import {
  186. getOutboundList,
  187. getList,
  188. remove,
  189. getGoodsInfo,
  190. getDetails,
  191. shipments,
  192. tireStockDescList,
  193. submitShip,
  194. } from "@/api/salesManagement/outboundWorkOrder";
  195. import detailsPage from "./detailsPage";
  196. import { getWorkDicts } from "@/api/system/dictbiz";
  197. export default {
  198. name: "index",
  199. components: {
  200. detailsPage,
  201. },
  202. data() {
  203. return {
  204. loading2: false,
  205. generateForm: {},
  206. generateVisible: false,
  207. generateData: [],
  208. generateOption: {
  209. align: "center",
  210. header: false,
  211. border: true,
  212. menu: false,
  213. column: [
  214. {
  215. label: "发货仓库名称",
  216. prop: "storageName",
  217. width: 200,
  218. overHidden: true,
  219. },
  220. {
  221. label: "批次号",
  222. prop: "dot",
  223. width: 100,
  224. overHidden: true,
  225. },
  226. {
  227. label: "采购订单号",
  228. prop: "poNo",
  229. width: 100,
  230. overHidden: true,
  231. },
  232. {
  233. label: "库存",
  234. prop: "inventory",
  235. width: 100,
  236. overHidden: true,
  237. },
  238. {
  239. label: "发货数",
  240. prop: "sendNum",
  241. width: 100,
  242. overHidden: true,
  243. },
  244. {
  245. label: "库区",
  246. prop: "reservoirArea",
  247. width: 100,
  248. overHidden: true,
  249. },
  250. ],
  251. },
  252. activeName: "待生成",
  253. statusNameData: [], // 状态字典
  254. dialogVisible: false,
  255. dialogForm: {},
  256. courierTypeList: [],
  257. courierList: [],
  258. detailsOpen: false,
  259. loading: false,
  260. search: {
  261. statusName: "待出库",
  262. },
  263. query: {},
  264. form: {},
  265. dataList: [],
  266. detailData: {},
  267. page: {
  268. pageSize: 20,
  269. currentPage: 1,
  270. total: 0,
  271. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500],
  272. },
  273. page2: {
  274. pageSize: 20,
  275. currentPage: 1,
  276. total: 0,
  277. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500],
  278. },
  279. key: 0,
  280. itemOption: {
  281. align: "center",
  282. header: false,
  283. border: true,
  284. menu: false,
  285. column: [
  286. {
  287. label: "商品名称",
  288. prop: "goodsName",
  289. disabled: true,
  290. width: 200,
  291. overHidden: true,
  292. // props: {
  293. // label: 'cname',
  294. // value: 'id'
  295. // },
  296. // dicUrl: '/api/gubersail-admin/goodsDesc/goodsListAll'
  297. },
  298. {
  299. label: "商品编码",
  300. disabled: true,
  301. prop: "goodsNo",
  302. width: 100,
  303. },
  304. {
  305. label: "品牌",
  306. prop: "brandId",
  307. disabled: true,
  308. width: 100,
  309. overHidden: true,
  310. props: {
  311. label: "cname",
  312. value: "id",
  313. },
  314. dicUrl: "/api/gubersail-admin/brandDesc/listAll?type=PP&enableOrNot=1",
  315. },
  316. {
  317. label: "规格型号",
  318. prop: "propertyName",
  319. disabled: true,
  320. width: 100,
  321. },
  322. {
  323. label: "花纹",
  324. prop: "pattern",
  325. disabled: true,
  326. width: 100,
  327. },
  328. {
  329. label: "商品描述",
  330. prop: "goodsDescription",
  331. disabled: true,
  332. },
  333. {
  334. label: "批次号",
  335. prop: "dot",
  336. type: "select",
  337. disabled: true,
  338. dicData: [],
  339. props: {
  340. label: "dot",
  341. value: "dot",
  342. },
  343. dicUrl: "/api/gubersail-admin/tireStockDesc/dotList",
  344. },
  345. ],
  346. },
  347. option: {
  348. viewBtn: false,
  349. editBtn: false,
  350. delBtn: false,
  351. addBtn: false,
  352. index: true,
  353. span: 8,
  354. border: true,
  355. height: "auto",
  356. searchMenuPosition: "right",
  357. align: "center",
  358. size: "small",
  359. menuWidth: 100,
  360. searchSpan: 8,
  361. searchIcon: true,
  362. searchIndex: 2,
  363. highlightCurrentRow: true,
  364. expand: true,
  365. expandWidth: 60,
  366. dialogWidth: "70%",
  367. summaryText: "合计",
  368. showSummary: true,
  369. sumColumnList: [
  370. {
  371. name: "goodsTotalNum",
  372. type: "sum",
  373. decimals: 0,
  374. },
  375. ],
  376. column: [
  377. {
  378. label: "出库单号",
  379. prop: "billno",
  380. search: true,
  381. overHidden: true,
  382. },
  383. {
  384. label: "来源单号",
  385. prop: "ordNo",
  386. search: true,
  387. overHidden: true,
  388. },
  389. {
  390. label: "业务来源",
  391. prop: "bsType",
  392. search: true,
  393. overHidden: true,
  394. type: "select",
  395. dicUrl: "/api/blade-system/dict-biz/dictionary?code=business_Source",
  396. props: {
  397. label: "dictValue",
  398. value: "dictKey",
  399. },
  400. },
  401. {
  402. label: "业务对象",
  403. prop: "customerName",
  404. search: true,
  405. overHidden: true,
  406. cell: true,
  407. width: 140,
  408. // filterable:true,
  409. // type: 'select',
  410. // remote:true,
  411. // props: {
  412. // label: 'cname',
  413. // value: 'cname',
  414. // res: 'data.records'
  415. // },
  416. // dicUrl: '/api/gubersail-admin/corpsDesc/list?current=1&size=20&corpType=KH&cname={{key}}',
  417. },
  418. {
  419. label: "仓库",
  420. prop: "storageName",
  421. search: true,
  422. overHidden: true,
  423. filterable: true,
  424. type: "select",
  425. props: {
  426. label: "cname",
  427. value: "cname",
  428. },
  429. dicUrl: "/api/gubersail-admin/storageDesc/listAll",
  430. },
  431. // , {
  432. // label: '商品种类',
  433. // prop: "numberRows",
  434. // overHidden: true,
  435. // }
  436. {
  437. label: "订单数量",
  438. prop: "goodsTotalNum",
  439. search: false,
  440. overHidden: true,
  441. // width: 120,
  442. },
  443. {
  444. label: "实际数量",
  445. prop: "sendTotalNum",
  446. search: false,
  447. overHidden: true,
  448. // width: 120,
  449. },
  450. {
  451. label: "状态",
  452. prop: "statusName",
  453. search: true,
  454. overHidden: true,
  455. type: "select",
  456. dicUrl: "/api/blade-system/dict-biz/dictionary?code=outbound_work_order_status",
  457. props: {
  458. label: "dictValue",
  459. value: "dictKey",
  460. },
  461. },
  462. {
  463. label: "业务日期",
  464. prop: "businesDate",
  465. overHidden: true,
  466. searchProp: "businesDateList",
  467. type: "date",
  468. search: true,
  469. width: 100,
  470. unlinkPanels: true,
  471. searchRange: true,
  472. searchDefaultTime: ["00:00:00", "23:59:59"],
  473. format: "yyyy-MM-dd",
  474. valueFormat: "yyyy-MM-dd HH:mm:ss",
  475. },
  476. {
  477. label: "库管",
  478. prop: "stockClerkName",
  479. type: "select",
  480. search: true,
  481. props: {
  482. label: "realName",
  483. value: "realName",
  484. },
  485. dicUrl: "/api/blade-user/stockClerkList",
  486. overHidden: true,
  487. },
  488. {
  489. label: "制单人",
  490. prop: "createUserName",
  491. searchProp: "createUser",
  492. overHidden: true,
  493. width: 100,
  494. filterable: true,
  495. remote: true,
  496. type: "select",
  497. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  498. props: {
  499. label: "account",
  500. value: "id",
  501. res: "data.records",
  502. },
  503. },
  504. {
  505. label: "制单日期",
  506. prop: "createTime",
  507. searchProp: "createTimeList",
  508. type: "date",
  509. overHidden: true,
  510. width: 100,
  511. searchRange: true,
  512. searchDefaultTime: ["00:00:00", "23:59:59"],
  513. format: "yyyy-MM-dd",
  514. valueFormat: "yyyy-MM-dd HH:mm:ss",
  515. },
  516. {
  517. label: "更新人",
  518. prop: "updateUserName",
  519. searchProp: "updateUser",
  520. overHidden: true,
  521. width: 100,
  522. filterable: true,
  523. remote: true,
  524. type: "select",
  525. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  526. props: {
  527. label: "account",
  528. value: "id",
  529. res: "data.records",
  530. },
  531. },
  532. {
  533. label: "更新日期",
  534. prop: "updateTime",
  535. searchProp: "updateTimeList",
  536. type: "date",
  537. overHidden: true,
  538. width: 100,
  539. searchRange: true,
  540. searchDefaultTime: ["00:00:00", "23:59:59"],
  541. format: "yyyy-MM-dd",
  542. valueFormat: "yyyy-MM-dd HH:mm:ss",
  543. },
  544. ],
  545. },
  546. option2: {
  547. height: "auto",
  548. calcHeight: 30,
  549. menuWidth: 120,
  550. tip: false,
  551. searchShow: true,
  552. searchMenuSpan: 12,
  553. border: true,
  554. index: true,
  555. addBtn: false,
  556. viewBtn: false,
  557. editBtn: false,
  558. delBtn: false,
  559. // selection: true,
  560. searchIcon: true,
  561. align: "center",
  562. searchIndex: 3,
  563. column: [
  564. {
  565. label: "订单编号",
  566. prop: "ordNo",
  567. search: true,
  568. overHidden: true,
  569. },
  570. {
  571. label: "客户名称",
  572. prop: "customerName",
  573. search: true,
  574. overHidden: true,
  575. },
  576. {
  577. label: "数量",
  578. prop: "goodsNum",
  579. overHidden: true,
  580. },
  581. {
  582. label: "商品名称",
  583. prop: "goodsName",
  584. overHidden: true,
  585. },
  586. ],
  587. },
  588. };
  589. },
  590. async created() {
  591. // 状态字段获取
  592. this.getWorkDicts("outbound_work_order_status").then((res) => {
  593. this.statusNameData = res.data.data;
  594. });
  595. this.key++;
  596. let i = 0;
  597. this.option.column.forEach((item) => {
  598. if (item.search) i++;
  599. });
  600. if (i % 3 !== 0) {
  601. const num = 3 - Number(i % 3);
  602. this.option.searchMenuSpan = num * 8;
  603. this.option.searchMenuPosition = "right";
  604. }
  605. if (this.$route.query.id) {
  606. this.detailData = {
  607. id: this.$route.query.id,
  608. };
  609. this.detailsOpen = true;
  610. }
  611. console.log(this.$route.query);
  612. },
  613. activated() {
  614. if (this.$route.query.id) {
  615. this.detailData = {
  616. id: this.$route.query.id,
  617. };
  618. this.detailsOpen = true;
  619. }
  620. setTimeout(() => {
  621. if (this.$route.query.srcId) {
  622. this.$store.commit("DOMIO_IN_DETAIL");
  623. this.detailsOpen = true;
  624. }
  625. }, 100);
  626. },
  627. methods: {
  628. check(row) {
  629. this.form = row;
  630. this.detailsOpen = true;
  631. },
  632. backToList(type) {
  633. this.form = {};
  634. this.detailsOpen = false;
  635. if (type === 0) {
  636. this.detailData = {};
  637. }
  638. if (this.$route.query.srcId) {
  639. this.$router.$avueRouter.closeTag(this.$route.fullPath);
  640. this.$router.push({
  641. path: "/tirePartsMall/salesManagement/outboundWorkOrder/index",
  642. });
  643. }
  644. this.onLoad(this.page, this.search);
  645. this.$store.commit("DOMIO_OUT_DETAIL");
  646. },
  647. //刷新
  648. refreshChange() {
  649. this.onLoad(this.page, this.search);
  650. },
  651. rowDel(form, index) {
  652. console.log(form);
  653. this.$confirm("此操作将永久删除该行, 是否继续?", "提示", {
  654. confirmButtonText: "确定",
  655. cancelButtonText: "取消",
  656. type: "warning",
  657. })
  658. .then(() => {
  659. remove(form.id).then((res) => {
  660. this.$message({
  661. type: "success",
  662. message: "删除成功!",
  663. });
  664. this.dataList.splice(index, 1);
  665. this.onLoad(this.page);
  666. });
  667. })
  668. .catch(() => {});
  669. },
  670. searchChange(params, done) {
  671. this.page.currentPage = 1;
  672. done();
  673. this.onLoad(this.page, params);
  674. },
  675. handleClick(tab, event) {
  676. console.log(tab.name, event);
  677. if (tab.name == "待生成") {
  678. this.query.statusName = tab.name;
  679. this.onLoad2(this.page2, this.query);
  680. } else {
  681. this.search.statusName = tab.name;
  682. this.onLoad(this.page,this.search);
  683. }
  684. },
  685. onLoad(page, params = {}) {
  686. var obj2 = this.deepClone(this.search);
  687. params = {
  688. ...params,
  689. current: page.currentPage,
  690. size: page.pageSize,
  691. bizTypeName: "FHGD",
  692. ...Object.assign(params, this.search),
  693. };
  694. this.loading = true;
  695. this.dataList.forEach((item) => {
  696. this.$refs.crud.toggleRowExpansion(item, false);
  697. });
  698. getList(params)
  699. .then((res) => {
  700. if (res.data.data.records) {
  701. res.data.data.records.forEach((e) => {
  702. e.itemLoading = true;
  703. });
  704. }
  705. this.dataList = res.data.data.records;
  706. this.page.total = res.data.data.total;
  707. this.$nextTick(() => {
  708. this.$refs.crud.doLayout();
  709. this.$refs.crud.dicInit();
  710. });
  711. this.loading = false;
  712. })
  713. .finally(() => {
  714. // if(this.search.statusName==''){
  715. // this.search.statusName='待出库'
  716. // }
  717. this.search = obj2;
  718. console.log(this.search);
  719. this.loading = false;
  720. });
  721. },
  722. editOpen(row, status) {
  723. this.form = row;
  724. this.detailData = {
  725. id: row.id,
  726. status: status,
  727. };
  728. this.detailsOpen = true;
  729. },
  730. expandChange(row) {
  731. if (!row.itemData) {
  732. getDetails({ id: row.id })
  733. .then((res) => {
  734. this.dataList[row.$index].itemData = res.data.data.shipItemsList;
  735. })
  736. .finally(() => {
  737. this.dataList[row.$index].itemLoading = false;
  738. });
  739. }
  740. },
  741. // 发货按钮
  742. deliverGoods(row) {
  743. // 获取运输类型
  744. getWorkDicts("deliveryMethod").then((res) => {
  745. this.courierTypeList = res.data.data;
  746. });
  747. // 获取快递公司
  748. getWorkDicts("tyre_express_company").then((res) => {
  749. this.courierList = res.data.data;
  750. });
  751. this.dialogForm = row;
  752. this.dialogVisible = true;
  753. },
  754. courierTypeChange() {
  755. this.dialogForm.courierCorporation = null;
  756. },
  757. // 发货
  758. confirmShipment() {
  759. for (let courierCompanies of this.courierList) {
  760. if (courierCompanies.dictValue === this.dialogForm.logisticsCorpName) {
  761. this.dialogForm.logisticsCorpId = courierCompanies.dictKey;
  762. break;
  763. }
  764. }
  765. const requestBody = {
  766. id: this.dialogForm.id,
  767. logisticsCorpId: this.dialogForm.logisticsCorpId,
  768. logisticsCorpName: this.dialogForm.logisticsCorpName,
  769. shipType: this.dialogForm.shipType,
  770. expressNo: this.dialogForm.expressNo,
  771. };
  772. shipments(requestBody).then((res) => {
  773. console.log(res);
  774. this.$message.success("发货成功");
  775. this.dialogVisible = false;
  776. });
  777. },
  778. /**
  779. * @param {{ currentPage: any; pageSize: any; }} page
  780. */
  781. onLoad2(page, params = {}) {
  782. let obj = {};
  783. obj = {
  784. ...Object.assign(params, this.query),
  785. };
  786. this.loading2 = true;
  787. getOutboundList(page.currentPage, page.pageSize, obj)
  788. .then((res) => {
  789. this.dataList2 = res.data.data.records;
  790. this.page2.total = res.data.data.total;
  791. this.$nextTick(() => {
  792. this.$refs.crud2.doLayout();
  793. });
  794. })
  795. .finally(() => {
  796. this.loading2 = false;
  797. });
  798. },
  799. refreshChange2() {
  800. this.onLoad2(this.page2, this.query);
  801. },
  802. searchChange2(params, done) {
  803. done();
  804. this.page2.currentPage = 1;
  805. this.onLoad2(this.page2, params);
  806. },
  807. rowEdit(row) {
  808. this.generateForm = row;
  809. this.generateData = [];
  810. let obj = {
  811. goodsId: row.goodsId,
  812. };
  813. tireStockDescList(obj).then((res) => {
  814. res.data.data.forEach((item) => {
  815. this.generateData.push({
  816. ...row,
  817. storageId: item.storageId,
  818. storageName: item.storageName,
  819. dot: item.dot,
  820. poNo: item.poNo,
  821. inventory: item.balanceQuantity,
  822. sendNum: 0,
  823. costpriePrice: item.inventoryCostPrice,
  824. reservoirAreaId: item.reservoirAreaId,
  825. reservoirArea: item.reservoirArea,
  826. });
  827. });
  828. });
  829. console.log(this.generateData);
  830. this.generateVisible = true;
  831. },
  832. sendNumChange(row, index) {
  833. let sum = 0;
  834. for (let item of this.generateData) {
  835. sum += Number(item.sendNum);
  836. }
  837. if (sum > row.goodsNum) {
  838. row.sendNum = 0;
  839. return this.$message.error("发货数量合计不能超过订单数量");
  840. }
  841. },
  842. generate() {
  843. let obj = {
  844. ...this.generateForm,
  845. shipItemsList: this.generateData.filter((item) => item.sendNum > 0),
  846. };
  847. const loading = this.$loading({
  848. lock: true,
  849. text: "加载中",
  850. spinner: "el-icon-loading",
  851. background: "rgba(255,255,255,0.7)",
  852. });
  853. submitShip(obj)
  854. .then((res) => {
  855. this.generateVisible = false;
  856. this.$message.success("操作成功");
  857. this.refreshChange();
  858. this.refreshChange2();
  859. })
  860. .finally(() => {
  861. loading.close();
  862. });
  863. },
  864. },
  865. };
  866. </script>
  867. <style scoped>
  868. .bottomBox {
  869. padding: 3px 6px;
  870. border-radius: 12px;
  871. color: #fff;
  872. font-size: 10px;
  873. }
  874. </style>