zs 2 rokov pred
rodič
commit
d52e857b37

+ 287 - 185
pagesHome/order/components/specs_1.vue

@@ -1,151 +1,81 @@
 <template>
 	<view class="specs">
 		<!-- 规格 -->
-		<uni-popup ref="specShow" background-color="#fff" type="bottom" :is-mask-click="false">
-			<view class="popup">
-				<view class="close">
-					<text @click="toClose" class="iconfont icon-shanchu"></text>
-				</view>
-				<!-- 				<view class="info_1" v-if="popupShow=='1'">
-							<view class="info_1">
-								<scroll-view scroll-y="true" class="scroll-view">
-									<view class="list-scroll-view">
-										<view class="one">
-											<view class="one_1">
-												<view class="l">
-													<image class="image"
-														:src="specsInfo.file&&specsInfo.file.length>0?specsInfo.file[0].url:info.goods.file[0].url"
-														mode="aspectFill" @tap="diaView"></image>
-												</view>
-												<view class="r">
-													<view class="money">
-														<text v-if="specsInfo.leader_price"
-															class="money_2"><text>团长价¥</text>{{specsInfo.leader_price}}</text>
-														<text v-if="specsInfo.price"
-															class="money_1"><text>特价¥</text>{{specsInfo.price}}</text>
-														<text v-if="!specsInfo.price&&!specsInfo.leader_price"
-															class="money_1"><text>¥</text>{{specsInfo.sell_money}}</text>
-														<text class="money_1"><text>¥</text>{{specsInfo.flow_money}}</text>
-													</view>
-													<view class="other_1">
-														<text>已选:</text>
-														<text>{{specsInfo.name}}</text>
-													</view>
-													<view class="other_1">
-														<text>运费:</text>
-														<text>{{specsInfo.freight===0?'包邮':specsInfo.freight+'元'}}</text>
-													</view>
-												</view>
-											</view>
-											<view class="one_2">
-												<view class="one_2_1">
-													规格
-												</view>
-												<view class="one_2_2">
-													<view
-														:class="['list',is_specs!=index&&item.num>0?'list':is_specs!=index&&item.num<=0?'huilist':is_specs==index&&item.num>0?'redlist':is_specs==index&&item.num<=0?'huiilist':'list']"
-														v-for="(item,index) in info.specs" :key="index" @tap="toSpecs(item)">
-														<text>{{item.name}}</text>
-													</view>
-												</view>
-											</view>
-											<view class="one_3">
-												<view class="one_3_1">
-													<text>数量</text>
-												</view>
-												<view class="one_3_1">
-													<uni-number-box v-model="buy_num" @change="toCount" :min="1"
-														:max="specsInfo.num">
-													</uni-number-box>
-												</view>
-												<view class="one_3_1">
-													<text>库存{{specsInfo.num||0}}</text><text class="limit"
-														v-if="specsInfo.limit_num">({{specsInfo.buy_name||'暂无'}}{{specsInfo.limit_num||0}}个)</text>
-												</view>
-											</view>
-										</view>
-									</view>
-								</scroll-view>
-							</view> -->
-				<!-- <view class="info_2">
-								<view :class="[specsInfo.can_group=='0'?'btns':'btn']" v-if="btn_type=='0'">
-									<button :disabled="is_zero" :class="[is_zero?'btncolor':'']" @tap="toMarket">加入购物车</button>
-								</view>
-								<view :class="[specsInfo.can_group=='0'?'btns':'btn']" v-if="btn_type=='1'">
-									<button :disabled="is_zero" :class="[is_zero?'btncolor':'']" @tap="toBuy">立即购买</button>
+		<view class="specs_1" v-if="popupShow=='1'">
+			111
+		</view>
+		<view class="specs_2" v-else-if="popupShow=='2'">
+			222
+		</view>
+		<view class="specs_3" v-else>
+			333
+		</view>
+	</view>
+	<!-- 			<view class="info_3" v-else-if="popupShow=='2'">
+				<scroll-view scroll-y="true" class="scroll-view">
+					<view class="list" v-for="(item,index) in info.act" :key="index">
+						<view class="list_1" @tap="toAct(item)">
+							<view class="title_1">
+								<view class="l">
+									<text>{{item.tag||'暂无'}}</text>{{item.act_time.title}}
 								</view>
