zs 2 年之前
父節點
當前提交
1a54c8191a
共有 2 個文件被更改,包括 116 次插入88 次删除
  1. 60 42
      pagesHome/group/index.vue
  2. 56 46
      pagesHome/order/detail.vue

+ 60 - 42
pagesHome/group/index.vue

@@ -2,7 +2,6 @@
 	<mobile-frame>
 		<view class="main">
 			<view class="one">
-	<!-- 			<view class="one_1">参团商品</view> -->
 				<view class="list" @tap="toView">
 					<image class="image" :src="goodsInfo.file&&goodsInfo.file.length>0?goodsInfo.file[0].url:''"
 						mode="">
@@ -11,6 +10,10 @@
 						<view class="name">
 							{{goodsInfo.name||'暂无'}}
 						</view>
+						<view class="specs">
+							<text>规格:{{specsInfo.name}}</text>
+							<text>店铺:{{shopInfo.name}}</text>
+						</view>
 						<view class="money">
 							<text>¥</text>
 							<text>{{specsInfo.sell_money}}</text>
@@ -22,36 +25,38 @@
 				<button type="default" size="default" @click="toGroup()">我要开团</button>
 			</view>
 			<view class="thr">
-				<!-- 	<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
-					<view class="list-scroll-view"> -->
-				<view class="list" v-for="(item, index) in list" :key="index">
-					<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode="">
-					</image>
-					<view class="list_1">
-						<view class="name">
-							{{item.name||'暂无'}}
-						</view>
-						<view class="some">
-							<text>店铺名称</text>
-							<text>{{item.name||'暂无'}}</text>
-						</view>
-						<view class="some">
-							<text>规格名称</text>
-							<text>{{item.name||'暂无'}}</text>
-						</view>
-						<view class="other">
-							<view class="other_1">
-								<text>¥</text>
-								<text>{{item.sell_money||0}}</text>
-							</view>
-							<view class="other_2">
-								<view class="btn" @click="toJoin(item)"><text>已参团{{item.num||'5'}}人</text>立即参团</view>
+				<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
+					<view class="list-scroll-view">
+						<view class="list" v-for="(item, index) in list" :key="index">
+							<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode="">
+							</image>
+							<view class="list_1">
+								<view class="name">
+									{{item.leader||'暂无'}}
+								</view>
+								<view class="some">
+									<text>商品名称</text>
+									<text>{{item.name||'暂无'}}</text>
+								</view>
+								<view class="some">
+									<text>参团人数</text>
+									<text>{{item.num||0}}人</text>
+								</view>
+								<view class="other">
+									<view class="other_1">
+										<text>¥</text>
+										<text>{{item.sell_money||0}}</text>
+									</view>
+									<view class="other_2">
+										<view class="btn" @click="toJoin(item)">
+											<text>{{item.status||'开团中'}}</text>立即参团
+										</view>
+									</view>
+								</view>
 							</view>
 						</view>
 					</view>
-				</view>
-				<!-- 		</view>
-				</scroll-view> -->
+				</scroll-view>
 			</view>
 		</view>
 	</mobile-frame>
@@ -75,6 +80,7 @@
 					"name": "商品6",
 					"view_num": 54,
 					"sell_money": 1,
