|
@@ -166,7 +166,7 @@
|
|
|
<view class="title">
|
|
|
{{goodsInfo.product_name}}
|
|
|
</view>
|
|
|
- <view class="desc" v-if="goodsInfo.product_description">
|
|
|
+ <view class="desc" v-html="goodsInfo.product_description" v-if="goodsInfo.product_description">
|
|
|
{{goodsInfo.product_description}}
|
|
|
</view>
|
|
|
|
|
@@ -227,12 +227,38 @@
|
|
|
{{item.name}}
|
|
|
</view>
|
|
|
<view class="item-box">
|
|
|
- <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)">
|
|
|
+ <!-- ,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)">
|
|
|
{{i.name}} {{i.price?`¥${i.price}`:''}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view class="choose-box" v-else-if="ot == 'RXKF'">
|
|
|
+ <view class="choose-item" v-for="item in goodsInfo.details.specifications" :key="item.code">
|
|
|
+ <view class="choose-title">
|
|
|
+ {{item.name}}
|
|
|
+ </view>
|
|
|
+ <view class="item-box">
|
|
|
+ <view class="item" :class="[i.name == chooseInfo[item.name].name?'active':'']" v-for="(i,d) in item.ingredients" :key="d" @click="()=>choose(i,item.name,item)">
|
|
|
+ {{i.name}} {{i.price?`¥${i.price}`:''}}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="choose-box" v-else-if="ot == 'KD'">
|
|
|
+ <view class="choose-item" v-for="item in goodsInfo.specItems" :key="item.specItemNo">
|
|
|
+ <view class="choose-title">
|
|
|
+ {{item.specItemName}}
|
|
|
+ </view>
|
|
|
+ <view class="item-box">
|
|
|
+ <view class="item" :class="[i.name == chooseInfo[item.specItemNo].specItemValueName?'active':'',isDisable(i,'KD')?'disable':'']" v-for="(i,d) in item.specValueList" :key="d" @click="()=>choose(i,item.specItemNo,item)">
|
|
|
+ {{i.name}}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
|
|
|
|
|
|
|
|
@@ -281,6 +307,14 @@
|
|
|
|
|
|
</u-modal>
|
|
|
|
|
|
+ <u-modal :show="show3" title="提示" confirmColor="#FF4D3A" confirmText="更换门店" @confirm="goShopList">
|
|
|
+ <view class="modal-box">
|
|
|
+ <view class="notice">
|
|
|
+ 当前门店暂时无商品上架,您可以切换至其他门店进行购买。
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </u-modal>
|
|
|
+
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -293,6 +327,7 @@
|
|
|
show:false,
|
|
|
show1:false,
|
|
|
show2:false,
|
|
|
+ show3:false,
|
|
|
active:0,
|
|
|
list:[],
|
|
|
shopInfo:{
|
|
@@ -336,16 +371,20 @@
|
|
|
config(){
|
|
|
let str = ''
|
|
|
for (let key in this.chooseInfo) {
|
|
|
- str +=this.chooseInfo[key].name +'/'
|
|
|
+ if(this.ot == 'KD'){
|
|
|
+ str +=this.chooseInfo[key].specItemValueName +'/'
|
|
|
+ }else{
|
|
|
+ str +=this.chooseInfo[key].name +'/'
|
|
|
+ }
|
|
|
}
|
|
|
- if(this.goodsInfo.details&&this.goodsInfo.details.sku_infos){
|
|
|
+ if(this.goodsInfo.details&&this.goodsInfo.details.sku_infos&&this.ot=='NXDC'){
|
|
|
let {productId,price,oldPrice} = this.findData()
|
|
|
this.productId = productId
|
|
|
this.itemPrice = {
|
|
|
price,
|
|
|
oldPrice
|
|
|
}
|
|
|
- }else if(this.goodsInfo.details&&this.goodsInfo.details.specifications){
|
|
|
+ }else if(this.goodsInfo.details&&this.goodsInfo.details.specifications&&this.ot=='XC'){
|
|
|
let addPrice = 0
|
|
|
for (let key in this.chooseInfo) {
|
|
|
addPrice += this.chooseInfo[key].price
|
|
@@ -369,19 +408,61 @@
|
|
|
price:this.item.priceHead+addPrice,
|
|
|
oldPrice:this.item.price+addPrice
|
|
|
}
|
|
|
+ }else if(this.goodsInfo.details&&this.goodsInfo.details.sku_infos&&this.ot == 'RXKF'){
|
|
|
+ let {productId,price,oldPrice} = this.findData1()
|
|
|
+ this.productId = productId
|
|
|
+ this.itemPrice = {
|
|
|
+ price,
|
|
|
+ oldPrice
|
|
|
+ }
|
|
|
+ }else if(this.goodsInfo.skuCombinList&&this.ot == 'KD'){
|
|
|
+ this.productId = this.findData2()
|
|
|
+ this.itemPrice = {
|
|
|
+ price:this.item.priceHead,
|
|
|
+ oldPrice:this.item.price
|
|
|
+ }
|
|
|
}
|
|
|
- console.log('jiage',this.itemPrice);
|
|
|
return str
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ isDisable(item,type){
|
|
|
+ if(type == 'KD'){
|
|
|
+ let flag = true
|
|
|
+ this.goodsInfo.skuCombinList.map(skuItem=>{
|
|
|
+ skuItem.skusSpecs.map(skuIt=>{
|
|
|
+ if(skuIt.specItemValueName == item.name){
|
|
|
+ flag = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ return flag
|
|
|
+ }else if(type == 'XC'){
|
|
|
+ let flag = false
|
|
|
+ console.log('pppppppp',this.chooseInfo);
|
|
|
+ for (let key in this.chooseInfo) {
|
|
|
+ if(this.chooseInfo[key].exclusives.length){
|
|
|
+ this.chooseInfo[key].exclusives.map(i=>{
|
|
|
+ i.values.map(it=>{
|
|
|
+ if(it.id == item){
|
|
|
+ flag = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return flag
|
|
|
+ }
|
|
|
+ },
|
|
|
// 选择规格
|
|
|
choose(item,key,data){
|
|
|
- console.log(item,key);
|
|
|
+ console.log(item,key,data,this.chooseInfo);
|
|
|
if(this.ot == 'XC'){
|
|
|
if(this.chooseInfo[key]&&this.chooseInfo[key].id == item.id &&!data.mandatory){
|
|
|
+ console.log(1111);
|
|
|
this.$delete(this.chooseInfo,key)
|
|
|
}else{
|
|
|
+ console.log(2222);
|
|
|
this.$set(this.chooseInfo,key,item)
|
|
|
}
|
|
|
}else if(this.ot == 'MDL'){
|
|
@@ -398,7 +479,27 @@
|
|
|
this.$set(this.chooseInfo,key,item)
|
|
|
}
|
|
|
}
|
|
|
- else{//奈雪的茶
|
|
|
+ else if(this.ot == 'KD'){
|
|
|
+ let flag = false
|
|
|
+ this.goodsInfo.skuCombinList.map(skuItem=>{
|
|
|
+ skuItem.skusSpecs.map(skuIt=>{
|
|
|
+ if(skuIt.specItemValueName == item.name){
|
|
|
+ flag = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // 在sku内有的才能选择
|
|
|
+ if(flag){
|
|
|
+ // 把数据组装成自己转换成skusSpecs格式对象
|
|
|
+ this.$set(this.chooseInfo,key,
|
|
|
+ {specItemName: data.specItemName,
|
|
|
+ specItemNo: key,
|
|
|
+ specItemValue: item.value,
|
|
|
+ specItemValueName: item.name})
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else{//奈雪的茶 瑞幸
|
|
|
this.$set(this.chooseInfo,key,item)
|
|
|
}
|
|
|
},
|
|
@@ -408,6 +509,12 @@
|
|
|
url:'./shopList'
|
|
|
})
|
|
|
},
|
|
|
+ goShopList(){
|
|
|
+ this.show3 = false
|
|
|
+ uni.navigateTo({
|
|
|
+ url:'./shopList'
|
|
|
+ })
|
|
|
+ },
|
|
|
// 滚动的选择商品
|
|
|
scroll(val){
|
|
|
if(!this.offsetTop){
|
|
@@ -476,7 +583,7 @@
|
|
|
add1(num){
|
|
|
this.num+=num
|
|
|
},
|
|
|
- // 计算当前选择规格价格和code
|
|
|
+ // 计算奈雪当前选择规格价格和code
|
|
|
findData(){
|
|
|
let productId = ''
|
|
|
let cur = {}
|
|
@@ -506,6 +613,58 @@
|
|
|
oldPrice:oldPrice+addPrice
|
|
|
}
|
|
|
},
|
|
|
+ // 计算瑞幸当前选择规格价格和code
|
|
|
+ findData1(){
|
|
|
+ let productId = ''
|
|
|
+ let cur = {}
|
|
|
+ let price = 0
|
|
|
+ let oldPrice = 0
|
|
|
+ let addPrice = 0
|
|
|
+ for (let key in this.chooseInfo) {
|
|
|
+ cur[key] = this.chooseInfo[key].name
|
|
|
+ addPrice += this.chooseInfo[key].price
|
|
|
+ }
|
|
|
+ this.goodsInfo.details.sku_infos.map(item=>{
|
|
|
+ let obj = {}
|
|
|
+ item.values.map(i=>{
|
|
|
+ obj[i.name] = i.spec_name
|
|
|
+
|
|
|
+ })
|
|
|
+ if(this.areObjectsEqual(cur,obj)){
|
|
|
+ price = this.item.priceHead
|
|
|
+ oldPrice = this.item.price
|
|
|
+ return productId = item.code
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('找到对应的1',productId,price);
|
|
|
+ return {
|
|
|
+ productId,
|
|
|
+ price:price+addPrice,
|
|
|
+ oldPrice:oldPrice+addPrice
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 计算库迪当前选择规格
|
|
|
+ findData2(){
|
|
|
+ let productId = ''
|
|
|
+ let cur = {}
|
|
|
+ for (let key in this.chooseInfo) {
|
|
|
+ cur[key] = this.chooseInfo[key].specItemValue
|
|
|
+ }
|
|
|
+ this.goodsInfo.skuCombinList.map(item=>{
|
|
|
+ let obj = {}
|
|
|
+ item.skusSpecs.map(i=>{
|
|
|
+ obj[i.specItemNo] = i.specItemValue
|
|
|
+
|
|
|
+ })
|
|
|
+ console.log(cur,obj);
|
|
|
+ if(this.areObjectsEqual(cur,obj)){
|
|
|
+ return productId = item.skuNo
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('找到对应的3',productId);
|
|
|
+ return productId
|
|
|
+
|
|
|
+ },
|
|
|
// 选择规格后,加入购物车
|
|
|
handleAdd(){
|
|
|
this.show2 = false
|
|
@@ -556,11 +715,51 @@
|
|
|
]
|
|
|
}
|
|
|
}else if(this.ot == 'MDL'){
|
|
|
+ let products = []
|
|
|
+ if(this.goodsInfo.details.optional.length){//有可选才添加 没有默认空数组
|
|
|
+ for (let key in this.chooseInfo) {
|
|
|
+ products.push(
|
|
|
+ {
|
|
|
+ "linkId": key.split('-')[1],//下单参数linkId(有时会和主商品id相同)
|
|
|
+ "productId": this.chooseInfo[key].id,//套餐选项商品id
|
|
|
+ "quantity": 1
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ obj ={
|
|
|
+ "imageUrl": this.item.imageUrl,
|
|
|
+ "nameCn": this.item.nameCn,
|
|
|
+ "productId": this.item.productId,
|
|
|
+ "quantity": this.num,
|
|
|
+ "sellPrice": this.itemPrice.price,//市场价(如果存在套餐选项加价,这里的金额需要计算加价)
|
|
|
+ "orgPrice": this.itemPrice.oldPrice,
|
|
|
+ "config": JSON.parse(JSON.stringify(this.config)) , //这里只是为了直观展示套餐选项,实际下单可以传空
|
|
|
+ "selected": [
|
|
|
+ {
|
|
|
+ "round": 0,//喜茶产品round目前没有使用,传0
|
|
|
+ "products": products
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ obj ={
|
|
|
+ "imageUrl": this.item.imageUrl,
|
|
|
+ "nameCn": this.item.nameCn,
|
|
|
+ "productId": this.item.productId,
|
|
|
+ "quantity": this.num,
|
|
|
+ "sellPrice": this.itemPrice.price,//市场价(如果存在套餐选项加价,这里的金额需要计算加价)
|
|
|
+ "orgPrice": this.itemPrice.oldPrice,
|
|
|
+ "config": JSON.parse(JSON.stringify(this.config)) , //这里只是为了直观展示套餐选项,实际下单可以传空
|
|
|
+ "selected": []
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(this.ot == 'XBK'){
|
|
|
let products = []
|
|
|
for (let key in this.chooseInfo) {
|
|
|
products.push(
|
|
|
{
|
|
|
- "linkId": key.split('-')[1],//下单参数linkId(有时会和主商品id相同)
|
|
|
+ "linkId": key,
|
|
|
"productId": this.chooseInfo[key].id,//套餐选项商品id
|
|
|
"quantity": 1
|
|
|
}
|
|
@@ -581,18 +780,7 @@
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
- }
|
|
|
- else if(this.ot == 'XBK'){
|
|
|
- let products = []
|
|
|
- for (let key in this.chooseInfo) {
|
|
|
- products.push(
|
|
|
- {
|
|
|
- "linkId": key,
|
|
|
- "productId": this.chooseInfo[key].id,//套餐选项商品id
|
|
|
- "quantity": 1
|
|
|
- }
|
|
|
- )
|
|
|
- }
|
|
|
+ }else if(this.ot == 'RXKF'){
|
|
|
obj ={
|
|
|
"imageUrl": this.item.imageUrl,
|
|
|
"nameCn": this.item.nameCn,
|
|
@@ -603,11 +791,33 @@
|
|
|
"config": JSON.parse(JSON.stringify(this.config)) , //这里只是为了直观展示套餐选项,实际下单可以传空
|
|
|
"selected": [
|
|
|
{
|
|
|
- "round": 0,//喜茶产品round目前没有使用,传0
|
|
|
- "products": products
|
|
|
+ "round": 0, //奈雪产品round目前没有使用,传0
|
|
|
+ "products": [
|
|
|
+ {
|
|
|
+ "productId": this.productId, //套餐选项skuID,商品详情的sku列表里面已经包含所有选项组合
|
|
|
+ "quantity": 1
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
+ }else if(this.ot == 'KD'){
|
|
|
+ obj ={
|
|
|
+ "linkId": this.productId,//套餐选项skuID(必须)
|
|
|
+ "imageUrl": this.item.imageUrl,
|
|
|
+ "nameCn": this.item.nameCn,
|
|
|
+ "productId": this.item.productId,
|
|
|
+ "quantity": this.num,
|
|
|
+ "sellPrice": this.itemPrice.price,//市场价(如果存在套餐选项加价,这里的金额需要计算加价)
|
|
|
+ "orgPrice": this.itemPrice.oldPrice,
|
|
|
+ "config": JSON.parse(JSON.stringify(this.config)) , //这里只是为了直观展示套餐选项,实际下单可以传空
|
|
|
+ "selected": [
|
|
|
+ {
|
|
|
+ "round": 0,//库迪产品round目前没有使用,传0
|
|
|
+ "products": [{ "productId": this.productId, "quantity": 1 }]//套餐选项skuID,跟外层的linkId值相同
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
this.carList.push(obj)
|
|
@@ -637,27 +847,43 @@
|
|
|
this.item = i
|
|
|
if(!item.childClassList) return
|
|
|
this.show2 = true
|
|
|
+ this.chooseInfo = {}
|
|
|
foodGoodsDetail({productId:i.productId,shopId:this.shopId}).then(res=>{
|
|
|
if(res.state = 'Success'){
|
|
|
this.goodsInfo = res.content.data
|
|
|
- this.chooseInfo = {}
|
|
|
- if(this.goodsInfo.details.spu_specs){//奈雪的茶
|
|
|
+ if(this.goodsInfo.details&&this.goodsInfo.details.spu_specs&&this.ot=='NXDC'){//奈雪的茶
|
|
|
this.goodsInfo.details.spu_specs.map(item=>{
|
|
|
this.$set(this.chooseInfo,item.code,item.values[0])
|
|
|
})
|
|
|
- }else if(this.goodsInfo.details.specifications){//喜茶
|
|
|
+ }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.$set(this.chooseInfo,item.id,item.values[0])
|
|
|
+ item.values.map(i=>{
|
|
|
+ if(i.checked){
|
|
|
+ this.$set(this.chooseInfo,item.id,item.values[0])
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- }else if(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.$set(this.chooseInfo,item.id,item.sku_infos[0])
|
|
|
})
|
|
|
- }else if(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=>{
|
|
|
// id可能相同 所以加上类目的name 方便创建订单时能取到id
|
|
|
this.$set(this.chooseInfo,item.name+'-'+item.id,item.sku_infos[0])
|
|
|
})
|
|
|
+ }else if(this.goodsInfo.details&&this.goodsInfo.details.specifications&&this.ot=='RXKF'){//瑞幸
|
|
|
+ this.goodsInfo.details.specifications.map(item=>{
|
|
|
+ this.$set(this.chooseInfo,item.name,item.ingredients[0])
|
|
|
+ })
|
|
|
+ }else if(this.goodsInfo.firstSku&&this.goodsInfo.firstSku.skusSpecs&&this.ot=='KD'){//库迪
|
|
|
+ this.goodsInfo.product_img = this.goodsInfo.detailImgUrl
|
|
|
+ this.goodsInfo.product_name = this.goodsInfo.title
|
|
|
+ this.goodsInfo.firstSku.skusSpecs.map(item=>{
|
|
|
+ this.$set(this.chooseInfo,item.specItemNo,item)
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
console.log(this.chooseInfo);
|
|
|
}
|
|
@@ -681,6 +907,9 @@
|
|
|
uni.hideLoading()
|
|
|
if(res.state = 'Success'){
|
|
|
this.list = res.content.data
|
|
|
+ if(!this.list.length){
|
|
|
+ this.show3 = true
|
|
|
+ }
|
|
|
this.list.map((item,index)=>{
|
|
|
if(this.ot != 'Kfc'&&item.childClassList){
|
|
|
item.menuVoList = JSON.parse(JSON.stringify(item.childClassList[0].menuVoList))
|
|
@@ -843,7 +1072,7 @@
|
|
|
.orderFood{
|
|
|
.shop-info{
|
|
|
width: 100%;
|
|
|
- height: 130rpx;
|
|
|
+ height: 140rpx;
|
|
|
padding: 20rpx 24rpx;
|
|
|
box-sizing: border-box;
|
|
|
border-bottom: 2rpx solid #F0F0F0;
|
|
@@ -860,11 +1089,11 @@
|
|
|
.address{
|
|
|
font-size: 24rpx;
|
|
|
color: #AAAAAA;
|
|
|
- margin-top: 16rpx;
|
|
|
+ margin-top: 8rpx;
|
|
|
}
|
|
|
}
|
|
|
.content{
|
|
|
- height: calc(100vh - 130rpx);
|
|
|
+ height: calc(100vh - 140rpx);
|
|
|
display: flex;
|
|
|
overflow: auto;
|
|
|
box-sizing: border-box;
|
|
@@ -1186,6 +1415,7 @@
|
|
|
margin: 24rpx 0;
|
|
|
}
|
|
|
.choose-box{
|
|
|
+ margin-top: 20rpx;
|
|
|
.choose-item{
|
|
|
.choose-title{
|
|
|
font-size: 28rpx;
|
|
@@ -1211,6 +1441,9 @@
|
|
|
border: 2rpx solid #EE4320;
|
|
|
background: #FEECE8;
|
|
|
}
|
|
|
+ .item.disable{
|
|
|
+ color: #AAAAAA;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|