فهرست منبع

采购记忆功能

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

+ 2 - 12
hdApp/src/admin/billing/affirmGhs.vue

@@ -308,6 +308,7 @@ export default {
 	mixins: [productMins],
 	data() {
 		return {
+			pageType: "cg",
 			list:[],
 			autoLoad: false,
 			ghsInfo:'',
@@ -342,17 +343,6 @@ export default {
 		};
 	},
 	onLoad(e) {
-		if (!this.getMerchantInfo) {
-			this.initMerchantInfo().then(data => {
-				uni.setNavigationBarTitle({
-					title: data.name
-				});
-			});
-		} else {
-			uni.setNavigationBarTitle({
-				title: this.getMerchantInfo.name
-			});
-		}
 		this.getGhsData(e.id);
 	},
 	onShow() {
@@ -503,7 +493,7 @@ export default {
 							self.pageTo({url: `/pagesPurchase/wechatPay?type=2&orderSn=${orderSn}&realPrice=${realPrice}&count=${count}&hasDebtPay=${hasDebtPay}`, type: 2})
 							setTimeout(() => {
 								uni.removeStorageSync('selectCouponInfo')
-								self.resetSelectInfoByType(self.pageType);
+								self.removeMemory(self.ghsInfo.id)
 								//删除小菊的记忆
 								uni.removeStorageSync("ghsXj"+params.ghsId)
 							}, 600)

+ 2 - 10
hdApp/src/admin/home/workbench.vue

@@ -69,16 +69,8 @@
     <!-- 客户按钮 -->
     <view class="module-com">
       <view class="tabs-head_bx">
-				<image
-					@click="pageTo({ url: '/admin/billing/index' })"
-					:src="kdSrc"
-					mode="widthFix"
-				></image>
-				<image
-					@click="pageTo({ url: '/pagesPurchase/order' })"
-					:src="cgSrc"
-					mode="widthFix"
-				></image>
+				<image @click="pageTo({ url: '/admin/billing/index' })" :src="kdSrc" mode="widthFix" ></image>
+				<image @click="pageTo({ url: '/pagesPurchase/order' })" :src="cgSrc" mode="widthFix"></image>
       </view>
       <div class="tabs-wrap">
         <div

+ 1 - 1
hdApp/src/components/module/app-search.vue

@@ -1,6 +1,6 @@
 <template>
 	<div class="app-search-module" :style="{ height: height + 'rpx' }">
-		<div class="map-search" :style="{ backgroundColor: backColor }" style="height: 100rpx">
+		<div class="map-search" :style="{ backgroundColor: backColor }" style="height: 80rpx">
 			<div class="icon-wrap" v-if="isIcon">
 				<i class="iconfont" :class="[icon]"></i>
 			</div>

+ 77 - 12
hdApp/src/mixins/product.js

@@ -200,28 +200,75 @@ export default {
 			return has;
 		}
 	},
+	onShow(){
+		if(this.pageType == 'cg' && !this.$util.isEmpty(this.option.id)){
+			//在initGhsData()获取记忆的花材,保证价格有变时取到最新价格
+		}else{
+			if(uni.getStorageSync('selectList'+this.pageType)){
+				this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType) })
+			}
+		}
+	},
 	methods: {
 		...mapActions(["setSelectInfoByType", "resetSelectInfoByType"]),
-		/**
-			* 请求商品数据
-			*/
+		//记忆已选的花材
+		rememberProduct(){
+			if(this.pageType == 'cg' && !this.$util.isEmpty(this.option.id)){
+				uni.setStorageSync('selectList'+this.pageType+'_ghs_'+this.option.id, this.selectList)
+			}else{
+				uni.setStorageSync('selectList'+this.pageType, this.selectList)
+			}
+		},
+		//清除已记忆花材
+		removeMemory(ghsId){
+			if(ghsId){
+				uni.removeStorageSync('selectList'+this.pageType+'_ghs_'+ghsId);
+			}else{
+				uni.removeStorageSync('selectList'+this.pageType);
+			}
+			this.resetSelectInfoByType(this.pageType);
+		},
+		//采购时请求供应商花材
 		async initGhsData(id,shopId) {
-			//extendInfo调用时的扩展参数  如  shopId
+			//extendInfo调用时的扩展参数,如shopId
 			try {
 				let params = {
 					py: this.py,
 					id:id,
 					shopId:shopId
 				};
+				let directList = [];
 				const { data } = await getGhsProductList(params);
 				data.forEach(element => {
 					element.child &&
 					element.child.forEach(child => {
+
+						//价格如果有改动,记忆的花材价格需要改掉 shish 20210811
+						directList[child.id] = child
+
 						child.classId = element.classId;
 						child.className = element.className;
 					});
 				});
 				this.productInfo = data;
+
+				if(this.pageType == 'cg' && !this.$util.isEmpty(this.option.id)){
+					if(uni.getStorageSync('selectList'+this.pageType+'_ghs_'+this.option.id)){
+						let currentInfo = uni.getStorageSync('selectList'+this.pageType+'_ghs_'+this.option.id)
+						if(!this.$util.isEmpty(currentInfo)){
+							currentInfo.forEach((currentItem,currentIndex,currentArray)=>{
+								let currentId = currentItem.id
+								if(directList[currentId]){
+									//价格如果有改动,记忆花材的价格需要更新 shish 20210811
+									currentArray[currentIndex].bigPrice = directList[currentId].bigPrice
+									currentArray[currentIndex].smallPrice = directList[currentId].smallPrice
+								}
+							})
+							this.setSelectInfoByType({ type: this.pageType, info: currentInfo })
+						}
+					}			
+				}
+
 				this.classIndex = 0;
 				this.scroll_into_view = 'class_0';
 				this.scrollPushList();
@@ -507,10 +554,7 @@ export default {
 			}
 			return info;
 		},
-
-		/**
-			* 添加商品
-			*/
+		//添加商品
 		addEvent(item) {
 			const list = this.selectList;
 			let has = false;
@@ -581,7 +625,16 @@ export default {
 					}
 				}
 			}
+
+			console.log('花材列表',list)
+
 			this.setSelectInfoByType({ type: this.pageType, info: list });
+
+			console.log('this.selectList',this.selectList)
+
+			//记忆已经选择的花材
+			this.rememberProduct()
+
 		},
 
 		addCustomNumEvent(item,params1,type) {
@@ -610,10 +663,12 @@ export default {
 			this.$nextTick(()=>{
 				this.customNum(params1)
 			})
+
+			//记忆已经选择的花材
+			this.rememberProduct()
+
 		},
-		/**
-			* 减去商品
-			*/
+		//减去商品
 		delEvent(item) {
 
 			const list = copyObject(this.selectList);
@@ -638,6 +693,9 @@ export default {
 				}
 			}
 			this.setSelectInfoByType({type: this.pageType, info: list});
+			console.log('this.selectList','减少花材之后:',this.selectList)
+			//记忆已经选择的花材
+			this.rememberProduct()
 		},
 		delAllEvent(item) {
 			const list = this.selectList;
@@ -649,6 +707,10 @@ export default {
 				}
 			}
 			this.setSelectInfoByType({ type: this.pageType, info: list });
