Authored by ccbikai

完善用户提交退货信息

... ... @@ -9,7 +9,7 @@ const refund = {
res.render('refund');
},
order(req, res, next) {
const uid = 8050882;
const uid = req.user.uid || 8050882;
const orderId = req.query.orderId;
if (!orderId) {
... ... @@ -20,6 +20,13 @@ const refund = {
res.json(result);
}).catch(next);
},
submit(req, res, next) {
const uid = req.user.uid || 8050882;
refundModel.submitRefundData(uid, req.body).then(result => {
res.json(result);
}).catch(next);
},
logistics(req, res) {
res.render('logistics', {
module: 'home',
... ...
... ... @@ -14,6 +14,16 @@ const refund = {
cache: true,
code: 200
}).then(global.yoho.camelCase);
},
submitRefundData(uid, params) {
console.log(Object.assign({
method: 'app.refund.submit',
uid: uid,
}, params));
return api.post('', Object.assign({
method: 'app.refund.submit',
uid: uid,
}, params)).then(global.yoho.camelCase);
}
};
... ...
... ... @@ -29,8 +29,9 @@ router.get('/favorite', favorite.favorite); // 个人中心 - 收藏
router.get('/favorite/favpaging', favorite.favpaging); // 个人中心 - 收藏商品/品牌(翻页)
router.post('/favorite/favdel', favorite.favdel); // 个人中心 - 收藏商品/品牌(刪除)
router.get('/refund', refund.refund);
router.get('/refund/order', refund.order);
router.get('/refund', refund.refund); // 退换货
router.get('/refund/order', refund.order); // 查询订单数据
router.post('/refund/submit', refund.submit); // 提交信息
router.get('/refund/logistics', refund.logistics); // 退换货 - 商品寄回信息
... ...
... ... @@ -101,6 +101,7 @@
product.reason = {
id: 0
};
product.imageList = [];
});
res.data.returnAmountMode.forEach(mode => {
if (mode.isDefault === 'Y') {
... ... @@ -112,6 +113,47 @@
}
});
},
methods: {
checkSubmitData() {
const data = this.submitData;
if (!data.order_code) {
return false;
}
// 退到银行卡
if (this.amount.return_amount_mode === 2) {
if (!this.amount.bank_name || !this.amount.bank_card || !this.amount.payee_name) {
return false;
}
}
// 退到支付宝
if (this.amount.return_amount_mode === 3) {
if (!this.amount.alipay_account || !this.amount.alipay_name) {
return false;
}
}
return true;
},
submit() {
if (!this.checkSubmitData()) {
alert('请填写完整退换货信息');
}
$.ajax({
method: 'POST',
url: '/home/refund/submit',
data: this.submitData
}).then(result => {
if (result.code === 200) {
console.log(result);
} else {
alert(result.message);
}
});
}
},
components: {
productList
}
... ...