Authored by yyq

exchange

... ... @@ -2,13 +2,18 @@
* 换货 controller
*/
'use strict';
const headerModel = require('../../../doraemon/models/header'); // 头部model
const exchangeModel = require('../models/exchange');
const exchange = {
exchange(req, res) {
res.render('refund/exchange', {
module: 'home',
page: 'refund-exchange'
page: 'refund-exchange',
pageHeader: headerModel.setNav({
navTitle: '换货申请'
}),
title: '换货申请',
});
},
... ...
... ... @@ -404,3 +404,41 @@ exports.getCoupon = (req, res, next) => {
})
.catch(next);
};
// const vipLe = (key) => {
// return {
// 银卡: 1,
// 金卡: 2,
// 白金: 3,
// }[key];
// };
/**
* [获取商品 品牌券]
*/
exports.product = (req, res, next) => {
let params = {
id: _.toString(req.params[0]),
uid: req.user.uid || 0
};
Promise.all([detailModel.getProductData(params), detailModel.getVipData(params)]).then((result) => {
// let vipPrice = [];
// if (result[0].data.vip) {
// for (let val of result[0].data.vip) {
// vipPrice.push({
// level: vipLe(val.caption),
// price: val.price,
// currentVip: req.user.uid &&
// parseInt(result[1].data.current_vip_level, 10) === vipLe(val.caption) ?
// 'active' : ''//eslint-disable-line
// });
// }
// result[0].data.vipPrice = vipPrice;
// }
res.json(result[0]);
}).catch(next);
};
... ...
... ... @@ -919,6 +919,38 @@ const getLimitProductData = (uid, limitProductCode) => {
});
};
const product = (params) => {
return api.get('', Object.assign({
method: 'app.product.data'
}, params), {
code: 200
}).then(result => {
if (result.data) {
let storage = 0; // result.storage 的 数值 不可靠,循环累加 库存
const goodsList = result.data.goods_list;
if (goodsList) {
for (let good of goodsList) {
for (let size of good.size_list) {
storage += size.storage_number;
}
}
}
result.data.storage = storage;
}
return result;
});
};
const getVipData = params => {
return api.get('', {
method: 'app.passport.vip',
uid: params.uid
}, {code: 200});
};
module.exports = {
getProductData,
getProductAsyncData,
... ... @@ -926,5 +958,7 @@ module.exports = {
getUserProfile: _getUserProfile,
productInfoBySkns: _productInfoBySkns,
detailDataPkgAsync: _detailDataPkgAsync,
getLimitProductData
getLimitProductData,
product,
getVipData
};
... ...
... ... @@ -84,6 +84,8 @@ router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商å“å’¨è¯
router.get('/detail/coupon.json', detail.brandCoupon); // 品牌券
router.post('/detail/coupon/save.json', auth, detail.getCoupon); // 获得 品牌券
router.get(/\/product_([\d]+)\.json/, detail.product);
router.get('/recom/maylike', recom.mayLike); // 你可能喜欢
... ...
... ... @@ -23,12 +23,12 @@
</div>
</div>
<!--<feature-selector
:is-visible="showFeatureSelector"
<!-- <feature-selector
:is-visible="showFeatureSelector"
:entity="entity"
:on-add-to-cart="whenFeatureChange"
button-text="确定">
</feature-selector>-->
</feature-selector> -->
</div>
</template>
... ... @@ -37,6 +37,7 @@
const qs = require('yoho-qs');
const Modal = require('plugin/modal');
const returnUtil = require('plugin/util');
const bus = require('plugin/vue-bus');
const productList = require('home/return/list.vue');
const reasonConfig = require('home/return/reason');
... ... @@ -68,9 +69,9 @@
},
created() {
// 打开 更换 颜色尺码 TAR-TODO 这个可能得重写
// bus.$on('open.featureSelector', msg => {
// this.queryProductFeature(msg.pid);
// });
bus.$on('open.featureSelector', msg => {
this.queryProductFeature(msg.pid);
});
// 获取 换货商品
$.ajax({
... ... @@ -275,6 +276,10 @@
background-color: #f6f6f6;
}
.return-exchange .return-select > .title {
padding-top: 0;
}
.exchange-info {
margin: 20px 0;
background-color: #fff;
... ...
... ... @@ -45,12 +45,12 @@
},
created() {
this.$set('product.change', {
this.product.change = {
color: this.product.color_name,
size: this.product.size_name,
goodsId: this.product.goods_id,
sku: this.product.product_sku
});
};
}
};
... ... @@ -79,6 +79,7 @@
.field .right {
color: #b0b0b0;
float: right;
}
.change {
... ...