瀏覽代碼

no message

py 2 年之前
父節點
當前提交
304b44123e
共有 7 個文件被更改,包括 442 次插入 和 50 次删除
  1. 13 0
      api/group.js
  2. 8 1
      common/css/common.css
  3. 1 0
      components/en-utils/en-nav/en-nav.vue
  4. 129 0
      pages-buy/group-mod/shop-list.vue
  5. 135 0
      pages-buy/group-shop.vue
  6. 148 47
      pages-buy/group.vue
  7. 8 2
      pages.json

+ 13 - 0
api/group.js

@@ -0,0 +1,13 @@
+import {request} from '../service/ajax.js'
+
+const newsUrl = '/api/group/'
+// 获取团购商家 
+export const groupShop = (data) => request(newsUrl + 'shop', 'post', { ...data },true)
+// 获取团购商家详情
+export const groupShopInfo = (data) => request(newsUrl + 'shop_info', 'post', { ...data },false)
+// 获取团购商品列表
+export const groupLists = (data) => request(newsUrl + 'lists', 'post', { ...data },false)
+// 获取团购商品详情
+export const groupInfo = (data) => request(newsUrl + 'info', 'post', { ...data },false)
+// 下单
+export const groupCreate = (data) => request(newsUrl + 'create', 'post', { ...data },false)

+ 8 - 1
common/css/common.css

@@ -173,6 +173,10 @@ image {
 	text-align: left;
 }
 
+.letter-spacing-6 {
+	letter-spacing: 6rpx;
+}
+
 .flex-1 {
 	flex: 1;
 }
