Browse Source

对接口

master
wangfukang 1 month ago
parent
commit
8e1ee1be49
  1. 457
      package1/group/groupBuyList.vue
  2. 31
      package1/group/groupBuySingle.vue

457
package1/group/groupBuyList.vue

@ -20,39 +20,33 @@
<swiper-item>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1d1edcc3e39c4a7cafeb64cf3209ed5e.png" alt="" />
</swiper-item>
<swiper-item>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1d1edcc3e39c4a7cafeb64cf3209ed5e.png" alt="" />
</swiper-item>
<swiper-item>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1d1edcc3e39c4a7cafeb64cf3209ed5e.png" alt="" />
</swiper-item>
</swiper>
</view>
<view class="menu-box">
<view class="menu-list" v-for="(item,index) in menuBtn" :key="index" @tap="goDetail(item.index)">
<view class="menu-list" v-for="(item,index) in menuBtn" :key="index" @tap="searchShop('typeUp',item.value)">
<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="goDetail(item.index)">
<view class="menu-list" v-for="(item,index) in menuBtn1" :key="index" @tap="searchShop('all','')">
<img :src="item.url" alt="" />
<view class="menu-name">{{item.name}}</view>
</view>
</view>
<view class="title-sort">
<view class="sort-member">
<view class="sort-text">
<view class="sort-text" @tap="searchShop('all','')">
综合排序 <text style="font-size: 20rpx;"></text>
</view>
</view>
<view class="sort-member">
<view class="sort-text">
<view class="sort-text" @tap="searchShop('sale','')">
销量优先 <text style="font-size: 20rpx;"></text>
</view>
</view>
<view class="sort-member">
<view class="sort-text">
<view class="sort-text" @tap="searchShop('score','')">
评分优先 <text style="font-size: 20rpx;"></text>
</view>
</view>
@ -61,302 +55,59 @@
区域选择 <text style="font-size: 20rpx;"></text>
</view>
<view class="sort-value" v-if="isArea">
<view class="sort-value1">最热</view>
<view class="sort-value1">最新</view>
<view class="sort-value1">最新</view>
<view class="sort-value1">最新</view>
<view class="sort-value1" v-for="(item,index) in shopArea" :key="index" @tap="searchShop('area',item.id)">{{item.title}}</view>
</view>
</view>
</view>
</view>
<view class="shop-list">
<view class="shop-member">
<view class="shop-member" v-for="(item,index) in shopList" :key="index" @tap="goDetail('shop',item)">
<view class="shop-top">
<view class="shop-img">
<img src="/static/images/img/shangpintu.png" alt="">
<img :src="item.shopIcon" alt="" @tap="goDetail('shop',item)">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/6c4ab92a43c842d8bb22035bce1f65cc.png" alt="" style="width:30rpx;height:30rpx;position: absolute;top: 0;left: 0;background-size: 100%;" />
</view>
<view class="shop-content" @tap="goDetail('shopDetail')">
<view class="shop-content" @tap="goDetail('shop',item)">
<view class="shop-name">
牛仔农庄(医专店)
{{item.shopName}}
</view>
<view class="shop-content-center">
<view class="shop-rate">
<view class="shop-rate-num">4.3</view>
<uni-rate :disabled="true" size="20" disabledColor="rgba(255, 184, 84, 1)" :value="4.3" />
<view class="shop-rate-num">{{item.shopScore}}</view>
<uni-rate :disabled="true" size="16" disabledColor="rgba(255, 184, 84, 1)" :value="item.shopScore" />
</view>
<view class="shop-tag">
<text style="padding: 4rpx 10rpx;background: rgba(223, 255, 176, 1);color: #777;border-radius: 6rpx;">
炒菜
{{item.shopTypeTitle}}
</text>
</view>
</view>
<view class="shop-content-bottom">
<view class="shop-deal">
已拼<text style="color: red;font-weight: 700;"> 12 </text>
</view>
<view class="shop-deal1">
月售 <text> 100+</text>
</view>
</view>
</view>
</view>
<view class="shop-bottom">
<view class="menu-member">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
</view>
<view class="shop-menu-price">
90.00
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
</view>
</view>
</view>
<view class="menu-member">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
</view>
<view class="shop-menu-price">
90.00
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
</view>
</view>
</view>
<view class="menu-member">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
</view>
<view class="shop-menu-price">
90.00
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
</view>
</view>
</view>
<view class="menu-member">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
</view>
<view class="shop-menu-price">
90.00
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
</view>
</view>
</view>
<view class="menu-member">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
</view>
<view class="shop-menu-price">
90.00
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
</view>
</view>
</view>
<view class="menu-member">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
</view>
<view class="shop-menu-price">
90.00
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
</view>
</view>
</view>
<view class="menu-member">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
</view>
<view class="shop-menu-price">
90.00
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
</view>
</view>
</view>
</view>
</view>
<view class="shop-member">
<view class="shop-top">
<view class="shop-img">
<img src="/static/images/img/shangpintu.png" alt="">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/6c4ab92a43c842d8bb22035bce1f65cc.png" alt="" style="width:30rpx;height:30rpx;position: absolute;top: 0;left: 0;background-size: 100%;" />
</view>
<view class="shop-content">
<view class="shop-name">
牛仔农庄(医专店)
</view>
<view class="shop-content-center">
<view class="shop-rate">
<view class="shop-rate-num">4.3</view>
<uni-rate :disabled="true" size="20" disabledColor="rgba(255, 184, 84, 1)" :value="4.3" />
</view>
<view class="shop-tag">
<text style="padding: 4rpx 10rpx;background: rgba(223, 255, 176, 1);color: #777;border-radius: 6rpx;">
炒菜
<text v-if = "item.subtitle != null" style="padding: 4rpx 10rpx;background: rgba(223, 255, 176, 1);color: #777;border-radius: 6rpx;">
{{item.subtitle}}
</text>
</view>
</view>
<view class="shop-content-bottom">
<view class="shop-deal">
已拼<text style="color: red;font-weight: 700;"> 12 </text>
</view>
<view class="shop-deal1">
月售 <text> 100+</text>
</view>
</view>
</view>
</view>
<view class="shop-bottom">
<view class="menu-member">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
</view>
<view class="shop-menu-price">
90.00
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
</view>
</view>
</view>
<view class="menu-member">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
</view>
<view class="shop-menu-price">
90.00
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
</view>
</view>
</view>
<view class="menu-member">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
</view>
<view class="shop-menu-price">
90.00
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
</view>
</view>
</view>
<view class="menu-member">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
</view>
<view class="shop-menu-price">
90.00
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
已拼<text style="color: red;font-weight: 700;"> {{item.saleCount != null ? item.saleCount : 0}} </text>
</view>
</view>
</view>
<view class="menu-member">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
</view>
<view class="shop-menu-price">
90.00
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
</view>
</view>
</view>
<view class="menu-member">
<view class="shop-bottom" v-if="item.products != null && item.products.length > 0">
<view class="menu-member" v-for="(item1,index1) in item.products" :key="index1" @tap="goDetail('product',item1)">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
<img :src="item1.productPicture" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
{{item1.productName}}
</view>
<view class="shop-menu-price">
90.00
¥{{item1.attributeListPrice | sliceMsg}}
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
</view>
</view>
</view>
<view class="menu-member">
<view class="menu-img">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="menu-content">
<view class="shop-menu-name">
啤酒价格
</view>
<view class="shop-menu-price">
90.00
</view>
<view class="shop-menu-purchase">
拼团 <text style="color: red;">85.00</text>
拼团 <text style="color: red;">¥{{item1.productGroupBuyPrices | slicePrice}}</text>
</view>
</view>
</view>
@ -379,6 +130,27 @@
autoplay: true,
interval: 4000,
duration: 1000,
searchScore: false,
searchSale: false,
pageNum:1,
shopArea:[],
totalPages:1,
searchForm:{
regionId:JSON.parse(uni.getStorageSync('area')).id,
shopType:'',
shopArea:'',
pageNum: 1,
pageSize: '10',
sort: "createTime",
order: "desc",
sortOrder:'shoprank',
orderOrder:'desc',
sortScore:'',
orderScore:'',
sortSale:'',
orderSale:''
},
shopList:[],
menuBtn:[{
name:'美食',
url:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/d6b53eb217644e74bbf957ff7462c27b.png',
@ -405,7 +177,7 @@
url:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/8d2f7ffb67a4477ebe663f562b3bd018.png',
index:6
},{
name:'家常菜',
name:'烤肉拌饭',
url:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/5e4fa14df92942eeb62254c8eb82f122.png',
index:7
},{
@ -426,18 +198,149 @@
},
components: {
},
filters: {
sliceMsg(val) {
var name = ''
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
name = newObj[as].specPrice
}
}
return name;
},
slicePrice(val){
let begin = ''
if(val != null){
begin = val[0].groupPrice
for(let i = 0;i < val.length;i++){
if(val[i].groupPrice < begin){
begin = val[i].groupPrice
}
}
}
return begin;
}
},
onLoad() {
this.getEatType();
this.getShopArea();
},
onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
uni.showLoading({
title: '加载中...',
mask: true
})
this.getShopList();
},
methods: {
goDetail(type){
if(type == 'shopDetail'){
searchShop(type,value){
if(type == 'area'){
this.searchForm.shopArea = value
}else if(type == 'score'){
this.searchScore = !this.searchScore
this.searchSale = false
}else if(type == 'sale'){
this.searchSale = !this.searchSale
this.searchScore = false
}else if(type == 'all'){
this.searchForm.sortOrder = 'shoprank'
this.searchForm.orderOrder = 'desc'
this.searchForm.shopArea = ''
this.searchScore = false
this.searchSale = false
}else if(type == 'typeUp'){
//TODO
}
this.getShopList();
},
getEatType(){
let that = this
that.tui.request("/dictData/getByCondition", "GET", {
sort:'sortOrder',
order:'asc',
dictId:'1712359407444168704'
}, false, true).then((res) => {
if (res.code == 200) {
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
}
}
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
}
}
}
} else {
that.tui.toast(res.message)
return
}
}).catch((res) => {})
},
getShopArea(){
let that = this
that.tui.request("/app/shopArea/getByParentId/"+JSON.parse(uni.getStorageSync('area')).id, "GET", {}, false, true).then((res) => {
if (res.code == 200) {
if(res.result != null){
for(let m = 0;m<res.result.length;m++){
if(res.result[m].isCanteen == 1){
that.shopArea.push(res.result[m])
}
}
console.log(that.shopArea)
}
} else {
that.tui.toast(res.message)
return
}
}).catch((res) => {})
},
getShopList(){
if(this.searchSale){
this.searchForm.sortSale = 'saleCount'
this.searchForm.orderSale = 'desc'
this.searchForm.sortOrder = ''
}else{
this.searchForm.sortSale = ''
}
if(this.searchScore){
this.searchForm.sortScore = 'shopScore'
this.searchForm.orderScore = 'desc'
this.searchForm.sortOrder = ''
}else{
this.searchForm.sortScore = ''
}
let that = this
that.tui.request("/app/shop/getByCondition", "GET", this.searchForm, false, true).then((res) => {
if (res.code == 200) {
if (that.pageNum == 1) {
that.shopList = res.result.content
} else {
that.shopList = [...that.shopList, ...res.result.content]
}
that.totalPages = res.result.totalPages
this.isArea = false
that.$forceUpdate()
} else {
that.tui.toast(res.message)
return
}
uni.hideLoading()
}).catch((res) => {})
},
goDetail(type,item){
if(type == 'shop'){
uni.navigateTo({
url:'/package1/group/groupBuySingle?type=shop&item=' + JSON.stringify(item)
})
}else{
uni.navigateTo({
url:'/package1/group/groupBuySingle'
url:'/package1/group/groupBuySingle?type=product&item=' + JSON.stringify(item)
})
}
},
@ -670,6 +573,7 @@
}
.shop-menu-price{
margin-top: 6rpx;
font-weight: 700;
}
.shop-menu-purchase{
display: flex;
@ -678,6 +582,7 @@
line-height: 36rpx;
padding: 0 0 0 4rpx;
border-radius: 8rpx;
font-weight: 700;
margin-top: 10rpx;
color: #777;
}

