Authored by Aiden Xu

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

... ... @@ -15,7 +15,7 @@ let channel = {
cache: true,
code: 200
}).then(result => {
return processResources(result.data);
return result.data ? processResources(result.data) : [];
});
},
getSidebarData() {
... ...
... ... @@ -5,7 +5,6 @@
*/
'use strict';
const homeModel = require('../models/index');
const _ = require('lodash');
const helpers = global.yoho.helpers;
/**
... ... @@ -29,12 +28,10 @@ const component = {
page: 'index',
noLocalCSS: true,
head_ico: proData && proData.head_ico ? helpers.image(proData.head_ico, 200, 200) : '',
nickname: proData ? proData.nickname : '登录/注册',
userinfourl: proData ? '/home/mydetails' : '',
serviceUrl: '/home/service'
nickname: proData ? proData.nickname : '登录/注册'
};
res.render('index', _.merge(result, data[1]));
res.render('index', Object.assign(result, data[1]));
}).catch(next);
},
mydetails: (req, res, next) => {
... ... @@ -82,7 +79,7 @@ const component = {
}).catch(next);
},
service: (req, res, next) => {
res.redirect('http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409')
res.redirect('http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=703953&configID=149819&jid=1099911094')
},
help: (req, res, next) => {
homeModel.getHelpInfo().then(helpList => {
... ... @@ -121,22 +118,12 @@ const component = {
},
saveFeedback: (req, res, next) => {
let saveFeedbackPara = {
uid: req.user.uid,
udid: req.user.udid, // todo
content: req.body.content,
suggest_type: 2
};
if (req.user && req.user.uid) {
_.merge(saveFeedbackPara, {
uid: req.user.uid
});
}
if (req.user && req.user.udid && !req.user.uid) {
_.merge(saveFeedbackPara, {
udid: req.user.udid
});
}
homeModel.saveFeedback(saveFeedbackPara).then(result => {
if (result.code === 200) {
return res.json({
... ...
... ... @@ -16,6 +16,8 @@ exports.getFavProductData = (uid, page, limit) => {
uid: uid,
page: page,
limit: limit
}, {
code: 200
}).then(result => {
var isend = true,
list = [],
... ... @@ -77,6 +79,8 @@ exports.getFavBrandData = (uid, gender, page, limit) => {
gender: gender,
page: page,
limit: limit
}, {
code: 200
}).then(result => {
var isend = true,
list = [],
... ...
... ... @@ -2,7 +2,6 @@
const api = global.yoho.API;
const serviceAPI = global.yoho.ServiceAPI;
const Promise = require('bluebird');
const _ = require('lodash');
const helpers = global.yoho.helpers;
/**
... ... @@ -15,6 +14,8 @@ const _getUserProfileData = exports.getUserProfileData = (uid) => {
return api.get('', {
uid: uid,
method: 'app.passport.profile'
}, {
code: 200
}).then(result => {
return result.data;
});
... ... @@ -30,9 +31,13 @@ const _getInfoNumData = (uid) => {
return api.all([api.get('', {
uid: uid,
method: 'app.home.getInfoNum' // 收藏及订单数目数据
}, {
code: 200
}), api.get('', {
uid: uid,
method: 'app.address.gethidden' // 用户地址的数据
}, {
code: 200
})]).then(data => {
let res = {
wait_pay_num: '',
... ... @@ -44,22 +49,18 @@ const _getInfoNumData = (uid) => {
yoho_coin_num: ''
};
if (data[0].data) {
for (let k in data[0].data) {
if (res[k] !== null) {
res[k] = data[0].data[k] ? data[0].data[k] : '';
if (k !== 'yoho_coin_num' && res[k] > 99) {
res[k] = '99+';
}
for (let k in data[0].data) {
if (res[k] !== null) {
res[k] = data[0].data[k] ? data[0].data[k] : '';
if (k !== 'yoho_coin_num' && res[k] > 99) {
res[k] = '99+';
}
}
}
if (data[1].data) {
res = _.merge(res, {
address_num: data[1].data.length ? data[1].data.length : ''
});
}
return res;
return Object.assign(res, {
address_num: data[1].data.length ? data[1].data.length : ''
});
});
};
... ... @@ -86,12 +87,14 @@ exports.getHelpInfo = (data) => {
},
infoData = Object.assign(defaultParam, data);
return api.get('', infoData).then(result => {
return api.get('', infoData, {
code: 200
}).then(result => {
var helpData = result.data;
var formatData = [];
helpData = helpData || [];
_.forEach(helpData, (item) => {
helpData.forEach(function(item) {
formatData.push({
name: item.caption,
code: item.code,
... ... @@ -117,9 +120,9 @@ exports.getHelpDetail = (data) => {
},
detailData = Object.assign(defaultParam, data);
return api.get('', detailData).then(result => {
return result;
});
return api.get('', detailData, {
code: 200
}).then(result => result);
};
/**
... ... @@ -149,7 +152,5 @@ exports.saveMydetails = (params) => {
},
data = Object.assign(defaultParam, params);
return api.get('', data).then(result => {
return result;
});
return api.get('', data).then(result => result);
};
... ...
... ... @@ -28,6 +28,8 @@ const refund = {
getExpressCompany() {
return api.get('', {
method: 'app.express.getExpressCompany'
}, {
code: 200
});
},
... ... @@ -42,7 +44,9 @@ const refund = {
* @returns {Promise.<T>|*}
*/
getRefundOrders(param) {
param = Object.assign({method: 'app.refund.getList'}, param);
param = Object.assign({
method: 'app.refund.getList'
}, param);
return api.get('', param, {
cache: true,
... ...
<div class="my-page">
<div class="my-header">
<span class="setting icon icon-setting" id="setting"></span>
<a class="user-info" id="user-info" {{#if userinfourl}} href='{{userinfourl}}' {{/if}}>
<a class="user-info no-intercept" id="user-info" href='/home/mydetails'>
<span class="user-avatar" {{#if head_ico}} style="background-image: url('{{head_ico}}');" {{/if}}></span>
<br><span class="username">{{nickname}}</span>
</a>
</div>
<div class="my-order">
<a class="order-title" href="/home/orders?type=1">
<a class="order-title no-intercept" href="/home/orders?type=1">
我的订单
<span class="read-order">
查看全部订单 <span class="icon icon-right"></span>
</span>
</a>
<div class="order-type clearfix">
<a class="type-item" href="/home/orders?type=2">
<a class="type-item no-intercept" href="/home/orders?type=2">
<span class="icon icon-wait-pay"></span>
<br>待付款
{{#if wait_pay_num}}
<span class="num">{{wait_pay_num}}</span>
{{/if}}
</a>
<a class="type-item" href="/home/orders?type=3">
<a class="type-item no-intercept" href="/home/orders?type=3">
<span class="icon icon-wait-cargo"></span>
<br>待发货
{{#if wait_cargo_num}}
<span class="num">{{wait_cargo_num}}</span>
{{/if}}
</a>
<a class="type-item" href="/home/orders?type=4">
<a class="type-item no-intercept" href="/home/orders?type=4">
<span class="icon icon-send-cargo"></span>
<br>待收货
{{#if send_cargo_num}}
<span class="num">{{send_cargo_num}}</span>
{{/if}}
</a>
<a class="type-item" href="/home/refund/orders">
<a class="type-item no-intercept" href="/home/refund/orders">
<span class="icon icon-refund-exchange"></span>
<br>退换货
{{#if refund_exchange_num}}
... ... @@ -45,33 +45,33 @@
</div>
</div>
<div class="group-list">
<a class="list-item" id="address">
<a class="list-item no-intercept" id="address">
地址管理
<span class="num">{{address_num}} <span class="icon icon-right"></span></span>
</a>
</div>
<div class="group-list">
<a class="list-item" href="/home/favorite">
<a class="list-item no-intercept" href="/home/favorite">
收藏的商品
<span class="num">{{product_favorite_total}} <span class="icon icon-right"></span></span>
</a>
<a class="list-item" href="/home/favorite?tab=brand">
<a class="list-item no-intercept" href="/home/favorite?tab=brand">
收藏的品牌
<span class="num">{{brand_favorite_total}} <span class="icon icon-right"></span></span>
</a>
</div>
<div class="group-list">
<a class="list-item" href="/home/mycurrency">
<a class="list-item no-intercept" href="/home/mycurrency">
YOHO 币
<span class="num">{{yoho_coin_num}} <span class="icon icon-right"></span></span>
</a>
</div>
<div class="group-list">
<a class="list-item" href="/home/help">
<a class="list-item no-intercept" href="/home/help">
帮助中心
<span class="num"><span class="icon icon-right"></span></span>
</a>
<a class="list-item" href="{{serviceUrl}}">
<a class="list-item no-intercept" href="/home/service">
在线客服
<span class="num"><span class="icon icon-right"></span></span>
</a>
... ...
... ... @@ -27,6 +27,11 @@ const getShopData = params => {
if (result[0].code === 200) {
/* 品牌名称 */
Object.assign(finalResult, {
brandName: result[0].data.brand_name
});
/* 品牌是否有店铺 */
if (result[0].data.shop_id) {
... ... @@ -48,9 +53,9 @@ const getShopData = params => {
/* 取店铺的基本信息 */
Object.assign(finalResult, {
brandLogo: subResult[0].data.shop_logo,
brandName: subResult[0].data.shop_name,
brandIntro: subResult[0].data.shop_intro,
shopLogo: subResult[0].data.shop_logo,
shopName: subResult[0].data.shop_name,
shopIntro: subResult[0].data.shop_intro,
isFav: subResult[0].data.is_favorite === 'Y'
});
... ...
... ... @@ -2,6 +2,9 @@ const Vue = require('yoho-vue');
const infiniteScroll = require('yoho-vue-infinite-scroll');
const favBrandList = require('home/fav-brand-list.vue');
const VueTouch = require('vue-touch');
Vue.use(VueTouch)
Vue.use(infiniteScroll);
new Vue({
... ...
... ... @@ -2,6 +2,9 @@ const Vue = require('yoho-vue');
const infiniteScroll = require('yoho-vue-infinite-scroll');
const favProductList = require('home/fav-product-list.vue');
const VueTouch = require('vue-touch');
Vue.use(VueTouch)
Vue.use(infiniteScroll);
new Vue({
... ...
... ... @@ -2,31 +2,31 @@ var yoho = require('yoho');
var $ = require('yoho-jquery');
var interceptClick = require('common/intercept-click');
$('.my-page').on('click', 'a', function() {
// 拦截跳转
var href = $(this).attr('href');
if (href) {
interceptClick(href);
return false;
}
});
// 跳转登录页
$('#user-info').on('click', function() {
var href = $(this).attr('href');
if (!href) {
yoho.goLogin();
}
});
// 地址管理
$('#address').on('click', function() {
yoho.goAddress({
'type': '2'
});
return false;
});
// 系统设置
$('#setting').on('click', function() {
yoho.goSetting();
return false;
});
$('.my-page').on('click', 'a', function() {
// 未登录时跳转至登录页
if (!yoho.isLogin) {
yoho.goLogin();
return false;
}
// 拦截跳转
var href = $(this).attr('href');
if (href) {
interceptClick(href);
return false;
}
});
... ...
... ... @@ -8,7 +8,7 @@
*
* 希望能与 微信 JS-SDK 一样方便
*/
const cookie = require('yoho-cookie');
const tip = require('common/tip');
/* 空方法 */
... ... @@ -24,6 +24,11 @@ const yoho = {
isApp: /yh_blk/i.test(navigator.userAgent || ''),
/**
* 判断是否是 登录
*/
isLogin: cookie.get('_YOHOUID'),
/**
* JS 与 APP 共享的对象
*/
data: window.yohoInterfaceData,
... ...
... ... @@ -12,7 +12,7 @@
.setting {
float: left;
margin-top: 30px;
margin-top: 40px;
margin-left: 15px;
font-size: 46px;
}
... ...
<template>
<div class="search">
<input v-if="showInput" type="text" name="">
<div v-else class="input" @click="changeToInput()">
<div v-else class="input" @click='yoho.goSearch()'>
<span class="icon icon-search"></span> Search
</div>
</div>
... ... @@ -26,24 +25,16 @@
padding: 5px 0;
}
input {
width: 92%;
height: 55px;
padding: 10px;
}
}
</style>
<script>
const yoho = require('yoho');
module.exports = {
data() {
return {
showInput: false
yoho
};
},
methods: {
changeToInput() {
this.showInput = true;
}
}
};
</script>
... ...
<template>
<div class="header {{class}}">
<div class="header" :class="class">
<div class="header-left">
<slot name="left">
<i class="icon icon-left" @click="goBack"></i>
... ...
... ... @@ -10,7 +10,7 @@
<button class="button" @click='yoho.goNewPage({"url":"http://m.yohoblk.com"})'>新页面</button>
<button class="button" @click="yoho.goPay()">支付</button>
<button class="button" @click="yoho.goBack()">返回</button>
<button class="button" @click='yoho.goShare({"title":"标题","des":"描述","img":"http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg","url":"http://m.yohoblk.com"})'>分享</button>
<button class="button" @click='yoho.goShare({"title":"标题","des":"描述","img":"http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg","url":"http://m.yohoblk.com/product/shop/share?domain=sctest1"})'>分享</button>
<button class="button" @click='yoho.goSearch()'>搜索</button>
<button class="button" @click='yoho.goSetting()'>设置</button>
<button class="button" @click='yoho.goSetAvatar()'>设置头像</button>
... ...
... ... @@ -120,10 +120,21 @@
},
methods: {
changeAddress() {
const self = this;
yoho.goAddress({
type: '1'
}, (address) => {
// Todo
if(address) {
self.$set('address', {
addressId: address.address_id,
area: address.area,
zipCode: address.zip_code,
mobile: address.mobile,
address: address.address,
consigneeName: address.consignee_name
});
}
}, () => {
tip('更换地址失败~');
});
... ... @@ -160,7 +171,7 @@
submitData() {
const data = {
order_code: this.orderCode,
address_id: this.address.address_id,
address_id: this.address.addressId,
address: this.address.address,
consigee_name: this.address.consignee,
area_code: this.address.areaCode,
... ...
<template>
<div class="fav-type" v-infinite-scroll="loadMore()" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
<ul class="fav-brand-list">
<li v-for="item in brandData" track-by="$index" id="li-{{$index}}">
<div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn($index)">
<li v-for="item in brandData" track-by="fav_id" id="li-{{item.fav_id}}"
v-touch:panstart="panstart(item.fav_id)"
v-touch:panmove="panmove(item.fav_id)"
v-touch:panend="panend(item.fav_id)">
<div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)">
<span class="fav-del-span"><span class="icon icon-edit-del"></span></span>
</div>
<a :href="item.link">
... ... @@ -11,10 +14,12 @@
</div>
<div class="fav-info-list">
<span class="title">{{item.brandName}}</span>
<span class="down" v-if="item.down">品牌已下架</span>
<span class="down">
<span v-if="item.down">品牌已下架</span>
</span>
</div>
</a>
<div class="fav-del-right hide" id="del-{{$index}}" @click="delItem($index, item.fav_id)">
<div class="fav-del-right hide" id="del-{{item.fav_id}}" @click="delItem($index, item.fav_id)">
<span class="icon icon-delete"></span>
<br/>
<span class="fav-del-txt">删除</span>
... ... @@ -42,7 +47,11 @@
busy: false,
editmodel: false,
page: 0,
brandData: []
pageX: 0,
currentX: 0,
pandata: {},
brandData: [],
keys: {}
};
},
methods: {
... ... @@ -65,7 +74,10 @@
if (result.list.length) {
result.list.forEach(function(o) {
_this.brandData.push(o);
if (!_this.keys[o.fav_id]) {
_this.keys[o.fav_id] = true;
_this.brandData.push(o);
}
});
}
... ... @@ -74,19 +86,20 @@
tip('网络错误');
});
},
showDelBtn(index) {
showDelBtn(id) {
this.hideDelBth();
let delBtn = $('#del-' + index);
let delBtn = $('#del-' + id);
let width = delBtn.width();
$('#li-' + index).css('transform', 'translateX(-' + width + 'px)');
$('#li-' + id).css('transform', 'translateX(-' + width + 'px)');
delBtn.removeClass('hide');
},
hideDelBth() {
this.brandData.forEach(function(d, index) {
$('#li-' + index).css('transform', 'translateX(0px)');
$('#del-' + index).addClass('hide');
this.brandData.forEach(function(d) {
$('#li-' + d.fav_id).css('transform', 'translateX(0px)');
$('#del-' + d.fav_id).addClass('hide');
});
this.pandata = {};
},
delItem(index, id) {
let _this = this;
... ... @@ -102,6 +115,7 @@
if (data.code === 200) {
_this.brandData.splice(index, 1);
_this.hideDelBth();
delete _this.keys[id];
} else if (data.code === 400) {
tip(data.message);
} else {
... ... @@ -110,16 +124,77 @@
}).fail(function() {
tip('网络错误');
});
},
panstart: function(id) {
event.preventDefault();
if (this.editmodel) {
return false;
}
$('#del-' + id).removeClass('hide');
this.pageX = event.targetTouches[0].pageX;
if (this.pandata.id !== id) {
if (this.pandata.id !== undefined) {
$('#li-' + this.pandata.id).css('transform', 'translateX(0px)');
$('#del-' + this.pandata.id).addClass('hide');
}
this.pandata.objX = 0;
this.pandata.id = id;
}
},
panmove: function(id) {
event.preventDefault();
if (this.editmodel) {
return false;
}
let li = $('#li-' + id);
let width = $('#del-' + id).width();
let moveX = event.targetTouches[0].pageX;
let X = moveX - this.pageX;
if (this.pandata.objX == 0) {
if (X >= 0) {
this.currentX = 0;
} else {
this.currentX = -Math.min(Math.abs(X), width);
}
li.css('transform', "translateX(" + this.currentX + "px)");
} else if (this.pandata.objX < 0) {
if (X >= 0) {
this.currentX = Math.min(Math.abs(X) - width, 0);
} else {
this.currentX = -width;
}
li.css('transform', "translateX(" + this.currentX + "px)");
}
},
panend: function(id) {
event.preventDefault();
if (this.editmodel) {
return false;
}
let li = $('#li-' + id);
let delBtn = $('#del-' + id);
let width = delBtn.width();
if (this.currentX > -(width / 2)) {
this.pandata.objX = 0;
delBtn.addClass('hide');
} else {
this.pandata.objX = -width;
}
li.css('transform',"translateX(" + this.pandata.objX + "px)");
}
},
created: function() {
let _this = this;
yoho.addNativeMethod('editModel', function(action) {
_this.hideDelBth();
_this.editmodel = action;
if (!action) {
_this.hideDelBth();
}
});
}
};
... ... @@ -138,10 +213,11 @@
.fav-brand-list {
padding-left: 20px;
list-style: none;
overflow: hidden;
li {
position: relative;
height: 135px;
overflow: hidden;
border-bottom: 1px solid #e0e0e0;
}
... ... @@ -214,28 +290,30 @@
font-size: 24px;
padding-bottom: 10px;
margin-right: 10px;
margin-top: 35px;
height: 100px;
height: 100%;
overflow: hidden;
position: relative;
.title {
width: 430px;
color: #b0b0b0;
text-overflow: ellipsis;
font-size: 34px;
margin: 0;
line-height: 130px;
}
}
span {
&.down {
.down {
height: 100%;
line-height: 130px;
float: right;
padding: 5px 18px;
color: #fffefe;
background: #b0b0b0;
border-radius: 20px;
font-size: 22px;
span {
padding: 5px 18px;
color: #fffefe;
background: #b0b0b0;
border-radius: 20px;
font-size: 22px;
}
}
}
}
... ...
<template>
<div class="fav-type" v-infinite-scroll="loadMore()" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
<ul class="fav-product-list">
<li v-for="item in productData" track-by="$index" id="li-{{$index}}">
<div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn($index)">
<li v-for="item in productData" track-by="fav_id" id="li-{{item.fav_id}}"
v-touch:panstart="panstart(item.fav_id)"
v-touch:panmove="panmove(item.fav_id)"
v-touch:panend="panend(item.fav_id)">
<div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)">
<span class="fav-del-span"><span class="icon icon-edit-del"></span></span>
</div>
<a :href="item.link">
... ... @@ -22,7 +25,7 @@
</div>
</div>
</a>
<div class="fav-del-right hide" id="del-{{$index}}" @click="delItem($index, item.fav_id)">
<div class="fav-del-right hide" id="del-{{item.fav_id}}" @click="delItem($index, item.fav_id)">
<span class="icon icon-delete"></span>
<br/>
<span class="fav-del-txt">删除</span>
... ... @@ -39,6 +42,7 @@
<script>
const $ = require('yoho-jquery');
const tip = require('common/tip');
const yoho = require('yoho');
module.exports = {
props: ['productUrl'],
... ... @@ -48,7 +52,11 @@
busy: false,
editmodel: false,
page: 0,
productData: []
pageX: 0,
currentX: 0,
pandata: {},
productData: [],
keys: {}
};
},
methods: {
... ... @@ -70,7 +78,10 @@
if (result.list.length) {
result.list.forEach(function(o) {
_this.productData.push(o);
if (!_this.keys[o.fav_id]) {
_this.keys[o.fav_id] = true;
_this.productData.push(o);
}
});
}
... ... @@ -79,19 +90,20 @@
tip('网络错误');
});
},
showDelBtn(index) {
showDelBtn(id) {
this.hideDelBth();
let delBtn = $('#del-' + index);
let delBtn = $('#del-' + id);
let width = delBtn.width();
$('#li-' + index).css('transform', 'translateX(-' + width + 'px)');
delBtn.removeClass('hide');
$('#li-' + id).css('transform', 'translateX(-' + width + 'px)');
},
hideDelBth() {
this.productData.forEach(function(d, index) {
$('#li-' + index).css('transform', 'translateX(0px)');
$('#del-' + index).addClass('hide');
this.productData.forEach(function(d) {
$('#li-' + d.fav_id).css('transform', 'translateX(0px)');
$('#del-' + d.fav_id).addClass('hide');
});
this.pandata = {};
},
delItem(index, id) {
let _this = this;
... ... @@ -107,6 +119,7 @@
if (data.code === 200) {
_this.productData.splice(index, 1);
_this.hideDelBth();
delete _this.keys[id];
} else if (data.code === 400) {
tip(data.message);
} else {
... ... @@ -115,16 +128,77 @@
}).fail(function() {
tip('网络错误');
});
},
panstart: function(id) {
event.preventDefault();
if (this.editmodel) {
return false;
}
$('#del-' + id).removeClass('hide');
this.pageX = event.targetTouches[0].pageX;
if (this.pandata.id !== id) {
if (this.pandata.id !== undefined) {
$('#li-' + this.pandata.id).css('transform', 'translateX(0px)');
$('#del-' + this.pandata.id).addClass('hide');
}
this.pandata.objX = 0;
this.pandata.id = id;
}
},
panmove: function(id) {
event.preventDefault();
if (this.editmodel) {
return false;
}
let li = $('#li-' + id);
let width = $('#del-' + id).width();
let moveX = event.targetTouches[0].pageX;
let X = moveX - this.pageX;
if (this.pandata.objX == 0) {
if (X >= 0) {
this.currentX = 0;
} else {
this.currentX = -Math.min(Math.abs(X), width);
}
li.css('transform', "translateX(" + this.currentX + "px)");
} else if (this.pandata.objX < 0) {
if (X >= 0) {
this.currentX = Math.min(Math.abs(X) - width, 0);
} else {
this.currentX = -width;
}
li.css('transform', "translateX(" + this.currentX + "px)");
}
},
panend: function(id) {
event.preventDefault();
if (this.editmodel) {
return false;
}
let li = $('#li-' + id);
let delBtn = $('#del-' + id);
let width = delBtn.width();
if (this.currentX > -(width / 2)) {
this.pandata.objX = 0;
delBtn.addClass('hide');
} else {
this.pandata.objX = -width;
}
li.css('transform',"translateX(" + this.pandata.objX + "px)");
}
},
created: function() {
let _this = this;
yoho.addNativeMethod('editModel', function(action) {
_this.hideDelBth();
_this.editmodel = action;
if (!action) {
_this.hideDelBth();
}
});
}
};
... ... @@ -143,10 +217,11 @@
.fav-product-list {
padding-left: 20px;
list-style: none;
overflow: hidden;
li {
position: relative;
height: 205px;
overflow: hidden;
}
.fav-del-left {
... ...
<template>
<div class="brand-share">
<img class="brand-top-box" v-bind:src="shopInfo.brandBg | resize 750 478">
<div class="brand-title">{{ shopInfo.brandName }}</div>
<div class="brand-intro">{{ shopInfo.brandIntro }}</div>
<img class="brand-top-box" v-bind:src="shopInfo.shopBg | resize 750 478">
<div class="brand-title">{{ shopInfo.shopName }}</div>
<div class="brand-intro">{{ shopInfo.shopIntro }}</div>
<div class="tip">进入 BLK 选购潮品</div>
<div class="icon arrow">&#xe602;</div>
<a href="//m.yohoblk.com"><img v-bind:src="shopInfo.brandBg | resize 752 365"></a>
<a href="//m.yohoblk.com"><img v-bind:src="shopInfo.shopBg | resize 752 365"></a>
</div>
<share-bottom></share-bottom>
</template>
... ... @@ -64,10 +64,10 @@
watch: {
shopInfo() {
share({
title: this.shopInfo.brandName,
title: this.shopInfo.shopName,
link: location.href,
desc: this.shopInfo.shareSubTitle,
imgUrl: this.shopInfo.brandBg
imgUrl: this.shopInfo.shopBg
});
}
},
... ...
... ... @@ -74,11 +74,13 @@
this.shopInfo = result;
this.shopInfo.showBrandInfo = true;
this.shareData = {
title: result.brandName,
title: result.shopName,
des: shareSubTitle,
url: '/product/shop/share?domain=' + this.domain,
img: result.brandBg,
url: '/product/shop/share?domain=' + locationQuery.domain,
img: result.shopBg,
isBlkShop: result.isBlkShop,
domain: locationQuery.domain,
brandName: result.brandName,
shopId: result.shopId, // 不是分享的参数,收藏店铺使用
isFav: result.isFav // 不是分享的参数,收藏店铺使用
};
... ... @@ -104,8 +106,7 @@
$.post(this.url, Object.assign({
order: this.sort,
page: this.page
}, this.filter, locationQuery))
.done(result => {
}, this.filter, locationQuery)).done(result => {
this.productList = result.data.productList;
this.filterConfig = result.data.filter;
}).fail(error => {
... ...
<template>
<div v-if="shopInfo.isBlkShop" class="brand-top-box" v-lazy:background-image="shopInfo.brandBg | resize 750 478">
<div v-if="shopInfo.isBlkShop" class="brand-top-box" v-lazy:background-image="shopInfo.shopBg | resize 750 478">
<div class="brand-bottom">
<img v-if="shopInfo.brandLogo" v-lazy="shopInfo.brandLogo | resize 80 80" alt="{{ shopInfo.brandName }}">
<div v-else class="brand-title">{{ shopInfo.brandName }}</div>
<img v-if="shopInfo.brandLogo" v-lazy="shopInfo.brandLogo | resize 80 80" alt="{{ shopInfo.shopName }}">
<div v-else class="brand-title">{{ shopInfo.shopName }}</div>
<hr>
<div v-show="showMore" transition="brand-intro" v-bind:class="{ 'brand-short': !showMore }">{{ shopInfo.brandIntro }}</div>
<div v-show="showMore" transition="brand-intro" v-bind:class="{ 'brand-short': !showMore }">{{ shopInfo.shopIntro }}</div>
</div>
<div v-if="!showMore" class="showmore expand" @click="introTrans()"><span class="icon">&#xe602;</span></div>
<div v-else class="showmore collapse" @click="introTrans()"><span class="icon">&#xe617;</span></div>
... ...
<template>
<div class="top-box clearfix" v-bind:class='{"top-box-left" : this.$parent.$refs.filter.isVisible,"top-change" : topChange || !this.shareData.isBlkShop}' v-infinite-scroll="changeTopStatus()">
<div class="top-box clearfix" v-bind:class='{"top-box-left" : this.$parent.$refs.filter.isVisible,"top-change" : topChange || !shareData.isBlkShop}' v-infinite-scroll="changeTopStatus()">
<span class="icon icon-back back" @click="goBack()"></span>
<span v-if="!shareData.isBlkShop">{{shareData.brandName}}</span>
<div class="right">
<span v-if="shareData.isBlkShop" v-show="shareData.isFav" class="icon" @click="collectShop()">&#xe60d;</span>
<span v-if="shareData.isBlkShop" v-show="!shareData.isFav" class="icon" @click="collectShop()">&#xe60c;</span>
... ... @@ -21,6 +22,7 @@
z-index: 99;
color: #fff;
font-size: 48px;
text-align: center;
.back {
width: 60px;
... ... @@ -58,7 +60,6 @@
<script>
const yoho = require('yoho');
const $ = require('yoho-jquery');
const tip = require('common/tip');
module.exports = {
data() {
... ... @@ -94,15 +95,12 @@
url: '/product/shop/collect.json',
data: data
}).done(result => {
tip(result.message);
if (result.code === 200) {
this.shareData.isFav = !this.shareData.isFav;
} else if (result.code === 403) {
yoho.goLogin();
yoho.goLogin('', this.collectShop);
}
}).fail(() => {
tip('网络错误');
});
}).fail(() => {});
},
showFilter() {
this.$parent.$refs.filter.isVisible = !this.$parent.$refs.filter.isVisible;
... ... @@ -116,6 +114,9 @@
this.topChange = false;
}
}
},
created() {
this.domain = this.shareData.domain;
}
};
</script>
... ...
/**
* 需要格式化的时间格式
*/
'use strict';
const helpers = global.yoho.helpers;
const timeFormat = {
y: '剩{y}年{M}月{d}天',
M: '剩{M}月{d}天',
d: '剩{d}天',
h: '剩{h}小时',
m: '剩{m}分钟',
s: '剩{s}秒',
dh: '剩{d}天{h}小时',
dhms: '剩{d}天{h}小时{m}分钟{s}秒',
hms: '剩{h}小时{m}分钟{s}秒',
ms: '剩{m}分钟{s}秒'
};
const anHour = 3600;
const aDay = anHour * 24;
const aMonth = aDay * 30;
const aYear = aMonth * 12;
/**
* 折扣专场专题列表过期时间处理 单位:s
* @param {[string]} time
* @return {[object]}
*/
const processTime = (time) => {
let data = {};
let type = '';
if (time < anHour) {
data.warnColor = true;
data.time = '低于1小时';
} else {
if (time > aYear) {
type = 'y';
} else if (time > aMonth) {
type = 'M';
} else if (time > aDay) {
type = 'dh';
} else {
type = 'h';
}
data.time = helpers.dateDiffFormat(timeFormat[type], time, 's');
}
return data;
};
module.exports = processTime;