Commit c85fc765 by 宋冰琦

修复部分bug

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