Ver Fonte

Merge branch 'master' into smslogin

shish há 1 mês atrás
pai
commit
fc0654f74e

+ 1 - 1
ghsApp/src/pagesArrears/list.vue

@@ -17,7 +17,7 @@
 					</view>
 					<view class="item-main" @click="gotoDetailsEvent(item)">
 						<view class="phone" @click.stop="callUp(item.mobile)" ><i class="iconfont icondianhua1"></i> {{ item.mobile }}</view>
-						<view class="price">{{ item.debtAmount }} <text class="iconfont iconxiangyou"></text>
+						<view class="price">{{ item.remainDebtAmount }} <text class="iconfont iconxiangyou"></text>
 						</view>
 					</view>
 				</view>

+ 1 - 1
ghsApp/src/pagesGys/list.vue

@@ -17,7 +17,7 @@
 					</view>
 					<view class="item-main" @click="gotoDetailsEvent(item)">
 						<view class="phone" @click.stop="callUp(item.mobile)" ><i class="iconfont icondianhua1"></i> {{ item.mobile }}</view>
-						<view class="price">{{ item.debtAmount }} <text class="iconfont iconxiangyou"></text>
+						<view class="price">{{ item.remainDebtAmount }} <text class="iconfont iconxiangyou"></text>
 						</view>
 					</view>
 				</view>

+ 1 - 1
hdApp/src/pagesArrears/list.vue

@@ -17,7 +17,7 @@
 					</view>
 					<view class="item-main">
 						<view class="phone" @click="callUp(item.mobile)" ><i class="iconfont icondianhua1"></i> {{ item.mobile }}</view>
-						<view class="price" @click="gotoDetailsEvent(item)">-{{ item.debtAmount }} <text class="iconfont iconxiangyou"></text>
+						<view class="price" @click="gotoDetailsEvent(item)">-{{ item.remainDebtAmount }} <text class="iconfont iconxiangyou"></text>
 						</view>
 					</view>
 				</view>

+ 2 - 22
hdApp/src/pagesPurchase/purDetails.vue

@@ -168,9 +168,9 @@
           </view>
         </view>
 
-        <view class="order-info_box" style="margin-top:35upx;" v-if="Number(detailInfo.debtAmount)>0 && detailInfo.showForPay==1">
+        <view class="order-info_box" style="margin-top:35upx;" v-if="Number(detailInfo.remainDebtAmount)>0 && detailInfo.showForPay==1">
           <view>累计待结:</view>
-          <view style="font-weight:bold;color:red;font-size:29upx;">¥{{detailInfo.debtAmount?parseFloat(detailInfo.debtAmount):0}}</view>
+          <view style="font-weight:bold;color:red;font-size:29upx;">¥{{detailInfo.remainDebtAmount?parseFloat(detailInfo.remainDebtAmount):0}}</view>
           <view class="price" v-if="loginStyle != 0">
             <button @click="goToSettle(detailInfo)" class="admin-button-com" style="padding:20upx 15upx;" v-if="detailInfo.remainDebtAmount>0">
             选订单结账
@@ -178,26 +178,6 @@
           </view>
         </view>
 
-        <block v-if="Number(detailInfo.inMyGhsBalance)>0">
-          <view class="order-info_box" style="margin-top:35upx;" v-if="detailInfo.remainDebtAmount>0">
-            <view>减去余额:</view>
-            <view style="font-weight:bold;color:#3385ff;font-size:29upx;">
-              ¥{{detailInfo.inMyGhsBalance?parseFloat(detailInfo.inMyGhsBalance):0}} 实欠 ¥{{detailInfo.remainDebtAmount?parseFloat(detailInfo.remainDebtAmount):0}}
-            </view>
-            <view class="price" v-if="loginStyle != 0">
-              <button @click="goToRecharge(detailInfo)" class="admin-button-com" style="padding:20upx 15upx;">
-              按金额结账
-              </button>
-            </view>
-          </view>
-          <view class="order-info_box" style="margin-top:35upx;" v-if="detailInfo.remainDebtAmount<0">
-            <view>账户余额:</view>
-            <view style="font-weight:bold;color:#3385ff;font-size:29upx;">
-              ¥{{Math.abs(detailInfo.remainDebtAmount)}} 已结清
-            </view>
-          </view>
-        </block>
-
       </view>
 
       <view class="module-com content-box proInfo">

+ 64 - 17
mallApp/src/mixins/cgProduct.js

@@ -23,6 +23,8 @@ export default {
 			//组合开单
 			scroll_into_view:"",
 			top_list:'',
+			cached_top_list: null,
+			scrollTimer: null,
 			timeFun:"",
 			filterProductInfo:''
 		};