@@ -414,7 +418,8 @@ image {
 .b-b-F9F9F9 {
 	border-bottom: 1rpx solid #F9F9F9;
 }
-.b-r-ccc{
+
+.b-r-ccc {
 	border: 1rpx solid #ccc;
 }
 
@@ -472,6 +477,7 @@ image {
 .p-t-20 {
 	padding-top: 20rpx;
 }
+
 .p-t-80 {
 	padding-top: 80rpx;
 }
@@ -479,6 +485,7 @@ image {
 .pb-5 {
 	padding-bottom: 5rpx;
 }
+
 .pb-10 {
 	padding-bottom: 10rpx;
 }

+ 1 - 0
components/en-utils/en-nav/en-nav.vue

@@ -154,6 +154,7 @@
 			// display: flex;
 			// align-items: center;
 			// justify-content: space-between;
+			transition: background-color 1s ease-in-out;
 			padding: 0 24rpx;
 
 			.iconfont {

+ 129 - 0
pages-buy/group-mod/shop-list.vue

@@ -0,0 +1,129 @@
+<template>
+	<view class="min-h-85">
+		<view v-if="list.length == 0" class="scroll-view-css">
+			<EnBlank :customSrc='true'>
+				<template v-slot:blankImg>
+					<image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
+				</template>
+			</EnBlank>
+		</view>
+		<view v-else class="item-box mb-16 bgc-f p-24 box-border-box display-flex" v-for="(item,index) in list"
+			:key="index" @click="goToUrl(item)">
+			<view class="item-left flex-shrink0">
+				<image :src="item.shop_logo" mode="aspectFill" class="shop_logo mr-16"></image>
+			</view>
+			<view class="item-right flex-1">
+				<view class="w-240 fs-34 fc-3 fw-600 mb-8 text-overflow-ellipsis-one">
+					{{item.shop_name}}电饭锅发的鬼地方东方闪电
+				</view>
+				<view class="align-items-center flex-justify-space mb-4">
+					<view class="fs-24 fc-9 w-150 text-overflow-ellipsis">
+						{{item.address}}
+					</view>
+					<view class="fs-24 fc-9 flex-shrink0">
+						销量{{item.shop_sales}}
+					</view>
+				</view>
+				<view class="align-items-center flex-justify-end pb-10 b-b-F9F9F9 mb-12">
+					<image class="dw mr-4" src="@/static/img/my/wz-two.png" mode=""></image>
+					<view class="fs-24 fc-9">
+						距离{{item.distance}}Km
+					</view>
+				</view>
+				<view class="align-items-center" v-for="(goodsItem,goodsIndex) in item.goods" :key="goodsIndex">
+					<view class="fs-30 fw-600 fc-ff3939 mr-8 flex-shrink0">
+						<span class="fs-24 fw-600 fc-ff3939">¥</span>
+						{{goodsItem.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">
+						¥{{goodsItem.line_price}}
+					</view>
+					<view class="fs-26 text-overflow-ellipsis-one">
+						{{goodsItem.title}}距离距离距离距离
+					</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import EnBlank from "@/components/en-utils/en-blank/en-blank";
+	import {
+		groupShop
+	} from "@/api/group.js"
+	export default {
+		components: {
+			EnBlank
+		},
+		data() {
+			return {
+				list: [],
+				total: 0
+			};
+		},
+		onLoad(data) {},
+		mounted() {},
+		methods: {
+			goToUrl(item) {
+				uni.navigateTo({
+					url: '/pages-buy/group-shop?shop_id=' + item.shop_id
+				});
+			},
+			groupShop(fromData) {
+				groupShop(fromData).then((res) => {
+					if (res.code === 1) {
+						if (fromData.page === 1) {
+							this.list = []
+							this.list = [...this.list, ...res.data.items];
+						} else {
+							if (this.list.length < this.total) {
+								this.list = [...this.list, ...res.data.items];
+								this.total = res.data.total;
+							}
+						}
+					}
+				})
+			}
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+	.line-price{
+		text-decoration: line-through;
+	}
+	.dw{
+		width: 20rpx;
+		height: 20rpx;
+	}
+	.w-240 {
+		width: 480rpx;
+	}
+
+	.min-h-85 {
+		min-height: 85vh;
+	}
+
+	.item-box {
+		width: 100%;
+		border-radius: 10rpx;
+	}
+
+	.shop_logo {
+		width: 160rpx;
+		height: 160rpx;
+		border-radius: 15rpx;
+	}
+	.w-150{
+		width: 300rpx;
+	}
+	.discount-box{
+		padding: 2rpx 6rpx;
+		border: 1rpx solid #ff3939;
+		border-radius: 6rpx;
+	}
+</style>

+ 135 - 0
pages-buy/group-shop.vue

@@ -0,0 +1,135 @@
+<template>
+	<view class="flex-common-css">
+		<Nav :leftShow='false' :customNav='true' :bgckgroundBox='scrollTopNum>30?"#fff":"transparent"' class="nav-box">
+			<template>
+				<view slot="custom" class="align-items-center" @click="leftClick">
+					<view class="nav-left-box text-align-center" v-show="scrollTopNum<30">
+						<uni-icons color="#fff" type="left" size="15"></uni-icons>
+					</view>
+					<uni-icons class="mr-30" color="#000" type="left" size="15" v-show="scrollTopNum>30"></uni-icons>
+					<view class="fs-34 fw-600 fc-3" v-show="scrollTopNum>30">
+						团购商家
+					</view>
+				</view>
+			</template>
+		</Nav>
+		<scroll-view :scroll-y="true" class="scroll-view-box" @scroll='scroll' @scrolltolower="scrolltolower">
+			<view class="uni-margin-wrap">
+				<swiper class="swiper" :circular='true' :autoplay="true" :interval="3000" :duration="500">
+					<swiper-item>
+						<view class="swiper-item bgc-B3DDFB">A</view>
+					</swiper-item>
+					<swiper-item>
+						<view class="swiper-item bgc-3">B</view>
+					</swiper-item>
+					<swiper-item>
+						<view class="swiper-item fc-65420c">C</view>
+					</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">
+					{{shopInfo.shop_name || ''}}
+				</view>
+			</view>
+		</scroll-view>
+	</view>
+</template>
+
+<script>
+	import {
+		groupShopInfo,
+		groupLists
+	} from '@/api/group.js'
+	import tools from '@/service/tools';
+	export default {
+		components: {},
+		data() {
+			return {
+				scrollTopNum: 0, //当前滚动条高度
+				fromData: {
+					operate_id: '',
+					lat: '',
+					lon: '',
+					shop_id: ''
+				},
+				shopInfo: {}
+			};
+		},
+		onLoad(data) {
+			if (data) {
+				this.fromData.shop_id = data.shop_id
+				this.groupShopInfo()
+			}
+		},
+		mounted() {},
+		methods: {
+			leftClick() {
+				tools.leftClick()
+			},
+			scroll(e) {
+				this.scrollTopNum = e.detail.scrollTop
+			},
+			scrolltolower() {
+				console.log('触底');
+			},
+			groupShopInfo(fromData) {
+				this.fromData.operate_id = uni.getStorageSync('operate_id');
+				this.fromData.lon = uni.getStorageSync('lon');
+				this.fromData.lat = uni.getStorageSync('lat');
+				groupShopInfo(this.fromData).then((res) => {
+					if (res.code === 1) {
+						this.shopInfo = res.data
+					}
+				})
+			}
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+	.scroll-view-box {
+		width: 100%;
+		height: 100vh;
+		position: fixed;
+		overflow: auto;
+	}
+
+	.nav-box {
+		transition: all 0.3s ease-in-out;
+	}
+
+	.uni-margin-wrap {
+		width: 100%;
+		// position: absolute;
+		// left: 0;
+		// top: 0;
+	}
+
+	.swiper {
+		height: 400rpx;
+	}
+
+	.swiper-item {
+		display: block;
+		height: 400rpx;
+		line-height: 400rpx;
+		text-align: center;
+	}
+
+	.nav-left-box {
+		width: 50rpx;
+		height: 50rpx;
+		line-height: 50rpx;
+		background: #9A9A9A;
+		border-radius: 18rpx;
+	}
+
+	.shop-box {
+		width: 100%;
+		// height: 100vh;
+		position: relative;
+		top: -10rpx;
+		border-radius: 15rpx 15rpx 0 0;
+	}
+</style>

+ 148 - 47
pages-buy/group.vue

@@ -8,7 +8,7 @@
 					<view class="head-search align-items-center">
 						<!-- <uni-icons class="s-icon" type="search" size="19"></uni-icons> -->
 						<image class="wh-32" src="@/static/img/index/ss.png" mode=""></image>
-						<input class="input" v-model="search" type="text" placeholder="搜一搜带你玩周边">
+						<input class="input" v-model="fromData.search" type="text" placeholder="搜一搜带你玩周边">
 						<view class="head-search-buttom text-align-center fs-28 fw-500 fc-f" @click="searchFun()">搜索
 						</view>
 					</view>
@@ -18,7 +18,8 @@
 						<view class="text-align-center nav-item" v-for="(item,i) in navList" :key="i"
 							@click="selectType(item.id)">
 							<image class="nav-img" :src="item.img" mode="scaleToFill"></image>
-							<view class="fs-24 w-96" :class="navId == item.id?'fw-600 fc-41ABF5':'fw-400'">{{item.name}}
+							<view class="fs-24 w-96"
+								:class="fromData.category_id == item.id?'fw-600 fc-41ABF5':'fw-400'">{{item.name}}
 							</view>
 						</view>
 					</view>
@@ -28,25 +29,43 @@
 					<view class="mr-20 sift-item align-items-center flex-justify-center"
 						:class="[{'bgc-F5F5F6':siftType},{'bgc-f':!siftType},{'siftClass':siftClassID === 1 && pop_type}]"
 						@click="siftClick(1)">
-						<view class="" :class="[{'fc-41ABF5':siftClassID === 1 && pop_type}]">
+						<view class=""
+							:class="[{'fc-41ABF5':(siftClassID === 1 && pop_type) || fromData.distance != 0}]">
 							{{siftDistance}}
 						</view>
 					</view>
 					<view class="mr-12 sift-item align-items-center flex-justify-center"
 						:class="[{'bgc-F5F5F6':siftType},{'bgc-f':!siftType},{'siftClass':siftClassID === 2 && pop_type}]"
 						@click="siftClick(2)">
-						<view class="" :class="[{'fc-41ABF5':siftClassID === 2 && pop_type}]">
+						<view class=""
+							:class="[{'fc-41ABF5':(siftClassID === 2 && pop_type) || fromData.orderBy != 0}]">
 							{{siftSort}}
 						</view>
 					</view>
 					<view class="pop-content" :style="[{'top': pop_top + 'px'}]"
 						:class="pop_type?'pop-box-true':'pop-box-false'" @click="gbPopType">
 						<view class="pop-select-box" @click.stop="noPopType">
-							<view class="">
-								1111111111111111111000000000000000000000000000000000000000000000000000000000
-							</view>
-							<view class="" v-for="(item,index) in 2">
-								电风扇电风扇
+							<view class="select-box p-24 box-border-box">
+								<view class="distance-box" v-show="siftClassID === 1">
+									<view class="mb-16 fs-30 fc-3 fw-500">
+										我的附近
+									</view>
+									<view class="align-items-center flex-wrap-wrap">
+										<view class="distance-label text-align-center mb-12"
+											v-for="(item,index) in distance_label" :key="item.id"
+											:class="fromData.distance===item.id?'siftClass':'bgc-F5F5F6'"
+											@click="distanceClick(item)">
+											{{item.name}}
+										</view>
+									</view>
+								</view>
+								<view class="sort-box" v-show="siftClassID === 2">
+									<view class="sort-select-box text-align-left" v-for="(item,index) in sort_label"
+										:key="item.id" @click="sortSelectClick(item)"
+										:class="fromData.orderBy===item.id?'fc-41ABF5':''">
+										{{item.name}}
+									</view>
+								</view>
 							</view>
 						</view>
 					</view>
@@ -54,8 +73,7 @@
 				<view v-show="pop_type" :style="[{'top': pop_top + 'px'}]" class="pop-mask" @click="gbPopType"
 					@touchmove.stop.prevent="stopScroll"></view>
 				<view class="p-12-24 box-border-box">
-					<view class="h-200" v-for="(item,index) in 10">
-					</view>
+					<shopListVue ref="shopListRef"></shopListVue>
 				</view>
 			</view>
 		</scroll-view>
@@ -67,17 +85,26 @@
 		groupList
 	} from '@/api/groupOrder.js';
 	import tools from "@/service/tools";
-	import EnBlank from "@/components/en-utils/en-blank/en-blank";
+	import shopListVue from './group-mod/shop-list.vue';
 	import {
 		getGroup
 	} from "@/api/category.js"
 	export default {
 		components: {
-			EnBlank
+			shopListVue
 		},
 		data() {
 			return {
-				navId: 0,
+				fromData: {
+					operate_id: '',
+					lat: '',
+					lon: '',
+					search: '',
+					category_id: 0,
+					distance: 0,
+					orderBy: 0,
+					page: 1
+				},
 				navList: [{
 					name: "全部",
 					id: 0,
@@ -91,23 +118,41 @@
 				pop_type: false,
 				navListHeight: '', //头部模块高度
 				siftDistance: '附近', //距离筛选
-				siftSort: '距离优先', //排序筛选
-				page: 1,
-				total: 0,
-				list: [],
-				search: ''
-			}
-		},
-		onReachBottom() {
-			if (this.list.length < this.total) {
-				this.page += 1;
-				this.getList();
+				siftSort: '默认排序', //排序筛选
+				distance_label: [{
+					name: '附近',
+					id: 0
+				}, {
+					name: '500m',
+					id: 0.5
+				}, {
+					name: '1km',
+					id: 1
+				}, {
+					name: '3km',
+					id: 3
+				}, {
+					name: '5km',
+					id: 5
+				}, {
+					name: '10km',
+					id: 10
+				}],
+				sort_label: [{
+					name: '默认排序',
+					id: 0
+				}, {
+					name: '距离优先',
+					id: 1
+				}, {
+					name: '销量优先',
+					id: 2
+				}]
 			}
 		},
 		onShow() {
 			this.getGroup()
-			this.page = 1;
-			this.list = [];
+			this.fromData.page = 1;
 			this.getList();
 		},
 		onLoad() {},
@@ -115,6 +160,38 @@
 			this.getHeight()
 		},
 		methods: {
+			distanceClick(item) {
+				// 距离筛选
+				if (this.fromData.distance === item.id) {
+					this.gbPopType()
+				} else {
+					this.fromData.distance = item.id
+					this.siftDistance = item.name
+					this.fromData.page = 1;
+					this.getList()
+					this.gbPopType()
+				}
+			},
+			sortSelectClick(item) {
+				// 排序筛选
+				if (this.fromData.orderBy === item.id) {
+					this.gbPopType()
+				} else {
+					this.fromData.orderBy = item.id
+					this.siftSort = item.name
+					this.fromData.page = 1;
+					this.getList()
+					this.gbPopType()
+				}
+			},
+			selectType(num) {
+				if (this.fromData.category_id === num) {
+					return
+				}
+				this.fromData.category_id = num
+				this.fromData.page = 1;
+				this.getList()
+			},
 			noPopType() {},
 			stopScroll(event) {
 				// 阻止默认的滑动行为
@@ -127,10 +204,14 @@
 						this.scroll_top = this.navListHeight
 					});
 				}
-				setTimeout(() => {
-					this.siftClassID = num
-					this.pop_type = true
-				}, 200)
+				if (this.pop_type && this.siftClassID === num) {
+					this.pop_type = false
+				} else {
+					setTimeout(() => {
+						this.siftClassID = num
+						this.pop_type = true
+					}, 200)
+				}
 			},
 			gbPopType() {
 				this.pop_type = !this.pop_type
@@ -187,7 +268,8 @@
 				})
 			},
 			scrolltolower(e) {
-				console.log(e);
+				++this.fromData.page
+				this.getList()
 			},
 			getGroup() {
 				let operate_id = uni.getStorageSync('operate_id');
@@ -206,28 +288,47 @@
 					}
 				})
 			},
-			getList() {
-				let school_id = uni.getStorageSync('school_id');
-				groupList({
-					school_id: school_id,
-					page: this.page
-				}).then((res) => {
-					if (res.code === 1) {
-						this.list = [...this.list, ...res.data.items];
-						this.total = res.data.total;
-					}
-				})
+			searchFun() {
+				if (this.fromData.search) {
+					this.fromData.page = 1;
+					this.getList()
+				} else {
+					tools.error("请输入搜索内容")
+				}
 			},
-			todet(item) {
-				uni.navigateTo({
-					url: '/pages-buy/group-det?id=' + item.id
-				})
+			getList() {
+				this.fromData.operate_id = uni.getStorageSync('operate_id');
+				this.fromData.lon = uni.getStorageSync('lon');
+				this.fromData.lat = uni.getStorageSync('lat');
+				console.log(this.fromData);
+				this.$refs.shopListRef.groupShop(this.fromData)
 			}
 		},
 	}
 </script>
 
 <style scoped lang="scss">
+	.select-box {}
+
+	.distance-box {}
+
+	.sort-box {}
+
+	.distance-label {
+		width: 32%;
+		height: 60rpx;
+		line-height: 60rpx;
+		border-radius: 8rpx;
+		margin-right: 1%;
+	}
+
+	.sort-select-box {
+		width: 100%;
+		height: 40rpx;
+		line-height: 40rpx;
+		padding: 15rpx 0;
+	}
+
 	.pop-box-true {
 		// display: block;
 		// transition: all .3s inherit;

+ 8 - 2
pages.json

@@ -109,6 +109,12 @@
 						"disableScroll": true
 					}
 				},
+				{
+					"path": "group-shop",
+					"style": {
+						"navigationBarTitleText": "团购商家"
+					}
+				},
 				{
 					"path": "group-det",
 					"style": {
@@ -425,8 +431,8 @@
 		"current": 0,
 		"list": [{
 				"name": "列表调试",
-				"path": "pages-buy/group",
-				"query": ""
+				"path": "pages-buy/group-shop",
+				"query": "shop_id=23"
 			},
 			{
 				"name": "店铺详情",