|
|
@@ -6,18 +6,18 @@
|
|
|
</view>
|
|
|
</block>
|
|
|
<block v-else>
|
|
|
- <view class="header">
|
|
|
- <view class="left">
|
|
|
+ <view class="header flex_r flex_jb">
|
|
|
+ <view class="left flex_c flex_jc">
|
|
|
<view class="title ellipsis">{{MerchantInfo.restaurant_name}}</view>
|
|
|
<view v-if="distance" class="address">距离您 {{(distance/1000)>1?distance/1000+'千米':distance+'米'}}</view>
|
|
|
<view v-else class="address">{{MerchantInfo.restaurant_address}}</view>
|
|
|
</view>
|
|
|
- <view class="right">
|
|
|
-
|
|
|
+ <view class="right flex_c flex_jc">
|
|
|
+ <span @click="openm" class="iconfont"></span>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view style="height: 130rpx;"></view>
|
|
|
- <view class="goodsBox">
|
|
|
+ <view class="goodsBox" v-if="goodsAllList.length">
|
|
|
<view class="left">
|
|
|
<scroll-view scroll-y scroll-with-animation class="menuList">
|
|
|
<view class="menu" :class="menuCurrent==index?'active':''" :style="menuCurrent==index?'color:'+template.color.color2+';border-color:'+template.color.color1:'color:'+template.color.color3" @click="selectMenuTap(index)" v-for="(item, index) in goodsAllList" :key="index">{{item.title}}</view>
|
|
|
@@ -53,7 +53,7 @@
|
|
|
<view class="title" :style="'color:'+template.color.color2">{{itm.product_name}}</view>
|
|
|
<view class="intro" :style="'color:'+template.color.color3">{{itm.product_description || ""}}</view>
|
|
|
<view class="box">
|
|
|
- <view class="price" :style="'color:'+template.color.color1">¥{{itm.product_price}}</view>
|
|
|
+ <view class="price" :style="'color:'+template.color.color1">¥{{itm.user_price}}</view>
|
|
|
<view class="button">
|
|
|
<block v-if="openStoreStatus">
|
|
|
<block v-if="itm.product_choose">
|
|
|
@@ -77,6 +77,9 @@
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <div class="hahaha">
|
|
|
+ <img src="http://teaclub.oss-cn-chengdu.aliyuncs.com/CloudShop/head_pic/769023cde4b820d36e75baf7b3faef6ea3095cb3png" alt="">
|
|
|
+ </div>
|
|
|
<!-- 购物袋 - 底部栏 -->
|
|
|
<view v-if="openStoreStatus && cartList.length>0" class="footer" :class="ios>=0?'footerX':''">
|
|
|
<view class="left">
|
|
|
@@ -116,19 +119,6 @@
|
|
|
<icon type="jian" @click="editGoods(item, 'jian')" size="23" :color="item.number==1?'#cccccc':'#d3aa79'"></icon>
|
|
|
<input type="number" :value="item.number" disabled />
|
|
|
<icon type="jia" @click="editGoods(item, 'jia')" size="23" color="#d3aa79"></icon>
|
|
|
- <!-- <block v-if="item.shelve_status">
|
|
|
- <block v-if="item.stock_number">
|
|
|
- <icon type="jian" @click="editGoods(item, 'jian')" size="23" :color="item.num==1?'#cccccc':'#d3aa79'"></icon>
|
|
|
- <input type="number" :value="item.num" disabled />
|
|
|
- <icon type="jia" @click="editGoods(item, 'jia')" size="23" :color="item.num>=item.stock_number?'#cccccc':'#d3aa79'"></icon>
|
|
|
- </block>
|
|
|
- <block v-else>
|
|
|
- <text>商品已售罄</text>
|
|
|
- </block>
|
|
|
- </block>
|
|
|
- <block v-else>
|
|
|
- <text>商品已下架</text>
|
|
|
- </block> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -136,14 +126,14 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view v-if="!openStoreStatus" class="footer" :class="ios>=0?'footerX':''" style="overflow: hidden;">
|
|
|
- <view class="label" :style="'background-color:'+template.color.color2">本店已休息,营业时间:{{openStoreTime}}</view>
|
|
|
+ <view class="label" :style="'background-color:'+template.color.color2">本店已休息,<block v-if="MerchantInfo.open_time">营业时间{{MerchantInfo.open_time}}</block></view>
|
|
|
</view>
|
|
|
<!-- 选规格-看详情 -->
|
|
|
<view v-if="goodShow" class="showPopBox" style="display: flex;align-items: center;justify-content: center;">
|
|
|
<view class="bg" @click="goodShow=false"></view>
|
|
|
<view class="goodsConten">
|
|
|
<view class="image">
|
|
|
- <image :src="goodsOneData.product_img" lazy-load mode="aspectFit"></image>
|
|
|
+ <img :src="goodsOneData.product_img" class="img" />
|
|
|
<icon @click="goodShow=false" type="close" size="25" :color="template.color.color5" style="top: 10rpx; right: 10rpx;"></icon>
|
|
|
</view>
|
|
|
<view class="title" :style="'color:'+template.color.color2">{{goodsOneData.product_name}}</view>
|
|
|
@@ -178,7 +168,6 @@
|
|
|
</view>
|
|
|
<block v-if="openStoreStatus">
|
|
|
<view class="button" @click="addShopCar()" :style="'background-color:'+template.color.color1">加入购物袋</view>
|
|
|
- <!-- <view v-else class="button none" :style="'background-color:'+template.color.color5">{{goodsOneData.stock_number===0?'商品已售罄':'加入购物袋'}}</view> -->
|
|
|
</block>
|
|
|
<block v-else>
|
|
|
<view class="button none" :style="'background-color:'+template.color.color5">本店已休息</view>
|
|
|
@@ -273,12 +262,11 @@ export default {
|
|
|
// 获取当下店铺所有商品
|
|
|
getGoodsAllList(da) {
|
|
|
post("local/getMerchantMenu", da).then(res => {
|
|
|
+ this.loading = false;
|
|
|
if (res.code == 0) {
|
|
|
- this.loading = false;
|
|
|
if(res.data.error_code == 200){
|
|
|
let da = res.data.data.products;
|
|
|
- let arr = [],
|
|
|
- obj = [];
|
|
|
+ let arr = [], obj = [];
|
|
|
for (const it of da) {
|
|
|
if (!arr.includes(it.category_name)) arr.push(it.category_name)
|
|
|
}
|
|
|
@@ -291,13 +279,15 @@ export default {
|
|
|
this.goodsAllList = obj
|
|
|
}
|
|
|
}
|
|
|
+ else if (res.code == -1) {
|
|
|
+ this.openStoreStatus = false
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
// 获取商品详情 - 展开规格选择
|
|
|
getDteailsTap(index, idx) {
|
|
|
- let self = this;
|
|
|
- let data = self.goodsAllList[index].goods[idx];
|
|
|
- self.childProductData = {};
|
|
|
+ let data = this.goodsAllList[index].goods[idx];
|
|
|
+ this.childProductData = {};
|
|
|
let info = this.MerchantInfo;
|
|
|
if (data.product_choose) {
|
|
|
post("local/getProduct", {
|
|
|
@@ -306,14 +296,45 @@ export default {
|
|
|
product_id: data.product_id
|
|
|
}).then(res => {
|
|
|
if (res.code === 0) {
|
|
|
- self.goodsOneData = res.data.data;
|
|
|
- self.buyNumber = 1;
|
|
|
- self.goodShow = true;
|
|
|
+ let da = res.data.data
|
|
|
+ if(da.brand_id == 13){
|
|
|
+ let arr = []
|
|
|
+ for (let it of da.details.specifications) {
|
|
|
+ arr.push({
|
|
|
+ name: it.name,
|
|
|
+ sku_infos: it.ingredients
|
|
|
+ })
|
|
|
+ }
|
|
|
+ da.details.optional = arr
|
|
|
+ }
|
|
|
+ if(da.brand_id == 19){
|
|
|
+ let arr = []
|
|
|
+ for (let it of da.details.specifications) {
|
|
|
+ arr.push({
|
|
|
+ name: it.name,
|
|
|
+ sku_infos: it.values
|
|
|
+ })
|
|
|
+ }
|
|
|
+ da.details.optional = arr
|
|
|
+ }
|
|
|
+ if(da.brand_id == 2){
|
|
|
+ let arr = []
|
|
|
+ for (let it of da.details.spu_specs) {
|
|
|
+ arr.push({
|
|
|
+ name: it.name,
|
|
|
+ sku_infos: it.values
|
|
|
+ })
|
|
|
+ }
|
|
|
+ da.details.optional = arr
|
|
|
+ }
|
|
|
+ this.goodsOneData = da;
|
|
|
+ this.buyNumber = 1;
|
|
|
+ this.goodShow = true;
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
- self.goodsOneData = data;
|
|
|
- self.goodShow = true;
|
|
|
+ this.goodsOneData = data;
|
|
|
+ this.goodShow = true;
|
|
|
}
|
|
|
},
|
|
|
// 商品类别导航跳转
|
|
|
@@ -323,8 +344,7 @@ export default {
|
|
|
},
|
|
|
// 选择规格标签
|
|
|
selectSpecsTap(index, idx) {
|
|
|
- let self = this;
|
|
|
- let specification = self.goodsOneData.details.optional;
|
|
|
+ let specification = this.goodsOneData.details.optional;
|
|
|
for (let i = 0; i < specification.length; i++) {
|
|
|
if (i == index) {
|
|
|
specification[i].active = true;
|
|
|
@@ -337,7 +357,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- self.$set(self.goodsOneData.details.optional, index, self.goodsOneData.details.optional[index])
|
|
|
+ this.$set(this.goodsOneData.details.optional, index, this.goodsOneData.details.optional[index])
|
|
|
let curSelectNum = 0;
|
|
|
let spec_price = 0;
|
|
|
let selectSpecArr = [];
|
|
|
@@ -357,12 +377,11 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
if (curSelectNum == specification.length) {
|
|
|
- self.canSubmit = true;
|
|
|
+ this.canSubmit = true;
|
|
|
} else {
|
|
|
- self.canSubmit = false;
|
|
|
+ this.canSubmit = false;
|
|
|
}
|
|
|
-
|
|
|
- self.childProductData = { selectSpecArr, selectSpecification, spec_price };
|
|
|
+ this.childProductData = { selectSpecArr, selectSpecification, spec_price };
|
|
|
},
|
|
|
// 添加购物袋前 修改购买数量
|
|
|
editGoodsOne(type) {
|
|
|
@@ -377,18 +396,20 @@ export default {
|
|
|
},
|
|
|
// 添加进购物袋
|
|
|
addShopCar() {
|
|
|
- let self = this;
|
|
|
- let data = self.goodsOneData;
|
|
|
- if (data.product_choose) {
|
|
|
- if (self.canSubmit) {
|
|
|
- self.addCartGoods(data, self.buyNumber, self.childProductData);
|
|
|
- } else {
|
|
|
- uni.showToast({ title: '请选择规格', icon: 'none' });
|
|
|
- return
|
|
|
- }
|
|
|
- } else {
|
|
|
- self.addCartGoods(data, self.buyNumber);
|
|
|
- }
|
|
|
+ let data = this.goodsOneData;
|
|
|
+
|
|
|
+ this.addCartGoods(data, this.buyNumber, this.childProductData);
|
|
|
+
|
|
|
+ // if (data.product_choose) {
|
|
|
+ // if (this.canSubmit) {
|
|
|
+ // this.addCartGoods(data, this.buyNumber, this.childProductData);
|
|
|
+ // } else {
|
|
|
+ // uni.showToast({ title: '请选择规格', icon: 'none' });
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // this.addCartGoods(data, this.buyNumber);
|
|
|
+ // }
|
|
|
},
|
|
|
// 添加购物袋
|
|
|
addCartGoods(da, num, spec = []) {
|
|
|
@@ -486,7 +507,19 @@ export default {
|
|
|
restaurant_id: this.MerchantInfo.restaurant_id,
|
|
|
brand_id: this.MerchantInfo.brand_id,
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
+ openm(){
|
|
|
+ let latitude = parseFloat(this.MerchantInfo.latitude);
|
|
|
+ let longitude = parseFloat(this.MerchantInfo.longitude);
|
|
|
+ let name = this.MerchantInfo.brand_name;
|
|
|
+ let address = this.MerchantInfo.restaurant_address;
|
|
|
+ uni.openLocation({
|
|
|
+ latitude, longitude, scale: 5, name, address,
|
|
|
+ success: function () {
|
|
|
+ console.log('success');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -505,11 +538,9 @@ page {
|
|
|
background-color: #fff;
|
|
|
box-shadow: 0 0 10rpx rgba(0, 0, 0, .05);
|
|
|
padding: 0 32rpx;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- justify-content: center;
|
|
|
|
|
|
.left {
|
|
|
+ width: calc(100% - 60rpx);
|
|
|
.title {
|
|
|
width: 90%;
|
|
|
color: #343434;
|
|
|
@@ -527,6 +558,14 @@ page {
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
}
|
|
|
+ .right{
|
|
|
+ width: 60rpx;
|
|
|
+ text-align: right;
|
|
|
+ .iconfont{
|
|
|
+ font-size: 50rpx;
|
|
|
+ color: #666;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.goodsBox {
|
|
|
@@ -717,6 +756,11 @@ page {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+.hahaha{
|
|
|
+ text-align: center;
|
|
|
+ margin-top: calc(30vh - 150rpx);
|
|
|
+}
|
|
|
+
|
|
|
.footer {
|
|
|
position: fixed;
|
|
|
bottom: 80rpx;
|
|
|
@@ -1008,6 +1052,10 @@ page {
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
position: relative;
|
|
|
+ .img{
|
|
|
+ object-fit: cover;
|
|
|
+ border-radius: 10rpx 10rpx 0 0;
|
|
|
+ }
|
|
|
|
|
|
icon {
|
|
|
position: absolute;
|