From 9354604265d3a5fd05b8bb528749bdbab424cc79 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期三, 18 六月 2025 23:03:21 +0800
Subject: [PATCH] 上下架,库存调整

---
 pages/goods-manager/goodsList/goodsList.vue |  125 +++++++++++++++++++++++++++++++++--------
 1 files changed, 99 insertions(+), 26 deletions(-)

diff --git a/pages/goods-manager/goodsList/goodsList.vue b/pages/goods-manager/goodsList/goodsList.vue
index e77a8be..d186625 100644
--- a/pages/goods-manager/goodsList/goodsList.vue
+++ b/pages/goods-manager/goodsList/goodsList.vue
@@ -5,7 +5,7 @@
 				<!-- 閫氳繃 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 }">
@@ -32,9 +32,10 @@
 									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,6 +53,18 @@
 		</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>
@@ -73,31 +87,11 @@
 				pageNumber: 1,
 				pageSize: 10,
 			},
-			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": [
-						"鐑崠涓�",
-					]
-				}
-			],
+			data: [],
 			formData: {
 				status: 'loading', // 鍔犺浇鐘舵��
 			},
+			selectGoods: {},
 			tipShow: false // 鏄惁鏄剧ず椤堕儴鎻愮ず妗�
 		};
 	},
@@ -109,6 +103,48 @@
 		}
 	},
 	methods: {
+		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();
+				})
+			}
+		},
+		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();
@@ -256,7 +292,6 @@
 		// 灏忕▼搴� 缂栬瘧鍚庝細澶氫竴灞傛爣绛撅紝鑰屽叾浠栧钩鍙版病鏈夛紝鎵�浠ラ渶瑕佺壒娈婂鐞嗕竴涓�
 		/deep/ .uni-list {
 			/* #endif */
-			height: calc(100vh - 100px - 80px - 60px);
 			display: flex;
 			flex-direction: row;
 			flex-wrap: wrap;
@@ -303,4 +338,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