Commit 09731eb7 by howie

feat:五粮液商家推荐功能新增

parent da2c6dcd
import { requestPOST, requestGET } from "@/utils/request.js";
export default {
// 获取五粮液商品推荐数据
getWlyList(data) {
return requestGET(`${process.env.BASE_URL}/innerApi/wlyService/commodityExtend/restaurant/recommended`, data);
},
// 获取搜索热门词
getHotWordsApi(data) {
return requestPOST(`${process.env.OLSHOP_URL}/product/query_popular_words_shop`, data);
......
<template>
<div class="main">
<div class="restaurant-list">
<div class="header_box">
<div class="card_title">餐馆推荐</div>
<div class="see_more">
<span @click="viewMore">查看更多</span>
<i class="iconfont icon-tubiao_jiyao-xiangyou"></i>
</div>
</div>
<image class="picture" :src="sourceData.restaurantLogo" mode="aspectFill" alt="" />
<div class="title_box">
<div class="title_text">{{sourceData.restaurantName}}</div>
<div class="title_tag">{{sourceData.restaurantLabel}}</div>
</div>
<div class="price_box flex">
<div class="count">
<span>承接次数</span>
<span class="price_text">{{sourceData.receiveCount}}</span>
</div>
<div class="average">
<span>人均</span>
<span class="price_text">{{sourceData.perCapitaConsumption}}</span>
</div>
</div>
<div class="address">
<div><i class="iconfont icon-dingwei2"></i></div>
<div class="address_text">{{merchantAddress}}</div>
</div>
<div class="btn_box">
<div class="left_btn" @click="linkMerchant">联系商家</div>
<div class="right_btn" @click="orderNow">立即预订</div>
</div>
</div>
</div>
</template>
<script>
const app = getApp()
import goods from "@/api/goods.js"
export default {
name: "restaurant-list",
props: {
datas: {
type: Object,
default: () => {
return {
// id: "",
// pageCode: 0,
// pageType: 0,
// queueNumber: 0,
// componentName: "图文",
// componentCode: "img-text",
// code: 1,
// componentData: {
// titles: "这是标题",
// abstract:
// "摘要文字 这是一个图文组件,可以上传图片和编辑文字,并且对图片大小、文字大小以及位置进行自定义编辑,快使用它!",
// imageUrl:
// "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2546973851,4267148231&fm=26&gp=0.jpg",
// link: {
// name: "",
// link: ""
// },
// initimgSize: "80%", //图片默认尺寸
// initcharSize: 1,
// initcharAlign: "left",
// initcharSite: "left"
// }
};
}
}
},
data() {
return {
sourceData:{
address:"",
restaurantLabel: "",
restaurantLogo: "",
restaurantName: "",
}
}
},
components: {},
computed: {
merchantAddress() {
const {
provinceName,
cityName,
areaName,
address
} = this.sourceData
return provinceName + cityName + areaName + address
}
},
created() {},
onLoad(options){
// console.log(options,'商家推荐options')
console.log("当前的地址",wx.getStorageSync('location'));
let _this = this
wx.getLocation({
type: 'wgs84',
success:function(res){
const query = {
longitude:res.longitude, // 经度
latitude:res.latitude // 纬度
}
console.log('定位数据',res)
goods.getWlyList(query).then(({data:{data}})=>{
_this.sourceData = data;
console.log(_this.sourceData,"商家数据");
})
},
fail:function(err){
console.log('定位失败',err)
wx.showModal({
title: '提示',
content: '定位失败,请检查是否开启了定位服务',
success (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}
})
},
methods: {
viewMore(){
let url = "/pages/wxArticle/main?link=" + encodeURIComponent("https://uat-zanmall-m.cipmp.com/#/pages/restaurantList/index");
app.$themeToLink({
type :1.2,
link : url
});
},
linkMerchant(){
wx.makePhoneCall({
phoneNumber: this.sourceData.linkPhone
})
},
orderNow(){
let url = 'https://uat-zanmall-m.cipmp.com/#/pages/restaurantInfo/index?restaurantId=' + this.sourceData.id
console.log(url,"立即预订的接口地址");
let link = "/pages/wxArticle/main?link=" + encodeURIComponent(url);
app.$themeToLink({
type :1.2,
link : link
});
},
}
}
</script>
<style lang="scss" scoped>
.main {
overflow: hidden;
box-sizing: border-box !important;
}
.restaurant-list {
// height: 320px;
padding: 12px;
background: #ffffff;
border-radius: 4px;
margin: 10px;
.header_box {
display: flex;
align-items: center;
justify-content: space-between;
}
.card_title {
text-align: center;
text-transform: uppercase;
font-size: 18px;
color: #0a0a0a;
font-weight: 600;
}
.see_more {
height: 30px;
color: #999999;
display: flex;
align-items: center;
// margin-bottom: 12px;
.jt {
display: inline-block;
border-top: 1px solid;
border-right: 1px solid;
width: 10px;
height: 10px;
-webkit-transform: rotate(-135deg);
transform: rotate(405deg);
margin-left: 0;
}
}
.picture {
width: 100%;
height: 180px;
margin-top: 12px;
}
.title_box {
display: flex;
// font-weight: 500;
font-size: 18px;
color: #333333;
align-items: center;
margin-top: 12px;
.title_text {
font-weight: 600;
}
.title_tag {
margin-left: 8px;
height: 18px;
font-size: 10px;
line-height: 18px;
border-radius: 2px;
background: #ffe5e7;
color: #e1000f;
text-align: center;
padding: 0 6px;
}
}
.price_box {
margin-top: 6px;
font-size: 12px;
color: #666666;
.count {
margin-right: 12px;
}
.price_text {
margin-left: 6px;
color: #e1000f;
}
}
.address {
margin-top: 12px;
font-size: 14px;
display: flex;
align-items: center;
.address_text {
margin-left: 8px;
}
}
.btn_box {
display: flex;
justify-content: flex-end;
font-size: 16px;
margin-top: 12px;
.left_btn {
padding: 4px 16px;
background: #ffffff;
border-radius: 22px;
color: #e1000f;
border: 1px solid #e1000f;
margin-right: 12px;
}
.right_btn {
padding: 4px 16px;
background: #e1000f;
border-radius: 22px;
color: #ffffff;
border: 1px solid #e1000f;
}
}
}
</style>
......@@ -23,6 +23,10 @@
<div v-else-if="item.componentCode == 'cube-nav' && item.componentInfo.visible == 1">
<cube-nav :datas="item"></cube-nav>
</div>
<!-- 五粮液的餐厅推荐 -->
<div v-else-if="item.componentCode == 'restaurant-list' && item.componentInfo.visible == 1">
<restaurant-list :datas="item"></restaurant-list>
</div>
<div v-else-if="item.componentCode == 'time-limited-discount' && item.componentInfo.visible == 1">
<time-limited-discount :class="'time-limited-discount'+index" :datas="item" :k="index"></time-limited-discount>
</div>
......@@ -107,7 +111,6 @@
<div v-if="item.componentCode == 'brand-list' && item.componentInfo.visible == 1">
<brandList :datas="item"></brandList>
</div>
</div>
<bottomCont v-if="showbottomCont"></bottomCont>
<template>
......@@ -152,6 +155,7 @@ import bottomCont from "../../components/bottomCont"
import ThemeDataPlant from "../../components/ThemeDataPlant"
import links from '@/components/basicTool/link/index.vue'
import interval from '@/components/basicTool/interval/index.vue'
import restaurantList from '../../components/restaurantList'
import partition from '@/components/basicTool/partition/index.vue'
import shopPopup from '@/components/basicTool/shop-popup/index.vue'
import woTimeout from '@/components/basicTool/wo-timeout/index.vue'
......@@ -220,6 +224,7 @@ export default {
};
},
components:{
"restaurant-list":restaurantList,
links,
interval,
partition,
......
......@@ -86,7 +86,7 @@ Component({
this.data.hotWordsInterval = setInterval(()=>{
// 取出下一个元素
currentIndex = (currentIndex + 1) % this.data.tableData.length;
console.log("有无",this.data.tableData[currentIndex].popularWordsName);
// console.log("有无",this.data.tableData[currentIndex].popularWordsName);
this.setData({
[placeHolderVal]:this.data.tableData[currentIndex].popularWordsName,
placeholderValue:this.data.tableData[currentIndex].popularWordsName
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment