From f64549c06c2e4fd3f47552ae0fcb3ae5ae79f796 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 24 六月 2025 18:41:43 +0800
Subject: [PATCH] 首页视频性能优化

---
 pages/goods-manager/goodsList/goodsList.vue |  169 +++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 130 insertions(+), 39 deletions(-)

diff --git a/pages/goods-manager/goodsList/goodsList.vue b/pages/goods-manager/goodsList/goodsList.vue
index ec15364..9e62ee5 100644
--- a/pages/goods-manager/goodsList/goodsList.vue
+++ b/pages/goods-manager/goodsList/goodsList.vue
@@ -5,16 +5,16 @@
 				<!-- 閫氳繃 uni-list--waterfall 绫诲喅瀹氶〉闈㈠竷灞�鏂瑰悜 -->
 				<!-- to 灞炴�ф惡甯﹀弬鏁拌烦杞鎯呴〉闈紝褰撳墠鍙负鍙傝�� -->
 				<view :border="!formData.waterfall" class="uni-list-item--waterfall" title="鑷畾涔夊晢鍝佸垪琛�"
-					v-for="item in data" :key="item.id" @click="addGoods(item.id)">
+					v-for="item in data" :key="item.id" @click="toggle(item)">
 					<!-- 閫氳繃header鎻掓Ы瀹氫箟鍒楄〃宸︿晶鍥剧墖 -->
 
 					<view class="uni-thumb shop-picture" :class="{ 'shop-picture-column': formData.waterfall }">
-						<image :src="item.goods_thumb" mode="aspectFill"></image>
+						<image :src="item.thumbnail" mode="aspectFill"></image>
 					</view>
 					<view class="shop">
 						<view>
 							<view class="uni-title">
-								<text class="uni-ellipsis-2">{{ item.name }}</text>
+								<text class="uni-ellipsis-2">{{ item.goodsName }}</text>
 							</view>
 							<!-- <view>
 									<text class="uni-tag hot-tag">{{ item.goods_tip }}</text>
@@ -24,17 +24,18 @@
 						<view>
 							<view class="shop-price">
 								<text>楼</text>
-								<text class="shop-price-text">{{ item.goods_price }}</text>
+								<text class="shop-price-text">{{ item.price }}</text>
 								<text>.00</text>
 							</view>
 							<view class="uni-flex-row">
-								<view class="uni-note">{{ item.comment_count || 0 }}鏉¤瘎璁� 鏈堥攢閲� {{
-									item.month_sell_count || 0 }}
+								<view class="uni-note">{{ item.commentNum || 0 }}鏉¤瘎璁� 鏈堥攢閲� {{
+									item.buyCount || 0 }}
 								</view>
 								<view class="uni-note ellipsis">
-									<text class="uni-link">涓婃灦</text>
+									<text :class="item.marketEnable == 'DOWN' ? 'market-down' : 'market-up'">{{
+										item.marketEnable == 'DOWN' ? "宸蹭笅鏋�" : "宸蹭笂鏋�" }}</text>
 
-									<text class="uni-link" style="color:red;">鍒犻櫎</text>
+									<!--<text class="uni-link" style="color:red;">鍒犻櫎</text> -->
 								</view>
 							</view>
 						</view>
@@ -43,6 +44,7 @@
 
 				</view>
 			</view>
+			<view style="height: 80px;"></view>
 		</view>
 
 		<button type="default" class="btn" @click="addGoods('')">
@@ -51,59 +53,110 @@
 		</button>
 		<!-- 閫氳繃 loadMore 缁勪欢瀹炵幇涓婃媺鍔犺浇鏁堟灉锛屽闇�鑷畾涔夋樉绀哄唴瀹癸紝鍙弬鑰冿細https://ext.dcloud.net.cn/plugin?id=29 -->
 		<uni-load-more v-if="loading || formData.status === 'noMore'" :status="formData.status" />
+		<view>
+			<!-- 鏅�氬脊绐� -->
+			<uni-popup ref="popup" background-color="#fff">
+				<view class="popup-content" :class="{ 'popup-height': type === 'left' || type === 'right' }">
+
+					<button type="default" @click="underOrup">{{ selectGoods.marketEnable == 'DOWN' ? '涓婃灦' : "涓嬫灦"
+					}}</button>
+
+					<button type="default" @click="stocks">璋冩暣搴撳瓨</button>
+				</view>
+			</uni-popup>
+		</view>
 
 	</view>
 </template>
 
 <script>
 
