Преглед изворни кода

供货商所有花材列表优化

jf пре 5 година
родитељ
комит
bf8995f923

+ 9 - 13
ghsApp/src/admin/billing/index.vue

@@ -1,11 +1,11 @@
 <template>
 	<view class="billing_box_bg">
 		<view class="input-wrap" >
-			<app-search-module v-model="py" placeholder="请输入关键词,支持拼音首字母搜索" @search="searchFn" />
+			<app-search-module v-model="py" placeholder="请输入关键词,支持拼音首字母搜索" @input="searchFn" />
 		</view>
 		<view class="scroll-middle_bx">
 			<scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop" >
-				<div v-for="(item, index) in filterProductInfo" :key="index" class="tab-bar-item" :class="[classIndex == index ? 'active' : '']" :data-current="index" @tap.stop="swichClass">
+				<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>{{ 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 ">
@@ -19,23 +19,18 @@
 				<view class="switchover-unit" @tap="isSmallCount = !isSmallCount">{{isSmallCount?'支':'扎'}}</view>
 			</scroll-view>
 
-			<scroll-view scroll-y class="right-box" :scroll-into-view="scrollClassId">
+			<scroll-view scroll-y class="right-box" :scroll-into-view="scroll_into_view" scroll-with-animation="true"
+																@scroll="scroll_detail"
+																lower-threshold="100"
+																@scrolltolower="scroll_bottom">
 				<!--内容部分 start -->
 				<block v-if="!$util.isEmpty(filterProductInfo)">
-					<view
-						class="item_list_bx"
-						v-for="(classItem, classIndex) in filterProductInfo"
-						:key="classIndex"
-						:id="`class_${classItem.classId}`"
-					>
+					<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>
 						<template v-for="(productItem, productIndex) in classItem.child">
-							<view
-								:id="`class_${classItem.classId}_${productItem.id}`"
-								:key="productIndex"
-							>
+							<view :id="`class_${classItem.classId}_${productItem.id}`" :key="productIndex">
 								<Commondity
 									:info="productItem"
 									:bigCount="
@@ -302,6 +297,7 @@ export default {
 	}
 	.item_list_bx {
 		padding: 40px 16px;
+		//padding: 0 16px;
     &:last-child{
       margin-bottom: 70upx;
     }

+ 30 - 16
ghsApp/src/components/module/app-commodity.vue

@@ -8,20 +8,27 @@
 		</view>
 		<view class="cmd-info_bx">
 			<view class="tit" @click="addEvents">{{ info.itemName || "" }}</view>
-			<view class="kc" @click="addEvents">库存 {{ info.stock }}</view>
-			<view class="num-open_bx">
-				<view class="price" v-if="!offPrice">¥{{ showPrice }}</view>
+			<view class="kc num-open_bx flex-end" v-if="type == COMMODITY_TYPE.COMMON">
+				<view class="price" v-if="!offPrice">¥{{ info.price }}</view>
 				<view class="price" v-else></view>
-				<view class="open-bx" v-if="type == COMMODITY_TYPE.COMMON">
-					<i class="iconfont iconjian" :class="delAnimationData?'animation':''" @click="delEvent" v-if="bigCount > 0 || smallCount > 0"></i>
-					<text class="num" @click="customNum">
-						<text v-if="bigCount > 0 || smallCount > 0">{{ `${bigCount}` }}</text>
-						<text v-if="smallCount > 0">/</text>
-						<text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
-					</text>
-					<i class="iconfont iconzeng" :class="addAnimationData?'animation':''" @click="addEvents"></i>
+				<view style="text-align: right" >
+					<view class="open-bx" >
+						<i class="iconfont iconjian" :class="delAnimationData?'animation':''" @click="delEvent" v-if="bigCount > 0 || smallCount > 0"></i>
+						<text class="num" @click="customNum">
+							<text v-if="bigCount > 0 || smallCount > 0">{{ `${bigCount}` }}</text>
+							<text v-if="smallCount > 0">/</text>
+							<text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
+						</text>
+						<i class="iconfont iconzeng" :class="addAnimationData?'animation':''" @click="addEvents"></i>
+					</view>
+					<text style="padding-right: 55rpx">库存 {{ info.stock }}</text>
 				</view>
-				<view class="open-bx" v-else-if="type == COMMODITY_TYPE.CHANGE">
+			</view>
+			<view class="num-open_bx flex-space" v-if="type == COMMODITY_TYPE.CHANGE">
+				<view class="price" v-if="!offPrice">¥{{ showPrice }}</view>
+				<view class="price" v-else></view>
+
+				<view class="open-bx" style="padding-bottom: 40rpx" >
 					<allSelectInput :inputType="'digit'" :isActive="isAloneAllActive" :isFocus="isAloneAllFocus" :value="changeAutoPrice" :placeholder="'自动调价'"
 						@deleteInputVal="deleteInputVal" @initAllInput="initAloneAllInput" @moveAllInput="moveAllInput">
 					</allSelectInput>
@@ -179,8 +186,8 @@ export default {
 	position: relative;
 	margin-bottom: 20px;
 	.img_bx {
-		height: 160px;
-		width: 160px;
+		height: 140px;
+		width: 140px;
 		position: absolute;
 		left: 0px;
 		top: 0px;
@@ -190,7 +197,8 @@ export default {
 		}
 	}
 	.cmd-info_bx {
-		padding-left: 177px;
+		padding-left: 160px;
+		padding-bottom: 20rpx;
 		& .tit {
 			font-size: 28px;
 			font-weight: 400;
@@ -198,9 +206,15 @@ export default {
 			padding-top: 10px;
 		}
 		& .kc {
+			position: relative;
 			color: #999999;
 			font-size: 24px;
-			padding: 8px 0 24px;
+			.price{
+				position: absolute;
+				left: 0;
+				bottom: 0;
+			}
+			//padding: 8px 0 24px;
 		}
 		& .num-open_bx {
 			display: flex;

+ 5 - 3
ghsApp/src/components/module/app-search.vue

@@ -1,12 +1,12 @@
 <template>
 	<div class="app-search-module" :style="{ height: height + 'rpx' }">
-		<div class="map-search" :style="{ backgroundColor: backColor }">
+		<div class="map-search" :style="{ backgroundColor: backColor }" style="height: 100rpx">
 			<div class="icon-wrap" v-if="isIcon">
 				<i class="iconfont" :class="[icon]"></i>
 			</div>
 			<div class="input-wrap">
 				<input
-					type="text"
+					type="text" placeholder-style="color:#ccc"
 					ref="searchInput"
 					v-model="search"
 					:focus="focus"
@@ -132,9 +132,11 @@ export default {
 		}
 		.input-wrap {
 			width: calc(100% - 90px);
+			height: 80rpx;
 			margin-left: 14px;
 			input {
-				font-size: 26px;
+				height: 100%;
+				font-size: 30px !important;
 				text-align: left;
 			}
 			.placeholder {

+ 147 - 32
ghsApp/src/mixins/product.js

@@ -11,7 +11,14 @@ export default {
 			py: "", //拼音搜索条件
 			type: "", //库存预警时,固定为waring,其他情况不传或者传空
 			autoLoad: true, //自动获取商品信息
-			isLimit: true //选择数量不能大于库存限制
+			isLimit: true, //选择数量不能大于库存限制
+			allFilterProductInfo:'',
+			filterProductInfo:'',
+			top_list:'',
+			//id动态切换
+			scroll_into_view:"",
+			timeFun:"",
+
 		};
 	},
 	onLoad(options) {
@@ -30,7 +37,7 @@ export default {
 	onUnload() {},
 	computed: {
 		...mapGetters(["getSelectInfo"]),
-		filterProductInfo() {
+		filterProductInfoxxxxx() {
 			let list = copyObject(this.productInfo);
 			if (this.py) {
 				let commonChildList = [];
@@ -64,28 +71,6 @@ export default {
 				this.suitClassIndex = 0;
 			}
 			return list;
-			// if (this.py) {
-			// 	let commonList = list.find(ele => {
-			// 		//在常用中过滤
-			// 		return ele.classId != -2;
-			// 	});
-			// 	if (commonList) {
-			// 		let commonChildList = [];
-			// 		if (!this.$util.isEmpty(commonList.child)) {
-			// 			commonList.child.forEach(ele => {
-			// 				let hasName = ele.itemName && ele.itemName.indexOf(this.py) >= 0;
-			// 				let elePy = (ele.py && ele.py.toLocaleUpperCase()) || "";
-			// 				let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0;
-			// 				if (hasName || hasPy) {
-			// 					commonChildList.push(ele);
-			// 				}
-			// 			});
-			// 		}
-			// 		commonList.child = commonChildList;
-			// 		list = [commonList];
-			// 	}
-			// }
-			// return list;
 		},
 		/**
 		 * 当前页面选中的商品列表
@@ -184,7 +169,7 @@ export default {
 			//extendInfo调用时的扩展参数  如  shopId
 			try {
 				let params = {
-					py: this.py,
+					// py: this.py,
 					type: this.type
 				};
 				if (extendInfo) {
@@ -200,10 +185,49 @@ export default {
 				});
 				this.productInfo = data;
 				this.classIndex = 0;
+				this.scrollPushList();
+				// console.log(this.filterProductInfo)
 			} catch (error) {
 			} finally {
 				uni.hideLoading();
 			}
+		},
+		/**
+			* 滚动或切换分类 获取更多数据
+			* **/
+		scrollPushList(){
+			let list = copyObject(this.productInfo);
+
+			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;
+					}
+				}
+			}
+
+
+
 		},
 		/**
 		 * 通过id获取当前选中的该商品信息
@@ -544,17 +568,108 @@ export default {
 		/**
 		 * 切换左侧商品类别
 		 */
-		swichClass(e) {
-			let cur = e.currentTarget.dataset.current;
-			if (this.classIndex == cur) {
-				return false;
-			} else {
+		swichClass(cur) {
+			// let cur = e.currentTarget.dataset.current;
+			// if (this.classIndex == cur) {
+			// 	return false;
+			// } else {}
 				this.classIndex = cur;
+			this.scroll_into_view = 'class_'+cur;
+				this.scrollPushList();
+				//解决最后一个 ***来回*** 问题 (由于点击左侧导航,右侧锚点位置信息变化,此时滚动事件也随之滚动。)
+				uni.setStorageSync("resolve","last");
+				setTimeout(()=>{
+					uni.removeStorageSync("resolve")
+				},400);
+			// }
+		},
+		/**
+			* 滚动商品监听
+			* **/
+		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);
+				});
+				this.async_detail_msg(options);
+			}).exec();
+		},
+		async_detail_msg(options){
+			//options  为滚动信息。  options.detail.scrollTop  值为相对于scroll-view。
+			let top_page = options.detail.scrollTop + this.top_list[0];
+
+			for(let i = 0;i < this.top_list.length; i++){
+				let node1 = this.top_list[i];
+				let node2 = this.top_list[i+1];
+				if(node2 && top_page >= node1 && top_page < node2){
+					this.classIndex = i;
+					this.scrollPushList();
+					break;
+				}else if(node2 && top_page === node2){
+					this.classIndex = i + 1;
+					this.scrollPushList();
+					break;
+				}
 			}
 		},
+		scroll_bottom(){
+			this.classIndex = this.filterProductInfo.length-1
+			this.scrollPushList();
+		},
 		/**
 		 * 搜索对应花材
 		 */
-		searchFn() {}
+		searchFn() {
+			let list = copyObject(this.productInfo);
+			if(!this.$util.isEmpty(this.py)){
+				clearInterval(this.timeFun)
+				let commonChildList = [];
+				list.forEach(ele => {
+					//过滤常用
+					if(ele.classId != -2){
+						if (!this.$util.isEmpty(ele.child)) {
+							ele.child.forEach(obj => {
+								let hasName = obj.itemName && obj.itemName.indexOf(this.py) >= 0;
+								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,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]});
+											}
+										})
+									}
+								}
+							});
+						}
+
+					}
+				});
+				list = this.$util.unique(commonChildList)
+				this.filterProductInfo = list;
+				this.classIndex = 0;
+			}else{
+				this.filterProductInfo = '';
+				this.classIndex = 0;
+				this.scrollPushList();
+			}
+		}
 	}
