Showing
4 changed files
with
20 additions
and
5 deletions
@@ -20,7 +20,9 @@ App({ | @@ -20,7 +20,9 @@ App({ | ||
20 | unionID: '', | 20 | unionID: '', |
21 | sessionKey: '', | 21 | sessionKey: '', |
22 | thirdSession: '', | 22 | thirdSession: '', |
23 | - systemInfo: {} | 23 | + systemInfo: {}, |
24 | + appShopId: 0, | ||
25 | + appUnionType: 0, | ||
24 | }, | 26 | }, |
25 | reportData: { | 27 | reportData: { |
26 | awakeReported: false | 28 | awakeReported: false |
@@ -117,12 +119,15 @@ App({ | @@ -117,12 +119,15 @@ App({ | ||
117 | }, 1000); | 119 | }, 1000); |
118 | }, | 120 | }, |
119 | getUnionShop() { | 121 | getUnionShop() { |
120 | - commonModel.getBindShop({ app_id: config.appid}) | 122 | + return commonModel.getBindShop({ app_id: config.appid}) |
121 | .then(res => { | 123 | .then(res => { |
122 | if (res.code === 200) { | 124 | if (res.code === 200) { |
123 | if (res.data && res.data.shopId) { | 125 | if (res.data && res.data.shopId) { |
126 | + this.globalData.appShopId = res.data.shopId; | ||
127 | + this.globalData.appUnionType = res.data.unionType; | ||
124 | this._setSync('app_bind_shop_id', res.data.shopId); | 128 | this._setSync('app_bind_shop_id', res.data.shopId); |
125 | this._setSync('app_bind_union_type', res.data.unionType); | 129 | this._setSync('app_bind_union_type', res.data.unionType); |
130 | + event.emit('app_shop_id_update'); | ||
126 | } | 131 | } |
127 | } | 132 | } |
128 | }) | 133 | }) |
@@ -274,6 +279,9 @@ App({ | @@ -274,6 +279,9 @@ App({ | ||
274 | getUnionType() { | 279 | getUnionType() { |
275 | return config.unionType; | 280 | return config.unionType; |
276 | }, | 281 | }, |
282 | + getShopId() { | ||
283 | + return this.globalData.appShopId || this._getSync('app_bind_shop_id'); | ||
284 | + }, | ||
277 | getAppId() { | 285 | getAppId() { |
278 | return config.appid; | 286 | return config.appid; |
279 | }, | 287 | }, |
@@ -140,8 +140,7 @@ const api = { | @@ -140,8 +140,7 @@ 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 | - shop_id: 1016, // TODO 临时写死 | ||
144 | - // union_type: config.unionType, // 渠道号 | 143 | + union_type: config.unionType, // 渠道号 |
145 | udid: udid.get() | 144 | udid: udid.get() |
146 | }, params); | 145 | }, params); |
147 | }, | 146 | }, |
1 | import wx from '../../utils/wx'; | 1 | import wx from '../../utils/wx'; |
2 | +import event from '../../common/event'; | ||
2 | import config from '../../common/config'; | 3 | import config from '../../common/config'; |
3 | import Yas from '../../common/yas'; | 4 | import Yas from '../../common/yas'; |
4 | import shopModel from '../../models/product/shop'; | 5 | import shopModel from '../../models/product/shop'; |
@@ -27,7 +28,13 @@ Page({ | @@ -27,7 +28,13 @@ Page({ | ||
27 | resource: config.resourceContentCode | 28 | resource: config.resourceContentCode |
28 | }, | 29 | }, |
29 | onLoad: function() { | 30 | onLoad: function() { |
31 | + if (app.globalData.appShopId) { | ||
30 | this.productList({ page: 1, limit: 20}); | 32 | this.productList({ page: 1, limit: 20}); |
33 | + } else { | ||
34 | + event.on('app_shop_id_update', () => { | ||
35 | + this.productList({ page: 1, limit: 20}); | ||
36 | + }); | ||
37 | + } | ||
31 | yas = new Yas(app); | 38 | yas = new Yas(app); |
32 | }, | 39 | }, |
33 | onReady: function() { | 40 | onReady: function() { |
@@ -123,6 +130,7 @@ Page({ | @@ -123,6 +130,7 @@ Page({ | ||
123 | this.data.isLoading = true; | 130 | this.data.isLoading = true; |
124 | wx.showLoading({title: '加载中'}); | 131 | wx.showLoading({title: '加载中'}); |
125 | delete params.setScrollPos; | 132 | delete params.setScrollPos; |
133 | + params.shop_id = app.getShopId(); | ||
126 | shopModel.shopProductList(params).then(res => { | 134 | shopModel.shopProductList(params).then(res => { |
127 | if (res.code === 200) { | 135 | if (res.code === 200) { |
128 | const keyAdapter = { | 136 | const keyAdapter = { |
-
Please register or login to post a comment