|
|
|
@ -1,19 +1,17 @@ |
|
|
|
|
<template> |
|
|
|
|
<view class="content"> |
|
|
|
|
<!-- <view class="width100 height85 backcorfff heads"> |
|
|
|
|
<view class="paddtop10 width90 alijusstart"> |
|
|
|
|
<view class="width80p font16 fcor333 fontwig6"> |
|
|
|
|
<image mode="widthFix" class="icon15 marRight10" src="../static/imgs/shop.png"></image>时代天街 |
|
|
|
|
</view> |
|
|
|
|
<view class="width20 fotrt"> |
|
|
|
|
<image mode="widthFix" class="icon20" src="../static/imgs/nocollection.png"></image> |
|
|
|
|
<image mode="widthFix" class="icon20" src="../static/imgs/collection.png"></image> |
|
|
|
|
</view> |
|
|
|
|
<view class="width100" v-if="flist ==''"> |
|
|
|
|
<view class="width100 height40 font14 padleft15 alijusstart" |
|
|
|
|
style="background-color: #e7f2ea;color: #4e8a5c;"> |
|
|
|
|
<image class="icon20 paddtright5" mode="widthFix" src="../static/imgs/horn.png"></image> |
|
|
|
|
营业时间{{starttime}}至{{endtime}}. |
|
|
|
|
</view> |
|
|
|
|
<view v-if="flist == '' " class="width100 mart60 fotct font14 fcor666"> |
|
|
|
|
<image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image> |
|
|
|
|
</view> |
|
|
|
|
<view class="width90 mart5 font12 fcor999">前门西大街正阳市场1号楼中部</view> |
|
|
|
|
</view> --> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<scroll-view scroll-y class="left-aside"> |
|
|
|
|
<scroll-view scroll-y class="left-aside" v-if="flist !=''"> |
|
|
|
|
<view v-for="(item,index) in flist" :key="index" class="f-item" :class="{active: item.name == currentId}" |
|
|
|
|
@click="tabtap(item)"> |
|
|
|
|
<view class="width100 fotct"> |
|
|
|
@ -26,8 +24,8 @@ |
|
|
|
|
</scroll-view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<scroll-view scroll-with-animation scroll-y class="right-aside" @scroll="asideScroll" |
|
|
|
|
:scroll-top="tabScrollTop"> |
|
|
|
|
<scroll-view scroll-with-animation scroll-y class="right-aside" @scroll="asideScroll" :scroll-top="tabScrollTop" |
|
|
|
|
v-if="flist !='' "> |
|
|
|
|
<view v-for="(item,index) in slist" :key="index" :id="'main-'+item.kfcId"> |
|
|
|
|
<view class="s-item width90"> |
|
|
|
|
<text class="promotion_mixg1 backcor99" style="margin-right: -3px;"></text> |
|
|
|
@ -36,7 +34,7 @@ |
|
|
|
|
{{item.name}} |
|
|
|
|
</view> |
|
|
|
|
<view v-if="titem.cateName == item.name" class="t-list mart10 paddbotm10" v-for="(titem,index) in tlist" |
|
|
|
|
:key="index" @click="showPopups(titem)"> |
|
|
|
|
:key="index"> |
|
|
|
|
<view class="paddtop10 width94 font16 fcor333 fotrt fontwig6 text2"> |
|
|
|
|
{{titem.productName}} |
|
|
|
|
</view> |
|
|
|
@ -59,10 +57,22 @@ |
|
|
|
|
v-if="titem.originalPrice == titem.salePrice" style="text-decoration: line-through;"> |
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
|
<view class="mart10 icon-click fotrt"> |
|
|
|
|
<!-- <image class="btn-reduce" mode="widthFix" src="../static/imgs/reduce.png"></image> --> |
|
|
|
|
<!-- <view class="num fcorfff" style="background: #d90209;">1</view> --> |
|
|
|
|
<image class="btn-plus" mode="widthFix" src="../static/imgs/plus.png"></image> |
|
|
|
|
<view class="mart10 icon-click fotrt alijusend" v-if="titem.productId"> |
|
|
|
|
<image class="btn-reduce" mode="widthFix" src="../static/imgs/reduce.png" |
|
|
|
|
v-if="titem.count > 0" @click="deletenums(titem)"></image> |
|
|
|
|
<view class="num fcorfff" style="background: #d90209;" v-if="titem.count > 0"> |
|
|
|
|
{{titem.count}} |
|
|
|
|
</view> |
|
|
|
|
<image class="btn-plus" mode="widthFix" src="../static/imgs/plus.png" |
|
|
|
|
@click="showPopups(titem)"></image> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<view class="mart10 icon-click fotrt alijusend" v-else> |
|
|
|
|
<view class="num fcorfff font14" style="background: #d90209;" @click="showPopups(titem)"> |
|
|
|
|
选规格 |
|
|
|
|
</view> |
|
|
|
|
<view class="unibadge" v-if="titem.count > 0"> |
|
|
|
|
{{titem.count}}</view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
@ -72,12 +82,13 @@ |
|
|
|
|
</view> |
|
|
|
|
</scroll-view> |
|
|
|
|
|
|
|
|
|
<shopcart :goods="shoppingcart" @add="addCart" @dec="decreaseCart" @input="inputCart" @delAll="delAll"> |
|
|
|
|
<shopcart v-if="flist !='' " :goods="shoppingcart" @add="addCart" @dec="decreaseCart" |
|
|
|
|
@delAll="delAll"> |
|
|
|
|
</shopcart> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 弹窗选择规格 --> |
|
|
|
|
<wybPopup ref="popup" type="bottom" width="500" height="700" scrollY="true" radius="6" :showCloseIcon="true"> |
|
|
|
|
<wybPopup ref="popup" type="bottom" width="500" height="700" scrollY="true" radius="6" :showCloseIcon="true"> |
|
|
|
|
<image mode="widthFix" class="width40w mart40" :src="kfcimgs"></image> |
|
|
|
|
<view class="width100 line1 mart10"></view> |
|
|
|
|
<view class="mart20 width90 font18 fontwig6 fcor333">{{kfcname}}</view> |
|
|
|
@ -139,11 +150,17 @@ |
|
|
|
|
kfcname: '', // 名字 |
|
|
|
|
kfcimgs: '', //图片 |
|
|
|
|
kfcprice: '', //价格 |
|
|
|
|
kfcoldprice: '' //原价 |
|
|
|
|
kfcoldprice: '', //原价 |
|
|
|
|
starttime: '', //开始时间 |
|
|
|
|
endtime: '', //结束时间 |
|
|
|
|
imagewxUrl: app.globalData.imageWxImg, |
|
|
|
|
imgadres: 'storeClose.png', |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onLoad(options) { |
|
|
|
|
this.storeCode = options.storeCode; |
|
|
|
|
this.starttime = options.sttime; |
|
|
|
|
this.endtime = options.entime; |
|
|
|
|
this.listByStoreCode(); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
@ -168,7 +185,7 @@ |
|
|
|
|
this.tlist.push(items); |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.currentId = res.return_data[0].name; |
|
|
|
|
this.currentId = res.return_data[0].name; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
@ -232,6 +249,21 @@ |
|
|
|
|
addCart: function(item) { |
|
|
|
|
if (item.num >= 0) { |
|
|
|
|
item.num++ |
|
|
|
|
for (var i = 0; i < this.tlist.length; i++) { |
|
|
|
|
if (this.tlist[i].productId && item.productId == this.tlist[i].productId) { |
|
|
|
|
this.tlist[i].count = item.num; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!this.tlist[i].productId) { |
|
|
|
|
for (var k = 0; k < this.tlist[i].specGroups.length; k++) { |
|
|
|
|
if (item.productId == this.tlist[i].specGroups[k].productId) { |
|
|
|
|
this.tlist[i].count = item.num |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.shoppingcart.forEach((good) => { |
|
|
|
|
if (item.name == good.name) |
|
|
|
|
good.num = item.num |
|
|
|
@ -248,27 +280,25 @@ |
|
|
|
|
decreaseCart(item) { |
|
|
|
|
if (item.num) { |
|
|
|
|
item.num-- |
|
|
|
|
this.shoppingcart.forEach((good) => { |
|
|
|
|
if (item.name == good.name) |
|
|
|
|
good.num = item.num |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
inputCart: function(item) { |
|
|
|
|
if (item.num >= 0) { |
|
|
|
|
item.num++ |
|
|
|
|
this.shoppingcart.forEach((good) => { |
|
|
|
|
if (item.name == good.name) |
|
|
|
|
good.num = item.num + -1 |
|
|
|
|
}) |
|
|
|
|
for (var i = 0; i < this.tlist.length; i++) { |
|
|
|
|
if (this.tlist[i].productId && item.productId == this.tlist[i].productId) { |
|
|
|
|
this.tlist[i].count = this.tlist[i].count - 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
if (!this.tlist[i].productId) { |
|
|
|
|
for (var k = 0; k < this.tlist[i].specGroups.length; k++) { |
|
|
|
|
if (item.productId == this.tlist[i].specGroups[k].productId) { |
|
|
|
|
this.tlist[i].count = this.tlist[i].count - 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
this.shoppingcart.forEach((good) => { |
|
|
|
|
if (item.name == good.name) |
|
|
|
|
Vue.set(good, 'count', 1) |
|
|
|
|
good.num = item.num |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
// 清空购物车 |
|
|
|
|
delAll() { |
|
|
|
@ -276,13 +306,34 @@ |
|
|
|
|
if (good.num) { |
|
|
|
|
good.num = 0 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
for (var i = 0; i < this.tlist.length; i++) { |
|
|
|
|
this.tlist[i].count = 0; |
|
|
|
|
} |
|
|
|
|
this.shoppingcart = []; |
|
|
|
|
app.globalData.qianzhulist = ''; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//商品减 |
|
|
|
|
deletenums(item) { |
|
|
|
|
if (item.count) { |
|
|
|
|
item.count-- |
|
|
|
|
for (var i = 0; i < this.tlist.length; i++) { |
|
|
|
|
if (this.tlist[i].productId && item.productId == this.tlist[i].productId) { |
|
|
|
|
this.tlist[i].count = item.count; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.shoppingcart.forEach((good) => { |
|
|
|
|
if (item.productName == good.name) |
|
|
|
|
good.num = item.count |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//弹出弹窗 |
|
|
|
|
showPopups(item) { |
|
|
|
|
let that = this; |
|
|
|
|
that.nums = 1; |
|
|
|
|
that.nums = 1; |
|
|
|
|
if (item.productId) { |
|
|
|
|
that.productId = item.productId; |
|
|
|
|
// that.kdjchangelist = item; |
|
|
|
@ -299,7 +350,7 @@ |
|
|
|
|
"imgs": that.kfcimgs, |
|
|
|
|
"price": that.kfcprice, |
|
|
|
|
"oldprice": that.kfcoldprice |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
that.shoppingcart.push(datas); |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '添加中...' |
|
|
|
@ -311,12 +362,12 @@ |
|
|
|
|
} else { |
|
|
|
|
let indexs = 1; |
|
|
|
|
for (var i = 0; i < that.shoppingcart.length; i++) { |
|
|
|
|
if (that.shoppingcart[i].name == that.kfcname) { |
|
|
|
|
indexs = 0; |
|
|
|
|
if (that.shoppingcart[i].name == that.kfcname) { |
|
|
|
|
indexs = 0; |
|
|
|
|
that.shoppingcart[i].num = that.shoppingcart[i].num + 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (indexs != 0) { |
|
|
|
|
if (indexs != 0) { |
|
|
|
|
let datas = { |
|
|
|
|
"num": 1, |
|
|
|
|
"storeCode": that.storeCode, |
|
|
|
@ -325,8 +376,8 @@ |
|
|
|
|
"imgs": that.kfcimgs, |
|
|
|
|
"price": that.kfcprice, |
|
|
|
|
"oldprice": that.kfcoldprice |
|
|
|
|
} |
|
|
|
|
that.shoppingcart.push(datas); |
|
|
|
|
} |
|
|
|
|
that.shoppingcart.push(datas); |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '添加中...' |
|
|
|
|
}) |
|
|
|
@ -335,17 +386,24 @@ |
|
|
|
|
}, 1000); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
that.kdjchangelist = item.specGroups; |
|
|
|
|
that.kfcimgs = item.specGroups[0].productImageUrl; |
|
|
|
|
that.productId = item.specGroups[0].productId; |
|
|
|
|
that.kfcprice = item.specGroups[0].salePrice; |
|
|
|
|
that.kfcname = item.specGroups[0].productName; |
|
|
|
|
that.kfcoldprice = item.specGroups[0].originalPrice; |
|
|
|
|
that.$refs.popup.show(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < that.tlist.length; i++) { |
|
|
|
|
if (that.tlist[i].productId && item.productId == that.tlist[i].productId) { |
|
|
|
|
that.tlist[i].count = that.tlist[i].count + 1 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
that.kdjchangelist = item.specGroups; |
|
|
|
|
that.kfcimgs = item.specGroups[0].productImageUrl; |
|
|
|
|
that.productId = item.specGroups[0].productId; |
|
|
|
|
that.kfcprice = item.specGroups[0].salePrice; |
|
|
|
|
that.kfcname = item.specGroups[0].productName; |
|
|
|
|
that.kfcoldprice = item.specGroups[0].originalPrice; |
|
|
|
|
that.$refs.popup.show(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//选择类型 |
|
|
|
|
changetype(item) { |
|
|
|
|
this.productId = item.productId; |
|
|
|
@ -367,7 +425,17 @@ |
|
|
|
|
"price": this.kfcprice, |
|
|
|
|
"oldprice": this.kfcoldprice |
|
|
|
|
} |
|
|
|
|
this.shoppingcart.push(datas); |
|
|
|
|
this.shoppingcart.push(datas); |
|
|
|
|
for (var i = 0; i < this.tlist.length; i++) { |
|
|
|
|
if (!this.tlist[i].productId) { |
|
|
|
|
for (var k = 0; k < this.tlist[i].specGroups.length; k++) { |
|
|
|
|
if (this.productId == this.tlist[i].specGroups[k].productId) { |
|
|
|
|
this.tlist[i].count = this.tlist[i].count + this.nums |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.$refs.popup.hide(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -375,7 +443,17 @@ |
|
|
|
|
for (var i = 0; i < this.shoppingcart.length; i++) { |
|
|
|
|
if (this.shoppingcart[i].name == this.kfcname) { |
|
|
|
|
indexs = 0; |
|
|
|
|
this.shoppingcart[i].num = this.shoppingcart[i].num + this.nums; |
|
|
|
|
this.shoppingcart[i].num = this.shoppingcart[i].num + this.nums; |
|
|
|
|
for (var i = 0; i < this.tlist.length; i++) { |
|
|
|
|
if (!this.tlist[i].productId) { |
|
|
|
|
for (var k = 0; k < this.tlist[i].specGroups.length; k++) { |
|
|
|
|
if (this.productId == this.tlist[i].specGroups[k].productId) { |
|
|
|
|
this.tlist[i].count = this.tlist[i].count + this.nums |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (indexs != 0) { |
|
|
|
@ -388,29 +466,39 @@ |
|
|
|
|
"price": this.kfcprice, |
|
|
|
|
"oldprice": this.kfcoldprice |
|
|
|
|
} |
|
|
|
|
this.shoppingcart.push(datas); |
|
|
|
|
this.shoppingcart.push(datas); |
|
|
|
|
for (var i = 0; i < this.tlist.length; i++) { |
|
|
|
|
if (!this.tlist[i].productId) { |
|
|
|
|
for (var k = 0; k < this.tlist[i].specGroups.length; k++) { |
|
|
|
|
if (this.productId == this.tlist[i].specGroups[k].productId) { |
|
|
|
|
this.tlist[i].count = this.tlist[i].count + this.nums |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.$refs.popup.hide(); |
|
|
|
|
}, |
|
|
|
|
//排除key对比 |
|
|
|
|
checinfo(item, item1) { |
|
|
|
|
const keys1 = Object.keys(item); |
|
|
|
|
const keys2 = Object.keys(item1); |
|
|
|
|
if (keys1.length !== keys2.length) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
for (let index = 0; index < keys1.length; index++) { |
|
|
|
|
const val1 = item[keys1[index]]; |
|
|
|
|
const val2 = item1[keys2[index]]; |
|
|
|
|
if (keys2[index] !== 'num') { |
|
|
|
|
if (val1 !== val2) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//排除key对比 |
|
|
|
|
checinfo(item, item1) { |
|
|
|
|
const keys1 = Object.keys(item); |
|
|
|
|
const keys2 = Object.keys(item1); |
|
|
|
|
if (keys1.length !== keys2.length) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
for (let index = 0; index < keys1.length; index++) { |
|
|
|
|
const val1 = item[keys1[index]]; |
|
|
|
|
const val2 = item1[keys2[index]]; |
|
|
|
|
if (keys2[index] !== 'num') { |
|
|
|
|
if (val1 !== val2) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//跳转详情 |
|
|
|
|
navToList() { |
|
|
|
@ -509,6 +597,7 @@ |
|
|
|
|
border-radius: 15px; |
|
|
|
|
background: #fff; |
|
|
|
|
min-height: 150px; |
|
|
|
|
|
|
|
|
|
&:after { |
|
|
|
|
content: ''; |
|
|
|
|
flex: 99; |
|
|
|
@ -518,7 +607,7 @@ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.qzgoodsimg { |
|
|
|
|
margin-top: -10px; |
|
|
|
|
margin-top: -10px; |
|
|
|
|
min-height: 100px; |
|
|
|
|
width: 120px; |
|
|
|
|
} |
|
|
|
@ -577,5 +666,19 @@ |
|
|
|
|
.wybfot { |
|
|
|
|
position: fixed; |
|
|
|
|
bottom: 0px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.unibadge { |
|
|
|
|
background: #000; |
|
|
|
|
width: 20px; |
|
|
|
|
height: 20px; |
|
|
|
|
border-radius: 50%; |
|
|
|
|
font-size: 9px; |
|
|
|
|
color: #fff; |
|
|
|
|
line-height: 20px; |
|
|
|
|
text-align: center; |
|
|
|
|
position: absolute; |
|
|
|
|
margin-top: -25px; |
|
|
|
|
margin-right: -5px; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|