31
package1/group/groupBuySingle.vue

@ -16,25 +16,25 @@
<view class="pintuan">
<view class="shop-top">
<view class="shop-img">
<img src="/static/images/img/shangpintu.png" alt="">
<img :src="shopItem.shopIcon" alt="">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/6c4ab92a43c842d8bb22035bce1f65cc.png"
alt=""
style="width:30rpx;height:30rpx;position: absolute;top: 0;left: 0;background-size: 100%;" />
</view>
<view class="shop-content" @tap="goDetail('shopDetail')">
<view class="shop-name">
牛仔农庄(医专店)
{{shopItem.shopName}}
</view>
<view class="shop-content-center">
<view class="shop-rate">
<view class="shop-rate-num">4.3</view>
<view class="shop-rate-num">{{shopItem.shopScore}}</view>
<uni-rate :disabled="true" size="20" disabledColor="rgba(255, 184, 84, 1)"
:value="4.3" />
:value="shopItem.shopScore" />
</view>
<view class="shop-tag">
<text
style="padding: 4rpx 10rpx;background: rgba(223, 255, 176, 1);color: #777;border-radius: 6rpx;">
炒菜
{{shopItem.shopTypeTitle}}
</text>
</view>
</view>
@ -43,13 +43,13 @@
店铺评价<uni-icons type="right" size="12"></uni-icons>
</view>
<view class="shop-deal1">
月售 <text> 100+</text>
销量 <text> {{shopItem.saleCount != null ? shopItem.saleCount : 0}}</text>
</view>
</view>
</view>
</view>
<view class="shop-bottom">
公告这里是第三食堂美食top1好吃不贵欢迎下好吃不贵欢迎下单欢迎下单
公告{{shopItem.remark}}
</view>
</view>
<view class="pintuan" style="padding: 0;margin-top:20rpx;display: flex;">
@ -390,15 +390,26 @@
export default {
data() {
return {
type:'',
shopId:'',
shopItem:{},
productItem:{},
productId:'',
menuButtonInfo: {},
isPintuan:true,
isPintuan:true
}
},
components: {
},
onLoad() {
onLoad(option) {
this.type = option.type
if(this.type == 'shop'){
this.shopItem = JSON.parse(option.item)
}else{
this.productItem = JSON.parse(option.item)
}
console.log(this.shopItem)
},
onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()

Loading…
Cancel
Save