diff --git a/pages/cart.vue b/pages/cart.vue
index eb5429d..019b148 100644
--- a/pages/cart.vue
+++ b/pages/cart.vue
@@ -234,7 +234,7 @@
- {{ good['cartNum'] }}
+ inputChangeHandle(index, gIndex, good, e)"/>
@@ -641,7 +641,32 @@ export default {
})
this.isAll = shopCheckNumber === this.list.length
},
+ inputChangeHandle(index, gIndex, good, e) {
+
+ if(+good.cartNum > good['productInfo']['attrInfo']['stock']) {
+ good.cartNum = good['productInfo']['attrInfo']['stock']
+ }
+ if(good.cartNum < 1) {
+ good.cartNum = 1
+ }
+ const value = +good.cartNum
+ console.log('index', value);
+ const id = good.id
+ // uni.showLoading()
+ changeCartNum(id, value).then(res => {
+ const { success } = res
+ if (success) {
+ // uni.hideLoading()
+ this.$set(this.list[index].carts[gIndex], 'cartNum', value)
+ }
+ }).catch(() => {
+ setTimeout(() => {
+ uni.hideLoading()
+ }, 3000)
+ })
+ },
changeNumHandle(index, gIndex, good, e) {
+ console.log(good);
const { type } = e
const value = good.cartNum + (type === 'plus' ? 1 : -1)
console.log('index', value);
@@ -879,8 +904,8 @@ export default {
border-radius: 28rpx 0rpx 0rpx 28rpx;
border: 1px solid #E6E6E6;
background-color: rgba(208,208,208,0.39);
- height: 40rpx;
- width: 40rpx;
+ height: 44rpx;
+ width: 44rpx;
padding: 0 20rpx;
font-weight: bold;
}
@@ -888,8 +913,8 @@ export default {
border-radius: 0rpx 28rpx 28rpx 0rpx;
border: 1px solid #C52733;
background-color: #C52733;
- height: 40rpx;
- width: 40rpx;
+ height: 44rpx;
+ width: 44rpx;
padding: 0 20rpx;
font-weight: bold;
}