Merge remote-tracking branch 'origin/master' into feature/refund
Showing
44 changed files
with
341 additions
and
155 deletions
@@ -39,6 +39,7 @@ module.exports = class extends global.yoho.BaseModel { | @@ -39,6 +39,7 @@ module.exports = class extends global.yoho.BaseModel { | ||
39 | getQuestionList() { | 39 | getQuestionList() { |
40 | return this.get({ | 40 | return this.get({ |
41 | url: 'activity/question/questionList', | 41 | url: 'activity/question/questionList', |
42 | + data: {uid: _.get(this.ctx, 'req.user.uid', 0)}, | ||
42 | api: global.yoho.ServiceAPI | 43 | api: global.yoho.ServiceAPI |
43 | }).then(result => { | 44 | }).then(result => { |
44 | let list = _.get(result, 'data.rows', []); | 45 | let list = _.get(result, 'data.rows', []); |
@@ -7,13 +7,9 @@ const shareBuyModel = require('../models/share-buy'), | @@ -7,13 +7,9 @@ const shareBuyModel = require('../models/share-buy'), | ||
7 | exports.index = (req, res, next) => { | 7 | exports.index = (req, res, next) => { |
8 | let activityId = req.query.act_id || 2023, | 8 | let activityId = req.query.act_id || 2023, |
9 | isApp = req.yoho.isApp, | 9 | isApp = req.yoho.isApp, |
10 | - uid = req.user.uid, | ||
11 | - protocol = req.app.locals.isProduction ? 'https:' : 'http:'; | ||
12 | - | ||
13 | - co(function* () { | ||
14 | - let isStudent = yield req.ctx(shareBuyModel).checkStudent(uid); | ||
15 | - let indexData = yield req.ctx(shareBuyModel).shareIndex(activityId, isApp, uid, isStudent, protocol); | 10 | + uid = req.user.uid; |
16 | 11 | ||
12 | + req.ctx(shareBuyModel).shareIndex(activityId, isApp, uid).then(indexData => { | ||
17 | res.render('share-buy/share-buy', { | 13 | res.render('share-buy/share-buy', { |
18 | pageHeader: headerModel.setNav({ | 14 | pageHeader: headerModel.setNav({ |
19 | navTitle: '分享购' | 15 | navTitle: '分享购' |
@@ -29,7 +25,7 @@ exports.index = (req, res, next) => { | @@ -29,7 +25,7 @@ exports.index = (req, res, next) => { | ||
29 | banner: indexData.banner, | 25 | banner: indexData.banner, |
30 | isStudent: indexData.isStudent | 26 | isStudent: indexData.isStudent |
31 | }); | 27 | }); |
32 | - })().catch(next); | 28 | + }).catch(next); |
33 | }; | 29 | }; |
34 | 30 | ||
35 | exports.detail = (req, res, next) => { | 31 | exports.detail = (req, res, next) => { |
@@ -73,3 +69,13 @@ exports.myRebeat = (req, res, next) => { | @@ -73,3 +69,13 @@ exports.myRebeat = (req, res, next) => { | ||
73 | }); | 69 | }); |
74 | }).catch(next); | 70 | }).catch(next); |
75 | }; | 71 | }; |
72 | + | ||
73 | +exports.getCouponCode = (req, res, next) => { | ||
74 | + let uid = req.user.uid, | ||
75 | + couponId = req.query.couponId, | ||
76 | + protocol = req.app.locals.isProduction ? 'https:' : 'http:'; | ||
77 | + | ||
78 | + req.ctx(shareBuyModel).getCouponCode(uid, couponId, protocol).then(result => { | ||
79 | + res.json(result); | ||
80 | + }) | ||
81 | +}; |
@@ -11,9 +11,9 @@ module.exports = class extends global.yoho.BaseModel { | @@ -11,9 +11,9 @@ module.exports = class extends global.yoho.BaseModel { | ||
11 | /** | 11 | /** |
12 | * 首页数据 | 12 | * 首页数据 |
13 | */ | 13 | */ |
14 | - shareIndex(activityId, isApp, uid, isStudent, protocol) { | 14 | + shareIndex(activityId, isApp, uid) { |
15 | 15 | ||
16 | - return api.all([this._CouponInfo(activityId, uid, isStudent), this._redeatList(), | 16 | + return api.all([this._CouponInfo(activityId, uid), this._redeatList(), |
17 | this._banner()]).then(result => { | 17 | this._banner()]).then(result => { |
18 | 18 | ||
19 | const indexData = { | 19 | const indexData = { |
@@ -23,8 +23,6 @@ module.exports = class extends global.yoho.BaseModel { | @@ -23,8 +23,6 @@ module.exports = class extends global.yoho.BaseModel { | ||
23 | const rebeatUrl = '//m.yohobuy.com/activity/share-buy/my-rebeat', | 23 | const rebeatUrl = '//m.yohobuy.com/activity/share-buy/my-rebeat', |
24 | strategyUrl = 'http://activity.yoho.cn/feature/115.html?share_id=2023&title=分享购攻略'; | 24 | strategyUrl = 'http://activity.yoho.cn/feature/115.html?share_id=2023&title=分享购攻略'; |
25 | 25 | ||
26 | - indexData.isStudent = isStudent; | ||
27 | - | ||
28 | if (result[0] && result[0].data && result[0].data.userCouponBoList) { | 26 | if (result[0] && result[0].data && result[0].data.userCouponBoList) { |
29 | _.forEach(result[0].data.userCouponBoList, function(val) { | 27 | _.forEach(result[0].data.userCouponBoList, function(val) { |
30 | 28 | ||
@@ -36,22 +34,8 @@ module.exports = class extends global.yoho.BaseModel { | @@ -36,22 +34,8 @@ module.exports = class extends global.yoho.BaseModel { | ||
36 | val.couponDescribe = '任意商品使用'; | 34 | val.couponDescribe = '任意商品使用'; |
37 | } else if (val.shopNames) { | 35 | } else if (val.shopNames) { |
38 | val.couponDescribe = '限' + val.shopNames + '使用'; | 36 | val.couponDescribe = '限' + val.shopNames + '使用'; |
39 | - } | ||
40 | - | ||
41 | - val.detailUrl = helpers.urlFormat('/activity/share-buy/detail', { | ||
42 | - couponId: val.couponId, | ||
43 | - couponCode: val.couponCode | ||
44 | - }); | ||
45 | - | ||
46 | - if (isApp) { | ||
47 | - val.detailUrl = protocol + val.detailUrl + | ||
48 | - '&openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"' + protocol + | ||
49 | - val.detailUrl + '","params":{"couponId":"' + val.couponId + '","couponCode":"' + | ||
50 | - val.couponCode + '"}}}'; | ||
51 | - } | ||
52 | - | ||
53 | - if (!indexData.isStudent) { | ||
54 | - val.detailUrl = ''; | 37 | + } else if (val.shareCoupon === '商品券') { |
38 | + val.couponDescribe = '指定商品可用'; | ||
55 | } | 39 | } |
56 | }); | 40 | }); |
57 | 41 | ||
@@ -102,12 +86,11 @@ module.exports = class extends global.yoho.BaseModel { | @@ -102,12 +86,11 @@ module.exports = class extends global.yoho.BaseModel { | ||
102 | /** | 86 | /** |
103 | * 首页获取优惠券信息 | 87 | * 首页获取优惠券信息 |
104 | */ | 88 | */ |
105 | - _CouponInfo(activityId, uid, isStudent) { | 89 | + _CouponInfo(activityId, uid) { |
106 | return api.get('', { | 90 | return api.get('', { |
107 | method: 'app.activity.getActivityCouponInfo', | 91 | method: 'app.activity.getActivityCouponInfo', |
108 | activity_id: activityId, | 92 | activity_id: activityId, |
109 | - uid: uid, | ||
110 | - isStudent: isStudent | 93 | + uid: uid |
111 | }, { | 94 | }, { |
112 | code: 200 | 95 | code: 200 |
113 | }).then((result) => { | 96 | }).then((result) => { |
@@ -145,7 +128,8 @@ module.exports = class extends global.yoho.BaseModel { | @@ -145,7 +128,8 @@ module.exports = class extends global.yoho.BaseModel { | ||
145 | code: 200 | 128 | code: 200 |
146 | }).then((result) => { | 129 | }).then((result) => { |
147 | let moreUrl, | 130 | let moreUrl, |
148 | - detailData; | 131 | + detailData, |
132 | + couponDetail = _.get(result, 'data.userCouponBoList[0]', {}); | ||
149 | 133 | ||
150 | if (result && result.code === 200 && result.data) { | 134 | if (result && result.code === 200 && result.data) { |
151 | detailData = _.assign(detailData, param); | 135 | detailData = _.assign(detailData, param); |
@@ -166,14 +150,17 @@ module.exports = class extends global.yoho.BaseModel { | @@ -166,14 +150,17 @@ module.exports = class extends global.yoho.BaseModel { | ||
166 | 150 | ||
167 | detailData.finish = parseInt(result.data.expiredTime, 10) > 0 ? false : true; | 151 | detailData.finish = parseInt(result.data.expiredTime, 10) > 0 ? false : true; |
168 | 152 | ||
169 | - if (result.data.userCouponBoList[0].sortNames) { | 153 | + if (couponDetail.sortNames) { |
170 | detailData.detailDes = '限品类: ' + result.data.userCouponBoList[0].sortNames; | 154 | detailData.detailDes = '限品类: ' + result.data.userCouponBoList[0].sortNames; |
171 | - } else if (result.data.userCouponBoList[0].brandNames) { | 155 | + } else if (couponDetail.brandNames) { |
172 | detailData.detailDes = '限品牌: ' + result.data.userCouponBoList[0].brandNames; | 156 | detailData.detailDes = '限品牌: ' + result.data.userCouponBoList[0].brandNames; |
173 | - } else if (result.data.userCouponBoList[0].shareCoupon === '全场通用') { | 157 | + } else if (couponDetail.shareCoupon === '全场通用') { |
174 | detailData.detailDes = result.data.userCouponBoList[0].shareCoupon; | 158 | detailData.detailDes = result.data.userCouponBoList[0].shareCoupon; |
175 | - } else if (result.data.userCouponBoList[0].shopNames) { | ||
176 | - detailData.detailDes = result.data.userCouponBoList[0].shopNames; | 159 | + } else if (couponDetail.shopNames) { |
160 | + detailData.detailDes = '限店铺:' + result.data.userCouponBoList[0].shopNames; | ||
161 | + } else if (couponDetail.shareCoupon === '商品券') { | ||
162 | + detailData.detailDes = '限商品:指定商品可用'; | ||
163 | + detailData.goodsCoupon = true; | ||
177 | } | 164 | } |
178 | 165 | ||
179 | detailData = _.assign(detailData, { | 166 | detailData = _.assign(detailData, { |
@@ -191,23 +178,24 @@ module.exports = class extends global.yoho.BaseModel { | @@ -191,23 +178,24 @@ module.exports = class extends global.yoho.BaseModel { | ||
191 | }); | 178 | }); |
192 | } | 179 | } |
193 | 180 | ||
194 | - /** | ||
195 | - * 判断是不是学生 | 181 | + /** |
182 | + * 获取分享码 | ||
196 | */ | 183 | */ |
197 | - checkStudent(uid) { | 184 | + getCouponCode(uid, couponId, protocol) { |
198 | return api.get('', { | 185 | return api.get('', { |
199 | - method: 'app.student.checkIsStudent', | ||
200 | - uid: uid | 186 | + method: 'app.activity.getActivityCouponCode', |
187 | + uid: uid, | ||
188 | + coupon_id: couponId | ||
201 | }).then(result => { | 189 | }).then(result => { |
202 | - | ||
203 | - let isStudent; | ||
204 | - | ||
205 | - if (result && result.data && result.code === 200) { | ||
206 | - isStudent = parseInt(result.data.isStudent, 10) === 1 ? true : false; | 190 | + if (result && result.code === 200 && result.data) { |
191 | + result.data.detailUrl = helpers.urlFormat('/activity/share-buy/detail', { | ||
192 | + couponId: couponId, | ||
193 | + couponCode: result.data.couponCode | ||
194 | + }); | ||
195 | + result.data.protocol = protocol; | ||
207 | } | 196 | } |
208 | 197 | ||
209 | - return isStudent; | ||
210 | - | 198 | + return result; |
211 | }); | 199 | }); |
212 | } | 200 | } |
213 | 201 |
@@ -257,7 +257,7 @@ router.get('/getCoupon', birthday.getCoupon); // 获取生日卷状态 | @@ -257,7 +257,7 @@ router.get('/getCoupon', birthday.getCoupon); // 获取生日卷状态 | ||
257 | router.get('/share-buy', update('5.7.0'), auth, shareBuy.index); // 分享购首页 | 257 | router.get('/share-buy', update('5.7.0'), auth, shareBuy.index); // 分享购首页 |
258 | router.get('/share-buy/detail', update('5.7.0'), shareBuy.detail); // 分享购详情页 | 258 | router.get('/share-buy/detail', update('5.7.0'), shareBuy.detail); // 分享购详情页 |
259 | router.get('/share-buy/my-rebeat', update('5.7.0'), auth, shareBuy.myRebeat); // 我的返利 | 259 | router.get('/share-buy/my-rebeat', update('5.7.0'), auth, shareBuy.myRebeat); // 我的返利 |
260 | - | 260 | +router.get('/share-buy/get-coupon-code', auth, shareBuy.getCouponCode); // 获取分享购券码 |
261 | 261 | ||
262 | router.get('/user-recommend', userRecommend.index); // 广点通投放落地页 | 262 | router.get('/user-recommend', userRecommend.index); // 广点通投放落地页 |
263 | router.get('/user-recommend/moreGoods', userRecommend.moreGoods); // 获取商品分页 | 263 | router.get('/user-recommend/moreGoods', userRecommend.moreGoods); // 获取商品分页 |
@@ -16,11 +16,7 @@ | @@ -16,11 +16,7 @@ | ||
16 | <p class="coupon-type">{{shareCouponType}}</p> | 16 | <p class="coupon-type">{{shareCouponType}}</p> |
17 | </div> | 17 | </div> |
18 | <div class="coupon-right"> | 18 | <div class="coupon-right"> |
19 | - {{#if detailUrl}} | ||
20 | - <a href="{{detailUrl}}" class="join">立即参与</a> | ||
21 | - {{else}} | ||
22 | - <span class="join">立即参与</span> | ||
23 | - {{/if}} | 19 | + <span class="join" data-id="{{couponId}}">立即参与</span> |
24 | <p class="coupon-mold">{{shareCoupon}}</p> | 20 | <p class="coupon-mold">{{shareCoupon}}</p> |
25 | <p class="coupon-limit">{{couponDescribe}}</p> | 21 | <p class="coupon-limit">{{couponDescribe}}</p> |
26 | </div> | 22 | </div> |
@@ -40,7 +40,13 @@ | @@ -40,7 +40,13 @@ | ||
40 | </div> | 40 | </div> |
41 | <div class="info-bottom"> | 41 | <div class="info-bottom"> |
42 | <span class="share-coupon">{{detailDes}}</span> | 42 | <span class="share-coupon">{{detailDes}}</span> |
43 | - <span class="coupon-tip">特列商品(秒杀、限定、境外、预售等)暂不支持使用优惠券。</span> | 43 | + <span class="coupon-tip"> |
44 | + {{#if goodsCoupon}} | ||
45 | + 下方为优惠劵适用商品,也可兑换劵码后到优惠券列表查看指定商品。 | ||
46 | + {{else}} | ||
47 | + 特列商品(秒杀、限定、境外、预售等)暂不支持使用优惠券。 | ||
48 | + {{/if}} | ||
49 | + </span> | ||
44 | <span class="validity">有效期: {{couponValidity}}</span> | 50 | <span class="validity">有效期: {{couponValidity}}</span> |
45 | </div> | 51 | </div> |
46 | 52 |
@@ -18,7 +18,9 @@ const index = (req, res) => { | @@ -18,7 +18,9 @@ const index = (req, res) => { | ||
18 | let isLogin = req.user && req.user.uid, | 18 | let isLogin = req.user && req.user.uid, |
19 | pageData = { | 19 | pageData = { |
20 | isLogin, | 20 | isLogin, |
21 | - signurl: helpers.urlFormat('/signin.html') | 21 | + signurl: helpers.urlFormat('/signin.html', { |
22 | + refer: req.originalUrl | ||
23 | + }) | ||
22 | }; | 24 | }; |
23 | 25 | ||
24 | // 唤起 APP 的路径 | 26 | // 唤起 APP 的路径 |
@@ -38,7 +40,8 @@ const index = (req, res) => { | @@ -38,7 +40,8 @@ const index = (req, res) => { | ||
38 | text: ' ' | 40 | text: ' ' |
39 | }, | 41 | }, |
40 | navBtn: false | 42 | navBtn: false |
41 | - }) | 43 | + }), |
44 | + isWechat: req.yoho.isWechat || req.yoho.isMarsApp // 默认判断微信,mars下同微信 | ||
42 | })); | 45 | })); |
43 | }; | 46 | }; |
44 | 47 |
@@ -129,6 +129,7 @@ const index = (params) => { | @@ -129,6 +129,7 @@ const index = (params) => { | ||
129 | signinUrl: helpers.urlFormat('/signin.html', { | 129 | signinUrl: helpers.urlFormat('/signin.html', { |
130 | refer: helpers.urlFormat('/home') | 130 | refer: helpers.urlFormat('/home') |
131 | }), | 131 | }), |
132 | + referUrl: helpers.urlFormat('/home'), | ||
132 | verifyUrl: helpers.urlFormat('/activity/student/register') | 133 | verifyUrl: helpers.urlFormat('/activity/student/register') |
133 | }; | 134 | }; |
134 | 135 |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | </label> | 9 | </label> |
10 | <label class="mobile"> | 10 | <label class="mobile"> |
11 | 联系电话: | 11 | 联系电话: |
12 | - <input type="text" name="mobile" value="{{address.mobile}}"> | 12 | + <input type="tel" name="mobile" value="{{address.mobile}}"> |
13 | </label> | 13 | </label> |
14 | <label class="area"> | 14 | <label class="area"> |
15 | 所在地区: | 15 | 所在地区: |
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | {{/unless}} | 20 | {{/unless}} |
21 | {{^}} | 21 | {{^}} |
22 | <div class="user-info"> | 22 | <div class="user-info"> |
23 | - <a class="login-btn" href="{{signinUrl}}"> | 23 | + <a class="login-btn" href="{{signinUrl}}" data-refer="{{referUrl}}"> |
24 | 登录/注册 | 24 | 登录/注册 |
25 | </a> | 25 | </a> |
26 | {{#if @root.studentSwitch}} | 26 | {{#if @root.studentSwitch}} |
@@ -106,7 +106,7 @@ | @@ -106,7 +106,7 @@ | ||
106 | </a> | 106 | </a> |
107 | </div> | 107 | </div> |
108 | <div class="group-list"> | 108 | <div class="group-list"> |
109 | - <a class="list-item invite" href="https://activity.yoho.cn/feature/357.html?share_id=2391&title="> | 109 | + <a class="list-item invite" href="http://activity.yoho.cn/feature/357.html?share_id=2391&title=邀请好友50元现金券无限赚"> |
110 | <span class="horn"></span> | 110 | <span class="horn"></span> |
111 | 邀请好友,50元现金券无限赚 | 111 | 邀请好友,50元现金券无限赚 |
112 | <span class="iconfont num"></span> | 112 | <span class="iconfont num"></span> |
@@ -13,7 +13,7 @@ const list = (req, res, next) => { | @@ -13,7 +13,7 @@ const list = (req, res, next) => { | ||
13 | } | 13 | } |
14 | 14 | ||
15 | let param = { | 15 | let param = { |
16 | - limit: 12, | 16 | + limit: 24, |
17 | order: 's_t_desc', | 17 | order: 's_t_desc', |
18 | page: 1, | 18 | page: 1, |
19 | uid: req.user.uid || 0 | 19 | uid: req.user.uid || 0 |
@@ -228,7 +228,7 @@ const category = (req, res, next) => { | @@ -228,7 +228,7 @@ const category = (req, res, next) => { | ||
228 | type: 'default', | 228 | type: 'default', |
229 | order: '0', | 229 | order: '0', |
230 | page: 1, | 230 | page: 1, |
231 | - limit: 12, | 231 | + limit: 24, |
232 | isApp: params.app_version | 232 | isApp: params.app_version |
233 | }, params); | 233 | }, params); |
234 | 234 |
@@ -71,7 +71,8 @@ const newDetail = { | @@ -71,7 +71,8 @@ const newDetail = { | ||
71 | `YOHO!BUY 有货${result.brandName}官网专卖店提供${result.brandName}正品、${result.brandName}真品、 ${result.brandName}打折、${result.brandName}代购等。`, // eslint-disable-line | 71 | `YOHO!BUY 有货${result.brandName}官网专卖店提供${result.brandName}正品、${result.brandName}真品、 ${result.brandName}打折、${result.brandName}代购等。`, // eslint-disable-line |
72 | pageFooter: true, | 72 | pageFooter: true, |
73 | localCss: true, | 73 | localCss: true, |
74 | - appPath: appPath | 74 | + appPath: appPath, |
75 | + isMarsApp: req.yoho.isMarsApp // 判断mars | ||
75 | }); | 76 | }); |
76 | }).catch(next); | 77 | }).catch(next); |
77 | }, | 78 | }, |
@@ -334,7 +334,8 @@ const shop = { | @@ -334,7 +334,8 @@ const shop = { | ||
334 | shopPage: true, | 334 | shopPage: true, |
335 | appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shop","params":{"shop_template_type":"2","shop_id":"' + | 335 | appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shop","params":{"shop_template_type":"2","shop_id":"' + |
336 | shopId + '","shop_name":"' + result.seoTitle + '"}}', | 336 | shopId + '","shop_name":"' + result.seoTitle + '"}}', |
337 | - localCss: true | 337 | + localCss: true, |
338 | + isMarsApp: req.yoho.isMarsApp | ||
338 | }); | 339 | }); |
339 | 340 | ||
340 | }); | 341 | }); |
@@ -37,7 +37,7 @@ const blkNewGoods = (req, res, next) => { | @@ -37,7 +37,7 @@ const blkNewGoods = (req, res, next) => { | ||
37 | type: 'default', | 37 | type: 'default', |
38 | order: '0', | 38 | order: '0', |
39 | page: 1, | 39 | page: 1, |
40 | - limit: 12, | 40 | + limit: 24, |
41 | isApp: params.app_version | 41 | isApp: params.app_version |
42 | }, params); | 42 | }, params); |
43 | 43 |
@@ -504,7 +504,7 @@ const getSearchKeywordData = (params, uid) => { | @@ -504,7 +504,7 @@ const getSearchKeywordData = (params, uid) => { | ||
504 | type: 'default', | 504 | type: 'default', |
505 | order: '0', | 505 | order: '0', |
506 | page: 1, | 506 | page: 1, |
507 | - limit: 12 | 507 | + limit: 24 |
508 | }, params); | 508 | }, params); |
509 | 509 | ||
510 | if (uid) { | 510 | if (uid) { |
@@ -14,8 +14,8 @@ const domains = { | @@ -14,8 +14,8 @@ const domains = { | ||
14 | // api: 'http://192.168.103.59:8080/gateway', | 14 | // api: 'http://192.168.103.59:8080/gateway', |
15 | // service: 'http://192.168.103.59:8080/gateway', | 15 | // service: 'http://192.168.103.59:8080/gateway', |
16 | 16 | ||
17 | - api: 'http://api-test2.yohops.com:9999/', | ||
18 | - service: 'http://service-test2.yohops.com:9999/', | 17 | + api: 'http://api-test3.yohops.com:9999/', |
18 | + service: 'http://service-test3.yohops.com:9999/', | ||
19 | singleApi: 'http://api-test2.yohops.com:9999/', | 19 | singleApi: 'http://api-test2.yohops.com:9999/', |
20 | global: 'http://global-test-soa.yohops.com:9999', | 20 | global: 'http://global-test-soa.yohops.com:9999', |
21 | liveApi: 'http://testapi.live.yohops.com:9999/', | 21 | liveApi: 'http://testapi.live.yohops.com:9999/', |
@@ -26,7 +26,7 @@ const domains = { | @@ -26,7 +26,7 @@ const domains = { | ||
26 | 26 | ||
27 | module.exports = { | 27 | module.exports = { |
28 | app: 'h5', | 28 | app: 'h5', |
29 | - appVersion: '5.9.0', // 调用api的版本 | 29 | + appVersion: '5.9.1', // 调用api的版本 |
30 | port: 6001, | 30 | port: 6001, |
31 | siteUrl: '//m.yohobuy.com', | 31 | siteUrl: '//m.yohobuy.com', |
32 | assetUrl: '//127.0.0.1:5001', | 32 | assetUrl: '//127.0.0.1:5001', |
@@ -23,6 +23,9 @@ module.exports = () => { | @@ -23,6 +23,9 @@ module.exports = () => { | ||
23 | if (req.query.nogoback || req.cookies.nogoback) { | 23 | if (req.query.nogoback || req.cookies.nogoback) { |
24 | res.locals.nogoback = true; | 24 | res.locals.nogoback = true; |
25 | } | 25 | } |
26 | + if (req.yoho.isMarsApp) { | ||
27 | + res.locals.nodownload = true; | ||
28 | + } | ||
26 | 29 | ||
27 | next(); | 30 | next(); |
28 | }; | 31 | }; |
@@ -67,7 +67,7 @@ exports.serverError = () => { | @@ -67,7 +67,7 @@ exports.serverError = () => { | ||
67 | return res.render('error/app-auth', { | 67 | return res.render('error/app-auth', { |
68 | module: 'common', | 68 | module: 'common', |
69 | page: 'app-redirect-login', | 69 | page: 'app-redirect-login', |
70 | - message: '验证失败,请登录', | 70 | + message: '请登录', |
71 | localCss: true, | 71 | localCss: true, |
72 | refer: err.refer | 72 | refer: err.refer |
73 | }); | 73 | }); |
@@ -104,7 +104,13 @@ const sortParams = (req, res, next) => { | @@ -104,7 +104,13 @@ const sortParams = (req, res, next) => { | ||
104 | if (_.every(matched, match => match)) { | 104 | if (_.every(matched, match => match)) { |
105 | return next(); | 105 | return next(); |
106 | } else { | 106 | } else { |
107 | - return res.redirect(helpers.urlFormat('/', sorts, 'list')); | 107 | + let subdomain = 'list'; |
108 | + | ||
109 | + if (req.hostname.indexOf('search') === 0) { | ||
110 | + subdomain = 'search'; | ||
111 | + } | ||
112 | + | ||
113 | + return res.redirect(helpers.urlFormat('/', sorts, subdomain)); | ||
108 | } | 114 | } |
109 | }; | 115 | }; |
110 | 116 |
@@ -43,8 +43,6 @@ module.exports = () => { | @@ -43,8 +43,6 @@ module.exports = () => { | ||
43 | pageChannel: {} | 43 | pageChannel: {} |
44 | }; | 44 | }; |
45 | 45 | ||
46 | - let ua = (req.get('User-Agent') || '').toLowerCase(); | ||
47 | - | ||
48 | const channel = req.query.channel || req.cookies._Channel || 'boys'; | 46 | const channel = req.query.channel || req.cookies._Channel || 'boys'; |
49 | 47 | ||
50 | // IP 地址 | 48 | // IP 地址 |
@@ -57,12 +55,15 @@ module.exports = () => { | @@ -57,12 +55,15 @@ module.exports = () => { | ||
57 | yoho.channel = channel; | 55 | yoho.channel = channel; |
58 | 56 | ||
59 | // 判断请求是否来自app | 57 | // 判断请求是否来自app |
60 | - yoho.isApp = (req.query.app_version && req.query.app_version !== 'false') || | ||
61 | - (req.query.appVersion && req.query.appVersion !== 'false') || | ||
62 | - req.cookies.app_version || /YohoBuy/i.test(req.get('User-Agent') || ''); | 58 | + yoho.isMarsApp = /yohomars/i.test(req.get('User-Agent') || ''); |
59 | + yoho.isApp = yoho.isMarsApp || | ||
60 | + req.cookies.app_version || | ||
61 | + /YohoBuy/i.test(req.get('User-Agent') || '') || | ||
62 | + (req.query.app_version && req.query.app_version !== 'false') || | ||
63 | + (req.query.appVersion && req.query.appVersion !== 'false'); | ||
63 | yoho.isMobile = /(nokia|iphone|android|ipad|motorola|^mot\-|softbank|foma|docomo|kddi|up\.browser|up\.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte\-|longcos|pantech|gionee|^sie\-|portalmmm|jig\s browser|hiptop|^ucweb|^benq|haier|^lct|opera\s*mobi|opera\*mini|320x320|240x320|176x220)/i.test(req.get('User-Agent') || ''); // eslint-disable-line | 64 | yoho.isMobile = /(nokia|iphone|android|ipad|motorola|^mot\-|softbank|foma|docomo|kddi|up\.browser|up\.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte\-|longcos|pantech|gionee|^sie\-|portalmmm|jig\s browser|hiptop|^ucweb|^benq|haier|^lct|opera\s*mobi|opera\*mini|320x320|240x320|176x220)/i.test(req.get('User-Agent') || ''); // eslint-disable-line |
64 | yoho.isWechat = /micromessenger/i.test(req.get('User-Agent') || ''); | 65 | yoho.isWechat = /micromessenger/i.test(req.get('User-Agent') || ''); |
65 | - yoho.isWeibo = ua.indexOf('weibo') !== -1; | 66 | + yoho.isWeibo = /weibo/i.test(req.get('User-Agent') || ''); |
66 | yoho.isqq = /MQQBrowser/i.test(req.get('User-Agent') || ''); | 67 | yoho.isqq = /MQQBrowser/i.test(req.get('User-Agent') || ''); |
67 | 68 | ||
68 | Object.assign(res.locals, yoho); | 69 | Object.assign(res.locals, yoho); |
@@ -77,6 +77,8 @@ module.exports = () => { | @@ -77,6 +77,8 @@ module.exports = () => { | ||
77 | res.cookie('app_version', appVersion); | 77 | res.cookie('app_version', appVersion); |
78 | res.cookie('app_client_type', appSessionType); | 78 | res.cookie('app_client_type', appSessionType); |
79 | } | 79 | } |
80 | + | ||
81 | + | ||
80 | next(); | 82 | next(); |
81 | }; | 83 | }; |
82 | }; | 84 | }; |
@@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
59 | <link rel="apple-touch-startup-image" sizes="640x920" href="http://static.yohobuy.com/m/v1/img/startup/startup-retina.png" media="screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)"> | 59 | <link rel="apple-touch-startup-image" sizes="640x920" href="http://static.yohobuy.com/m/v1/img/startup/startup-retina.png" media="screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)"> |
60 | <link rel="apple-touch-startup-image" sizes="320x460" href="http://static.yohobuy.com/m/v1/img/startup/startup.png" media="screen and (max-device-width: 320)"> | 60 | <link rel="apple-touch-startup-image" sizes="320x460" href="http://static.yohobuy.com/m/v1/img/startup/startup.png" media="screen and (max-device-width: 320)"> |
61 | </head> | 61 | </head> |
62 | - <body class="{{pageStyle}} {{#if isWechat}}wechat-body{{/if}} {{#if width750}}width750{{/if}} {{#if isPassportPage}}passport-body{{/if}} {{#if isStarIndexPage}}star-index-bg{{/if}} {{#if isStarDetailPage}}star-class-body{{/if}} {{#if isInstallmentPage}}installment-body{{/if}}"> | 62 | + <body class="{{pageStyle}} {{#if isWechat}}wechat-body{{/if}} {{#if isMarsApp}}is-mars-app{{/if}} {{#if width750}}width750{{/if}} {{#if isPassportPage}}passport-body{{/if}} {{#if isStarIndexPage}}star-index-bg{{/if}} {{#if isStarDetailPage}}star-class-body{{/if}} {{#if isInstallmentPage}}installment-body{{/if}}"> |
63 | <div class="main-wrap" id="main-wrap" {{#if appPath}}data-apppath='{{{appPath}}}'{{/if}}> | 63 | <div class="main-wrap" id="main-wrap" {{#if appPath}}data-apppath='{{{appPath}}}'{{/if}}> |
64 | {{#if systemUpdate}} | 64 | {{#if systemUpdate}} |
65 | {{> updata}} | 65 | {{> updata}} |
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | a.async = 1; | 12 | a.async = 1; |
13 | a.src = j; | 13 | a.src = j; |
14 | m.parentNode.insertBefore(a, m); | 14 | m.parentNode.insertBefore(a, m); |
15 | - }(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.4.1/yas.js', '_yas')); | 15 | + }(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.4.2/yas.js', '_yas')); |
16 | 16 | ||
17 | var _hmt = _hmt || []; | 17 | var _hmt = _hmt || []; |
18 | 18 | ||
@@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
56 | uid = uid === 0 ? '' : uid; | 56 | uid = uid === 0 ? '' : uid; |
57 | window._ozuid = uid; // 暴露ozuid | 57 | window._ozuid = uid; // 暴露ozuid |
58 | if (window._yas) { | 58 | if (window._yas) { |
59 | - window._yas(1 * new Date(), '2.4.1', 'yohobuy_m', uid, '', ''); | 59 | + window._yas(1 * new Date(), '2.4.2', 'yohobuy_m', uid, '', ''); |
60 | } | 60 | } |
61 | 61 | ||
62 | setTimeout(function() { | 62 | setTimeout(function() { |
@@ -220,8 +220,14 @@ let question = { | @@ -220,8 +220,14 @@ let question = { | ||
220 | } | 220 | } |
221 | }).then(function(data) { | 221 | }).then(function(data) { |
222 | that.saving = false; | 222 | that.saving = false; |
223 | - if (data.code === 200) { | ||
224 | - tipDg.show('调查问卷已成功提交,感谢您的帮助!'); | 223 | + if (data.code === 200 || data.code === 206) { |
224 | + let tip = '调查问卷已成功提交,感谢您的帮助!'; | ||
225 | + | ||
226 | + if (data.code === 206 && data.message) { | ||
227 | + tip = data.message; | ||
228 | + } | ||
229 | + | ||
230 | + tipDg.show(tip); | ||
225 | 231 | ||
226 | setTimeout(function() { | 232 | setTimeout(function() { |
227 | if (yoho.isApp) { | 233 | if (yoho.isApp) { |
@@ -2,8 +2,8 @@ | @@ -2,8 +2,8 @@ | ||
2 | require('activity/share-buy.page.css'); | 2 | require('activity/share-buy.page.css'); |
3 | 3 | ||
4 | let $ = require('yoho-jquery'), | 4 | let $ = require('yoho-jquery'), |
5 | - dialog = require('plugin/dialog'), | ||
6 | - yoho = require('yoho-app'); | 5 | + yoho = require('yoho-app'), |
6 | + tip = require('plugin/tip'); | ||
7 | 7 | ||
8 | let $news = $('.news'), | 8 | let $news = $('.news'), |
9 | newsLiL = $news.find('li').length, | 9 | newsLiL = $news.find('li').length, |
@@ -12,7 +12,7 @@ let $news = $('.news'), | @@ -12,7 +12,7 @@ let $news = $('.news'), | ||
12 | let shareData = { | 12 | let shareData = { |
13 | title: '【有货】参与分享购,大家一起拿返利~', | 13 | title: '【有货】参与分享购,大家一起拿返利~', |
14 | link: location.href, | 14 | link: location.href, |
15 | - desc: '学生用户专享,返利升级购物可直接抵现金,超级福利等你来嗨~', | 15 | + desc: '返利升级购物可直接抵现金,超级福利等你来嗨~', |
16 | imgUrl: 'http://img11.static.yhbimg.com/yhb-img01/2017/05/10/16/011568a808f9b10e098b6542d3a8cb3d6b.png' | 16 | imgUrl: 'http://img11.static.yhbimg.com/yhb-img01/2017/05/10/16/011568a808f9b10e098b6542d3a8cb3d6b.png' |
17 | }; | 17 | }; |
18 | 18 | ||
@@ -58,17 +58,27 @@ if (newsLiL > 1) { | @@ -58,17 +58,27 @@ if (newsLiL > 1) { | ||
58 | } | 58 | } |
59 | 59 | ||
60 | $('.join').click(function() { | 60 | $('.join').click(function() { |
61 | - if ($('.coupon-list').data('student') === false) { | ||
62 | 61 | ||
63 | - dialog.showDialog({ | ||
64 | - dialogText: '完成学生认证即可参与活动哦~', | ||
65 | - fast: true, | ||
66 | - hasFooter: { | ||
67 | - rightBtnText: '去认证' | 62 | + $.ajax({ |
63 | + type: 'GET', | ||
64 | + url: '/activity/share-buy/get-coupon-code', | ||
65 | + data: { | ||
66 | + couponId: $(this).data('id') | ||
67 | + }, | ||
68 | + success: function(result) { | ||
69 | + | ||
70 | + if (result.code === 200) { | ||
71 | + let link = result.data.detailUrl; | ||
72 | + | ||
73 | + if (yoho.isApp) { | ||
74 | + link = result.data.protocol + link; | ||
75 | + yoho.goH5(link); | ||
76 | + } else { | ||
77 | + window.location.href = link; | ||
78 | + } | ||
79 | + } else { | ||
80 | + tip.show(result.message); | ||
68 | } | 81 | } |
69 | - }, function() { | ||
70 | - | ||
71 | - yoho.goH5('http://m.yohobuy.com/activity/student/register', '{"action":"go.h5","params":{"islogin":"N","type":"13","url":"http://m.yohobuy.com/activity/student/register"}}'); | ||
72 | - }, null, true); | ||
73 | - } | 82 | + } |
83 | + }); | ||
74 | }); | 84 | }); |
@@ -20,20 +20,23 @@ let params = { | @@ -20,20 +20,23 @@ let params = { | ||
20 | endTime: [endTime] // 时间差数组 | 20 | endTime: [endTime] // 时间差数组 |
21 | }; | 21 | }; |
22 | 22 | ||
23 | -let noResultHbs = require('product/search/no-result-new.hbs'); | 23 | +let couponSum = $('.coupon-money').find('span').text(); |
24 | 24 | ||
25 | let shareData = { | 25 | let shareData = { |
26 | - title: '发福利啦!专享优惠速来领~', | 26 | + title: '【YOHO!BUY有货】送你' + couponSum + '元专享福利啦!速来领~', |
27 | link: location.href, | 27 | link: location.href, |
28 | - desc: '来YOHO玩潮流~甄选好货等你来BUY~', | 28 | + desc: '1400+潮流品牌每日上新,等你来BUY!', |
29 | imgUrl: 'http://img11.static.yhbimg.com/yhb-img01/2017/05/10/16/011568a808f9b10e098b6542d3a8cb3d6b.png' | 29 | imgUrl: 'http://img11.static.yhbimg.com/yhb-img01/2017/05/10/16/011568a808f9b10e098b6542d3a8cb3d6b.png' |
30 | - | ||
31 | }; | 30 | }; |
32 | 31 | ||
33 | let appVersion, link; | 32 | let appVersion, link; |
34 | 33 | ||
35 | let couponId = $('.coupon-info').data('id'); | 34 | let couponId = $('.coupon-info').data('id'); |
36 | 35 | ||
36 | +let initial = true; | ||
37 | +let beforeScroll = document.body.scrollTop; // 滚动前位置记录 | ||
38 | +let listEnd = false; | ||
39 | + | ||
37 | require('common/share')(shareData); | 40 | require('common/share')(shareData); |
38 | require('common'); | 41 | require('common'); |
39 | 42 | ||
@@ -42,6 +45,10 @@ if (yoho.isApp) { | @@ -42,6 +45,10 @@ if (yoho.isApp) { | ||
42 | 45 | ||
43 | shareData.link = link; | 46 | shareData.link = link; |
44 | 47 | ||
48 | + if (yoho.isAndroid) { | ||
49 | + shareData.desc = encodeURIComponent('1400+潮流品牌每日上新,等你来BUY!'); | ||
50 | + } | ||
51 | + | ||
45 | yoho.ready(function() { | 52 | yoho.ready(function() { |
46 | yoho.invokeMethod('set.shareInfo', shareData); | 53 | yoho.invokeMethod('set.shareInfo', shareData); |
47 | }); | 54 | }); |
@@ -111,6 +118,10 @@ function productData() { | @@ -111,6 +118,10 @@ function productData() { | ||
111 | noLazy: true, | 118 | noLazy: true, |
112 | }; | 119 | }; |
113 | 120 | ||
121 | + if (listEnd) { | ||
122 | + return false; | ||
123 | + } | ||
124 | + | ||
114 | if (appVersion) { | 125 | if (appVersion) { |
115 | setting.app_version = appVersion; | 126 | setting.app_version = appVersion; |
116 | } | 127 | } |
@@ -125,6 +136,7 @@ function productData() { | @@ -125,6 +136,7 @@ function productData() { | ||
125 | 136 | ||
126 | if (!onloading) { | 137 | if (!onloading) { |
127 | onloading = true; | 138 | onloading = true; |
139 | + page = page + 1; | ||
128 | 140 | ||
129 | $.ajax({ | 141 | $.ajax({ |
130 | type: 'GET', | 142 | type: 'GET', |
@@ -133,20 +145,28 @@ function productData() { | @@ -133,20 +145,28 @@ function productData() { | ||
133 | xhrFields: { | 145 | xhrFields: { |
134 | withCredentials: true | 146 | withCredentials: true |
135 | }, | 147 | }, |
148 | + complete: function() { | ||
149 | + onloading = false; | ||
150 | + }, | ||
136 | success: function(data) { | 151 | success: function(data) { |
137 | 152 | ||
138 | if (data === '' || (data.list && data.list.length <= 0)) { | 153 | if (data === '' || (data.list && data.list.length <= 0)) { |
139 | - $container.html(noResultHbs()); | 154 | + |
155 | + if (initial) { | ||
156 | + $('.commodity').hide(); | ||
157 | + } | ||
158 | + | ||
159 | + listEnd = true; | ||
160 | + | ||
161 | + return false; | ||
140 | } else { | 162 | } else { |
141 | $container.append(data); | 163 | $container.append(data); |
142 | } | 164 | } |
143 | 165 | ||
144 | - onloading = false; | 166 | + initial = false; |
145 | } | 167 | } |
146 | }); | 168 | }); |
147 | } | 169 | } |
148 | - | ||
149 | - page = page + 1; | ||
150 | } | 170 | } |
151 | 171 | ||
152 | // 滚动加载 | 172 | // 滚动加载 |
@@ -160,7 +180,16 @@ function scrollHandler() { | @@ -160,7 +180,16 @@ function scrollHandler() { | ||
160 | } | 180 | } |
161 | 181 | ||
162 | $(window).scroll(function() { | 182 | $(window).scroll(function() { |
163 | - window.requestAnimationFrame(scrollHandler); | 183 | + setTimeout(function() { |
184 | + let afterScroll = document.body.scrollTop; | ||
185 | + | ||
186 | + if (afterScroll - beforeScroll > 0) { | ||
187 | + window.requestAnimationFrame(scrollHandler); | ||
188 | + beforeScroll = afterScroll; | ||
189 | + } else { | ||
190 | + return false; | ||
191 | + } | ||
192 | + }, 5); | ||
164 | }); | 193 | }); |
165 | 194 | ||
166 | $(function() { | 195 | $(function() { |
@@ -256,28 +256,30 @@ $.extend({ | @@ -256,28 +256,30 @@ $.extend({ | ||
256 | 5. yas的cookies 种在 .yohobuy.com 根域下 | 256 | 5. yas的cookies 种在 .yohobuy.com 根域下 |
257 | 257 | ||
258 | 周奇琪 | 258 | 周奇琪 |
259 | - */ | ||
260 | - | ||
261 | - let isWechat = /micromessenger/i.test(navigator.userAgent || ''); | ||
262 | - let mktc = queryString().mkt_code || queryString().union_type || ''; | ||
263 | 259 | ||
264 | - function saveMktCode() { | ||
265 | - if (mktc) { | ||
266 | - setCookie('mkt_code', mktc, { | ||
267 | - path: '/', | ||
268 | - domain: 'yohobuy.com', | ||
269 | - expires: 7 // 7天 | ||
270 | - }); | ||
271 | - } | ||
272 | - } | 260 | + mkt_code 控制移动到 YAS 2017.07.13 |
261 | + */ | ||
273 | 262 | ||
274 | - if (isWechat) { | ||
275 | - saveMktCode(); | ||
276 | - } else { | ||
277 | - if (!cookie('mkt_code') || mktc === '100000000000349') { | ||
278 | - saveMktCode(); | ||
279 | - } | ||
280 | - } | 263 | + // let isWechat = /micromessenger/i.test(navigator.userAgent || ''); |
264 | + // let mktc = queryString().mkt_code || queryString().union_type || ''; | ||
265 | + | ||
266 | + // function saveMktCode() { | ||
267 | + // if (mktc) { | ||
268 | + // setCookie('mkt_code', mktc, { | ||
269 | + // path: '/', | ||
270 | + // domain: 'yohobuy.com', | ||
271 | + // expires: 7 // 7天 | ||
272 | + // }); | ||
273 | + // } | ||
274 | + // } | ||
275 | + | ||
276 | + // if (isWechat) { | ||
277 | + // saveMktCode(); | ||
278 | + // } else { | ||
279 | + // if (!cookie('mkt_code') || mktc === '100000000000349') { | ||
280 | + // saveMktCode(); | ||
281 | + // } | ||
282 | + // } | ||
281 | 283 | ||
282 | // 尝试打开 APP | 284 | // 尝试打开 APP |
283 | require('./common/open-app'); | 285 | require('./common/open-app'); |
@@ -186,16 +186,18 @@ class ChosePanel { | @@ -186,16 +186,18 @@ class ChosePanel { | ||
186 | $yohoPage.on('touchstart', '#chose-btn-buynow', (e) => { | 186 | $yohoPage.on('touchstart', '#chose-btn-buynow', (e) => { |
187 | let sku = this._checkSku(this.buyNum); | 187 | let sku = this._checkSku(this.buyNum); |
188 | 188 | ||
189 | - window._yas.sendCustomInfo({ | ||
190 | - op: 'YB_GDS_BUYNOW_BTN', | ||
191 | - param: JSON.stringify({ | ||
192 | - C_ID: this.C_ID, | ||
193 | - PRD_ID: this.data.cartInfo.productId, | ||
194 | - PRD_NUM: this.buyNum, | ||
195 | - PRD_SKN: this.data.cartInfo.productSkn, | ||
196 | - PRD_SKU: sku && sku.skuId | ||
197 | - }) | ||
198 | - }, true); | 189 | + if (window._yas && window._yas.sendCustomInfo) { |
190 | + window._yas.sendCustomInfo({ | ||
191 | + op: 'YB_GDS_BUYNOW_BTN', | ||
192 | + param: JSON.stringify({ | ||
193 | + C_ID: this.C_ID, | ||
194 | + PRD_ID: this.data.cartInfo.productId, | ||
195 | + PRD_NUM: this.buyNum, | ||
196 | + PRD_SKN: this.data.cartInfo.productSkn, | ||
197 | + PRD_SKU: sku && sku.skuId | ||
198 | + }) | ||
199 | + }, true); | ||
200 | + } | ||
199 | return this._choseBtnSureClick(e, true); | 201 | return this._choseBtnSureClick(e, true); |
200 | }); | 202 | }); |
201 | } | 203 | } |
@@ -71,6 +71,7 @@ $usernameInput.bind('input propertychange', function() { | @@ -71,6 +71,7 @@ $usernameInput.bind('input propertychange', function() { | ||
71 | // 提交表单请求 | 71 | // 提交表单请求 |
72 | $addressForm.on('submit', function() { | 72 | $addressForm.on('submit', function() { |
73 | let username = $usernameInput.val().replace(/(^\s+)|(\s+$)/g, ''); | 73 | let username = $usernameInput.val().replace(/(^\s+)|(\s+$)/g, ''); |
74 | + let phone = $(this).find('[name="mobile"]').val(); | ||
74 | 75 | ||
75 | if (isSubmiting) { | 76 | if (isSubmiting) { |
76 | return false; | 77 | return false; |
@@ -95,6 +96,12 @@ $addressForm.on('submit', function() { | @@ -95,6 +96,12 @@ $addressForm.on('submit', function() { | ||
95 | tip.show('手机号不能为空'); | 96 | tip.show('手机号不能为空'); |
96 | return false; | 97 | return false; |
97 | } | 98 | } |
99 | + | ||
100 | + if (!(/^[0-9]{11}$/.test(phone))) { | ||
101 | + tip.show('请填写正确的手机号'); | ||
102 | + return false; | ||
103 | + } | ||
104 | + | ||
98 | if (!$(this).find('[name="area_code"]').val() || !$(this).find('[name="area"]').val() || | 105 | if (!$(this).find('[name="area_code"]').val() || !$(this).find('[name="area"]').val() || |
99 | $(this).find('[name="area_code"]').val().length < 6) { | 106 | $(this).find('[name="area_code"]').val().length < 6) { |
100 | tip.show('省市区不能为空'); | 107 | tip.show('省市区不能为空'); |
@@ -17,7 +17,7 @@ let introUrl = $('#introUrl').val(), | @@ -17,7 +17,7 @@ let introUrl = $('#introUrl').val(), | ||
17 | end = false; | 17 | end = false; |
18 | 18 | ||
19 | $('#is-deposit-advance').on('click', function() { | 19 | $('#is-deposit-advance').on('click', function() { |
20 | - tip.show('定金预售商品只能在APP端购买'); | 20 | + tip.show('定金预售商品只能在有货App购买'); |
21 | }); | 21 | }); |
22 | 22 | ||
23 | // 判断是否要显示向左滑动提示 | 23 | // 判断是否要显示向左滑动提示 |
1 | let $ = require('yoho-jquery'), | 1 | let $ = require('yoho-jquery'), |
2 | - tip = require('plugin/tip'); | 2 | + tip = require('plugin/tip'), |
3 | + yoho = require('yoho-app'); | ||
3 | 4 | ||
4 | let functions = { | 5 | let functions = { |
5 | /** | 6 | /** |
@@ -68,6 +69,17 @@ let functions = { | @@ -68,6 +69,17 @@ let functions = { | ||
68 | * 添加到购物车 | 69 | * 添加到购物车 |
69 | */ | 70 | */ |
70 | addToCart(sku, skn, buyNum) { | 71 | addToCart(sku, skn, buyNum) { |
72 | + if (!yoho.isLogin()) { | ||
73 | + let preInfo = `${sku}_${skn}_${buyNum}`; | ||
74 | + let actCkOpthn = { | ||
75 | + path: '/', | ||
76 | + expires: 1 | ||
77 | + }; | ||
78 | + | ||
79 | + window.setCookie('tmp-cart-info', preInfo, actCkOpthn); | ||
80 | + window.location.href = '//m.yohobuy.com/signin.html?refer=' + encodeURIComponent(window.location.href); | ||
81 | + return false; | ||
82 | + } | ||
71 | if (window._yas && window._yas.sendCustomInfo) { | 83 | if (window._yas && window._yas.sendCustomInfo) { |
72 | window._yas.sendCustomInfo({ | 84 | window._yas.sendCustomInfo({ |
73 | op: 'YB_GDS_DT_ADD_TO_SC', | 85 | op: 'YB_GDS_DT_ADD_TO_SC', |
@@ -100,6 +112,7 @@ let functions = { | @@ -100,6 +112,7 @@ let functions = { | ||
100 | cartNum = '99+'; | 112 | cartNum = '99+'; |
101 | } | 113 | } |
102 | $('.num-tag').html(cartNum).removeClass('hide'); | 114 | $('.num-tag').html(cartNum).removeClass('hide'); |
115 | + window.setCookie('tmp-cart-info', ''); | ||
103 | } | 116 | } |
104 | 117 | ||
105 | if (res.message) { | 118 | if (res.message) { |
@@ -151,7 +151,7 @@ function render(data) { | @@ -151,7 +151,7 @@ function render(data) { | ||
151 | if (data.isDepositAdvance === 'Y') { | 151 | if (data.isDepositAdvance === 'Y') { |
152 | setTimeout(function() { | 152 | setTimeout(function() { |
153 | $('#addtoCart').text('立即购买').off('touchstart').on('touchstart', function() { | 153 | $('#addtoCart').text('立即购买').off('touchstart').on('touchstart', function() { |
154 | - tip.show('定金预售商品只能在APP端购买'); | 154 | + tip.show('定金预售商品只能在有货App购买'); |
155 | return false; | 155 | return false; |
156 | }); | 156 | }); |
157 | }, 200); | 157 | }, 200); |
@@ -7,6 +7,7 @@ let productSkn = $('#productSkn').val(); | @@ -7,6 +7,7 @@ let productSkn = $('#productSkn').val(); | ||
7 | let brandId = $('#brand-id').val(); | 7 | let brandId = $('#brand-id').val(); |
8 | let shopId = $('#shopId').val(); | 8 | let shopId = $('#shopId').val(); |
9 | let bundleType = $('#bundleType').val(); | 9 | let bundleType = $('#bundleType').val(); |
10 | +let yoho = require('yoho-app'); | ||
10 | 11 | ||
11 | require('common'); | 12 | require('common'); |
12 | 13 | ||
@@ -21,6 +22,26 @@ require('./detail/recommend-for-you-product-desc'); | @@ -21,6 +22,26 @@ require('./detail/recommend-for-you-product-desc'); | ||
21 | 22 | ||
22 | let detailFuns = require('./detail/functions'); | 23 | let detailFuns = require('./detail/functions'); |
23 | 24 | ||
25 | +let productName = $('.goods-name .name').text(); | ||
26 | +let productPic = $('.banner-container').find('img:first').attr('src'); | ||
27 | + | ||
28 | +if (productPic && productPic.indexOf('http:') < 0) { | ||
29 | + productPic = `http:${productPic}`; | ||
30 | +} | ||
31 | +let shareData = { | ||
32 | + title: `推荐这本城市指南给你:${productName}`, | ||
33 | + link: location.href, | ||
34 | + desc: '最近很多 KOL 在推!据说是探索城市必备神器', | ||
35 | + desCircle: `最近被刷屏的这本城市指南终于可以买到了!${productName}`, | ||
36 | + imgUrl: productPic | ||
37 | +}; | ||
38 | + | ||
39 | +if (yoho.isMarsApp) { | ||
40 | + yoho.ready(function() { | ||
41 | + yoho.invokeMethod('set.shareInfo', shareData); | ||
42 | + }); | ||
43 | +} | ||
44 | + | ||
24 | window.rePosFooter && window.rePosFooter(); | 45 | window.rePosFooter && window.rePosFooter(); |
25 | 46 | ||
26 | setTimeout(() => { | 47 | setTimeout(() => { |
@@ -87,7 +108,7 @@ setTimeout(() => { | @@ -87,7 +108,7 @@ setTimeout(() => { | ||
87 | 108 | ||
88 | setTimeout(function() { | 109 | setTimeout(function() { |
89 | $('#isDepositAdvance').on('touchstart', function() { | 110 | $('#isDepositAdvance').on('touchstart', function() { |
90 | - tip.show('定金预售商品只能在APP端购买'); | 111 | + tip.show('定金预售商品只能在有货App购买'); |
91 | return false; | 112 | return false; |
92 | }); | 113 | }); |
93 | }, 200); | 114 | }, 200); |
@@ -155,6 +176,16 @@ setTimeout(() => { | @@ -155,6 +176,16 @@ setTimeout(() => { | ||
155 | 176 | ||
156 | let chosePanel = require('common/chose-panel-new'); | 177 | let chosePanel = require('common/chose-panel-new'); |
157 | 178 | ||
179 | + if (window.cookie('tmp-cart-info') && yoho.isLogin()) { | ||
180 | + let preInfo = window.cookie('tmp-cart-info').split('_'); | ||
181 | + | ||
182 | + if (preInfo[1] === $('#productSkn').val()) { | ||
183 | + detailFuns.addToCart(preInfo[0], preInfo[1], preInfo[2]); | ||
184 | + } else { | ||
185 | + window.setCookie('tmp-cart-info', ''); | ||
186 | + } | ||
187 | + } | ||
188 | + | ||
158 | $('#addtoCart, #ticketsToCart').on('touchstart', function() { | 189 | $('#addtoCart, #ticketsToCart').on('touchstart', function() { |
159 | let productCode = $('#limitProductCode').val(); | 190 | let productCode = $('#limitProductCode').val(); |
160 | let seckill = $('.seckill-time').length; | 191 | let seckill = $('.seckill-time').length; |
@@ -180,8 +211,14 @@ setTimeout(() => { | @@ -180,8 +211,14 @@ setTimeout(() => { | ||
180 | return; | 211 | return; |
181 | } | 212 | } |
182 | if (result.buyNow) { // 立即购买 | 213 | if (result.buyNow) { // 立即购买 |
183 | - location.href = '/cart/index/buynow/orderensure?product_sku=' + | 214 | + let nextUrl = location.origin + '/cart/index/buynow/orderensure?product_sku=' + |
184 | result.sku.skuId + '&buy_number=' + result.buyNum; | 215 | result.sku.skuId + '&buy_number=' + result.buyNum; |
216 | + | ||
217 | + if (yoho.isMarsApp && !yoho.isLogin()) { | ||
218 | + yoho.goLogin(nextUrl); | ||
219 | + } else { | ||
220 | + location.href = nextUrl; | ||
221 | + } | ||
185 | return; | 222 | return; |
186 | } | 223 | } |
187 | detailFuns.addToCart(result.sku.skuId, productSkn, result.buyNum); | 224 | detailFuns.addToCart(result.sku.skuId, productSkn, result.buyNum); |
@@ -368,7 +405,8 @@ setTimeout(() => { | @@ -368,7 +405,8 @@ setTimeout(() => { | ||
368 | // 加载详情页的返回顶部按钮并注册事件 | 405 | // 加载详情页的返回顶部按钮并注册事件 |
369 | 406 | ||
370 | $(document).scroll(function() { | 407 | $(document).scroll(function() { |
371 | - if ($(document).scrollTop() >= $(document).height() - $(window).height() - 120) { | 408 | + if (($(document).scrollTop() >= $(document).height() - $(window).height() - 120) && |
409 | + $('.back-to-top').length > 0) { | ||
372 | let top = $('.back-to-top').offset().top - $('.float-top').offset().top + | 410 | let top = $('.back-to-top').offset().top - $('.float-top').offset().top + |
373 | ($('.back-to-top').height() - $('.float-top').height()) / 2; | 411 | ($('.back-to-top').height() - $('.float-top').height()) / 2; |
374 | let left = $('.back-to-top').offset().left - $('.float-top').offset().left; | 412 | let left = $('.back-to-top').offset().left - $('.float-top').offset().left; |
@@ -37,7 +37,10 @@ yoho = { | @@ -37,7 +37,10 @@ yoho = { | ||
37 | /** | 37 | /** |
38 | * 判断是否是 APP | 38 | * 判断是否是 APP |
39 | */ | 39 | */ |
40 | - isApp: /YohoBuy/i.test(navigator.userAgent || '') || qs && qs.app_version || cookie.get('app_version'), | 40 | + isMarsApp: /YohoMars/i.test(navigator.userAgent || ''), |
41 | + isApp: /YohoMars/i.test(navigator.userAgent || '') || | ||
42 | + /YohoBuy/i.test(navigator.userAgent || '') || | ||
43 | + qs && qs.app_version || cookie.get('app_version'), | ||
41 | isiOS: /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || ''), | 44 | isiOS: /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || ''), |
42 | isAndroid: /Android/i.test(navigator.userAgent || ''), | 45 | isAndroid: /Android/i.test(navigator.userAgent || ''), |
43 | 46 | ||
@@ -46,13 +49,6 @@ yoho = { | @@ -46,13 +49,6 @@ yoho = { | ||
46 | */ | 49 | */ |
47 | data: window.yohoInterfaceData, | 50 | data: window.yohoInterfaceData, |
48 | 51 | ||
49 | - /** | ||
50 | - * 判断是否是 登录 | ||
51 | - */ | ||
52 | - isLogin: function() { | ||
53 | - return cookie.get('_YOHOUID'); | ||
54 | - }, | ||
55 | - | ||
56 | ready: function(callback) { | 52 | ready: function(callback) { |
57 | if (this.isApp) { | 53 | if (this.isApp) { |
58 | document.addEventListener('deviceready', callback); | 54 | document.addEventListener('deviceready', callback); |
@@ -121,17 +117,29 @@ yoho = { | @@ -121,17 +117,29 @@ yoho = { | ||
121 | 117 | ||
122 | getUid: function() { | 118 | getUid: function() { |
123 | if (yoho.isApp) { | 119 | if (yoho.isApp) { |
124 | - return qs.uid; | 120 | + return qs.uid || cookie.get('_YOHOUID') || cookie.get('app_uid'); |
125 | } | 121 | } |
126 | 122 | ||
127 | return window.getUid(); | 123 | return window.getUid(); |
128 | }, | 124 | }, |
129 | 125 | ||
126 | + /** | ||
127 | + * 判断是否是 登录 | ||
128 | + */ | ||
129 | + isLogin: function() { | ||
130 | + return this.getUid(); | ||
131 | + }, | ||
132 | + | ||
130 | goLogin: function(refer, data) { | 133 | goLogin: function(refer, data) { |
131 | let url; | 134 | let url; |
132 | 135 | ||
136 | + if (refer.indexOf('//') === 0) { | ||
137 | + refer = location.protocol + refer; | ||
138 | + } | ||
139 | + | ||
133 | url = 'http://m.yohobuy.com/signin.html?refer=' + encodeURIComponent(refer); | 140 | url = 'http://m.yohobuy.com/signin.html?refer=' + encodeURIComponent(refer); |
134 | refer = yoho.parseUrl(refer || location.href); | 141 | refer = yoho.parseUrl(refer || location.href); |
142 | + | ||
135 | if (this.isApp) { | 143 | if (this.isApp) { |
136 | url = location.href; | 144 | url = location.href; |
137 | if (this.isAndroid) { | 145 | if (this.isAndroid) { |
@@ -1190,3 +1190,29 @@ $basicBtnC: #eb0313; | @@ -1190,3 +1190,29 @@ $basicBtnC: #eb0313; | ||
1190 | iframe { | 1190 | iframe { |
1191 | display: none; | 1191 | display: none; |
1192 | } | 1192 | } |
1193 | + | ||
1194 | +.is-mars-app { | ||
1195 | + .good-detail-page { | ||
1196 | + margin-bottom: 140px; | ||
1197 | + | ||
1198 | + .addto-cart, | ||
1199 | + .sold-out { | ||
1200 | + background-color: #000; | ||
1201 | + margin-left: 100px; | ||
1202 | + } | ||
1203 | + | ||
1204 | + .cart-bar { | ||
1205 | + .num-tag { | ||
1206 | + background-color: #89b374; | ||
1207 | + } | ||
1208 | + | ||
1209 | + .new-foot-ico.fav { | ||
1210 | + display: none; | ||
1211 | + } | ||
1212 | + } | ||
1213 | + | ||
1214 | + .suspend-home { | ||
1215 | + display: none; | ||
1216 | + } | ||
1217 | + } | ||
1218 | +} |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | * @Author: Targaryen | 2 | * @Author: Targaryen |
3 | * @Date: 2017-03-23 11:02:31 | 3 | * @Date: 2017-03-23 11:02:31 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | - * @Last Modified time: 2017-05-26 16:42:29 | 5 | + * @Last Modified time: 2017-07-18 14:29:33 |
6 | */ | 6 | */ |
7 | /* 红人店铺数据处理 */ | 7 | /* 红人店铺数据处理 */ |
8 | 8 | ||
@@ -152,13 +152,18 @@ const _tools = { | @@ -152,13 +152,18 @@ const _tools = { | ||
152 | * @param {*} moduleData | 152 | * @param {*} moduleData |
153 | */ | 153 | */ |
154 | tripleImage(moduleData) { | 154 | tripleImage(moduleData) { |
155 | - let displayType = _.get(moduleData, 'properties.displayType', 0); | 155 | + let displayType = parseInt(_.get(moduleData, 'properties.displayType', 0), 10); |
156 | + | ||
157 | + // 没有展示方式,不展示此模块,处理接口返回数据异常的情况 | ||
158 | + if (!displayType) { | ||
159 | + return {}; | ||
160 | + } | ||
156 | 161 | ||
157 | return { | 162 | return { |
158 | module_type: 'TripleImage', | 163 | module_type: 'TripleImage', |
159 | pics: _picsHandle(moduleData), | 164 | pics: _picsHandle(moduleData), |
160 | isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', 0), | 165 | isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', 0), |
161 | - displayType: parseInt(displayType, 10), | 166 | + displayType: displayType, |
162 | }; | 167 | }; |
163 | }, | 168 | }, |
164 | 169 |
-
Please register or login to post a comment