Commit c85fc765 by 宋冰琦

修复部分bug

parent fb561fe3
......@@ -23,13 +23,15 @@
<view v-for="specItem in goodInfo.specs" :key="specItem.specId">
<div class="good-spec-name">{{ specItem.specName }}</div>
<view class="good-spec-rule">
<div v-for="specItemRule in specItem.rules" class="div_item" :key="specItemRule.ruleId" @click="selectRoles(specItemRule, specItem)">
<div v-for="specItemRule in specItem.rules":key="specItemRule.ruleId" @click="selectRoles(specItemRule, specItem)">
<div v-if="ShowIt(specItemRule.ruleId)" class="div_item" >
<div v-if="specItemRule.isRecommend=='1'" :class="[UseIt(specItemRule.ruleId)?'disabledStyle':'']" class="default"></div>
<button class="good-spec-rule-item" :disabled="UseIt(specItemRule.ruleId)"
:class="{ active: isActvie(specItemRule) }">
<view @click.prevent="checkSku(specItemRule)">{{ specItemRule.ruleName }}</view>
</button>
</div>
</div>
</view>
</view>
</view>
......@@ -104,6 +106,7 @@ export default {
BottomSafeHeight:0,
Utils,
shopState:true,
showSku:[]
}
},
onShow() {
......@@ -154,14 +157,15 @@ export default {
},
initInfo(goodsInfo){
this.available = []
this.showSku = []
this.selected = []
const skus = goodsInfo.skus;
if (skus) {
const sku = skus.find(v => v.isDefault == 1 && v.state == 1) || skus.find(v => v.isDefault == 0 && v.state == 1);
this.skusDefault = skus.find(v => v.isDefault == 1);
this.skusSellout = skus.find(v => v.isDefault == 1 && v.state == 1)
|| skus.find(v => v.state == 1)
|| skus.find(v => v.isDefault == 1)
const sku = skus.find(v => v.isDefault == 1 && (v.state == 1&&v.isDelete===0)) || skus.find(v => v.isDefault == 0 && (v.state == 1&&v.isDelete===0));
this.skusDefault = skus.find(v => v.isDefault == 1&&v.isDelete===0);
this.skusSellout = skus.find(v => v.isDefault == 1 && (v.state == 1&&v.isDelete===0))
|| skus.find(v => (v.state == 1&&v.isDelete===0))
|| skus.find(v => v.isDefault == 1&&v.isDelete===0)
|| skus[0]
if (sku){
this.selected.push(...sku.rules)
......@@ -169,14 +173,20 @@ export default {
this.selected = []
};
skus.forEach(item => {
if (item.isDelete === 0) {
item.rules.forEach(rule => {
this.showSku.push(rule.ruleId)
})
}
})
skus.forEach(item => {
if (item.state == 1) {
item.rules.forEach(rule => {
this.available.push(rule.ruleId)
item.ruleIds.push(rule.ruleId)
})
}
})
console.log(this.selected,skus)
console.log(this.selected,this.showSku)
}
this.$nextTick(() => {
this.buildGoods(e => {
......@@ -363,6 +373,9 @@ export default {
},
UseIt(ruleId) {
return this.available.indexOf(ruleId) == -1&&this.shopState
},
ShowIt(ruleId) {
return this.showSku.indexOf(ruleId) !== -1
}
},
computed: {
......
......@@ -27,8 +27,8 @@
</view>
<view class="usebtn" v-if="canuse.length!=0&&current===0">
<view class="content">
<view class="text" v-if="price!=0">已选1张HOOLOO,可优惠<span class="money">{{price}}</span></view>
<view class="text" v-else>暂未选择HOOLOO优惠</view>
<view class="text" v-if="price!=0">已选1张HOOLOO,可优惠<span class="money">{{price}}</span></view>
<view class="text" v-else>暂未选择HOOLOO优惠</view>
<view>
<view class="btnView" @click="setTickcet">确认</view>
</view>
......
......@@ -140,6 +140,7 @@ export default {
this.initData(option)
},
onShow() {
uni.setStorageSync('allow',true)
uni.setStorageSync('goodsList',{})
this.backToMneu = false
},
......
......@@ -120,13 +120,16 @@ import User from '@/request/user'
import Order from '@/request/order'
export default {
onHide() {
console.log('onHide--------',this.cleanFlag,'this.cleanFlag')
if(this.cleanFlag) {
this.goods = {}
}
},
onShow() {
// this.goods = uni.getStorageSync('goodsList') || {};
// setTimeout(() => {
console.log('onshow',this.returnFlag,uni.getStorageSync('shopCarInfo'))
if ((JSON.stringify(this.goods)!="{}")&&!this.returnFlag) {
const allow = uni.getStorageSync('allow');
console.log('onshow-----------',allow,'allow')
if(allow) {
if ((JSON.stringify(this.goods)!="{}")) {
Order.getWaitTine({
shopId: uni.getStorageSync('shopData').id,
goods: this.goods
......@@ -136,13 +139,12 @@ export default {
}else{
uni.switchTab({ url: '/pages/menu/menu' })
}
// }, 1000);
}
this.BottomSafeHeight = uni.getStorageSync('BottomSafeHeight')
this.TermsStatus = uni.getStorageSync('TermsStatus') || false
},
async onLoad(option) {
uni.setStorageSync('allow',true)
console.log('onload')
// 清除优惠卷信息
this.$store.commit("cleanInfo",{})
......@@ -154,7 +156,6 @@ export default {
// 商品详情页点击立即支付进入
if (option.goodsList) {
console.log('详情进入')
this.returnFlag = false
this.getMessageFlag()
const shopData = uni.getStorageSync('shopData');
this.shopData = shopData
......@@ -172,7 +173,6 @@ export default {
// console.log(q);
if (q) {
console.log('扫码进入')
this.returnFlag = false
this.getMessageFlag()
this.saveGetTicket()
User.getLocation((state, params) => {
......@@ -198,7 +198,6 @@ export default {
// 购物车点击进入
if(uni.getStorageSync('shopCarInfo').length!=0) {
console.log('购物车进入')
this.returnFlag = false
this.getMessageFlag()
console.log(uni.getStorageSync('shopCarInfo'))
const shopData = uni.getStorageSync('shopData');
......@@ -206,7 +205,6 @@ export default {
this.buyType = 3;
const shopCarInfo = uni.getStorageSync('shopCarInfo') || []
this.goods = shopCarInfo.filter(item => item.flag);
console.log(this.goods)
this.saveGetTicket()
return
}
......@@ -215,7 +213,7 @@ export default {
},
data() {
return {
returnFlag:true,
cleanFlag:false,
messageList:[
{
tmp:'1uErx-15S-3vuopXSvvsxCeM_Jd-1iZC-nXzd2yW3QU',
......@@ -463,6 +461,7 @@ export default {
},
//结算组装数据发起订单
async saveReserve(val = {}) {
uni.setStorageSync('allow',false)
// 组装购物车数据或者立即支付数据
let list = [];
if (this.payType == '1') {
......@@ -500,6 +499,7 @@ export default {
if (orderInfo && orderInfo.data.code == 200) {
// const {}
await Menu.requestPayment(orderInfo.data.data, res, this.buyType);
this.cleanFlag = true
}else{
}
......
......@@ -125,7 +125,7 @@ export default {
created() {
let platform = uni.getSystemInfoSync().platform;
uni.downloadFile({
url: 'http://songclound.oss-cn-hongkong.aliyuncs.com/2022/06/27/71d36be0ed966.mp4', //仅为示例,并非真实的资源
url: 'https://hooloo-dev-api.gdatac.com/resources/menu.mp4', //仅为示例,并非真实的资源
success: (res) => {
if (res.statusCode === 200) {
console.log(res);
......
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