Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop
Showing
44 changed files
with
632 additions
and
314 deletions
@@ -31,7 +31,7 @@ yoho币 | /home/mycurrency | | @@ -31,7 +31,7 @@ yoho币 | /home/mycurrency | | ||
31 | 关于我们 | /home/about | | 31 | 关于我们 | /home/about | |
32 | 物流详情 | /home/logistic?order_code=1609827614 | | 32 | 物流详情 | /home/logistic?order_code=1609827614 | |
33 | 退换货物流详情| /home/logistic?order_code=1609827614&type=refund| | 33 | 退换货物流详情| /home/logistic?order_code=1609827614&type=refund| |
34 | - | 34 | +退换货列表 | /home/refund/orders | |
35 | -------------------------------------------------------------------------------- | 35 | -------------------------------------------------------------------------------- |
36 | 36 | ||
37 | ---- | 37 | ---- |
@@ -16,7 +16,7 @@ const exchange = { | @@ -16,7 +16,7 @@ const exchange = { | ||
16 | 16 | ||
17 | // 订单 可换货商品列表 | 17 | // 订单 可换货商品列表 |
18 | order(req, res, next) { | 18 | order(req, res, next) { |
19 | - const uid = req.user.uid || 8050882; | 19 | + const uid = 8041886; |
20 | const orderId = req.query.orderId; | 20 | const orderId = req.query.orderId; |
21 | 21 | ||
22 | if (!orderId) { | 22 | if (!orderId) { |
@@ -48,6 +48,21 @@ const exchange = { | @@ -48,6 +48,21 @@ const exchange = { | ||
48 | exchangeModel.submitExchange(uid, req.body).then(result => { | 48 | exchangeModel.submitExchange(uid, req.body).then(result => { |
49 | res.json(result); | 49 | res.json(result); |
50 | }).catch(next); | 50 | }).catch(next); |
51 | + }, | ||
52 | + | ||
53 | + /** | ||
54 | + * 取消换货申请 | ||
55 | + * @param req | ||
56 | + * @param res | ||
57 | + * @param next | ||
58 | + */ | ||
59 | + cancelApply(req, res, next) { | ||
60 | + let id = req.body.id; | ||
61 | + let uid = req.user.id; | ||
62 | + | ||
63 | + exchangeModel.cancelApply(uid, id).then(result => { | ||
64 | + return res.json(result); | ||
65 | + }).catch(next); | ||
51 | } | 66 | } |
52 | }; | 67 | }; |
53 | 68 |
@@ -4,21 +4,18 @@ | @@ -4,21 +4,18 @@ | ||
4 | */ | 4 | */ |
5 | 'use strict'; | 5 | 'use strict'; |
6 | const favModel = require('../models/favorite'); | 6 | const favModel = require('../models/favorite'); |
7 | -const helpers = global.yoho.helpers; | ||
8 | 7 | ||
9 | const fav = { | 8 | const fav = { |
10 | favorite: (req, res) => { | 9 | favorite: (req, res) => { |
11 | if (req.query.tab === 'brand') { | 10 | if (req.query.tab === 'brand') { |
12 | res.render('favorite-brand', { | 11 | res.render('favorite-brand', { |
13 | module: 'home', | 12 | module: 'home', |
14 | - page: 'favorite-brand', | ||
15 | - brandUrl: helpers.urlFormat('/product/new') | 13 | + page: 'favorite-brand' |
16 | }); | 14 | }); |
17 | } else { | 15 | } else { |
18 | res.render('favorite', { | 16 | res.render('favorite', { |
19 | module: 'home', | 17 | module: 'home', |
20 | - page: 'favorite', | ||
21 | - productUrl: helpers.urlFormat('/product/new') | 18 | + page: 'favorite' |
22 | }); | 19 | }); |
23 | } | 20 | } |
24 | }, | 21 | }, |
@@ -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) => { |
@@ -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({ |
@@ -90,6 +90,27 @@ const refund = { | @@ -90,6 +90,27 @@ const refund = { | ||
90 | refundModel.getRefundOrders(param).then(result => { | 90 | refundModel.getRefundOrders(param).then(result => { |
91 | return res.json(result); | 91 | return res.json(result); |
92 | }); | 92 | }); |
93 | + }, | ||
94 | + | ||
95 | + /** | ||
96 | + * 取消申请 | ||
97 | + * @param req | ||
98 | + * @param res | ||
99 | + */ | ||
100 | + cancelApply(req, res) { | ||
101 | + let uid = req.user.id; | ||
102 | + let id = req.body.id; | ||
103 | + | ||
104 | + uid = testUid; | ||
105 | + if (!uid && req.xhr) { | ||
106 | + return res.json({ | ||
107 | + code: notLoginCode, | ||
108 | + message: notLoginTip | ||
109 | + }); | ||
110 | + } | ||
111 | + refundModel.cancelRefundApply(uid, id).then(result => { | ||
112 | + return res.json(result); | ||
113 | + }); | ||
93 | } | 114 | } |
94 | }; | 115 | }; |
95 | 116 |
@@ -36,6 +36,19 @@ const exchange = { | @@ -36,6 +36,19 @@ const exchange = { | ||
36 | }, params); | 36 | }, params); |
37 | 37 | ||
38 | return api.post('', data).then(global.yoho.camelCase); | 38 | return api.post('', data).then(global.yoho.camelCase); |
39 | + }, | ||
40 | + | ||
41 | + /** | ||
42 | + * 取消换货申请 | ||
43 | + * @param uid | ||
44 | + * @param id | ||
45 | + */ | ||
46 | + cancelApply(uid, id) { | ||
47 | + return api.post('', { | ||
48 | + uid: uid, | ||
49 | + id: id, | ||
50 | + method: 'app.change.cancel' | ||
51 | + }).then(global.yoho.camelCase); | ||
39 | } | 52 | } |
40 | }; | 53 | }; |
41 | 54 |
@@ -16,48 +16,10 @@ exports.getFavProductData = (uid, page, limit) => { | @@ -16,48 +16,10 @@ 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, | ||
21 | - list = [], | ||
22 | - data = result.data; | ||
23 | - | ||
24 | - if (data && page <= data.page_total) { | ||
25 | - data.product_list.forEach(function(d) { | ||
26 | - if (!d.product_skn) { | ||
27 | - return; | ||
28 | - } | ||
29 | - | ||
30 | - let link = ''; | ||
31 | - let discountPrice = false; | ||
32 | - | ||
33 | - if (d.goodsId && d.cnAlphabet) { | ||
34 | - link = helpers.urlFormat(`/product/pro_${d.product_id}_${d.goodsId}/${d.cnAlphabet}.html`); | ||
35 | - } | ||
36 | - | ||
37 | - if (Number(d.market_price) - Number(d.sales_price) > 0) { | ||
38 | - discountPrice = '¥' + Number(Math.max(d.sales_price, 0)).toFixed(2); | ||
39 | - } | ||
40 | - | ||
41 | - list.push({ | ||
42 | - fav_id: d.product_id, | ||
43 | - link: link, | ||
44 | - imgUrl: d.image ? helpers.image(d.image) : '', | ||
45 | - title: d.product_name, | ||
46 | - price: '¥' + Number(Math.max(d.market_price, 0)).toFixed(2), | ||
47 | - discountPrice: discountPrice, | ||
48 | - sellOut: d.storage <= 0, | ||
49 | - invalidGoods: d.status === 0 | ||
50 | - }); | ||
51 | - }); | ||
52 | - | ||
53 | - if (page < data.page_total) { | ||
54 | - isend = false; | ||
55 | - } | ||
56 | - } | ||
57 | - return { | ||
58 | - isend: isend, | ||
59 | - list: list | ||
60 | - }; | 22 | + return result.data ? global.yoho.camelCase(result.data) : {}; |
61 | }); | 23 | }); |
62 | }; | 24 | }; |
63 | 25 | ||
@@ -77,31 +39,10 @@ exports.getFavBrandData = (uid, gender, page, limit) => { | @@ -77,31 +39,10 @@ exports.getFavBrandData = (uid, gender, page, limit) => { | ||
77 | gender: gender, | 39 | gender: gender, |
78 | page: page, | 40 | page: page, |
79 | limit: limit | 41 | limit: limit |
42 | + }, { | ||
43 | + code: 200 | ||
80 | }).then(result => { | 44 | }).then(result => { |
81 | - var isend = true, | ||
82 | - list = [], | ||
83 | - data = result.data; | ||
84 | - | ||
85 | - if (data && page <= data.page_total) { | ||
86 | - data.brand_list.forEach(function(d) { | ||
87 | - list.push({ | ||
88 | - fav_id: d.brand_id, | ||
89 | - link: '', // todo | ||
90 | - imgUrl: d.brand_ico ? helpers.image(d.brand_ico, 160, 125) : '', | ||
91 | - brandName: d.brand_name, | ||
92 | - down: d.status === 0 | ||
93 | - }); | ||
94 | - }); | ||
95 | - | ||
96 | - if (page < data.page_total) { | ||
97 | - isend = false; | ||
98 | - } | ||
99 | - } | ||
100 | - | ||
101 | - return { | ||
102 | - isend: isend, | ||
103 | - list: list | ||
104 | - }; | 45 | + return result.data ? global.yoho.camelCase(result.data) : {}; |
105 | }); | 46 | }); |
106 | }; | 47 | }; |
107 | 48 |
@@ -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,22 +49,18 @@ const _getInfoNumData = (uid) => { | @@ -44,22 +49,18 @@ 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) { | ||
49 | - if (res[k] !== null) { | ||
50 | - res[k] = data[0].data[k] ? data[0].data[k] : ''; | ||
51 | - if (k !== 'yoho_coin_num' && res[k] > 99) { | ||
52 | - res[k] = '99+'; | ||
53 | - } | 52 | + for (let k in data[0].data) { |
53 | + if (res[k] !== null) { | ||
54 | + res[k] = data[0].data[k] ? data[0].data[k] : ''; | ||
55 | + if (k !== 'yoho_coin_num' && res[k] > 99) { | ||
56 | + res[k] = '99+'; | ||
54 | } | 57 | } |
55 | } | 58 | } |
56 | } | 59 | } |
57 | - if (data[1].data) { | ||
58 | - res = _.merge(res, { | ||
59 | - address_num: data[1].data.length ? data[1].data.length : '' | ||
60 | - }); | ||
61 | - } | ||
62 | - return res; | 60 | + |
61 | + return Object.assign(res, { | ||
62 | + address_num: data[1].data && data[1].data.length ? data[1].data.length : '' | ||
63 | + }); | ||
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 | }; |
@@ -50,7 +50,7 @@ exports.getOrderDetail = (uid, orderCode) => { | @@ -50,7 +50,7 @@ exports.getOrderDetail = (uid, orderCode) => { | ||
50 | */ | 50 | */ |
51 | exports.cancelOrder = (orderCode, reasonId, reason) => { | 51 | exports.cancelOrder = (orderCode, reasonId, reason) => { |
52 | 52 | ||
53 | - return api.get('057f5f856dff8b58.json', { | 53 | + return api.post('', { |
54 | method: 'app.SpaceOrders.close', | 54 | method: 'app.SpaceOrders.close', |
55 | order_code: orderCode, | 55 | order_code: orderCode, |
56 | reason_id: reasonId, | 56 | reason_id: reasonId, |
@@ -67,7 +67,7 @@ exports.cancelOrder = (orderCode, reasonId, reason) => { | @@ -67,7 +67,7 @@ exports.cancelOrder = (orderCode, reasonId, reason) => { | ||
67 | */ | 67 | */ |
68 | exports.confirmOrder = (orderCode) => { | 68 | exports.confirmOrder = (orderCode) => { |
69 | 69 | ||
70 | - return api.get('', { | 70 | + return api.post('', { |
71 | method: 'app.SpaceOrders.confirm', | 71 | method: 'app.SpaceOrders.confirm', |
72 | order_code: orderCode | 72 | order_code: orderCode |
73 | }).then(result => { | 73 | }).then(result => { |
@@ -82,7 +82,7 @@ exports.confirmOrder = (orderCode) => { | @@ -82,7 +82,7 @@ exports.confirmOrder = (orderCode) => { | ||
82 | * @returns {Promise.<T>|*} | 82 | * @returns {Promise.<T>|*} |
83 | */ | 83 | */ |
84 | exports.deleteOrder = (orderCode, uid) => { | 84 | exports.deleteOrder = (orderCode, uid) => { |
85 | - return api.get('', { | 85 | + return api.post('', { |
86 | method: 'app.SpaceOrders.delOrderByCode', | 86 | method: 'app.SpaceOrders.delOrderByCode', |
87 | order_code: orderCode, | 87 | order_code: orderCode, |
88 | uid: uid | 88 | uid: uid |
@@ -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,12 +44,28 @@ const refund = { | @@ -42,12 +44,28 @@ 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, |
49 | code: 200 | 53 | code: 200 |
50 | }).then(global.yoho.camelCase); | 54 | }).then(global.yoho.camelCase); |
55 | + }, | ||
56 | + | ||
57 | + /** | ||
58 | + * 取消退货申请 | ||
59 | + * | ||
60 | + * @param uid 用户id | ||
61 | + * @param id 退货id | ||
62 | + */ | ||
63 | + cancelRefundApply(uid, id) { | ||
64 | + return api.post('', { | ||
65 | + uid: uid, | ||
66 | + id: id, | ||
67 | + method: 'app.refund.cancel' | ||
68 | + }).then(global.yoho.camelCase); | ||
51 | } | 69 | } |
52 | }; | 70 | }; |
53 | 71 |
@@ -46,6 +46,7 @@ router.get('/refund/order', refund.order); // 查询订单数据 | @@ -46,6 +46,7 @@ router.get('/refund/order', refund.order); // 查询订单数据 | ||
46 | router.post('/refund/submit', refund.submit); // 提交信息 | 46 | router.post('/refund/submit', refund.submit); // 提交信息 |
47 | router.get('/refund/logistics', refund.logistics); // 退换货 - 商品寄回信息 | 47 | router.get('/refund/logistics', refund.logistics); // 退换货 - 商品寄回信息 |
48 | router.post('/save-logistics', refund.saveLogistics); // 退换货 - 添加寄回物流信息 | 48 | router.post('/save-logistics', refund.saveLogistics); // 退换货 - 添加寄回物流信息 |
49 | +router.post('/refund/cancel-apply', refund.cancelApply); // 退货 - 取消申请 | ||
49 | 50 | ||
50 | router.get('/exchange-status', refund.exchangeGoods); // 退换货 - 换货状态 | 51 | router.get('/exchange-status', refund.exchangeGoods); // 退换货 - 换货状态 |
51 | router.get('/refund/orders', refund.refundOrders); // 退换货 - 订单列表 | 52 | router.get('/refund/orders', refund.refundOrders); // 退换货 - 订单列表 |
@@ -56,6 +57,7 @@ router.get('/exchange', exchange.exchange); | @@ -56,6 +57,7 @@ router.get('/exchange', exchange.exchange); | ||
56 | router.get('/exchange/order', exchange.order); // AJAX 获取订单 商品 | 57 | router.get('/exchange/order', exchange.order); // AJAX 获取订单 商品 |
57 | router.get('/exchange/delivery', exchange.delivery); // AJAX 获取 退货方式 | 58 | router.get('/exchange/delivery', exchange.delivery); // AJAX 获取 退货方式 |
58 | router.post('/exchange/submit', exchange.submit); // AJAX 提交换货 申请 | 59 | router.post('/exchange/submit', exchange.submit); // AJAX 提交换货 申请 |
60 | +router.post('/exchange/cancel-apply', exchange.cancelApply); // AJAX 取消换货申请 | ||
59 | 61 | ||
60 | router.get('/mydetails', home.mydetails); // 个人信息 | 62 | router.get('/mydetails', home.mydetails); // 个人信息 |
61 | router.post('/save-mydetails', home.saveMydetails); // 保存个人信息 | 63 | router.post('/save-mydetails', home.saveMydetails); // 保存个人信息 |
1 | <div class="yoho-favorite-brand-page"> | 1 | <div class="yoho-favorite-brand-page"> |
2 | <div class="fav-content" id="fav-content"> | 2 | <div class="fav-content" id="fav-content"> |
3 | - <fav-brand-list brand-url='{{brandUrl}}'></fav-brand-list> | 3 | + <fav-brand-list></fav-brand-list> |
4 | </div> | 4 | </div> |
5 | -</div> | ||
5 | +</div> |
1 | <div class="yoho-favorite-page"> | 1 | <div class="yoho-favorite-page"> |
2 | <div class="fav-content" id="fav-content"> | 2 | <div class="fav-content" id="fav-content"> |
3 | - <fav-product-list product-url='{{productUrl}}'></fav-product-list> | 3 | + <fav-product-list></fav-product-list> |
4 | </div> | 4 | </div> |
5 | -</div> | ||
5 | +</div> |
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> |
@@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
9 | 9 | ||
10 | // const helpers = global.yoho.helpers; | 10 | // const helpers = global.yoho.helpers; |
11 | const model = require('../models/detail'); | 11 | const model = require('../models/detail'); |
12 | +const camelCase = global.yoho.camelCase; | ||
12 | 13 | ||
13 | /** | 14 | /** |
14 | * 商品详情 | 15 | * 商品详情 |
@@ -25,7 +26,7 @@ const component = { | @@ -25,7 +26,7 @@ const component = { | ||
25 | const id = req.params[0]; | 26 | const id = req.params[0]; |
26 | 27 | ||
27 | let params = { | 28 | let params = { |
28 | - uid: req.user.uid || 0, | 29 | + uid: req.user.uid || 8050378, |
29 | article_id: id, | 30 | article_id: id, |
30 | client_type: 'h5' | 31 | client_type: 'h5' |
31 | }; | 32 | }; |
@@ -33,6 +34,72 @@ const component = { | @@ -33,6 +34,72 @@ const component = { | ||
33 | model.index(params).then(result => { | 34 | model.index(params).then(result => { |
34 | res.json(result); | 35 | res.json(result); |
35 | }).catch(next); | 36 | }).catch(next); |
37 | + }, | ||
38 | + | ||
39 | + /** | ||
40 | + * 点赞 | ||
41 | + * | ||
42 | + * @param req | ||
43 | + * @param res | ||
44 | + * @param next | ||
45 | + */ | ||
46 | + like(req, res, next) { | ||
47 | + const params = { | ||
48 | + article_id: req.params[0], | ||
49 | + udid: req.sessionID | ||
50 | + | ||
51 | + // uid: req.user.uid || 8050378 | ||
52 | + }; | ||
53 | + | ||
54 | + model.like(params, 'true' === req.query.flag).then(result => { | ||
55 | + res.json(result); | ||
56 | + }).catch(next); | ||
57 | + }, | ||
58 | + | ||
59 | + /** | ||
60 | + * 收藏 | ||
61 | + * | ||
62 | + * @param req | ||
63 | + * @param res | ||
64 | + * @param next | ||
65 | + */ | ||
66 | + favorite(req, res, next) { | ||
67 | + const params = { | ||
68 | + article_id: req.params[0], | ||
69 | + uid: req.user.uid || 8050378 | ||
70 | + }; | ||
71 | + | ||
72 | + /* | ||
73 | + if (!req.user.id) { | ||
74 | + res.json({ | ||
75 | + code: 403 | ||
76 | + }); | ||
77 | + | ||
78 | + return; | ||
79 | + } | ||
80 | + */ | ||
81 | + model.favorite(params, 'true' === req.query.flag).then(result => { | ||
82 | + res.json(result); | ||
83 | + }).catch(next); | ||
84 | + }, | ||
85 | + | ||
86 | + /** | ||
87 | + * 杂项信息 | ||
88 | + * | ||
89 | + * @param req | ||
90 | + * @param res | ||
91 | + * @param next | ||
92 | + */ | ||
93 | + misc(req, res, next) { | ||
94 | + const params = { | ||
95 | + article_id: req.params[0], | ||
96 | + uid: req.user.uid || 8050378, | ||
97 | + udid: req.sessionID | ||
98 | + }; | ||
99 | + | ||
100 | + model.misc(params).then(result => { | ||
101 | + res.json(camelCase(result)); | ||
102 | + }).catch(next); | ||
36 | } | 103 | } |
37 | }; | 104 | }; |
38 | 105 |
@@ -23,7 +23,7 @@ module.exports = { | @@ -23,7 +23,7 @@ module.exports = { | ||
23 | getNewsList: (req, res, next) => { | 23 | getNewsList: (req, res, next) => { |
24 | let params = { | 24 | let params = { |
25 | page: req.body.page, | 25 | page: req.body.page, |
26 | - gender: req.body.gender, | 26 | + channel: req.body.channel, |
27 | uid: req.user.uid | 27 | uid: req.user.uid |
28 | }; | 28 | }; |
29 | 29 |
@@ -30,6 +30,67 @@ const model = { | @@ -30,6 +30,67 @@ const model = { | ||
30 | 30 | ||
31 | return camelCase([article, content, brands, other]); | 31 | return camelCase([article, content, brands, other]); |
32 | })(); | 32 | })(); |
33 | + }, | ||
34 | + | ||
35 | + /** | ||
36 | + * 点赞 | ||
37 | + * | ||
38 | + * @param params | ||
39 | + * @param flag | ||
40 | + * @returns {*} | ||
41 | + */ | ||
42 | + like(params, flag) { | ||
43 | + return Promise.coroutine(function*() { | ||
44 | + let ret = null; | ||
45 | + | ||
46 | + if (flag) { | ||
47 | + ret = yield serviceAPI.get('guang/api/v2/praise/setPraise', params); | ||
48 | + } else { | ||
49 | + ret = yield serviceAPI.get('guang/api/v2/praise/cancel', params); | ||
50 | + } | ||
51 | + | ||
52 | + const misc = yield serviceAPI.get('guang/api/v2/article/getArticleBaseInfo', Object.assign({ | ||
53 | + id: params.article_id | ||
54 | + }, params)); | ||
55 | + | ||
56 | + return [ret, misc]; | ||
57 | + })(); | ||
58 | + }, | ||
59 | + | ||
60 | + /** | ||
61 | + * 收藏 | ||
62 | + * | ||
63 | + * @param params | ||
64 | + * @param flag | ||
65 | + * @returns {*} | ||
66 | + */ | ||
67 | + favorite(params, flag) { | ||
68 | + return Promise.coroutine(function*() { | ||
69 | + let ret = null; | ||
70 | + | ||
71 | + if (flag) { | ||
72 | + ret = yield serviceAPI.get('guang/api/v1/favorite/setFavorite', params); | ||
73 | + } else { | ||
74 | + ret = yield serviceAPI.get('guang/api/v1/favorite/cancelFavorite', params); | ||
75 | + } | ||
76 | + | ||
77 | + const misc = yield serviceAPI.get('guang/api/v2/article/getArticleBaseInfo', Object.assign({ | ||
78 | + id: params.article_id | ||
79 | + }, params)); | ||
80 | + | ||
81 | + return [ret, misc]; | ||
82 | + })(); | ||
83 | + }, | ||
84 | + | ||
85 | + /** | ||
86 | + * 其它信息 | ||
87 | + * | ||
88 | + * @param params | ||
89 | + */ | ||
90 | + misc(params) { | ||
91 | + return serviceAPI.get('guang/api/v2/article/getArticleBaseInfo', Object.assign({ | ||
92 | + id: params.article_id | ||
93 | + }, params)); | ||
33 | } | 94 | } |
34 | }; | 95 | }; |
35 | 96 |
@@ -8,13 +8,25 @@ | @@ -8,13 +8,25 @@ | ||
8 | 'use strict'; | 8 | 'use strict'; |
9 | const serviceAPI = global.yoho.ServiceAPI; | 9 | const serviceAPI = global.yoho.ServiceAPI; |
10 | 10 | ||
11 | +const yhChannel = { | ||
12 | + men: { | ||
13 | + channel: '1,3' | ||
14 | + }, | ||
15 | + women: { | ||
16 | + channel: '2,3' | ||
17 | + }, | ||
18 | + all: { | ||
19 | + channel: '1,2,3' | ||
20 | + } | ||
21 | +}; | ||
22 | + | ||
11 | module.exports = { | 23 | module.exports = { |
12 | 24 | ||
13 | /* 资讯列表页数据获取 */ | 25 | /* 资讯列表页数据获取 */ |
14 | getNewsListData(params) { | 26 | getNewsListData(params) { |
15 | return serviceAPI.get('guang/api/v2/article/getList', { | 27 | return serviceAPI.get('guang/api/v2/article/getList', { |
16 | sort_id: '', | 28 | sort_id: '', |
17 | - gender: params.gender, | 29 | + gender: yhChannel[params.channel].channel, |
18 | uid: params.uid || '0', | 30 | uid: params.uid || '0', |
19 | page: params.page, | 31 | page: params.page, |
20 | limit: '10' | 32 | limit: '10' |
@@ -15,6 +15,9 @@ const detail = require(`${cRoot}/detail`); | @@ -15,6 +15,9 @@ const detail = require(`${cRoot}/detail`); | ||
15 | 15 | ||
16 | router.get(/\/([\d]+)(.*)/, detail.index); // 详情routers | 16 | router.get(/\/([\d]+)(.*)/, detail.index); // 详情routers |
17 | router.get(/news_(\d+)\.json/, detail.news); | 17 | router.get(/news_(\d+)\.json/, detail.news); |
18 | +router.get(/like_(\d+)\.json/, detail.like); | ||
19 | +router.get(/favorite_(\d+)\.json/, detail.favorite); | ||
20 | +router.get(/misc_(\d+)\.json/, detail.misc); | ||
18 | 21 | ||
19 | const news = require(`${cRoot}/index`); | 22 | const news = require(`${cRoot}/index`); |
20 | 23 |
@@ -43,12 +43,12 @@ const model = { | @@ -43,12 +43,12 @@ const model = { | ||
43 | * | 43 | * |
44 | * @param params | 44 | * @param params |
45 | */ | 45 | */ |
46 | - favorite(params) { | 46 | + favorite(params, flag) { |
47 | let method = ''; | 47 | let method = ''; |
48 | 48 | ||
49 | - if (params.operation === 'add') { | 49 | + if (flag) { |
50 | method = 'app.favorite.add'; | 50 | method = 'app.favorite.add'; |
51 | - } else if (params.operation === 'remove') { | 51 | + } else { |
52 | method = 'app.favorite.cancel'; | 52 | method = 'app.favorite.cancel'; |
53 | } | 53 | } |
54 | 54 |
@@ -37,6 +37,7 @@ | @@ -37,6 +37,7 @@ | ||
37 | "serve-favicon": "^2.3.0", | 37 | "serve-favicon": "^2.3.0", |
38 | "uuid": "^2.0.2", | 38 | "uuid": "^2.0.2", |
39 | "vue-loader": "^8.5.3", | 39 | "vue-loader": "^8.5.3", |
40 | + "vue-touch": "^1.1.0", | ||
40 | "winston": "^2.2.0", | 41 | "winston": "^2.2.0", |
41 | "winston-daily-rotate-file": "^1.1.4", | 42 | "winston-daily-rotate-file": "^1.1.4", |
42 | "yoho-md5": "^2.0.0", | 43 | "yoho-md5": "^2.0.0", |
@@ -77,6 +78,7 @@ | @@ -77,6 +78,7 @@ | ||
77 | "stylelint": "^6.9.0", | 78 | "stylelint": "^6.9.0", |
78 | "stylelint-config-yoho": "1.2.5", | 79 | "stylelint-config-yoho": "1.2.5", |
79 | "vue-loader": "^8.5.3", | 80 | "vue-loader": "^8.5.3", |
81 | + "vue-touch": "^1.1.0", | ||
80 | "webpack": "^1.13.1", | 82 | "webpack": "^1.13.1", |
81 | "webpack-dev-server": "^1.14.1", | 83 | "webpack-dev-server": "^1.14.1", |
82 | "webpack-stream": "^3.1.0", | 84 | "webpack-stream": "^3.1.0", |
1 | <div class="select"> | 1 | <div class="select"> |
2 | <ul> | 2 | <ul> |
3 | {{#each items}} | 3 | {{#each items}} |
4 | - <li class="item-li {{#if disabled}} disabled {{/if}}" key="{{key}}" status="{{disabled}}">{{val}}</li> | 4 | + <li class="item-li {{#if disabled}} disabled {{/if}}" key="{{key}}" status="{{disabled}}">{{{val}}}</li> |
5 | {{/each}} | 5 | {{/each}} |
6 | <li class="item-del"> | 6 | <li class="item-del"> |
7 | <span>取消</span> | 7 | <span>取消</span> |
public/img/home/noorder.png
0 → 100644
1.07 KB
@@ -43,14 +43,14 @@ function Select(items) { | @@ -43,14 +43,14 @@ function Select(items) { | ||
43 | if (elem.parent().length === 0) { | 43 | if (elem.parent().length === 0) { |
44 | const lis = elem.find('.item-li'); | 44 | const lis = elem.find('.item-li'); |
45 | 45 | ||
46 | - lis.each(function() { | ||
47 | - if (!$(this).attr('status')) { | 46 | + lis.each(function(index) { |
47 | + if ($(this).attr('status') === 'false' || $(this).attr('status') === '') { | ||
48 | $(this).click(function(e) { | 48 | $(this).click(function(e) { |
49 | hide(); | 49 | hide(); |
50 | - cb({ | ||
51 | - key: $(e.target).attr('key'), | ||
52 | - val: e.target.innerHTML | ||
53 | - }); | 50 | + cb(Object.assign({ |
51 | + key: e.target.getAttribute('key'), | ||
52 | + val: e.target.innerText | ||
53 | + }, items[index])); | ||
54 | }); | 54 | }); |
55 | } | 55 | } |
56 | }); | 56 | }); |
@@ -7,67 +7,68 @@ | @@ -7,67 +7,68 @@ | ||
7 | 7 | ||
8 | const $ = require('yoho-jquery'); | 8 | const $ = require('yoho-jquery'); |
9 | 9 | ||
10 | -$.ajax({ | ||
11 | - url: '//res.wx.qq.com/open/js/jweixin-1.1.0.js', | ||
12 | - dataType: 'script', | ||
13 | - cache: true, | ||
14 | - success: function() { | ||
15 | - $.ajax({ | ||
16 | - url: '/api/wechat/share/token', | ||
17 | - data: { | ||
18 | - url: location.href | ||
19 | - }, | ||
20 | - success: function(res) { | ||
21 | - if (window.wx) { | ||
22 | - window.wx.config({ | ||
23 | - debug: false, | ||
24 | - appId: res.appId, | ||
25 | - timestamp: res.timestamp, | ||
26 | - nonceStr: res.nonceStr, | ||
27 | - signature: res.signature, | ||
28 | - jsApiList: [ | ||
29 | - 'checkJsApi', | ||
30 | - 'onMenuShareTimeline', | ||
31 | - 'onMenuShareAppMessage', | ||
32 | - 'onMenuShareQQ', | ||
33 | - 'onMenuShareWeibo', | ||
34 | - 'hideMenuItems', | ||
35 | - 'showMenuItems', | ||
36 | - 'hideAllNonBaseMenuItem', | ||
37 | - 'showAllNonBaseMenuItem', | ||
38 | - 'translateVoice', | ||
39 | - 'startRecord', | ||
40 | - 'stopRecord', | ||
41 | - 'onRecordEnd', | ||
42 | - 'playVoice', | ||
43 | - 'pauseVoice', | ||
44 | - 'stopVoice', | ||
45 | - 'uploadVoice', | ||
46 | - 'downloadVoice', | ||
47 | - 'chooseImage', | ||
48 | - 'previewImage', | ||
49 | - 'uploadImage', | ||
50 | - 'downloadImage', | ||
51 | - 'getNetworkType', | ||
52 | - 'openLocation', | ||
53 | - 'getLocation', | ||
54 | - 'hideOptionMenu', | ||
55 | - 'showOptionMenu', | ||
56 | - 'closeWindow', | ||
57 | - 'scanQRCode', | ||
58 | - 'chooseWXPay', | ||
59 | - 'openProductSpecificView', | ||
60 | - 'addCard', | ||
61 | - 'chooseCard', | ||
62 | - 'openCard' | ||
63 | - ] | ||
64 | - }); | 10 | +if (/MicroMessenger/i.test(navigator.userAgent)) { |
11 | + $.ajax({ | ||
12 | + url: '//res.wx.qq.com/open/js/jweixin-1.1.0.js', | ||
13 | + dataType: 'script', | ||
14 | + cache: true, | ||
15 | + success: function() { | ||
16 | + $.ajax({ | ||
17 | + url: '/api/wechat/share/token', | ||
18 | + data: { | ||
19 | + url: location.href | ||
20 | + }, | ||
21 | + success: function(res) { | ||
22 | + if (window.wx) { | ||
23 | + window.wx.config({ | ||
24 | + debug: false, | ||
25 | + appId: res.appId, | ||
26 | + timestamp: res.timestamp, | ||
27 | + nonceStr: res.nonceStr, | ||
28 | + signature: res.signature, | ||
29 | + jsApiList: [ | ||
30 | + 'checkJsApi', | ||
31 | + 'onMenuShareTimeline', | ||
32 | + 'onMenuShareAppMessage', | ||
33 | + 'onMenuShareQQ', | ||
34 | + 'onMenuShareWeibo', | ||
35 | + 'hideMenuItems', | ||
36 | + 'showMenuItems', | ||
37 | + 'hideAllNonBaseMenuItem', | ||
38 | + 'showAllNonBaseMenuItem', | ||
39 | + 'translateVoice', | ||
40 | + 'startRecord', | ||
41 | + 'stopRecord', | ||
42 | + 'onRecordEnd', | ||
43 | + 'playVoice', | ||
44 | + 'pauseVoice', | ||
45 | + 'stopVoice', | ||
46 | + 'uploadVoice', | ||
47 | + 'downloadVoice', | ||
48 | + 'chooseImage', | ||
49 | + 'previewImage', | ||
50 | + 'uploadImage', | ||
51 | + 'downloadImage', | ||
52 | + 'getNetworkType', | ||
53 | + 'openLocation', | ||
54 | + 'getLocation', | ||
55 | + 'hideOptionMenu', | ||
56 | + 'showOptionMenu', | ||
57 | + 'closeWindow', | ||
58 | + 'scanQRCode', | ||
59 | + 'chooseWXPay', | ||
60 | + 'openProductSpecificView', | ||
61 | + 'addCard', | ||
62 | + 'chooseCard', | ||
63 | + 'openCard' | ||
64 | + ] | ||
65 | + }); | ||
66 | + } | ||
65 | } | 67 | } |
66 | - } | ||
67 | - }); | ||
68 | - } | ||
69 | -}); | ||
70 | - | 68 | + }); |
69 | + } | ||
70 | + }); | ||
71 | +} | ||
71 | module.exports = (shareData) => { | 72 | module.exports = (shareData) => { |
72 | if (window.wx) { | 73 | if (window.wx) { |
73 | window.wx.ready(function() { | 74 | window.wx.ready(function() { |
@@ -8,7 +8,7 @@ let Vue = require('yoho-vue'); | @@ -8,7 +8,7 @@ let Vue = require('yoho-vue'); | ||
8 | * | 8 | * |
9 | * {value | resize 100 200 2} ==> /100/200/2 | 9 | * {value | resize 100 200 2} ==> /100/200/2 |
10 | */ | 10 | */ |
11 | -Vue.filter('resize', (value, width, height, mode)=> { | 11 | +Vue.filter('resize', (value, width, height, mode) => { |
12 | return value ? value.replace(/(\{width}|\{height}|\{mode})/g, function($0) { | 12 | return value ? value.replace(/(\{width}|\{height}|\{mode})/g, function($0) { |
13 | const dict = { | 13 | const dict = { |
14 | '{width}': width, | 14 | '{width}': width, |
@@ -27,7 +27,7 @@ Vue.filter('resize', (value, width, height, mode)=> { | @@ -27,7 +27,7 @@ Vue.filter('resize', (value, width, height, mode)=> { | ||
27 | * | 27 | * |
28 | * {value | gender} | 28 | * {value | gender} |
29 | */ | 29 | */ |
30 | -Vue.filter('clothingGenderIdentity', (value)=> { | 30 | +Vue.filter('clothingGenderIdentity', (value) => { |
31 | let ret = null; | 31 | let ret = null; |
32 | 32 | ||
33 | switch (value) { | 33 | switch (value) { |
@@ -49,7 +49,7 @@ Vue.filter('clothingGenderIdentity', (value)=> { | @@ -49,7 +49,7 @@ Vue.filter('clothingGenderIdentity', (value)=> { | ||
49 | * | 49 | * |
50 | * @param value brand domain | 50 | * @param value brand domain |
51 | */ | 51 | */ |
52 | -Vue.filter('brandUrl', (value)=> { | 52 | +Vue.filter('brandUrl', (value) => { |
53 | return `/product/shop?domain=${value}`; | 53 | return `/product/shop?domain=${value}`; |
54 | }); | 54 | }); |
55 | 55 | ||
@@ -57,6 +57,7 @@ Vue.filter('brandUrl', (value)=> { | @@ -57,6 +57,7 @@ Vue.filter('brandUrl', (value)=> { | ||
57 | * 产品 URL | 57 | * 产品 URL |
58 | */ | 58 | */ |
59 | Vue.filter('goodsUrl', productId => { | 59 | Vue.filter('goodsUrl', productId => { |
60 | + if (!productId) return ''; | ||
60 | return `/product/${productId}`; | 61 | return `/product/${productId}`; |
61 | }); | 62 | }); |
62 | 63 |
@@ -24,13 +24,11 @@ const cate = { | @@ -24,13 +24,11 @@ const cate = { | ||
24 | lifestyle: '6f7b590ed3844e680d4052fc5c4d98ad' | 24 | lifestyle: '6f7b590ed3844e680d4052fc5c4d98ad' |
25 | }; | 25 | }; |
26 | 26 | ||
27 | -/* 资讯列表资源位 */ | 27 | +/* TODO 资讯列表资源位 */ |
28 | const news = { | 28 | const news = { |
29 | - new: 'd4fdfcad1ec877d466d9780efaf4d296', | ||
30 | - sports: 'e1f8dce8cb9de1a0977479c13c4d3dcc', | ||
31 | - life: '5c0b9963d8b75e6fd788a2b49402be14', | ||
32 | - sneakers: 'c4a62196c30cae5301e419aa3f77747b', | ||
33 | - fashion: '70bc6b9d5c96bb7698eab85c7cd5ebbe' | 29 | + all: 'd4fdfcad1ec877d466d9780efaf4d296', |
30 | + men: 'e1f8dce8cb9de1a0977479c13c4d3dcc', | ||
31 | + women: '5c0b9963d8b75e6fd788a2b49402be14' | ||
34 | }; | 32 | }; |
35 | 33 | ||
36 | module.exports = { | 34 | module.exports = { |
1 | const Vue = require('yoho-vue'); | 1 | 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 | - | ||
5 | const VueTouch = require('vue-touch'); | 4 | const VueTouch = require('vue-touch'); |
6 | -Vue.use(VueTouch) | 5 | +require('common/vue-filter'); |
7 | 6 | ||
7 | +Vue.use(VueTouch) | ||
8 | Vue.use(infiniteScroll); | 8 | Vue.use(infiniteScroll); |
9 | 9 | ||
10 | new Vue({ | 10 | new Vue({ |
1 | const Vue = require('yoho-vue'); | 1 | 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 | - | ||
5 | const VueTouch = require('vue-touch'); | 4 | const VueTouch = require('vue-touch'); |
6 | -Vue.use(VueTouch) | 5 | +require('common/vue-filter'); |
7 | 6 | ||
7 | +Vue.use(VueTouch) | ||
8 | Vue.use(infiniteScroll); | 8 | Vue.use(infiniteScroll); |
9 | 9 | ||
10 | 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, |
@@ -212,6 +212,7 @@ body { | @@ -212,6 +212,7 @@ body { | ||
212 | border: 0 none; | 212 | border: 0 none; |
213 | background: $white; | 213 | background: $white; |
214 | font-size: 28px; | 214 | font-size: 28px; |
215 | + margin-right: 10px; | ||
215 | 216 | ||
216 | &.black { | 217 | &.black { |
217 | width: 192px; | 218 | width: 192px; |
@@ -237,3 +238,7 @@ body { | @@ -237,3 +238,7 @@ body { | ||
237 | } | 238 | } |
238 | } | 239 | } |
239 | } | 240 | } |
241 | + | ||
242 | +.select .overdue{ | ||
243 | + color: #b0b0b0; | ||
244 | +} |
@@ -199,3 +199,40 @@ $white: #fff; | @@ -199,3 +199,40 @@ $white: #fff; | ||
199 | } | 199 | } |
200 | } | 200 | } |
201 | } | 201 | } |
202 | + | ||
203 | +.order-empty { | ||
204 | + width: 100%; | ||
205 | + height: 100%; | ||
206 | + text-align: center; | ||
207 | + background: $white; | ||
208 | + | ||
209 | + &:before { | ||
210 | + content: ""; | ||
211 | + display: inline-block; | ||
212 | + width: 153px; | ||
213 | + height: 195px; | ||
214 | + margin-top: 290px; | ||
215 | + background: resolve("home/noorder.png") no-repeat; | ||
216 | + background-size: 100%; | ||
217 | + } | ||
218 | + | ||
219 | + p{ | ||
220 | + color: #b0b0b0; | ||
221 | + } | ||
222 | + | ||
223 | + p:first-of-type{ | ||
224 | + font-size: 34px; | ||
225 | + margin: 50px 0 20px; | ||
226 | + } | ||
227 | + | ||
228 | + a{ | ||
229 | + display: inline-block; | ||
230 | + width: 414px; | ||
231 | + height: 94px; | ||
232 | + margin-top: 60px; | ||
233 | + background: $black; | ||
234 | + color: $white; | ||
235 | + line-height: 94px; | ||
236 | + font-size: 28px; | ||
237 | + } | ||
238 | +} |
@@ -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/product/shop/share?domain=sctest1"})'>分享</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/example/app"})'>分享</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> |
@@ -27,6 +27,7 @@ | @@ -27,6 +27,7 @@ | ||
27 | <script> | 27 | <script> |
28 | const yoho = require('yoho'); | 28 | const yoho = require('yoho'); |
29 | const modal = require('common/modal'); | 29 | const modal = require('common/modal'); |
30 | + const share = require('common/share'); | ||
30 | 31 | ||
31 | module.exports = { | 32 | module.exports = { |
32 | data() { | 33 | data() { |
@@ -41,6 +42,13 @@ | @@ -41,6 +42,13 @@ | ||
41 | modal.alert('传递的信息是:' + data); | 42 | modal.alert('传递的信息是:' + data); |
42 | } | 43 | } |
43 | }); | 44 | }); |
45 | + | ||
46 | + share({ | ||
47 | + title: '标题', | ||
48 | + link: location.href, | ||
49 | + desc: '我在BLK发现了一个不错的品牌,赶快来看看吧!', | ||
50 | + imgUrl: 'http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg' | ||
51 | + }); | ||
44 | }, | 52 | }, |
45 | methods: { | 53 | methods: { |
46 | addressCallback(info) { | 54 | addressCallback(info) { |
@@ -8,9 +8,9 @@ | @@ -8,9 +8,9 @@ | ||
8 | <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)"> | 8 | <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)"> |
9 | <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> |
10 | </div> | 10 | </div> |
11 | - <a :href="item.link"> | 11 | + <a :href="item.link | brandUrl"> |
12 | <div class="fav-img-box"> | 12 | <div class="fav-img-box"> |
13 | - <img :src="item.imgUrl" alt=""/> | 13 | + <img :src="item.imgUrl | resize 160 125" alt=""/> |
14 | </div> | 14 | </div> |
15 | <div class="fav-info-list"> | 15 | <div class="fav-info-list"> |
16 | <span class="title">{{item.brandName}}</span> | 16 | <span class="title">{{item.brandName}}</span> |
@@ -29,7 +29,7 @@ | @@ -29,7 +29,7 @@ | ||
29 | 29 | ||
30 | <div class="fav-null-box {{ nullbox }}"> | 30 | <div class="fav-null-box {{ nullbox }}"> |
31 | <span class="fav-null">您暂无收藏任何品牌</span> | 31 | <span class="fav-null">您暂无收藏任何品牌</span> |
32 | - <a slot="go-shopping" class="go-shopping" :href="brandUrl">随便逛逛</a> | 32 | + <a slot="go-shopping" class="go-shopping" href="/product/new">随便逛逛</a> |
33 | </div> | 33 | </div> |
34 | </div> | 34 | </div> |
35 | </template> | 35 | </template> |
@@ -40,7 +40,6 @@ | @@ -40,7 +40,6 @@ | ||
40 | const yoho = require('yoho'); | 40 | const yoho = require('yoho'); |
41 | 41 | ||
42 | module.exports = { | 42 | module.exports = { |
43 | - props: ['brandUrl'], | ||
44 | data() { | 43 | data() { |
45 | return { | 44 | return { |
46 | nullbox: 'hide', | 45 | nullbox: 'hide', |
@@ -65,21 +64,26 @@ | @@ -65,21 +64,26 @@ | ||
65 | page: ++_this.page, | 64 | page: ++_this.page, |
66 | tab: 'brand' | 65 | tab: 'brand' |
67 | } | 66 | } |
68 | - }).then(result => { | ||
69 | - if (result.isend) { | 67 | + }).then(data => { |
68 | + if (_this.page === data.pageTotal) { | ||
70 | _this.busy = true; | 69 | _this.busy = true; |
71 | } else { | 70 | } else { |
72 | _this.busy = false; | 71 | _this.busy = false; |
73 | } | 72 | } |
74 | 73 | ||
75 | - if (result.list.length) { | ||
76 | - result.list.forEach(function(o) { | ||
77 | - if (!_this.keys[o.fav_id]) { | ||
78 | - _this.keys[o.fav_id] = true; | ||
79 | - _this.brandData.push(o); | 74 | + data.brandList.forEach(function(o){ |
75 | + if (!_this.keys[o.brandId]) { | ||
76 | + _this.keys[o.brandId] = true; | ||
77 | + | ||
78 | + _this.brandData.push({ | ||
79 | + fav_id: o.brandId, | ||
80 | + link: o.brandDomain, | ||
81 | + imgUrl: o.brandIco, | ||
82 | + brandName: o.brandName, | ||
83 | + down: o.status === 0 | ||
84 | + }); | ||
80 | } | 85 | } |
81 | - }); | ||
82 | - } | 86 | + }) |
83 | 87 | ||
84 | _this.nullbox = _this.brandData.length ? 'hide' : ''; | 88 | _this.nullbox = _this.brandData.length ? 'hide' : ''; |
85 | }).fail(() => { | 89 | }).fail(() => { |
@@ -8,9 +8,9 @@ | @@ -8,9 +8,9 @@ | ||
8 | <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)"> | 8 | <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)"> |
9 | <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> |
10 | </div> | 10 | </div> |
11 | - <a :href="item.link"> | 11 | + <a :href="item.link | goodsUrl"> |
12 | <div class="fav-img-box"> | 12 | <div class="fav-img-box"> |
13 | - <img :src="item.imgUrl" alt=""/> | 13 | + <img :src="item.imgUrl | resize 152 203" alt=""/> |
14 | </div> | 14 | </div> |
15 | <div class="fav-info-list"> | 15 | <div class="fav-info-list"> |
16 | <span class="title">{{item.title}}</span> | 16 | <span class="title">{{item.title}}</span> |
@@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
34 | </ul> | 34 | </ul> |
35 | <div class="fav-null-box {{ nullbox }}"> | 35 | <div class="fav-null-box {{ nullbox }}"> |
36 | <span class="fav-null">您暂无收藏任何商品</span> | 36 | <span class="fav-null">您暂无收藏任何商品</span> |
37 | - <a slot="go-shopping" class="go-shopping" :href="productUrl">随便逛逛</a> | 37 | + <a slot="go-shopping" class="go-shopping" href='/product/new'>随便逛逛</a> |
38 | </div> | 38 | </div> |
39 | </div> | 39 | </div> |
40 | </template> | 40 | </template> |
@@ -45,7 +45,6 @@ | @@ -45,7 +45,6 @@ | ||
45 | const yoho = require('yoho'); | 45 | const yoho = require('yoho'); |
46 | 46 | ||
47 | module.exports = { | 47 | module.exports = { |
48 | - props: ['productUrl'], | ||
49 | data() { | 48 | data() { |
50 | return { | 49 | return { |
51 | nullbox: 'hide', | 50 | nullbox: 'hide', |
@@ -69,21 +68,39 @@ | @@ -69,21 +68,39 @@ | ||
69 | data: { | 68 | data: { |
70 | page: ++_this.page | 69 | page: ++_this.page |
71 | } | 70 | } |
72 | - }).then(result => { | ||
73 | - if (result.isend) { | 71 | + }).then(data => { |
72 | + if (_this.page === data.pageTotal) { | ||
74 | _this.busy = true; | 73 | _this.busy = true; |
75 | } else { | 74 | } else { |
76 | _this.busy = false; | 75 | _this.busy = false; |
77 | } | 76 | } |
78 | 77 | ||
79 | - if (result.list.length) { | ||
80 | - result.list.forEach(function(o) { | ||
81 | - if (!_this.keys[o.fav_id]) { | ||
82 | - _this.keys[o.fav_id] = true; | ||
83 | - _this.productData.push(o); | 78 | + data.productList.forEach(function(o){ |
79 | + if (!o.productSkn) { | ||
80 | + return; | ||
81 | + } | ||
82 | + | ||
83 | + if (!_this.keys[o.productId]) { | ||
84 | + _this.keys[o.productId] = true; | ||
85 | + | ||
86 | + let discountPrice = false; | ||
87 | + | ||
88 | + if (Number(o.marketPrice) - Number(o.salesPrice) > 0) { | ||
89 | + discountPrice = '¥' + Number(Math.max(o.salesPrice, 0)).toFixed(2); | ||
84 | } | 90 | } |
85 | - }); | ||
86 | - } | 91 | + |
92 | + _this.productData.push({ | ||
93 | + fav_id: o.productId, | ||
94 | + link: o.goodsId && o.cnAlphabet ? o.productId : '', | ||
95 | + imgUrl: o.image, | ||
96 | + title: o.productName, | ||
97 | + price: '¥' + Number(Math.max(o.marketPrice, 0)).toFixed(2), | ||
98 | + discountPrice: discountPrice, | ||
99 | + sellOut: o.storage <= 0, | ||
100 | + invalidGoods: o.status === 0 | ||
101 | + }); | ||
102 | + } | ||
103 | + }) | ||
87 | 104 | ||
88 | _this.nullbox = _this.productData.length ? 'hide' : ''; | 105 | _this.nullbox = _this.productData.length ? 'hide' : ''; |
89 | }).fail(() => { | 106 | }).fail(() => { |
@@ -43,10 +43,11 @@ | @@ -43,10 +43,11 @@ | ||
43 | <div class="order-button" v-show="order.status != 1 && order.status != 2 && order.status != 3"> | 43 | <div class="order-button" v-show="order.status != 1 && order.status != 2 && order.status != 3"> |
44 | <button v-if="order.status == 0" @click="cancelOrder(order.orderCode)">取消订单</button> | 44 | <button v-if="order.status == 0" @click="cancelOrder(order.orderCode)">取消订单</button> |
45 | <button v-if="order.status == 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button> | 45 | <button v-if="order.status == 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button> |
46 | - <button v-if="order.status == 4 || order.status == 5 ">查看物流</button> | 46 | + <button v-if="order.status == 4 || order.status == 5 " @click="seeExpress(order.orderCode)">查看物流</button> |
47 | <button v-if="order.status == 4 || order.status == 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button> | 47 | <button v-if="order.status == 4 || order.status == 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button> |
48 | <button v-if="order.status == 6" @click="deleteOrder(order,index)">删除订单</button> | 48 | <button v-if="order.status == 6" @click="deleteOrder(order,index)">删除订单</button> |
49 | <button v-if="order.status == 6" class="normal">再次购买</button> | 49 | <button v-if="order.status == 6" class="normal">再次购买</button> |
50 | + <button v-if="order.isSupportRefund == 'Y' || order.isSupportExchange == 'Y'" class="normal" @click="applyRefund()">申请售后</button> | ||
50 | </div> | 51 | </div> |
51 | </template> | 52 | </template> |
52 | <script> | 53 | <script> |
@@ -56,6 +57,7 @@ | @@ -56,6 +57,7 @@ | ||
56 | const tip = require('common/tip'); | 57 | const tip = require('common/tip'); |
57 | const Modal = require('common/modal'); | 58 | const Modal = require('common/modal'); |
58 | const yohoAPI = require('yoho'); | 59 | const yohoAPI = require('yoho'); |
60 | + let genderSel = require('common/select'); | ||
59 | 61 | ||
60 | module.exports = { | 62 | module.exports = { |
61 | data() { | 63 | data() { |
@@ -76,6 +78,24 @@ | @@ -76,6 +78,24 @@ | ||
76 | }).then(result => { | 78 | }).then(result => { |
77 | if (result.code === 200) { | 79 | if (result.code === 200) { |
78 | this.$set('order', result.data); | 80 | this.$set('order', result.data); |
81 | + genderSel = genderSel([ | ||
82 | + { | ||
83 | + key: this.order.isSupportRefund, | ||
84 | + val: this.order.isSupportRefund === 'Y' ? '申请退货' : '<span class="overdue">申请退货(已过期限)</span>', | ||
85 | + url: '/home/refund?orderId=' + this.order.orderCode, | ||
86 | + disabled: this.order.isSupportRefund !== 'Y' | ||
87 | + }, | ||
88 | + { | ||
89 | + key: this.order.isSupportExchange, | ||
90 | + val: this.order.isSupportExchange === 'Y' ? '申请换货' : '<span class="overdue">申请换货(已过期限)</span>', | ||
91 | + url: '/home/exchange?orderId=' + this.order.orderCode, | ||
92 | + disabled: this.order.isSupportExchange !== 'Y' | ||
93 | + }, | ||
94 | + { | ||
95 | + key: 'onlineService', | ||
96 | + val: '在线客服' | ||
97 | + } | ||
98 | + ]); | ||
79 | } else { | 99 | } else { |
80 | tip(result.message); | 100 | tip(result.message); |
81 | } | 101 | } |
@@ -161,8 +181,19 @@ | @@ -161,8 +181,19 @@ | ||
161 | goBuy(code) { | 181 | goBuy(code) { |
162 | yohoAPI.goPay({orderid: code}); | 182 | yohoAPI.goPay({orderid: code}); |
163 | }, | 183 | }, |
164 | - seeExpress() { | ||
165 | - location.href = ''; | 184 | + seeExpress(code) { |
185 | + location.href = '/home/logistic?order_code='+code; | ||
186 | + }, | ||
187 | + | ||
188 | + /** | ||
189 | + * 申请售后 | ||
190 | + */ | ||
191 | + applyRefund(code) { | ||
192 | + genderSel.show(function(item) { | ||
193 | + console.log(item); | ||
194 | + return; | ||
195 | + location.href = item.url; | ||
196 | + }); | ||
166 | } | 197 | } |
167 | } | 198 | } |
168 | }; | 199 | }; |
@@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
30 | <div class="options"> | 30 | <div class="options"> |
31 | <button v-if="order.status === 0" @click="cancelOrder(order.orderCode)">取消订单</button> | 31 | <button v-if="order.status === 0" @click="cancelOrder(order.orderCode)">取消订单</button> |
32 | <button v-if="order.status === 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button> | 32 | <button v-if="order.status === 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button> |
33 | - <button v-if="order.status === 4 || order.status === 5 ">查看物流</button> | 33 | + <button v-if="order.status === 4 || order.status === 5 " @click="seeExpress(order.orderCode)">查看物流</button> |
34 | <button v-if="order.status === 4 || order.status === 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button> | 34 | <button v-if="order.status === 4 || order.status === 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button> |
35 | <button v-if="order.status === 6" @click="deleteOrder(order,index)">删除订单</button> | 35 | <button v-if="order.status === 6" @click="deleteOrder(order,index)">删除订单</button> |
36 | <button v-if="order.status === 6" class="normal">再次购买</button> | 36 | <button v-if="order.status === 6" class="normal">再次购买</button> |
@@ -39,6 +39,11 @@ | @@ -39,6 +39,11 @@ | ||
39 | </div> | 39 | </div> |
40 | </li> | 40 | </li> |
41 | </ul> | 41 | </ul> |
42 | + <div class="order-empty {{emptybox}}"> | ||
43 | + <p>您暂时还没有订单</p> | ||
44 | + <p>Your do not have an order <br>for the time being</p> | ||
45 | + <a href="">去购物</a> | ||
46 | + </div> | ||
42 | </template> | 47 | </template> |
43 | 48 | ||
44 | <script> | 49 | <script> |
@@ -58,6 +63,7 @@ | @@ -58,6 +63,7 @@ | ||
58 | type: this.$parent.$data.type, | 63 | type: this.$parent.$data.type, |
59 | orderList: [], | 64 | orderList: [], |
60 | busy: false, | 65 | busy: false, |
66 | + emptybox: 'hide' | ||
61 | }; | 67 | }; |
62 | }, | 68 | }, |
63 | 69 | ||
@@ -86,7 +92,11 @@ | @@ -86,7 +92,11 @@ | ||
86 | if (result.data.orderList.length > 0) { | 92 | if (result.data.orderList.length > 0) { |
87 | this.$set('orderList', _that.orderList.concat(result.data.orderList)); | 93 | this.$set('orderList', _that.orderList.concat(result.data.orderList)); |
88 | _that.pageTotal = result.data.pageTotal; | 94 | _that.pageTotal = result.data.pageTotal; |
95 | + } else { | ||
96 | + _that.emptybox = ''; | ||
89 | } | 97 | } |
98 | + } else { | ||
99 | + _that.emptybox = ''; | ||
90 | } | 100 | } |
91 | }).fail(() => { | 101 | }).fail(() => { |
92 | tip('网络错误'); | 102 | tip('网络错误'); |
@@ -172,8 +182,8 @@ | @@ -172,8 +182,8 @@ | ||
172 | goBuy(code) { | 182 | goBuy(code) { |
173 | yohoAPI.goPay({orderid: code}); | 183 | yohoAPI.goPay({orderid: code}); |
174 | }, | 184 | }, |
175 | - seeExpress() { | ||
176 | - location.href = ''; | 185 | + seeExpress(code) { |
186 | + location.href = '/home/logistic?order_code='+code; | ||
177 | } | 187 | } |
178 | } | 188 | } |
179 | }; | 189 | }; |
@@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
31 | <div class="order-option" v-show="order.canCancel == 'Y'"> | 31 | <div class="order-option" v-show="order.canCancel == 'Y'"> |
32 | <div class="goods-total"></div> | 32 | <div class="goods-total"></div> |
33 | <div class="options" v-show="order.canCancel == 'Y'"> | 33 | <div class="options" v-show="order.canCancel == 'Y'"> |
34 | - <button v-if="order.canCancel == 'Y'" class="normal">取消申请</button> | 34 | + <button v-if="order.canCancel == 'Y'" class="normal" @click="cancelApply(order.id, order.refundType)">取消申请</button> |
35 | </div> | 35 | </div> |
36 | </div> | 36 | </div> |
37 | </div> | 37 | </div> |
@@ -85,12 +85,17 @@ | @@ -85,12 +85,17 @@ | ||
85 | tip('网络错误'); | 85 | tip('网络错误'); |
86 | }); | 86 | }); |
87 | }, | 87 | }, |
88 | - cancelApply(code) { | 88 | + /** |
89 | + * 取消申请 | ||
90 | + * @param id | ||
91 | + * @param type refundType 1为退货,2为换货 | ||
92 | + */ | ||
93 | + cancelApply(id, type) { | ||
89 | $.ajax({ | 94 | $.ajax({ |
90 | - url: '/home/cancel-apply', | 95 | + url: '/home/'+(type == 2 ? 'exchange' : 'refund')+'/cancel-apply', |
91 | type: 'post', | 96 | type: 'post', |
92 | data: { | 97 | data: { |
93 | - orderCode: code | 98 | + id: id |
94 | } | 99 | } |
95 | }).then(result => { | 100 | }).then(result => { |
96 | if (result.code === 200) { | 101 | if (result.code === 200) { |
1 | <template> | 1 | <template> |
2 | - <top-nav></top-nav> | ||
3 | - <div class="show-box no-padding first-box" :class="{'is-app': isApp}"> | 2 | + <top-nav :id="id" :article="article"></top-nav> |
3 | + <div class="show-box no-padding first-box"> | ||
4 | <div class="news-box"> | 4 | <div class="news-box"> |
5 | <h1>{{article.articleTitle}}</h1> | 5 | <h1>{{article.articleTitle}}</h1> |
6 | <div class="status-bar"> | 6 | <div class="status-bar"> |
7 | <span class="icon icon-timeshare"></span><span class="label">{{article.publishTime | formatUnixTime 'MM.DD HH:mm'}}</span> | 7 | <span class="icon icon-timeshare"></span><span class="label">{{article.publishTime | formatUnixTime 'MM.DD HH:mm'}}</span> |
8 | - <span class="icon icon-eye"></span><span class="label">{{article.pageViews}}</span> | 8 | + <span class="icon icon-read"></span><span class="label">{{article.pageViews}}</span> |
9 | </div> | 9 | </div> |
10 | </div> | 10 | </div> |
11 | 11 | ||
@@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
31 | </ul> | 31 | </ul> |
32 | </div> | 32 | </div> |
33 | 33 | ||
34 | - <div class="show-box" v-if="other"> | 34 | + <div class="show-box" v-if="other && other.length > 0"> |
35 | <h2>相关文章</h2> | 35 | <h2>相关文章</h2> |
36 | <div class="other-box" v-for="item in other"> | 36 | <div class="other-box" v-for="item in other"> |
37 | <div> | 37 | <div> |
@@ -57,14 +57,6 @@ | @@ -57,14 +57,6 @@ | ||
57 | } | 57 | } |
58 | 58 | ||
59 | .show-box { | 59 | .show-box { |
60 | - &.first-box { | ||
61 | - margin-top: 120px; | ||
62 | - } | ||
63 | - | ||
64 | - &.first-box.is-app { | ||
65 | - margin-top: 180px; | ||
66 | - } | ||
67 | - | ||
68 | background: $bgcolor; | 60 | background: $bgcolor; |
69 | margin-top: 30px; | 61 | margin-top: 30px; |
70 | border-bottom: 1px solid #eee; | 62 | border-bottom: 1px solid #eee; |
@@ -206,8 +198,10 @@ | @@ -206,8 +198,10 @@ | ||
206 | recommendProducts: [] | 198 | recommendProducts: [] |
207 | }; | 199 | }; |
208 | }, | 200 | }, |
209 | - created() { | 201 | + init() { |
210 | const newsId = $('#app').data('newsId'); | 202 | const newsId = $('#app').data('newsId'); |
203 | + | ||
204 | + this.id = newsId; | ||
211 | let loadDeferred = null; | 205 | let loadDeferred = null; |
212 | 206 | ||
213 | $.get(`/news/news_${newsId}.json`).then(result => { | 207 | $.get(`/news/news_${newsId}.json`).then(result => { |
@@ -215,6 +209,7 @@ | @@ -215,6 +209,7 @@ | ||
215 | content = result[1], | 209 | content = result[1], |
216 | brands = result[2], | 210 | brands = result[2], |
217 | other = result[3]; | 211 | other = result[3]; |
212 | + | ||
218 | let goods, prodMap = {}; | 213 | let goods, prodMap = {}; |
219 | 214 | ||
220 | if (article && article.code === 200 && article.data) { | 215 | if (article && article.code === 200 && article.data) { |
@@ -228,7 +223,6 @@ | @@ -228,7 +223,6 @@ | ||
228 | return block && typeof block.goods === 'object'; | 223 | return block && typeof block.goods === 'object'; |
229 | }); | 224 | }); |
230 | 225 | ||
231 | - | ||
232 | const list = []; | 226 | const list = []; |
233 | 227 | ||
234 | goods = products[0] ? products[0].goods.data : null; | 228 | goods = products[0] ? products[0].goods.data : null; |
@@ -264,7 +258,6 @@ | @@ -264,7 +258,6 @@ | ||
264 | this.other = other.data; | 258 | this.other = other.data; |
265 | } | 259 | } |
266 | 260 | ||
267 | - | ||
268 | // 延时读取商品价格、名称等信息 | 261 | // 延时读取商品价格、名称等信息 |
269 | loadDeferred = () => { | 262 | loadDeferred = () => { |
270 | $.get('/product/search_product.json', { | 263 | $.get('/product/search_product.json', { |
@@ -77,15 +77,14 @@ | @@ -77,15 +77,14 @@ | ||
77 | module.exports = { | 77 | module.exports = { |
78 | data() { | 78 | data() { |
79 | return { | 79 | return { |
80 | - contentCode: contentCode.news[qs.cate || 'new'], | 80 | + contentCode: contentCode.news[qs.channel || 'all'], |
81 | newsList: [], | 81 | newsList: [], |
82 | - gender: qs.gender, | ||
83 | page: 0, | 82 | page: 0, |
84 | scrollDisabled: false | 83 | scrollDisabled: false |
85 | }; | 84 | }; |
86 | }, | 85 | }, |
87 | watch: { | 86 | watch: { |
88 | - gender() { | 87 | + channel() { |
89 | this.getNewsList(); | 88 | this.getNewsList(); |
90 | } | 89 | } |
91 | }, | 90 | }, |
@@ -96,9 +95,8 @@ | @@ -96,9 +95,8 @@ | ||
96 | $.post({ | 95 | $.post({ |
97 | url: '/news/list.json', | 96 | url: '/news/list.json', |
98 | data: { | 97 | data: { |
99 | - sortId: this.crntCateId, | ||
100 | page: this.page++, | 98 | page: this.page++, |
101 | - gender: this.gender || '1,2,3' | 99 | + channel: qs.channel || 'all' |
102 | } | 100 | } |
103 | }).done(result => { | 101 | }).done(result => { |
104 | if (result.code === 200) { | 102 | if (result.code === 200) { |
1 | <template> | 1 | <template> |
2 | <div class="top-nav"> | 2 | <div class="top-nav"> |
3 | <navbar> | 3 | <navbar> |
4 | - <a slot="left" href="javascript:alert('TODO');"> | ||
5 | - <span class="icon icon-left"></span> | ||
6 | - </a> | ||
7 | - | ||
8 | <template slot="right"> | 4 | <template slot="right"> |
9 | - <a class="right-button" href="javascript:alert('TODO');"> | ||
10 | - <span class="icon icon-check"></span> | 5 | + <a class="right-button" href="javascript:void(0);" @click="like()"> |
6 | + <span class="icon icon-like" :class=""></span> | ||
11 | {{likeCount}} | 7 | {{likeCount}} |
12 | </a> | 8 | </a> |
13 | 9 | ||
14 | - <a class="right-button" href="javascript:alert('TODO');"> | ||
15 | - <span class="icon icon-love"></span> | 10 | + <a class="right-button" href="javascript:void(0);" @click="favorite()"> |
11 | + <span class="icon" :class="{ 'icon-love': !isFavorite, 'icon-love-solid': isFavorite}"></span> | ||
16 | </a> | 12 | </a> |
17 | 13 | ||
18 | - <a class="right-button" href="javascript:alert('TODO');"> | 14 | + <a class="right-button" href="javascript:void(0);" @click="share()"> |
19 | <span class="icon icon-share"></span> | 15 | <span class="icon icon-share"></span> |
20 | </a> | 16 | </a> |
21 | </template> | 17 | </template> |
@@ -35,16 +31,80 @@ | @@ -35,16 +31,80 @@ | ||
35 | require('common/vue-filter'); | 31 | require('common/vue-filter'); |
36 | 32 | ||
37 | module.exports = { | 33 | module.exports = { |
34 | + props: { | ||
35 | + id: Number, | ||
36 | + article: Object | ||
37 | + }, | ||
38 | components: { | 38 | components: { |
39 | navbar: require('component/header.vue') | 39 | navbar: require('component/header.vue') |
40 | }, | 40 | }, |
41 | data() { | 41 | data() { |
42 | return { | 42 | return { |
43 | isApp: yoho.isApp, | 43 | isApp: yoho.isApp, |
44 | - likeCount: 9, | 44 | + likeCount: this.article.praise, |
45 | + isFavorite: false, | ||
46 | + isLiked: false | ||
45 | }; | 47 | }; |
46 | }, | 48 | }, |
49 | + watch: { | ||
50 | + article: function() { | ||
51 | + this.likeCount = this.article.praise; | ||
52 | + } | ||
53 | + }, | ||
54 | + methods: { | ||
55 | + like: function() { | ||
56 | + $.get(`/news/like_${this.article.id}.json`, { | ||
57 | + flag: !this.isLiked | ||
58 | + }, (results)=> { | ||
59 | + const result = results[0], misc = results[1]; | ||
60 | + | ||
61 | + if (result.code === 200) { | ||
62 | + this.likeCount = result.data; | ||
63 | + } | ||
64 | + | ||
65 | + if (misc.code === 200) { | ||
66 | + this.isLiked = misc.data.isPraise === 'Y'; | ||
67 | + } | ||
68 | + }); | ||
69 | + }, | ||
70 | + favorite: function() { | ||
71 | + $.get(`/news/favorite_${this.article.id}.json`, { | ||
72 | + flag: !this.isFavorite | ||
73 | + }, (results)=> { | ||
74 | + const result = results[0], misc = results[1]; | ||
75 | + | ||
76 | + if (result.code === 200) { | ||
77 | + // TODO: | ||
78 | + } | ||
79 | + | ||
80 | + if (misc.code === 200) { | ||
81 | + this.isFavorite = misc.data.isFavor === 'Y'; | ||
82 | + } | ||
83 | + }); | ||
84 | + }, | ||
85 | + share: function() { | ||
86 | + yoho.goShare({ | ||
87 | + title: this.article.articleTitle, | ||
88 | + des: '优质精选,BLK潮流资讯为你呈现', | ||
89 | + img: this.article.coverImage.replace(/(\{width}|\{height}|\{mode})/g, function($0) { | ||
90 | + const dict = { | ||
91 | + '{width}': 300, | ||
92 | + '{height}': 300, | ||
93 | + '{mode}': 2 | ||
94 | + }; | ||
95 | + | ||
96 | + return dict[$0]; | ||
97 | + }) | ||
98 | + }); | ||
99 | + } | ||
100 | + }, | ||
47 | created() { | 101 | created() { |
102 | + $.get(`/news/misc_${this.id}.json`).then(result => { | ||
103 | + if (result.code === 200) { | ||
104 | + this.isFavorite = result.data.isFavor === 'Y'; | ||
105 | + this.isLiked = result.data.isPraise === 'Y'; | ||
106 | + } | ||
107 | + }); | ||
48 | } | 108 | } |
49 | }; | 109 | }; |
50 | </script> | 110 | </script> |
@@ -179,7 +179,7 @@ | @@ -179,7 +179,7 @@ | ||
179 | <span v-if="entity.isCollect === 'Y' " class="icon icon-love-solid"></span> | 179 | <span v-if="entity.isCollect === 'Y' " class="icon icon-love-solid"></span> |
180 | <span v-else class="icon icon-love"></span> | 180 | <span v-else class="icon icon-love"></span> |
181 | </button> | 181 | </button> |
182 | - <button class="button button-solid" style="flex: 2" | 182 | + <button class="button button-solid add-to-cart" |
183 | @click="showAddToCart()" | 183 | @click="showAddToCart()" |
184 | :disabled="isSoldOut"> | 184 | :disabled="isSoldOut"> |
185 | <span v-if="isSoldOut"> | 185 | <span v-if="isSoldOut"> |
@@ -292,10 +292,6 @@ | @@ -292,10 +292,6 @@ | ||
292 | } | 292 | } |
293 | 293 | ||
294 | .control-box { | 294 | .control-box { |
295 | - display: flex; | ||
296 | - flex-direction: row; | ||
297 | - justify-content: space-around; | ||
298 | - align-items: stretch; | ||
299 | position: fixed; | 295 | position: fixed; |
300 | width: 750px; | 296 | width: 750px; |
301 | height: 99px; | 297 | height: 99px; |
@@ -305,12 +301,13 @@ | @@ -305,12 +301,13 @@ | ||
305 | min-width: 100px; | 301 | min-width: 100px; |
306 | border: none; | 302 | border: none; |
307 | border-top: 1px solid #ccc; | 303 | border-top: 1px solid #ccc; |
308 | - flex: 1; | 304 | + width: 187.5px; |
305 | + float: left; | ||
306 | + display: block; | ||
309 | 307 | ||
310 | .icon { | 308 | .icon { |
311 | font-size: 40px; | 309 | font-size: 40px; |
312 | } | 310 | } |
313 | - | ||
314 | } | 311 | } |
315 | 312 | ||
316 | .control-button:first-child { | 313 | .control-button:first-child { |
@@ -321,6 +318,10 @@ | @@ -321,6 +318,10 @@ | ||
321 | font-size: 26px; | 318 | font-size: 26px; |
322 | } | 319 | } |
323 | 320 | ||
321 | + .add-to-cart { | ||
322 | + width: 375px; | ||
323 | + font-size: 28px; | ||
324 | + } | ||
324 | } | 325 | } |
325 | 326 | ||
326 | .horizon-wrapper { | 327 | .horizon-wrapper { |
@@ -404,7 +405,7 @@ | @@ -404,7 +405,7 @@ | ||
404 | data() { | 405 | data() { |
405 | return { | 406 | return { |
406 | yoho: yoho, | 407 | yoho: yoho, |
407 | - isApp: yoho.isApp, | 408 | + isApp: true || yoho.isApp, |
408 | intro: {}, | 409 | intro: {}, |
409 | firstImage: '', | 410 | firstImage: '', |
410 | entity: { | 411 | entity: { |
@@ -483,9 +484,9 @@ | @@ -483,9 +484,9 @@ | ||
483 | } else if (result.code === 403) { | 484 | } else if (result.code === 403) { |
484 | // 未登陆 | 485 | // 未登陆 |
485 | yoho.goLogin('', function() { | 486 | yoho.goLogin('', function() { |
486 | - | 487 | + this.toggleFavorite(); |
487 | }, function() { | 488 | }, function() { |
488 | - | 489 | + tip('登陆失败'); |
489 | }); | 490 | }); |
490 | } | 491 | } |
491 | }); | 492 | }); |
@@ -499,7 +500,11 @@ | @@ -499,7 +500,11 @@ | ||
499 | this.entity.isCollect = 'Y'; | 500 | this.entity.isCollect = 'Y'; |
500 | } else if (result.code === 403) { | 501 | } else if (result.code === 403) { |
501 | // 未登陆 | 502 | // 未登陆 |
502 | - yoho.goLogin(); | 503 | + yoho.goLogin('', function() { |
504 | + this.toggleFavorite(); | ||
505 | + }, function() { | ||
506 | + tip('登陆失败'); | ||
507 | + }); | ||
503 | } | 508 | } |
504 | }); | 509 | }); |
505 | } | 510 | } |
-
Please register or login to post a comment