index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  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" @row-del="rowDel"
  5. @row-update="rowUpdate" :before-open="beforeOpen" :before-close="beforeClose" :search.sync="search"
  6. @row-save="rowSave" @saveColumn="saveColumn" @search-change="searchChange" @search-reset="searchReset"
  7. @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
  8. @refresh-change="refreshChange" @on-load="onLoad" @tree-load="treeLoad" :cell-style="tableRowClassName"
  9. :table-loading="loading" @expand-change="expandChange" @resetColumn="resetColumn"
  10. @search-criteria-switch="searchCriteriaSwitch">
  11. <template slot-scope="scope" slot="expand">
  12. <el-table :data="scope.row.insideList" v-loading="scope.row.loading" :cell-style="tableRowClassName">
  13. <el-table-column label="产品分类" prop="priceCategory" align="center" show-overflow-tooltip width="200">
  14. </el-table-column>
  15. <el-table-column label="价格类别" prop="priceType" align="center" show-overflow-tooltip width="180">
  16. </el-table-column>
  17. <el-table-column label="商品名称" prop="cname" align="center" show-overflow-tooltip width="120">
  18. </el-table-column>
  19. <el-table-column label="编码" prop="code" align="center" show-overflow-tooltip width="120"></el-table-column>
  20. <el-table-column label="规格型号" prop="typeno" align="center" show-overflow-tooltip width="120">
  21. </el-table-column>
  22. <el-table-column label="供应商" prop="corpName" align="center" show-overflow-tooltip width="120">
  23. </el-table-column>
  24. <el-table-column label="订货数量" prop="orderQuantity" align="center" show-overflow-tooltip width="180">
  25. </el-table-column>
  26. <el-table-column label="发货数量" prop="actualQuantity" align="center" show-overflow-tooltip width="200">
  27. </el-table-column>
  28. <el-table-column label="库存" prop="storageQuantity" align="center" show-overflow-tooltip width="200">
  29. </el-table-column>
  30. <el-table-column label="采购价格" prop="purchaseAmount" align="center" show-overflow-tooltip width="200">
  31. </el-table-column>
  32. <el-table-column label="最新单价" prop="price" align="center" show-overflow-tooltip width="200">
  33. </el-table-column>
  34. <el-table-column label="金额" prop="amount" align="center" show-overflow-tooltip width="200">
  35. </el-table-column>
  36. </el-table>
  37. </template>
  38. <template slot-scope="scope" slot="orderNo">
  39. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row, scope.index)">{{scope.row.orgOrderNo}}</span>
  40. </template>
  41. <template slot="corpIdSearch">
  42. <crop-select v-model="search.corpId" corpType="KH"></crop-select>
  43. </template>
  44. <template slot-scope="scope" slot="corpId">
  45. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row, scope.index)">{{scope.row.corpsName}}</span>
  46. </template>
  47. <template slot-scope="scope" slot="createUser">
  48. {{ scope.row.createUserName }}
  49. </template>
  50. <template slot-scope="scope" slot="createPurchase">
  51. {{ scope.row.createPurchase == 1 ? "是" : "否" }}
  52. </template>
  53. <template slot-scope="scope" slot="createFreight">
  54. {{ scope.row.createFreight == 1 ? "是" : "否" }}
  55. </template>
  56. <template slot="status" slot-scope="scope">
  57. <span v-if="scope.row.status == 0">暂存</span>
  58. <span v-else-if="scope.row.status == 1">提交请核</span>
  59. <span v-else-if="scope.row.status == 2">审批中</span>
  60. <span v-else-if="scope.row.status == 3">审批通过</span>
  61. </template>
  62. <template slot="specialCheck" slot-scope="scope">
  63. <span v-if="scope.row.specialCheck == 0">否</span>
  64. <span v-else>是</span>
  65. </template>
  66. <template slot="specialCheckStatus" slot-scope="scope">
  67. <span v-if="scope.row.specialCheckStatus == 0">未提交</span>
  68. <span v-if="scope.row.specialCheckStatus == 1">提交</span>
  69. <span v-if="scope.row.specialCheckStatus == 2">审批中</span>
  70. <span v-if="scope.row.specialCheckStatus == 3">审批通过</span>
  71. </template>
  72. <template slot="menuLeft" slot-scope="{ size }">
  73. <el-button type="success" :size="size" @click="copyOrder" :disabled="single">复制单据</el-button>
  74. <el-button type="info" :size="size" icon="el-icon-printer" @click="exportExcel">导 出</el-button>
  75. <el-button type="info" size="small" icon="el-icon-download" @click="exportHandle">库 存</el-button>
  76. </template>
  77. <template slot-scope="scope" slot="menu">
  78. <el-button type="text" size="small" v-debounce @click="saveSell(scope.row)"
  79. :disabled="scope.row.status < 3 || scope.row.createPurchase == 1" v-if="isProcurements">生成采购</el-button>
  80. <el-button type="text" size="small" v-debounce @click="customerReceipt(scope.row)" :disabled="
  81. !scope.row.status ||
  82. scope.row.status < 3 ||
  83. scope.row.createFreight == 1
  84. ">客户收货</el-button>
  85. <el-button type="text" icon="el-icon-delete" size="small" @click.stop="rowDel(scope.row, scope.index)"
  86. :disabled="scope.row.status > 0">删除
  87. </el-button>
  88. </template>
  89. </avue-crud>
  90. </basic-container>
  91. <detail-page ref="detail" :isProcurements = "isProcurements" @goBack="goBack" :detailData="detailData" v-if="!isShow"></detail-page>
  92. </div>
  93. </template>
  94. <script>
  95. import option from "./configuration/mainList.json";
  96. import {
  97. customerList,
  98. typeSave,
  99. deleteDetails,
  100. saveSell,
  101. detail,
  102. generateShipment,
  103. genClient,
  104. warehouseList,
  105. isProcurement
  106. } from "@/api/basicData/configuration";
  107. import detailPage from "./detailsPageEdit";
  108. import search from "../../../page/index/search";
  109. import { defaultDate } from "@/util/date";
  110. import { getToken } from "@/util/auth";
  111. import os from "os";
  112. import { gainUser } from "@/api/basicData/customerInquiry";
  113. import { getCurrentDate } from "@/util/date";
  114. export default {
  115. name: "customerInformation",
  116. components: {
  117. detailPage
  118. },
  119. data() {
  120. return {
  121. loading: false,
  122. configuration: {
  123. multipleChoices: false,
  124. multiple: false,
  125. collapseTags: false,
  126. placeholder: "请点击右边按钮选择",
  127. dicData: [],
  128. clearable: true
  129. },
  130. form: {},
  131. option: {},
  132. parentId: 0,
  133. search: {},
  134. dataList: [],
  135. isProcurements:true,
  136. page: {
  137. pageSize: 10,
  138. currentPage: 1,
  139. total: 0,
  140. pageSizes: [10, 50, 100, 200, 300]
  141. },
  142. // 非单个禁用
  143. single: true,
  144. // 非多个禁用
  145. multiple: true,
  146. selection: [],
  147. isShow: true,
  148. detailData: {},
  149. warehouseTypeOption: [],
  150. warehouseList: []
  151. };
  152. },
  153. async created() {
  154. // this.search.businesDate = defaultDate(1);
  155. this.search.createTime = defaultDate(3);
  156. // this.option = option
  157. this.option = await this.getColumnData(this.getColumnName(14), option);
  158. this.getWorkDicts("payment_term").then(res => {
  159. this.findObject(this.option.column, "paymentType").dicData =
  160. res.data.data;
  161. });
  162. this.getWorkDicts("order_status").then(res => {
  163. this.findObject(this.option.column, "orderStatus").dicData =
  164. res.data.data;
  165. });
  166. gainUser().then(res => {
  167. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  168. });
  169. let i = 0;
  170. this.option.column.forEach(item => {
  171. if (item.search) i++;
  172. });
  173. if (i % 3 !== 0) {
  174. const num = 3 - Number(i % 3);
  175. this.option.searchMenuSpan = num * 8;
  176. this.option.searchMenuPosition = "right";
  177. }
  178. this.option.column.forEach(item => {
  179. if (item.pickerOptions) {
  180. item.pickerOptions = {
  181. shortcuts: [
  182. {
  183. text: "最近一周",
  184. onClick(picker) {
  185. const end = new Date();
  186. const start = new Date();
  187. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  188. picker.$emit("pick", [start, end]);
  189. }
  190. },
  191. {
  192. text: "最近一个月",
  193. onClick(picker) {
  194. const end = new Date();
  195. const start = new Date();
  196. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  197. picker.$emit("pick", [start, end]);
  198. }
  199. },
  200. {
  201. text: "最近三个月",
  202. onClick(picker) {
  203. const end = new Date();
  204. const start = new Date();
  205. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  206. picker.$emit("pick", [start, end]);
  207. }
  208. }
  209. ]
  210. };
  211. }
  212. });
  213. this.getWorkDicts("warehouseType").then(res => {
  214. this.warehouseTypeOption = res.data.data
  215. })
  216. warehouseList().then(res => {
  217. this.warehouseList = res.data.data.records
  218. })
  219. },
  220. activated() {
  221. setTimeout(() => {
  222. if (this.$route.query.id) {
  223. this.isShow = true;
  224. this.beforeOpenPage({ id: this.$route.query.id });
  225. }
  226. if (this.$route.query.check) {
  227. this.isShow = true;
  228. // this.beforeOpenPage({id: this.$route.query.check.billId})
  229. this.detailData = {
  230. id: this.$route.query.check.billId,
  231. check: this.$route.query.check,
  232. auditId: this.$route.query.check.id
  233. };
  234. this.isShow = false;
  235. this.$store.commit("DOMXS_IN_DETAIL");
  236. }
  237. if (this.$route.query.params) {
  238. this.beforeOpenPage({ id: this.$route.query.params });
  239. }
  240. }, 100);
  241. },
  242. methods: {
  243. searchCriteriaSwitch(type) {
  244. if (type) {
  245. this.option.height = this.option.height - 190;
  246. } else {
  247. this.option.height = this.option.height + 190;
  248. }
  249. this.$refs.crud.getTableHeight();
  250. },
  251. tableRowClassName({ row, column, rowIndex, columnIndex }) {
  252. if (row.orderStatus == "录入" && columnIndex == 19) {
  253. return {
  254. background: "#eceb3c"
  255. };
  256. } else if (row.orderStatus == "成交") {
  257. return "success-row";
  258. } else if (row.orderStatus == "已报价") {
  259. return "quote-row";
  260. } else if (row.orderStatus == "未成交") {
  261. return "warning-row";
  262. }
  263. return "padding:0;height:40px;";
  264. },
  265. //删除列表后面的删除按钮触发触发(row, index, done)
  266. rowDel(row, index, done) {
  267. this.$confirm("确定将选择数据删除?", {
  268. confirmButtonText: "确定",
  269. cancelButtonText: "取消",
  270. type: "warning"
  271. })
  272. .then(() => {
  273. return deleteDetails(row.id);
  274. })
  275. .then(() => {
  276. this.$message({
  277. type: "success",
  278. message: "操作成功!"
  279. });
  280. this.page.currentPage = 1;
  281. this.onLoad(this.page, { parentId: 0 });
  282. });
  283. },
  284. //修改时的修改按钮点击触发
  285. rowUpdate(row, index, done, loading) {
  286. typeSave(row).then(
  287. () => {
  288. this.$message({
  289. type: "success",
  290. message: "操作成功!"
  291. });
  292. // 数据回调进行刷新
  293. done(row);
  294. },
  295. error => {
  296. window.console.log(error);
  297. loading();
  298. }
  299. );
  300. },
  301. //新增修改时保存触发
  302. rowSave(row, done, loading) {
  303. typeSave(row).then(res => {
  304. console.log(res);
  305. done();
  306. });
  307. },
  308. //查询全部
  309. initData() {
  310. customerList().then(res => {
  311. console.log(this.form);
  312. const column = this.findObject(this.option.column, "parentId");
  313. column.dicData = res.data.data.records;
  314. });
  315. },
  316. //新增子项触发
  317. handleAdd(row) {
  318. this.parentId = row.id;
  319. const column = this.findObject(this.option.column, "parentId");
  320. column.value = row.id;
  321. column.addDisabled = true;
  322. this.$refs.crud.rowAdd();
  323. },
  324. closeDetailPage() {
  325. this.isShow = true;
  326. },
  327. //查看跳转页面
  328. beforeOpenPage(row, index) {
  329. const data = {
  330. moduleName: "xs",
  331. tableName: "business_order",
  332. billId: row.id,
  333. no: localStorage.getItem("browserID")
  334. };
  335. this.checkLock(data).then(res => {
  336. if (res.data.code == 200) {
  337. this.detailData = {
  338. seeDisabled: true,
  339. id: row.id
  340. };
  341. this.isShow = false;
  342. this.$store.commit("DOMXS_IN_DETAIL");
  343. }
  344. }).catch(err => {
  345. this.detailData = {
  346. id: row.id,
  347. seeDisabled: true,
  348. opDisabled: true
  349. };
  350. this.isShow = false;
  351. this.$store.commit("DOMXS_IN_DETAIL");
  352. });
  353. },
  354. //新增跳转页面
  355. beforeOpen(row, index) {
  356. this.detailData = {
  357. id: row.id
  358. };
  359. this.isShow = false;
  360. this.$store.commit("DOMXS_IN_DETAIL");
  361. },
  362. editOpen(row, index) {
  363. this.detailData = {
  364. id: row.id
  365. };
  366. this.isShow = false;
  367. this.$store.commit("DOMXS_IN_DETAIL");
  368. },
  369. // 复制新单
  370. copyOrder() {
  371. const id = this.selection[0].id;
  372. this.detailData = {
  373. copyId: id
  374. };
  375. this.isShow = false;
  376. this.$store.commit("DOMXS_IN_DETAIL");
  377. },
  378. //点击新增时触发
  379. beforeClose(done) {
  380. this.parentId = "";
  381. const column = this.findObject(this.option.column, "parentId");
  382. column.value = "";
  383. column.addDisabled = false;
  384. done();
  385. },
  386. //点击搜索按钮触发
  387. searchChange(params, done) {
  388. if (params.businesDate) {
  389. params.orderStartDate = params.businesDate[0] + " " + "00:00:00";
  390. params.orderEndDate = params.businesDate[1] + " " + "23:59:59";
  391. delete params.businesDate;
  392. }
  393. if (params.requiredDeliveryDate) {
  394. params.deliveryStartDate =
  395. params.requiredDeliveryDate[0] + " " + "00:00:00";
  396. params.deliveryEndDate =
  397. params.requiredDeliveryDate[1] + " " + "23:59:59";
  398. this.$delete(params, "requiredDeliveryDate");
  399. }
  400. if (params.requiredArrivalDate) {
  401. params.arrivalDateStart =
  402. params.requiredArrivalDate[0] + " " + "00:00:00";
  403. params.arrivalDateEnd =
  404. params.requiredArrivalDate[1] + " " + "23:59:59";
  405. this.$delete(params, "requiredArrivalDate");
  406. }
  407. if (params.actualDeliveryDate) {
  408. params.actualDeliveryDateStart =
  409. params.actualDeliveryDate[0] + " " + "00:00:00";
  410. params.actualDeliveryDateEnd =
  411. params.actualDeliveryDate[1] + " " + "23:59:59";
  412. this.$delete(params, "actualDeliveryDate");
  413. }
  414. if (params.createTime) {
  415. params.createTimeStart = params.createTime[0] + " " + "00:00:00";
  416. params.createTimeEnd = params.createTime[1] + " " + "23:59:59";
  417. this.$delete(params, "createTime");
  418. }
  419. this.page.currentPage = 1;
  420. this.onLoad(this.page, params);
  421. done();
  422. },
  423. searchReset() {
  424. this.configuration.dicData = [];
  425. },
  426. // 选择框
  427. selectionChange(list) {
  428. this.selection = list;
  429. this.single = list.length !== 1;
  430. },
  431. currentChange(currentPage) {
  432. this.page.currentPage = currentPage;
  433. },
  434. sizeChange(pageSize) {
  435. this.page.pageSize = pageSize;
  436. },
  437. //列表刷新触发
  438. refreshChange() {
  439. this.dataList.forEach(item => {
  440. this.$refs.crud.toggleRowExpansion(item, false);
  441. });
  442. this.page.currentPage = 1;
  443. this.onLoad(this.page, this.search);
  444. },
  445. // 表格展开触发
  446. expandChange(row, index) {
  447. if (row.loading) {
  448. detail(row.id).then(res => {
  449. row.insideList = res.data.data.orderItemsList;
  450. row.loading = false;
  451. });
  452. }
  453. },
  454. onLoad(page, params) {
  455. // 重置掉展开
  456. this.dataList.forEach(item => {
  457. this.$refs.crud.toggleRowExpansion(item, false);
  458. });
  459. let data = this.gobackSearch(params);
  460. console.log(data)
  461. let queryParams = Object.assign({}, data, {
  462. size: page.pageSize,
  463. current: page.currentPage,
  464. billType: "XS",
  465. corpsTypeId: this.treeDeptId
  466. });
  467. this.loading = true;
  468. customerList(queryParams)
  469. .then(res => {
  470. this.dataList = res.data.data.records;
  471. this.dataList.forEach(item => {
  472. this.$set(item, "insideList", []);
  473. this.$set(item, "loading", true);
  474. });
  475. this.page.total = res.data.data.total;
  476. this.option.height = window.innerHeight - 240;
  477. })
  478. .finally(() => {
  479. this.loading = false;
  480. });
  481. isProcurement({"param":"synchronous"})
  482. .then(res=>{
  483. this.isProcurements = res.data.data
  484. })
  485. },
  486. //树桩列点击展开触发
  487. treeLoad(tree, treeNode, resolve) {
  488. const parentId = tree.id;
  489. customerList({ parentId: parentId }).then(res => {
  490. resolve(res.data.data.records);
  491. });
  492. },
  493. goBack() {
  494. this.detailData = this.$options.data().detailData;
  495. if (JSON.stringify(this.$route.query) != "{}") {
  496. this.$router.$avueRouter.closeTag();
  497. this.$router.push({
  498. path: "/businessManagement/salesOrder/index"
  499. });
  500. }
  501. this.dataList.forEach(item => {
  502. this.$refs.crud.toggleRowExpansion(item, false);
  503. });
  504. this.isShow = true;
  505. this.onLoad(this.page, this.search);
  506. },
  507. gobackSearch(params) {
  508. params = Object.assign({}, this.search);
  509. if (params.businesDate && params.businesDate != "") {
  510. params.orderStartDate = params.businesDate[0] + " " + "00:00:00";
  511. params.orderEndDate = params.businesDate[1] + " " + "23:59:59";
  512. this.$delete(params, "businesDate");
  513. }
  514. if (params.receiptTime && params.receiptTime != "") {
  515. params.receiptTimeStart = params.receiptTime[0] + " " + "00:00:00";
  516. params.receiptTimeEnd = params.receiptTime[1] + " " + "23:59:59";
  517. this.$delete(params, "receiptTime");
  518. }
  519. if (params.arrivalTime && params.arrivalTime != "") {
  520. params.arrivalTimeStart = params.arrivalTime[0] + " " + "00:00:00";
  521. params.arrivalTimeEnd = params.arrivalTime[1] + " " + "23:59:59";
  522. this.$delete(params, "arrivalTime");
  523. }
  524. if (params.requiredDeliveryDate && params.requiredDeliveryDate != "") {
  525. params.deliveryStartDate =
  526. params.requiredDeliveryDate[0] + " " + "00:00:00";
  527. params.deliveryEndDate =
  528. params.requiredDeliveryDate[1] + " " + "23:59:59";
  529. this.$delete(params, "requiredDeliveryDate");
  530. }
  531. if (params.requiredArrivalDate && params.requiredArrivalDate != "") {
  532. params.arrivalDateStart =
  533. params.requiredArrivalDate[0] + " " + "00:00:00";
  534. params.arrivalDateEnd =
  535. params.requiredArrivalDate[1] + " " + "23:59:59";
  536. this.$delete(params, "requiredArrivalDate");
  537. }
  538. if (params.actualDeliveryDate && params.actualDeliveryDate != "") {
  539. params.actualDeliveryDateStart =
  540. params.actualDeliveryDate[0] + " " + "00:00:00";
  541. params.actualDeliveryDateEnd =
  542. params.actualDeliveryDate[1] + " " + "23:59:59";
  543. this.$delete(params, "actualDeliveryDate");
  544. }
  545. if (params.createTime && params.createTime != "") {
  546. params.createTimeStart = params.createTime[0] + " " + "00:00:00";
  547. params.createTimeEnd = params.createTime[1] + " " + "23:59:59";
  548. this.$delete(params, "createTime");
  549. }
  550. return params;
  551. },
  552. exportExcel() {
  553. let data = this.gobackSearch()
  554. const routeData = this.$router.resolve({
  555. path: '/api/blade-purchase-sales/order/saleOrderExport', //跳转目标窗口的地址
  556. query: {
  557. 'Blade-Auth': getToken(),
  558. ...data //括号内是要传递给新窗口的参数
  559. }
  560. })
  561. window.open(routeData.href.slice(1, routeData.href.length));
  562. },
  563. //列保存触发
  564. async saveColumn() {
  565. /**
  566. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  567. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  568. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  569. */
  570. const inSave = await this.saveColumnData(
  571. this.getColumnName(14),
  572. this.option
  573. );
  574. if (inSave) {
  575. this.$message.success("保存成功");
  576. //关闭窗口
  577. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  578. this.$nextTick(() => {
  579. this.$refs.crud.doLayout();
  580. });
  581. }
  582. },
  583. async resetColumn() {
  584. this.option = option;
  585. const inSave = await this.delColumnData(this.getColumnName(14), option);
  586. if (inSave) {
  587. this.$nextTick(() => {
  588. this.$refs.crud.doLayout();
  589. });
  590. this.$message.success("重置成功");
  591. //关闭窗口
  592. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  593. }
  594. },
  595. // 导出
  596. exportHandle() {
  597. this.$confirm("是否导出产品信息?", "提示", {
  598. confirmButtonText: "确定",
  599. cancelButtonText: "取消",
  600. type: "warning"
  601. })
  602. .then(() => {
  603. window.open(
  604. `/api/blade-client/goodsdesc/export-out-info?${this.website.tokenHeader
  605. }=${getToken()}`
  606. );
  607. })
  608. .catch(() => {
  609. this.$message({
  610. type: "info",
  611. message: "已取消" //
  612. });
  613. });
  614. },
  615. // 生成采购
  616. saveSell(row) {
  617. if (
  618. Number(row.settlmentAmount) < Number(row.debitAmount) &&
  619. row.specialCheckStatus != 3
  620. )
  621. return this.$message.error("收款未收齐,禁止生成采购单");
  622. this.$confirm("是否生成采购单?", {
  623. confirmButtonText: "确定",
  624. cancelButtonText: "取消",
  625. type: "warning"
  626. }).then(() => {
  627. this.loading = true
  628. saveSell(row.id).then(res => {
  629. if (res.data.code == 200) {
  630. this.$message.success("生成成功");
  631. }
  632. }).finally(() => {
  633. this.loading = false;
  634. this.onLoad(this.page, this.search);
  635. })
  636. });
  637. },
  638. customerReceipt(row) {
  639. if (this.$store.getters.inStatus) {
  640. this.$alert("客户收货存在,请保存客户收货再进行操作", "温馨提示", {
  641. confirmButtonText: "确定",
  642. type: "warning",
  643. callback: action => { }
  644. });
  645. } else {
  646. let arr = [];
  647. this.openFullScreen(false, "正在生成客户收货...");
  648. detail(row.id).then(res => {
  649. arr = res.data.data.orderItemsList
  650. ? res.data.data.orderItemsList
  651. : [];
  652. if (arr.length === 0)
  653. return this.$message.error("该单子明细为空,不能生成客户收货");
  654. let ids = [];
  655. arr.forEach(item => ids.push(item.id));
  656. this.$confirm("此操作将进行客户收货,是否继续?", {
  657. confirmButtonText: "确定",
  658. cancelButtonText: "取消",
  659. type: "warning"
  660. }).then(() => {
  661. this.openFullScreen(false, "正在生成客户收货...");
  662. res.data.data.orgId = res.data.data.id
  663. res.data.data.deliveryStatus = '录入'
  664. res.data.data.srcOrderNo = res.data.data.orgOrderNo
  665. res.data.data.arrivalContact = res.data.data.corpAttn
  666. res.data.data.arrivalTel = res.data.data.corpTel
  667. res.data.data.totalWeight = res.data.data.cartonWeight
  668. res.data.data.totalVolumn = res.data.data.cntrVolumn
  669. res.data.data.deliveryItemsList = res.data.data.orderItemsList
  670. res.data.data.deliveryFeesList = res.data.data.orderFeesList
  671. res.data.data.salesCompany = res.data.data.belongToCorpId
  672. res.data.data.deliveryAmount = 0
  673. res.data.data.totalQuantity = 0
  674. res.data.data.totalCost = 0
  675. res.data.data.billType = 'FH'
  676. res.data.data.saleman = res.data.data.chargeMember
  677. res.data.data.orderItemsList.forEach(item => {
  678. item.containerVolume = item.cntrVolumn
  679. item.actualWeight = item.cartonWeight
  680. item.specificationAndModel = item.itemType
  681. item.orgOrderNo = res.data.data.orgOrderNo
  682. item.srcOrderNo = res.data.data.srcOrderNo
  683. item.srcId = item.id
  684. item.actualQuantity = (Number(item.orderQuantity) - Number(item.actualQuantity))
  685. item.arrivalQuantity = item.actualQuantity
  686. item.deliveryAmount = item.amount
  687. item.purchaseTotalAmount = (Number(item.purchaseAmount) * Number(item.actualQuantity))
  688. item.purchaseTotalAmount = item.purchaseTotalAmount.toFixed(2)
  689. item.inventoryNumber = item.storageQuantity
  690. res.data.data.deliveryAmount += Number(item.deliveryAmount)
  691. res.data.data.totalQuantity += Number(item.actualQuantity)
  692. res.data.data.totalCost += Number(item.deliveryAmount)
  693. delete item.id
  694. delete item.pid
  695. delete item.createTime
  696. delete item.createUser
  697. delete item.status
  698. delete item.updateTime
  699. delete item.updateUser
  700. })
  701. res.data.data.orderFeesList.forEach(item => {
  702. delete item.createDept
  703. delete item.createTime
  704. delete item.createUser
  705. delete item.id
  706. delete item.isDeleted
  707. delete item.pid
  708. delete item.status
  709. delete item.tenantId
  710. delete item.updateTime
  711. delete item.updateUser
  712. })
  713. this.warehouseTypeOption.forEach((item, index) => {
  714. if (index == 0) {
  715. res.data.data.warehouseType = item.dictValue
  716. }
  717. })
  718. this.warehouseList.forEach((item, index) => {
  719. if (index == 0) {
  720. res.data.data.storageId = item.id
  721. }
  722. })
  723. res.data.data.businessDate = getCurrentDate()
  724. delete res.data.data.createTime
  725. delete res.data.data.id
  726. delete res.data.data.sysNo
  727. delete res.data.data.corpName
  728. delete res.data.data.belongToCorpList
  729. genClient(res.data.data).then(() => {
  730. this.$message.success('客户收货成功')
  731. this.openFullScreen(true);
  732. this.onLoad(this.page, this.search);
  733. })
  734. });
  735. }).finally(() => {
  736. this.openFullScreen(true);
  737. });
  738. }
  739. },
  740. //遮罩层
  741. openFullScreen(res, text) {
  742. const loading = this.$loading({
  743. lock: true,
  744. text: text,
  745. spinner: "el-icon-loading",
  746. background: "rgba(0, 0, 0, 0.7)"
  747. });
  748. if (res === true) loading.close();
  749. }
  750. }
  751. };
  752. </script>
  753. <style scoped>
  754. </style>