py 2 anni fa
parent
commit
b9f1f63e19
4 ha cambiato i file con 263 aggiunte e 8 eliminazioni
  1. 4 2
      api/group.js
  2. 79 0
      pages-buy/group-goods-info.vue
  3. 172 4
      pages-buy/group-shop.vue
  4. 8 2
      pages.json

+ 4 - 2
api/group.js

@@ -6,8 +6,10 @@ export const groupShop = (data) => request(newsUrl + 'shop', 'post', { ...data }
 // 获取团购商家详情
 export const groupShopInfo = (data) => request(newsUrl + 'shop_info', 'post', { ...data },false)
 // 获取团购商品列表
-export const groupLists = (data) => request(newsUrl + 'lists', 'post', { ...data },false)
+export const groupList = (data) => request(newsUrl + 'list', 'post', { ...data },false)
 // 获取团购商品详情
 export const groupInfo = (data) => request(newsUrl + 'info', 'post', { ...data },false)
 // 下单
-export const groupCreate = (data) => request(newsUrl + 'create', 'post', { ...data },false)
+export const groupCreate = (data) => request(newsUrl + 'create', 'post', { ...data },false)
+// 获取顶部团购商品列表
+export const groupIndexGoods = (data) => request(newsUrl + 'index_goods', 'post', { ...data },false)

+ 79 - 0
pages-buy/group-goods-info.vue

@@ -0,0 +1,79 @@
+<template>
+	<view class="">
+		<Nav :title="shop_name" :bgckgroundBox='"transparent"' leftIconColor="#333" titleColor="#333"></Nav>
+		<view class="sift-box p-12-24 box-border-box align-items-center">
+			<view class="flex-1 align-items-center">
+				<view class="max-w-200">
+					
+				</view>
+			</view>
+			<uni-icons type="bars" size="22"></uni-icons>
+		</view>
+		<scroll-view :scroll-y="true" class="flex-common-css">
+			
+		</scroll-view>
+	</view>
+</template>
+
+<script>
+	import {
+		groupInfo,
+		groupIndexGoods
+	} from '@/api/group.js'
+	export default {
+		components: {},
+		data() {
+			return {
+				shop_id: '',
+				gooods_id: '',
+				shop_name: '',
+				goods_info: {},
+				sift_data: [],
+				sift_id: 0
+			};
+		},
+		onLoad(data) {
+			if (data) {
+				this.shop_id = data.shop_id
+				this.gooods_id = data.gooods_id
+				this.shop_name = data.shop_name
+				this.groupInfo()
+				this.groupIndexGoods()
+			}
+			// console.log(data);
+		},
+		mounted() {},
+		methods: {
+			groupIndexGoods() {
+				groupIndexGoods({shop_id: this.shop_id}).then((res) => {
+					if(res.code === 1) {
+						this.sift_data = res.data
+					}
+				})
+			},
+			groupInfo() {
+				groupInfo({
+					shop_id: this.shop_id,
+					id: this.gooods_id
+				}).then((res) => {
+					if (res.code === 1) {
+						this.goods_info = res.data
+					}
+				})
+			}
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+.box-b{
+	width: 100%;
+	height: 100vh;
+	background: orangered;
+}
+.max-w-200{
+	max-width: 200rpx;
+	background: rebeccapurple;
+	margin-right: 15rpx;
+}
+</style>

+ 172 - 4
pages-buy/group-shop.vue

@@ -27,10 +27,85 @@
 					</swiper-item>
 				</swiper>
 			</view>
-			<view class="shop-box p-24 box-border-box bgc-f">
-				<view class="fs-38 fw-600 fc-3 letter-spacing-6">
+			<view class="shop-box p-24 box-border-box">
+				<view class="fs-38 fw-600 fc-3 letter-spacing-6 mb-18">
 					{{shopInfo.shop_name || ''}}
 				</view>
+				<view class="align-items-center flex-justify-space p-b-20 b-b-F9F9F9 mb-18">
+					<view class="">
+						营业时间:{{timeData}}
+					</view>
+					<image src="@/static/img/takeout/info-phone.png" mode="" class="phone"></image>
+				</view>
+				<view class="p-b-20 b-b-F9F9F9 mb-18">
+					<view class="fs-26 fc-3 mb-10">
+						{{shopInfo.city_name || ''}} {{shopInfo.address || ''}}
+					</view>
+					<view class="align-items-center">
+						<image class="dw mr-4" src="@/static/img/my/wz-two.png" mode=""></image>
+						<view class="fs-24 fc-9">
+							距离{{shopInfo.distance ||  ''}}Km
+						</view>
+					</view>
+				</view>
+				<view class="align-items-center mb-18">
+					<view class="hr mr-8"></view>
+					<view class="fs-32 fw-600 fc-3 letter-spacing-6">
+						团购
+					</view>
+				</view>
+				<view class="list-box bgc-f b-rad-16 p-24 box-border-box">
+					<view class="item-box align-items-flex-start" v-for="(item,index) in shopList" :key="index" @click="goToUrl(item)">
+						<image :src="item.cover_img" mode="aspectFit" class="shop-img mr-16 flex-shrink0"></image>
+						<view class="flex-1">
+							<view class="align-items-center mb-10">
+								<view class="fs-32 fs-32 flex-1 mr-16 text-overflow-ellipsis-one w-380">
+									{{item.title}}营业时间营业时间营业时间营业时间营业时间营业时间营业时间
+								</view>
+								<uni-icons type="right" size="16"></uni-icons>
+							</view>
+							<view class="align-items-center mb-18">
+								<view class="align-items-center mr-12" v-show="item.usable_time === 1">
+									<view class="fc-9">
+										24小时可用
+									</view>
+									<view class="d-calss bgc-9 ml-10"></view>
+								</view>
+								<view class="align-items-center mr-12">
+									<view class="fc-9">
+										{{item.pre_book === 1?'免预约':'需预约'}}
+									</view>
+									<view class="d-calss bgc-9 ml-10"></view>
+								</view>
+								<view class="fc-9" v-show="item.is_quota == 1">
+									限购{{item.quota_num}}份
+								</view>
+							</view>
+							<view class="align-items-center flex-justify-space">
+								<view class="align-items-center">
+									<view class="fs-30 fw-600 fc-ff3939 mr-8 flex-shrink0">
+										<span class="fs-24 fc-ff3939">¥</span>
+										{{item.price}}
+									</view>
+									<view class="mr-8 fs-20 fc-ff3939 discount-box flex-shrink0">
+										6.3折
+									</view>
+									<view class="mr-8 fc-9 fs-24 flex-shrink0 line-price">
+										¥{{item.line_price}}
+									</view>
+								</view>
+								<view class="">
+									<view class="fs-26 fc-9 mb-8 text-align-right">
+										销量 {{item.sales}}+
+									</view>
+									<view class="item-but fc-f fs-32">
+										抢购
+									</view>
+								</view>
+							</view>
+						</view>
+					</view>
+				</view>
 			</view>
 		</scroll-view>
 	</view>
@@ -39,7 +114,7 @@
 <script>
 	import {
 		groupShopInfo,
-		groupLists
+		groupList
 	} from '@/api/group.js'
 	import tools from '@/service/tools';
 	export default {
@@ -53,17 +128,26 @@
 					lon: '',
 					shop_id: ''
 				},
-				shopInfo: {}
+				shopInfo: {},
+				timeData: '',
+				array: '',
+				shopList: []
 			};
 		},
 		onLoad(data) {
 			if (data) {
 				this.fromData.shop_id = data.shop_id
 				this.groupShopInfo()
+				this.groupList()
 			}
 		},
 		mounted() {},
 		methods: {
+			goToUrl(item) {
+				uni.navigateTo({
+					url: '/pages-buy/group-goods-info?shop_id=' + item.shop_id + '&gooods_id=' + item.id + '&shop_name=' + this.shopInfo.shop_name
+				});
+			},
 			leftClick() {
 				tools.leftClick()
 			},
@@ -73,6 +157,15 @@
 			scrolltolower() {
 				console.log('触底');
 			},
+			groupList() {
+				groupList({
+					shop_id: this.fromData.shop_id
+				}).then((res) => {
+					if (res.code === 1) {
+						this.shopList = res.data
+					}
+				})
+			},
 			groupShopInfo(fromData) {
 				this.fromData.operate_id = uni.getStorageSync('operate_id');
 				this.fromData.lon = uni.getStorageSync('lon');
@@ -80,6 +173,24 @@
 				groupShopInfo(this.fromData).then((res) => {
 					if (res.code === 1) {
 						this.shopInfo = res.data
+						res.data.business_hours.forEach((v, k) => {
+							// let time =
+							v.forEach((i, j) => {
+								let time = ''
+								if (j == 0 || j == 3) {
+									time = i + '-'
+								} else {
+									time = i
+								}
+								this.array = this.array + time
+							})
+							if (res.data.business_hours.length === k + 1) {
+								this.timeData = this.timeData + this.array
+							} else {
+								this.timeData = this.timeData + this.array + ','
+							}
+							this.array = ''
+						})
 					}
 				})
 			}
@@ -88,6 +199,62 @@
 </script>
 
 <style lang="scss" scoped>
+	.item-box{
+		margin-bottom: 20rpx;
+	}
+	.item-box:last-child {
+		margin-bottom: 0;
+	}
+	.item-but{
+		background: #57CAFF;
+		border-radius: 40rpx;
+		padding: 15rpx 30rpx;
+		box-sizing: border-box;
+	}
+	.line-price {
+		text-decoration: line-through;
+	}
+
+	.discount-box {
+		padding: 0rpx 6rpx;
+		border: 1rpx solid #ff3939;
+		border-radius: 6rpx;
+		box-sizing: border-box;
+	}
+
+	.d-calss {
+		width: 5rpx;
+		height: 5rpx;
+		border-radius: 50%;
+	}
+
+	.w-380 {
+		width: 380rpx;
+	}
+
+	.shop-img {
+		width: 180rpx;
+		height: 180rpx;
+		border-radius: 15rpx;
+	}
+
+	.hr {
+		width: 5rpx;
+		height: 32rpx;
+		border-radius: 10rpx;
+		background: #333;
+	}
+
+	.dw {
+		width: 20rpx;
+		height: 20rpx;
+	}
+
+	.phone {
+		width: 35rpx;
+		height: 35rpx;
+	}
+
 	.scroll-view-box {
 		width: 100%;
 		height: 100vh;
@@ -131,5 +298,6 @@
 		position: relative;
 		top: -10rpx;
 		border-radius: 15rpx 15rpx 0 0;
+		background: #F6F6F6;
 	}
 </style>

+ 8 - 2
pages.json

@@ -115,6 +115,12 @@
 						"navigationBarTitleText": "团购商家"
 					}
 				},
+				{
+					"path": "group-goods-info",
+					"style": {
+						"navigationBarTitleText": "团购商品详情"
+					}
+				},
 				{
 					"path": "group-det",
 					"style": {
@@ -431,8 +437,8 @@
 		"current": 0,
 		"list": [{
 				"name": "列表调试",
-				"path": "pages-buy/group-shop",
-				"query": "shop_id=23"
+				"path": "pages-buy/group-goods-info",
+				"query": "shop_id=23&gooods_id=7&shop_name=冒菜冒菜"
 			},
 			{
 				"name": "店铺详情",