+
+			console.log('this.selectList','减少花材之后:',this.selectList)
+			//记忆已经选择的花材
+			this.rememberProduct()
 		},
 		/**
 			* 通过id获取当前选中的商品类别信息  左边菜单角标  当前选中该类别商品多少件
@@ -813,7 +875,10 @@ export default {
 				}
 			}
 			this.setSelectInfoByType({ type: this.pageType, info: list });
-			// this.$forceUpdate();
+
+			//记忆已经选择的花材
+			this.rememberProduct()
+
 		},
 		/**
 			* 切换左侧商品类别

+ 5 - 5
hdApp/src/pages.json

@@ -581,31 +581,31 @@
 				{
 					"path": "result",
 					"style": {
-						"navigationBarTitleText": "开单结果"
+						"navigationBarTitleText": "开单状态"
 					}
 				},
 				{
 					"path": "affirm",
 					"style": {
-						"navigationBarTitleText": "确认下单"
+						"navigationBarTitleText": "确认订单信息"
 					}
 				},
 				{
 					"path": "affirmGoods",
 					"style": {
-						"navigationBarTitleText": "确认下单"
+						"navigationBarTitleText": "确认订单信息"
 					}
 				},
 				{
 					"path": "affirmGhs",
 					"style": {
-						"navigationBarTitleText": "确认下单"
+						"navigationBarTitleText": "确认订单信息"
 					}
 				},
 				{
 					"path": "affirmPxClass",
 					"style": {
-						"navigationBarTitleText": "确认下单"
+						"navigationBarTitleText": "确认订单信息"
 					}
 				},
 				{

+ 12 - 2
hdApp/src/pagesPurchase/ghsProduct.vue

@@ -15,7 +15,12 @@
       </view>
     </view>
 		<view class="input-wrap" >
-			<app-search-module v-model="py" placeholder="输入拼音首字母搜索" @input="searchFn" />
+			<view class="search-bar">
+				<app-search-module v-model="py" placeholder="输首字母搜索,如太阳花,输tyh" @input="searchFn" />
+			</view>
+			<view style="padding:0 0rpx 0 20rpx;" >
+				<button class="admin-button-com middle blue" @click="removeMemory(option.id)">清除采购</button>
+			</view>
 		</view>
 		<view class="scroll-middle_bx">
 			<scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop" >
@@ -131,9 +136,10 @@ export default {
 	mixins: [productMins,allMoreSelectInputMins],
 	data() {
 		return {
+			pageType: "cg",
 			COMMODITY_TYPE,
 			popupShow:false,
-			isGhsProduct:true,//采购进店开单
+			isGhsProduct:true,
 			isFocus: false,
 			isModel: false,
 			isSmallCount: false,
@@ -550,7 +556,11 @@ export default {
     }
   }
 	.input-wrap {
+		display: flex;
 		padding: 22px 20px 22px 30px;
+		.search-bar {
+			flex: 1;
+		}
 	}
 	.scroll-middle_bx {
 		flex: 1;

+ 0 - 2
hdApp/src/pagesPurchase/order.vue

@@ -88,8 +88,6 @@ export default {
     enter (item) {
       const { id } = item
 			uni.navigateTo({url:`/pagesPurchase/ghsProduct?id=${id}`, type: 2 })
-      //采购整体没有记忆功能,进入时将小菊记忆删除
-      uni.removeStorageSync("ghsXj"+id)
     },
     init() {
       this.getGHSList()