فهرست منبع

app 小菊管理

shish 4 سال پیش
والد
کامیت
dfcc28aba3

+ 61 - 4
ghsApp/src/admin/billing/affirm.vue

@@ -198,7 +198,9 @@ export default {
       currentItemData: { bigCount: 0, smallCount: 0, userPrice: 0 },
       currentItemFocus:false,
       currentModelShow:false,
-      checkStock:true
+      checkStock:true,
+			xjData:{},
+			xjDataInfo:{}
     };
   },
   onLoad (option) {
@@ -235,6 +237,58 @@ export default {
 		if(!this.$util.isEmpty(uni.getStorageSync("newClient"))){
 			this.showCustomer = true;
 		}
+
+    //小菊的添加和修改,同样代码有多个地方,请搜索关键词 xj_change_code
+		if(this.xjData.hasUpdate == 1){
+			console.log('this.xjData',this.xjData)
+			console.log('this.xjDataInfo',this.xjDataInfo)
+
+			const list = this.selectList;
+
+			this.currentItemData = this.xjDataInfo
+
+			if(this.xjData.cancel == 1){
+				this.currentItemData.bigCount = 0
+				this.currentItemData.smallCount = 0
+				console.log('this.currentItemData',this.currentItemData)
+				this.confirmAddModel({index:0})
+			}else{
+
+				//判断list有没有数据,没有需要初始化
+				const list = this.selectList;
+				let has = false
+				for (let index = 0; index < list.length; index++) {
+					const element = list[index];
+					if (element.id == this.xjDataInfo.id && element.classId == this.xjDataInfo.classId) {
+						has = true
+					}
+				}
+
+				if(has == false){
+					let params = {
+						...this.xjDataInfo,
+						bigCount: null, //扎数
+						smallCount: null, //支数
+						autoPrice: null, //调价价格
+						userPrice: null, //调价价格
+					};
+					list.push(params);
+					this.setSelectInfoByType({ type: this.pageType, info: list });
+				}
+
+				this.currentItemData.bigCount = this.xjData.stock
+				this.currentItemData.smallCount = 0
+				this.currentItemData.bigPrice = this.xjData.price
+				this.currentItemData.price = this.xjData.price
+				this.currentItemData.itemPrice = this.xjData.price
+				this.currentItemData.userPrice = this.xjData.price
+
+				this.confirmAddModel({index:1})
+			}
+		}
+		this.xjData = {}
+
+
 	},
 	onUnload(){
 			uni.removeStorageSync('newClient');
@@ -268,7 +322,8 @@ export default {
 					this.showAddModel({ ...item, bigCount: item.bigCount, smallCount: item.smallCount, userPrice: item.userPrice })
 				}
 			}else{
-				this.$msg("小菊请去列表页修改")
+				//去特殊品种页
+				this.goToSpecialVariety(item)
 			}
 		},
 		addModelCancel() {
@@ -344,7 +399,8 @@ export default {
 			if(variety == 0){
 				this.delEvent(item)
 			}else{
-				this.$msg("小菊请去列表页修改")
+				//去特殊品种页
+				this.goToSpecialVariety(item)
 			}
 		},
     //添加花材
@@ -367,13 +423,14 @@ export default {
 				this.addEvent(item)
 			}else{
 				//去特殊品种页
-				this.$emit("goToSpecialVariety", item);
+				this.goToSpecialVariety(item)
 			}
 		},
 		//去特殊品种页,如小菊等
 		goToSpecialVariety(info){
 			this.xjDataInfo = info
 			if(info.stock <= 0){
+        this.$util.noStockRemind()
 				uni.showToast({title:"没有库存",icon:"none"})
 			}else{
 				this.$util.pageTo({url: "/admin/item/xj",query: {stock:info.stock,price: info.price,customId:this.option.customId,userPrice:info.userPrice}})

+ 2 - 0
ghsApp/src/admin/billing/index.vue

@@ -125,6 +125,8 @@ export default {
 		}
 	},
 	onShow() {
+
+		//小菊的添加和修改,同样代码有多个地方,请搜索关键词 xj_change_code
 		if(this.xjData.hasUpdate == 1){
 			console.log('this.xjData',this.xjData)
 			console.log('this.xjDataInfo',this.xjDataInfo)

+ 3 - 3
ghsApp/src/mixins/globalMixins.js

@@ -169,9 +169,9 @@ export default {
 					that.kdType = 'PDA'
 					product.userPrice = product.bigPrice
 
-          //已经选择过的花材,先从storage取出,/admin/billing/affirm 页面的selectList才有数据
-          if(uni.getStorageSync('selectList'+that.pageType+'_custom_'+that.option.customId)){
-            let currentInfo = uni.getStorageSync('selectList'+that.pageType+'_custom_'+that.option.customId)
+          //已经选择过的花材,先从storage取出,跳转到下一页/admin/billing/affirm 时selectList才有数据
+          if(uni.getStorageSync('selectList_'+that.pageType+'_custom_'+that.option.customId)){
+            let currentInfo = uni.getStorageSync('selectList_'+that.pageType+'_custom_'+that.option.customId)
             if(!that.$util.isEmpty(currentInfo)){
               currentInfo.forEach((currentItem,currentIndex,currentArray)=>{
                 let currentId = currentItem.id

+ 17 - 17
ghsApp/src/mixins/product.js

@@ -115,17 +115,17 @@ export default {
 	onShow(){
 		//修改花材
 		if(this.option.modifyProductKey){
-			if(uni.getStorageSync('selectList'+this.option.modifyProductKey)){
+			if(uni.getStorageSync('selectList_'+this.option.modifyProductKey)){
 				//由于价格会变化,所以在initData()重新载入已经选择的花材
 			}
 		}else if(this.pageType == 'bill' && !this.$util.isEmpty(this.option.customId)){
-			if(uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId)){
+			if(uni.getStorageSync('selectList_'+this.pageType+'_custom_'+this.option.customId)){
 				//由于价格会变化,所以在initData()重新载入已经选择的花材
 			}			
 		}else{
 			//盘点和报损等不需要考虑价格
-			if(uni.getStorageSync('selectList'+this.pageType)){
-				this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType) })
+			if(uni.getStorageSync('selectList_'+this.pageType)){
+				this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList_'+this.pageType) })
 			}
 		}
 	},
@@ -140,9 +140,9 @@ export default {
 		rememberProduct(){
 			if(this.pageType == 'bill' && !this.$util.isEmpty(this.option.customId)){
 				//开单根据客户记住已选的花材
-				uni.setStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId, this.selectList)
+				uni.setStorageSync('selectList_'+this.pageType+'_custom_'+this.option.customId, this.selectList)
 			}else{
-				uni.setStorageSync('selectList'+this.pageType, this.selectList)
+				uni.setStorageSync('selectList_'+this.pageType, this.selectList)
 			}
 		},
 		//清除记忆花材
@@ -156,22 +156,22 @@ export default {
 						that.removeMemoryDirect(customId)
 					}
 				}
-			});
+			})
+			that.$msg('已清除')
 		},
 		//直接清除记忆花材不提示
 		removeMemoryDirect(customId=0){
 			let that = this
 			if(customId!=0){
-				uni.removeStorageSync('selectList'+that.pageType+'_custom_'+customId);
+				uni.removeStorageSync('selectList_'+that.pageType+'_custom_'+customId);
 				//删除小菊的记忆
 				uni.removeStorageSync("xj"+customId)
 			}else{
 				console.log(983)
-				uni.removeStorageSync('selectList'+that.pageType);
+				uni.removeStorageSync('selectList_'+that.pageType);
 			}
-			console.log('selectList'+that.pageType)
-			that.resetSelectInfoByType(that.pageType);
-			that.$msg('已清除')
+			console.log('selectList_'+that.pageType)
+			that.resetSelectInfoByType(that.pageType)
 		},
 		//请求商品数据
 		async initData(extendInfo) {
@@ -199,8 +199,8 @@ export default {
 				this.productInfoList = data;
 				//修改花材
 				if(this.option.modifyProductKey){
-					if(uni.getStorageSync('selectList'+this.option.modifyProductKey)){
-						let currentInfo = uni.getStorageSync('selectList'+this.option.modifyProductKey)
+					if(uni.getStorageSync('selectList_'+this.option.modifyProductKey)){
+						let currentInfo = uni.getStorageSync('selectList_'+this.option.modifyProductKey)
 						if(!this.$util.isEmpty(currentInfo)){
 							currentInfo.forEach((currentItem,currentIndex,currentArray)=>{
 								let currentId = currentItem.id
@@ -210,12 +210,12 @@ export default {
 								}
 							})
 							this.setSelectInfoByType({ type: this.pageType, info:  currentInfo})
-							uni.removeStorageSync('selectList'+this.option.modifyProductKey)
+							uni.removeStorageSync('selectList_'+this.option.modifyProductKey)
 						}
 					}
 				}else if(this.pageType == 'bill' && !this.$util.isEmpty(this.option.customId)){
-					if(uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId)){
-						let currentInfo = uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId)
+					if(uni.getStorageSync('selectList_'+this.pageType+'_custom_'+this.option.customId)){
+						let currentInfo = uni.getStorageSync('selectList_'+this.pageType+'_custom_'+this.option.customId)
 						if(!this.$util.isEmpty(currentInfo)){
 							currentInfo.forEach((currentItem,currentIndex,currentArray)=>{
 								let currentId = currentItem.id

+ 1 - 1
ghsApp/src/pagesOrder/detail.vue

@@ -397,7 +397,7 @@ export default {
 
 				getOrderProduct({ id: orderId }).then(res => {
 					let productList = res.data.productList
-					uni.setStorageSync('selectList'+modifyProductKey, productList)
+					uni.setStorageSync('selectList_'+modifyProductKey, productList)
 					self.$util.pageTo({url: '/admin/billing/index',type:2,query: {customId: customId,customName:customName,orderId:orderId,modifyProductKey:modifyProductKey}})
 				})
 

+ 2 - 2
ghsApp/src/pagesPurchase/add.vue

@@ -143,8 +143,8 @@ export default {
 		...mapGetters(["getMyShopInfo","getLoginInfo"]),
 	},
 	onShow(){
-		if(uni.getStorageSync('selectList'+this.pageType)){
-			this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType) });
+		if(uni.getStorageSync('selectList_'+this.pageType)){
+			this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList_'+this.pageType) });
 		}
 		//this.shopId = this.getMyShopInfo.id;
 		//let type = '';