Authored by 沈志敏

改为es6

const Vue = require('vue');
const Status = require('me/refund/status.vue');
const Status = require('me/refund-status.vue');
require('common/vue-filter');
... ...
... ... @@ -55,33 +55,30 @@
};
},
methods: {
loadMore: function() {
let _this = this;
loadMore() {
this.busy = true;
$.ajax({
url: '/me/collection/favpaging',
data: {
page: ++_this.page,
page: ++this.page,
tab: 'brand'
}
}).then(data => {
if ($.isEmptyObject(data) || data.pageTotal === 0) {
_this.busy = true;
this.busy = true;
} else {
if (data.pageTotal && _this.page === data.pageTotal) {
_this.busy = true;
if (data.pageTotal && this.page === data.pageTotal) {
this.busy = true;
} else {
_this.busy = false;
this.busy = false;
}
const list = data.brandList || [];
list.forEach(function(o) {
if (!_this.keys[o.brandId]) {
_this.keys[o.brandId] = true;
_this.brandData.push({
list.forEach(o => {
if (!this.keys[o.brandId]) {
this.keys[o.brandId] = true;
this.brandData.push({
fav_id: o.brandId,
link: o.brandDomain,
imgUrl: o.brandIco,
... ... @@ -92,7 +89,7 @@
});
}
_this.nullbox = _this.brandData.length ? 'hide' : '';
this.nullbox = this.brandData.length ? 'hide' : '';
}).fail(() => {
tip('网络错误');
});
... ... @@ -108,15 +105,13 @@
this.pandata.objX = -width;
},
hideDelBth() {
this.brandData.forEach(function(d) {
this.brandData.forEach(d => {
$('#li-' + d.fav_id).css('transform', 'translateX(0px)');
$('#del-' + d.fav_id).addClass('hide');
});
this.pandata = {};
},
delItem(index, id) {
let _this = this;
$.ajax({
method: 'POST',
url: '/me/del-favdel',
... ... @@ -124,21 +119,21 @@
favId: id,
type: 'brand'
}
}).then(function(data) {
}).then(data => {
if (data.code === 200) {
_this.brandData.splice(index, 1);
_this.hideDelBth();
delete _this.keys[id];
this.brandData.splice(index, 1);
this.hideDelBth();
delete this.keys[id];
} else if (data.code === 400) {
tip(data.message);
} else {
tip('刪除收藏失败');
}
}).fail(function() {
}).fail(() => {
tip('网络错误');
});
},
panstart: function(id) {
panstart(id) {
event.preventDefault();
if (this.editmodel && this.pandata.id !== id) {
return false;
... ... @@ -156,7 +151,7 @@
this.pandata.id = id;
}
},
panmove: function(id) {
panmove(id) {
event.preventDefault();
if (this.editmodel && this.pandata.id !== id) {
return false;
... ... @@ -183,7 +178,7 @@
li.css('transform', 'translateX(' + this.currentX + 'px)');
}
},
panend: function(id) {
panend(id) {
event.preventDefault();
if (this.editmodel && this.pandata.id !== id) {
return false;
... ... @@ -206,16 +201,15 @@
}
}
},
created: function() {
let _this = this;
yoho.addNativeMethod('editModel', function() {
_this.hideDelBth();
_this.editmodel = !_this.editmodel;
created() {
yoho.addNativeMethod('editModel', () => {
this.hideDelBth();
this.editmodel = !this.editmodel;
let header = interceptClick.titleMap[5];
header.defaultSelectedIndex = '1';
header.right.des = _this.editmodel ? '完成' : '编辑';
header.right.des = this.editmodel ? '完成' : '编辑';
return yoho.goPageView({
header: header
});
... ...
... ... @@ -60,34 +60,32 @@
};
},
methods: {
loadMore: function() {
let _this = this;
loadMore() {
this.busy = true;
$.ajax({
url: '/me/collection/favpaging',
data: {
page: ++_this.page
page: ++this.page
}
}).then(data => {
if ($.isEmptyObject(data) || data.pageTotal === 0) {
_this.busy = true;
this.busy = true;
} else {
if (_this.page === data.pageTotal) {
_this.busy = true;
if (this.page === data.pageTotal) {
this.busy = true;
} else {
_this.busy = false;
this.busy = false;
}
const list = data.productList || [];
list.forEach(function(o) {
list.forEach(o => {
if (!o.productSkn) {
return;
}
if (!_this.keys[o.productId]) {
_this.keys[o.productId] = true;
if (!this.keys[o.productId]) {
this.keys[o.productId] = true;
let discountPrice = false;
... ... @@ -95,7 +93,7 @@
discountPrice = '¥' + Number(Math.max(o.salesPrice, 0)).toFixed(2);
}
_this.productData.push({
this.productData.push({
fav_id: o.productId,
link: o.goodsId && o.cnAlphabet ? o.productId : '',
imgUrl: o.image,
... ... @@ -109,7 +107,7 @@
});
}
_this.nullbox = _this.productData.length ? 'hide' : '';
this.nullbox = this.productData.length ? 'hide' : '';
}).fail(() => {
tip('网络错误');
});
... ... @@ -125,15 +123,13 @@
this.pandata.objX = -width;
},
hideDelBth() {
this.productData.forEach(function(d) {
this.productData.forEach(d => {
$('#li-' + d.fav_id).css('transform', 'translateX(0px)');
$('#del-' + d.fav_id).addClass('hide');
});
this.pandata = {};
},
delItem(index, id) {
let _this = this;
$.ajax({
method: 'POST',
url: '/me/del-favdel',
... ... @@ -141,21 +137,21 @@
favId: id,
type: 'product'
}
}).then(function(data) {
}).then(data => {
if (data.code === 200) {
_this.productData.splice(index, 1);
_this.hideDelBth();
delete _this.keys[id];
this.productData.splice(index, 1);
this.hideDelBth();
delete this.keys[id];
} else if (data.code === 400) {
tip(data.message);
} else {
tip('刪除收藏失败');
}
}).fail(function() {
}).fail(() => {
tip('网络错误');
});
},
panstart: function(id) {
panstart(id) {
event.preventDefault();
if (this.editmodel && this.pandata.id !== id) {
return false;
... ... @@ -173,7 +169,7 @@
this.pandata.id = id;
}
},
panmove: function(id) {
panmove(id) {
event.preventDefault();
if (this.editmodel && this.pandata.id !== id) {
return false;
... ... @@ -200,7 +196,7 @@
li.css('transform', 'translateX(' + this.currentX + 'px)');
}
},
panend: function(id) {
panend(id) {
event.preventDefault();
if (this.editmodel && this.pandata.id !== id) {
return false;
... ... @@ -223,17 +219,15 @@
}
}
},
created: function() {
let _this = this;
yoho.addNativeMethod('editModel', function() {
_this.hideDelBth();
_this.editmodel = !_this.editmodel;
created() {
yoho.addNativeMethod('editModel', () => {
this.hideDelBth();
this.editmodel = !this.editmodel;
let header = interceptClick.titleMap[5];
header.defaultSelectedIndex = '0';
header.right.des = _this.editmodel ? '完成' : '编辑';
header.right.des = this.editmodel ? '完成' : '编辑';
return yoho.goPageView({
header: header
});
... ...
... ... @@ -71,12 +71,10 @@
});
},
setAender: function() {
let _this = this;
genderSel.show(function(item) {
_this.gender = item.val.toLowerCase();
_this.saveDetails({
nickname: _this.nickname,
genderSel.show(item => {
this.gender = item.val.toLowerCase();
this.saveDetails({
nickname: this.nickname,
gender: item.key
});
});
... ...
... ... @@ -127,13 +127,11 @@
});
},
getCancelReason() {
let that = this;
$.ajax({
url: '/me/getCancelOrderReason',
}).then(result => {
if (result.data.length > 0) {
that.options = result.data;
this.options = result.data;
}
}).fail(() => {
tip('操作失败');
... ... @@ -151,10 +149,8 @@
};
},
autoCancel(code) {
let _that = this;
return () => {
_that.orderDetail().cancel({orderCode: code}, (result) => {
this.orderDetail().cancel({orderCode: code}, (result) => {
if (result.code === 200) {
location.reload();
}
... ... @@ -211,7 +207,7 @@
yohoAPI.goPay({orderid: code});
},
applyRefund() {
genderSel.show(function(item) {
genderSel.show(item => {
if (item.url) {
interceptClick.intercept(item.url);
}
... ...
... ... @@ -85,8 +85,6 @@
methods: {
getOrderData() {
let _that = this;
this.busy = true;
if (this.page >= this.pageTotal) {
return;
... ... @@ -100,15 +98,15 @@
}
}).then(result => {
if (result.code === 200) {
_that.busy = false;
this.busy = false;
if (result.data.orderList.length > 0) {
this.$set('orderList', _that.orderList.concat(result.data.orderList));
_that.pageTotal = result.data.pageTotal;
this.$set('orderList', this.orderList.concat(result.data.orderList));
this.pageTotal = result.data.pageTotal;
}
}
if (_that.orderList.length === 0) {
_that.emptybox = '';
if (this.orderList.length === 0) {
this.emptybox = '';
}
}).fail(() => {
tip('网络错误');
... ... @@ -129,23 +127,19 @@
});
},
getCancelReason() {
let that = this;
$.ajax({
url: '/me/getCancelOrderReason',
}).then(result => {
if (result.data.length > 0) {
that.options = result.data;
this.options = result.data;
}
}).fail(() => {
tip('操作失败');
});
},
autoCancel(code) {
let _that = this;
return () => {
_that.order().cancel({orderCode: code}, (result) => {
this.order().cancel({orderCode: code}, (result) => {
if (result.code === 200) {
location.reload();
}
... ... @@ -173,7 +167,7 @@
});
},
deleteOrder(order, index) {
let that = this;
let _that = this;
Modal.confirm('', '确认删除订单?', function() {
this.hide();
... ... @@ -185,7 +179,7 @@
}
}).then(result => {
if (result.code === 200) {
that.orderList.splice(index, 1);
_that.orderList.splice(index, 1);
} else {
tip(result.message);
}
... ...
... ... @@ -66,8 +66,6 @@
methods: {
getOrderData() {
let _that = this;
this.busy = true;
if (this.page >= this.pageTotal) {
return;
... ... @@ -79,14 +77,14 @@
limit: this.limit
}
}).then(result => {
_that.busy = false;
this.busy = false;
if (result.data.list.length > 0) {
this.$set('orderList', _that.orderList.concat(result.data.list));
_that.pageTotal = result.data.totalPage;
this.$set('orderList', this.orderList.concat(result.data.list));
this.pageTotal = result.data.totalPage;
}
if (_that.orderList.length === 0) {
_that.emptybox = '';
if (this.orderList.length === 0) {
this.emptybox = '';
}
}).fail(() => {
tip('网络错误');
... ...
... ... @@ -121,7 +121,7 @@
};
},
methods: {
cancel: function() {
cancel() {
if (!this.detail || !this.orderCode) {
return false;
}
... ... @@ -140,7 +140,7 @@
data: {
id: this.orderCode,
}
}).then(function(data) {
}).then(data => {
if (data.code === 200) {
interceptClick.intercept('/me/return');
} else if (data.code === 400) {
... ... @@ -151,9 +151,7 @@
});
}
},
created: function() {
let _this = this;
created() {
$.ajax({
url: '/me/return/status-detail',
data: {
... ... @@ -162,19 +160,19 @@
}
}).then(res => {
if (res.data) {
_this.detail = res.data;
if (!_this.detail.goodsList) {
this.detail = res.data;
if (!this.detail.goodsList) {
return;
}
if (this.type === 'refund') {
_this.orderCode = _this.detail.sourceOrderCode;
this.orderCode = this.detail.sourceOrderCode;
} else if (this.type === 'exchange') {
_this.orderCode = _this.detail.orderCode;
this.orderCode = this.detail.orderCode;
}
_this.detail.goodsList.forEach(function(d) {
d.evidenceImages = d.evidenceImages.map(function(p) {
this.detail.goodsList.forEach(d => {
d.evidenceImages = d.evidenceImages.map(p => {
return util.getImgHost(p) + '?imageView2/2/w/154/h/154';
})
});
... ... @@ -185,5 +183,5 @@
</script>
<style>
@import "../../../scss/me/_status.css";
@import "../../scss/me/_status.css";
</style>
... ...
... ... @@ -29,7 +29,7 @@
indexList
},
methods: {
search: function() {
search() {
let inputname = this.inputname;
if (!inputname) {
... ... @@ -40,7 +40,7 @@
let filter = {};
for (let k in this.company_list) {
this.company_list[k].forEach(function(d) {
this.company_list[k].forEach(d => {
if (d.company_name.indexOf(inputname) > -1) {
if (!filter[k]) {
filter[k] = [];
... ... @@ -51,7 +51,7 @@
}
this.showData = filter;
},
select: function(companyId, companyName) {
select(companyId, companyName) {
this.$dispatch('changeView', {
view: 'logistics',
company_id: companyId,
... ...
... ... @@ -27,12 +27,12 @@
};
},
methods: {
companylist: function() {
companylist() {
this.$dispatch('changeView', {
view: 'logisticsCompany'
});
},
submit: function() {
submit() {
if (!this.company_name) {
tip('请选择快递公司');
return false;
... ... @@ -51,7 +51,7 @@
expressCompany: this.company_name,
expressNumber: this.num
}
}).then(function(res) {
}).then(res => {
if ($.type(res) !== 'object') {
res = {};
}
... ...