@@ -539,6 +541,18 @@ export default {
 
 				this.classIndex = 0;
 				this.scrollPushList();
+				
+				// 异步获取并缓存分类节点高度,避免滚动时高频查询
+				this.$nextTick(() => {
+					setTimeout(() => {
+						const query = uni.createSelectorQuery().in(this);
+						query.selectAll(".selectAll").boundingClientRect(data => {
+							if (data && data.length > 0) {
+								this.cached_top_list = data.map(item => Math.ceil(item.top));
+							}
+						}).exec();
+					}, 600);
+				});
 			} catch (error) {
 				console.log(error)
 			} finally {
@@ -559,12 +573,55 @@ export default {
 			this.filterProductInfo = classList
 			return
 		},
-		//滚动商品监听
+		//滚动商品监听(加入防抖与节流,使用缓存高度,避免高频跨线程查询)
 		scroll_detail(options){
-			//options  为滚动信息。  options.detail.scrollTop  值为相对于scroll-view。
-			if(!uni.getStorageSync("resolve")){
-				this.get_node_details(options);
-			};
+			if(uni.getStorageSync("resolve")){
+				return;
+			}
+			
+			if (this.scrollTimer) return;
+			this.scrollTimer = setTimeout(() => {
+				this.scrollTimer = null;
+				
+				// 如果有缓存的高度列表,直接使用缓存进行快速区间判定
+				if (this.cached_top_list && this.cached_top_list.length > 0) {
+					this.async_detail_msg_fast(options.detail.scrollTop);
+				} else {
+					// 降级容灾:若未获取到缓存,则使用原有的动态查询
+					this.get_node_details(options);
+				}
+			}, 120);
+		},
+		// 快速区间判定(无 SelectorQuery 查询,极速响应)
+		async_detail_msg_fast(scrollTop) {
+			let top_page = scrollTop + this.cached_top_list[0];
+			for(let i = 0; i < this.cached_top_list.length; i++){
+				let node1 = this.cached_top_list[i];
+				let node2 = this.cached_top_list[i+1];
+				if(node2 && top_page >= node1 && top_page < node2){
+					this.updateActiveClasses(i);
+					break;
+				}else if(node2 && top_page === node2){
+					this.updateActiveClasses(i + 1);
+					break;
+				}
+			}
+		},
+		// 动态 DOM 回收与激活核心逻辑
+		updateActiveClasses(activeIndex) {
+			this.classIndex = activeIndex;
+			
+			// 动态 DOM 回收:只保留当前分类、上一个分类和下两个分类处于激活状态,其余全部释放
+			if (this.filterProductInfo && this.filterProductInfo.length > 0) {
+				this.filterProductInfo.forEach((item, idx) => {
+					if (idx >= activeIndex - 1 && idx <= activeIndex + 2) {
+						item.isActive = true;
+					} else {
+						item.isActive = false; // 滚出可视区域的分类,销毁其内部所有花材组件,释放内存
+					}
+				});
+				this.$forceUpdate();
+			}
 		},
 		//获取商品节点信息
 		get_node_details(options){
@@ -585,20 +642,10 @@ export default {
 				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.filterProductInfo[this.classIndex].isActive = true;
-					this.filterProductInfo[this.classIndex+1].isActive = true;
-					if(this.filterProductInfo[this.classIndex+1].child.length<5){
-						this.filterProductInfo[this.classIndex+2].isActive = true;
-					}
+					this.updateActiveClasses(i);
 					break;
 				}else if(node2 && top_page === node2){
-					this.classIndex = i + 1;
-					this.filterProductInfo[this.classIndex].isActive = true;
-					this.filterProductInfo[this.classIndex+1].isActive = true;
-					if(this.filterProductInfo[this.classIndex+1].child.length<5){
-						this.filterProductInfo[this.classIndex+2].isActive = true;
-					}
+					this.updateActiveClasses(i + 1);
 					break;
 				}
 			}

+ 1 - 1
mallApp/src/pages/item/components/subItem.vue

@@ -2,7 +2,7 @@
 	<view class="product-item">
 		<view class="item-cmd_bx" @click="customNum()">
 			<view class="img_bx" style="background:#eeeeee" @click.stop="showBigImg">
-				<image :src="info.cover" v-if="isImg"></image>
+				<image :src="info.cover" v-if="isImg" lazy-load mode="aspectFill"></image>
 			</view>
 			<view class="cmd-info_bx">
 				<view class="tit">

+ 5 - 0
mallApp/src/pages/item/item.vue

@@ -859,6 +859,11 @@ export default {
 		flex: 1;
 		box-sizing: border-box;
 		padding-bottom:90upx;
+		/* 开启 GPU 硬件加速 */
+		transform: translateZ(0);
+		will-change: scroll-position;
+		/* 限制重排和重绘范围,提升滚动性能 */
+		contain: layout style;
 	}
 	.item_list_bx {
 		padding: 40upx 16upx 20upx 16upx;