|
@@ -3,7 +3,7 @@
|
|
<view class="main">
|
|
<view class="main">
|
|
<view class="top" v-if="list.length !=0">
|
|
<view class="top" v-if="list.length !=0">
|
|
<view class="text_1">
|
|
<view class="text_1">
|
|
- <checkbox class="checkbox" @click="selectAll(false)" :checked="isAll">全选</checkbox>
|
|
|
|
|
|
+ <checkbox class="checkbox" @click="selectAll(false)" :checked="isAll">全选</checkbox>
|
|
</view>
|
|
</view>
|
|
<view class="text_2" v-if="num==0" @click="edit(1)">编辑</view>
|
|
<view class="text_2" v-if="num==0" @click="edit(1)">编辑</view>
|
|
<view class="text_2" v-if="num==1" @click="edit(0)">完成</view>
|
|
<view class="text_2" v-if="num==1" @click="edit(0)">完成</view>
|
|
@@ -70,7 +70,7 @@
|
|
</view>
|
|
</view>
|
|
<view class="foot" v-if="list.length !=0">
|
|
<view class="foot" v-if="list.length !=0">
|
|
<view class="total">总价:<text>¥{{totalMoney}}(不含运费)</text></view>
|
|
<view class="total">总价:<text>¥{{totalMoney}}(不含运费)</text></view>
|
|
- <view class="btn">
|
|
|
|
|
|
+ <view class="btn" v-if="hasCheck()">
|
|
<button type="primary" size="mini" @click="toSettle()" v-if="num==0">提交订单</button>
|
|
<button type="primary" size="mini" @click="toSettle()" v-if="num==0">提交订单</button>
|
|
<button type="primary" size="mini" @click="toDel()" v-if="num==1">删除</button>
|
|
<button type="primary" size="mini" @click="toDel()" v-if="num==1">删除</button>
|
|
</view>
|
|
</view>
|
|
@@ -263,8 +263,9 @@ export default {
|
|
async changeValue(value) {
|
|
async changeValue(value) {
|
|
const that = this;
|
|
const that = this;
|
|
this.$nextTick(async () => {
|
|
this.$nextTick(async () => {
|
|
- const { goodsSpec_id: goodsSpecId, num } = value
|
|
|
|
|
|
+ const { goodsSpec_id: goodsSpecId, num, cart_id: cartId } = value
|
|
const res = await that.$api(`/cart/checkGoodsNum`, 'GET', {
|
|
const res = await that.$api(`/cart/checkGoodsNum`, 'GET', {
|
|
|
|
+ cartId,
|
|
goodsSpecId,
|
|
goodsSpecId,
|
|
num
|
|
num
|
|
});
|
|
});
|
|
@@ -333,7 +334,27 @@ export default {
|
|
if (file.length && file.length > 0) return file[0].url
|
|
if (file.length && file.length > 0) return file[0].url
|
|
},
|
|
},
|
|
// 去结算
|
|
// 去结算
|
|
- toSettle() { },
|
|
|
|
|
|
+ async toSettle() {
|
|
|
|
+ // 将选中的购物车放到数组中,传回服务端进行检查.然后拿着key去订单页请求数据
|
|
|
|
+ const goodsList = this.list.map(i => i.goods).flat();
|
|
|
|
+ const cartIds = goodsList.filter(i => i.check).map(i => i.cart_id)
|
|
|
|
+ const res = await this.$api(`/util/checkCartBuy`, 'POST', {
|
|
|
|
+ cartIds
|
|
|
|
+ });
|
|
|
|
+ if (res.errcode == '0') {
|
|
|
|
+ const { data } = res
|
|
|
|
+ if (data.result) {
|
|
|
|
+ const key = data.key;
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: `/pagesHome/order/order?key=${key}`
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 是否选中商品,控制提交订单按钮
|
|
|
|
+ hasCheck() {
|
|
|
|
+ return this.list.some(e => e.goods.some(eg => eg.check))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|