Authored by 李奇

获取shopId修改

... ... @@ -20,7 +20,9 @@ App({
unionID: '',
sessionKey: '',
thirdSession: '',
systemInfo: {}
systemInfo: {},
appShopId: 0,
appUnionType: 0,
},
reportData: {
awakeReported: false
... ... @@ -117,12 +119,15 @@ App({
}, 1000);
},
getUnionShop() {
commonModel.getBindShop({ app_id: config.appid})
return commonModel.getBindShop({ app_id: config.appid})
.then(res => {
if (res.code === 200) {
if (res.data && res.data.shopId) {
this.globalData.appShopId = res.data.shopId;
this.globalData.appUnionType = res.data.unionType;
this._setSync('app_bind_shop_id', res.data.shopId);
this._setSync('app_bind_union_type', res.data.unionType);
event.emit('app_shop_id_update');
}
}
})
... ... @@ -274,6 +279,9 @@ App({
getUnionType() {
return config.unionType;
},
getShopId() {
return this.globalData.appShopId || this._getSync('app_bind_shop_id');
},
getAppId() {
return config.appid;
},
... ...
... ... @@ -140,8 +140,7 @@ const api = {
business_line: config.apiParams.business_line,
client_type: config.apiParams.client_type,
app_version: config.apiParams.app_version,
shop_id: 1016, // TODO 临时写死
// union_type: config.unionType, // 渠道号
union_type: config.unionType, // 渠道号
udid: udid.get()
}, params);
},
... ...
<block wx:if="{{curShoppingCartData.has_product_in_shop_cart}}">
<block wx:if="{{false}}">
我是购物车内容
</block>
<block wx:else>
... ...
import wx from '../../utils/wx';
import event from '../../common/event';
import config from '../../common/config';
import Yas from '../../common/yas';
import shopModel from '../../models/product/shop';
... ... @@ -27,7 +28,13 @@ Page({
resource: config.resourceContentCode
},
onLoad: function() {
this.productList({ page: 1, limit: 20});
if (app.globalData.appShopId) {
this.productList({ page: 1, limit: 20});
} else {
event.on('app_shop_id_update', () => {
this.productList({ page: 1, limit: 20});
});
}
yas = new Yas(app);
},
onReady: function() {
... ... @@ -123,6 +130,7 @@ Page({
this.data.isLoading = true;
wx.showLoading({title: '加载中'});
delete params.setScrollPos;
params.shop_id = app.getShopId();
shopModel.shopProductList(params).then(res => {
if (res.code === 200) {
const keyAdapter = {
... ...