zs 2 gadi atpakaļ
vecāks
revīzija
5cefbe5a73
1 mainītis faili ar 109 papildinājumiem un 120 dzēšanām
  1. 109 120
      pagesHome/group/index.vue

+ 109 - 120
pagesHome/group/index.vue

@@ -22,7 +22,7 @@
 				</view>
 			</view>
 			<view class="two">
-				<button type="default" size="default" @click="toGroup()">我要开团</button>
+				<button type="default" size="default" @click="toGroup">我要开团</button>
 			</view>
 			<view class="thr">
 				<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
@@ -40,7 +40,7 @@
 								</view>
 								<view class="some">
 									<text>参团人数</text>
-									<text>{{item.num||0}}人</text>
+									<text>{{item.person_limit||0}}人</text>
 								</view>
 								<view class="other">
 									<view class="other_1">
@@ -59,6 +59,21 @@
 				</scroll-view>
 			</view>
 		</view>
+		<uni-popup ref="popup" background-color="#fff" type="bottom">
+			<view class="content">
+				<view class="one">
+					<text>数量</text>
+					<view class="count">
+						<uni-number-box :min="1" :max="specsInfo.num" v-model="num" @change="toCount">
+						</uni-number-box>
+					</view>
+					<text>库存{{specsInfo.num||0}}</text>
+				</view>
+				<view class="btn">
+					<text @click="onSubmit" class="button">确认开团</text>
+				</view>
+			</view>
+		</uni-popup>
 	</mobile-frame>
 </template>
 
@@ -75,97 +90,8 @@
 				// 店铺详情
 				shopInfo: {},
 				// 参团列表
-				list: [{
-					"_id": "633559dfa4e39d34f49990af",
-					"name": "商品6",
-					"view_num": 54,
-					"sell_money": 1,
-					"leader": '测试人员',
-					"file": [{
-						"id": "20221010102439",
-						"name": "ece9214111e760727a166eaac037fdc0.jpg",
-						"uri": "/files/point/goods/20221010102439.jpg",
-						"url": "https://broadcast.waityou24.cn/files/point/goods/20221010102439.jpg",
-						"uid": 1665368678937,
-						"status": "success"
-					}],
-					"time": "2022-10-11 15:50:27"
-				}, {
-					"_id": "63437e3ba163596194c3e830",
-					"name": "王大拿商品1",
-					"view_num": 37,
-					"sell_money": 15,
-					"leader": '测试人员',
-					"file": [{
-						"id": "20221010100628",
-						"name": "0e7edbb2f8e99780f253a3604adc32e4.jpg",
-						"uri": "/files/point/goods/20221010100628.jpg",
-						"url": "https://broadcast.waityou24.cn/files/point/goods/20221010100628.jpg",
-						"uid": 1665367588108,
-						"status": "success"
-					}],
-					"time": "2022-10-11 15:08:29"
-				}, {
-					"_id": "6343878989bdcb128d846990",
-					"name": "王大拿商品2",
-					"view_num": 196,
-					"sell_money": 50,
-					"leader": '测试人员',
-					"file": [{
-						"id": "20221011092711",
-						"name": "25.png",
-						"uri": "/files/point/goods/20221011092711.png",
-						"url": "https://broadcast.waityou24.cn/files/point/goods/20221011092711.png",
-						"uid": 1665451632365,
-						"status": "success"
-					}],
-					"time": "2022-10-11 15:05:41"
-				}, {
-					"_id": "63353758101f3c01048c4f61",
-					"name": "test",
-					"view_num": 265,
-					"sell_money": 0.1,
-					"leader": '测试人员',
-					"file": [{
-						"id": "20220929141236",
-						"name": "f0e22552dddcf494f9720c655a8420a.png",
-						"uri": "/files/point/goods/20220929141236.png",
-						"url": "https://broadcast.waityou24.cn/files/point/goods/20220929141236.png",
-						"uid": 1664431956868,
-						"status": "success"
-					}],
-					"time": "2022-10-11 11:21:01"
-				}, {
-					"_id": "633930162a24745ec0006373",
-					"name": "测试店铺1-商品1",
-					"view_num": 59,
-					"sell_money": 0.1,
-					"leader": '测试人员',
-					"file": [{
-						"id": "20220929141236",
-						"name": "f0e22552dddcf494f9720c655a8420a.png",
-						"uri": "/files/point/goods/20220929141236.png",
-						"url": "https://broadcast.waityou24.cn/files/point/goods/20220929141236.png",
-						"uid": 1664431956868,
-						"status": "success"
-					}],
-					"time": "2022-10-11 11:15:36"
-				}, {
-					"_id": "63355854a4e39d34f499904a",
-					"name": "商品2",
-					"view_num": 164,
-					"sell_money": 1,
-					"leader": '测试人员',
-					"file": [{
-						"id": "20220929163309",
-						"name": "f0e22552dddcf494f9720c655a8420a.png",
-						"uri": "/files/point/goods/20220929163309.png",
-						"url": "https://broadcast.waityou24.cn/files/point/goods/20220929163309.png",
-						"uid": 1664440389135,
-						"status": "success"
-					}],
-					"time": "2022-10-11 11:13:11"
-				}],
+				list: [],
+				num: 0,
 				total: 0,
 				skip: 0,
 				limit: 6,
