fix: 兼容HbulderX 3.6.15版本 update的BUG

pull/8/head
ldh 2023-01-10 02:09:20 +08:00
parent 0930be1618
commit e01366111d
3 changed files with 29 additions and 18 deletions

View File

@ -186,7 +186,7 @@
:show="state.showSelectSku"
:goodsInfo="state.data.goods"
:grouponAction="state.grouponAction"
v-model:grouponNum="state.grouponNum"
:grouponNum="state.grouponNum"
@buy="onBuy"
@change="onSkuChange"
@close="state.showSelectSku = false"

View File

@ -116,8 +116,9 @@
:show="state.showSelectSku"
:goodsInfo="state.goodsInfo"
:grouponAction="state.grouponAction"
v-model:grouponNum="state.grouponNum"
:grouponNum="state.defaultGrouponNum"
@buy="onBuy"
@ladder="onLadder"
@change="onSkuChange"
@close="onSkuClose"
/>
@ -190,16 +191,17 @@
onPageScroll(() => {});
const state = reactive({
skeletonLoading: true,
goodsId: 0,
goodsInfo: {},
goodsSwiper: [],
showSelectSku: false,
selectedSkuPrice: {},
grouponId: 0,
grouponType: '',
grouponNum: 0,
grouponAction: 'create',
skeletonLoading: true, //
goodsId: 0, // ID
goodsInfo: {}, //
goodsSwiper: [], //
showSelectSku: false, //
selectedSkuPrice: {}, //
grouponId: 0, // ID
grouponType: '', //
defaultGrouponNum: 0, //
grouponNum: 0, //
grouponAction: 'create', //
});
//
@ -226,6 +228,11 @@
state.selectedSkuPrice = e;
}
//
function onLadder(e) {
state.grouponNum = e
}
function onSkuClose() {
state.showSelectSku = false;
}
@ -241,6 +248,7 @@
function onJoinGroupon(groupon) {
state.grouponAction = 'join';
state.grouponId = groupon.id;
state.defaultGrouponNum = groupon.num;
state.grouponNum = groupon.num;
state.showSelectSku = true;
}
@ -303,6 +311,7 @@
state.goodsInfo = data;
state.grouponType = state.goodsInfo.activity_type;
if (state.grouponType === 'groupon') {
state.defaultGrouponNum = state.goodsInfo.activity.rules.team_num;
state.grouponNum = state.goodsInfo.activity.rules.team_num;
}
state.goodsSwiper = formatGoodsSwiper(state.goodsInfo.images);

View File

@ -44,7 +44,7 @@
class="ss-reset-button spec-btn"
:class="[
{
'checked-btn': grouponNum == ladder,
'checked-btn': state.grouponNum == ladder,
},
]"
@tap="onSelectLadder(ladder)"
@ -91,7 +91,7 @@
<view class="buy-box ss-flex ss-col-center ss-flex ss-col-center ss-row-center">
<view class="ss-flex">
<button class="ss-reset-button origin-price-btn ss-flex-col">
<view class="btn-title">{{ grouponNum }}人团</view>
<view class="btn-title">{{ state.grouponNum === 0 ? '阶梯团' : state.grouponNum + '人团' }}</view>
</button>
<button class="ss-reset-button btn-tox ss-flex-col" @tap="onBuy">
<view class="btn-price">
@ -128,7 +128,7 @@
import { formatPrice } from '@/sheep/hooks/useGoods';
import { isEmpty } from 'lodash';
const emits = defineEmits(['change', 'addCart', 'buy', 'close', 'update:grouponNum']);
const emits = defineEmits(['change', 'addCart', 'buy', 'close', 'ladder']);
const props = defineProps({
show: {
type: Boolean,
@ -150,6 +150,7 @@
const state = reactive({
selectedSkuPrice: {},
currentSkuArray: [],
grouponNum: props.grouponNum,
});
//
@ -204,7 +205,7 @@
//
function getSkuPriceByLadder() {
return state.selectedSkuPrice.ladders.find((item) => item.ladder == props.grouponNum);
return state.selectedSkuPrice.ladders.find((item) => item.ladder == state.grouponNum);
}
watch(
@ -340,13 +341,14 @@
//
function onSelectLadder(ladder) {
emits('update:grouponNum', ladder);
state.grouponNum = ladder;
emits('ladder', ladder);
}
//
function onSelectSku(pid, skuId) {
//
if (activityType === 'groupon_ladder' && props.grouponNum == 0) {
if (activityType === 'groupon_ladder' && state.grouponNum == 0) {
sheep.$helper.toast('请选择拼团人数');
return;
}