zs 2 éve
szülő
commit
7de0897692
4 módosított fájl, 251 hozzáadás és 81 törlés
  1. 61 33
      pages/market/index.vue
  2. 18 35
      pagesMy/logistics/index.vue
  3. 57 8
      pagesMy/order/index.vue
  4. 115 5
      pagesMy/order/info.vue

+ 61 - 33
pages/market/index.vue

@@ -32,37 +32,35 @@
 										<checkbox :value="item._id" :checked="item.check">
 											优惠套装---{{item.name||'暂无名称'}}</checkbox>
 									</view>
-									<checkbox-group name="checkbox" @change="goodsChange">
-										<view class="content" v-for="gs in item.goods" :key="gs.goodsSpec_id">
-											<view class="img">
-												<image :src="getFile(gs)"></image>
+									<view class="content" v-for="(gs,indexx) in item.goods" :key="indexx">
+										<view class="img">
+											<image :src="getFile(gs)"></image>
+										</view>
+										<view class="one_1" @click="toCommon('/pagesHome/order/detail',gs)">
+											<view class="name"><text class="set">套装</text> {{gs.goods_name}}
 											</view>
-											<view class="one_1" @click="toCommon('/pagesHome/order/detail',gs)">
-												<view class="name"><text class="set">套装</text> {{gs.goods_name}}
-												</view>
-												<view class="info">
-													<view class="title_1" v-if="gs.spec_name">
-														<text>规格:{{gs.spec_name}}</text>
-													</view>
+											<view class="info">
+												<view class="title_1" v-if="gs.spec_name">
+													<text>规格:{{gs.spec_name}}</text>
 												</view>
 											</view>
-											<view class="money">
-												<view>{{gs.set_num}}件/套x{{gs.set_num}}</view>
-											</view>
 										</view>
-										<view class="total">
-											<view class="total_1"> <text>套装价</text>¥{{item.sell_money||0}} </view>
-											<view class="total_2">
-												<view class="num">
-													<uni-number-box @change="changeValue(item)" name="num" value="item"
-														:min="1" v-model="item.num" />
-												</view>
-												<view class="del">
-													<text class="iconfont icon-del-copy" @click="toDel(item)"></text>
-												</view>
+										<view class="money">
+											<view>{{gs.set_num}}件/套x{{gs.set_num}}</view>
+										</view>
+									</view>
+									<view class="total">
+										<view class="total_1"> <text>套装价</text>¥{{item.sell_money||0}} </view>
+										<view class="total_2">
+											<view class="num">
+												<uni-number-box @change="changeValue(item)" name="num" value="item"
+													:min="1" v-model="item.num" />
+											</view>
+											<view class="del">
+												<text class="iconfont icon-del-copy" @click="toDel(item)"></text>
 											</view>
 										</view>
-									</checkbox-group>
+									</view>
 								</view>
 								<view class="list_2" v-else>
 									<view class="title">
