Authored by 陈轩

exchange

... ... @@ -42,7 +42,13 @@ const exchange = {
},
// 提交 换货
submit() { }
submit(req, res, next) {
const uid = req.user.uid || 8050882;
exchangeModel.submitExchange(uid, req.body).then(result => {
res.json(result);
}).catch(next);
}
};
module.exports = exchange;
... ...
... ... @@ -29,7 +29,14 @@ const exchange = {
}).then(global.yoho.camelCase);
},
submitExchangeData() {},
submitExchange(uid, params) {
const data = Object.assign({
uid,
method: 'app.change.submit'
}, params);
return api.post('', data).then(global.yoho.camelCase);
}
};
module.exports = exchange;
... ...
... ... @@ -49,6 +49,7 @@ router.post('/save-logistics', refund.saveLogistics); // 退换货 - 添加寄
router.get('/exchange', exchange.exchange);
router.get('/exchange/order', exchange.order); // AJAX 获取订单 商品
router.get('/exchange/delivery', exchange.delivery); // AJAX 获取 退货方式
router.post('/exchange/submit', exchange.submit); // AJAX 提交换货 申请
router.get('/mydetails', home.mydetails); // 个人信息设置
router.get('/about-us', home.aboutUs); // 个人中心 - 关于我们
... ...
... ... @@ -31,7 +31,7 @@
:is-visible="showFeatureSelector"
:entity="entity"
:on-add-to-cart="whenFeatureChange"
:config="{btnTxt:'确定'}">
buttonText="确定">
</feature-selector>
</div>
</template>
... ... @@ -51,6 +51,7 @@
return {
title: '请选择换货商品',
page: 'exchange',
orderCode: qs.orderId,
showFeatureSelector: false,
entity: {},
exchangeData: {},
... ... @@ -92,7 +93,7 @@
$.ajax({
url: '/home/exchange/order',
data: {
orderId: qs.orderId
orderId: this.orderCode
}
}).then(res => {
const self = this;
... ... @@ -147,14 +148,48 @@
return result;
});
},
// 生成提交数据
submitData() {
const data = {
order_code: this.orderCode,
address_id: this.address.address_id,
address: this.address.address,
consigee_name: this.address.consignee,
area_code: this.address.areaCode,
zip_code: this.address.zipCode,
mobile: this.address.mobile,
delivery_typ: this.deliveryType,
app_type: 1,
goods: []
};
this.selectedGoods.forEach(good => {
data.goods.push({
product_skn: good.productSkn,
product_skc: good.productSku,
goods_type: good.goodsTypeId,
last_price: good.lastPrice,
exchange_reason: good.reason.id,
remark: good.remark,
evidence_images: good.imageList,
new_goods_id: good.newGoodsId,
new_product_sku: good.newProductSku
});
});
return data;
},
// 提交 换货
submit() {
if (!this.checkSubmitData()) {
alert('请填写完整退换货信息');
}
$.ajax({
method: 'POST',
url: '/home/refund/submit',
data: this.submitData
url: '/home/exchange/submit',
data: this.submitData()
}).then(result => {
if (result.code === 200) {
console.log(result);
... ...
... ... @@ -42,6 +42,10 @@
uid: this._uid
});
}
},
created() {
}
};
... ...