Showing
10 changed files
with
55 additions
and
10 deletions
@@ -3,6 +3,7 @@ import udid from './common/udid'; | @@ -3,6 +3,7 @@ import udid from './common/udid'; | ||
3 | import event from './common/event'; | 3 | import event from './common/event'; |
4 | import {verify} from './common/api'; | 4 | import {verify} from './common/api'; |
5 | import config from './common/config'; | 5 | import config from './common/config'; |
6 | +import commonModel from './models/common'; | ||
6 | import Promise from './vendors/es6-promise'; | 7 | import Promise from './vendors/es6-promise'; |
7 | import { MD5 } from './vendors/crypto'; | 8 | import { MD5 } from './vendors/crypto'; |
8 | import { wechatAuthLogin, verifySessionKey } from './common/login'; | 9 | import { wechatAuthLogin, verifySessionKey } from './common/login'; |
@@ -72,6 +73,9 @@ App({ | @@ -72,6 +73,9 @@ App({ | ||
72 | this.globalData.systemInfo = res; | 73 | this.globalData.systemInfo = res; |
73 | }); | 74 | }); |
74 | 75 | ||
76 | + // 获取关联店铺 | ||
77 | + this.getUnionShop(); | ||
78 | + | ||
75 | // 设置渠道来源 | 79 | // 设置渠道来源 |
76 | if (options && options.query && options.query.union_type) { | 80 | if (options && options.query && options.query.union_type) { |
77 | this.globalData.union_type = options.query.union_type; | 81 | this.globalData.union_type = options.query.union_type; |
@@ -112,6 +116,18 @@ App({ | @@ -112,6 +116,18 @@ App({ | ||
112 | this.wechatAuthLogin(); | 116 | this.wechatAuthLogin(); |
113 | }, 1000); | 117 | }, 1000); |
114 | }, | 118 | }, |
119 | + getUnionShop() { | ||
120 | + commonModel.getBindShop({ app_id: config.appid}) | ||
121 | + .then(res => { | ||
122 | + if (res.code === 200) { | ||
123 | + if (res.data && res.data.shopId) { | ||
124 | + this._setSync('app_bind_shop_id', res.data.shopId); | ||
125 | + this._setSync('app_bind_union_type', res.data.unionType); | ||
126 | + } | ||
127 | + } | ||
128 | + }) | ||
129 | + .catch(() => {}); | ||
130 | + }, | ||
115 | _getSync(key) { | 131 | _getSync(key) { |
116 | try { | 132 | try { |
117 | return wx.getStorageSync(key); | 133 | return wx.getStorageSync(key); |
@@ -140,7 +140,8 @@ const api = { | @@ -140,7 +140,8 @@ const api = { | ||
140 | business_line: config.apiParams.business_line, | 140 | business_line: config.apiParams.business_line, |
141 | client_type: config.apiParams.client_type, | 141 | client_type: config.apiParams.client_type, |
142 | app_version: config.apiParams.app_version, | 142 | app_version: config.apiParams.app_version, |
143 | - union_type: config.unionType, // 渠道号 | 143 | + shop_id: 1016, // TODO 临时写死 |
144 | + // union_type: config.unionType, // 渠道号 | ||
144 | udid: udid.get() | 145 | udid: udid.get() |
145 | }, params); | 146 | }, params); |
146 | }, | 147 | }, |
1 | const config = { | 1 | const config = { |
2 | domains: { | 2 | domains: { |
3 | // test3 | 3 | // test3 |
4 | - // api: 'http://api-test3.dev.yohocorp.com', | 4 | + api: 'http://api-test3.dev.yohocorp.com', |
5 | 5 | ||
6 | // test1 | 6 | // test1 |
7 | // api: 'http://api-test1.dev.yohocorp.com', | 7 | // api: 'http://api-test1.dev.yohocorp.com', |
@@ -10,7 +10,7 @@ const config = { | @@ -10,7 +10,7 @@ const config = { | ||
10 | // api: 'http://apigray.yoho.cn', | 10 | // api: 'http://apigray.yoho.cn', |
11 | 11 | ||
12 | // production | 12 | // production |
13 | - api: 'https://api.yoho.cn', | 13 | + // api: 'https://api.yoho.cn', |
14 | 14 | ||
15 | yasApi: 'https://analysis.yohobuy.com/yas_mobile' | 15 | yasApi: 'https://analysis.yohobuy.com/yas_mobile' |
16 | }, | 16 | }, |
@@ -13,4 +13,18 @@ export default { | @@ -13,4 +13,18 @@ export default { | ||
13 | }, params) | 13 | }, params) |
14 | }); | 14 | }); |
15 | }, | 15 | }, |
16 | + | ||
17 | + /** | ||
18 | + * 通过AppId查绑定店铺 | ||
19 | + * @param params | ||
20 | + * @returns {*} | ||
21 | + */ | ||
22 | + getBindShop(params) { | ||
23 | + return api.get({ | ||
24 | + url: '', | ||
25 | + data: Object.assign({ | ||
26 | + method: 'app.shops.union' | ||
27 | + }, params) | ||
28 | + }); | ||
29 | + } | ||
16 | }; | 30 | }; |
@@ -10,7 +10,7 @@ export default { | @@ -10,7 +10,7 @@ export default { | ||
10 | return api.get({ | 10 | return api.get({ |
11 | url: '', | 11 | url: '', |
12 | data: Object.assign({ | 12 | data: Object.assign({ |
13 | - method: 'app.distribution.productList' | 13 | + method: 'app.search.shop.productList' |
14 | }, params) | 14 | }, params) |
15 | }); | 15 | }); |
16 | }, | 16 | }, |
@@ -10,7 +10,7 @@ export default { | @@ -10,7 +10,7 @@ export default { | ||
10 | return api.get({ | 10 | return api.get({ |
11 | url: '', | 11 | url: '', |
12 | data: Object.assign({ | 12 | data: Object.assign({ |
13 | - method: 'app.distribution.productList' | 13 | + method: 'app.search.shop.productList' |
14 | }, params) | 14 | }, params) |
15 | }); | 15 | }); |
16 | } | 16 | } |
@@ -10,7 +10,7 @@ export default { | @@ -10,7 +10,7 @@ export default { | ||
10 | return api.get({ | 10 | return api.get({ |
11 | url: '', | 11 | url: '', |
12 | data: Object.assign({ | 12 | data: Object.assign({ |
13 | - method: 'app.distribution.productList' | 13 | + method: 'app.search.shop.productList' |
14 | }, params) | 14 | }, params) |
15 | }); | 15 | }); |
16 | }, | 16 | }, |
@@ -36,5 +36,19 @@ export default { | @@ -36,5 +36,19 @@ export default { | ||
36 | method: 'app.popular.shopsdecorator' | 36 | method: 'app.popular.shopsdecorator' |
37 | }, params) | 37 | }, params) |
38 | }); | 38 | }); |
39 | - } | 39 | + }, |
40 | + | ||
41 | + /** | ||
42 | + * 店铺商品列表 | ||
43 | + * @param params | ||
44 | + * @returns {*} | ||
45 | + */ | ||
46 | + shopProductList(params) { | ||
47 | + return api.get({ | ||
48 | + url: '', | ||
49 | + data: Object.assign({ | ||
50 | + method: 'app.search.shop.productList' | ||
51 | + }, params) | ||
52 | + }); | ||
53 | + }, | ||
40 | }; | 54 | }; |
1 | import wx from '../../utils/wx'; | 1 | import wx from '../../utils/wx'; |
2 | import config from '../../common/config'; | 2 | import config from '../../common/config'; |
3 | import Yas from '../../common/yas'; | 3 | import Yas from '../../common/yas'; |
4 | -import indexModel from '../../models/index/index'; | 4 | +import shopModel from '../../models/product/shop'; |
5 | 5 | ||
6 | // 获取应用实例 | 6 | // 获取应用实例 |
7 | let app = getApp(); | 7 | let app = getApp(); |
@@ -123,7 +123,7 @@ Page({ | @@ -123,7 +123,7 @@ Page({ | ||
123 | this.data.isLoading = true; | 123 | this.data.isLoading = true; |
124 | wx.showLoading({title: '加载中'}); | 124 | wx.showLoading({title: '加载中'}); |
125 | delete params.setScrollPos; | 125 | delete params.setScrollPos; |
126 | - indexModel.productList(params).then(res => { | 126 | + shopModel.shopProductList(params).then(res => { |
127 | if (res.code === 200) { | 127 | if (res.code === 200) { |
128 | const keyAdapter = { | 128 | const keyAdapter = { |
129 | skn: 'product_skn', | 129 | skn: 'product_skn', |
-
Please register or login to post a comment