zs 2 years ago
parent
commit
47e5abe2a6
1 changed files with 20 additions and 2 deletions
  1. 20 2
      pagesHome/order/detail.vue

+ 20 - 2
pagesHome/order/detail.vue

@@ -192,7 +192,8 @@
 											</uni-number-box>
 										</view>
 										<view class="one_3_1">
-											<text>库存{{specsInfo.num||0}}</text>
+											<text>库存{{specsInfo.num||0}}</text><text
+												class="limit">({{specsInfo.buy_name||'暂无'}}{{specsInfo.limit_num||0}}个)</text>
 										</view>
 									</view>
 								</view>
@@ -329,6 +330,8 @@
 				is_zero: false,
 				// 商品设置
 				group_config: [],
+				// 限制说明
+				buyList: [],
 				// 购买数量
 				buy_num: 1,
 				// 规格弹出框
@@ -417,6 +420,11 @@
 					shop: that.info?.shop?._id
 				}, 'group');
 				if (res.errcode == '0' && res.total > 0) that.$set(that, `group_config`, res.data);
+				// 限制说明
+				res = await that.$api(`/dictData`, 'GET', {
+					code: "buy_limit"
+				});
+				if (res.errcode == '0') that.$set(that, `buyList`, res.data)
 			},
 			// 查询商品信息
 			async search() {
@@ -483,6 +491,8 @@
 						let specsInfo = that.group_config.find(i => i.spec._id == data._id)
 						if (specsInfo?._id && that.user.is_leader == '0') data.can_group = '0'
 						else data.can_group = '1'
+						let limit = that.buyList.find((i) => i.value == data.buy_limit);
+						if (limit) data.buy_name = limit.label
 						that.$set(that, `specsInfo`, data);
 						that.$set(that, `is_specs`, dataIndex);
 					}
@@ -512,6 +522,8 @@
 				let specsInfo = that.group_config.find(i => i.spec._id == e._id)
 				if (specsInfo?._id && that.user.is_leader == '0') e.can_group = '0'
 				else e.can_group = '1'
+				let limit = that.buyList.find((i) => i.value == e.buy_limit);
+				if (limit) e.buy_name = limit.label
 				that.$set(that, `specsInfo`, e)
 				that.$set(that, `buy_num`, 1);
 				if (e.num <= 0) that.$set(that, `is_zero`, true)
@@ -621,7 +633,8 @@
 						} else {
 							uni.showToast({
 								title: res.data.msg,
-								icon: 'none'
+								icon: 'none',
+								duration: 5000
 							})
 						}
 					} else {
@@ -1233,6 +1246,11 @@
 								font-size: 14px;
 								color: #858585;
 							}
+
+							.limit {
+								color: #ff0000;
+								padding: 0 0 0 2vw;
+							}
 						}
 					}
 				}