@@ -188,33 +114,58 @@
 			// 开团
 			async toGroup() {
 				const that = this;
-				let user = that.user;
-				if (user._id) {
-					let data = {
-						shop: that.shopInfo._id,
-						goods: that.goodsInfo._id,
-						goodsSpec: that.specsInfo._id,
-						leader: user._id
-					}
-					const arr = await that.$api(`/group`, 'POST', data)
-					if (arr.errcode == '0') {
-						uni.showToast({
-							title: '开团成功',
-							icon: 'none'
-						})
-						that.clearPage();
-						that.search()
-					} else {
-						uni.showToast({
-							title: arr.data.errmsg,
-							icon: 'none'
-						})
-					}
-				} else {
-					uni.navigateTo({
-						url: `/pages/login/index`
-					})
-				}
+				that.$refs.popup.open();
+				// let user = that.user;
+				// if (user._id) {
+				// 	let data = {
+				// 		customer: user._id,
+				// 		shop: that.shopInfo._id,
+				// 		goods: that.goodsInfo._id,
+				// 		goodsSpec: that.specsInfo._id,
+				// 		num: that.num,
+				// 	}
+				// 	let arr = await that.$api(`/util/checkCanBuy`, 'POST', data)
+				// 	if (arr.errcode == '0') {
+				// 		if (arr.data.result == true) {
+				// 			uni.navigateTo({
+				// 				url: `/pagesHome/order/order?key=${arr.data.key}`
+				// 			})
+				// 		} else {
+				// 			uni.showToast({
+				// 				title: arr.data.msg,
+				// 				icon: 'none'
+				// 			})
+				// 		}
+				// 	} else {
+				// 		uni.showToast({
+				// 			title: arr.errmsg,
+				// 			icon: 'none'
+				// 		})
+				// 	}
+				// 	const arr = await that.$api(`/group`, 'POST', data)
+				// 	if (arr.errcode == '0') {
+				// 		uni.showToast({
+				// 			title: '开团成功',
+				// 			icon: 'none'
+				// 		})
+				// 		that.clearPage();
+				// 		that.search()
+				// 	} else {
+				// 		uni.showToast({
+				// 			title: arr.data.errmsg,
+				// 			icon: 'none'
+				// 		})
+				// 	}
+				// } else {
+				// 	uni.navigateTo({
+				// 		url: `/pages/login/index`
+				// 	})
+				// }
+			},
+			// 计数器
+			toCount(e) {
+				const that = this;
+				that.num = e;
 			},
 			// 立即参团
 			toJoin(e) {
@@ -464,4 +415,42 @@
 			flex-direction: column;
 		}
 	}
+
+	.content {
+		height: 60vw;
+
+		.one {
+			display: flex;
+			justify-content: flex-start;
+			align-items: center;
+			margin: 0 2vw;
+			padding: 2vw 0;
+
+			text {
+				margin: 0 2vw 0 0;
+			}
+
+			text:last-child {
+				margin: 0 0 0 2vw;
+				font-size: var(--font12Size);
+				color: var(--f85Color);
+			}
+		}
+
+		.btn {
+			display: flex;
+			justify-content: space-between;
+			position: fixed;
+			bottom: 0;
+
+			.button {
+				width: 100vw;
+				padding: 4vw 0;
+				background-color: var(--fFB1Color);
+				text-align: center;
+				font-size: var(--font18Szie);
+				color: var(--mainColor);
+			}
+		}
+	}
 </style>