fix:规格弹框,手动输入数量无法改变数量问题修复

pull/8/head
kele 2023-05-11 10:32:04 +08:00
parent c04bb0b112
commit 9b89863c96
3 changed files with 37 additions and 8 deletions

View File

@ -87,6 +87,7 @@
:max="state.selectedSkuPrice.stock"
:step="1"
v-model="state.selectedSkuPrice.goods_num"
@change="onNumberChange($event)"
activity="groupon"
></su-number-box>
</view>
@ -96,9 +97,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 === 0 ? '阶梯团' : grouponNum + '人团'
}}</view>
<view class="btn-title">{{ grouponNum === 0 ? '阶梯团' : grouponNum + '人团' }}</view>
</button>
<button class="ss-reset-button btn-tox ss-flex-col" @tap="onBuy">
<view class="btn-price">
@ -160,6 +159,13 @@
currentSkuArray: [],
grouponNum: props.grouponNum,
});
//
function onNumberChange(e) {
if(e === 0) return;
if (state.selectedSkuPrice.goods_num === e) return;
state.selectedSkuPrice.goods_num = e;
}
//
if (!props.goodsInfo.is_sku) {
state.selectedSkuPrice = props.goodsInfo.sku_prices[0];

View File

@ -60,6 +60,7 @@
:max="state.selectedSkuPrice.stock"
:step="1"
v-model="state.selectedSkuPrice.goods_num"
@change="onNumberChange($event)"
activity="seckill"
></su-number-box>
</view>
@ -151,6 +152,12 @@
sheep.$helper.toast('请选择规格');
}
};
//
function onNumberChange(e) {
if (e === 0) return;
if (state.selectedSkuPrice.goods_num === e) return;
state.selectedSkuPrice.goods_num = e;
}
//
const changeDisabled = (isChecked = false, pid = 0, skuId = 0) => {
let newPrice = []; // skuPrice

View File

@ -21,13 +21,14 @@
<view
v-if="goodsPrice.price > 0 && goodsPrice.score > 0"
class="score-text ss-m-l-4"
>+</view
>
>+
</view>
<image
v-if="goodsPrice.score > 0"
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
class="score-img"
></image>
>
</image>
<view v-if="goodsPrice.score > 0" class="score-text">
{{ goodsPrice.score }}
</view>
@ -75,6 +76,7 @@
:max="state.selectedSkuPrice.stock"
:step="1"
v-model="state.selectedSkuPrice.goods_num"
@change="onNumberChange($event)"
></su-number-box>
</view>
</scroll-view>
@ -123,7 +125,12 @@
selectedSkuPrice: {},
currentSkuArray: [],
});
//
function onNumberChange(e) {
if (e === 0) return;
if (state.selectedSkuPrice.goods_num === e) return;
state.selectedSkuPrice.goods_num = e;
}
//
if (!props.goodsInfo.is_sku) {
state.selectedSkuPrice = props.goodsInfo.sku_prices[0];
@ -162,7 +169,10 @@
price = state.selectedSkuPrice.price;
score = state.selectedSkuPrice.score || 0;
}
return { price, score };
return {
price,
score,
};
});
function onAddCart() {
@ -352,6 +362,7 @@
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
color: #fff;
}
.score-btn {
width: 100%;
margin: 0 20rpx;
@ -393,22 +404,26 @@
font-weight: 500;
line-height: 42rpx;
}
.score-img {
width: 36rpx;
height: 36rpx;
margin: 0 4rpx;
}
.score-text {
font-size: 30rpx;
font-weight: 500;
color: $red;
font-family: OPPOSANS;
}
.price-text {
font-size: 30rpx;
font-weight: 500;
color: $red;
font-family: OPPOSANS;
&::before {
content: '¥';
font-size: 30rpx;
@ -449,6 +464,7 @@
margin-right: 10rpx;
margin-bottom: 10rpx;
}
.disabled-btn {
font-weight: 400;
color: #c6c6c6;