Authored by 郭成尧

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

... ... @@ -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');
... ...
... ... @@ -88,6 +88,12 @@
interceptClick.intercept('/me/service');
return false;
});
document.addEventListener('visibilitychange', () => {
if (!document.hidden) {
this.reload();
}
});
},
methods: {
updateNavBar() {
... ... @@ -98,6 +104,14 @@
header: header
});
},
reload() {
this.show = false;
this.order = {};
this.selected = {};
this.cancelbusy = false;
this.getOrderData();
},
getOrderData() {
$.ajax({
url: '/me/get-order',
... ... @@ -150,7 +164,7 @@
if (result.code === 200) {
tip('取消成功');
setTimeout(() => {
location.reload();
this.reload();
}, 1000);
} else if (result.code !== 500) {
tip(result.message);
... ... @@ -190,7 +204,7 @@
reason: this.options.length ? this.options[0].reason : null
}, (result) => {
if (result.code === 200) {
location.reload();
this.reload();
}
});
};
... ... @@ -225,7 +239,9 @@
});
},
confirmGoods(code) {
Modal.confirm('', '确认收货', function() {
let _this = this;
Modal.confirm('', '确认收货吗?', function() {
this.hide();
$.ajax({
url: '/me/confirmReceive',
... ... @@ -235,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);
}
... ...