Przeglądaj źródła

零售开单优化

jf 5 lat temu
rodzic
commit
244ab90f03

+ 0 - 3
ghsApp/src/mixins/product.js

@@ -175,7 +175,6 @@ export default {
 				}
 			}
 			this.filterProductInfo = classList
-			console.log(classList)
 			return
 			if(this.$util.isEmpty(this.filterProductInfo)){	//第一次进入无数据
 				let classList = [];
@@ -522,8 +521,6 @@ export default {
 		 */
 		swichClass(cur) {
 			this.isCut = true;
-			console.log(cur,this.filterProductInfo.length-1);
-
 			this.filterProductInfo[cur].isActive = true;
 			if(cur==this.filterProductInfo.length-1){
 				this.filterProductInfo[cur-1].isActive = true;

+ 4 - 4
hdApp/src/admin/billing/index.vue

@@ -30,8 +30,8 @@
 					<view class="item_list_bx suitSelectAll" v-for="(res,i) in suitFilterProductInfo" :key="i" :id="`class_${i}`">
 						<view class="item_list_title">{{ res.className }}</view>
 						<template v-for="(data,j) in res.child">
-							<view :id="`class_${res.classId}_${data.id}`" :key="j" >
-								<GoodsCommondity
+							<view style="height: 160rpx" :id="`class_${res.classId}_${data.id}`" :key="j" >
+								<GoodsCommondity v-if="res.isActive"
 									:info.sync="data"
 									:bigCount="getSelectItemById(data.id, res.classId).bigCount"
 									:smallCount="getSelectItemById(data.id, res.classId).smallCount"
@@ -79,8 +79,8 @@
 							{{ classItem.className }}
 						</view>
 						<template v-for="(productItem, productIndex) in classItem.child">
-							<view :id="`class_${classItem.classId}_${productItem.id}`" :key="productIndex">
-								<Commondity
+							<view style="height: 160rpx" :id="`class_${classItem.classId}_${productItem.id}`" :key="productIndex">
+								<Commondity v-if="classItem.isActive"
 									:info="productItem"
 									:bigCount="
 										getSelectItemById(productItem.id, classItem.classId).bigCount

+ 67 - 17
hdApp/src/mixins/product.js

@@ -230,7 +230,16 @@ export default {
 			* **/
 		scrollPushList(){
 			let list = copyObject(this.productInfo);
-
+			let classList = [];
+			for (let i=0;i<list.length;i++){
+				if(i<2){
+					classList.push({...list[i],isActive:true});
+				}else{
+					classList.push({...list[i],isActive:false});
+				}
+			}
+			this.filterProductInfo = classList
+			return
 			if(this.$util.isEmpty(this.filterProductInfo)){	//第一次进入无数据
 				let classList = [];
 				list.forEach(ele=>{
@@ -294,18 +303,23 @@ export default {
 				let node2 = this.top_list[i+1];
 				if(node2 && top_page >= node1 && top_page < node2){
 					this.classIndex = i;
-					this.scrollPushList();
+					this.filterProductInfo[this.classIndex].isActive = true;
+					this.filterProductInfo[this.classIndex+1].isActive = true;
+					// this.scrollPushList();
 					break;
 				}else if(node2 && top_page === node2){
 					this.classIndex = i + 1;
-					this.scrollPushList();
+					this.filterProductInfo[this.classIndex].isActive = true;
+					this.filterProductInfo[this.classIndex+1].isActive = true;
+					// this.scrollPushList();
 					break;
 				}
 			}
 		},
 		scroll_bottom(){
 			this.classIndex = this.filterProductInfo.length-1
-			this.scrollPushList();
+			this.filterProductInfo[this.classIndex].isActive = true;
+			// this.scrollPushList();
 		},
 		/**
 			* 获取当前选中商品总价
@@ -353,7 +367,16 @@ export default {
 			* **/
 		suitScrollPushList(){
 			let list = copyObject(this.suitInfo);
-
+			let classList = [];
+			for (let i=0;i<list.length;i++){
+				if(i<2){
+					classList.push({...list[i],isActive:true});
+				}else{
+					classList.push({...list[i],isActive:false});
+				}
+			}
+			this.suitFilterProductInfo = classList
+			return
 			if(this.$util.isEmpty(this.suitFilterProductInfo)){	//第一次进入无数据
 				let classList = [];
 				list.forEach(ele=>{
@@ -834,11 +857,19 @@ export default {
 			* 切换左侧商品类别
 			*/
 		swichClass(cur) {
-			clearInterval(this.timeFun)
+			// clearInterval(this.timeFun)
 			this.classIndex = cur;
+			this.filterProductInfo[cur].isActive = true;
+			if(cur==this.filterProductInfo.length-1){
+				this.filterProductInfo[cur-1].isActive = true;
+			}
+			if(cur!=0&&cur!=this.filterProductInfo.length-1){
+				this.filterProductInfo[cur-1].isActive = true;
+				this.filterProductInfo[cur+1].isActive = true;
+			}
 			this.scroll_into_view = '';
 			this.$nextTick(()=>{this.scroll_into_view = 'class_'+cur;})
-			this.scrollPushList();
+			// this.scrollPushList();
 			//解决最后一个 ***来回*** 问题 (由于点击左侧导航,右侧锚点位置信息变化,此时滚动事件也随之滚动。)
 			uni.setStorageSync("resolve","last");
 			setTimeout(()=>{
@@ -850,11 +881,21 @@ export default {
 			* 成品(多风格)-切换左侧商品类别
 			*/
 		suitSwichClass(cur) {
-			clearInterval(this.suitTimeFun)
+
+
+			// clearInterval(this.suitTimeFun)
 			this.suitClassIndex = cur;
+			this.suitFilterProductInfo[cur].isActive = true;
+			if(cur==this.suitFilterProductInfo.length-1){
+				this.suitFilterProductInfo[cur-1].isActive = true;
+			}
+			if(cur!=0&&cur!=this.suitFilterProductInfo.length-1){
+				this.suitFilterProductInfo[cur-1].isActive = true;
+				this.suitFilterProductInfo[cur+1].isActive = true;
+			}
 			this.suit_scroll_into_view = '';
 			this.$nextTick(()=>{this.suit_scroll_into_view = 'class_'+cur;})
-			this.suitScrollPushList();
+			// this.suitScrollPushList();
 			// this.scrollPushList();
 			//解决最后一个 ***来回*** 问题 (由于点击左侧导航,右侧锚点位置信息变化,此时滚动事件也随之滚动。)
 			uni.setStorageSync("resolve","last");
@@ -894,18 +935,23 @@ export default {
 				let node2 = this.suit_top_list[i+1];
 				if(node2 && top_page >= node1 && top_page < node2){
 					this.suitClassIndex = i;
-					this.suitScrollPushList();
+					this.suitFilterProductInfo[this.suitClassIndex].isActive = true;
+					this.suitFilterProductInfo[this.suitClassIndex+1].isActive = true;
+					// this.suitScrollPushList();
 					break;
 				}else if(node2 && top_page === node2){
 					this.suitClassIndex = i + 1;
-					this.suitScrollPushList();
+					this.suitFilterProductInfo[this.suitClassIndex].isActive = true;
+					this.suitFilterProductInfo[this.suitClassIndex+1].isActive = true;
+					// this.suitScrollPushList();
 					break;
 				}
 			}
 		},
 		suit_scroll_bottom(){
 			this.suitClassIndex = this.suitFilterProductInfo.length-1
-			this.suitScrollPushList();
+			this.suitFilterProductInfo[this.suitClassIndex].isActive = true;
+			// this.suitScrollPushList();
 		},
 		/**
 			* 搜索对应花材
@@ -925,13 +971,13 @@ export default {
 								let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0;
 								if (hasName || hasPy) {
 									if(this.$util.isEmpty(commonChildList)){
-										commonChildList = [...commonChildList,{classId: ele.classId, className: ele.className,child:[obj]}];
+										commonChildList = [...commonChildList,{classId: ele.classId, className: ele.className,isActive:true,child:[obj]}];
 									}else{
 										commonChildList.forEach(res => {
 											if(res.classId==ele.classId){
 												res.child.push(obj)
 											}else{
-												commonChildList.push({classId: ele.classId, className: ele.className,child:[obj]});
+												commonChildList.push({classId: ele.classId, className: ele.className,isActive:true,child:[obj]});
 											}
 										})
 									}
@@ -944,9 +990,11 @@ export default {
 				list = this.$util.unique(commonChildList)
 				this.suitFilterProductInfo = list;
 				this.suitClassIndex = 0;
+				this.suit_scroll_into_view = 'class_'+0;
 			}else{
 				this.suitFilterProductInfo = '';
 				this.suitClassIndex = 0;
+				this.suit_scroll_into_view = 'class_'+0;
 				this.suitScrollPushList();
 			}
 		},
@@ -972,13 +1020,13 @@ export default {
 								let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) == 0;
 								if (hasName || hasPy) {
 									if(this.$util.isEmpty(commonChildList)){
-										commonChildList = [...commonChildList,{classId: ele.classId, className: ele.className,child:[obj]}];
+										commonChildList = [...commonChildList,{classId: ele.classId, className: ele.className,isActive:true,child:[obj]}];
 									}else{
 										commonChildList.forEach(res => {
 											if(res.classId==ele.classId){
 												res.child.push(obj)
 											}else{
-												commonChildList.push({classId: ele.classId, className: ele.className,child:[obj]});
+												commonChildList.push({classId: ele.classId, className: ele.className,isActive:true,child:[obj]});
 											}
 										})
 									}
@@ -990,10 +1038,12 @@ export default {
 				});
 				list = this.$util.unique(commonChildList)
 				this.filterProductInfo = list;
-				this.suitClassIndex = 0;
+				this.classIndex = 0;
+				this.scroll_into_view = 'class_'+0;
 			}else{
 				this.filterProductInfo = '';
 				this.classIndex = 0;
+				this.scroll_into_view = 'class_'+0;
 				this.scrollPushList();
 			}
 		},

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

@@ -42,11 +42,8 @@
 							{{ classItem.className }}
 						</view>
 						<template v-for="(productItem, productIndex) in classItem.child">
-							<view
-								:id="`class_${classItem.classId}_${productItem.id}`"
-								:key="productIndex"
-							>
-								<Commondity
+							<view style="height: 160rpx" :id="`class_${classItem.classId}_${productItem.id}`" :key="productIndex">
+								<Commondity v-if="classItem.isActive"
 									:info="productItem"
 									:offVerifyRepertory="true"
 									:bigCount="

+ 3 - 1
hdApp/src/pagesStorehouse/inventory/select.vue

@@ -32,7 +32,8 @@
 							{{ classItem.className }}
 						</view>
 						<template v-for="(productItem, productIndex) in classItem.child">
-							<Commondity
+							<view style="height: 160rpx" :id="`class_${classItem.classId}_${productItem.id}`" :key="productIndex">
+							<Commondity v-if="classItem.isActive"
 								:offPrice="true"
 								:key="productIndex"
 								:info="productItem"
@@ -47,6 +48,7 @@
 								@addOneEvent="addCustomNumEvent"
 								@del="delEvent"
 							></Commondity>
+							</view>
 						</template>
 					</view>
 				</block>