购买数量超过库存后修改为库存数量

master
chc 2022-11-29 11:19:37 +08:00
parent 7f71614781
commit 2b5f57dfab
1 changed files with 391 additions and 378 deletions

View File

@ -102,7 +102,8 @@
<view class="goods-skus-number flex flex-a-c flex-j-sb">
<view class="view-class-title">数量</view>
<u-input class="view-class-input" input-align="right" v-model="num" type="number" />
<u-input class="view-class-input" input-align="right" v-model="num" type="number"
@change="numChange()" />
</view>
</scroll-view>
<!-- 按钮 -->
@ -182,9 +183,13 @@
watch: {
num(val) {
if (val) {
//
if (val > this.goodsDetail.quantity) {
this.val = this.goodsDetail.quantity
this.$nextTick(function () {
this.num = this.goodsDetail.quantity
})
}
}
},
buyType: {
@ -207,7 +212,12 @@
closeMask() {
this.$emit("closeBuy", false);
},
numChange() {
if (this.num > this.goodsDetail.quantity) {
alert(1)
this.num = this.goodsDetail.quantity
}
},
/**点击规格 */
handleClickSpec(val, index, specValue) {
this.currentSelceted[index] = specValue.value;
@ -255,8 +265,7 @@
API_trade.addToCart(data).then((res) => {
if (res.data.success) {
uni.navigateTo({
url: `/pages/order/fillorder?way=${
data.cartType
url: `/pages/order/fillorder?way=${data.cartType
}&addr=${""}&parentOrder=${encodeURIComponent(
JSON.stringify(this.parentOrder)
)}`,
@ -306,8 +315,7 @@
API_trade.addToCart(data).then((res) => {
if (res.data.code == 200) {
uni.navigateTo({
url: `/pages/order/fillorder?way=${data.cartType}&addr=${
this.addr.id || ""
url: `/pages/order/fillorder?way=${data.cartType}&addr=${this.addr.id || ""
}&parentOrder=${encodeURIComponent(JSON.stringify(this.parentOrder))}`,
});
}
@ -390,10 +398,12 @@
</script>
<style lang="scss" scoped>
@import "./popup.scss";
.price-row {
text-align: center;
}
.buy {
background-image: linear-gradient(135deg, #ffba0d, #ffc30d 69%, #ffcf0d);
box-shadow: 0 2px 6px 0 rgba(255, 65, 66, 0.2);
@ -418,6 +428,7 @@
>.view-class-title {
flex: 8;
}
>.view-class-input {
flex: 1
}
@ -466,6 +477,7 @@
}
}
}
.wholesale-item {
color: #999 !important;
font-size: 24rpx;
@ -493,6 +505,7 @@
color: $price-color;
line-height: 80rpx;
margin-right: 20rpx;
>* {
color: $price-color;
line-height: 80rpx;