|
@@ -22,7 +22,8 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<!-- 列表 -->
|
|
<!-- 列表 -->
|
|
|
- <view class="cart-list">
|
|
|
|
|
|
|
+ <scroll-view scroll-y="true" class="scrollBox">
|
|
|
|
|
+ <view class="cart-list">
|
|
|
<block v-for="(item, index) in cartList" :key="item.id">
|
|
<block v-for="(item, index) in cartList" :key="item.id">
|
|
|
<view class="cart-item" :class="{ 'b-b': index !== cartList.length - 1 }">
|
|
<view class="cart-item" :class="{ 'b-b': index !== cartList.length - 1 }">
|
|
|
<view class="iconfont iconroundcheckfill checkbox"
|
|
<view class="iconfont iconroundcheckfill checkbox"
|
|
@@ -53,9 +54,9 @@
|
|
|
-
|
|
-
|
|
|
</view>
|
|
</view>
|
|
|
<view class="number">
|
|
<view class="number">
|
|
|
- <!-- <input type="number"
|
|
|
|
|
- v-model="item.cart_num > item.productInfo.stock ? item.productInfo.stock : item.cart_num"/> -->
|
|
|
|
|
- {{ item.cart_num > item.productInfo.stock ? item.productInfo.stock : item.cart_num }}
|
|
|
|
|
|
|
+ <input type="number" @input = "inputChangeNum($event,index,item)"
|
|
|
|
|
+ v-model="item.cart_num > item.productInfo.stock ? item.productInfo.stock : item.cart_num"/>
|
|
|
|
|
+ <!-- {{ item.cart_num > item.productInfo.stock ? item.productInfo.stock : item.cart_num }} -->
|
|
|
</view>
|
|
</view>
|
|
|
<view class="add" @click="changeNum('add',index,item)">
|
|
<view class="add" @click="changeNum('add',index,item)">
|
|
|
+
|
|
+
|
|
@@ -78,6 +79,8 @@
|
|
|
</view>
|
|
</view>
|
|
|
</block>
|
|
</block>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+ </scroll-view>
|
|
|
|
|
+
|
|
|
<!-- 底部菜单栏 -->
|
|
<!-- 底部菜单栏 -->
|
|
|
<view class="action-section">
|
|
<view class="action-section">
|
|
|
<view class="checkbox">
|
|
<view class="checkbox">
|
|
@@ -199,11 +202,31 @@ export default {
|
|
|
}
|
|
}
|
|
|
this.calcTotal(type);
|
|
this.calcTotal(type);
|
|
|
},
|
|
},
|
|
|
|
|
+ //数量输入变化
|
|
|
|
|
+ inputChangeNum(e,index,item) {
|
|
|
|
|
+ const cartList = this.cartList[index]
|
|
|
|
|
+ let num = e.detail.value
|
|
|
|
|
+ if(num < cartList.trueStock ) {
|
|
|
|
|
+ cartList.cart_num = num
|
|
|
|
|
+ }else {
|
|
|
|
|
+ cartList.cart_num = cartList.trueStock
|
|
|
|
|
+ }
|
|
|
|
|
+ const data = {
|
|
|
|
|
+ number: num,
|
|
|
|
|
+ id: item.id
|
|
|
|
|
+ }
|
|
|
|
|
+ this.numberChange(data)
|
|
|
|
|
+ },
|
|
|
|
|
+ //数量加减变化
|
|
|
changeNum(type,index,item) {
|
|
changeNum(type,index,item) {
|
|
|
const cartList = this.cartList[index]
|
|
const cartList = this.cartList[index]
|
|
|
if(type == "add") {
|
|
if(type == "add") {
|
|
|
- cartList.cart_num >= cartList.productInfo.stock || cartList.cart_num++
|
|
|
|
|
|
|
+ cartList.cart_num >= cartList.trueStock || cartList.cart_num++
|
|
|
}else if(type == "del") {
|
|
}else if(type == "del") {
|
|
|
|
|
+ if(cartList.cart_num <=1) {
|
|
|
|
|
+ this.deleteCartItem(index)
|
|
|
|
|
+ // this.cartList.splice(index, 1);
|
|
|
|
|
+ }
|
|
|
cartList.cart_num <= 1 || cartList.cart_num--
|
|
cartList.cart_num <= 1 || cartList.cart_num--
|
|
|
}
|
|
}
|
|
|
const data = {
|
|
const data = {
|
|
@@ -296,10 +319,14 @@ export default {
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
|
|
|
+ page {
|
|
|
|
|
+ // height: 100%;
|
|
|
|
|
+ }
|
|
|
.header {
|
|
.header {
|
|
|
- // position: absolute;
|
|
|
|
|
- // top: 0;
|
|
|
|
|
- // width: 100%;
|
|
|
|
|
|
|
+ height: 140rpx;
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ top: 0;
|
|
|
|
|
+ width: 100%;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
|
background-color: #fff;
|
|
background-color: #fff;
|
|
@@ -324,8 +351,16 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.container {
|
|
.container {
|
|
|
|
|
+ height: 100%;
|
|
|
padding-bottom: 134rpx;
|
|
padding-bottom: 134rpx;
|
|
|
background-color: $page-color-base;
|
|
background-color: $page-color-base;
|
|
|
|
|
+
|
|
|
|
|
+ .scrollBox {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ top: 140rpx;
|
|
|
|
|
+ // margin-top: 120rpx;
|
|
|
|
|
+ height: calc(100% - 300rpx);
|
|
|
|
|
+ }
|
|
|
/* 空白页 */
|
|
/* 空白页 */
|
|
|
.empty {
|
|
.empty {
|
|
|
position: fixed;
|
|
position: fixed;
|
|
@@ -349,7 +384,7 @@ export default {
|
|
|
font-size: $font-sm + 2rpx;
|
|
font-size: $font-sm + 2rpx;
|
|
|
color: $font-color-disabled;
|
|
color: $font-color-disabled;
|
|
|
.navigator {
|
|
.navigator {
|
|
|
- color: $uni-color-primary;
|
|
|
|
|
|
|
+ color: #438BED;
|
|
|
margin-left: 16rpx;
|
|
margin-left: 16rpx;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -357,6 +392,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
/* 购物车列表项 */
|
|
/* 购物车列表项 */
|
|
|
.cart-item {
|
|
.cart-item {
|
|
|
|
|
+ height: 100%;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
position: relative;
|
|
position: relative;
|
|
|
margin: 15rpx;
|
|
margin: 15rpx;
|