-								<view :class="[specsInfo.can_group=='0'?'btns':'btn']" v-if="specsInfo.can_group=='0'">
-									<button :disabled="is_zero" :class="[is_zero?'btncolor':'']" @tap="toGroup">我要开团</button>
+								<view class="r">
+									<text class="iconfont icon-jiantouyou"></text>
 								</view>
-							</view> -->
-			</view>
-			<!-- 				<view class="info_3" v-else-if="popupShow=='2'">
-							<scroll-view scroll-y="true" class="scroll-view">
-								<view class="list" v-for="(item,index) in info.act" :key="index">
-									<view class="list_1" @tap="toAct(item)">
-										<view class="title_1">
-											<view class="l">
-												<text>{{item.tag||'暂无'}}</text>{{item.act_time.title}}
-											</view>
-											<view class="r">
-												<text class="iconfont icon-jiantouyou"></text>
-											</view>
-										</view>
-										<view class="title_2">
-											<view class="text" v-if="item.type=='5'||item.type=='6'">{{item.text}}</view>
-											<view class="time">{{item.config.time_start}}-{{item.config.time_end}}</view>
+							</view>
+							<view class="title_2">
+								<view class="text" v-if="item.type=='5'||item.type=='6'">{{item.text}}</view>
+								<view class="time">{{item.config.time_start}}-{{item.config.time_end}}</view>
+							</view>
+							<view class="title_2" v-if="item.type=='2'">
+								<view class="specList" v-for="(tag,indexx) in item.list" :key="indexx">
+									<view class="name">规格:{{tag.spec_name}}</view>
+									<view class="giftList" v-for="(tags,indexs) in tag.gift" :key="indexs"
+										@tap.stop="tags.type=='0' && getDetail(tags)">
+										<view class="left">
+											<view class="goods">{{tags.goods_name}}{{tags.spec_name}}</view>
+											<view class="goods">{{tags.desc}}</view>
+											<view class="num">×{{tags.num}}</view>
 										</view>
-										<view class="title_2" v-if="item.type=='2'">
-											<view class="specList" v-for="(tag,indexx) in item.list" :key="indexx">
-												<view class="name">规格:{{tag.spec_name}}</view>
-												<view class="giftList" v-for="(tags,indexs) in tag.gift" :key="indexs"
-													@tap.stop="tags.type=='0' && getDetail(tags)">
-													<view class="left">
-														<view class="goods">{{tags.goods_name}}{{tags.spec_name}}</view>
-														<view class="goods">{{tags.desc}}</view>
-														<view class="num">×{{tags.num}}</view>
-													</view>
-													<view class="right"><text class="iconfont icon-jiantouyou"></text>
-													</view>
-												</view>
-											</view>
+										<view class="right"><text class="iconfont icon-jiantouyou"></text>
 										</view>
 									</view>
 								</view>
-							</scroll-view>
-						</view> -->
-			<!-- 				<view class="info_4" v-else>
-							<view class="info_4">
-								<scroll-view scroll-y="true" class="scroll-view">
-									<view class="list-scroll-view">
-										<view class="list" v-for="(item,index) in info.sets" :key="index">
-											<view class="name"><text class="set">套装</text>{{item.name}}</view>
-											<view class="set">
-												<view class="set_1" v-for="(tag,indexx) in item.set" :key="indexx"
-													@tap="toDeatil(tag)">
-													<image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''"
-														mode="aspectFit">
-													</image>
-													<view class="goods textOver">{{tag.goods_name}}</view>
-													<view class="spec textOver">{{tag.spec_name}}</view>
-												</view>
-											</view>
-											<view class="bottom">
-												<view class="money">
-													共{{item.goods_total||0}}件,套装价:<text>¥{{item.sell_money||0}}</text>
-												</view>
-												<view class="add">
-													<button size="mini" @tap="toSetMarket(item)">加入购物车</button>
-												</view>
-											</view>
-										</view>
+							</view>
+						</view>
+					</view>
+				</scroll-view>
+			</view>
+			<view class="info_4" v-else>
+				<view class="info_4">
+					<scroll-view scroll-y="true" class="scroll-view">
+						<view class="list-scroll-view">
+							<view class="list" v-for="(item,index) in info.sets" :key="index">
+								<view class="name"><text class="set">套装</text>{{item.name}}</view>
+								<view class="set">
+									<view class="set_1" v-for="(tag,indexx) in item.set" :key="indexx"
+										@tap="toDeatil(tag)">
+										<image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''"
+											mode="aspectFit">
+										</image>
+										<view class="goods textOver">{{tag.goods_name}}</view>
+										<view class="spec textOver">{{tag.spec_name}}</view>
+									</view>
+								</view>
+								<view class="bottom">
+									<view class="money">
+										共{{item.goods_total||0}}件,套装价:<text>¥{{item.sell_money||0}}</text>
 									</view>
