封装方法 接口200返回true catch到500 返回false
async updateCart(productId, goodsId, number, specifications, id) {
try {
const res = await util.request(api.CartUpdate, {
productId: productId,
goodsId: goodsId,
specifications: specifications,
number: number
}, 'POST')
return true
} catch (e) {
return false
}
},
方法调用
async bindNumber() {
if(await this.updateCart(productId,goodsId, number,specifications, id){
}
}