Authored by Aiden Xu

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

@@ -15,7 +15,7 @@ let channel = { @@ -15,7 +15,7 @@ let channel = {
15 cache: true, 15 cache: true,
16 code: 200 16 code: 200
17 }).then(result => { 17 }).then(result => {
18 - return processResources(result.data); 18 + return result.data ? processResources(result.data) : [];
19 }); 19 });
20 }, 20 },
21 getSidebarData() { 21 getSidebarData() {
@@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
5 */ 5 */
6 'use strict'; 6 'use strict';
7 const homeModel = require('../models/index'); 7 const homeModel = require('../models/index');
8 -const _ = require('lodash');  
9 const helpers = global.yoho.helpers; 8 const helpers = global.yoho.helpers;
10 9
11 /** 10 /**
@@ -29,12 +28,10 @@ const component = { @@ -29,12 +28,10 @@ const component = {
29 page: 'index', 28 page: 'index',
30 noLocalCSS: true, 29 noLocalCSS: true,
31 head_ico: proData && proData.head_ico ? helpers.image(proData.head_ico, 200, 200) : '', 30 head_ico: proData && proData.head_ico ? helpers.image(proData.head_ico, 200, 200) : '',
32 - nickname: proData ? proData.nickname : '登录/注册',  
33 - userinfourl: proData ? '/home/mydetails' : '',  
34 - serviceUrl: '/home/service' 31 + nickname: proData ? proData.nickname : '登录/注册'
35 }; 32 };
36 33
37 - res.render('index', _.merge(result, data[1])); 34 + res.render('index', Object.assign(result, data[1]));
38 }).catch(next); 35 }).catch(next);
39 }, 36 },
40 mydetails: (req, res, next) => { 37 mydetails: (req, res, next) => {
@@ -82,7 +79,7 @@ const component = { @@ -82,7 +79,7 @@ const component = {
82 }).catch(next); 79 }).catch(next);
83 }, 80 },
84 service: (req, res, next) => { 81 service: (req, res, next) => {
85 - res.redirect('http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409') 82 + res.redirect('http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=703953&configID=149819&jid=1099911094')
86 }, 83 },
87 help: (req, res, next) => { 84 help: (req, res, next) => {
88 homeModel.getHelpInfo().then(helpList => { 85 homeModel.getHelpInfo().then(helpList => {
@@ -121,22 +118,12 @@ const component = { @@ -121,22 +118,12 @@ const component = {
121 }, 118 },
122 saveFeedback: (req, res, next) => { 119 saveFeedback: (req, res, next) => {
123 let saveFeedbackPara = { 120 let saveFeedbackPara = {
  121 + uid: req.user.uid,
  122 + udid: req.user.udid, // todo
124 content: req.body.content, 123 content: req.body.content,
125 suggest_type: 2 124 suggest_type: 2
126 }; 125 };
127 126
128 - if (req.user && req.user.uid) {  
129 - _.merge(saveFeedbackPara, {  
130 - uid: req.user.uid  
131 - });  
132 - }  
133 -  
134 - if (req.user && req.user.udid && !req.user.uid) {  
135 - _.merge(saveFeedbackPara, {  
136 - udid: req.user.udid  
137 - });  
138 - }  
139 -  
140 homeModel.saveFeedback(saveFeedbackPara).then(result => { 127 homeModel.saveFeedback(saveFeedbackPara).then(result => {
141 if (result.code === 200) { 128 if (result.code === 200) {
142 return res.json({ 129 return res.json({
@@ -16,6 +16,8 @@ exports.getFavProductData = (uid, page, limit) => { @@ -16,6 +16,8 @@ exports.getFavProductData = (uid, page, limit) => {
16 uid: uid, 16 uid: uid,
17 page: page, 17 page: page,
18 limit: limit 18 limit: limit
  19 + }, {
  20 + code: 200
19 }).then(result => { 21 }).then(result => {
20 var isend = true, 22 var isend = true,
21 list = [], 23 list = [],
@@ -77,6 +79,8 @@ exports.getFavBrandData = (uid, gender, page, limit) => { @@ -77,6 +79,8 @@ exports.getFavBrandData = (uid, gender, page, limit) => {
77 gender: gender, 79 gender: gender,
78 page: page, 80 page: page,
79 limit: limit 81 limit: limit
  82 + }, {
  83 + code: 200
80 }).then(result => { 84 }).then(result => {
81 var isend = true, 85 var isend = true,
82 list = [], 86 list = [],
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 const api = global.yoho.API; 2 const api = global.yoho.API;
3 const serviceAPI = global.yoho.ServiceAPI; 3 const serviceAPI = global.yoho.ServiceAPI;
4 const Promise = require('bluebird'); 4 const Promise = require('bluebird');
5 -const _ = require('lodash');  
6 const helpers = global.yoho.helpers; 5 const helpers = global.yoho.helpers;
7 6
8 /** 7 /**
@@ -15,6 +14,8 @@ const _getUserProfileData = exports.getUserProfileData = (uid) => { @@ -15,6 +14,8 @@ const _getUserProfileData = exports.getUserProfileData = (uid) => {
15 return api.get('', { 14 return api.get('', {
16 uid: uid, 15 uid: uid,
17 method: 'app.passport.profile' 16 method: 'app.passport.profile'
  17 + }, {
  18 + code: 200
18 }).then(result => { 19 }).then(result => {
19 return result.data; 20 return result.data;
20 }); 21 });
@@ -30,9 +31,13 @@ const _getInfoNumData = (uid) => { @@ -30,9 +31,13 @@ const _getInfoNumData = (uid) => {
30 return api.all([api.get('', { 31 return api.all([api.get('', {
31 uid: uid, 32 uid: uid,
32 method: 'app.home.getInfoNum' // 收藏及订单数目数据 33 method: 'app.home.getInfoNum' // 收藏及订单数目数据
  34 + }, {
  35 + code: 200
33 }), api.get('', { 36 }), api.get('', {
34 uid: uid, 37 uid: uid,
35 method: 'app.address.gethidden' // 用户地址的数据 38 method: 'app.address.gethidden' // 用户地址的数据
  39 + }, {
  40 + code: 200
36 })]).then(data => { 41 })]).then(data => {
37 let res = { 42 let res = {
38 wait_pay_num: '', 43 wait_pay_num: '',
@@ -44,7 +49,6 @@ const _getInfoNumData = (uid) => { @@ -44,7 +49,6 @@ const _getInfoNumData = (uid) => {
44 yoho_coin_num: '' 49 yoho_coin_num: ''
45 }; 50 };
46 51
47 - if (data[0].data) {  
48 for (let k in data[0].data) { 52 for (let k in data[0].data) {
49 if (res[k] !== null) { 53 if (res[k] !== null) {
50 res[k] = data[0].data[k] ? data[0].data[k] : ''; 54 res[k] = data[0].data[k] ? data[0].data[k] : '';
@@ -53,13 +57,10 @@ const _getInfoNumData = (uid) => { @@ -53,13 +57,10 @@ const _getInfoNumData = (uid) => {
53 } 57 }
54 } 58 }
55 } 59 }
56 - }  
57 - if (data[1].data) {  
58 - res = _.merge(res, { 60 +
  61 + return Object.assign(res, {
59 address_num: data[1].data.length ? data[1].data.length : '' 62 address_num: data[1].data.length ? data[1].data.length : ''
60 }); 63 });
61 - }  
62 - return res;  
63 }); 64 });
64 }; 65 };
65 66
@@ -86,12 +87,14 @@ exports.getHelpInfo = (data) => { @@ -86,12 +87,14 @@ exports.getHelpInfo = (data) => {
86 }, 87 },
87 infoData = Object.assign(defaultParam, data); 88 infoData = Object.assign(defaultParam, data);
88 89
89 - return api.get('', infoData).then(result => { 90 + return api.get('', infoData, {
  91 + code: 200
  92 + }).then(result => {
90 var helpData = result.data; 93 var helpData = result.data;
91 var formatData = []; 94 var formatData = [];
92 95
93 helpData = helpData || []; 96 helpData = helpData || [];
94 - _.forEach(helpData, (item) => { 97 + helpData.forEach(function(item) {
95 formatData.push({ 98 formatData.push({
96 name: item.caption, 99 name: item.caption,
97 code: item.code, 100 code: item.code,
@@ -117,9 +120,9 @@ exports.getHelpDetail = (data) => { @@ -117,9 +120,9 @@ exports.getHelpDetail = (data) => {
117 }, 120 },
118 detailData = Object.assign(defaultParam, data); 121 detailData = Object.assign(defaultParam, data);
119 122
120 - return api.get('', detailData).then(result => {  
121 - return result;  
122 - }); 123 + return api.get('', detailData, {
  124 + code: 200
  125 + }).then(result => result);
123 }; 126 };
124 127
125 /** 128 /**
@@ -149,7 +152,5 @@ exports.saveMydetails = (params) => { @@ -149,7 +152,5 @@ exports.saveMydetails = (params) => {
149 }, 152 },
150 data = Object.assign(defaultParam, params); 153 data = Object.assign(defaultParam, params);
151 154
152 - return api.get('', data).then(result => {  
153 - return result;  
154 - }); 155 + return api.get('', data).then(result => result);
155 }; 156 };
@@ -28,6 +28,8 @@ const refund = { @@ -28,6 +28,8 @@ const refund = {
28 getExpressCompany() { 28 getExpressCompany() {
29 return api.get('', { 29 return api.get('', {
30 method: 'app.express.getExpressCompany' 30 method: 'app.express.getExpressCompany'
  31 + }, {
  32 + code: 200
31 }); 33 });
32 }, 34 },
33 35
@@ -42,7 +44,9 @@ const refund = { @@ -42,7 +44,9 @@ const refund = {
42 * @returns {Promise.<T>|*} 44 * @returns {Promise.<T>|*}
43 */ 45 */
44 getRefundOrders(param) { 46 getRefundOrders(param) {
45 - param = Object.assign({method: 'app.refund.getList'}, param); 47 + param = Object.assign({
  48 + method: 'app.refund.getList'
  49 + }, param);
46 50
47 return api.get('', param, { 51 return api.get('', param, {
48 cache: true, 52 cache: true,
1 <div class="my-page"> 1 <div class="my-page">
2 <div class="my-header"> 2 <div class="my-header">
3 <span class="setting icon icon-setting" id="setting"></span> 3 <span class="setting icon icon-setting" id="setting"></span>
4 - <a class="user-info" id="user-info" {{#if userinfourl}} href='{{userinfourl}}' {{/if}}> 4 + <a class="user-info no-intercept" id="user-info" href='/home/mydetails'>
5 <span class="user-avatar" {{#if head_ico}} style="background-image: url('{{head_ico}}');" {{/if}}></span> 5 <span class="user-avatar" {{#if head_ico}} style="background-image: url('{{head_ico}}');" {{/if}}></span>
6 <br><span class="username">{{nickname}}</span> 6 <br><span class="username">{{nickname}}</span>
7 </a> 7 </a>
8 </div> 8 </div>
9 <div class="my-order"> 9 <div class="my-order">
10 - <a class="order-title" href="/home/orders?type=1"> 10 + <a class="order-title no-intercept" href="/home/orders?type=1">
11 我的订单 11 我的订单
12 <span class="read-order"> 12 <span class="read-order">
13 查看全部订单 <span class="icon icon-right"></span> 13 查看全部订单 <span class="icon icon-right"></span>
14 </span> 14 </span>
15 </a> 15 </a>
16 <div class="order-type clearfix"> 16 <div class="order-type clearfix">
17 - <a class="type-item" href="/home/orders?type=2"> 17 + <a class="type-item no-intercept" href="/home/orders?type=2">
18 <span class="icon icon-wait-pay"></span> 18 <span class="icon icon-wait-pay"></span>
19 <br>待付款 19 <br>待付款
20 {{#if wait_pay_num}} 20 {{#if wait_pay_num}}
21 <span class="num">{{wait_pay_num}}</span> 21 <span class="num">{{wait_pay_num}}</span>
22 {{/if}} 22 {{/if}}
23 </a> 23 </a>
24 - <a class="type-item" href="/home/orders?type=3"> 24 + <a class="type-item no-intercept" href="/home/orders?type=3">
25 <span class="icon icon-wait-cargo"></span> 25 <span class="icon icon-wait-cargo"></span>
26 <br>待发货 26 <br>待发货
27 {{#if wait_cargo_num}} 27 {{#if wait_cargo_num}}
28 <span class="num">{{wait_cargo_num}}</span> 28 <span class="num">{{wait_cargo_num}}</span>
29 {{/if}} 29 {{/if}}
30 </a> 30 </a>
31 - <a class="type-item" href="/home/orders?type=4"> 31 + <a class="type-item no-intercept" href="/home/orders?type=4">
32 <span class="icon icon-send-cargo"></span> 32 <span class="icon icon-send-cargo"></span>
33 <br>待收货 33 <br>待收货
34 {{#if send_cargo_num}} 34 {{#if send_cargo_num}}
35 <span class="num">{{send_cargo_num}}</span> 35 <span class="num">{{send_cargo_num}}</span>
36 {{/if}} 36 {{/if}}
37 </a> 37 </a>
38 - <a class="type-item" href="/home/refund/orders"> 38 + <a class="type-item no-intercept" href="/home/refund/orders">
39 <span class="icon icon-refund-exchange"></span> 39 <span class="icon icon-refund-exchange"></span>
40 <br>退换货 40 <br>退换货
41 {{#if refund_exchange_num}} 41 {{#if refund_exchange_num}}
@@ -45,33 +45,33 @@ @@ -45,33 +45,33 @@
45 </div> 45 </div>
46 </div> 46 </div>
47 <div class="group-list"> 47 <div class="group-list">
48 - <a class="list-item" id="address"> 48 + <a class="list-item no-intercept" id="address">
49 地址管理 49 地址管理
50 <span class="num">{{address_num}} <span class="icon icon-right"></span></span> 50 <span class="num">{{address_num}} <span class="icon icon-right"></span></span>
51 </a> 51 </a>
52 </div> 52 </div>
53 <div class="group-list"> 53 <div class="group-list">
54 - <a class="list-item" href="/home/favorite"> 54 + <a class="list-item no-intercept" href="/home/favorite">
55 收藏的商品 55 收藏的商品
56 <span class="num">{{product_favorite_total}} <span class="icon icon-right"></span></span> 56 <span class="num">{{product_favorite_total}} <span class="icon icon-right"></span></span>
57 </a> 57 </a>
58 - <a class="list-item" href="/home/favorite?tab=brand"> 58 + <a class="list-item no-intercept" href="/home/favorite?tab=brand">
59 收藏的品牌 59 收藏的品牌
60 <span class="num">{{brand_favorite_total}} <span class="icon icon-right"></span></span> 60 <span class="num">{{brand_favorite_total}} <span class="icon icon-right"></span></span>
61 </a> 61 </a>
62 </div> 62 </div>
63 <div class="group-list"> 63 <div class="group-list">
64 - <a class="list-item" href="/home/mycurrency"> 64 + <a class="list-item no-intercept" href="/home/mycurrency">
65 YOHO 币 65 YOHO 币
66 <span class="num">{{yoho_coin_num}} <span class="icon icon-right"></span></span> 66 <span class="num">{{yoho_coin_num}} <span class="icon icon-right"></span></span>
67 </a> 67 </a>
68 </div> 68 </div>
69 <div class="group-list"> 69 <div class="group-list">
70 - <a class="list-item" href="/home/help"> 70 + <a class="list-item no-intercept" href="/home/help">
71 帮助中心 71 帮助中心
72 <span class="num"><span class="icon icon-right"></span></span> 72 <span class="num"><span class="icon icon-right"></span></span>
73 </a> 73 </a>
74 - <a class="list-item" href="{{serviceUrl}}"> 74 + <a class="list-item no-intercept" href="/home/service">
75 在线客服 75 在线客服
76 <span class="num"><span class="icon icon-right"></span></span> 76 <span class="num"><span class="icon icon-right"></span></span>
77 </a> 77 </a>
@@ -27,6 +27,11 @@ const getShopData = params => { @@ -27,6 +27,11 @@ const getShopData = params => {
27 27
28 if (result[0].code === 200) { 28 if (result[0].code === 200) {
29 29
  30 + /* 品牌名称 */
  31 + Object.assign(finalResult, {
  32 + brandName: result[0].data.brand_name
  33 + });
  34 +
30 /* 品牌是否有店铺 */ 35 /* 品牌是否有店铺 */
31 if (result[0].data.shop_id) { 36 if (result[0].data.shop_id) {
32 37
@@ -48,9 +53,9 @@ const getShopData = params => { @@ -48,9 +53,9 @@ const getShopData = params => {
48 53
49 /* 取店铺的基本信息 */ 54 /* 取店铺的基本信息 */
50 Object.assign(finalResult, { 55 Object.assign(finalResult, {
51 - brandLogo: subResult[0].data.shop_logo,  
52 - brandName: subResult[0].data.shop_name,  
53 - brandIntro: subResult[0].data.shop_intro, 56 + shopLogo: subResult[0].data.shop_logo,
  57 + shopName: subResult[0].data.shop_name,
  58 + shopIntro: subResult[0].data.shop_intro,
54 isFav: subResult[0].data.is_favorite === 'Y' 59 isFav: subResult[0].data.is_favorite === 'Y'
55 }); 60 });
56 61
@@ -2,6 +2,9 @@ const Vue = require('yoho-vue'); @@ -2,6 +2,9 @@ const Vue = require('yoho-vue');
2 const infiniteScroll = require('yoho-vue-infinite-scroll'); 2 const infiniteScroll = require('yoho-vue-infinite-scroll');
3 const favBrandList = require('home/fav-brand-list.vue'); 3 const favBrandList = require('home/fav-brand-list.vue');
4 4
  5 +const VueTouch = require('vue-touch');
  6 +Vue.use(VueTouch)
  7 +
5 Vue.use(infiniteScroll); 8 Vue.use(infiniteScroll);
6 9
7 new Vue({ 10 new Vue({
@@ -2,6 +2,9 @@ const Vue = require('yoho-vue'); @@ -2,6 +2,9 @@ const Vue = require('yoho-vue');
2 const infiniteScroll = require('yoho-vue-infinite-scroll'); 2 const infiniteScroll = require('yoho-vue-infinite-scroll');
3 const favProductList = require('home/fav-product-list.vue'); 3 const favProductList = require('home/fav-product-list.vue');
4 4
  5 +const VueTouch = require('vue-touch');
  6 +Vue.use(VueTouch)
  7 +
5 Vue.use(infiniteScroll); 8 Vue.use(infiniteScroll);
6 9
7 new Vue({ 10 new Vue({
@@ -2,31 +2,31 @@ var yoho = require('yoho'); @@ -2,31 +2,31 @@ var yoho = require('yoho');
2 var $ = require('yoho-jquery'); 2 var $ = require('yoho-jquery');
3 var interceptClick = require('common/intercept-click'); 3 var interceptClick = require('common/intercept-click');
4 4
5 -$('.my-page').on('click', 'a', function() {  
6 - // 拦截跳转  
7 - var href = $(this).attr('href');  
8 - if (href) {  
9 - interceptClick(href);  
10 - return false;  
11 - }  
12 -});  
13 -  
14 -// 跳转登录页  
15 -$('#user-info').on('click', function() {  
16 - var href = $(this).attr('href');  
17 - if (!href) {  
18 - yoho.goLogin();  
19 - }  
20 -});  
21 -  
22 // 地址管理 5 // 地址管理
23 $('#address').on('click', function() { 6 $('#address').on('click', function() {
24 yoho.goAddress({ 7 yoho.goAddress({
25 'type': '2' 8 'type': '2'
26 }); 9 });
  10 + return false;
27 }); 11 });
28 12
29 // 系统设置 13 // 系统设置
30 $('#setting').on('click', function() { 14 $('#setting').on('click', function() {
31 yoho.goSetting(); 15 yoho.goSetting();
  16 + return false;
  17 +});
  18 +
  19 +$('.my-page').on('click', 'a', function() {
  20 + // 未登录时跳转至登录页
  21 + if (!yoho.isLogin) {
  22 + yoho.goLogin();
  23 + return false;
  24 + }
  25 +
  26 + // 拦截跳转
  27 + var href = $(this).attr('href');
  28 + if (href) {
  29 + interceptClick(href);
  30 + return false;
  31 + }
32 }); 32 });
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 * 8 *
9 * 希望能与 微信 JS-SDK 一样方便 9 * 希望能与 微信 JS-SDK 一样方便
10 */ 10 */
11 - 11 +const cookie = require('yoho-cookie');
12 const tip = require('common/tip'); 12 const tip = require('common/tip');
13 13
14 /* 空方法 */ 14 /* 空方法 */
@@ -24,6 +24,11 @@ const yoho = { @@ -24,6 +24,11 @@ const yoho = {
24 isApp: /yh_blk/i.test(navigator.userAgent || ''), 24 isApp: /yh_blk/i.test(navigator.userAgent || ''),
25 25
26 /** 26 /**
  27 + * 判断是否是 登录
  28 + */
  29 + isLogin: cookie.get('_YOHOUID'),
  30 +
  31 + /**
27 * JS 与 APP 共享的对象 32 * JS 与 APP 共享的对象
28 */ 33 */
29 data: window.yohoInterfaceData, 34 data: window.yohoInterfaceData,
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 12
13 .setting { 13 .setting {
14 float: left; 14 float: left;
15 - margin-top: 30px; 15 + margin-top: 40px;
16 margin-left: 15px; 16 margin-left: 15px;
17 font-size: 46px; 17 font-size: 46px;
18 } 18 }
1 <template> 1 <template>
2 <div class="search"> 2 <div class="search">
3 - <input v-if="showInput" type="text" name="">  
4 - <div v-else class="input" @click="changeToInput()"> 3 + <div v-else class="input" @click='yoho.goSearch()'>
5 <span class="icon icon-search"></span> Search 4 <span class="icon icon-search"></span> Search
6 </div> 5 </div>
7 </div> 6 </div>
@@ -26,24 +25,16 @@ @@ -26,24 +25,16 @@
26 padding: 5px 0; 25 padding: 5px 0;
27 } 26 }
28 27
29 - input {  
30 - width: 92%;  
31 - height: 55px;  
32 - padding: 10px;  
33 - }  
34 } 28 }
35 </style> 29 </style>
36 <script> 30 <script>
  31 + const yoho = require('yoho');
  32 +
37 module.exports = { 33 module.exports = {
38 data() { 34 data() {
39 return { 35 return {
40 - showInput: false 36 + yoho
41 }; 37 };
42 - },  
43 - methods: {  
44 - changeToInput() {  
45 - this.showInput = true;  
46 - }  
47 } 38 }
48 }; 39 };
49 </script> 40 </script>
1 <template> 1 <template>
2 - <div class="header {{class}}"> 2 + <div class="header" :class="class">
3 <div class="header-left"> 3 <div class="header-left">
4 <slot name="left"> 4 <slot name="left">
5 <i class="icon icon-left" @click="goBack"></i> 5 <i class="icon icon-left" @click="goBack"></i>
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 <button class="button" @click='yoho.goNewPage({"url":"http://m.yohoblk.com"})'>新页面</button> 10 <button class="button" @click='yoho.goNewPage({"url":"http://m.yohoblk.com"})'>新页面</button>
11 <button class="button" @click="yoho.goPay()">支付</button> 11 <button class="button" @click="yoho.goPay()">支付</button>
12 <button class="button" @click="yoho.goBack()">返回</button> 12 <button class="button" @click="yoho.goBack()">返回</button>
13 - <button class="button" @click='yoho.goShare({"title":"标题","des":"描述","img":"http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg","url":"http://m.yohoblk.com"})'>分享</button> 13 + <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>
14 <button class="button" @click='yoho.goSearch()'>搜索</button> 14 <button class="button" @click='yoho.goSearch()'>搜索</button>
15 <button class="button" @click='yoho.goSetting()'>设置</button> 15 <button class="button" @click='yoho.goSetting()'>设置</button>
16 <button class="button" @click='yoho.goSetAvatar()'>设置头像</button> 16 <button class="button" @click='yoho.goSetAvatar()'>设置头像</button>
@@ -120,10 +120,21 @@ @@ -120,10 +120,21 @@
120 }, 120 },
121 methods: { 121 methods: {
122 changeAddress() { 122 changeAddress() {
  123 + const self = this;
  124 +
123 yoho.goAddress({ 125 yoho.goAddress({
124 type: '1' 126 type: '1'
125 }, (address) => { 127 }, (address) => {
126 - // Todo 128 + if(address) {
  129 + self.$set('address', {
  130 + addressId: address.address_id,
  131 + area: address.area,
  132 + zipCode: address.zip_code,
  133 + mobile: address.mobile,
  134 + address: address.address,
  135 + consigneeName: address.consignee_name
  136 + });
  137 + }
127 }, () => { 138 }, () => {
128 tip('更换地址失败~'); 139 tip('更换地址失败~');
129 }); 140 });
@@ -160,7 +171,7 @@ @@ -160,7 +171,7 @@
160 submitData() { 171 submitData() {
161 const data = { 172 const data = {
162 order_code: this.orderCode, 173 order_code: this.orderCode,
163 - address_id: this.address.address_id, 174 + address_id: this.address.addressId,
164 address: this.address.address, 175 address: this.address.address,
165 consigee_name: this.address.consignee, 176 consigee_name: this.address.consignee,
166 area_code: this.address.areaCode, 177 area_code: this.address.areaCode,
1 <template> 1 <template>
2 <div class="fav-type" v-infinite-scroll="loadMore()" infinite-scroll-disabled="busy" infinite-scroll-distance="10"> 2 <div class="fav-type" v-infinite-scroll="loadMore()" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
3 <ul class="fav-brand-list"> 3 <ul class="fav-brand-list">
4 - <li v-for="item in brandData" track-by="$index" id="li-{{$index}}">  
5 - <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn($index)"> 4 + <li v-for="item in brandData" track-by="fav_id" id="li-{{item.fav_id}}"
  5 + v-touch:panstart="panstart(item.fav_id)"
  6 + v-touch:panmove="panmove(item.fav_id)"
  7 + v-touch:panend="panend(item.fav_id)">
  8 + <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)">
6 <span class="fav-del-span"><span class="icon icon-edit-del"></span></span> 9 <span class="fav-del-span"><span class="icon icon-edit-del"></span></span>
7 </div> 10 </div>
8 <a :href="item.link"> 11 <a :href="item.link">
@@ -11,10 +14,12 @@ @@ -11,10 +14,12 @@
11 </div> 14 </div>
12 <div class="fav-info-list"> 15 <div class="fav-info-list">
13 <span class="title">{{item.brandName}}</span> 16 <span class="title">{{item.brandName}}</span>
14 - <span class="down" v-if="item.down">品牌已下架</span> 17 + <span class="down">
  18 + <span v-if="item.down">品牌已下架</span>
  19 + </span>
15 </div> 20 </div>
16 </a> 21 </a>
17 - <div class="fav-del-right hide" id="del-{{$index}}" @click="delItem($index, item.fav_id)"> 22 + <div class="fav-del-right hide" id="del-{{item.fav_id}}" @click="delItem($index, item.fav_id)">
18 <span class="icon icon-delete"></span> 23 <span class="icon icon-delete"></span>
19 <br/> 24 <br/>
20 <span class="fav-del-txt">删除</span> 25 <span class="fav-del-txt">删除</span>
@@ -42,7 +47,11 @@ @@ -42,7 +47,11 @@
42 busy: false, 47 busy: false,
43 editmodel: false, 48 editmodel: false,
44 page: 0, 49 page: 0,
45 - brandData: [] 50 + pageX: 0,
  51 + currentX: 0,
  52 + pandata: {},
  53 + brandData: [],
  54 + keys: {}
46 }; 55 };
47 }, 56 },
48 methods: { 57 methods: {
@@ -65,7 +74,10 @@ @@ -65,7 +74,10 @@
65 74
66 if (result.list.length) { 75 if (result.list.length) {
67 result.list.forEach(function(o) { 76 result.list.forEach(function(o) {
  77 + if (!_this.keys[o.fav_id]) {
  78 + _this.keys[o.fav_id] = true;
68 _this.brandData.push(o); 79 _this.brandData.push(o);
  80 + }
69 }); 81 });
70 } 82 }
71 83
@@ -74,19 +86,20 @@ @@ -74,19 +86,20 @@
74 tip('网络错误'); 86 tip('网络错误');
75 }); 87 });
76 }, 88 },
77 - showDelBtn(index) { 89 + showDelBtn(id) {
78 this.hideDelBth(); 90 this.hideDelBth();
79 - let delBtn = $('#del-' + index); 91 + let delBtn = $('#del-' + id);
80 let width = delBtn.width(); 92 let width = delBtn.width();
81 93
82 - $('#li-' + index).css('transform', 'translateX(-' + width + 'px)'); 94 + $('#li-' + id).css('transform', 'translateX(-' + width + 'px)');
83 delBtn.removeClass('hide'); 95 delBtn.removeClass('hide');
84 }, 96 },
85 hideDelBth() { 97 hideDelBth() {
86 - this.brandData.forEach(function(d, index) {  
87 - $('#li-' + index).css('transform', 'translateX(0px)');  
88 - $('#del-' + index).addClass('hide'); 98 + this.brandData.forEach(function(d) {
  99 + $('#li-' + d.fav_id).css('transform', 'translateX(0px)');
  100 + $('#del-' + d.fav_id).addClass('hide');
89 }); 101 });
  102 + this.pandata = {};
90 }, 103 },
91 delItem(index, id) { 104 delItem(index, id) {
92 let _this = this; 105 let _this = this;
@@ -102,6 +115,7 @@ @@ -102,6 +115,7 @@
102 if (data.code === 200) { 115 if (data.code === 200) {
103 _this.brandData.splice(index, 1); 116 _this.brandData.splice(index, 1);
104 _this.hideDelBth(); 117 _this.hideDelBth();
  118 + delete _this.keys[id];
105 } else if (data.code === 400) { 119 } else if (data.code === 400) {
106 tip(data.message); 120 tip(data.message);
107 } else { 121 } else {
@@ -110,16 +124,77 @@ @@ -110,16 +124,77 @@
110 }).fail(function() { 124 }).fail(function() {
111 tip('网络错误'); 125 tip('网络错误');
112 }); 126 });
  127 + },
  128 + panstart: function(id) {
  129 + event.preventDefault();
  130 + if (this.editmodel) {
  131 + return false;
  132 + }
  133 +
  134 + $('#del-' + id).removeClass('hide');
  135 + this.pageX = event.targetTouches[0].pageX;
  136 + if (this.pandata.id !== id) {
  137 + if (this.pandata.id !== undefined) {
  138 + $('#li-' + this.pandata.id).css('transform', 'translateX(0px)');
  139 + $('#del-' + this.pandata.id).addClass('hide');
  140 + }
  141 +
  142 + this.pandata.objX = 0;
  143 + this.pandata.id = id;
  144 + }
  145 + },
  146 + panmove: function(id) {
  147 + event.preventDefault();
  148 + if (this.editmodel) {
  149 + return false;
  150 + }
  151 +
  152 + let li = $('#li-' + id);
  153 + let width = $('#del-' + id).width();
  154 + let moveX = event.targetTouches[0].pageX;
  155 + let X = moveX - this.pageX;
  156 +
  157 + if (this.pandata.objX == 0) {
  158 + if (X >= 0) {
  159 + this.currentX = 0;
  160 + } else {
  161 + this.currentX = -Math.min(Math.abs(X), width);
  162 + }
  163 + li.css('transform', "translateX(" + this.currentX + "px)");
  164 + } else if (this.pandata.objX < 0) {
  165 + if (X >= 0) {
  166 + this.currentX = Math.min(Math.abs(X) - width, 0);
  167 + } else {
  168 + this.currentX = -width;
  169 + }
  170 + li.css('transform', "translateX(" + this.currentX + "px)");
  171 + }
  172 + },
  173 + panend: function(id) {
  174 + event.preventDefault();
  175 + if (this.editmodel) {
  176 + return false;
  177 + }
  178 +
  179 + let li = $('#li-' + id);
  180 + let delBtn = $('#del-' + id);
  181 + let width = delBtn.width();
  182 +
  183 + if (this.currentX > -(width / 2)) {
  184 + this.pandata.objX = 0;
  185 + delBtn.addClass('hide');
  186 + } else {
  187 + this.pandata.objX = -width;
  188 + }
  189 + li.css('transform',"translateX(" + this.pandata.objX + "px)");
113 } 190 }
114 }, 191 },
115 created: function() { 192 created: function() {
116 let _this = this; 193 let _this = this;
117 194
118 yoho.addNativeMethod('editModel', function(action) { 195 yoho.addNativeMethod('editModel', function(action) {
119 - _this.editmodel = action;  
120 - if (!action) {  
121 _this.hideDelBth(); 196 _this.hideDelBth();
122 - } 197 + _this.editmodel = action;
123 }); 198 });
124 } 199 }
125 }; 200 };
@@ -138,10 +213,11 @@ @@ -138,10 +213,11 @@
138 .fav-brand-list { 213 .fav-brand-list {
139 padding-left: 20px; 214 padding-left: 20px;
140 list-style: none; 215 list-style: none;
  216 + overflow: hidden;
141 217
142 li { 218 li {
  219 + position: relative;
143 height: 135px; 220 height: 135px;
144 - overflow: hidden;  
145 border-bottom: 1px solid #e0e0e0; 221 border-bottom: 1px solid #e0e0e0;
146 } 222 }
147 223
@@ -214,23 +290,24 @@ @@ -214,23 +290,24 @@
214 font-size: 24px; 290 font-size: 24px;
215 padding-bottom: 10px; 291 padding-bottom: 10px;
216 margin-right: 10px; 292 margin-right: 10px;
217 - margin-top: 35px;  
218 - height: 100px; 293 + height: 100%;
219 overflow: hidden; 294 overflow: hidden;
220 position: relative; 295 position: relative;
221 296
222 .title { 297 .title {
223 - width: 430px;  
224 color: #b0b0b0; 298 color: #b0b0b0;
225 text-overflow: ellipsis; 299 text-overflow: ellipsis;
226 font-size: 34px; 300 font-size: 34px;
227 margin: 0; 301 margin: 0;
228 - } 302 + line-height: 130px;
229 } 303 }
230 304
231 - span {  
232 - &.down { 305 + .down {
  306 + height: 100%;
  307 + line-height: 130px;
233 float: right; 308 float: right;
  309 +
  310 + span {
234 padding: 5px 18px; 311 padding: 5px 18px;
235 color: #fffefe; 312 color: #fffefe;
236 background: #b0b0b0; 313 background: #b0b0b0;
@@ -239,6 +316,7 @@ @@ -239,6 +316,7 @@
239 } 316 }
240 } 317 }
241 } 318 }
  319 + }
242 320
243 .fav-null { 321 .fav-null {
244 font-size: 22px; 322 font-size: 22px;
1 <template> 1 <template>
2 <div class="fav-type" v-infinite-scroll="loadMore()" infinite-scroll-disabled="busy" infinite-scroll-distance="10"> 2 <div class="fav-type" v-infinite-scroll="loadMore()" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
3 <ul class="fav-product-list"> 3 <ul class="fav-product-list">
4 - <li v-for="item in productData" track-by="$index" id="li-{{$index}}">  
5 - <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn($index)"> 4 + <li v-for="item in productData" track-by="fav_id" id="li-{{item.fav_id}}"
  5 + v-touch:panstart="panstart(item.fav_id)"
  6 + v-touch:panmove="panmove(item.fav_id)"
  7 + v-touch:panend="panend(item.fav_id)">
  8 + <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)">
6 <span class="fav-del-span"><span class="icon icon-edit-del"></span></span> 9 <span class="fav-del-span"><span class="icon icon-edit-del"></span></span>
7 </div> 10 </div>
8 <a :href="item.link"> 11 <a :href="item.link">
@@ -22,7 +25,7 @@ @@ -22,7 +25,7 @@
22 </div> 25 </div>
23 </div> 26 </div>
24 </a> 27 </a>
25 - <div class="fav-del-right hide" id="del-{{$index}}" @click="delItem($index, item.fav_id)"> 28 + <div class="fav-del-right hide" id="del-{{item.fav_id}}" @click="delItem($index, item.fav_id)">
26 <span class="icon icon-delete"></span> 29 <span class="icon icon-delete"></span>
27 <br/> 30 <br/>
28 <span class="fav-del-txt">删除</span> 31 <span class="fav-del-txt">删除</span>
@@ -39,6 +42,7 @@ @@ -39,6 +42,7 @@
39 <script> 42 <script>
40 const $ = require('yoho-jquery'); 43 const $ = require('yoho-jquery');
41 const tip = require('common/tip'); 44 const tip = require('common/tip');
  45 + const yoho = require('yoho');
42 46
43 module.exports = { 47 module.exports = {
44 props: ['productUrl'], 48 props: ['productUrl'],
@@ -48,7 +52,11 @@ @@ -48,7 +52,11 @@
48 busy: false, 52 busy: false,
49 editmodel: false, 53 editmodel: false,
50 page: 0, 54 page: 0,
51 - productData: [] 55 + pageX: 0,
  56 + currentX: 0,
  57 + pandata: {},
  58 + productData: [],
  59 + keys: {}
52 }; 60 };
53 }, 61 },
54 methods: { 62 methods: {
@@ -70,7 +78,10 @@ @@ -70,7 +78,10 @@
70 78
71 if (result.list.length) { 79 if (result.list.length) {
72 result.list.forEach(function(o) { 80 result.list.forEach(function(o) {
  81 + if (!_this.keys[o.fav_id]) {
  82 + _this.keys[o.fav_id] = true;
73 _this.productData.push(o); 83 _this.productData.push(o);
  84 + }
74 }); 85 });
75 } 86 }
76 87
@@ -79,19 +90,20 @@ @@ -79,19 +90,20 @@
79 tip('网络错误'); 90 tip('网络错误');
80 }); 91 });
81 }, 92 },
82 - showDelBtn(index) { 93 + showDelBtn(id) {
83 this.hideDelBth(); 94 this.hideDelBth();
84 - let delBtn = $('#del-' + index); 95 + let delBtn = $('#del-' + id);
85 let width = delBtn.width(); 96 let width = delBtn.width();
86 97
87 - $('#li-' + index).css('transform', 'translateX(-' + width + 'px)');  
88 delBtn.removeClass('hide'); 98 delBtn.removeClass('hide');
  99 + $('#li-' + id).css('transform', 'translateX(-' + width + 'px)');
89 }, 100 },
90 hideDelBth() { 101 hideDelBth() {
91 - this.productData.forEach(function(d, index) {  
92 - $('#li-' + index).css('transform', 'translateX(0px)');  
93 - $('#del-' + index).addClass('hide'); 102 + this.productData.forEach(function(d) {
  103 + $('#li-' + d.fav_id).css('transform', 'translateX(0px)');
  104 + $('#del-' + d.fav_id).addClass('hide');
94 }); 105 });
  106 + this.pandata = {};
95 }, 107 },
96 delItem(index, id) { 108 delItem(index, id) {
97 let _this = this; 109 let _this = this;
@@ -107,6 +119,7 @@ @@ -107,6 +119,7 @@
107 if (data.code === 200) { 119 if (data.code === 200) {
108 _this.productData.splice(index, 1); 120 _this.productData.splice(index, 1);
109 _this.hideDelBth(); 121 _this.hideDelBth();
  122 + delete _this.keys[id];
110 } else if (data.code === 400) { 123 } else if (data.code === 400) {
111 tip(data.message); 124 tip(data.message);
112 } else { 125 } else {
@@ -115,16 +128,77 @@ @@ -115,16 +128,77 @@
115 }).fail(function() { 128 }).fail(function() {
116 tip('网络错误'); 129 tip('网络错误');
117 }); 130 });
  131 + },
  132 + panstart: function(id) {
  133 + event.preventDefault();
  134 + if (this.editmodel) {
  135 + return false;
  136 + }
  137 +
  138 + $('#del-' + id).removeClass('hide');
  139 + this.pageX = event.targetTouches[0].pageX;
  140 + if (this.pandata.id !== id) {
  141 + if (this.pandata.id !== undefined) {
  142 + $('#li-' + this.pandata.id).css('transform', 'translateX(0px)');
  143 + $('#del-' + this.pandata.id).addClass('hide');
  144 + }
  145 +
  146 + this.pandata.objX = 0;
  147 + this.pandata.id = id;
  148 + }
  149 + },
  150 + panmove: function(id) {
  151 + event.preventDefault();
  152 + if (this.editmodel) {
  153 + return false;
  154 + }
  155 +
  156 + let li = $('#li-' + id);
  157 + let width = $('#del-' + id).width();
  158 + let moveX = event.targetTouches[0].pageX;
  159 + let X = moveX - this.pageX;
  160 +
  161 + if (this.pandata.objX == 0) {
  162 + if (X >= 0) {
  163 + this.currentX = 0;
  164 + } else {
  165 + this.currentX = -Math.min(Math.abs(X), width);
  166 + }
  167 + li.css('transform', "translateX(" + this.currentX + "px)");
  168 + } else if (this.pandata.objX < 0) {
  169 + if (X >= 0) {
  170 + this.currentX = Math.min(Math.abs(X) - width, 0);
  171 + } else {
  172 + this.currentX = -width;
  173 + }
  174 + li.css('transform', "translateX(" + this.currentX + "px)");
  175 + }
  176 + },
  177 + panend: function(id) {
  178 + event.preventDefault();
  179 + if (this.editmodel) {
  180 + return false;
  181 + }
  182 +
  183 + let li = $('#li-' + id);
  184 + let delBtn = $('#del-' + id);
  185 + let width = delBtn.width();
  186 +
  187 + if (this.currentX > -(width / 2)) {
  188 + this.pandata.objX = 0;
  189 + delBtn.addClass('hide');
  190 + } else {
  191 + this.pandata.objX = -width;
  192 + }
  193 + li.css('transform',"translateX(" + this.pandata.objX + "px)");
118 } 194 }
119 }, 195 },
120 created: function() { 196 created: function() {
121 let _this = this; 197 let _this = this;
122 198
123 yoho.addNativeMethod('editModel', function(action) { 199 yoho.addNativeMethod('editModel', function(action) {
124 - _this.editmodel = action;  
125 - if (!action) {  
126 _this.hideDelBth(); 200 _this.hideDelBth();
127 - } 201 + _this.editmodel = action;
128 }); 202 });
129 } 203 }
130 }; 204 };
@@ -143,10 +217,11 @@ @@ -143,10 +217,11 @@
143 .fav-product-list { 217 .fav-product-list {
144 padding-left: 20px; 218 padding-left: 20px;
145 list-style: none; 219 list-style: none;
  220 + overflow: hidden;
146 221
147 li { 222 li {
  223 + position: relative;
148 height: 205px; 224 height: 205px;
149 - overflow: hidden;  
150 } 225 }
151 226
152 .fav-del-left { 227 .fav-del-left {
1 <template> 1 <template>
2 <div class="brand-share"> 2 <div class="brand-share">
3 - <img class="brand-top-box" v-bind:src="shopInfo.brandBg | resize 750 478">  
4 - <div class="brand-title">{{ shopInfo.brandName }}</div>  
5 - <div class="brand-intro">{{ shopInfo.brandIntro }}</div> 3 + <img class="brand-top-box" v-bind:src="shopInfo.shopBg | resize 750 478">
  4 + <div class="brand-title">{{ shopInfo.shopName }}</div>
  5 + <div class="brand-intro">{{ shopInfo.shopIntro }}</div>
6 <div class="tip">进入 BLK 选购潮品</div> 6 <div class="tip">进入 BLK 选购潮品</div>
7 <div class="icon arrow">&#xe602;</div> 7 <div class="icon arrow">&#xe602;</div>
8 - <a href="//m.yohoblk.com"><img v-bind:src="shopInfo.brandBg | resize 752 365"></a> 8 + <a href="//m.yohoblk.com"><img v-bind:src="shopInfo.shopBg | resize 752 365"></a>
9 </div> 9 </div>
10 <share-bottom></share-bottom> 10 <share-bottom></share-bottom>
11 </template> 11 </template>
@@ -64,10 +64,10 @@ @@ -64,10 +64,10 @@
64 watch: { 64 watch: {
65 shopInfo() { 65 shopInfo() {
66 share({ 66 share({
67 - title: this.shopInfo.brandName, 67 + title: this.shopInfo.shopName,
68 link: location.href, 68 link: location.href,
69 desc: this.shopInfo.shareSubTitle, 69 desc: this.shopInfo.shareSubTitle,
70 - imgUrl: this.shopInfo.brandBg 70 + imgUrl: this.shopInfo.shopBg
71 }); 71 });
72 } 72 }
73 }, 73 },
@@ -74,11 +74,13 @@ @@ -74,11 +74,13 @@
74 this.shopInfo = result; 74 this.shopInfo = result;
75 this.shopInfo.showBrandInfo = true; 75 this.shopInfo.showBrandInfo = true;
76 this.shareData = { 76 this.shareData = {
77 - title: result.brandName, 77 + title: result.shopName,
78 des: shareSubTitle, 78 des: shareSubTitle,
79 - url: '/product/shop/share?domain=' + this.domain,  
80 - img: result.brandBg, 79 + url: '/product/shop/share?domain=' + locationQuery.domain,
  80 + img: result.shopBg,
81 isBlkShop: result.isBlkShop, 81 isBlkShop: result.isBlkShop,
  82 + domain: locationQuery.domain,
  83 + brandName: result.brandName,
82 shopId: result.shopId, // 不是分享的参数,收藏店铺使用 84 shopId: result.shopId, // 不是分享的参数,收藏店铺使用
83 isFav: result.isFav // 不是分享的参数,收藏店铺使用 85 isFav: result.isFav // 不是分享的参数,收藏店铺使用
84 }; 86 };
@@ -104,8 +106,7 @@ @@ -104,8 +106,7 @@
104 $.post(this.url, Object.assign({ 106 $.post(this.url, Object.assign({
105 order: this.sort, 107 order: this.sort,
106 page: this.page 108 page: this.page
107 - }, this.filter, locationQuery))  
108 - .done(result => { 109 + }, this.filter, locationQuery)).done(result => {
109 this.productList = result.data.productList; 110 this.productList = result.data.productList;
110 this.filterConfig = result.data.filter; 111 this.filterConfig = result.data.filter;
111 }).fail(error => { 112 }).fail(error => {
1 <template> 1 <template>
2 - <div v-if="shopInfo.isBlkShop" class="brand-top-box" v-lazy:background-image="shopInfo.brandBg | resize 750 478"> 2 + <div v-if="shopInfo.isBlkShop" class="brand-top-box" v-lazy:background-image="shopInfo.shopBg | resize 750 478">
3 <div class="brand-bottom"> 3 <div class="brand-bottom">
4 - <img v-if="shopInfo.brandLogo" v-lazy="shopInfo.brandLogo | resize 80 80" alt="{{ shopInfo.brandName }}">  
5 - <div v-else class="brand-title">{{ shopInfo.brandName }}</div> 4 + <img v-if="shopInfo.brandLogo" v-lazy="shopInfo.brandLogo | resize 80 80" alt="{{ shopInfo.shopName }}">
  5 + <div v-else class="brand-title">{{ shopInfo.shopName }}</div>
6 <hr> 6 <hr>
7 - <div v-show="showMore" transition="brand-intro" v-bind:class="{ 'brand-short': !showMore }">{{ shopInfo.brandIntro }}</div> 7 + <div v-show="showMore" transition="brand-intro" v-bind:class="{ 'brand-short': !showMore }">{{ shopInfo.shopIntro }}</div>
8 </div> 8 </div>
9 <div v-if="!showMore" class="showmore expand" @click="introTrans()"><span class="icon">&#xe602;</span></div> 9 <div v-if="!showMore" class="showmore expand" @click="introTrans()"><span class="icon">&#xe602;</span></div>
10 <div v-else class="showmore collapse" @click="introTrans()"><span class="icon">&#xe617;</span></div> 10 <div v-else class="showmore collapse" @click="introTrans()"><span class="icon">&#xe617;</span></div>
1 <template> 1 <template>
2 - <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()"> 2 + <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()">
3 <span class="icon icon-back back" @click="goBack()"></span> 3 <span class="icon icon-back back" @click="goBack()"></span>
  4 + <span v-if="!shareData.isBlkShop">{{shareData.brandName}}</span>
4 <div class="right"> 5 <div class="right">
5 <span v-if="shareData.isBlkShop" v-show="shareData.isFav" class="icon" @click="collectShop()">&#xe60d;</span> 6 <span v-if="shareData.isBlkShop" v-show="shareData.isFav" class="icon" @click="collectShop()">&#xe60d;</span>
6 <span v-if="shareData.isBlkShop" v-show="!shareData.isFav" class="icon" @click="collectShop()">&#xe60c;</span> 7 <span v-if="shareData.isBlkShop" v-show="!shareData.isFav" class="icon" @click="collectShop()">&#xe60c;</span>
@@ -21,6 +22,7 @@ @@ -21,6 +22,7 @@
21 z-index: 99; 22 z-index: 99;
22 color: #fff; 23 color: #fff;
23 font-size: 48px; 24 font-size: 48px;
  25 + text-align: center;
24 26
25 .back { 27 .back {
26 width: 60px; 28 width: 60px;
@@ -58,7 +60,6 @@ @@ -58,7 +60,6 @@
58 <script> 60 <script>
59 const yoho = require('yoho'); 61 const yoho = require('yoho');
60 const $ = require('yoho-jquery'); 62 const $ = require('yoho-jquery');
61 - const tip = require('common/tip');  
62 63
63 module.exports = { 64 module.exports = {
64 data() { 65 data() {
@@ -94,15 +95,12 @@ @@ -94,15 +95,12 @@
94 url: '/product/shop/collect.json', 95 url: '/product/shop/collect.json',
95 data: data 96 data: data
96 }).done(result => { 97 }).done(result => {
97 - tip(result.message);  
98 if (result.code === 200) { 98 if (result.code === 200) {
99 this.shareData.isFav = !this.shareData.isFav; 99 this.shareData.isFav = !this.shareData.isFav;
100 } else if (result.code === 403) { 100 } else if (result.code === 403) {
101 - yoho.goLogin(); 101 + yoho.goLogin('', this.collectShop);
102 } 102 }
103 - }).fail(() => {  
104 - tip('网络错误');  
105 - }); 103 + }).fail(() => {});
106 }, 104 },
107 showFilter() { 105 showFilter() {
108 this.$parent.$refs.filter.isVisible = !this.$parent.$refs.filter.isVisible; 106 this.$parent.$refs.filter.isVisible = !this.$parent.$refs.filter.isVisible;
@@ -116,6 +114,9 @@ @@ -116,6 +114,9 @@
116 this.topChange = false; 114 this.topChange = false;
117 } 115 }
118 } 116 }
  117 + },
  118 + created() {
  119 + this.domain = this.shareData.domain;
119 } 120 }
120 }; 121 };
121 </script> 122 </script>
1 -/**  
2 - * 需要格式化的时间格式  
3 - */  
4 -  
5 -'use strict';  
6 -  
7 -const helpers = global.yoho.helpers;  
8 -  
9 -const timeFormat = {  
10 - y: '剩{y}年{M}月{d}天',  
11 - M: '剩{M}月{d}天',  
12 - d: '剩{d}天',  
13 - h: '剩{h}小时',  
14 - m: '剩{m}分钟',  
15 - s: '剩{s}秒',  
16 - dh: '剩{d}天{h}小时',  
17 - dhms: '剩{d}天{h}小时{m}分钟{s}秒',  
18 - hms: '剩{h}小时{m}分钟{s}秒',  
19 - ms: '剩{m}分钟{s}秒'  
20 -};  
21 -  
22 -const anHour = 3600;  
23 -const aDay = anHour * 24;  
24 -const aMonth = aDay * 30;  
25 -const aYear = aMonth * 12;  
26 -  
27 -/**  
28 - * 折扣专场专题列表过期时间处理 单位:s  
29 - * @param {[string]} time  
30 - * @return {[object]}  
31 - */  
32 -const processTime = (time) => {  
33 - let data = {};  
34 - let type = '';  
35 -  
36 - if (time < anHour) {  
37 - data.warnColor = true;  
38 - data.time = '低于1小时';  
39 - } else {  
40 - if (time > aYear) {  
41 - type = 'y';  
42 - } else if (time > aMonth) {  
43 - type = 'M';  
44 - } else if (time > aDay) {  
45 - type = 'dh';  
46 - } else {  
47 - type = 'h';  
48 - }  
49 -  
50 - data.time = helpers.dateDiffFormat(timeFormat[type], time, 's');  
51 - }  
52 -  
53 - return data;  
54 -};  
55 -  
56 -module.exports = processTime;