Authored by ccbikai

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

... ... @@ -21,7 +21,6 @@ exports.index = (req, res) => {
/* 查询 产品列表 */
exports.fetchProducts = (req, res, next) => {
const params = {
uid: req.user.uid, // mock data
page: req.query.page || 1,
order: req.query.order || 1,
query: req.query.query
... ...
... ... @@ -271,9 +271,9 @@ const intercept = (url) => {
} else {
location.href = url;
}
}
};
module.exports = {
titleMap: titleMap,
intercept: intercept
}
};
... ...
const Vue = require('vue');
const Status = require('me/refund/status.vue');
const Status = require('me/refund-status.vue');
require('common/vue-filter');
... ...
... ... @@ -16,6 +16,7 @@
.badge-tr {
position: absolute;
top: -5px;
right: -11px;
left: 100%;
transform: translate3d(-60%,0,0);
margin: 0;
}
... ...
... ... @@ -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 = {};
}
... ...
... ... @@ -3,7 +3,7 @@
<show-box :is-first="true">
<image-carousel :goods="entity.goodsList"></image-carousel>
<div class="title-box">
<h1>{{entity.productName}}</h1>
<h1 class="line-clamp-2">{{entity.productName}}</h1>
<i class="price" v-if="entity.productPriceBo.marketPrice > entity.productPriceBo.salesPrice"
:class="{'strike-through': entity.productPriceBo.salesPrice > 0}">{{entity.productPriceBo.formatMarketPrice}}</i>
... ... @@ -14,16 +14,14 @@
</div>
</show-box>
<show-box v-if="entity.brand">
<div class="brand">
<img :src="entity.brand.brandIco | resize 110 68" width="55" height="34"/>
<show-box class="brand" v-if="entity.brand">
<img :src="entity.brand.brandIco | resize 110 68"/>
<h2>{{entity.brand.brandName}}</h2>
<a :href="entity.brand.brandDomain | brandUrl">
进入店铺
<span class="icon icon-right"></span>
</a>
</div>
<h2>{{entity.brand.brandName}}</h2>
<a :href="entity.brand.brandDomain | brandUrl">
进入店铺
<span class="icon icon-right"></span>
</a>
</show-box>
<div class="separator" v-if="isApp"><span>继续拖动,查看商品信息</span>
... ... @@ -154,7 +152,7 @@
</ul>
</show-box>
<show-box :is-last="true">
<show-box class="product-detail-desc" :is-last="true">
<h2>商品详情</h2>
<i>DETAILS</i>
... ... @@ -170,7 +168,7 @@
<button class="button control-button">
<span @click="yoho.goShopingCart()" style="position: relative;">
<i class="icon icon-bag"></i>
<span v-if="isApp && cartCount > 0" class="badge badge-tr">{{cartCount}}</span>
<span v-if="isApp && cartCount > 0" class="badge badge-tr">{{cartCount >= 100 ? '99+': cartCount}}</span>
</span>
</button>
<button class="button control-button" @click="toggleFavorite()">
... ... @@ -201,33 +199,45 @@
background: #f6f6f6;
}
.show-box .brand {
max-height: 108px;
line-height: 48px;
.show-box.brand {
$lh: 68px;
overflow: hidden;
img {
vertical-align: middle;
height: 68px;
width: auto;
max-width: 110px;
float: left;
}
h2 {
display: inline-block;
font-size: 28px;
vertical-align: middle;
margin-left: 30px;
width: 50%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: $lh;
}
a {
float: right;
font-size: 28px;
line-height: $lh;
color: #b0b0b0;
}
}
.product-detail-desc {
/* 覆盖 img width,height 属性 */
img {
width: 100% !important;
height: auto !important;
}
}
.separator {
text-align: center;
color: #c4c4c4;
... ...
... ... @@ -13,8 +13,7 @@
word-wrap: break-word;
img {
max-width: 100%;
height: auto !important;
width: 100%;
}
p {
... ...
... ... @@ -31,7 +31,7 @@
el: '#product-list',
data: function() {
return {
sortName: locationQuery.sort_name,
sortName: locationQuery.title || locationQuery.sort_name, // 优先使用 title
orderConfig: [],
filterConfig: null,
... ... @@ -79,23 +79,23 @@
order: this.order,
page: nextPage
}, this.filter, locationQuery))
.done(res => {
if (res.code === 200) {
self.page = res.data.page;
self.totalPage = res.data.pageTotal;
self.$set('productList', self.productList.concat(res.data.productList));
if (!self.filterConfig) {
self.$set('filterConfig', res.data.filter);
.done(res => {
if (res.code === 200) {
self.page = res.data.page;
self.totalPage = res.data.pageTotal;
self.$set('productList', self.productList.concat(res.data.productList));
if (!self.filterConfig) {
self.$set('filterConfig', res.data.filter);
}
}
}
})
.fail(error => {
tip('网络出错~');
})
.always(() => {
self.inSearching = false;
});
})
.fail(error => {
tip('网络出错~');
})
.always(() => {
self.inSearching = false;
});
},
openFilter() {
... ...
... ... @@ -29,6 +29,10 @@
font-size: 32px;
font-style: italic;
margin: 5px 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: 100%;
}
hr {
... ...