Authored by ccbikai

Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop

... ... @@ -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,
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 = {
... ...
... ... @@ -5,11 +5,7 @@
*/
'use strict';
// const _ = require('lodash');
// const helpers = global.yoho.helpers;
const api = global.yoho.API;
const camelCase = global.yoho.camelCase;
/**
* 商品详情
... ...
... ... @@ -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');
... ...
... ... @@ -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',
... ... @@ -141,7 +164,7 @@
if (result.code === 200) {
tip('取消成功');
setTimeout(() => {
location.reload();
this.reload();
}, 1000);
} else if (result.code !== 500) {
tip(result.message);
... ... @@ -181,7 +204,7 @@
reason: this.options.length ? this.options[0].reason : null
}, (result) => {
if (result.code === 200) {
location.reload();
this.reload();
}
});
};
... ... @@ -216,7 +239,9 @@
});
},
confirmGoods(code) {
Modal.confirm('', '确认收货', function() {
let _this = this;
Modal.confirm('', '确认收货吗?', function() {
this.hide();
$.ajax({
url: '/me/confirmReceive',
... ... @@ -226,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) {
... ... @@ -129,7 +145,7 @@
if (result.code === 200) {
tip('取消成功');
setTimeout(() => {
location.reload();
this.reload();
}, 1000);
} else if (result.code !== 500) {
tip(result.message);
... ... @@ -158,7 +174,7 @@
reason: this.options.length ? this.options[0].reason : null
}, (result) => {
if (result.code === 200) {
location.reload();
this.reload();
}
});
};
... ... @@ -209,7 +225,9 @@
});
},
confirmGoods(code) {
Modal.confirm('', '确认收货', function() {
let _this = this;
Modal.confirm('', '确认收货吗?', function() {
this.hide();
$.ajax({
url: '/me/confirmReceive',
... ... @@ -219,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);
}
... ...
... ... @@ -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,
... ...