Sfoglia il codice sorgente

fix:登录接口

storeBelieveInLight 1 anno fa
parent
commit
b8220dc854

+ 1 - 1
commit/api.js

@@ -1,7 +1,7 @@
1 1
 import { 
2 2
  myRequest 
3 3
 } from './request.js'
4
- 
4
+
5 5
 // 查询所有权限
6 6
 export function queryJurisdiction(data) { 
7 7
  return myRequest({ 

+ 6 - 6
commit/config.js

@@ -8,10 +8,10 @@ export function queyrConfig(data) {
8 8
 		method: 'post',
9 9
 		data
10 10
 	})
11
-}
12
-
13
-
14
-
11
+}
12
+
13
+
14
+
15 15
 // 获取门店分润值
16 16
 export function getShopBonusSetting(data) {
17 17
 	return myRequest({
@@ -19,7 +19,7 @@ export function getShopBonusSetting(data) {
19 19
 		method: 'post',
20 20
 		data
21 21
 	})
22
-}
22
+}
23 23
 
24 24
 // 修改门店分润值
25 25
 export function updateShopBonusSetting(data) {
@@ -52,4 +52,4 @@ export function queryByMerId(data) {
52 52
 		method: 'post',
53 53
 		data
54 54
 	})
55
-}
55
+}

+ 17 - 0
commit/order.js

@@ -194,4 +194,21 @@ export function confirmReceiptApi(id, data) {
194 194
          method: 'POST',
195 195
          apiType
196 196
      })
197
+}
198
+
199
+/**
200
+ * PHP获取token接口
201
+ **/
202
+/**
203
+ * merId
204
+ * @param {*} data 
205
+ * @returns 
206
+ */
207
+export function getPhpGlobalToken(data, merId) {
208
+    return myRequestPhp({
209
+        url: `${pre}mer/getPhpToken?${merId}`,
210
+        method: 'POST',
211
+        data,
212
+        apiType
213
+    })
197 214
 }

+ 3 - 2
commit/request.js

@@ -1,12 +1,13 @@
1 1
 let is = 2
2 2
 var baseURL = 'https://api.hxxfb.com/gateway/' // API访问的地址
