Просмотр исходного кода

零售采购订单和预订花材列表页优化

shish 3 лет назад
Родитель
Сommit
ceaaaf7f7c

+ 116 - 238
hdApp/src/mixins/cgProduct.js

@@ -1,5 +1,4 @@
-import { getGoodsDataApi,getProductDataApi,getPxClassDataApi } from "@/api/product/index";
-import { getGhsProductList } from "@/api/product/index";
+import { getGoodsDataApi,getProductDataApi,getPxClassDataApi,getGhsProductList } from "@/api/product";
 import { mapGetters, mapActions } from "vuex";
 import { copyObject } from "@/utils/util";
 export default {
@@ -7,10 +6,8 @@ export default {
 		return {
 			options:'',
 			pageType: "bill", //选择商品页面类别  用于区分不同功能的数据
-
 			suitInfo: [], //商品-商品信息
 			suitClassIndex: 0, //商品-当前商品类别下标
-
 			productInfo: [], //商品信息
 			pxClassInfo: [], //培训班开单列表
 			classIndex: 0, //当前商品类别下标
@@ -18,16 +15,13 @@ export default {
 			type: "", //库存预警时,固定为waring,其他情况不传或者传空
 			autoLoad: true, //自动获取商品信息
 			isLimit: true, //选择数量不能大于库存限制
-
 			//商品开单
 			suit_scroll_into_view:"",
 			suit_top_list:'',
-			suitTimeFun:"",
 			suitFilterProductInfo:'',
 			//组合开单
 			scroll_into_view:"",
 			top_list:'',
-			timeFun:"",
 			filterProductInfo:'',
 			//当前页面默认使用的单位 0大单位 1小单位
 			globalUnitType:0
@@ -168,15 +162,7 @@ export default {
 			let has = false;
 			if (this.selectList) {
 				for (const item of this.selectList) {
-					const {
-						bigCount,
-						smallCount,
-						bigNum,
-						bigUnit,
-						smallNum,
-						smallUnit,
-						ratio
-					} = item;
+					const { bigCount, smallCount, bigNum, bigUnit, smallNum, smallUnit, ratio } = item;
 					const ratioNum = Number(ratio);
 					if (
 						Number(bigCount) * ratioNum + Number(smallCount) >
@@ -238,89 +224,53 @@ export default {
 			}
 		},
 		//采购时请求供应商花材
-		async initGhsData(id,shopId) {
+		async initGhsData(id,shopId,showAll) {
 			//extendInfo调用时的扩展参数,如shopId
 			try {
-				let params = {
-					py: this.py,
-					id:id,
-					shopId:shopId
-				};
-				let directList = [];
+				let params = { py: this.py, id:id, shopId:shopId, showAll:showAll }
 				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 })
-						}else{
-							//临时解决方案
-							this.resetSelectInfoByType(this.pageType);
-						}
+				if(this.pageType == 'cg' || this.pageType == 'bookCg'){
+					let targetId = this.option.id ? this.option.id : 0
+					let currentInfo = uni.getStorageSync('selectList'+this.pageType+'_ghs_'+targetId)
+					if(!this.$util.isEmpty(currentInfo)){
+						this.setSelectInfoByType({ type: this.pageType, info: currentInfo })
 					}else{
 						//临时解决方案
 						this.resetSelectInfoByType(this.pageType);
-					}			
+					}
 				}
-
 				this.classIndex = 0;
 				this.scroll_into_view = 'class_0';
 				this.scrollPushList();
 			} catch (error) {
+				uni.hideLoading()
 			} finally {
-				uni.hideLoading();
+				uni.hideLoading()
 			}
 		},
 		async initData(extendInfo) {
 			//extendInfo调用时的扩展参数  如  shopId
-			try {
-				let params = {
-					py: this.py,
-					type: this.type
-				};
-				if (extendInfo) {
-					params = { ...params, ...extendInfo };
-				}
-				const { data } = await getProductDataApi(params);
-				data.forEach(element => {
-					element.child &&
-					element.child.forEach(child => {
-						child.classId = element.classId;
-						child.className = element.className;
-					});
+			let params = {
+				py: this.py,
+				type: this.type
+			};
+			if (extendInfo) {
+				params = { ...params, ...extendInfo };
+			}
+			const { data } = await getProductDataApi(params);
+			data.forEach(element => {
+				element.child &&
+				element.child.forEach(child => {
+					child.classId = element.classId;
+					child.className = element.className;
 				});
-				this.productInfo = data;
-				this.classIndex = 0;
-				this.scrollPushList();
-			} catch (error) {
-			} finally {
-				uni.hideLoading();
-			}
+			});
+			this.productInfo = data;
+			this.classIndex = 0;
+			this.scrollPushList();
 		},
-		/**
-			* 滚动或切换分类 获取更多数据
-			* **/
+		//滚动或切换分类 获取更多数据
 		scrollPushList(){
 			let list = copyObject(this.productInfo);
 			let classList = [];
@@ -332,55 +282,19 @@ export default {
 				}
 			}
 			this.filterProductInfo = classList
-			return
-			if(this.$util.isEmpty(this.filterProductInfo)){	//第一次进入无数据
-				let classList = [];
-				list.forEach(ele=>{
-					classList = [...classList,{child:[],classId:ele.classId,className:ele.className}]
-				})
-				classList[this.classIndex].child = list[this.classIndex].child;
-				this.filterProductInfo = classList;
-				let classIndex = 1;
-				this.timeFun = setInterval(()=>{
-					if(classIndex<this.filterProductInfo.length){
-						classList[classIndex].child = list[classIndex].child;
-						this.filterProductInfo = classList;
-						classIndex++
-					}else{
-						clearInterval(this.timeFun)
-					}
-				},600)
-			}else{//获取更多数据
-				if(this.$util.isEmpty(this.filterProductInfo[this.classIndex].child)){
-					this.filterProductInfo[this.classIndex].child = list[this.classIndex].child;
-				}
-				if(this.classIndex+1<this.filterProductInfo.length-1){
-					if(this.$util.isEmpty(this.filterProductInfo[this.classIndex+1].child)){
-						this.filterProductInfo[this.classIndex+1].child = list[this.classIndex+1].child;
-					}
-				}
-			}
-
-
-
 		},
-		/**
-			* 滚动商品监听
-			* **/
+		//滚动商品监听
 		scroll_detail(options){
 			//options  为滚动信息。  options.detail.scrollTop  值为相对于scroll-view。
 			if(!uni.getStorageSync("resolve")){
 				this.get_node_details(options);
 			};
 		},
-		/**
-			* 获取商品节点信息
-			* **/
+		//获取商品节点信息
 		get_node_details(options){
 			const query = uni.createSelectorQuery().in(this); //获得实力
 			//获取多个节点方式
 			query.selectAll(".selectAll").boundingClientRect(data=>{
-				// console.log(data); //得到class类名为  selectAll的数组集合
 				this.top_list = data.map(item=>{
 					return Math.ceil(item.top);
 				});
@@ -414,9 +328,9 @@ export default {
 			}
 		},
 		scroll_bottom(){
-				this.classIndex = this.filterProductInfo.length-1
-				this.filterProductInfo[this.classIndex].isActive = true;
-				this.filterProductInfo[this.classIndex-1].isActive = true;
+			this.classIndex = this.filterProductInfo.length-1
+			this.filterProductInfo[this.classIndex].isActive = true;
+			this.filterProductInfo[this.classIndex-1].isActive = true;
 		},
 		//获取当前选中商品总价
 		getSelectItemPrice(item) {
@@ -428,9 +342,7 @@ export default {
 			price = Math.round(sum * 100) / 100;
 			return price;
 		},
-		/**
-			* 商品-请求商品数据
-			*/
+		//商品-请求商品数据
 		async initGoodsData(extendInfo) {
 			//extendInfo调用时的扩展参数  如  shopId
 			try {
@@ -457,9 +369,7 @@ export default {
 				uni.hideLoading();
 			}
 		},
-		/**
-			* 商品-滚动或切换分类 获取更多数据
-			* **/
+		//商品-滚动或切换分类 获取更多数据
 		suitScrollPushList(){
 			let list = copyObject(this.suitInfo);
 			let classList = [];
@@ -471,41 +381,8 @@ export default {
 				}
 			}
 			this.suitFilterProductInfo = classList
-			return
-			if(this.$util.isEmpty(this.suitFilterProductInfo)){	//第一次进入无数据
-				let classList = [];
-				list.forEach(ele=>{
-					classList = [...classList,{child:[],classId:ele.classId,className:ele.className}]
-				})
-				classList[this.suitClassIndex].child = list[this.suitClassIndex].child;
-				this.suitFilterProductInfo = classList;
-				let classIndex = 1;
-				this.suitTimeFun = setInterval(()=>{
-					if(classIndex<this.suitFilterProductInfo.length){
-						classList[classIndex].child = list[classIndex].child;
-						this.suitFilterProductInfo = classList;
-						classIndex++
-					}else{
-						clearInterval(this.suitTimeFun)
-					}
-				},600)
-			}else{//获取更多数据
-				if(this.$util.isEmpty(this.suitFilterProductInfo[this.suitClassIndex].child)){
-					this.suitFilterProductInfo[this.suitClassIndex].child = list[this.suitClassIndex].child;
-				}
-				if(this.suitClassIndex+1<this.suitFilterProductInfo.length-1){
-					if(this.$util.isEmpty(this.suitFilterProductInfo[this.suitClassIndex+1].child)){
-						this.suitFilterProductInfo[this.suitClassIndex+1].child = list[this.suitClassIndex+1].child;
-					}
-				}
-			}
-
-
-
 		},
-		/**
-			* 获取当前选中商品总价
-			*/
+		//获取当前选中商品总价
 		getSelectGoodsPrice(item) {
 			let price = 0;
 
@@ -516,9 +393,7 @@ export default {
 			}
 			return price;
 		},
-		/**
-			* 通过id获取当前选中的商品信息
-			*/
+		//通过id获取当前选中的商品信息
 		getSelectItemById(id, classId) {
 			let info = {
 				bigCount: 0, //扎数
@@ -542,9 +417,7 @@ export default {
 			}
 			return info;
 		},
-		/**
-			* 通过id获取当前选中的商品类别信息  左边菜单角标  当前选中该类别商品多少件
-			*/
+		//通过id获取当前选中的商品类别信息  左边菜单角标  当前选中该类别商品多少件
 		getSelectClassById(classId) {
 			let info = {
 				bigCount: 0, //扎数
@@ -730,9 +603,7 @@ export default {
 			//记忆已经选择的花材
 			this.rememberProduct()
 		},
-		/**
-			* 通过id获取当前选中的商品类别信息  左边菜单角标  当前选中该类别商品多少件
-			*/
+		//通过id获取当前选中的商品类别信息  左边菜单角标  当前选中该类别商品多少件
 		getSuitSelectClassById(classId) {
 			let info = {
 				bigCount: 0, //扎数
@@ -757,10 +628,7 @@ export default {
 			}
 			return info;
 		},
-
-		/**
-			* 多风格-添加商品
-			*/
+		//多风格-添加商品
 		addGoodsEvent(item) {
 			console.log(item,'itemitem')
 			const list = this.selectList;
@@ -801,9 +669,7 @@ export default {
 			this.setSelectInfoByType({ type: this.pageType, info: list });
 			// this.$forceUpdate();
 		},
-		/**
-			* 多风格-添加商品
-			*/
+		//多风格-添加商品
 		addGoods(item) {
 			const list = this.selectList;
 			let has = false;
@@ -841,9 +707,7 @@ export default {
 			this.setSelectInfoByType({ type: this.pageType, info: list });
 			// this.$forceUpdate();
 		},
-		/**
-			* 多风格-减去商品
-			*/
+		//多风格-减去商品
 		delGoodsEvent(item) {
 			const list = this.selectList;
 			for (let index = 0; index < list.length; index++) {
@@ -861,9 +725,7 @@ export default {
 			}
 			this.setSelectInfoByType({ type: this.pageType, info: list });
 		},
-		/**
-			* 更新商品
-			*/
+		//更新商品
 		updateItemEvent(item) {
 			const list = this.selectList;
 
@@ -898,26 +760,32 @@ export default {
 			this.rememberProduct()
 
 		},
-		/**
-			* 切换左侧商品类别
-			*/
+		//切换左侧商品类别
 		swichClass(cur) {
-			// clearInterval(this.timeFun)
-			console.log(cur,'---',this.filterProductInfo)
 			this.classIndex = cur;
 			this.filterProductInfo[cur].isActive = true;
-			if(cur==this.filterProductInfo.length-1){
-				this.filterProductInfo[cur-1].isActive = true;
+			if(cur == this.filterProductInfo.length-1){
+				if(this.filterProductInfo[cur-1]){
+					this.filterProductInfo[cur-1].isActive = true
+				}
 			}
-			if(cur!=0&&cur!=this.filterProductInfo.length-2){
-				this.filterProductInfo[cur-1].isActive = true;
-				this.filterProductInfo[cur+1].isActive = true;
-				if(this.filterProductInfo[cur+1].child.length<5&&cur<this.filterProductInfo.length-3){
-					this.filterProductInfo[cur+2].isActive = true;
+			if(cur !=0 && cur != this.filterProductInfo.length-2){
+				if(this.filterProductInfo[cur-1]){
+					this.filterProductInfo[cur-1].isActive = true
+				}
+				if(this.filterProductInfo[cur+1]){
+					this.filterProductInfo[cur+1].isActive = true
+				}
+				if(this.filterProductInfo[cur+1] && this.filterProductInfo[cur+1].child.length < 5 && cur < this.filterProductInfo.length-3){
+					if(this.filterProductInfo[cur+2]){
+						this.filterProductInfo[cur+2].isActive = true
+					}
 				}
 			}
 			this.scroll_into_view = '';
-			this.$nextTick(()=>{this.scroll_into_view = 'class_'+cur;})
+			this.$nextTick(()=>{
+				this.scroll_into_view = 'class_'+cur
+			})
 			// this.scrollPushList();
 			//解决最后一个 ***来回*** 问题 (由于点击左侧导航,右侧锚点位置信息变化,此时滚动事件也随之滚动。)
 			uni.setStorageSync("resolve","last");
@@ -925,14 +793,8 @@ export default {
 				uni.removeStorageSync("resolve")
 			},400);
 		},
-
-		/**
-			* 商品(多风格)-切换左侧商品类别
-			*/
+		//商品(多风格)-切换左侧商品类别
 		suitSwichClass(cur) {
-
-
-			// clearInterval(this.suitTimeFun)
 			this.suitClassIndex = cur;
 			this.suitFilterProductInfo[cur].isActive = true;
 			if(cur==this.suitFilterProductInfo.length-1){
@@ -952,18 +814,14 @@ export default {
 				uni.removeStorageSync("resolve")
 			},400);
 		},
-		/**
-			* 滚动商品监听
-			* **/
+		//滚动商品监听
 		suit_scroll_detail(options){
 			//options  为滚动信息。  options.detail.scrollTop  值为相对于scroll-view。
 			if(!uni.getStorageSync("resolve")){
 				this.suit_get_node_details(options);
 			};
 		},
-		/**
-			* 获取商品节点信息
-			* **/
+		//获取商品节点信息
 		suit_get_node_details(options){
 			const query = uni.createSelectorQuery().in(this); //获得实力
 			//获取多个节点方式
@@ -1002,13 +860,10 @@ export default {
 			this.suitFilterProductInfo[this.suitClassIndex].isActive = true;
 			// this.suitScrollPushList();
 		},
-		/**
-			* 搜索对应花材
-			*/
+		//搜索对应花材
 		suitSearchFn() {
 			let list = copyObject(this.suitFilterProductInfo);
 			if(!this.$util.isEmpty(this.py)){
-				clearInterval(this.suitTimeFun)
 				let commonChildList = [];
 				list.forEach(ele => {
 					//过滤常用
@@ -1050,7 +905,6 @@ export default {
 		searchFn() {
 			let list = copyObject(this.productInfo);
 			if(!this.$util.isEmpty(this.py)){
-
 				//大于等于2个字符才开始搜索 shish 20210622
 				if(this.py.length <=1){
 					return
@@ -1059,47 +913,71 @@ export default {
 				if(this.py.toLocaleLowerCase().indexOf('fs') == 0 && this.py.length <= 2){
 					return
 				}
+				if(this.py.indexOf('粉色') == 0 && this.py.length <= 2){
+					return
+				}
 				if(this.py.toLocaleLowerCase().indexOf('hs') == 0 && this.py.length <= 2){
 					return
 				}
+				if(this.py.indexOf('红色') == 0 && this.py.length <= 2){
+					return
+				}
+				if(this.py.indexOf('黄色') == 0 && this.py.length <= 2){
+					return
+				}
 				if(this.py.toLocaleLowerCase().indexOf('zs') == 0 && this.py.length <= 2){
 					return
 				}
+				if(this.py.indexOf('紫色') == 0 && this.py.length <= 2){
+					return
+				}
 				if(this.py.toLocaleLowerCase().indexOf('ls') == 0 && this.py.length <= 2){
 					return
 				}
+				if(this.py.indexOf('绿色') == 0 && this.py.length <= 2){
+					return
+				}
 				if(this.py.toLocaleLowerCase().indexOf('bs') == 0 && this.py.length <= 2){
 					return
 				}
-				clearInterval(this.timeFun)
+				if(this.py.indexOf('白色') == 0 && this.py.length <= 2){
+					return
+				}
+				if(this.py.toLocaleLowerCase().indexOf('cs') == 0 && this.py.length <= 2){
+					return
+				}
+				if(this.py.indexOf('橙色') == 0 && this.py.length <= 2){
+					return
+				}
+				if(this.py.indexOf('银色') == 0 && this.py.length <= 2){
+					return
+				}
 				let commonChildList = [];
 				list.forEach(ele => {
-					//过滤常用
-					if(ele.classId != -2){
-						if (!this.$util.isEmpty(ele.child)) {
-							ele.child.forEach(obj => {
-								//模糊搜索 shish 20210622
-								let hasName = obj.itemName && obj.itemName.indexOf(this.py) >= 0;
+					if (!this.$util.isEmpty(ele.child)) {
+						ele.child.forEach(obj => {
+							let hasName = obj.itemName && obj.itemName.indexOf(this.py) >= 0;
+							let hasPy = false
+							if(hasName == false){
 								let elePy = (obj.py && obj.py.toLocaleUpperCase()) || "";
-								let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0;
-								if (hasName || hasPy) {
-									if(this.$util.isEmpty(commonChildList)){
-										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,isActive:true,child:[obj]});
-											}
-										})
-									}
+								hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0;
+							}
+							if (hasName || hasPy) {
+								if(this.$util.isEmpty(commonChildList)){
+									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,isActive:true,child:[obj]});
+										}
+									})
 								}
-							});
-						}
-
+							}
+						});
 					}
-				});
+				})
 				list = this.$util.unique(commonChildList)
 				this.filterProductInfo = list;
 				this.classIndex = 0;

+ 1 - 1
hdApp/src/pages.json

@@ -380,7 +380,7 @@
 				{ "path": "xj", "style": { "navigationBarTitleText": "请选择颜色", "enablePullDownRefresh": true } },
 				{ "path": "refundDetail", "style": { "navigationBarTitleText": "退款详情", "enablePullDownRefresh": true } },
 				{ "path": "level", "style": { "navigationBarTitleText": "会员等级", "enablePullDownRefresh": true } },
-				{ "path": "bookProduct", "style": { "navigationBarTitleText": "预订花材", "enablePullDownRefresh": true } },
+				{ "path": "bookProduct", "style": { "navigationBarTitleText": "预订花材", "enablePullDownRefresh": false } },
 				{ "path": "bookExplain", "style": { "navigationBarTitleText": "预订说明", "enablePullDownRefresh": true } },
 				{ "path": "refundList","style": {"navigationBarTitleText": "退款记录", "enablePullDownRefresh": true } },
 				{ "path": "readMe","style": {"navigationBarTitleText": "购买须知", "enablePullDownRefresh": true } }

+ 14 - 25
hdApp/src/pagesPurchase/bookProduct.vue

@@ -12,7 +12,6 @@
 				<text @click="pageTo('/pagesPurchase/bookExplain?id='+ghsInfo.id)" style="margin-left:5upx;font-weight:bold;text-decoration:underline;color:red;">预订说明</text>
 			</view>
         </view>
-		<i class="iconfont icondianhua1" style="font-size:50upx;color:#6da3f5;position:absolute;top:45upx;" v-if="ghsInfo.mobile !=''" @tap="toPhone(ghsInfo.mobile)"></i>
       </view>
     </view>
 		<view class="input-wrap" >
@@ -27,17 +26,10 @@
 			</view>
 		</view>
 		<view class="scroll-middle_bx">
-			<scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop" >
+			<scroll-view scroll-y scroll-with-animation class="tab-view">
 				<div v-for="(item, index) in filterProductInfo" :key="index" class="tab-bar-item" :class="[classIndex == index ? 'active' : '']" :data-current="index" @tap.stop="swichClass(index)">
 					<text v-if="item.classId=='-1' || item.classId=='-3'" style="color: red">{{ item.className || "" }}</text>
 					<text v-else>{{ item.className }}</text>
-					<text class="tag" v-if=" getSelectClassById(item.classId).bigCount > 0 || getSelectClassById(item.classId).smallCount > 0">
-						<text v-if=" getSelectClassById(item.classId).bigCount > 0 || getSelectClassById(item.classId).smallCount > 0 ">
-							{{ `${getSelectClassById(item.classId).bigCount}` }}
-						</text>
-						<text v-if="getSelectClassById(item.classId).smallCount > 0"> / </text>
-						<text v-if="getSelectClassById(item.classId).smallCount > 0">{{ getSelectClassById(item.classId).smallCount }}</text>
-					</text>
 				</div>
 				<view style="height: 120upx"></view>
 			</scroll-view>
@@ -53,10 +45,8 @@
 							<view class="box" :id="`class_${classItem.classId}_${productItem.id}`" :key="productIndex">
 								<Commondity v-if="classItem.isActive"
 									:info="productItem"
-									:offVerifyRepertory="true"
 									:bigCount="getSelectItemById(productItem.id, classItem.classId).bigCount"
 									:smallCount="getSelectItemById(productItem.id, classItem.classId).smallCount"
-									:discount.sync="ghsInfo.giveDiscount"
 									@customNum="customNum"
 									@add="addEvent"
 									@addOneEvent="addCustomNumEvent"
@@ -69,7 +59,7 @@
 					</view>
 				</block>
 				<block v-else>
-					<app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(filterProductInfo)" />
+					<app-wrapper-empty title="加载中..." :is-empty="$util.isEmpty(filterProductInfo)" />
 				</block>
 
 			</scroll-view>
@@ -225,6 +215,7 @@ export default {
 			//每公斤服务费
 			kiloFee:0,
 			cartItemShow:false,
+			offVerifyRepertory:true
 		};
 	},
 	onPullDownRefresh() {
@@ -451,7 +442,7 @@ export default {
 					//获取供货商花材
 					if(id>0){
 						this.visitMall(id)
-						this.initGhsData(id,shopId)
+						this.initGhsData(id,shopId,1)
 						//不是新人或者已经下过单的或者活动没有开启不显示新人红包
 						if(this.ghsInfo.hasCg == 1 || this.ghsInfo.new == 0 || this.ghsInfo.xrFl == 0 || this.ghsInfo.sendNewGift == 1){
 							this.isNewCustom = false
@@ -462,11 +453,11 @@ export default {
 					}
 					this.option.id = res.data.id;
 					this.newCustomGift.xrFlAmount = res.data.xrFlAmount
-				}).catch(err => {})
+				})
 			} else {
 				this.ghsId = this.option.id
 				//获取供货商花材
-				this.initGhsData(id,shopId);
+				this.initGhsData(id,shopId,1)
 				getGhsDataApi({id: this.option.id}).then(res => {
 					this.ghsInfo = res.data
 					this.shopId = res.data.shopId
@@ -482,7 +473,7 @@ export default {
 					//预订单最低公斤数
 					this.miniKilo = res.data.miniKilo || 0
 					this.kiloFee = res.data.kiloFee || 0
-				}).catch(err => {})
+				})
 			}
 		},
 		visitMall(ghsId){
@@ -622,8 +613,7 @@ export default {
 			} else {
 				this.tabIndex = e.index;
 			}
-		},
-		scrollTop() {}
+		}
 	}
 };
 </script>
@@ -649,8 +639,8 @@ export default {
       padding: 30upx;
       box-sizing: border-box;
       &>image{
-        height: 130upx;
-        width: 130upx;
+        height: 110upx;
+        width: 110upx;
         display: inline-block;
         border-radius: 10upx;
         background-color: #eee;
@@ -660,13 +650,12 @@ export default {
         vertical-align: top;
         display: inline-block;
         height: 100%;
-        margin-left: 30upx;
+        margin-left: 20upx;
         &>.shop_title{
-          margin-top: 14upx;
-          font-size: 38upx;
+          font-size: 37upx;
           font-weight: 600;
           color: #060606;
-		  width: 500upx;
+		  width: 523upx;
 		  overflow: hidden;
 		  white-space: nowrap;
 		  .level{
@@ -691,7 +680,7 @@ export default {
 		  }
         }
         &>.shop_intro{
-          margin-top:25upx;
+          margin-top:18upx;
           font-size:32upx;
           font-weight:bold;
           color: #666666;

+ 16 - 158
hdApp/src/pagesPurchase/components/bookItem.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="item-cmd_bx" @click="customNum(info.variety)">
 		<view class="img_bx" style="background:#eeeeee" @click.stop="showBigImg">
-			<image :src="info.cover" lazy-load="true" :lazy-load-margin="0" v-if="isImg"></image>
+			<image :src="info.cover" lazy-load="true" :lazy-load-margin="0"></image>
 		</view>
 		<view class="cmd-info_bx">
 			<view class="tit" >
@@ -21,32 +21,22 @@
 				</view>
 				<view style="text-align: right" >
 					<view class="open-bx" >
-						<i class="iconfont iconjian" :class="delAnimationData?'animation':''" @click.stop="delEvent(info.variety)" v-if="bigCount > 0 || smallCount > 0"></i>
+						<i class="iconfont iconjian" @click.stop="delEvent(info.variety)" v-if="bigCount > 0 || smallCount > 0"></i>
 						<text class="num">
 							<text v-if="bigCount > 0" style="font-weight:bold;color:#3385ff;">{{ `${bigCount}` }}</text>
 							<text v-if="smallCount > 0" >{{ `${smallCount}` }}</text>
 						</text>
-						<i class="iconfont iconzeng" :class="addAnimationData?'animation':''" @click.stop="addEvents(info.variety)"></i>
+						<i class="iconfont iconzeng" @click.stop="addEvents(info.variety)"></i>
 					</view>
 				</view>
 			</view>
 		</view>
 	</view>
 </template>
-
 <script>
-import { COMMODITY_TYPE } from "@/utils/declare";
-import AppImg from "@/components/app-img";
-import { changePriceByIdApi } from '@/api/product/index'
-import animationMins from "@/mixins/animation";
-import allSelectInput from "@/components/module/allSelectInput";
-import allSelectInputMins from "@/mixins/allSelectInput";
 export default {
-	name: "Commodity",
-	components: {
-		AppImg,allSelectInput
-	},
-	mixins: [animationMins,allSelectInputMins],
+	name: "bookItem",
+	mixins: [],
 	props: {
 		info: {
 			required: true,
@@ -55,148 +45,47 @@ export default {
 				return {};
 			}
 		},
-		type: {
-			type: String,
-			default: COMMODITY_TYPE.COMMON
-		},
 		bigCount: {
 			type: Number,
 			default: 0
 		},
-		scrollTop: {
-			type: Number,
-			default: 0
-		},
 		smallCount: {
 			type: Number,
 			default: 0
-		},
-		discount:{
-			type: Number,
-			default: 1
-		},
-		showStock:{
-			type: Number,
-			default: 0
-		},
-		autoPrice: {},
-		offPrice: {
-			type: Boolean,
-			default: false
-		},
-		offVerifyRepertory: {
-			type: Boolean,
-			default: false
-		},
+		}
 	},
 	data() {
 		return {
-			COMMODITY_TYPE,
-			isImg:false,
-			isAlterMoney:false,
-			isAloneAllActive: false,
-			isAloneAllFocus: false,
-			isShowSucceed:false,
-			changeAutoPrice:'',
-			showPrice:0.00,
-			ifFocus:false,
-			showMaxStock:230,//囤货时显示的最大库存
 		};
 	},
-	created() {},
-	mounted() {
-		setTimeout(()=>{
-			this.isImg = true;
-		},100)
-		if(this.info.priceLabel == 2){
-			this.changeAutoPrice = this.info.price
-		}
-		this.showPrice = this.info.price;
-	},
 	methods: {
-		//input点击删除按键
-		deleteInputVal(){
-			this.isAloneAllActive=false;
-			this.changeAutoPrice = '';
-		},
-		//离开input
-		moveAllInput(e){
-			this.isAloneAllActive=false;
-			this.isAloneAllFocus=false;
-			// if(e==''){return}
-			this.changeAutoPrice = e?e:0;
-			if(this.isAlterMoney){
-				this.isAlterMoney = false;
-				// let self = this
-				changePriceByIdApi({
-					productId: this.info.id,
-					price: this.changeAutoPrice
-				}).then(res => {
-					if(res.code == 1){
-						this.showPrice = res.data.price
-						this.isShowSucceed = true
-						setTimeout(()=>{
-							this.isShowSucceed = false
-						},1000)
-					}else{
-						this.$msg(res.msg)
-					}
-				})
-			}
-		},
 		showBigImg(){
 			this.$emit("showBigCover", this.info);
 		},
 		addEvents(variety) {
-			const ratio = Number(this.info.ratio);
-			if(this.offVerifyRepertory){
-				if(this.info.stock<=0){
-					uni.showToast({title:'没有货了',icon:'none'})
-					return
-				}
-				if (Number(this.bigCount) * ratio + Number(this.smallCount) >Number(this.info.bigNum) * ratio + Number(this.info.smallNum)) {
-					this.$msg("库存只剩"+this.info.bigNum);
-					return
-				}
-			}
-			this.animationFun('add');
 			this.$emit("add", this.info);
 		},
 		delEvent(variety) {
-			this.animationFun('del');
-			console.log(this.info,'this.info')
 			this.$emit("del", this.info);
 		},
-		changePriceEvent(event) {
-			this.isFocus = false;
-			this.isAlterMoney = true;
-
-		},
 		customNum(variety) {
-			
-				if(this.info.stock<=0){
-					uni.showToast({title:'没有货了',icon:'none'})
-					return
-				}
-				if(!this.bigCount && !this.smallCount){
-					let params = {
-						...this.info,
-						bigCount: this.bigCount,
-						smallCount: this.smallCount
-					};
-					this.$emit("addOneEvent", this.info,params);
-				}
-				this.$emit("customNum", {
+			if(!this.bigCount && !this.smallCount){
+				let params = {
 					...this.info,
 					bigCount: this.bigCount,
 					smallCount: this.smallCount
-				});
-			
+				};
+				this.$emit("addOneEvent", this.info,params);
+			}
+			this.$emit("customNum", {
+				...this.info,
+				bigCount: this.bigCount,
+				smallCount: this.smallCount
+			});
 		}
 	}
 };
 </script>
-
 <style lang="scss" scoped>
 .item-cmd_bx {
 	position: relative;
@@ -251,18 +140,6 @@ export default {
 					color: #3385ff;
 					font-size: 55upx;
 				}
-				.position{
-					display: block;
-					width: 70upx;
-					text-align: center;
-				}
-				.iconcachu {
-					margin: 0 6upx 0 20upx;
-					color: #ccc;
-					&.edit {
-						color: #3385ff;
-					}
-				}
 				& > .num {
 					display: inline-block;
 					width: 100upx;
@@ -275,25 +152,6 @@ export default {
 					background-color: #f5f5f5;
 					font-size: 24upx;
 				}
-				.change-input {
-					width: 164upx;
-					height: 60upx;
-					line-height: 60upx;
-					text-align: center;
-					background: #ffffff;
-					border: 1px solid #dddddd;
-					border-radius: 4upx;
-					font-size: 25upx;
-				}
-				.btn-box{
-					width: 100upx;
-					height: 60upx;
-					line-height: 60upx;
-					color: #ffffff;
-					background: #3385ff;
-					text-align: center;
-					border-radius: 10upx;
-				}
 			}
 		}
 	}

+ 9 - 126
hdApp/src/pagesPurchase/components/item.vue

@@ -1,15 +1,16 @@
 <template>
 	<view class="item-cmd_bx" @click="customNum(info.variety)">
 		<view class="img_bx" style="background:#eeeeee" @click.stop="showBigImg">
-			<image :src="info.cover" lazy-load="true" :lazy-load-margin="0" v-if="isImg"></image>
+			<image :src="info.cover" lazy-load="true" :lazy-load-margin="0"></image>
 		</view>
 		<view class="cmd-info_bx">
 			<view class="tit" >
-				<text style="font-size:22upx;border:1upx solid #3385ff;color:white;background-color:#3385ff;margin-right:5upx;padding-left:5upx;padding-right:5upx;" v-if="info.presell == 1">预售</text>
+				<text style="font-size:22upx;border:1upx solid #3385ff;color:white;background-color:#3385ff;margin-right:5upx;padding-left:5upx;padding-right:5upx;" 
+				v-if="info.presell == 1">预售</text>
 				{{ info.itemName}}
 			</view>
 			<view class="kc num-open_bx flex-space">
-				<view v-if="!offPrice">
+				<view>
 					<view class="flex-space" v-if="Number(info.discountPrice)>0" style="position:absolute;top:14upx;">
 						<view style="padding:2upx 10upx 5upx 10upx;text-align: center;color: red;border: 1px solid red;margin-right: 20upx;line-height: 1;font-size: 20upx">
 							{{parseFloat(((Number(info.discountPrice)/Number(info.prePrice)).toFixed(2)*10).toFixed(1))+'折'}}
@@ -26,15 +27,14 @@
 					</view>
 					<view class="price" >¥{{ parseFloat(info.price) }}</view>
 				</view>
-				<view class="price" v-else></view>
 				<view style="text-align: right" >
 					<view class="open-bx" >
-						<i class="iconfont iconjian" :class="delAnimationData?'animation':''" @click.stop="delEvent(info.variety)" v-if="bigCount > 0 || smallCount > 0"></i>
+						<i class="iconfont iconjian" @click.stop="delEvent(info.variety)" v-if="bigCount > 0 || smallCount > 0"></i>
 						<text class="num">
 							<text v-if="bigCount > 0" style="font-weight:bold;color:#3385ff;">{{ `${bigCount}` }}</text>
 							<text v-if="smallCount > 0" >{{ `${smallCount}` }}</text>
 						</text>
-						<i class="iconfont iconzeng" :class="addAnimationData?'animation':''" @click.stop="addEvents(info.variety)"></i>
+						<i class="iconfont iconzeng" @click.stop="addEvents(info.variety)"></i>
 					</view>
 					<template v-if="showStock && showStock == 1">
 						<text v-if="Number(info.stock) > Number(info.stockWarning)" style="color:#333;margin-right:65upx;">还剩 {{ parseFloat(info.stock) }}</text>
@@ -47,18 +47,9 @@
 </template>
 
 <script>
-import { COMMODITY_TYPE } from "@/utils/declare";
-import AppImg from "@/components/app-img";
-import { changePriceByIdApi } from '@/api/product/index'
-import animationMins from "@/mixins/animation";
-import allSelectInput from "@/components/module/allSelectInput";
-import allSelectInputMins from "@/mixins/allSelectInput";
 export default {
-	name: "Commodity",
-	components: {
-		AppImg,allSelectInput
-	},
-	mixins: [animationMins,allSelectInputMins],
+	name: "item",
+	mixins: [],
 	props: {
 		info: {
 			required: true,
@@ -67,95 +58,27 @@ export default {
 				return {};
 			}
 		},
-		type: {
-			type: String,
-			default: COMMODITY_TYPE.COMMON
-		},
 		bigCount: {
 			type: Number,
 			default: 0
 		},
-		scrollTop: {
-			type: Number,
-			default: 0
-		},
 		smallCount: {
 			type: Number,
 			default: 0
 		},
-		discount:{
-			type: Number,
-			default: 1
-		},
 		showStock:{
 			type: Number,
 			default: 0
 		},
-		autoPrice: {},
-		offPrice: {
-			type: Boolean,
-			default: false
-		},
 		offVerifyRepertory: {
 			type: Boolean,
 			default: false
 		},
 	},
 	data() {
-		return {
-			COMMODITY_TYPE,
-			isImg:false,
-			isAlterMoney:false,
-			isAloneAllActive: false,
-			isAloneAllFocus: false,
-			isShowSucceed:false,
-			changeAutoPrice:'',
-			showPrice:0.00,
-			ifFocus:false,
-			showMaxStock:230,//囤货时显示的最大库存
-		};
-	},
-	created() {},
-	mounted() {
-		setTimeout(()=>{
-			this.isImg = true;
-		},100)
-		if(this.info.priceLabel == 2){
-			this.changeAutoPrice = this.info.price
-		}
-		this.showPrice = this.info.price;
+		return {}
 	},
 	methods: {
-		//input点击删除按键
-		deleteInputVal(){
-			this.isAloneAllActive=false;
-			this.changeAutoPrice = '';
-		},
-		//离开input
-		moveAllInput(e){
-			this.isAloneAllActive=false;
-			this.isAloneAllFocus=false;
-			// if(e==''){return}
-			this.changeAutoPrice = e?e:0;
-			if(this.isAlterMoney){
-				this.isAlterMoney = false;
-				// let self = this
-				changePriceByIdApi({
-					productId: this.info.id,
-					price: this.changeAutoPrice
-				}).then(res => {
-					if(res.code == 1){
-						this.showPrice = res.data.price
-						this.isShowSucceed = true
-						setTimeout(()=>{
-							this.isShowSucceed = false
-						},1000)
-					}else{
-						this.$msg(res.msg)
-					}
-				})
-			}
-		},
 		showBigImg(){
 			this.$emit("showBigCover", this.info);
 		},
@@ -172,7 +95,6 @@ export default {
 						return
 					}
 				}
-				this.animationFun('add');
 				this.$emit("add", this.info);
 			}else{
 				//去特殊品种页
@@ -181,19 +103,12 @@ export default {
 		},
 		delEvent(variety) {
 			if(variety == 0){
-				this.animationFun('del');
-				console.log(this.info,'this.info')
 				this.$emit("del", this.info);
 			}else{
 				//去特殊品种页
 				this.$emit("goToSpecialVariety", this.info);
 			}
 		},
-		changePriceEvent(event) {
-			this.isFocus = false;
-			this.isAlterMoney = true;
-
-		},
 		customNum(variety) {
 			if(variety == 0){
 				if(this.info.stock<=0){
@@ -221,7 +136,6 @@ export default {
 	}
 };
 </script>
-
 <style lang="scss" scoped>
 .item-cmd_bx {
 	position: relative;
@@ -276,18 +190,6 @@ export default {
 					color: #3385ff;
 					font-size: 55upx;
 				}
-				.position{
-					display: block;
-					width: 70upx;
-					text-align: center;
-				}
-				.iconcachu {
-					margin: 0 6upx 0 20upx;
-					color: #ccc;
-					&.edit {
-						color: #3385ff;
-					}
-				}
 				& > .num {
 					display: inline-block;
 					width: 100upx;
@@ -300,25 +202,6 @@ export default {
 					background-color: #f5f5f5;
 					font-size: 24upx;
 				}
-				.change-input {
-					width: 164upx;
-					height: 60upx;
-					line-height: 60upx;
-					text-align: center;
-					background: #ffffff;
-					border: 1px solid #dddddd;
-					border-radius: 4upx;
-					font-size: 25upx;
-				}
-				.btn-box{
-					width: 100upx;
-					height: 60upx;
-					line-height: 60upx;
-					color: #ffffff;
-					background: #3385ff;
-					text-align: center;
-					border-radius: 10upx;
-				}
 			}
 		}
 	}

+ 8 - 22
hdApp/src/pagesPurchase/ghsProduct.vue

@@ -7,7 +7,6 @@
 				<view class="shop_info">
 					<view class="shop_title" @click="pageTo({url:'/pagesPurchase/level?id='+ghsInfo.id})"> {{ghsInfo.name}} </view>
 				</view>
-				<!-- <i class="iconfont icondianhua1" style="font-size:55upx;color:#6da3f5;position:absolute;top:20upx;right:50upx;" v-if="ghsInfo.mobile !=''" @tap="toPhone(ghsInfo.mobile)"></i> -->
 			</view>
 			<view>
 			<image v-if="buyNotice == 1" :src="`${constant.imgUrl}/cg/buy_look2.png`" @click.stop="getReadMe()" style="border-radius:10upx;margin-top:9upx;" mode="widthFix"></image>
@@ -27,17 +26,10 @@
 		</view>
 
 		<view class="scroll-middle_bx">
-			<scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop" >
+			<scroll-view scroll-y scroll-with-animation class="tab-view">
 				<div v-for="(item, index) in filterProductInfo" :key="index" class="tab-bar-item" :class="[classIndex == index ? 'active' : '']" :data-current="index" @tap.stop="swichClass(index)">
 					<text v-if="item.classId=='-1' || item.classId=='-3'" style="color: red;font-weight:bold;">{{ item.className || "" }}</text>
 					<text v-else>{{ item.className }}</text>
-					<text class="tag" v-if=" getSelectClassById(item.classId).bigCount > 0 || getSelectClassById(item.classId).smallCount > 0">
-						<text v-if=" getSelectClassById(item.classId).bigCount > 0 || getSelectClassById(item.classId).smallCount > 0 ">
-							{{ `${getSelectClassById(item.classId).bigCount}` }}
-						</text>
-						<text v-if="getSelectClassById(item.classId).smallCount > 0"> / </text>
-						<text v-if="getSelectClassById(item.classId).smallCount > 0">{{ getSelectClassById(item.classId).smallCount }}</text>
-					</text>
 				</div>
 				<view style="height: 120upx"></view>
 			</scroll-view>
@@ -45,7 +37,7 @@
 																@scroll="scroll_detail"
 																lower-threshold="100"
 																@scrolltolower="scroll_bottom">
-				<!--内容部分 start -->
+
 				<block v-if="!$util.isEmpty(filterProductInfo)">
 					<view class="item_list_bx selectAll" v-for="(classItem, classIndex) in filterProductInfo" :key="classIndex" :id="`class_${classIndex}`">
 						<view class="item_list_title">{{ classItem.className }}</view>
@@ -79,12 +71,8 @@
 					</view>
 				</block>
 				<block v-else>
-					<app-wrapper-empty
-						title="暂无数据"
-						:is-empty="$util.isEmpty(filterProductInfo)"
-					/>
+					<app-wrapper-empty title="加载中..." :is-empty="$util.isEmpty(filterProductInfo)" />
 				</block>
-				<!--内容部分 end -->
 			</scroll-view>
 		</view>
 		
@@ -93,8 +81,7 @@
 				<view class="select-cmd_bx" v-if="customData">
 					<view class="kc">
 						<text v-if="ghsInfo.showStock && ghsInfo.showStock==1">
-						{{customData.stock?parseFloat(customData.stock):0}}
-						{{customData.bigUnit}}
+						{{customData.stock?parseFloat(customData.stock):0}}{{customData.bigUnit}}
 						</text>
 					</view>
 					<view class="num_bx">
@@ -373,7 +360,7 @@ export default {
 		},
 		aheadCg(item){
 			const { id } = item
-			this.pageTo({url: '/pagesPurchase/bookProduct?id='+id})
+			this.pageTo({url: '/pagesPurchase/bookProduct?id='+id,type:2})
 		},
 		delMemory(){
 			this.cartItemShow = false
@@ -514,7 +501,7 @@ export default {
 					//获取供货商花材
 					if(id>0){
 						this.visitMall(id)
-						this.initGhsData(id,shopId)
+						this.initGhsData(id,shopId,0)
 						//不是新人或者已经下过单的或者活动没有开启不显示新人红包
 						if(this.ghsInfo.hasCg == 1 || this.ghsInfo.new == 0 || this.ghsInfo.xrFl == 0 || this.ghsInfo.sendNewGift == 1){
 							this.isNewCustom = false
@@ -530,7 +517,7 @@ export default {
 			} else {
 				this.ghsId = this.option.id
 				//获取供货商花材
-				this.initGhsData(id,shopId);
+				this.initGhsData(id,shopId,0);
 				getGhsDataApi({id: this.option.id}).then(res => {
 					this.ghsInfo = res.data
 					this.shopId = res.data.shopId
@@ -716,8 +703,7 @@ export default {
 			} else {
 				this.tabIndex = e.index;
 			}
-		},
-		scrollTop() {}
+		}
 	}
 };
 </script>