update api

This commit is contained in:
2020-06-29 17:24:57 +08:00
parent 905022e6e4
commit dce6d3a1b8
19 changed files with 280 additions and 87 deletions

View File

@@ -38,6 +38,7 @@
</view>
<view class="cart-btn" v-if="status == '编辑'" @click="settlement">结算</view>
<view class="delete-btn" v-if="status == '完成'" @click="deleteGoods">删除</view>
<u-toast ref="uToast" />
</view>
</view>
</template>
@@ -62,7 +63,7 @@ export default {
})
checkedGoods = checkedGoods.concat(temp);
})
// console.log(checkedGoods);
console.log(checkedGoods);
this.checkedGoods = checkedGoods;
},
deep: true
@@ -88,9 +89,23 @@ export default {
})
},
deleteGoods() {
if(!this.checkedGoods.length) return false;
let id = [];
this.checkedGoods.forEach(item => {
id.push(item.cart_id);
})
// console.log(id);
this.$u.api.deleteCart({ id }).then(res => {
if (res.errCode == 0) {
if(!res.data.msg) {
this.getCartList();
} else {
this.$refs.uToast.show({
title: res.data.msg,
type: 'error',
})
}
}
})
},