index.js
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import { IMG_URL } from "~/utils/constantData";
import ActivityApi from "~/api/activityApi/index";
import USERAPI from '~/api/usersApi/index'
import {taskLoginAndRegister} from '../../../common/common'
Page({
data: {
IMG_URL: IMG_URL,
localData: {
merchantName: '嘀加企微管家SCRM',
WelfareOfficer: '业务顾问-小杨',
code: 'not_open_code'
}
},
onRoute(options) {
taskLoginAndRegister({options,pages:'addFLG'}, this.getFLG(options.open==1))
// console.log(options);
// if (!options) {
// this.getFLG(false)
// return
// }
// if (options.merchantId) {
// options.pages = 'addFLG'
// const sessionId = wx.$storage.get('sessionId')
// if (!sessionId) {
// let para = {
// merchantId: options.merchantId,
// type: 1,
// pages:'addFLG'
// }
// let temp = encodeURIComponent(JSON.stringify(para))
// wx.navigateTo({
// url: '/packageStoreAssistant/packageAuth/pages/authentication/register/register?data=' + temp,
// });
// } else {
// const USERINFO = wx.$storage.get('userInfo')
// if (USERINFO.merchantId == options.merchantId) {
// USERAPI.checkSession().then(({
// code
// }) => {
// if (code == '0') {
// this.getFLG(true,options.merchantId)
// } else {
// wx.$router.reLaunch('/packageStoreAssistant/packageAuth/pages/authentication/login/login', options)
// }
// })
// } else {
// let para = {
// merchantId: options.merchantId,
// type: 1,
// pages:'addFLG'
// }
// let temp = encodeURIComponent(JSON.stringify(para))
// wx.navigateTo({
// url: '/packageStoreAssistant/packageAuth/pages/authentication/register/register?data=' + temp,
// });
// }
// }
// }else{
// this.getFLG(options.open==1)
// }
},
getFLG(open,merchantId) {
const userStorage = wx.$storage.get("userInfo");
let para = {
merchantIds: [merchantId || userStorage.merchantId]
}
let localData = {}
if(!open){
this.setData({
open
})
return
}
ActivityApi.getWelfareInfo(para).then(res => {
if (res && res.length) {
const item = res[0]
localData = {
merchantName: item.merchantName,
WelfareOfficer: item.welfareManName,
code: item.qrCode
}
this.setData({
localData,
open
})
}
})
}
})