|
@@ -82,7 +82,7 @@
|
|
|
|
|
|
|
|
|
|
<!-- 购物车 -->
|
|
<!-- 购物车 -->
|
|
- <u-popup :show="show" round="32rpx" mode="bottom" @close="show = false">
|
|
|
|
|
|
+ <u-popup :show="show" round="32rpx" mode="bottom" @close="close('show')">
|
|
<view class="popup-title-box" >
|
|
<view class="popup-title-box" >
|
|
<view class="title">
|
|
<view class="title">
|
|
已选商品
|
|
已选商品
|
|
@@ -157,7 +157,7 @@
|
|
|
|
|
|
|
|
|
|
<!-- 商品详情 -->
|
|
<!-- 商品详情 -->
|
|
- <u-popup :show="show2" round="32rpx" mode="bottom" @close="show2 = false">
|
|
|
|
|
|
+ <u-popup :show="show2" round="32rpx" mode="bottom" @close="close('show2')">
|
|
<view class="popup-goodsDetail">
|
|
<view class="popup-goodsDetail">
|
|
<view class="box">
|
|
<view class="box">
|
|
|
|
|
|
@@ -170,13 +170,13 @@
|
|
{{goodsInfo.product_description}}
|
|
{{goodsInfo.product_description}}
|
|
</view>
|
|
</view>
|
|
|
|
|
|
- <view class="choose-box" v-if="ot == 'NXDC'">
|
|
|
|
|
|
+ <view class="choose-box" v-if="goodsInfo.details&&ot == 'NXDC'">
|
|
<view class="choose-item" v-for="item in goodsInfo.details.spu_specs" :key="item.code">
|
|
<view class="choose-item" v-for="item in goodsInfo.details.spu_specs" :key="item.code">
|
|
<view class="choose-title">
|
|
<view class="choose-title">
|
|
{{item.name}}
|
|
{{item.name}}
|
|
</view>
|
|
</view>
|
|
<view class="item-box">
|
|
<view class="item-box">
|
|
- <view class="item" :class="[i.code == chooseInfo[item.code].code?'active':'']" v-for="i in item.values" :key="i.code" @click="choose(i,item.code)">
|
|
|
|
|
|
+ <view class="item" :class="[i.code == chooseInfo[item.code].code?'active':'',isDisable(i,'NXDC',item)?'disable':'']" v-for="i in item.values" :key="i.code" @click="choose(i,item.code)">
|
|
{{i.name}} {{i.price?`¥${i.price}`:''}}
|
|
{{i.name}} {{i.price?`¥${i.price}`:''}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -189,7 +189,7 @@
|
|
{{item.name}}
|
|
{{item.name}}
|
|
</view>
|
|
</view>
|
|
<view class="item-box">
|
|
<view class="item-box">
|
|
- <view class="item" :class="[i.id == chooseInfo[item.name+'-'+item.id].id?'active':'']" v-for="i in item.sku_infos" :key="i.id" @click="()=>choose(i,item.name+'-'+item.id)">
|
|
|
|
|
|
+ <view class="item" :class="[i.id == chooseInfo[item.name+'-'+item.id].id?'active':'',i.disable?'disable':'']" v-for="i in item.sku_infos" :key="i.id" @click="()=>choose(i,item.name+'-'+item.id)">
|
|
{{i.name}} {{i.price?`¥${i.price}`:''}}
|
|
{{i.name}} {{i.price?`¥${i.price}`:''}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -214,21 +214,21 @@
|
|
{{item.name}}
|
|
{{item.name}}
|
|
</view>
|
|
</view>
|
|
<view class="item-box">
|
|
<view class="item-box">
|
|
- <view class="item" :class="[i.id == chooseInfo[item.id].id?'active':'']" v-for="i in item.sku_infos" :key="i.id" @click="()=>choose(i,item.id)">
|
|
|
|
|
|
+ <view class="item" :class="[i.id == chooseInfo[item.id].id?'active':'',i.disable?'disable':'']" v-for="i in item.sku_infos" :key="i.id" @click="()=>choose(i,item.id)">
|
|
{{i.name}} {{i.price?`¥${i.price}`:''}}
|
|
{{i.name}} {{i.price?`¥${i.price}`:''}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
- <view class="choose-box" v-else-if="ot == 'XC'">
|
|
|
|
- <view class="choose-item" v-for="item in goodsInfo.details.specifications" :key="item.code">
|
|
|
|
|
|
+ <view class="choose-box" v-else-if="goodsInfo.details&&goodsInfo.details.specifications&&ot == 'XC'">
|
|
|
|
+ <view class="choose-item" v-for="item in goodsInfo.details.specifications" :key="item.id">
|
|
<view class="choose-title">
|
|
<view class="choose-title">
|
|
{{item.name}}
|
|
{{item.name}}
|
|
</view>
|
|
</view>
|
|
<view class="item-box">
|
|
<view class="item-box">
|
|
<!-- ,isDisable(i.id,'XC')?'disable':'' -->
|
|
<!-- ,isDisable(i.id,'XC')?'disable':'' -->
|
|
- <view class="item " :class="[i.id == chooseInfo[item.id].id?'active':'']" v-for="i in item.values" :key="i.id" @click="()=>choose(i,item.id,item)">
|
|
|
|
|
|
+ <view class="item " :class="[i.id == chooseInfo[item.id].id?'active':'',isDisable(i.id,'XC')?'disable':'']" v-for="i in item.values" :key="i.id" @click="choose(i,item.id,item)">
|
|
{{i.name}} {{i.price?`¥${i.price}`:''}}
|
|
{{i.name}} {{i.price?`¥${i.price}`:''}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -349,7 +349,8 @@
|
|
itemPrice:{//弹窗内商品价格
|
|
itemPrice:{//弹窗内商品价格
|
|
price:0,
|
|
price:0,
|
|
oldPrice:0
|
|
oldPrice:0
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ test:false
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -369,6 +370,7 @@
|
|
},
|
|
},
|
|
// 选择的规格文字 同时计算当前选择的价格
|
|
// 选择的规格文字 同时计算当前选择的价格
|
|
config(){
|
|
config(){
|
|
|
|
+ console.log('config');
|
|
let str = ''
|
|
let str = ''
|
|
for (let key in this.chooseInfo) {
|
|
for (let key in this.chooseInfo) {
|
|
if(this.ot == 'KD'){
|
|
if(this.ot == 'KD'){
|
|
@@ -384,7 +386,7 @@
|
|
price,
|
|
price,
|
|
oldPrice
|
|
oldPrice
|
|
}
|
|
}
|
|
- }else if(this.goodsInfo.details&&this.goodsInfo.details.specifications&&this.ot=='XC'){
|
|
|
|
|
|
+ }else if(this.ot=='XC'&&this.goodsInfo.details&&this.goodsInfo.details.specifications){
|
|
let addPrice = 0
|
|
let addPrice = 0
|
|
for (let key in this.chooseInfo) {
|
|
for (let key in this.chooseInfo) {
|
|
addPrice += this.chooseInfo[key].price
|
|
addPrice += this.chooseInfo[key].price
|
|
@@ -426,7 +428,8 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- isDisable(item,type){
|
|
|
|
|
|
+ isDisable(item,type,data){
|
|
|
|
+ console.log('isDisable');
|
|
if(type == 'KD'){
|
|
if(type == 'KD'){
|
|
let flag = true
|
|
let flag = true
|
|
this.goodsInfo.skuCombinList.map(skuItem=>{
|
|
this.goodsInfo.skuCombinList.map(skuItem=>{
|
|
@@ -439,7 +442,6 @@
|
|
return flag
|
|
return flag
|
|
}else if(type == 'XC'){
|
|
}else if(type == 'XC'){
|
|
let flag = false
|
|
let flag = false
|
|
- console.log('pppppppp',this.chooseInfo);
|
|
|
|
for (let key in this.chooseInfo) {
|
|
for (let key in this.chooseInfo) {
|
|
if(this.chooseInfo[key].exclusives.length){
|
|
if(this.chooseInfo[key].exclusives.length){
|
|
this.chooseInfo[key].exclusives.map(i=>{
|
|
this.chooseInfo[key].exclusives.map(i=>{
|
|
@@ -452,6 +454,27 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return flag
|
|
return flag
|
|
|
|
+ }else if(type == 'NXDC'){
|
|
|
|
+ let flag = true
|
|
|
|
+ let cur = {}
|
|
|
|
+ for (let key in this.chooseInfo) {
|
|
|
|
+ if(data.code == key){
|
|
|
|
+ cur[key] = item.code
|
|
|
|
+ }else{
|
|
|
|
+ cur[key] = this.chooseInfo[key].code
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.goodsInfo.details.sku_infos.map(item=>{
|
|
|
|
+ let obj = {}
|
|
|
|
+ item.specs.map(i=>{
|
|
|
|
+ obj[i.code] = i.spec_code
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ if(this.areObjectsEqual(cur,obj)){
|
|
|
|
+ flag = false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return flag
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 选择规格
|
|
// 选择规格
|
|
@@ -459,10 +482,8 @@
|
|
console.log(item,key,data,this.chooseInfo);
|
|
console.log(item,key,data,this.chooseInfo);
|
|
if(this.ot == 'XC'){
|
|
if(this.ot == 'XC'){
|
|
if(this.chooseInfo[key]&&this.chooseInfo[key].id == item.id &&!data.mandatory){
|
|
if(this.chooseInfo[key]&&this.chooseInfo[key].id == item.id &&!data.mandatory){
|
|
- console.log(1111);
|
|
|
|
this.$delete(this.chooseInfo,key)
|
|
this.$delete(this.chooseInfo,key)
|
|
}else{
|
|
}else{
|
|
- console.log(2222);
|
|
|
|
this.$set(this.chooseInfo,key,item)
|
|
this.$set(this.chooseInfo,key,item)
|
|
}
|
|
}
|
|
}else if(this.ot == 'MDL'){
|
|
}else if(this.ot == 'MDL'){
|
|
@@ -540,9 +561,11 @@
|
|
},
|
|
},
|
|
// 购物车内添加数量 商品添加数量 选择规格时不走这里 但是选择规格的购物车内数量操作走这里
|
|
// 购物车内添加数量 商品添加数量 选择规格时不走这里 但是选择规格的购物车内数量操作走这里
|
|
add(item,num,data={},idx){//item:当前操作item num:增加或者减少 data:当前item的上层栏目,idx:购物车内当前操作商品index 方便删除
|
|
add(item,num,data={},idx){//item:当前操作item num:增加或者减少 data:当前item的上层栏目,idx:购物车内当前操作商品index 方便删除
|
|
|
|
+ console.log('add',item);
|
|
// 如果需要选择规格
|
|
// 如果需要选择规格
|
|
if(data.childClassList) return this.handleItem(item,data)
|
|
if(data.childClassList) return this.handleItem(item,data)
|
|
-
|
|
|
|
|
|
+ // 影响逻辑太大 暂时不改
|
|
|
|
+ // if(item.menuFlag == "C") return this.handleItem(item,data)
|
|
// 肯德基
|
|
// 肯德基
|
|
if(this.ot == 'Kfc'){
|
|
if(this.ot == 'Kfc'){
|
|
if(this.carList.some(i=>item.productId == i.productId)){
|
|
if(this.carList.some(i=>item.productId == i.productId)){
|
|
@@ -565,7 +588,7 @@
|
|
}
|
|
}
|
|
this.carList.push(obj)
|
|
this.carList.push(obj)
|
|
}
|
|
}
|
|
- // }else if(this.ot == 'NXDC'){//奈雪的茶 购物车内没有的商品不会从这里添加 所以只处理有的情况
|
|
|
|
|
|
+ // }else if(this.ot == 'NXDC'){
|
|
}else{
|
|
}else{
|
|
if(this.carList.some((i,d)=>item.productId == i.productId)){
|
|
if(this.carList.some((i,d)=>item.productId == i.productId)){
|
|
this.carList.forEach((row,index)=>{
|
|
this.carList.forEach((row,index)=>{
|
|
@@ -576,6 +599,15 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ }else{//单品直接添加
|
|
|
|
+ console.log(2222);
|
|
|
|
+ this.chooseInfo = {}
|
|
|
|
+ this.itemPrice = {
|
|
|
|
+ price:this.item.priceHead,
|
|
|
|
+ oldPrice:this.item.price
|
|
|
|
+ }
|
|
|
|
+ this.item = item
|
|
|
|
+ this.handleAdd()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -840,6 +872,9 @@
|
|
}
|
|
}
|
|
|
|
|
|
return true;
|
|
return true;
|
|
|
|
+ },
|
|
|
|
+ close(key){
|
|
|
|
+ this[key] = false
|
|
},
|
|
},
|
|
handleItem(i,item){
|
|
handleItem(i,item){
|
|
console.log(item);
|
|
console.log(item);
|
|
@@ -856,7 +891,6 @@
|
|
this.$set(this.chooseInfo,item.code,item.values[0])
|
|
this.$set(this.chooseInfo,item.code,item.values[0])
|
|
})
|
|
})
|
|
}else if(this.goodsInfo.details&&this.goodsInfo.details.specifications&&this.ot=='XC'){//喜茶
|
|
}else if(this.goodsInfo.details&&this.goodsInfo.details.specifications&&this.ot=='XC'){//喜茶
|
|
- console.log('xccccc',this.goodsInfo.details);
|
|
|
|
this.goodsInfo.details.specifications.map(item=>{
|
|
this.goodsInfo.details.specifications.map(item=>{
|
|
item.values.map(i=>{
|
|
item.values.map(i=>{
|
|
if(i.checked){
|
|
if(i.checked){
|
|
@@ -866,16 +900,32 @@
|
|
})
|
|
})
|
|
}else if(this.goodsInfo.details&&this.goodsInfo.details.optional&&this.goodsInfo.details.optional.length&&this.ot=='XBK'){//星巴克
|
|
}else if(this.goodsInfo.details&&this.goodsInfo.details.optional&&this.goodsInfo.details.optional.length&&this.ot=='XBK'){//星巴克
|
|
this.goodsInfo.details.optional.map(item=>{
|
|
this.goodsInfo.details.optional.map(item=>{
|
|
- this.$set(this.chooseInfo,item.id,item.sku_infos[0])
|
|
|
|
|
|
+ item.sku_infos.map(i=>{
|
|
|
|
+ if(i.checked){
|
|
|
|
+ this.$set(this.chooseInfo,item.id,i)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ // this.$set(this.chooseInfo,item.id,item.sku_infos[0])
|
|
})
|
|
})
|
|
}else if(this.goodsInfo.details&&this.goodsInfo.details.optional&&this.goodsInfo.details.optional.length){//麦当劳
|
|
}else if(this.goodsInfo.details&&this.goodsInfo.details.optional&&this.goodsInfo.details.optional.length){//麦当劳
|
|
this.goodsInfo.details.optional.map(item=>{
|
|
this.goodsInfo.details.optional.map(item=>{
|
|
|
|
+ item.sku_infos.map(i=>{
|
|
|
|
+ if(i.checked){
|
|
|
|
+ this.$set(this.chooseInfo,item.name+'-'+item.id,i)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
// id可能相同 所以加上类目的name 方便创建订单时能取到id
|
|
// id可能相同 所以加上类目的name 方便创建订单时能取到id
|
|
- this.$set(this.chooseInfo,item.name+'-'+item.id,item.sku_infos[0])
|
|
|
|
|
|
+ // this.$set(this.chooseInfo,item.name+'-'+item.id,item.sku_infos[0])
|
|
})
|
|
})
|
|
}else if(this.goodsInfo.details&&this.goodsInfo.details.specifications&&this.ot=='RXKF'){//瑞幸
|
|
}else if(this.goodsInfo.details&&this.goodsInfo.details.specifications&&this.ot=='RXKF'){//瑞幸
|
|
this.goodsInfo.details.specifications.map(item=>{
|
|
this.goodsInfo.details.specifications.map(item=>{
|
|
- this.$set(this.chooseInfo,item.name,item.ingredients[0])
|
|
|
|
|
|
+ item.ingredients.map(i=>{
|
|
|
|
+ if(i.checked){
|
|
|
|
+ this.$set(this.chooseInfo,item.name,i)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ // this.$set(this.chooseInfo,item.name,item.ingredients[0])
|
|
})
|
|
})
|
|
}else if(this.goodsInfo.firstSku&&this.goodsInfo.firstSku.skusSpecs&&this.ot=='KD'){//库迪
|
|
}else if(this.goodsInfo.firstSku&&this.goodsInfo.firstSku.skusSpecs&&this.ot=='KD'){//库迪
|
|
this.goodsInfo.product_img = this.goodsInfo.detailImgUrl
|
|
this.goodsInfo.product_img = this.goodsInfo.detailImgUrl
|
|
@@ -925,7 +975,6 @@
|
|
this.$nextTick(()=>{
|
|
this.$nextTick(()=>{
|
|
let query = uni.createSelectorQuery().in(this);
|
|
let query = uni.createSelectorQuery().in(this);
|
|
query.selectAll('.section-name').boundingClientRect(data=>{
|
|
query.selectAll('.section-name').boundingClientRect(data=>{
|
|
- console.log(data);
|
|
|
|
this.topList =data.map(item=>{
|
|
this.topList =data.map(item=>{
|
|
return item.top
|
|
return item.top
|
|
})
|
|
})
|
|
@@ -1040,7 +1089,6 @@
|
|
const openSecondsTotal = openHours * 3600 + openMinutes * 60 + openSeconds;
|
|
const openSecondsTotal = openHours * 3600 + openMinutes * 60 + openSeconds;
|
|
const closeSecondsTotal = closeHours * 3600 + closeMinutes * 60 + closeSeconds;
|
|
const closeSecondsTotal = closeHours * 3600 + closeMinutes * 60 + closeSeconds;
|
|
|
|
|
|
- console.log(openSecondsTotal,closeSecondsTotal,nowSecondsTotal);
|
|
|
|
if ( openSecondsTotal <nowSecondsTotal && nowSecondsTotal<closeSecondsTotal ) {
|
|
if ( openSecondsTotal <nowSecondsTotal && nowSecondsTotal<closeSecondsTotal ) {
|
|
return true
|
|
return true
|
|
} else {
|
|
} else {
|
|
@@ -1443,6 +1491,7 @@
|
|
}
|
|
}
|
|
.item.disable{
|
|
.item.disable{
|
|
color: #AAAAAA;
|
|
color: #AAAAAA;
|
|
|
|
+ pointer-events: none;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|