+					"leader": '测试人员',
 					"file": [{
 						"id": "20221010102439",
 						"name": "ece9214111e760727a166eaac037fdc0.jpg",
@@ -89,6 +95,7 @@
 					"name": "王大拿商品1",
 					"view_num": 37,
 					"sell_money": 15,
+					"leader": '测试人员',
 					"file": [{
 						"id": "20221010100628",
 						"name": "0e7edbb2f8e99780f253a3604adc32e4.jpg",
@@ -103,6 +110,7 @@
 					"name": "王大拿商品2",
 					"view_num": 196,
 					"sell_money": 50,
+					"leader": '测试人员',
 					"file": [{
 						"id": "20221011092711",
 						"name": "25.png",
@@ -117,6 +125,7 @@
 					"name": "test",
 					"view_num": 265,
 					"sell_money": 0.1,
+					"leader": '测试人员',
 					"file": [{
 						"id": "20220929141236",
 						"name": "f0e22552dddcf494f9720c655a8420a.png",
@@ -131,6 +140,7 @@
 					"name": "测试店铺1-商品1",
 					"view_num": 59,
 					"sell_money": 0.1,
+					"leader": '测试人员',
 					"file": [{
 						"id": "20220929141236",
 						"name": "f0e22552dddcf494f9720c655a8420a.png",
@@ -145,6 +155,7 @@
 					"name": "商品2",
 					"view_num": 164,
 					"sell_money": 1,
+					"leader": '测试人员',
 					"file": [{
 						"id": "20220929163309",
 						"name": "f0e22552dddcf494f9720c655a8420a.png",
@@ -178,7 +189,7 @@
 			async toGroup() {
 				const that = this;
 				let user = that.user;
-				if (user) {
+				if (user._id) {
 					let data = {
 						shop: that.shopInfo._id,
 						goods: that.goodsInfo._id,
@@ -195,20 +206,27 @@
 						that.search()
 					} else {
 						uni.showToast({
-							title: arr.data.errmsg || '下单失败!',
+							title: arr.data.errmsg,
 							icon: 'none'
 						})
 					}
 				} else {
-					uni.showToast({
-						title: '无用户登录无法开团',
-						icon: 'none'
+					uni.navigateTo({
+						url: `/pages/login/index`
 					})
 				}
 			},
 			// 立即参团
 			toJoin(e) {
-				console.log(e);
+				const that = this;
+				let user = that.user;
+				if (user._id) {
+					console.log(e);
+				} else {
+					uni.navigateTo({
+						url: `/pages/login/index`
+					})
+				}
 			},
 			// 监听用户是否登录
 			watchLogin() {
@@ -290,12 +308,6 @@
 		height: 100vh;
 
 		.one {
-			.one_1 {
-				text-align: center;
-				font-size: var(--font16Size);
-				font-weight: bold;
-				margin: 2vw 0;
-			}
 
 			.list {
 				display: flex;
@@ -326,6 +338,13 @@
 						margin: 0 0 1vw 0;
 					}
 
+					.specs {
+						display: flex;
+						justify-content: space-between;
+						color: var(--f85Color);
+						font-size: var(--font12Size);
+					}
+
 					.money {
 						color: var(--fFB1Color);
 						font-size: var(--font14Size);
@@ -340,8 +359,7 @@
 		}
 
 		.two {
-			margin: 4vw 0;
-			text-align: center;
+			margin: 4vw 0 0 0;
 
 			button {
 				margin: 0 2vw 2vw 2vw;

+ 56 - 46
pagesHome/order/detail.vue

@@ -110,12 +110,10 @@
 				<view class="two">
 					<view class="two_1">规格</view>
 					<view class="two_2">
-						<view class="two_2_1" v-for="(item,index) in specs" :key="index">
-							<text @click="toStyle(item,index)" :class="{ 'style': isActive==index}">{{item.name}}
-							</text>
-							<text @click="toGroup(item)">参团</text>
-						</view>
-					<!-- 	v-if="can_group=='0'" -->
+						<text v-for="(item,index) in specs" :key="index" @click="toStyle(item,index)"
+							:class="{ 'style': isActive==index}">{{item.name}}
+						</text>
+						<!-- 	<text class="group" v-if="item.can_group=='0'" @click="toGroup(item)">参团</text> -->
 					</view>
 				</view>
 				<view class="thr">
@@ -126,7 +124,10 @@
 					</view>
 					<text>库存{{max}}</text>
 				</view>
-				<view @click="toBuy(type)" class="button">{{type=='0'?'加入购物车':'立即购买'}}</view>
+				<view class="btn">
+					<view @click="toBuy(type)" class="button1">{{type=='0'?'加入购物车':'立即购买'}}</view>
+					<view @click="toGroup" class="button2">参团</view>
+				</view>
 			</view>
 		</uni-popup>
 	</mobile-frame>
@@ -146,11 +147,6 @@
 						route: 'pages/store/index',
 						normal: require('@/static/store.png'),
 					},
-					{
-						name: '周边',
-						route: 'pages/week/index',
-						normal: require('@/static/week.png'),
-					},
 					{
 						name: '购物车',
 						route: 'pages/market/index',
@@ -308,12 +304,24 @@
 				}
 			},
 			// 参团
-			toGroup(e) {
-				console.log(e);
+			toGroup() {
 				const that = this;
-				uni.navigateTo({
-					url: `/pagesHome/group/index?specs_id=${e._id}&goods_id=${that.id}`
-				})
+				if (that.Selected) {
+					let specs_id;
+					let specs = that.specs.find(i => i.name == that.Selected)
+					if (specs) specs_id = specs._id
+					uni.navigateTo({
+						url: `/pagesHome/group/index?specs_id=${specs_id}&goods_id=${that.id}`
+					})
+				} else {
+					uni.showModal({
+						title: '提示',
+						content: '请选择规格',
+						confirmColor: '#ff0000',
+						showCancel: false,
+						success: function(res) {}
+					});
+				}
 			},
 			//主菜单跳转
 			toPath(e) {
@@ -817,30 +825,17 @@
 
 			.two_2 {
 				padding: 1vw;
-				display: flex;
 
-				.two_2_1 {
-					display: flex;
-					flex-direction: column;
-					align-items: center;
-
-					text {
-						margin: 0 2vw 0 0;
-						padding: 1vw;
-						border-radius: 1vw;
-						background-color: var(--f9Color);
-					}
-
-					text:last-child {
-						margin: 1vw 0 0 0;
-						color: var(--mainColor);
-						background-color: #FFD700;
-					}
+				text {
+					margin: 0 2vw 0 0;
+					padding: 1vw;
+					border-radius: 1vw;
+					background-color: var(--f9Color);
+				}
 
-					.style {
-						color: var(--mainColor);
-						background-color: var(--ff0Color);
-					}
+				.style {
+					color: var(--mainColor);
+					background-color: var(--ff0Color);
 				}
 			}
 		}
@@ -862,15 +857,30 @@
 			}
 		}
 
-		.button {
+		.btn {
+			display: flex;
+			justify-content: space-between;
 			position: fixed;
-			width: 100vw;
-			padding: 4vw 0;
-			background-color: var(--fFB1Color);
 			bottom: 0;
-			text-align: center;
-			font-size: var(--font18Szie);
-			color: var(--mainColor);
+
+			.button1 {
+				width: 50vw;
+				padding: 4vw 0;
+				background-color: var(--fFB1Color);
+				text-align: center;
+				font-size: var(--font18Szie);
+				color: var(--mainColor);
+			}
+
+			.button2 {
+				width: 50vw;
+				padding: 4vw 0;
+				background-color: #FF8A18;
+				text-align: center;
+				font-size: var(--font18Szie);
+				color: var(--mainColor);
+			}
 		}
+
 	}
 </style>