@@ -206,8 +204,9 @@
 				} = e.detail;
 				for (const p1 of list) {
 					let p2;
-					if (p1._id) p2 = value.find((i) => i == p1._id);
-					if (p1.shop) p2 = value.find((i) => i == p1.shop);
+					// 判断是套装还是正常商品
+					if (p1.is_set == '0') p2 = value.find((i) => i == p1._id);
+					else p2 = value.find((i) => i == p1.shop);
 					let a = p2 ? true : false;
 					p1.check = a;
 					for (let s of p1.goods) {
@@ -284,6 +283,7 @@
 				const that = this;
 				this.$nextTick(async () => {
 					let res;
+					// 判断是套装还是正常商品
 					if (value.is_set == '0') {
 						const {
 							_id: set_id,
@@ -328,6 +328,8 @@
 			// 删除, 接口,购物车删除,然后将该数据移除
 			async toDel(e) {
 				let list = this.list;
+				let set_list = [];
+				let goods_list = [];
 				uni.showModal({
 					title: '提示',
 					content: '请选择要删除的商品',
@@ -336,27 +338,50 @@
 						if (e?.cart_id) {
 							const result = await this.$api(`/cart/${e.cart_id}`, 'Delete');
 							if (result.errcode === 0) {
-								list = list.map(i => ({
+								// 判断是套装还是正常商品
+								set_list = list.filter(i => i.is_set == '0')
+								goods_list = list.filter(i => i.is_set !== '0')
+								set_list = set_list.filter(i => i.cart_id !== e.cart_id)
+								goods_list = goods_list.map(i => ({
 									...i,
 									goods: i.goods.filter(f => f.cart_id !== e.cart_id)
 								}))
-								this.$set(this, `list`, list);
+								this.$set(this, `list`, [...set_list, ...goods_list]);
 								// 检查店铺内是否还有商品
 								this.checkShopGoodsExist();
 								// 计算总额
 								this.countMoney();
 							}
 						} else {
-							const goodsList = list.map(i => i.goods).flat();
-							const cartIds = goodsList.filter(i => i.check).map(i => i.cart_id)
+							let goodsList = [];
+							let cartIds = [];
+							for (let val of this.list) {
+								// 判断是套装还是正常商品
+								if (val.is_set == '0') goodsList.push(val)
+								else goodsList.push(val.goods)
+							}
+							for (let val of goodsList) {
+								// 判断是套装还是正常商品
+								if (val.is_set == '0') {
+									if (val.check) cartIds.push(val.cart_id)
+								} else {
+									for (let set of val) {
+										if (set.check) cartIds.push(set.cart_id)
+									}
+								}
+							}
+							set_list = list.filter(i => i.is_set == '0')
+							goods_list = list.filter(i => i.is_set !== '0')
 							for (let val of cartIds) {
 								const result = await this.$api(`/cart/${val}`, 'Delete');
 								if (result.errcode === 0) {
-									list = list.map(i => ({
+									// 判断是套装还是正常商品
+									set_list = set_list.filter(i => i.cart_id !== val)
+									goods_list = goods_list.map(i => ({
 										...i,
 										goods: i.goods.filter(f => f.cart_id !== val)
 									}))
-									this.$set(this, `list`, list);
+									this.$set(this, `list`, [...set_list, ...goods_list]);
 									// 检查店铺内是否还有商品
 									this.checkShopGoodsExist();
 									// 计算总额
@@ -381,6 +406,7 @@
 				// 渲染结束执行下面方法
 				that.$nextTick(() => {
 					for (const val of list) {
+						// 判断是套装还是正常商品
 						if (val.is_set == '0') {
 							if (val.check == true) {
 								let total = that.$multiply(val.sell_money, val.num);
@@ -409,10 +435,12 @@
 				let goodsList = [];
 				let cartIds = [];
 				for (let val of this.list) {
+					// 判断是套装还是正常商品
 					if (val.is_set == '0') goodsList.push(val)
 					else goodsList.push(val.goods)
 				}
 				for (let val of goodsList) {
+					// 判断是套装还是正常商品
 					if (val.is_set == '0') {
 						if (val.check) cartIds.push(val.cart_id)
 					} else {

+ 18 - 35
pagesMy/logistics/index.vue

@@ -4,32 +4,7 @@
 			<!-- 已收货查看选择商品物流 -->
 			<view class="first" v-if="type == 'order'">
 				<view class="first_1">
-					<picker class="picker" mode="selector" :range="info.goods" @change="goodsChange"
-						range-key="goods_name">
-						<view>{{goods_name||'请选择查看物流的商品'}}</view>
-					</picker>
-				</view>
-				<view class="first_2" v-if="goods_name">
-					<image class="image" :src="goods.goods_file&&goods.goods_file.length>0?goods.goods_file[0].url:''"
-						mode="">
-						<view class="other">
-							<view class="name textOver">
-								{{goods.goods_name}}
-							</view>
-							<view class="other_1 textOver">
-								<text>规格:</text>
-								<text>{{goods.name}}</text>
-							</view>
-							<view class="other_1 textOver">
-								<text>金额:</text>
-								<text>¥{{info.type=='0'?goods.price||goods.sell_money:goods.group_config.money}}</text>
-							</view>
-							<view class="other_1 textOver">
-								<text>数量:</text>
-								<text>×{{goods.buy_num}}</text>
-							</view>
-						</view>
-					</image>
+					<tabs :tabs="goodstabs" @tabsChange="goodstabsChange"></tabs>
 				</view>
 			</view>
 			<!-- 售后,尊荣商品查看物流 -->
@@ -72,13 +47,16 @@
 				// 类型
 				type: '',
 				// 商品选择
-				goods_name: '',
 				goods: {},
 				// 标签页
 				tabs: {
 					active: '',
 					menu: []
 				},
+				goodstabs: {
+					active: '',
+					menu: []
+				},
 				user: {},
 				info: {},
 				is_check: '',
@@ -138,12 +116,16 @@
 					}
 					if (res.errcode == '0') {
 						if (that.type == 'order') {
-							for (let val of res.data.goods) {
-								val.goods_name = val.goods.name;
-								val.goods_file = val.goods.file;
+							for (let [index, val] of res.data.goods.entries()) {
+								let num = index + 1
+								val.title = `物流` + num;
+								val.active = val.goods._id;
 							}
+							that.$set(that.tabs, `active`, res.data.goods[0].goods._id)
+							that.$set(that.goodstabs, `menu`, res.data.goods)
 						}
 						that.$set(that, `info`, res.data);
+						if (that.type == 'order') that.goodstabsChange(res.data.goods[0].goods._id, '1')
 						if (that.type != 'order') that.search();
 					} else {
 						uni.showToast({
@@ -266,14 +248,15 @@
 				}
 			},
 			// 选择指定商品查信息
-			async goodsChange(e) {
+			async goodstabsChange(e, type) {
 				const that = this;
-				let data = that.info.goods[e.detail.value];
-				that.$set(that, `goods`, data);
-				that.$set(that, `goods_name`, data.goods_name);
+				let active = '';
+				if (type == '1') active = e
+				else active = e.active
+				that.$set(that.goodstabs, `active`, active)
 				let res = await that.$api(`/orderDetail/sot`, `POST`, {
 					id: that.info._id,
-					goods_id: data._id
+					goods_id: active
 				});
 				if (res.errcode == '0') {
 					for (let [index, item] of res.data.entries()) {

+ 57 - 8
pagesMy/order/index.vue

@@ -14,7 +14,12 @@
 										<view class="goods">
 											<view class="goodsList" v-for="(tag,indexs) in item.goods" :key="indexs">
 												<view class="shopname">
-													<view class="shop">
+													<view class="shop" v-if="tag.is_set=='0'">
+														<view class="r">
+															<text class="set">套装</text> {{tag.name}}
+														</view>
+													</view>
+													<view class="shop" v-else>
 														<text class="iconfont icon-shangdian"></text>
 														<text>{{tag.shop_name}}</text>
 													</view>
@@ -34,13 +39,20 @@
 															<view class="goodsname textOver">
 																{{tags.goods.name}}
 															</view>
-															<view class="specs">
+															<view class="specs" v-if="tag.is_set=='0'">
+																{{tags.spec_name}}
+															</view>
+															<view class="specs" v-else>
 																{{tags.name}}
 															</view>
 															<text v-if="tags.gift.length>0" class="gift">赠品</text>
 															<text v-if="tags.sp_price" class="act">特价</text>
 														</view>
-														<view class="market_3">
+														<view class="market_3" v-if="tag.is_set=='0'">
+															<view class="price">{{tags.set_num}}件/套x{{tags.set_num}}
+															</view>
+														</view>
+														<view class="market_3" v-else>
 															<view v-if="item.type=='0'" class="price">
 																¥{{tags.price||tags.sell_money}}
 															</view>
@@ -62,7 +74,12 @@
 									</view>
 									<view class="list_2" v-else>
 										<view class="list_2_1">
-											<view class="shopname">
+											<view class="shopname" v-if="item.is_set=='0'">
+												<view class="r">
+													<text class="set">套装</text> {{tag.name}}
+												</view>
+											</view>
+											<view class="shopname" v-else>
 												<text class="iconfont icon-shangdian"></text>
 												<text>{{item.shop.name}}</text>
 											</view>
@@ -79,13 +96,20 @@
 													<view class="goodsname textOver">
 														{{tag.goods.name}}
 													</view>
-													<view class="specs">
+													<view class="specs" v-if="item.is_set=='0'">
+														{{tag.spec_name}}
+													</view>
+													<view class="specs" v-else>
 														{{tag.name}}
 													</view>
 													<text v-if="tag.gift.length>0" class="gift">赠品</text>
 													<text v-if="tag.sp_price" class="act">特价</text>
 												</view>
-												<view class="goods_3">
+												<view class="goods_3" v-if="item.is_set=='0'">
+													<view class="price">{{tags.set_num}}件/套x{{tags.set_num}}
+													</view>
+												</view>
+												<view class="goods_3" v-else>
 													<view v-if="item.type=='0'" class="price">
 														¥{{tag.price||tag.sell_money}}
 													</view>
@@ -106,7 +130,8 @@
 									<view class="btn">
 										<button v-if="item.status=='0'" size="mini"
 											@tap.stop="toCancel(item)">取消订单</button>
-										<button v-if="item.status=='0'" :disabled="disabled" size="mini" @tap.stop="toPay(item)">支付</button>
+										<button v-if="item.status=='0'" :disabled="disabled" size="mini"
+											@tap.stop="toPay(item)">支付</button>
 										<button v-if="item.status=='1'&&item.is_afterSale!=true" size="mini"
 											@tap.stop="toCancels(item)">取消订单</button>
 										<button v-if="item.status=='2'||item.status=='3'||item.status=='2-'" size="mini"
@@ -162,7 +187,7 @@
 				scrollTop: 0,
 				// 字典表
 				statusList: [],
-				disabled:false
+				disabled: false
 			};
 		},
 		onLoad: function(e) {
@@ -584,6 +609,18 @@
 										text:last-child {
 											padding: 0 0 0 2vw;
 										}
+
+										.r {
+											.set {
+												margin: 0 1vw 0 0;
+												font-size: 12px;
+												border-radius: 5px;
+												padding: 0 1vw;
+												color: #ffffff;
+												background-color: #FF6347;
+												border: 1px solid #FFA500;
+											}
+										}
 									}
 
 									.status {
@@ -677,6 +714,18 @@
 								text:last-child {
 									padding: 0 0 0 2vw;
 								}
+
+								.r {
+									.set {
+										margin: 0 1vw 0 0;
+										font-size: 12px;
+										border-radius: 5px;
+										padding: 0 1vw;
+										color: #ffffff;
+										background-color: #FF6347;
+										border: 1px solid #FFA500;
+									}
+								}
 							}
 
 							.status {

+ 115 - 5
pagesMy/order/info.vue

@@ -27,7 +27,12 @@
 							</view>
 							<view class="two_1" v-if="info.status=='0'">
 								<view class="list" v-for="(item,index) in info.goods" :key="index">
-									<view class="list_1">
+									<view class="list_1" v-if="item.is_set=='0'">
+										<view class="r">
+											<text class="set">套装</text> {{item.name}}
+										</view>
+									</view>
+									<view class="list_1" v-else>
 										<text class="iconfont icon-shangdian"></text>
 										<text>{{item.shop_name}}</text>
 									</view>
@@ -41,7 +46,10 @@
 												</view>
 												<view class="goodsname">
 													{{tag.goods.name}}
-													<view class="specs">
+													<view class="specs" v-if="item.is_set=='0'">
+														{{tag.spec_name}}
+													</view>
+													<view class="specs" v-else>
 														{{tag.name}}
 													</view>
 													<view class="other">
@@ -49,7 +57,10 @@
 														<text v-if="tag.sp_price" class="act">特价</text>
 													</view>
 												</view>
-												<view class="goodsother">
+												<view class="goodsother" v-if="item.is_set=='0'">
+													<view class="price">{{tag.set_num}}件/套x{{tag.set_num}}</view>
+												</view>
+												<view class="goodsother" v-else>
 													<view v-if="info.type=='0'" class="price">
 														¥{{tag.price||tag.sell_money}}
 													</view>
@@ -75,7 +86,10 @@
 														说明:{{tags.desc}}
 													</view>
 												</view>
-												<view class="right">
+												<view class="right" v-if="item.is_set=='0'">
+													<view class="price">{{tags.set_num}}件/套x{{tags.set_num}}</view>
+												</view>
+												<view class="right" v-else>
 													<view class="price">
 														¥{{tags.money||0}}
 													</view>
@@ -86,6 +100,10 @@
 											</view>
 										</view>
 									</view>
+									<view class="list_3" v-if="item.is_set=='0'">
+										<view class="list_3_1">单价:¥{{item.sell_money}}</view>
+										<view class="list_3_2">数量:×{{item.buy_num}}</view>
+									</view>
 								</view>
 							</view>
 							<view class="two_2" v-else>
@@ -95,7 +113,32 @@
 								</view>
 								<view class="list_2">
 									<view class="goods" v-for="(item,index) in info.goods" :key="index">
-										<view class="goods_1">
+										<view class="set_name" v-if="item.is_set=='0'">
+											<view class="r">
+												<text class="set">套装</text> {{item.name||'暂无'}}
+											</view>
+										</view>
+										<view v-if="item.is_set=='0'">
+											<view class="goods_1" v-for="(tag,indexc) in item.goods" :key="indexc">
+												<view class="url">
+													<image class="image"
+														:src="tag.file&&tag.file.length>0?tag.file[0].url:tag.goods.file[0].url"
+														mode="">
+													</image>
+												</view>
+												<view class="goodsname">
+													{{tag.goods.name}}
+													<view class="specs">
+														{{tag.spec_name}}
+													</view>
+												</view>
+												<view class="goodsother">
+													<view class="price">{{tag.set_num}}件/套x{{tag.set_num}}
+													</view>
+												</view>
+											</view>
+										</view>
+										<view class="goods_1" v-else>
 											<view class="url">
 												<image class="image"
 													:src="item.file&&item.file.length>0?item.file[0].url:item.goods.file[0].url"
@@ -147,6 +190,10 @@
 												</view>
 											</view>
 										</view>
+										<view class="goods_4" v-if="item.is_set=='0'">
+											<view class="goods_4_1">单价:¥{{item.sell_money}}</view>
+											<view class="goods_4_2">数量:×{{item.buy_num}}</view>
+										</view>
 									</view>
 								</view>
 							</view>
@@ -321,6 +368,18 @@
 							text:last-child {
 								padding: 0 0 0 2vw;
 							}
+
+							.r {
+								.set {
+									margin: 0 1vw 0 0;
+									font-size: 12px;
+									border-radius: 5px;
+									padding: 0 1vw;
+									color: #ffffff;
+									background-color: #FF6347;
+									border: 1px solid #FFA500;
+								}
+							}
 						}
 
 						.list_2 {
@@ -412,6 +471,23 @@
 								}
 							}
 						}
+
+						.list_3 {
+							display: flex;
+							justify-content: space-between;
+							margin: 0 0 2vw 0;
+							padding: 2vw 0;
+
+							.list_3_1 {
+								font-size: var(--font16Size);
+								color: var(--f85Color);
+							}
+
+							text {
+								padding: 0 1vw 0 0;
+								font-size: var(--font20Szie);
+							}
+						}
 					}
 				}
 
@@ -433,6 +509,22 @@
 							border-bottom: 1px dashed #f1f1f1;
 							padding: 2vw 0;
 
+							.set_name {
+								padding: 2vw;
+
+								.r {
+									.set {
+										margin: 0 1vw 0 0;
+										font-size: 12px;
+										border-radius: 5px;
+										padding: 0 1vw;
+										color: #ffffff;
+										background-color: #FF6347;
+										border: 1px solid #FFA500;
+									}
+								}
+							}
+
 							.goods_1 {
 								display: flex;
 
@@ -512,6 +604,24 @@
 									}
 								}
 							}
+
+							.goods_4 {
+								display: flex;
+								justify-content: space-between;
+								border-bottom: 0.1vw solid var(--fcColor);
+								margin: 0 0 2vw 0;
+								padding: 2vw 0;
+
+								.goods_4_1 {
+									font-size: var(--font16Size);
+									color: var(--f85Color);
+								}
+
+								text {
+									padding: 0 1vw 0 0;
+									font-size: var(--font20Szie);
+								}
+							}
 						}
 					}
 				}