From 8335a9090a51564c954c2995a3ec6a761c48b1d3 Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期四, 30 十一月 2023 19:40:04 +0800
Subject: [PATCH] add:新增编辑时若当前供应商没有该产品,添加弹窗提醒
---
src/views/purchaseManage/purchase/components/AddPurchase.vue | 121 +++++++++++++++++++++++++++++++++------
src/views/purchaseManage/purchase/index.vue | 3 +
2 files changed, 104 insertions(+), 20 deletions(-)
diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue
index 3d78de0..90bfa28 100644
--- a/src/views/purchaseManage/purchase/components/AddPurchase.vue
+++ b/src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -376,7 +376,8 @@
},
total:0,
totalTwo:0,
- productListIdx:0
+ productListIdx:0,
+ lacks:[],
};
},
created() {
@@ -518,22 +519,91 @@
this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖");
} else {
const params = this.saveParams();
+ //鏂板缓
if (this.editConfig.title === "鍒涘缓") {
- addPurchase(params).then((res) => {
- this.editConfig.visible = false;
- if (res.code === 200) {
- this.$message.success("娣诲姞鎴愬姛");
- this.$parent.getData();
+ this.tableData.forEach((item)=>{
+ if(this.productTableList.tableProductList.map(obj => obj.number).includes(item.number)) {
+ console.log(`${item.name} 鍦ㄦ暟缁勪腑瀛樺湪`);
+ } else {
+ this.lacks.push(item.name)
}
- });
+ })
+ if(this.lacks.length>0){
+ this.$confirm(`褰撳墠渚涘簲鍟嗕笉鑳芥彁渚涙偍閫夋嫨鐨勪骇鍝�:${this.lacks}, 鏄惁缁х画鍒涘缓閲囪喘鍗�?`, '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ console.log("纭畾鍒涘缓")
+ //鍒涘缓閲囪喘鍗�
+ addPurchase(params).then((res) => {
+ this.editConfig.visible = false;
+ if (res.code === 200) {
+ this.$message.success("鍒涘缓鎴愬姛");
+ this.$parent.getData();
+ }
+ });
+ }).catch(() => {
+ console.log("鍙栨秷鍒涘缓")
+ });
+ }else{
+ addPurchase(params).then((res) => {
+ this.editConfig.visible = false;
+ if (res.code === 200) {
+ this.$message.success("鍒涘缓鎴愬姛");
+ this.$parent.getData();
+ }
+ });
+ }
} else {
- updatePurchase(params).then((res) => {
- this.editConfig.visible = false;
- if (res.code === 200) {
- this.$message.success("缂栬緫鎴愬姛");
- this.$parent.getData();
+ // 缂栬緫
+ getProductList({
+ supplierId:this.editConfig.infomation.supplierId,
+ page:1,
+ pageSize:100
+ }).then((res)=>{
+ if(res.code===200){
+ // 缂栬緫鍓嶅厛鐪嬬湅褰撳墠渚涘簲鍟嗗搴旂殑浜у搧鍒楄〃
+ this.productTableList.tableProductList = res.data.list
+ //褰撳墠浜у搧鏄惁鍦ㄥ綋鍓嶄緵搴斿晢涓嬪瓨鍦�
+ this.tableData.forEach((item)=>{
+ if(this.productTableList.tableProductList.map(obj => obj.number).includes(item.number)) {
+ console.log(`${item.name} 鍦ㄦ暟缁勪腑瀛樺湪`);
+ } else {
+ this.lacks.push(item.name)
+ }
+ })
+ // 涓嶅瓨鍦ㄧ殑浜у搧淇℃伅
+ if(this.lacks.length>0){
+ this.$confirm(`褰撳墠渚涘簲鍟嗕笉鑳芥彁渚涙偍閫夋嫨鐨勪骇鍝�:${this.lacks}, 鏄惁缁х画鏇存柊閲囪喘鍗�?`, '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ console.log("纭畾鏇存柊")
+ //鏇存柊閲囪喘鍗�
+ updatePurchase(params).then((res) => {
+ this.editConfig.visible = false;
+ if (res.code === 200) {
+ this.$message.success("鏇存柊鎴愬姛");
+ this.$parent.getData();
+ }
+ });
+ }).catch(() => {
+ console.log("鍙栨秷鏇存柊")
+ });
+ }else {
+ updatePurchase(params).then((res) => {
+ this.editConfig.visible = false;
+ if (res.code === 200) {
+ this.$message.success("鏇存柊鎴愬姛");
+ this.$parent.getData();
+ }
+ });
+ }
}
- });
+ })
+
}
}
} else {
@@ -569,6 +639,8 @@
priceAdjustment:data.priceAdjustment?Number(data.priceAdjustment):0,
realTotalPrice:this.total?Number(this.total):0,
totalPrice:this.totalTwo?Number(this.totalTwo):0,
+ status:data.status,
+ quantity:data.quantity, // 閲囪喘鏁伴噺
}
};
if(data.ID){
@@ -598,6 +670,7 @@
);
};
},
+ // 閫夋嫨渚涘簲鍟�
async handleSelectClient(value, item) {
this.productTableList.supplierId=item.ID
if (value === "client") {
@@ -622,11 +695,10 @@
this.$set(this.editConfig.infomation,'supplierName',row.name)
this.editConfig.infomation.contact = row.contact;
this.editConfig.infomation.phone = row.phone;
- this.supplierId = row.ID;
+ this.editConfig.infomation.supplierId = row.ID;
},
// 娓呴櫎宸查�夋嫨鐢ㄦ埛
clearupClient(value) {
- this.emptyProductClick()
if (value == "client") {
this.$set(this.editConfig.infomation, "supplierName", "");
this.supplierId = null;
@@ -640,15 +712,21 @@
) {
this.tableData = [
{
+ purchaseId:0,
productId: this.productId,
productIndex:this.productIndex,
- id: 0,
amount: 0,
- desc: "",
name: "",
number: "",
price: 0,
total: 0,
+ remark:'',
+ unit:'',
+ purchasePrice:'',
+ deliveryTime:"",
+ shippingDuration:"",
+ specifications:"",
+ modelNumber:"",
},
];
} else {
@@ -693,13 +771,16 @@
inputContent(val, prop, row) {
// this.productId = row.productId;
this.productIndex=row.productIndex;
- console.log(row,val,prop,"浜у搧ID",this.tableData)
+ let num=0
this.tableData.map((item) => {
+ num+=item.amount
if (item.productIndex === row.productIndex) {
item[prop] = val;
}
});
-
+ if(prop==="amount"){
+ this.editConfig.infomation.quantity=num
+ }
},
getSummaries(total){
this.totalTwo= JSON.parse(JSON.stringify(total));
@@ -749,7 +830,7 @@
productId: '',
productIndex:this.productIndex,
id: 0,
- amount: 0,
+ amount: "0",
desc: "",
name: "",
number: "",
diff --git a/src/views/purchaseManage/purchase/index.vue b/src/views/purchaseManage/purchase/index.vue
index 7d7cfd5..806d08f 100644
--- a/src/views/purchaseManage/purchase/index.vue
+++ b/src/views/purchaseManage/purchase/index.vue
@@ -261,6 +261,9 @@
this.tableLoading = false
this.editConfig.visible = true
this.editConfig.title = "缂栬緫"
+ res.data.productList.map((item,index)=>{
+ item.productIndex=index
+ })
this.editConfig.infomation = {
productList: res.data.productList,
supplierName: res.data.purchase.supplier.name,
--
Gitblit v1.8.0