-								</scroll-view>
+									<view class="add">
+										<button size="mini" @tap="toSetMarket(item)">加入购物车</button>
+									</view>
+								</view>
 							</view>
-						</view> -->
-	</view>
-	</uni-popup>
-	<!-- 		<view class="dialog" v-if="dialog.show==true" @tap="dialogClose">
+						</view>
+					</scroll-view>
+				</view>
+			</view> -->
+	<!-- <view class="dialog" v-if="dialog.show==true" @tap="dialogClose">
 				<view class="dialog_1" v-if="dialog.type=='1'">
 					<swiper class="swiper" circular @change="diaSpecs" :current="is_specs">
 						<swiper-item class="list" v-for="(item,index) in info.specs" :key="index">
@@ -161,7 +91,6 @@
 					</swiper>
 				</view>
 			</view> -->
-	</view>
 </template>
 
 <script>
@@ -170,31 +99,78 @@
 			goodsInfo: {
 				type: Object,
 			},
-			goodsColect: {
-				type: Boolean
-			}
+			specsInfo: {
+				type: Object,
+			},
+			btn_type: {
+				type: String
+			},
+			popupShow: {
+				type: String
+			},
+			is_specs: {
+				type: Number
+			},
 		},
 		data() {
 			return {
-				// 图片
-				fileList: [],
-				// 活动
-				acttagsList: [],
+				// 商品图片
+				goodsfileList: [],
+				// 规格图片
+				specfileList: [],
 			};
 		},
 		methods: {
-			toGoodscolect() {
+			diaView() {
 				const that = this;
-				that.$emit('toGoodscolect')
-			}
+				that.$emit('diaView')
+			},
+			toSpecs(item) {
+				const that = this;
+				that.$emit('diaView', item)
+			},
+			toCount() {
+				const that = this;
+				that.$emit('toCount')
+			},
+			toMarket() {
+				const that = this;
+				that.$emit('toMarket')
+			},
+			toBuy() {
+				const that = this;
+				that.$emit('toBuy')
+			},
+			toGroup() {
+				const that = this;
+				that.$emit('toGroup')
+			},
+			toAct(item) {
+				const that = this;
+				that.$emit('toAct', item)
+			},
+			getDetail(item) {
+				const that = this;
+				that.$emit('getDetail', item)
+			},
+			toSetMarket(item) {
+				const that = this;
+				that.$emit('toSetMarket', item)
+			},
 		},
 		watch: {
+			specsInfo: {
+				deep: true,
+				immediate: true,
+				handler(val) {
+					if (val && val.file.length > 0) this.$set(this, `specfileList`, val.file)
+				}
+			},
 			goodsInfo: {
 				deep: true,
 				immediate: true,
 				handler(val) {
-					if (val && val.file.length > 0) this.$set(this, `fileList`, val.file)
-					if (val && val.act_tags.length > 0) this.$set(this, `acttagsList`, val.act_tags)
+					if (val && val.file.length > 0) this.$set(this, `goodsfileList`, val.file)
 				}
 			}
 		},