-};
+}

+ 47 - 358
ghsApp/src/mixins/productContrapose.js

@@ -1,5 +1,6 @@
 // import { getProductDataApi } from "@/api/product/index";
 import { getProductDataApi,getAllProductDataApi } from "@/api/product/index";
+import { STOCK_TYPE } from "@/utils/declare";
 import { mapGetters, mapActions } from "vuex";
 import { copyObject } from "@/utils/util";
 export default {
@@ -12,7 +13,10 @@ export default {
 			py: "", //拼音搜索条件
 			type: "", //库存预警时,固定为waring,其他情况不传或者传空
 			autoLoad: true, //自动获取商品信息
-			isLimit: true //选择数量不能大于库存限制
+			isLimit: true, //选择数量不能大于库存限制
+			filterProductInfoContrapose:[],
+			allFilterProductInfoContrapose:[],
+			isMore:true,
 		};
 	},
 	onLoad(options) {
@@ -27,387 +31,72 @@ export default {
 	},
 	onUnload() {},
 	computed: {
-		...mapGetters(["getSelectInfo"]),
-		filterProductInfoContrapose() {
-			let list = copyObject(this.productInfo);
-			if (this.py) {
-				let commonList = list;
-				if (commonList) {
-					let commonChildList = [];
-					if (!this.$util.isEmpty(commonList)) {
-						commonList.forEach(ele => {
-							let hasName = ele.itemName && ele.itemName.indexOf(this.py) >= 0;
-							let elePy = (ele.py && ele.py.toLocaleUpperCase()) || "";
-							let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0;
-							if (hasName || hasPy) {
-								commonChildList.push(ele);
-							}
-						});
-					}
-					commonList = commonChildList;
-					list = commonList
-				}
-			}
-			return list;
-		},
-		/**
-		 * 当前页面选中的商品列表
-		 */
-		selectList() {
-			// console.log('this.getSelectInfo',this.getSelectInfo)
-			// console.log('this.pageType',this.pageType)
-			// console.log('this.getSelectInfo[this.pageType]',this.getSelectInfo[this.pageType])
-			return this.getSelectInfo[this.pageType] || [];
-		},
-		scrollClassId() {
-			const curClass = this.productInfo[this.classIndex];
-			if (curClass) {
-				return `class_${curClass.classId}`;
-			}
-
-			return "";
-		},
-		//选择商品总价
-		allPrice() {
-			let price = 0;
-
-			if (this.selectList) {
-				for (const item of this.selectList) {
-					const itemInfo = this.getSelectItemById(item.id, item.classId);
-					if (
-						itemInfo &&
-						!this.$util.isEmpty(itemInfo.bigPrice) &&
-						!this.$util.isEmpty(itemInfo.smallPrice)
-					) {
-						price += item.bigCount * Number(itemInfo.bigPrice);
-						price += item.smallCount * Number(itemInfo.smallPrice);
-					}
-				}
-			}
-
-			return Math.round(price * 100) / 100;
-		},
-		//选择商品总数
-		allCount() {
-			let bigLength = 0;
-			let smallLength = 0;
-			if (this.selectList) {
-				for (const item of this.selectList) {
-					bigLength += item.bigCount
-					smallLength += item.smallCount
-				}
-			}
-			return {bigLength:bigLength,smallLength:smallLength,};
-			// return this.selectList.length;
-		},
-		/**
-		 * 当前选中商品列表中是否有没有库存的商品
-		 */
-		hasNoStock() {
-			let has = false;
-			if (this.selectList) {
-				for (const item of this.selectList) {
-					const {
-						bigCount,
-						smallCount,
-						bigNum,
-						bigUnit,
-						smallNum,
-						smallUnit,
-						ratio
-					} = item;
-					const ratioNum = Number(ratio);
-					if (
-						Number(bigCount) * ratioNum + Number(smallCount) >
-						Number(bigNum) * ratioNum + Number(smallNum)
-					) {
-						has = true;
-						break;
-					}
-				}
-			}
-			return has;
-		}
+		...mapGetters(["getSelectInfo","getMyShopInfo"]),
 	},
 	methods: {
 		...mapActions(["setSelectInfoByType", "resetSelectInfoByType"]),
 		/**
 		 * 请求商品数据
 		 */
+		loadMore(){
+			if(this.isMore){
+				this.page++;
+				let type = this.tabs[this.tabIndex].key == STOCK_TYPE.WARN ? "waring" : "";
+				if(type=="waring"){
+					this.initDataContrapose({ type,shopId: this.shopId});
+				}
+			}
+
+		},
+		// async initDataContrapose(extendInfo) {
 		async initDataContrapose(extendInfo) {
 			//extendInfo调用时的扩展参数  如  shopId
-			try {
 				let params = {
 					py: this.py,
-					type: this.type?this.type:''
+					type: this.type,
+					showPage: 1,
+					page: this.page,
 				};
-				if (extendInfo) {
-					params = { ...params, ...extendInfo };
-				}
-				// const { data } = await getProductDataApi(params);
+			if (extendInfo) {
+				params = { ...params, ...extendInfo };
+			}
 				const { data } = await getAllProductDataApi(params);
-				// data.forEach(element => {
-				// 	element.child && element.child.forEach(child => {
-				// 			child.classId = element.classId;
-				// 			child.className = element.className;
-				// 		});
-				// });
+			data.list.forEach((ele)=>{
+				this.filterProductInfoContrapose.push(ele);
+			})
+			this.allFilterProductInfoContrapose = this.filterProductInfoContrapose;
+			if(this.filterProductInfoContrapose.length==data.totalNum){this.isMore = false;}
 				this.productInfo = data.list;
-				this.classIndex = 0;
 				uni.stopPullDownRefresh();
-			} catch (error) {
-			} finally {
-				uni.hideLoading();
-			}
-		},
-		/**
-		 * 获取当前选中商品总价
-		 */
-		getSelectItemPrice(item) {
-			let price = 0;
-			const { bigCount, smallCount, bigPrice, smallPrice } = item;
-			let sum =
-				Number(bigCount) * Number(bigPrice) +
-				Number(smallCount) * Number(smallPrice);
-			price = Math.round(sum * 100) / 100;
-			return price;
-		},
-		/**
-		 * 通过id获取当前选中的商品信息
-		 */
-		getSelectItemById(id) {
-			let info = {
-				bigCount: 0, //扎数
-				smallCount: 0, //支数
-				autoPrice: 0 //调价价格
-			};
-			const item =
-				this.selectList && this.selectList.find(ele => {
-					return ele.id == id;
-				});
-			if (item) {
-				info = {
-					...item,
-					bigCount: Number(item.bigCount),
-					smallCount: Number(item.smallCount),
-					autoPrice: Number(item.autoPrice)
-				};
-			}
-			return info;
-		},
-		/**
-		 * 通过id获取当前选中的商品类别信息  左边菜单角标  当前选中该类别商品多少件
-		 */
-		getSelectClassById(classId) {
-			let info = {
-				bigCount: 0, //扎数
-				smallCount: 0 //支数
-			};
-
-			const productItem =
-				this.productInfo &&
-				this.productInfo.find(ele => {
-					return ele.classId == classId;
-				});
-			if (productItem && productItem.child) {
-				for (const item of productItem.child) {
-					for (const selectItem of this.selectList) {
-						if (item.id == selectItem.id && item.classId == selectItem.classId) {
-							info.bigCount += Number(selectItem.bigCount);
-							info.smallCount += Number(selectItem.smallCount);
-						}
-					}
-				}
-			}
-			return info;
+			uni.hideLoading();
 		},
 
-		/**
-		 * 添加商品
-		 */
-		addEvent(item) {
-			const list = this.selectList;
-			let has = false;
-			for (let index = 0; index < list.length; index++) {
-				const element = list[index];
-				if (element.id == item.id) {
-					has = true;
-					if (this.isLimit) {
-						if (element.bigCount < item.bigNum) {
-							list[index] = { ...element, bigCount: ++element.bigCount };
-						}else{
-							this.$msg("库存不足");
-						}
-						//  else if (element.smallCount < item.smallNum) {
-						// 	list[index] = { ...element, smallCount: ++element.smallCount };
-						// }
-					} else {
-						list[index] = { ...element, bigCount: ++element.bigCount };
-					}
 
-					if (this.isLimit) {
-						const { bigCount, smallCount } = list[index];
-						//超过库存时 设置为库存最大值
-						const ratio = Number(item.ratio);
-						if (
-							Number(bigCount) * ratio + Number(smallCount) >
-							Number(item.bigNum) * ratio + Number(item.smallNum)
-						) {
-							list[index].bigCount = Number(item.bigNum);
-							list[index].smallCount = Number(item.smallNum);
-							this.$msg("库存不足");
-						}
-					}
 
-					break;
-				}
-			}
-			if (!has) {
-				let info = {};
 
-				info =
-					this.productInfo && this.productInfo.find(element => {
-						return element.id == item.id;
-					});
-				let params = {
-					...info,
-					bigCount: 1, //扎数
-					smallCount: 0, //支数
-					autoPrice: 0 //调价价格
-				};
-				if (info.bigNum && info.bigNum > 0) {
-					list.push(params);
-				} else {
-					this.$msg("库存不足");
-				}
-			}
 
-			this.setSelectInfoByType({ type: this.pageType, info: list });
-		},
 		/**
-		 * 减去商品
-		 */
-		delEvent(item) {
-			const list = this.selectList;
-			let has = false;
-			for (let index = 0; index < list.length; index++) {
-				const element = list[index];
-				if (element.id == item.id && element.classId == item.classId) {
-					has = true;
-
-					if (element.bigCount > 0) {
-						list[index] = { ...element, bigCount: --element.bigCount };
-					} else if (element.smallCount > 0) {
-						list[index] = { ...element, smallCount: 0 };
-					}
-
-					if (this.isLimit) {
-						const { bigCount, smallCount } = list[index];
-						//超过库存时 设置为库存最大值
-						const ratio = Number(item.ratio);
-						if (
-							Number(bigCount) * ratio + Number(smallCount) >
-							Number(item.bigNum) * ratio + Number(item.smallNum)
-						) {
-							list[index].bigCount = Number(item.bigNum);
-							list[index].smallCount = Number(item.smallNum);
-						}
-					}
-					if (element.bigCount == 0 && element.smallCount == 0) {
-						list.splice(index, 1);
-					}
-
-					break;
-				}
-			}
-			if (!has) {
-				let info = { classId: item.classId, id: item.id };
-
-				const classInfo =
-					this.productInfo &&
-					this.productInfo.find(element => {
-						return element.classId == item.classId && element.child;
-					});
-				if (classInfo) {
-					info = classInfo.child.find(ele => {
-						return ele.id == item.id;
-					});
-				}
-				let params = {
-					...info,
-					bigCount: 1, //扎数
-					smallCount: 0, //支数
-					autoPrice: 0 //调价价格
-				};
-
-				list.push(params);
-			}
-			this.setSelectInfoByType({ type: this.pageType, info: list });
-			// this.$forceUpdate();
-		},
-		// /**
-		//  * 删除商品
-		//  */
-		// removeEvent(item) {
-		// 	const list = this.selectList;
-		// 	for (let index = list.length - 1; index >= 0; index--) {
-		// 		const element = list[index];
-		// 		if (element.id == item.id && element.classId == item.classId) {
-		// 			list.splice(index, 1);
-		// 			break;
-		// 		}
-		// 	}
-		// 	this.setSelectInfoByType({ type: this.pageType, info: list });
-		// 	// this.$forceUpdate();
-		// },
-		/**
-		 * 更新商品
+		 * 搜索对应花材
 		 */
-		updateItemEvent(item) {
-			const list = this.selectList;
-			for (let index = 0; index < list.length; index++) {
-				const element = list[index];
-				if (element.id == item.id && element.classId == item.classId) {
-					const { bigCount, smallCount } = list[index];
-					//超过库存时 设置为库存最大值
-					const ratio = Number(item.ratio);
-					if (this.isLimit) {
-						if (
-							Number(bigCount) * ratio + Number(smallCount) >
-							Number(item.bigNum) * ratio + Number(item.smallNum)
-						) {
-							list[index].bigCount = Number(item.bigNum);
-							list[index].smallCount = Number(item.smallNum);
+		searchFnContrapose() {
+			let list = copyObject(this.filterProductInfoContrapose);
+			if(!this.$util.isEmpty(this.py)){
+				let commonChildList = [];
+				list.forEach(ele => {
+						let hasName = ele.itemName && ele.itemName.indexOf(this.py) >= 0;
+						let elePy = (ele.py && ele.py.toLocaleUpperCase()) || "";
+						let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0;
+						if (hasName || hasPy) {
+							console.log(ele)
+							commonChildList.push(ele)
 						}
-					}
-
-					list[index] = {
-						...element,
-						bigCount: Number(item.bigCount),
-						smallCount: Number(item.smallCount)
-					};
 
-					break;
-				}
-			}
-
-			this.setSelectInfoByType({ type: this.pageType, info: list });
-			// this.$forceUpdate();
-		},
-		/**
-		 * 切换左侧商品类别
-		 */
-		swichClass(e) {
-			let cur = e.currentTarget.dataset.current;
-			if (this.classIndex == cur) {
-				return false;
-			} else {
-				this.classIndex = cur;
+				});
+				// list = this.$util.unique(commonChildList)
+				this.filterProductInfoContrapose = commonChildList;
+			}else{
+				this.filterProductInfoContrapose = this.allFilterProductInfoContrapose;
 			}
-		},
-		/**
-		 * 搜索对应花材
-		 */
-		searchFn() {}
+		}
 	}
 };

+ 13 - 14
ghsApp/src/pagesStorehouse/allot/exSelect.vue

@@ -4,13 +4,13 @@
 			<app-search-module
 				v-model="py"
 				placeholder="请输入关键词,支持拼音首字母搜索"
-				@search="searchFn"
+				@input="searchFn"
 			/>
 		</view>
 <!--		<app-tabs :tabs="tabs" :currentTab="tabIndex" @change="change" itemWidth="50%"/>-->
 		<view class="scroll-middle_bx">
 			<scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop">
-				<div v-for="(item, index) in filterProductInfo" :key="index" class="tab-bar-item" :class="[classIndex == index ? 'active' : '']" :data-current="index" @tap.stop="swichClass">
+				<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>{{ 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">
@@ -24,20 +24,19 @@
 				<view class="switchover-unit" @tap="isSmallCount = !isSmallCount">{{isSmallCount?'支':'扎'}}</view>
 			</scroll-view>
 
-			<scroll-view
-				scroll-y
-				class="right-box"
-				v-if="tabIndex == 0"
-				:scroll-into-view="scrollClassId"
-			>
+<!--			<scroll-view-->
+<!--				scroll-y-->
+<!--				class="right-box"-->
+<!--				v-if="tabIndex == 0"-->
+<!--				:scroll-into-view="scrollClassId"-->
+<!--			>-->
+				<scroll-view scroll-y class="right-box" v-if="tabIndex == 0" :scroll-into-view="scroll_into_view" scroll-with-animation="true"
+																	@scroll="scroll_detail"
+																	lower-threshold="100"
+																	@scrolltolower="scroll_bottom">
 				<!--内容部分 start -->
 				<block v-if="!$util.isEmpty(filterProductInfo)">
-					<view
-						class="item_list_bx"
-						v-for="(classItem, classIndex) in filterProductInfo"
-						:key="classIndex"
-						:id="`class_${classItem.classId}`"
-					>
+					<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>

+ 8 - 14
ghsApp/src/pagesStorehouse/inventory/select.vue

@@ -4,7 +4,7 @@
 			<app-search-module
 				v-model="py"
 				placeholder="请输入关键词,支持拼音首字母搜索"
-				@search="searchFn"
+				@input="searchFn"
 			/>
 		</view>
 <!--		<app-tabs-->
@@ -15,7 +15,7 @@
 <!--		/>-->
 		<view class="scroll-middle_bx">
 			<scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop">
-				<div v-for="(item, index) in filterProductInfo" :key="index" class="tab-bar-item" :class="[classIndex == index ? 'active' : '']" :data-current="index" @tap.stop="swichClass" >
+				<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>{{ item.className || "" }}</text>
 					<text class="tag"
 						v-if=" getSelectClassById(item.classId).bigCount > 0 || getSelectClassById(item.classId).smallCount > 0">
@@ -30,20 +30,14 @@
 				<view class="switchover-unit" @tap="isSmallCount = !isSmallCount">{{isSmallCount?'支':'扎'}}</view>
 			</scroll-view>
 
-			<scroll-view
-				scroll-y
-				class="right-box"
-				v-if="tabIndex == 0"
-				:scroll-into-view="scrollClassId"
-			>
+<!--			<scroll-view scroll-y class="right-box" v-if="tabIndex == 0" :scroll-into-view="scrollClassId">-->
+				<scroll-view scroll-y class="right-box" v-if="tabIndex == 0" :scroll-into-view="scroll_into_view" scroll-with-animation="true"
+																	@scroll="scroll_detail"
+																	lower-threshold="100"
+																	@scrolltolower="scroll_bottom">
 				<!--内容部分 start -->
 				<block v-if="!$util.isEmpty(filterProductInfo)">
-					<view
-						class="item_list_bx"
-						v-for="(classItem, classIndex) in filterProductInfo"
-						:key="classIndex"
-						:id="`class_${classItem.classId}`"
-					>
+					<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>

+ 29 - 16
ghsApp/src/pagesStorehouse/stockWarn/manage.vue

@@ -3,17 +3,14 @@
     <app-tabs :tabs="tabs" :currentTab="tabIndex" @change="change" itemWidth="50%"/>
     <view class="input-wrap">
 			<view class="search-bar">
-				<app-search-module
-					v-model="py"
-					placeholder="输入商品名拼音首字母查询"
-					@search="searchFn"
-				/>
+				<app-search-module v-if="tabs[tabIndex].name=='库存预警'" v-model="py" placeholder="输入商品名拼音首字母查询" @input="searchFnContrapose"/>
+				<app-search-module v-else v-model="py" placeholder="输入商品名拼音首字母查询" @input="searchFn"/>
 			</view>
       <view v-if="loginInfo.super" class="city-select text-line">
 				<DorpdownSelect :menuObj.sync="menuObj" :selectItemId.sync="shopId" top="0" @selectSussess="selectSussess"></DorpdownSelect>
 			</view>
 		</view>
-		
+
 		<view v-if="tabs[tabIndex].name=='库存预警'" class="scroll-middle_bx">
 			<!--内容部分 start -->
 			<!--内容部分 start -->
@@ -21,7 +18,7 @@
 <!--				<view class="item_list_bx" v-for="(classItem, classIndex) in filterProductInfoContrapose" :key="classIndex" :id="`class_${classItem.classId}`">-->
 <!--				</view>-->
 					<!--					<text v-else>当前库存充足</text>-->
-				<view class="item_list_bx" style="width: 100%">
+				<scroll-view scroll-y class="item_list_bx" @scrolltolower="loadMore" lower-threshold="100" style="width: 100%">
 					<template v-for="(productItem, productIndex) in filterProductInfoContrapose">
 						<CommodityStock
 							:isPrice="false"
@@ -30,24 +27,32 @@
 							:info="productItem"
 						></CommodityStock>
 					</template>
-				</view>
+				</scroll-view>
 			</block>
+
 			<block v-else>
 				<view style="width: 100%">
 					<app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(filterProductInfoContrapose)"/></view>
 			</block>
 		</view>
+
+
+
 		<view v-else class="scroll-middle_bx">
 			<scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop">
-				<div v-for="(item, index) in filterProductInfo" :key="index" class="tab-bar-item" :class="[classIndex == index ? 'active' : '']" :data-current="index" @tap.stop="swichClass">
+				<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>{{ item.className || "" }}</text>
 				</div>
 			</scroll-view>
-			<scroll-view scroll-y class="right-box" v-if="currentTab == index" :scroll-into-view="scrollClassId">
+<!--			<scroll-view scroll-y class="right-box" v-if="currentTab == index" :scroll-into-view="scrollClassId">-->
+				<scroll-view scroll-y class="right-box" :scroll-into-view="scroll_into_view" scroll-with-animation="true"
+																	@scroll="scroll_detail"
+																	lower-threshold="100"
+																	@scrolltolower="scroll_bottom">
 				<!--内容部分 start -->
 				<!--内容部分 start -->
 				<block v-if="!$util.isEmpty(filterProductInfo)">
-					<view class="item_list_bx" v-for="(classItem, classIndex) in filterProductInfo" :key="classIndex" :id="`class_${classItem.classId}`">
+					<view class="item_list_bx selectAll" v-for="(classItem, classIndex) in filterProductInfo" :key="classIndex" :id="`class_${classIndex}`">
 						<view class="item_list_title" v-if="!$util.isEmpty(classItem.child)"> {{ classItem.className }}</view>
 						<text v-if="tabs[tabIndex].name=='库存预警'&&$util.isEmpty(classItem.child)">当前库存充足</text>
 						<template v-for="(productItem, productIndex) in classItem.child">
@@ -100,6 +105,7 @@ export default {
 			autoLoad: false, //不自动请求数据  自定义请求
 			pageType: "stock",
 			tabIndex: 0,
+			page:1,
 			tabs: [
 				{
 					name: "库存预警",
@@ -113,7 +119,7 @@ export default {
 		};
 	},
 	computed:{
-		...mapGetters(["getMyShopInfo"]),
+		...mapGetters(["getMyShopInfo","getLoginInfo"]),
 	},
 	onLoad() {
 		let type = this.tabs[this.tabIndex].key == STOCK_TYPE.WARN ? "waring" : "";
@@ -146,7 +152,8 @@ export default {
 				this.tabs[this.tabIndex].key;
 				let type = this.tabs[this.tabIndex].key == STOCK_TYPE.WARN ? "waring" : "";
 				if(type=="waring"){
-					this.initDataContrapose({ type, shopId: this.shopId });
+					uni.hideLoading();
+					// this.initDataContrapose({ type, shopId: this.shopId });
 				}else{
 					this.initData({ type, shopId: this.shopId });
 				}
@@ -164,10 +171,16 @@ export default {
 			// this.initData({ shopId: this.shopId });
 		},
 		scrollTop() {},
+		initProductInfo() {
+			this.filterProductInfoContrapose = [];
+			this.page = 1;
+			this.isMore = true;
+			},
 		selectSussess(val) {
 			uni.showLoading({
 				title: "加载中"
 			});
+			this.initProductInfo();
 			let type = this.tabs[this.tabIndex].key == STOCK_TYPE.WARN ? "waring" : "";
 			this.shopId = val.selectItem.id;
 			// this.initData({ type, shopId: this.shopId });
@@ -268,9 +281,9 @@ export default {
 	}
 	.item_list_bx {
 		padding: 40px 16px;
-    &:last-child{
-      margin-bottom: 70upx;
-    }
+    //&:last-child{
+    //  margin-bottom: 70upx;
+    //}
 	}
 	.item_list_title {
 		margin-bottom: 20px;

+ 7 - 0
ghsApp/src/static/css/reset.scss

@@ -1,3 +1,10 @@
+.flex{display: flex;align-items: center;}
+.flex-center{display: flex;align-items: center;justify-content: center}
+.flex-space{display: flex;align-items: center;justify-content: space-between}
+.flex-end{display: flex;align-items: center;justify-content: flex-end}
+.ov-1x{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
+.ov-2x{text-overflow: -o-ellipsis-lastline;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;}
+
 /*  #ifdef  H5  */
 .uni-page-head {
     background-color: transparent !important;