优化服务列表页面

This commit is contained in:
TOP糯米 2023-04-09 02:02:04 +08:00
parent 85284d0b1c
commit ee7c3e9f19
1 changed files with 12 additions and 19 deletions

View File

@ -11,7 +11,7 @@
/> />
</view> </view>
<view class="common-bottom-components" :style="{ paddingBottom: pageConfig.safeAreaInsets.bottom + 'px' }"> <view class="common-bottom-components" :style="{ paddingBottom: pageConfig.safeAreaInsets.bottom + 'px' }">
<view class="cart" @click="utils.toPage('/pages/service/cart')"> <view class="cart" @click="toCart">
<view class="cart-icon"> <view class="cart-icon">
<text class="iconfont icon-gouwuche"></text> <text class="iconfont icon-gouwuche"></text>
</view> </view>
@ -38,7 +38,6 @@ export default {
pageConfig: {}, pageConfig: {},
data: [], data: [],
canUseCartBtn: false, canUseCartBtn: false,
canChangeCartNumber: true,
currentId: 0, currentId: 0,
}; };
}, },
@ -124,27 +123,21 @@ export default {
* 数量改变 * 数量改变
*/ */
changeNumber(e, id) { changeNumber(e, id) {
if (this.canChangeCartNumber) {
this.canChangeCartNumber = false;
if (e.value > 0) { if (e.value > 0) {
if (e.type == "add" && e.value == 1) { if (e.type == "add" && e.value == 1) {
this.$models.cart.toCart(id).then(async () => { this.$models.cart.toCart(id).then(() => {
await this.$store.dispatch("cart/update", true); this.$store.dispatch("cart/update", true);
this.canChangeCartNumber = true;
}); });
} else { } else {
this.$models.cart.change(id, e.type).then(async () => { this.$models.cart.change(id, e.type).then(() => {
await this.$store.dispatch("cart/update", true); this.$store.dispatch("cart/update", true);
this.canChangeCartNumber = true;
}); });
} }
} else { } else {
this.$models.cart.delete(id).then(async () => { this.$models.cart.delete(id).then(() => {
await this.$store.dispatch("cart/update", true); this.$store.dispatch("cart/update", true);
this.canChangeCartNumber = true;
}); });
} }
}
}, },
/** /**
* 去下单 * 去下单