@@ -202,54 +178,180 @@
 </script>
 
 <style lang="scss">
-	.banner {
-		.banner_1 {
+	.specs {
+		.specs_1 {
+			position: relative;
+			display: flex;
+			flex-direction: column;
+			height: 54vh;
 
-			border-bottom: 0.5vw solid var(--f9Color);
+			.info_1 {
+				position: relative;
+				flex-grow: 1;
 
-			swiper {
-				height: 44vh !important;
-			}
+				.one {
+					padding: 2vw;
 
-			.list {
-				border-radius: 5px;
+					.one_1 {
+						display: flex;
+						margin: 0 0 2vw 0;
+						padding: 0 0 2vw 0;
+						border-bottom: 0.5vw solid var(--f9Color);
 
-				.image {
-					width: 100%;
-					height: 100%;
-					border-radius: 5px;
-					background-color: #fff;
+						.l {
+							width: 25vw;
+							height: 25vw;
+
+							.image {
+								width: 100%;
+								height: 100%;
+								border-radius: 5px;
+							}
+						}
+
+						.r {
+							width: 70vw;
+							padding: 0 0 0 2vw;
+
+							.money {
+
+								margin: 0 0 2vw 0;
+
+								.money_2 {
+									color: #23B67A;
+									font-size: 20px;
+									padding: 0 1vw 0 0;
+									font-weight: bold;
+
+									text {
+										font-size: 14px;
+									}
+								}
+
+								.money_1 {
+									font-size: 20px;
+									color: #ff0000;
+									padding: 0 2vw 0 0;
+
+									text {
+										font-size: 14px;
+									}
+								}
+
+								.money_1:last-child {
+									font-size: 16px;
+									color: #858585;
+									text-decoration: line-through;
+
+								}
+							}
+
+							.other_1 {
+								font-size: 15px;
+								color: #858585;
+
+								text:last-child {
+									color: #000000;
+								}
+							}
+						}
+					}
+
+					.one_2 {
+						margin: 0 0 2vw 0;
+						border-bottom: 0.5vw solid var(--f9Color);
+
+						.one_2_1 {
+							font-size: 14px;
+							margin: 0 0 2vw 0;
+						}
+
+						.one_2_2 {
+							display: flex;
+							flex-wrap: wrap;
+
+							.list {
+								background-color: #F5F5F5;
+								margin: 0 2vw 2vw 0;
+								padding: 0.5vw 1vw;
+								border-radius: 5px;
+
+								text {
+									font-size: 14px;
+									color: #000;
+								}
+							}
+
+							.huilist {
+								background-color: #DCDCDC;
+
+								text {
+									color: #858585;
+								}
+							}
+
+							.redlist {
+								background-color: #ff0000;
+
+								text {
+									color: #ffffff;
+								}
+							}
+
+							.huiilist {
+								background-color: #808080;
+
+								text {
+									color: #cccccc;
+								}
+							}
+						}
+					}
+
+					.one_3 {
+						display: flex;
+
+						.one_3_1 {
+							margin: 0 2vw 0 0;
+
+							text {
+								font-size: 14px;
+								color: #858585;
+							}
+
+							.limit {
+								color: #ff0000;
+								padding: 0 0 0 2vw;
+							}
+						}
+					}
 				}
 			}
 
-			.goodsColect {
-				position: fixed;
-				top: 2vw;
-				right: 3vw;
-				z-index: 99;
-				background-color: #858585;
-				border-radius: 90px;
+			.info_2 {
+				display: flex;
+				text-align: center;
+				justify-content: space-between;
 
-				text {
-					font-size: 30px;
+				.btns {
+					width: 50vw;
 				}
-			}
 
-			.acttags {
-				position: absolute;
-				top: 1vw;
-				left: 1vw;
-				width: 97%;
+				.btn {
+					width: 100vw;
+				}
 
-				text {
-					display: inline-block;
-					background-color: #ff0000;
+				button {
+					width: 100%;
+					border-radius: 0;
+					background-color: var(--fFB1Color);
 					color: #fff;
-					border-radius: 1vw;
-					padding: 0.5vw;
-					font-size: 12px;
+					border: 1px solid #f1f1f1;
+				}
 
-					margin: 0 1vw 0 0;
+				.btncolor {
+					background: #f1f1f1;
+					color: #858585;
 				}
 			}
 		}

+ 68 - 1
pagesHome/order/detail.vue

@@ -137,7 +137,17 @@
 			</view>
 		</view>
 		<!-- 规格 -->
-		<specs_1></specs_1>
+		<uni-popup ref="specShow" background-color="#fff" type="bottom" :is-mask-click="false">
+			<view class="popup">
+				<view class="close">
+					<text @click="toClose" class="iconfont icon-shanchu"></text>
+				</view>
+				<specs_1 :goodsInfo="info.goods" :specsInfo="specsInfo" :btn_type="btn_type" :popupShow="popupShow"
+					:is_specs="is_specs" @diaView="diaView" @toSpecs="toSpecs" @toCount="toCount" @toMarket="toMarket"
+					@toBuy="toBuy" @toGroup="toGroup">
+				</specs_1>
+			</view>
+		</uni-popup>
 	</mobile-frame>
 </template>
 
@@ -564,6 +574,47 @@
 					})
 				}
 			},
+			// 加入购物车
+			async toMarket() {
+				const that = this;
+				let user = that.user;
+				let info = that.info;
+				let specsInfo = that.specsInfo;
+				if (user && user._id) {
+					let obj = {
+						customer: user._id,
+						shop: info.shop._id,
+						goods: info.goods._id,
+						goodsSpec: specsInfo._id,
+						num: that.buy_num,
+						inviter: that.inviter
+					}
+					let res = await that.$api(`/cart`, 'POST', obj)
+					if (res.errcode == '0') {
+						uni.showToast({
+							title: `加入购物车成功`,
+							icon: 'none'
+						})
+						that.toClose();
+					} else {
+						uni.showToast({
+							title: res.errmsg,
+							icon: 'none'
+						})
+					}
+				} else {
+					uni.navigateTo({
+						url: `/pages/login/index`
+					})
+				}
+			},
+			// 开团
+			toGroup() {
+				const that = this;
+				uni.navigateTo({
+					url: `/pagesHome/group/index?shop=${that.info?.shop?._id}&goods=${that.id}`
+				})
+			},
 			// 店铺,购物车
 			toNavleft(e) {
 				const that = this;
@@ -926,4 +977,20 @@
 			border-bottom: none;
 		}
 	}
+
+	.uni-popup {
+		z-index: 9999 !important;
+	}
+
+	.popup {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 60vh;
+
+		.close {
+			text-align: right;
+			padding: 2vw;
+		}
+	}
 </style>

+ 16 - 14
pagesMy/order/info.vue

@@ -265,20 +265,22 @@
 				const that = this;
 				let res;
 				// 待付款
-				if (that.id && that.status == '0') {
-					res = await that.$api(`/order/${that.id}`);
-				} else {
-					res = await that.$api(`/orderDetail/${that.id}`);
-				}
-				if (res.errcode == '0') {
-					let status = that.statusList.find(i => i.value == res.data.status)
-					if (status) res.data.zhStatus = status.label;
-					// 运费总数和商品总数相加
-					let total = 0;
-					for (let val of res.data?.total_detail) total = this.$plus(total, val.money)
-					res.data.goods_total = total
-					that.$set(that, `info`, res.data);
-					uni.hideLoading();
+				if (that.id) {
+					if (that.status == '0') {
+						res = await that.$api(`/order/${that.id}`);
+					} else {
+						res = await that.$api(`/orderDetail/${that.id}`);
+					}
+					if (res.errcode == '0') {
+						let status = that.statusList.find(i => i.value == res.data.status)
+						if (status) res.data.zhStatus = status.label;
+						// 运费总数和商品总数相加
+						let total = 0;
+						for (let val of res.data?.total_detail) total = this.$plus(total, val.money)
+						res.data.goods_total = total
+						that.$set(that, `info`, res.data);
+						uni.hideLoading();
+					}
 				}
 			},
 			// 查询其他信息