3
+
3 4
  if(is==1){
4 5
 	  baseURL = 'https://api.hxxfb.com/gateway/';//测试环境
5 6
  }else if(is==2){
6 7
 	 // baseURL = 'https://api.hebeiyhc.com/gateway/'; //生产环境
7 8
 	 // baseURL = 'https://api.hebeiyhc.com/gateway/'; //生产环境
8
-	   // baseURL = 'https://testapi.hxxfb.com/gateway/'; //预生产环境
9
-	   baseURL = '/gateway/'; //预生产环境
9
+	   baseURL = 'http://testapi.hxxfb.com/gateway/'; //预生产环境
10
+	//    baseURL = '/gateway/'; //预生产环境
10 11
 	
11 12
  }else{
12 13
 	  baseURL = 'https://api.hxxfb.com/gateway/'; //预生产环境

+ 20 - 8
commit/requestPhp.js

@@ -1,5 +1,7 @@
1 1
 
2
-let baseURL = 'https://shop.hxxfb.com/'
2
+
3
+import {getPhpToken} from "../utils/readAppInfo"
4
+let baseURL = 'http://testshop.hxxfb.com/'
3 5
 // 请求超出时间
4 6
 const timeout = 5000
5 7
 
@@ -10,8 +12,8 @@ export function myRequestPhp(options) {
10 12
 	let data = options.data || {};
11 13
 	let header = {
12 14
 		'Content-Type': 'application/json;charset=UTF-8',
13
-		'X-token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuaHh4ZmIuY29tIiwiYXVkIjoiYXBpLmh4eGZiLmNvbSIsImlhdCI6MTc0MDM3MTM1NSwibmJmIjoxNzQwMzcxMzU1LCJleHAiOjE3NTExNzEzNTUsImp0aSI6WzI5OCwibWVyIl19.j2f8VwdwWY4zBpcijHntzUZ9YUms2SxChaVsYf7KnPs',
14
-		'Accept': '*/*',
15
+		// 'X-Token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuaHh4ZmIuY29tIiwiYXVkIjoiYXBpLmh4eGZiLmNvbSIsImlhdCI6MTc0MDM3MTM1NSwibmJmIjoxNzQwMzcxMzU1LCJleHAiOjE3NTExNzEzNTUsImp0aSI6WzI5OCwibWVyIl19.j2f8VwdwWY4zBpcijHntzUZ9YUms2SxChaVsYf7KnPs',
16
+		"x-Token": uni.getStorageSync('phpToken'), //token
15 17
 		...options.header
16 18
 	}
17 19
 	return new Promise((resolve, reject) => {
@@ -21,8 +23,11 @@ export function myRequestPhp(options) {
21 23
 			header: header,
22 24
 			data: data,
23 25
 			timeout,
24
-			success(response) {
26
+			success:async function(response) {
25 27
 				const res = response
28
+				const message = res.data && res.data.message || ""
29
+				// console.log(res, "resresresresres")
30
+				// console.log(message, "99999message")
26 31
 				if (res.data.status == 200) { //接口返回200走一下操作
27 32
 					resolve(res)
28 33
 				} else if (res.data.status == 500) { //接口返回500走一下操作
@@ -30,15 +35,21 @@ export function myRequestPhp(options) {
30 35
 						title: res.data.error,
31 36
 						icon: 'none'
32 37
 					})
38
+				} else if ((res.data.status == 400 || res.data.status == 40000) && (message.indexOf('登录') > -1 || message.indexOf('过期') > -1 ||  message.indexOf('token') > -1)) { //接口返回400走一下操作500走一下操作
39
+					await  getPhpToken()
40
+					 resolve(res)
33 41
 				} else { //除了500都会走以下操作
34
-					return uni.showToast({
35
-						title: res.data.message,
36
-						icon: 'none'
42
+					 uni.showToast({
43
+						title: message,
44
+						icon: 'none',
45
+						duration: 6000
37 46
 					})
47
+					return
38 48
 				}
49
+				uni.hideToast();
39 50
 			},
40 51
 			fail(err) {
41
-				console.log(err)
52
+				console.log(err,"接口")
42 53
 				if (err.errMsg.indexOf('request:fail') !== -1) {
43 54
 					uni.showToast({
44 55
 						title: '网络异常',
@@ -51,6 +62,7 @@ export function myRequestPhp(options) {
51 62
 						duration: 2000
52 63
 					})
53 64
 				}
65
+				uni.hideToast();
54 66
 				reject(err);
55 67
 
56 68
 			},

+ 2 - 2
pages/cashier/index.vue

@@ -180,7 +180,7 @@ import {
180 180
   selectMerchantOrder,
181 181
   payUserList,
182 182
 } from "@/commit/shop.js";
183
-import readAppInfo from "@/utils/readAppInfo.js";
183
+import readAppInfo,{getPhpToken} from "@/utils/readAppInfo.js";
184 184
 export default {
185 185
   data() {
186 186
     return {
@@ -221,7 +221,7 @@ export default {
221 221
     let userinfo = uni.getStorageSync("userinfo");
222 222
 	    this.mer_id = selectmerchant.merId;
223 223
     let jurisdiction = uni.getStorageSync("jurisdiction");
224
-
224
+     await getPhpToken()
225 225
     if (jurisdiction) {
226 226
       jurisdiction.forEach((res, index) => {
227 227
         if (res == 7) {

+ 3 - 2
pages/my/index.vue

@@ -23,7 +23,7 @@
23 23
 
24 24
 <script>
25 25
 	import { emConnect } from '@/EaseIM/emApis';
26
-	import readAppInfo from '@/utils/readAppInfo.js';
26
+	import readAppInfo ,{getPhpToken}from '@/utils/readAppInfo.js';
27 27
 	const { loginWithPassword,closeEaseIM } = emConnect();
28 28
 	export default {
29 29
 		data() {
@@ -77,8 +77,9 @@
77 77
 			// });
78 78
 			
79 79
 			await readAppInfo();
80
-			
80
+			await getPhpToken()
81 81
 			let jurisdiction = uni.getStorageSync('jurisdiction')
82
+			
82 83
 			console.log('jurisdiction', jurisdiction)
83 84
 			let mnuList = this.mnu
84 85
 			if (jurisdiction) {

+ 4 - 1
pages/ordermanagement/index.vue

@@ -97,6 +97,7 @@ import {
97 97
 } from "@/commit/order.js";
98 98
 import quickPickUpVue from "./components/quickPickUp/quickPickUp.vue";
99 99
 import { toQueryString } from "@/utils/index.js";
100
+	import readAppInfo ,{getPhpToken}from '@/utils/readAppInfo.js';
100 101
 export default {
101 102
   components: { quickPickUpVue },
102 103
   data() {
@@ -157,7 +158,9 @@ export default {
157 158
       ],
158 159
     };
159 160
   },
160
-  onLoad() {},
161
+  async onLoad() {
162
+    await getPhpToken()
163
+  },
161 164
   async onShow() {
162 165
    
163 166
     let selectmerchant = uni.getStorageSync("selectmerchant");

+ 2 - 2
pages/supplychainon/ProductCard.vue

@@ -55,10 +55,10 @@
55 55
 
56 56
       <!-- 操作按钮 -->
57 57
       <view class="action-bar">
58
-        <button class="action-btn edit-price" @click="$emit('edit-price')">
58
+        <button class="action-btn edit-price" @click="$emit('edit-price',data)">
59 59
           改价
60 60
         </button>
61
-        <button class="action-btn set-activity" @click="$emit('edit-activity')">
61
+        <button class="action-btn set-activity" @click="$emit('edit-activity',data)">
62 62
           活动
63 63
         </button>
64 64
       </view>

+ 171 - 0
pages/supplychainon/price-edit-modal.vue

@@ -0,0 +1,171 @@
1
+<template>
2
+  <view class="price-edit-modal">
3
+    <!-- 遮罩层 -->
4
+    <view class="mask" @tap="close"></view>
5
+    
6
+    <!-- 弹窗内容 -->
7
+    <view class="modal-content">
8
+      <view class="modal-header">修改销售价</view>
9
+      
10
+      <!-- 商品类型选择 -->
11
+      <view class="goods-type">
12
+        <text class="label">商品类型:</text>
13
+        <radio-group @change="handleTypeChange">
14
+          <view v-for="item in goodsTypes" :key="item.value" class="radio-item">
15
+            <label>
16
+              <radio :value="item.value" :checked="currentType === item.value" color="#007AFF"/>
17
+              {{ item.label }}
18
+            </label>
19
+          </view>
20
+        </radio-group>
21
+      </view>
22
+
23
+      <!-- 价格输入区域 -->
24
+      <view class="price-input">
25
+        <text class="tip">最低销售价格不能小于:{{ minPrice }}</text>
26
+        <view class="input-row">
27
+          <text>销售价:</text>
28
+          <input 
29
+            type="number" 
30
+            v-model="currentPrice" 
31
+            placeholder="请输入销售价"
32
+            :min="minPrice"
33
+            @input="calculateProfit"
34
+          />
35
+        </view>
36
+      </view>
37
+
38
+      <!-- 计算结果显示 -->
39
+      <view class="profit-display">
40
+        <view>养老金:{{ pensionFund.toFixed(2) }}</view>
41
+        <view>创客利润:{{ makerProfit.toFixed(2) }}</view>
42
+      </view>
43
+
44
+      <button class="confirm-btn" @tap="handleConfirm">确定</button>
45
+    </view>
46
+  </view>
47
+</template>
48
+
49
+<script>
50
+export default {
51
+  props: {
52
+    minPrice: { type: Number, default: 8.75 },
53
+    originalPrice: { type: Number, required: true },
54
+    goodsType: { type: String, default: 'normal' }
55
+  },
56
+  data() {
57
+    return {
58
+      currentPrice: this.originalPrice,
59
+      currentType: this.goodsType,
60
+      pensionFund: 0,
61
+      makerProfit: 1.75,
62
+      goodsTypes: [
63
+        { label: '普通商品', value: 'normal' },
64
+        { label: '会员商品', value: 'member' },
65
+        { label: '高级会员商品', value: 'vip' },
66
+        { label: '合伙人商品', value: 'partner' },
67
+        { label: '股权商品', value: 'stock' },
68
+        { label: '合伙人+股权商品', value: 'partner_stock' }
69
+      ]
70
+    }
71
+  },
72
+  methods: {
73
+    handleTypeChange(e) {
74
+      this.currentType = e.detail.value
75
+      // 这里可以添加不同类型的价格计算逻辑
76
+    },
77
+    calculateProfit() {
78
+      // 示例计算逻辑,实际根据业务需求修改
79
+      this.pensionFund = this.currentPrice * 0.05
80
+      this.makerProfit = this.currentPrice * 0.15
81
+    },
82
+    handleConfirm() {
83
+      if (this.currentPrice < this.minPrice) {
84
+        uni.showToast({ title: '价格不能低于最低价', icon: 'none' })
85
+        return
86
+      }
87
+      this.$emit('confirm', {
88
+        price: Number(this.currentPrice),
89
+        type: this.currentType
90
+      })
91
+    },
92
+    close() {
93
+      this.$emit('close')
94
+    }
95
+  }
96
+}
97
+</script>
98
+
99
+<style scoped>
100
+/* 弹窗公共样式 */
101
+.mask {
102
+  position: fixed;
103
+  top: 0;
104
+  left: 0;
105
+  right: 0;
106
+  bottom: 0;
107
+  background: rgba(0,0,0,0.5);
108
+  z-index: 999;
109
+}
110
+
111
+.modal-content {
112
+  position: fixed;
113
+  top: 50%;
114
+  left: 50%;
115
+  transform: translate(-50%, -50%);
116
+  width: 85%;
117
+  max-width: 600rpx;
118
+  background: #fff;
119
+  border-radius: 12rpx;
120
+  padding: 30rpx;
121
+  z-index: 1000;
122
+}
123
+
124
+.modal-header {
125
+  font-size: 18px;
126
+  font-weight: bold;
127
+  margin-bottom: 20rpx;
128
+  text-align: center;
129
+}
130
+
131
+/* 商品类型选择样式 */
132
+.goods-type {
133
+  margin-bottom: 30rpx;
134
+}
135
+.radio-item {
136
+  margin: 15rpx 0;
137
+  display: flex;
138
+  align-items: center;
139
+}
140
+
141
+/* 输入区域样式 */
142
+.price-input {
143
+  margin: 20rpx 0;
144
+}
145
+.input-row {
146
+  display: flex;
147
+  align-items: center;
148
+  margin: 15rpx 0;
149
+}
150
+input {
151
+  border: 1rpx solid #ddd;
152
+  padding: 10rpx;
153
+  border-radius: 8rpx;
154
+  flex: 1;
155
+  margin-left: 15rpx;
156
+}
157
+
158
+/* 按钮样式 */
159
+.confirm-btn {
160
+  background: #007AFF;
161
+  color: white;
162
+  margin-top: 30rpx;
163
+  border-radius: 8rpx;
164
+}
165
+
166
+.profit-display {
167
+  padding: 15rpx 0;
168
+  border-top: 1rpx solid #eee;
169
+  margin-top: 20rpx;
170
+}
171
+</style>

File diff suppressed because it is too large
+ 536 - 469
pages/user/login/index.vue


+ 2 - 1
shop/productManagementModule/index.vue

@@ -32,7 +32,7 @@
32 32
 </template>
33 33
 
34 34
 <script>
35
-import readAppInfo from "@/utils/readAppInfo.js";
35
+import readAppInfo,{getPhpToken} from "@/utils/readAppInfo.js";
36 36
 import listCardInfo from "./components/listCardInfo.vue";
37 37
 import {toQueryString} from "@/utils/index.js"
38 38
 export default {
@@ -115,6 +115,7 @@ export default {
115 115
     // });
116 116
 
117 117
     await readAppInfo();
118
+    await getPhpToken();
118 119
 return
119 120
     let jurisdiction = uni.getStorageSync("jurisdiction") || [];
120 121
     console.log("jurisdiction", jurisdiction);

+ 250 - 226
utils/readAppInfo.js

@@ -1,245 +1,269 @@
1 1
 import {
2
-	selectMerchant,
3
-	queryStoreBranch,
4
-	getImUser
5
-} from '@/commit/api.js'
2
+  selectMerchant,
3
+  queryStoreBranch,
4
+  getImUser
5
+} from "@/commit/api.js";
6 6
 import {
7
-	emConnect,
8
-} from '@/EaseIM/emApis';
9
-import loginStore from '@/store/modules/login.js';
7
+	getPhpGlobalToken
8
+} from "@/commit/order.js";
9
+import { emConnect } from "@/EaseIM/emApis";
10
+import loginStore from "@/store/modules/login.js";
10 11
 
11
-
12
-const {
13
-	loginWithPassword
14
-} = emConnect();
12
+const { loginWithPassword } = emConnect();
15 13
 
16 14
 const setEMUserLoginInfosToStorage = (userId, token) => {
17
-	const params = {
18
-		key: `EM_LOGIN_INFOS`,
19
-		data: {
20
-			userId: userId,
21
-			token: token
22
-		},
23
-	};
24
-	uni.setStorage({
25
-		...params
26
-	});
27
-}
15
+  const params = {
16
+    key: `EM_LOGIN_INFOS`,
17
+    data: {
18
+      userId: userId,
19
+      token: token
20
+    }
21
+  };
22
+  uni.setStorage({
23
+    ...params
24
+  });
25
+};
28 26
 
29 27
 const loginWithUserId = async () => {
30
-	let loginEaseIMId = uni.getStorageSync('im_userid')
31
-	try {
32
-		const res = await loginWithPassword(
33
-			loginEaseIMId,
34
-			uni.getStorageSync('im_pass')
35
-		);
36
-		loginStore.mutations['SET_LOGIN_USER_BASE_INFOS']({
37
-			loginUserId: loginEaseIMId,
38
-		});
39
-		setEMUserLoginInfosToStorage(
40
-			loginEaseIMId.toLowerCase(),
41
-			res.accessToken
42
-			//注意:res.accessToken
43
-		);
44
-	} catch (error) {
45
-		console.log('>>>>>>', error);
46
-		uni.showToast({
47
-			title: '登录失败',
48
-			icon: 'none',
49
-		});
50
-	} finally {
51
-		loginEaseIMId = '';
52
-	}
53
-}
28
+  let loginEaseIMId = uni.getStorageSync("im_userid");
29
+  try {
30
+    const res = await loginWithPassword(
31
+      loginEaseIMId,
32
+      uni.getStorageSync("im_pass")
33
+    );
34
+    loginStore.mutations["SET_LOGIN_USER_BASE_INFOS"]({
35
+      loginUserId: loginEaseIMId
36
+    });
37
+    setEMUserLoginInfosToStorage(
38
+      loginEaseIMId.toLowerCase(),
39
+      res.accessToken
40
+      //注意:res.accessToken
41
+    );
42
+  } catch (error) {
43
+    console.log(">>>>>>", error);
44
+    uni.showToast({
45
+      title: "登录失败",
46
+      icon: "none"
47
+    });
48
+  } finally {
49
+    loginEaseIMId = "";
50
+  }
51
+};
54 52
 
55 53
 const llwFunc = async () => {
56
-	//lww
57
-	let storeStaff = uni.getStorageSync('storeStaff')
58
-	if (storeStaff != null) {
59
-		const res = await queryStoreBranch({
60
-			id: storeStaff.department
61
-		})
62
-		if (res.data.status == 200) {
63
-			uni.setStorageSync('jurisdiction', paramsData.jurisdiction);
64
-		}
65
-	} else {
66
-		uni.setStorageSync('jurisdiction', [7, 9, 5, 3]);
67
-	}
68
-
69
-	// TODO 需要明确含义,目前逻辑是undifined
70
-	let type;
71
-
72
-	if (type == 1) {
73
-		console.log('返回上一页')
74
-		uni.navigateBack({
75
-			delta: 1
76
-		})
77
-	} else {
78
-		uni.switchTab({
79
-			url: '../pages/cashier/index'
80
-		});
81
-	}
82
-}
54
+  //lww
55
+  let storeStaff = uni.getStorageSync("storeStaff");
56
+  if (storeStaff != null) {
57
+    const res = await queryStoreBranch({
58
+      id: storeStaff.department
59
+    });
60
+    if (res.data.status == 200) {
61
+      uni.setStorageSync("jurisdiction", paramsData.jurisdiction);
62
+    }
63
+  } else {
64
+    uni.setStorageSync("jurisdiction", [7, 9, 5, 3]);
65
+  }
66
+
67
+  // TODO 需要明确含义,目前逻辑是undifined
68
+  let type;
69
+
70
+  if (type == 1) {
71
+    console.log("返回上一页");
72
+    uni.navigateBack({
73
+      delta: 1
74
+    });
75
+  } else {
76
+    uni.switchTab({
77
+      url: "../pages/cashier/index"
78
+    });
79
+  }
80
+};
83 81
 
84 82
 const readQuery = () => {
85
-	const hash = window.location.hash; // 例如:#/?param1=value1&param2=value2
83
+  const hash = window.location.hash; // 例如:#/?param1=value1&param2=value2
86 84
 
87
-	// 检查 hash 是否为空
88
-	if (hash) {
89
-		// 创建一个 URLSearchParams 实例
90
-		const queryString = hash.split('?')[1]; // 获取 '?' 后面的部分
91
-		const params = new URLSearchParams(queryString);
85
+  // 检查 hash 是否为空
86
+  if (hash) {
87
+    // 创建一个 URLSearchParams 实例
88
+    const queryString = hash.split("?")[1]; // 获取 '?' 后面的部分
89
+    const params = new URLSearchParams(queryString);
92 90
 
93
-		return JSON.parse(decodeURIComponent(params.get('data')))
94
-	}
95
-}
91
+    return JSON.parse(decodeURIComponent(params.get("data")));
92
+  }
93
+};
96 94
 
97 95
 const func = async () => {
98
-	try {
99
-		const paramsData = readQuery()
100
-		if(!paramsData) {
101
-			return;
102
-		}
103
-		
104
-		console.log('%c [ 1. 读取url登录信息url参数 ]-4', 'font-size:13px; background:pink; color:#bf2c9f;', paramsData)
105
-
106
-		const paramsData1 = {
107
-			"storeStaff": null,
108
-			"x_token": "MTYzMzYxODYzMjY4MTA0NTIwMjUtMDEtMDYgYXQgMjI6MDA6MDkgQ1NU",
109
-			"user": {
110
-				"uid": 16336,
111
-				"wechat_user_id": "0",
112
-				"ali_user_id": "0",
113
-				"account": "18632681045",
114
-				"real_name": "",
115
-				"label_id": null,
116
-				"group_id": "11",
117
-				"nickname": "用户1045",
118
-				"avatar": "https://app.bjtdba.com/uploads/logo.jpg",
119
-				"phone": "18632681045",
120
-				"now_score": null,
121
-				"score": 0,
122
-				"now_money": 0,
123
-				"brokerage_price": 0,
124
-				"admin_agent_rate": null,
125
-				"locktime": null,
126
-				"user_number": null,
127
-				"im": 0,
128
-				"im_uuid": null,
129
-				"last_ip": "20.100.5.11",
130
-				"identity": 5,
131
-				"spreadUid": null,
132
-				"user_type": "MP",
133
-				"pwd": "$2y$10$XARVMD82YRAl9NMwzLcrKeSozdzlnUj7IXp2dvPGYGobzYFlf0j5K",
134
-				"mer_id": 0,
135
-				"spread_count": 0,
136
-				"first_sign": 0
137
-			}
138
-		}
139
-
140
-		uni.setStorageSync('userinfo', paramsData.user);
141
-		uni.setStorageSync('authorization', paramsData.x_token);
142
-		uni.setStorageSync('storeStaff', paramsData.storeStaff);
143
-
144
-		// 用户状态判断
145
-		const userInfoData = await selectMerchant({
146
-			uid: paramsData.user.uid
147
-		});
148
-		
149
-		console.log('%c [ 2. 获取用户信息 ]-4', 'font-size:13px; background:pink; color:#bf2c9f;', userInfoData)
150
-		
151
-		if(userInfoData.data.status === 200) {
152
-			// 新逻辑
153
-			uni.setStorageSync('selectmerchant', userInfoData.data.data);
154
-			let storeStaff = uni.getStorageSync('storeStaff')
155
-			console.log('%c [ storeStaff ]-4', 'font-size:13px; background:pink; color:#bf2c9f;', storeStaff, storeStaff != null)
156
-			console.log('%c [ 本地存储用户信息 userInfo ]-4', 'font-size:13px; background:pink; color:#bf2c9f;', uni.getStorageSync('userinfo'))
157
-			localStorage.setItem('aaa', '33333')
158
-			console.log('读原生的', localStorage.getItem('aaa'))
159
-			
160
-			if (storeStaff) {
161
-				queryStoreBranch({
162
-					id: storeStaff.department
163
-				}).then(res => {
164
-					if (res.data.status == 200) {
165
-						uni.setStorageSync('jurisdiction', res.data.data.jurisdiction);
166
-					}
167
-				})
168
-			} else {
169
-				uni.setStorageSync('jurisdiction', [7, 9, 5, 3]);
170
-			}
171
-			// uni.showToast({
172
-			// 	title: res.data.message,
173
-			// 	icon: "none"
174
-			// })
175
-			setTimeout(function() {
176
-				console.log('%c [ 3. 获取用户信息成功,跳转页面 ]-4', 'font-size:13px; background:pink; color:#bf2c9f;')
177
-				uni.switchTab({
178
-					url: '../../cashier/index'
179
-				});
180
-			}, 700);
181
-		}
182
-		
183
-		
184
-		
185
-		
186
-		return;
187
-		// 之前的逻辑
188
-		
189
-		uni.setStorageSync('selectmerchant', data.data.data);
190
-
191
-		const {
192
-			merchantIntention = {},
193
-		} = userInfoData.data.data || {};
194
-
195
-		uni.setStorage({
196
-			key: 'myUsername',
197
-			data: JSON.stringify(uni.getStorageSync('userinfo').uid),
198
-		});
199
-		uni.setStorage({
200
-			key: 'mer_id',
201
-			data: merchantIntention.mer_id,
202
-		});
203
-
204
-		if (userInfoData.data.status == 200) {
205
-			uni.setStorageSync('selectmerchant', userInfoData.data.data);
206
-
207
-			const imUserData = await getImUser({
208
-				mer_id: uni.getStorageSync('mer_id'),
209
-			});
210
-			// actionEMReconnect();
211
-			const {
212
-				loginWithPassword
213
-			} = emConnect();
214
-			uni.setStorage({
215
-				key: 'im_userid',
216
-				data: imUserData.data.data.im_userid
217
-			})
218
-			uni.setStorage({
219
-				key: 'im_pass',
220
-				data: imUserData.data.data.im_pass
221
-			})
222
-			uni.setStorage({
223
-				key: 'im_uuid',
224
-				data: imUserData.data.data.im_uuid
225
-			})
226
-			//环信注册成功 登录
227
-			if (imUserData.data.status == 200) {
228
-				console.log('>>>>>>>>环信注册成功 登录')
229
-				await loginWithUserId()
230
-			}
231
-
232
-
233
-
234
-			await llwFunc();
235
-
236
-		}
237
-	} catch (error) {
238
-		console.error(error);
239
-		//TODO handle the exception
240
-	}
96
+  try {
97
+    const paramsData = readQuery();
98
+    if (!paramsData) {
99
+      return;
100
+    }
101
+
102
+    console.log(
103
+      "%c [ 1. 读取url登录信息url参数 ]-4",
104
+      "font-size:13px; background:pink; color:#bf2c9f;",
105
+      paramsData
106
+    );
107
+
108
+    const paramsData1 = {
109
+      storeStaff: null,
110
+      x_token: "MTYzMzYxODYzMjY4MTA0NTIwMjUtMDEtMDYgYXQgMjI6MDA6MDkgQ1NU",
111
+      user: {
112
+        uid: 16336,
113
+        wechat_user_id: "0",
114
+        ali_user_id: "0",
115
+        account: "18632681045",
116
+        real_name: "",
117
+        label_id: null,
118
+        group_id: "11",
119
+        nickname: "用户1045",
120
+        avatar: "https://app.bjtdba.com/uploads/logo.jpg",
121
+        phone: "18632681045",
122
+        now_score: null,
123
+        score: 0,
124
+        now_money: 0,
125
+        brokerage_price: 0,
126
+        admin_agent_rate: null,
127
+        locktime: null,
128
+        user_number: null,
129
+        im: 0,
130
+        im_uuid: null,
131
+        last_ip: "20.100.5.11",
132
+        identity: 5,
133
+        spreadUid: null,
134
+        user_type: "MP",
135
+        pwd: "$2y$10$XARVMD82YRAl9NMwzLcrKeSozdzlnUj7IXp2dvPGYGobzYFlf0j5K",
136
+        mer_id: 0,
137
+        spread_count: 0,
138
+        first_sign: 0
139
+      }
140
+    };
141
+
142
+    uni.setStorageSync("userinfo", paramsData.user);
143
+    uni.setStorageSync("authorization", paramsData.x_token);
144
+    uni.setStorageSync("storeStaff", paramsData.storeStaff);
145
+
146
+    // 用户状态判断
147
+    const userInfoData = await selectMerchant({
148
+      uid: paramsData.user.uid
149
+    });
150
+
151
+    console.log(
152
+      "%c [ 2. 获取用户信息 ]-4",
153
+      "font-size:13px; background:pink; color:#bf2c9f;",
154
+      userInfoData
155
+    );
156
+
157
+    if (userInfoData.data.status === 200) {
158
+      // 新逻辑
159
+      uni.setStorageSync("selectmerchant", userInfoData.data.data);
160
+      let storeStaff = uni.getStorageSync("storeStaff");
161
+      console.log(
162
+        "%c [ storeStaff ]-4",
163
+        "font-size:13px; background:pink; color:#bf2c9f;",
164
+        storeStaff,
165
+        storeStaff != null
166
+      );
167
+      console.log(
168
+        "%c [ 本地存储用户信息 userInfo ]-4",
169
+        "font-size:13px; background:pink; color:#bf2c9f;",
170
+        uni.getStorageSync("userinfo")
171
+      );
172
+      localStorage.setItem("aaa", "33333");
173
+      console.log("读原生的", localStorage.getItem("aaa"));
174
+
175
+      if (storeStaff) {
176
+        queryStoreBranch({
177
+          id: storeStaff.department
178
+        }).then((res) => {
179
+          if (res.data.status == 200) {
180
+            uni.setStorageSync("jurisdiction", res.data.data.jurisdiction);
181
+          }
182
+        });
183
+      } else {
184
+        uni.setStorageSync("jurisdiction", [7, 9, 5, 3]);
185
+      }
186
+      // uni.showToast({
187
+      // 	title: res.data.message,
188
+      // 	icon: "none"
189
+      // })
190
+      setTimeout(function () {
191
+        console.log(
192
+          "%c [ 3. 获取用户信息成功,跳转页面 ]-4",
193
+          "font-size:13px; background:pink; color:#bf2c9f;"
194
+        );
195
+        uni.switchTab({
196
+          url: "../../cashier/index"
197
+        });
198
+      }, 700);
199
+    }
200
+
201
+    return;
202
+    // 之前的逻辑
203
+
204
+    uni.setStorageSync("selectmerchant", data.data.data);
205
+
206
+    const { merchantIntention = {} } = userInfoData.data.data || {};
207
+
208
+    uni.setStorage({
209
+      key: "myUsername",
210
+      data: JSON.stringify(uni.getStorageSync("userinfo").uid)
211
+    });
212
+    uni.setStorage({
213
+      key: "mer_id",
214
+      data: merchantIntention.mer_id
215
+    });
216
+
217
+    if (userInfoData.data.status == 200) {
218
+      uni.setStorageSync("selectmerchant", userInfoData.data.data);
219
+
220
+      const imUserData = await getImUser({
221
+        mer_id: uni.getStorageSync("mer_id")
222
+      });
223
+      // actionEMReconnect();
224
+      const { loginWithPassword } = emConnect();
225
+      uni.setStorage({
226
+        key: "im_userid",
227
+        data: imUserData.data.data.im_userid
228
+      });
229
+      uni.setStorage({
230
+        key: "im_pass",
231
+        data: imUserData.data.data.im_pass
232
+      });
233
+      uni.setStorage({
234
+        key: "im_uuid",
235
+        data: imUserData.data.data.im_uuid
236
+      });
237
+      //环信注册成功 登录
238
+      if (imUserData.data.status == 200) {
239
+        console.log(">>>>>>>>环信注册成功 登录");
240
+        await loginWithUserId();
241
+      }
241 242
 
243
+      await llwFunc();
244
+    }
245
+  } catch (error) {
246
+    console.error(error);
247
+    //TODO handle the exception
248
+  }
249
+};
250
+export default func;
242 251
 
252
+export async function getPhpToken() {
253
+  let phpToken = uni.getStorageSync("phpToken");
254
+  let selectmerchant = uni.getStorageSync("selectmerchant");
255
+  if (!phpToken && selectmerchant) {
243 256
 
257
+    try {
258
+      const res = await getPhpGlobalToken({
259
+      	merId: selectmerchant.merId || ""
260
+      }, merId)
261
+      if (res.data.status == 200) {
262
+        const token = res.data.data.token || "";
263
+        uni.setStorageSync("phpToken", token);
264
+      } else {
265
+        uni.setStorageSync("phpToken", "");
266
+      }
267
+    } catch (error) {}
268
+  }
244 269
 }
245
-export default func;