Browse Source

对接 商家列表

master
wangfukang 1 month ago
parent
commit
5caefb87e8
  1. 43
      package1/group/groupBuyList.vue
  2. 91
      package1/group/searchGroup.vue

43
package1/group/groupBuyList.vue

@ -23,13 +23,13 @@
</swiper>
</view>
<view class="menu-box">
<view class="menu-list" v-for="(item,index) in menuBtn" :key="index" @tap="searchShop('typeUp',item.value)">
<view class="menu-list" v-for="(item,index) in menuBtn" :key="index" @tap="goDetail('search',item)">
<img :src="item.url" alt="" />
<view class="menu-name">{{item.name}}</view>
</view>
</view>
<view class="menu-box">
<view class="menu-list" v-for="(item,index) in menuBtn1" :key="index" @tap="searchShop('all','')">
<view class="menu-list" v-for="(item,index) in menuBtn1" :key="index" @tap="goDetail('search',item)">
<img :src="item.url" alt="" />
<view class="menu-name">{{item.name}}</view>
</view>
@ -78,7 +78,7 @@
</view>
<view class="shop-tag">
<text style="padding: 4rpx 10rpx;background: rgba(223, 255, 176, 1);color: #777;border-radius: 6rpx;">
{{item.shopTakeaway.type}}
{{item.shopTypeTitle == undefined ? '美食' : item.shopTypeTitle}}
</text>
</view>
</view>
@ -95,7 +95,7 @@
</view>
</view>
<view class="shop-bottom" v-if="item.products != null && item.products.length > 0">
<view class="menu-member" v-if='item1.isPush == 1' v-for="(item1,index1) in item.products" :key="index1" @tap="goDetail('product',item1)">
<view class="menu-member" v-if='item1.isPush == 1 && item1.delFlag == 1' v-for="(item1,index1) in item.products" :key="index1" @tap="goDetail('product',item1)">
<view class="menu-img">
<img :src="item1.productPicture" alt="">
</view>
@ -141,6 +141,7 @@
shopType:'',
shopArea:'',
pageNumber: 1,
keyWord:'',
pageSize: '10',
sort: "shoprank",
order: "desc",
@ -154,43 +155,53 @@
shopList:[],
menuBtn:[{
name:'美食',
value:'',
url:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/d6b53eb217644e74bbf957ff7462c27b.png',
index:1
},{
name:'甜点饮品',
value:'',
url:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/b43aea98962b402f900eca84b2c171ae.png',
index:2
},{
name:'超市便利',
value:'',
url:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/e082a4c10b9a47f0bdb588fb91bc9afb.png',
index:3
},{
name:'蔬菜水果',
value:'',
url:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/e6adc80518c24c488522ab19f036af27.png',
index:4
},{
name:'看病买药',
value:'',
url:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/766761af471a4f9f90e9a137f9c4f701.png',
index:5
}],
menuBtn1:[{
name:'米粉面馆',
value:'',
url:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/8d2f7ffb67a4477ebe663f562b3bd018.png',
index:6
},{
name:'烤肉拌饭',
name:'早点',
value:'',
url:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/5e4fa14df92942eeb62254c8eb82f122.png',
index:7
},{
name:'快餐',
value:'',
url:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/05d2286ac1be4ae784858409889690d5.png',
index:8
},{
name:'麻辣烫冒菜',
value:'',
url:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/0ac5e0095a5d4097b338ec450df8d3dd.png',
index:9
},{
name:'汉堡披萨',
value:'',
url:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/14b93d4bce134b3db4b42b13b6993e6c.png',
index:10
}],
@ -245,6 +256,7 @@
},
methods: {
searchShop(type,value){
this.searchForm.pageNumber = 1
if(type == 'area'){
this.searchForm.shopArea = value
}else if(type == 'score'){
@ -279,12 +291,12 @@
for(let i = 0;i<res.result.content.length;i++){
for(let m = 0;m<this.menuBtn.length;m++){
if(this.menuBtn[m].name == res.result.content[i].title){
this.menuBtn[m].index = res.result.content[i].value
this.menuBtn[m].value = res.result.content[i].value
}
}
for(let m = 0;m<this.menuBtn1.length;m++){
if(this.menuBtn1[m].name == res.result.content[i].title){
this.menuBtn1[m].index = res.result.content[i].value
this.menuBtn1[m].value = res.result.content[i].value
}
}
}
@ -353,9 +365,16 @@
url:'/package1/group/groupBuySingle?type=shop&item=' + JSON.stringify(item)
})
}else if(type == 'search'){
if(item){
console.log("11111",item)
uni.navigateTo({
url:'/package1/group/searchGroup?shopType=' + (item.value || '')
})
}else{
uni.navigateTo({
url:'/package1/group/searchGroup'
})
}
}else{
uni.navigateTo({
url:'/package1/group/groupBuySingle?type=product&item=' + JSON.stringify(item)
@ -376,7 +395,7 @@
<style lang="scss">
page {
width: 100%;
height: 100%;
min-height: 100%;
font-size: 24rpx;
background: #F5F8F5;
color: #00231C;
@ -384,14 +403,16 @@
.page1 {
width: 100%;
height: 100%;
min-height: 100vh;
font-size: 24rpx;
position: relative;
}
.title{
background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/8bc15960c2dc40268e295d6dd23aecce.png') no-repeat;
background-size: 100% 100%;
width: 100%;
height: 54%;
height: auto;
padding-bottom: 20rpx;
}
.swiper {
width: 100%;
@ -499,7 +520,7 @@
}
.shop-member{
width: 100%;
height: 480rpx;
height: auto;
border-radius: 20rpx;
background: #fff;
margin-bottom: 20rpx;

91
package1/group/searchGroup.vue

@ -11,28 +11,17 @@
</view>
<view class="title-search" :style="{'margin-top': menuButtonInfo.top +'px'}">
<uni-icons type="search" size="18" style="margin: 9rpx;"></uni-icons>
<input type="text" placeholder="搜索" />
<input type="text" placeholder="搜索" v-model="searchForm.keyWord" @confirm="goSearch" confirm-type="search" />
</view>
</view>
<view style="width: 95%;background: #fff;margin: 0 auto;border-radius: 10px;padding: 10px;min-height: 80px;">
<view style="height: 30px;color: #777;">
历史搜索
<view style="width: 95%;background: #fff;margin: 0 auto;border-radius: 10px;padding: 10px;min-height: 80px;" v-if="historyList.length > 0 && !searchForm.shopName">
<view style="height: 30px;color: #777;display: flex;justify-content: space-between;align-items: center;">
<text>历史搜索</text>
<uni-icons type="trash" size="18" color="#999" @tap="clearHistory"></uni-icons>
</view>
<view style="">
<view style="margin-right:10px;background: #eee;display: inline-block;padding: 5px 10px;border-radius: 5px;float: left;">
麻辣
</view>
<view style="margin-right:10px;background: #eee;display: inline-block;padding: 5px 10px;border-radius: 5px;float: left;">
牛肉
</view>
<view style="margin-right:10px;background: #eee;display: inline-block;padding: 5px 10px;border-radius: 5px;float: left;">
</view>
<view style="margin-right:10px;background: #eee;display: inline-block;padding: 5px 10px;border-radius: 5px;float: left;">
</view>
<view style="margin-right:10px;background: #eee;display: inline-block;padding: 5px 10px;border-radius: 5px;float: left;">
<view style="overflow: hidden;">
<view v-for="(item, index) in historyList" :key="index" @tap="clickHistory(item)" style="margin-right:10px;margin-bottom:10px;background: #eee;display: inline-block;padding: 5px 10px;border-radius: 5px;float: left;">
{{item}}
</view>
</view>
</view>
@ -80,7 +69,7 @@
</view>
<view class="shop-tag">
<text style="padding: 4rpx 10rpx;background: rgba(223, 255, 176, 1);color: #777;border-radius: 6rpx;">
{{item.shopTakeaway.type}}
{{item.shopTakeaway && item.shopTakeaway.type ? item.shopTakeaway.type : '美食'}}
</text>
</view>
</view>
@ -97,7 +86,7 @@
</view>
</view>
<view class="shop-bottom" v-if="item.products != null && item.products.length > 0">
<view class="menu-member" v-if='item1.isPush == 1' v-for="(item1,index1) in item.products" :key="index1" @tap="goDetail('product',item1)">
<view class="menu-member" v-if='item1.delFlag == 1' v-for="(item1,index1) in item.products" :key="index1" @tap="goDetail('product',item1)">
<view class="menu-img">
<img :src="item1.productPicture" alt="">
</view>
@ -131,9 +120,12 @@
searchSale: false,
shopArea:[],
totalPages:1,
historyList: [],
searchForm:{
regionId:JSON.parse(uni.getStorageSync('area')).id,
shopName:'',
shopType:'',
keyWord:'',
shopArea:'',
pageNumber: 1,
pageSize: '10',
@ -181,19 +173,54 @@
this.getShopList();
},
onLoad() {
onLoad(option) {
if (option && option.shopType && option.shopType !== 'undefined') {
this.searchForm.shopType = option.shopType;
this.getShopList();
}
let history = uni.getStorageSync('searchHistoryGroup');
if (history) {
this.historyList = JSON.parse(history);
}
this.getShopArea();
// this.getShopList();
//this.getShopList();
},
onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
uni.showLoading({
title: '加载中...',
mask: true
})
},
methods: {
goSearch() {
if (this.searchForm.keyWord && this.searchForm.keyWord.trim()) {
let list = this.historyList;
let index = list.indexOf(this.searchForm.keyWord.trim());
if (index !== -1) list.splice(index, 1);
list.unshift(this.searchForm.keyWord.trim());
if (list.length > 10) list.pop();
this.historyList = list;
uni.setStorageSync('searchHistoryGroup', JSON.stringify(list));
}
this.searchForm.pageNumber = 1;
this.getShopList();
},
clickHistory(item) {
this.searchForm.keyWord = item;
this.goSearch();
this.$forceUpdate()
},
clearHistory() {
uni.showModal({
title: '提示',
content: '确定清空历史搜索吗?',
success: (res) => {
if (res.confirm) {
this.historyList = [];
uni.setStorageSync('searchHistoryGroup', '[]');
}
}
});
},
searchShop(type,value){
this.searchForm.pageNumber = 1
if(type == 'area'){
this.searchForm.shopArea = value
}else if(type == 'score'){
@ -299,7 +326,7 @@
<style lang="scss">
page {
width: 100%;
height: 100%;
min-height: 100%;
font-size: 24rpx;
background: #F5F8F5;
color: #00231C;
@ -307,14 +334,16 @@
.page1 {
width: 100%;
height: 100%;
min-height: 100vh;
font-size: 24rpx;
position: relative;
}
.title{
background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/8bc15960c2dc40268e295d6dd23aecce.png') no-repeat;
background-size: 100% 100%;
width: 100%;
height: 54%;
height: auto;
padding-bottom: 20rpx;
}
.title-sreach{
width: 75%;
@ -378,7 +407,7 @@
}
.shop-member{
width: 100%;
height: 480rpx;
height: auto;
border-radius: 20rpx;
background: #fff;
margin-bottom: 20rpx;

Loading…
Cancel
Save