From edf50893285f13c7c975b376a70ac3b164f48a13 Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期一, 02 九月 2024 18:02:54 +0800
Subject: [PATCH] update 购物车加载速度

---
 sub_pages/customer/shopping/shopping.vue |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/sub_pages/customer/shopping/shopping.vue b/sub_pages/customer/shopping/shopping.vue
index a512018..7b36437 100644
--- a/sub_pages/customer/shopping/shopping.vue
+++ b/sub_pages/customer/shopping/shopping.vue
@@ -16,10 +16,7 @@
 		</view>
 		<view class="">
 			<no-data v-if="!list||list.length===0" style="width: 100%;"></no-data>
-
 			<view class="shopping-item m-t-20" v-for="(item,index) of list" :key="index">
-
-
 				<view class="sup-title">
 					<radio :checked="ids.indexOf('supplier@'+item.supplierId)>=0" @click="changeItem(item,'supplier')">
 					</radio>
@@ -32,8 +29,8 @@
 						<u-swipe-action-item :options="options1" @click="(e)=>{clickSwipeButton(dto,true)}">
 							<view class="item-each flex">
 								<radio :checked="ids.indexOf(dto.id)>=0" @click="changeItem(dto,'flower')"></radio>
-								<image class="img img100 m-r-6 br-4" :class="[!dto.stock?'component-stock-zero':'']"
-									:src="dto.url||dto.cover"></image>
+								<image class="img img100 m-r-6 br-4" :lazy-load="true"
+									:class="[!dto.stock?'component-stock-zero':'']" :src="dto.url||dto.cover"></image>
 								<view class="flex1">
 									<view class="title" @click.stop="toDetail(dto)"><span class="m-r-5"
 											style="display: inline-block;">{{dto.categoryStr||''}}</span><span
@@ -119,13 +116,16 @@
 			totalprice() {
 
 				let totalprice = 0
-				this.list && this.list.forEach(dto => {
-					dto.flowerList && dto.flowerList.forEach(item => {
-						if (this.ids.indexOf(item.id) >= 0) {
-							totalprice += item.price * item.num
-						}
+				if (this.ids.length > 0) {
+					this.list && this.list.forEach(dto => {
+						dto.flowerList && dto.flowerList.forEach(item => {
+							if (this.ids.indexOf(item.id) >= 0) {
+								totalprice += item.price * item.num
+							}
+						})
 					})
-				})
+				}
+
 				return totalprice.toFixed(2)
 			},
 		},
@@ -464,8 +464,9 @@
 					this.$message.showToast('请先前往个人中心补充个人信息')
 					return
 				}
+				this.$store.dispatch('sign_clear', 'shopping');
+
 				this.$message.showLoading()
-				await this.$store.dispatch('sign_clear', 'shopping');
 				const {
 					code,
 					data
@@ -474,7 +475,7 @@
 				this.list = []
 				if (code === 0) {
 					this.list = data || []
-
+					this.$forceUpdate()
 				}
 			},
 			toDetail(dto) {

--
Gitblit v1.9.3