From 1faedc0334667d7e6e402acf8f2bf2663e6b14d6 Mon Sep 17 00:00:00 2001 From: xiao-fajia <1665375861@qq.com> Date: Sat, 14 Sep 2024 11:33:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/repair/stockOperate/stockOperate.js | 10 ++ src/views/repair/Components/PartChoose.vue | 58 ++++++-- .../repair/stockOperate/Components/SoInfo.vue | 41 ++++-- .../stockOperate/Components/SoTable.vue | 126 +++++++++++++++--- 4 files changed, 201 insertions(+), 34 deletions(-) diff --git a/src/api/repair/stockOperate/stockOperate.js b/src/api/repair/stockOperate/stockOperate.js index 543ea86..23d957c 100644 --- a/src/api/repair/stockOperate/stockOperate.js +++ b/src/api/repair/stockOperate/stockOperate.js @@ -1 +1,11 @@ import request from '@/utils/request' + +const preUrl = "/repair/so" + +export function createRepairSo(data){ + return request({ + url: preUrl + "/create", + method: "post", + data + }) +} diff --git a/src/views/repair/Components/PartChoose.vue b/src/views/repair/Components/PartChoose.vue index 8565f20..f80cbfc 100644 --- a/src/views/repair/Components/PartChoose.vue +++ b/src/views/repair/Components/PartChoose.vue @@ -2,17 +2,17 @@ - + - - - - - - + + + + + + @@ -26,8 +26,48 @@ export default { return{ partSelected: null, partList: [ - {id: 1, name: '张胜男', age:20, gender: 1}, - {id: 2, name: '张胜妇', age:20, gender: 1} + { + id: 1, + tenantId: 1, + barCode: "12344564632463", + code: "12312312", + name: "测试1", + model: "12321", + price: "100", + type: "不知道", + unit: "个", + warehouse: "d1", + miniStock: 100, + maxStock: 100, + stock: 20, + img: '', + attribute: "123213123", + corpId: 1, + coverImage: '', + carModel: "大车", + remark: "没有", + }, + { + id: 2, + tenantId: 1, + barCode: "12344564632463", + code: "12312312", + name: "测试2", + model: "12321", + price: "10", + type: "不知道", + unit: "个", + warehouse: "d2", + miniStock: 10, + maxStock: 10, + stock: 5, + img: '', + attribute: "123213123", + corpId: 1, + coverImage: '', + carModel: "大车", + remark: "没有", + } ], queryParams:{ pageNo: 1, diff --git a/src/views/repair/stockOperate/Components/SoInfo.vue b/src/views/repair/stockOperate/Components/SoInfo.vue index 7b00eb6..7ab2e92 100644 --- a/src/views/repair/stockOperate/Components/SoInfo.vue +++ b/src/views/repair/stockOperate/Components/SoInfo.vue @@ -36,19 +36,24 @@ - + - + + + + + + - - + + - - 结算 + + 结算 确定 @@ -63,6 +68,7 @@ import PartChoose from "@/views/repair/Components/PartChoose.vue"; import SoTable from "@/views/repair/stockOperate/Components/SoTable.vue"; import SupplierChoose from "@/views/repair/Components/SupplierChoose.vue"; import {createUniqueCodeByHead} from "@/utils/createUniqueCode"; +import {createRepairSo} from "@/api/repair/stockOperate/stockOperate"; export default { name: "SoInfo", @@ -77,7 +83,7 @@ export default { type: Boolean, defaultValue: true, required: true - } + }, }, data() { return { @@ -88,7 +94,13 @@ export default { soTime: Date.now(), userId: null, userName: null, - partList: [] + partList: [], + totalPrice: null, + soType: this.soByType ? "01" : "02", + purchaseType: "01", + itemCount: 0, + soStatus: this.soByType ? "01" : "04", + remark: null, }, staffRole: "采购员", partList: [], @@ -106,7 +118,8 @@ export default { }, // 得到选择的供应商 getSupplier(data) { - console.log(data) + this.formData.supplierId = data.id + this.formData.supplierName = data.name }, // 得到选择的商品 async getPart(data) { @@ -124,6 +137,16 @@ export default { // 删除数据 deleteItem(index) { this.partList.splice(index, 1) + }, + // 表格的数据 + tableData(data){ + this.formData.totalPrice = data.reduce((x, y) => {return x + y.totalPrice}, 0) + this.formData.itemCount = data.reduce((x, y) => {return x + y.count}, 0) + this.formData.partList = data + }, + async handleSubmit(){ + const res = await createRepairSo(this.formData) + console.log(res) } } } diff --git a/src/views/repair/stockOperate/Components/SoTable.vue b/src/views/repair/stockOperate/Components/SoTable.vue index 0a73902..524e9c7 100644 --- a/src/views/repair/stockOperate/Components/SoTable.vue +++ b/src/views/repair/stockOperate/Components/SoTable.vue @@ -1,21 +1,53 @@