-import UIcon from '@/uview-components/uview-ui/components/u-icon/u-icon.vue';
+import '@/components/uview-components/uview-ui';
+
+import * as API_GOODS from "@/api/goods.js";
+
 export default {
-	components: { UIcon },
 	data() {
 		return {
 			formData: {
 				waterfall: false, // 甯冨眬鏂瑰悜鍒囨崲
 				status: 'loading', // 鍔犺浇鐘舵��
 			},
-			data: [
-				{
-					"id": 122,
-					"goods_thumb": "https://lilishop-oss.oss-cn-beijing.aliyuncs.com/83df593e6ba448ddbe6685d928e6fa65.jpg",
-					"name": "銆愮垎娆俱�慉pple iPhone 11 (A2223) 64GB 娣辩┖鐏拌壊 绉诲姩鑱旈�氱數淇�4G鎵嬫満",
-					"goods_price": "699.00",
-					"goods_tip": "鐑崠涓�",
-					"tag": [
-						"鐑崠涓�",
-					]
-				},
-				{
-					"id": 123,
-					"goods_thumb": "https://lilishop-oss.oss-cn-beijing.aliyuncs.com/83df593e6ba448ddbe6685d928e6fa65.jpg",
-					"name": "銆愮垎娆俱�慉pple iPhone 11 (A2223) 64GB 娣辩┖鐏拌壊 绉诲姩鑱旈�氱數淇�4G鎵嬫満",
-					"goods_price": "699.00",
-					"goods_tip": "鐑崠涓�",
-					"tag": [
-						"鐑崠涓�",
-					]
-				}
-			],
+			params: {
+				pageNumber: 1,
+				pageSize: 10,
+			},
+			data: [],
 			formData: {
 				status: 'loading', // 鍔犺浇鐘舵��
 			},
+			selectGoods: {},
 			tipShow: false // 鏄惁鏄剧ず椤堕儴鎻愮ず妗�
 		};
 	},
-	onLoad() { },
+	onLoad() {
+	},
+	onShow() {
+		if (this.$options.filters.tipsToLogin()) {
+			this.getGoodsList();
+		}
+	},
 	methods: {
-		load(data, ended) {
-			if (ended) {
-				this.formData.status = 'noMore'
+		underOrup() {
+			let params = {
+				goodsId: this.selectGoods.id,
+			};
+			this.$refs.popup.close()
+			if (this.selectGoods.marketEnable == 'DOWN') {
+				API_GOODS.upGoods(params).then((res) => {
+					uni.showLoading({
+						title: '涓婃灦鎴愬姛'
+					});
+
+					setTimeout(function () {
+						uni.hideLoading();
+					}, 2000);
+					this.getGoodsList();
+				})
+			}
+			else {
+				API_GOODS.lowGoods(params).then((res) => {
+					uni.showLoading({
+						title: '涓嬫灦鎴愬姛'
+					});
+
+					setTimeout(function () {
+						uni.hideLoading();
+					}, 2000);
+					this.getGoodsList();
+				})
 			}
 		},
-		addGoods(id) {
-			console.log("addGoods:" + id);
+		stocks() {
+			
+			this.$refs.popup.close()
+			var goodsId = this.selectGoods.id
+			uni.navigateTo({
+				url: `/pages/goods-manager/updateSkus/updateSkus${"?goodsId=" + goodsId}`,
+			});
+		},
+		toggle(item) {
+			this.$refs.popup.open('bottom')
+			this.selectGoods = item;
+		},
 
+		getGoodsList() {
+			uni.showLoading();
+			API_GOODS.getStoreGoods(
+				this.params.pageNumber,
+				this.params.pageSize
+			).then((res) => {
+				this.data = res.data.result.records;
+
+				if (this.$store.state.isShowToast) { uni.hideLoading() };
+			});
+		},
+		addGoods(id) {
 			uni.navigateTo({
 				url: `/pages/goods-manager/addGoods/addGoods${id ? "?id=" + id : ""}`,
 			});
@@ -249,7 +302,7 @@
 			/deep/
 			/* #endif */
 			.uni-list-item--waterfall {
-				// width: 50%;
+				width: 98%;
 				display: flex;
 				box-sizing: border-box;
 				margin-bottom: 10px;
@@ -284,4 +337,42 @@
 		margin-right: 10rpx;
 	}
 }
+
+@mixin flex {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	flex-direction: row;
+}
+
+@mixin height {
+	/* #ifndef APP-NVUE */
+	height: 100%;
+	/* #endif */
+	/* #ifdef APP-NVUE */
+	flex: 1;
+	/* #endif */
+}
+
+.popup-content {
+	@include flex;
+	align-items: center;
+	justify-content: center;
+	padding: 15px;
+	height: 150px;
+	background-color: #fff;
+}
+
+.popup-height {
+	@include height;
+	width: 200px;
+}
+
+.market-down {
+	color: red;
+}
+
+.market-up {
+	color: green;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0