Authored by 陈轩

Merge remote-tracking branch 'origin/develop' into develop

... ... @@ -9,13 +9,13 @@ const api = global.yoho.API;
const yhChannel = {
men: {
channel: '1'
channel: '301'
},
women: {
channel: '2'
channel: '302'
},
lifestyle: {
channel: '4'
channel: '303'
}
};
... ...
... ... @@ -21,13 +21,16 @@ const handleBrandList = origin => {
indexList: []
};
_.sortBy(origin, (o) => {
return o.key;
});
_.forEach(origin, (value, key) => {
let brands = [];
_.forEach(value, (subValue) => {
brands.push({
name: subValue.brand_name,
link: '/brand/' + subValue.brand_domain,
name: subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name,
logo: subValue.brand_ico,
domain: subValue.brand_domain
});
... ... @@ -69,9 +72,7 @@ const getBrandListData = params => {
* @returns {*|Promise.<TResult>}
*/
const getCateListData = params => {
return brandApi.getCateListData(params).then(result => {
return camelCase(result);
});
return brandApi.getCateListData(params).then(camelCase);
};
module.exports = {
... ...
... ... @@ -34,13 +34,12 @@ const refund = {
}).catch(next);
},
logistics(req, res, next) {
const applyid = req.query.applyid;
refundModel.getExpressCompany().then(result => {
res.render('logistics', {
module: 'me',
page: 'logistics',
applyid: applyid,
applyid: req.query.applyid,
type: req.query.type,
company_list: result ? JSON.stringify(result.data) : ''
});
}).catch(next);
... ... @@ -48,11 +47,13 @@ const refund = {
saveLogistics(req, res, next) {
const uid = req.user.uid;
const applyid = req.body.applyid;
const expressCompany = req.body.expressCompany;
const expressId = req.body.expressId;
const expressNumber = req.body.expressNumber;
refundModel.setexpress(applyid, uid, expressCompany, expressId, expressNumber).then(data => {
refundModel.setexpress(applyid, uid, {
type: req.body.type,
expressCompany: req.body.expressCompany,
expressNumber: req.body.expressNumber,
expressId: req.body.expressId
}).then(data => {
return res.json(data);
}).catch(next);
},
... ...
... ... @@ -32,14 +32,16 @@ const refund = {
code: 200
});
},
setexpress(applyid, uid, expressCompany, expressId, expressNumber) {
setexpress(applyid, uid, data) {
const method = data.type === 'refund' ? 'app.refund.setexpress' : 'app.change.setexpress';
return api.get('', {
method: 'app.refund.setexpress',
method: method,
id: applyid,
uid: uid,
express_company: expressCompany,
express_number: expressNumber,
express_id: expressId
express_company: data.expressCompany,
express_number: data.expressNumber,
express_id: data.expressId
});
},
getChangeDetail(id, uid) {
... ...
<div class="logistics-page" id="logistics">
<components :is="currentView" :company_id="company_id" :company_name="company_name" applyid='{{applyid}}' company_list='{{company_list}}' keep-alive></components>
<components :is="currentView" :company_id="company_id" :company_name="company_name" applyid='{{applyid}}' type='{{type}}' company_list='{{company_list}}' keep-alive></components>
</div>
... ...
... ... @@ -5,11 +5,7 @@
*/
'use strict';
// const _ = require('lodash');
// const helpers = global.yoho.helpers;
const api = global.yoho.API;
const camelCase = global.yoho.camelCase;
/**
* 商品详情
... ...
... ... @@ -272,7 +272,7 @@ const intercept = (url) => {
}
// 首页
if (/\/$/.test(path)) {
if (/\/$/.test(path) || !path) {
return yoho.goTab({
index: 0,
url: /^(https?:)?\/\//i.test(url) ? url : origin + url
... ...
... ... @@ -5,12 +5,13 @@ var util = require('common/util');
$(() => {
window.addEventListener('touchmove', function() {
var topHeight = document.body.scrollTop;
if (topHeight > 50) {
$('#header').addClass('top-change');
} else {
$('#header').removeClass('top-change');
}
})
});
if (!yoho.isLogin) {
$('.auth').addClass('no-intercept');
... ...
... ... @@ -8,6 +8,8 @@
const tab = require('channel/tab.vue');
const $ = require('jquery');
const bus = require('common/vue-bus');
const qs = require('yoho-qs');
const cookie = require('yoho-cookie');
const channelTrans = {
men: {
... ... @@ -29,7 +31,8 @@
return {
category: [],
categoryResult: {},
gender: '1,3'
gender: '1,3',
detaultChannel: qs.channel || cookie.get('_Channel') || 'men'
};
},
components: {
... ... @@ -44,7 +47,7 @@
}).then(result => {
if (result.code === 200 && result.data) {
this.$set('categoryResult', result.data);
this.$set('category', this.categoryResult['MEN男士']);
this.$set('category', this.categoryResult[channelTrans[this.detaultChannel].key]);
}
}).fail(() => {
tip('网络错误');
... ... @@ -55,8 +58,9 @@
this.getCateList();
bus.$on('channel.change', (page, channel) => {
this.$set('gender', channelTrans[channel].code);
this.$set('category', this.categoryResult[channelTrans[channel].key]);
this.$set('detaultChannel', channel || qs.channel || cookie.get('_Channel') || 'men');
this.$set('gender', channelTrans[this.detaultChannel].code);
this.$set('category', this.categoryResult[channelTrans[this.detaultChannel].key]);
});
}
};
... ...
... ... @@ -244,7 +244,7 @@
});
if (yoho.isApp) {
bus.$on('app.favourite.tabChange', this.updateNavBar);
bus.$on('app.favourite.tabChange', this.updateNavBar);
}
}
};
... ...
... ... @@ -81,14 +81,37 @@
};
},
created() {
this.updateNavBar();
this.getOrderData();
yohoAPI.addNativeMethod('goToService', () => {
interceptClick.intercept('/me/service');
return false;
});
document.addEventListener('visibilitychange', () => {
if (!document.hidden) {
this.reload();
}
});
},
methods: {
updateNavBar() {
const header = $.extend({}, interceptClick.defaultTitleMap[2]);
header.title.des = '订单详情';
yoho.updateNavigationBar({
header: header
});
},
reload() {
this.show = false;
this.order = {};
this.selected = {};
this.cancelbusy = false;
this.getOrderData();
},
getOrderData() {
$.ajax({
url: '/me/get-order',
... ... @@ -139,7 +162,10 @@
reason: this.selected.reason || this.options[0].reason
}, (result) => {
if (result.code === 200) {
location.reload();
tip('取消成功');
setTimeout(() => {
this.reload();
}, 1000);
} else if (result.code !== 500) {
tip(result.message);
}
... ... @@ -178,7 +204,7 @@
reason: this.options.length ? this.options[0].reason : null
}, (result) => {
if (result.code === 200) {
location.reload();
this.reload();
}
});
};
... ... @@ -202,7 +228,7 @@
}
}).then(result => {
if (result.code === 200) {
yohoAPI.goBack(true);
yohoAPI.goBack();
return false;
} else if (result.code !== 500) {
tip(result.message);
... ... @@ -213,7 +239,9 @@
});
},
confirmGoods(code) {
Modal.confirm('', '确认收货', function() {
let _this = this;
Modal.confirm('', '确认收货吗?', function() {
this.hide();
$.ajax({
url: '/me/confirmReceive',
... ... @@ -223,7 +251,7 @@
}
}).then(result => {
if (result.code === 200) {
location.reload();
_this.reload();
} else if (result.code !== 500) {
tip(result.message);
}
... ...
... ... @@ -73,22 +73,38 @@
limit: 10,
pageTotal: 1,
type: this.$parent.$data.type,
orderList: [],
busy: false,
cancelbusy: false,
emptybox: 'hide',
currentCode: '',
selected: {},
options: [],
currentCode: '',
cancelbusy: false
orderList: []
};
},
ready() {
created() {
this.getOrderData();
this.getCancelReason();
},
document.addEventListener('visibilitychange', () => {
if (!document.hidden) {
this.reload();
}
});
},
methods: {
reload() {
this.page = 0;
this.pageTotal = 1;
this.busy = false;
this.cancelbusy = false;
this.emptybox = 'hide';
this.currentCode = '';
this.selected = {};
this.orderList = [];
this.getOrderData();
},
getOrderData() {
this.busy = true;
if (this.page >= this.pageTotal) {
... ... @@ -127,7 +143,10 @@
reason: this.selected.reason || this.options[0].reason
}, (result) => {
if (result.code === 200) {
location.reload();
tip('取消成功');
setTimeout(() => {
this.reload();
}, 1000);
} else if (result.code !== 500) {
tip(result.message);
}
... ... @@ -155,7 +174,7 @@
reason: this.options.length ? this.options[0].reason : null
}, (result) => {
if (result.code === 200) {
location.reload();
this.reload();
}
});
};
... ... @@ -206,7 +225,9 @@
});
},
confirmGoods(code) {
Modal.confirm('', '确认收货', function() {
let _this = this;
Modal.confirm('', '确认收货吗?', function() {
this.hide();
$.ajax({
url: '/me/confirmReceive',
... ... @@ -216,7 +237,7 @@
}
}).then(result => {
if (result.code === 200) {
location.reload();
_this.reload();
} else if (result.code !== 500) {
tip(result.message);
}
... ...
... ... @@ -65,10 +65,25 @@
emptybox: 'hide'
};
},
ready() {
this.getRefundData();
created() {
this.reload();
document.addEventListener('visibilitychange', () => {
if (!document.hidden) {
this.reload();
}
});
},
methods: {
reload() {
this.page= 0;
this.pageTotal = 1;
this.orderList= [];
this.busy= false;
this.emptybox= 'hide';
this.getRefundData();
},
getRefundData() {
this.busy = true;
if (this.page >= this.pageTotal) {
... ... @@ -94,14 +109,13 @@
tip('网络错误');
});
},
/**
* 取消申请
* @param id
* @param type refundType 1为退货,2为换货
*/
cancelApply(id, type) {
let _this = this;
Modal.confirm('', '确认取消吗?', function() {
this.hide();
// type refundType 1为退货,2为换货
$.ajax({
url: '/me/return/' + (Number(type) === 2 ? 'exchange' : 'refund') + '/cancel-apply',
type: 'post',
... ... @@ -110,7 +124,10 @@
}
}).then(result => {
if (result.code === 200) {
location.reload();
tip('取消成功');
setTimeout(() => {
_this.reload();
}, 1000);
} else {
tip(result.message);
}
... ...
... ... @@ -31,7 +31,7 @@
</div>
<div v-if="(detail.deliveryTpye === '10' || type ==='refund') && detail.status == 10"
class="logistics">
<a href="/me/return/logistics?applyid={{applyid}}">填写商品寄回的快递信息</a>
<a href="/me/return/logistics?applyid={{applyid}}&type={{type}}">填写商品寄回的快递信息</a>
</div>
</div>
<div class="exchange-details">
... ... @@ -125,9 +125,41 @@
};
},
methods: {
reload() {
this.id = '';
this.sourceOrderCode = '';
this.show = false;
this.detail = {};
$.ajax({
url: '/me/return/status-detail',
data: {
applyid: this.applyid,
type: this.type
}
}).then(res => {
if (res.code === 200) {
this.show = true;
this.detail = res.data;
if (!this.detail.goodsList) {
return;
}
this.id = this.detail.id;
this.sourceOrderCode = this.detail.sourceOrderCode;
} else if (result.code !== 500) {
tip(result.message);
} else {
tip('数据获取失败');
}
}).fail(() => {
tip('网络错误');
});
},
cancel() {
let id = this.id;
let url = '';
let _this = this;
if (!id) {
return false;
... ... @@ -138,6 +170,7 @@
url = '/me/return/exchange/cancel-apply';
}
Modal.confirm('', '确认取消吗?', function() {
this.hide();
$.ajax({
... ... @@ -148,7 +181,7 @@
}
}).then(data => {
if (data.code === 200) {
location.reload();
_this.reload();
} else {
tip(data.message);
}
... ... @@ -157,39 +190,11 @@
}
},
created() {
$.ajax({
url: '/me/return/status-detail',
data: {
applyid: this.applyid,
type: this.type
}
}).then(res => {
if (res.code === 200) {
this.show = true;
this.detail = res.data;
if (!this.detail.goodsList) {
return;
}
this.id = this.detail.id;
this.sourceOrderCode = this.detail.sourceOrderCode;
this.detail.goodsList.forEach(d => {
// d.evidenceImages = d.evidenceImages.map(p => {
// return util.getImgHost(p) + '?imageView2/2/w/154/h/154';
// })
});
} else if (result.code !== 500) {
tip(result.message);
} else {
tip('数据获取失败');
}
}).fail(() => {
tip('网络错误');
});
this.reload();
document.addEventListener('visibilitychange', function() {
document.addEventListener('visibilitychange', () => {
if (!document.hidden) {
location.reload();
this.reload();
}
});
}
... ...
... ... @@ -20,7 +20,7 @@
const yoho = require('yoho');
module.exports = {
props: ['applyid', 'company_id', 'company_name'],
props: ['applyid', 'type', 'company_id', 'company_name'],
data() {
return {
num: '',
... ... @@ -47,6 +47,7 @@
url: '/me/return/save-logistics',
data: {
applyid: this.applyid,
type: this.type,
expressId: this.company_id,
expressCompany: this.company_name,
expressNumber: this.num
... ... @@ -58,7 +59,7 @@
if (res.code !== 200) {
tip(res.message || '网络错误');
} else {
yoho.goBack(true);
yoho.goBack();
}
});
return false;
... ...
... ... @@ -90,7 +90,7 @@
title: result.shopName,
des: shareSubTitle,
url: shareUrl,
img: result.shopBg,
img: result.shopLogo ? result.shopLogo : '',
isBlkShop: result.isBlkShop,
domain: locationQuery.domain,
brandName: result.brandName,
... ...