...
|
...
|
@@ -3,7 +3,6 @@ import udid from './common/udid'; |
|
|
import event from './common/event';
|
|
|
import {verify} from './common/api';
|
|
|
import config from './common/config';
|
|
|
import commonModel from './models/common';
|
|
|
import Promise from './vendors/es6-promise';
|
|
|
import { MD5 } from './vendors/crypto';
|
|
|
import { wechatAuthLogin, verifySessionKey } from './common/login';
|
...
|
...
|
@@ -75,9 +74,6 @@ App({ |
|
|
this.globalData.systemInfo = res;
|
|
|
});
|
|
|
|
|
|
// 获取关联店铺
|
|
|
this.getUnionShop();
|
|
|
|
|
|
// 设置渠道来源
|
|
|
if (options && options.query && options.query.union_type) {
|
|
|
this.globalData.union_type = options.query.union_type;
|
...
|
...
|
@@ -118,21 +114,6 @@ App({ |
|
|
this.wechatAuthLogin();
|
|
|
}, 1000);
|
|
|
},
|
|
|
getUnionShop() {
|
|
|
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');
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {});
|
|
|
},
|
|
|
_getSync(key) {
|
|
|
try {
|
|
|
return wx.getStorageSync(key);
|
...
|
...
|
@@ -280,7 +261,8 @@ App({ |
|
|
return config.unionType;
|
|
|
},
|
|
|
getShopId() {
|
|
|
return this.globalData.appShopId || this._getSync('app_bind_shop_id');
|
|
|
return this.globalData.unionShop && this.globalData.unionShop.shopId ||
|
|
|
this._getSync('unionShop').shopId;
|
|
|
},
|
|
|
getAppId() {
|
|
|
return config.appid;
|
...
|
...
|
|