storeBelieveInLight преди 1 година
родител
ревизия
1da7710ca1
променени са 7 файла, в които са добавени 237 реда и са изтрити 67 реда
  1. 0 1
      commit/order.js
  2. 2 2
      commit/request.js
  3. 2 1
      pages.json
  4. 94 51
      pages/cashier/index.vue
  5. 117 0
      pages/cashier/latestRecords.vue
  6. 1 1
      pages/user/login/index.vue
  7. 21 11
      utils/readAppInfo.js

+ 0 - 1
commit/order.js

@@ -205,7 +205,6 @@ export function confirmReceiptApi(id, data) {
205 205
  * @returns 
206 206
  */
207 207
 export function getPhpGlobalToken(data, merId) {
208
-    return ;
209 208
     return myRequestPhp({
210 209
         url: `${pre}mer/getPhpToken?${merId}`,
211 210
         method: 'POST',

+ 2 - 2
commit/request.js

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

+ 2 - 1
pages.json

@@ -6,7 +6,8 @@
6 6
         "path": "pages/cashier/index",
7 7
         "style": {
8 8
           // "navigationBarTitleText": "收银台"
9
-          "navigationStyle": "custom"
9
+          "navigationStyle": "custom",
10
+          "enablePullDownRefresh": true
10 11
         }
11 12
       },
12 13
       {

+ 94 - 51
pages/cashier/index.vue

@@ -49,18 +49,18 @@
49 49
       </view>
50 50
     </view>
51 51
 
52
-	
53
-    <view class="cashier-list" v-if="Number(zhuangi) != 7 ? false : true">	
54
-		<view class="cashier-list-top">
55
-		   <view class="cashier-jilu-top" style="font-weight: bold;"> 总贡献值: {{gongxian || 0}} </view>
56
-			<view class="cashier-jilu-top" style="font-weight: bold;"> 总京豆: {{jingdou  || 0}} </view>
57
-		</view>
58
-		<view class="cashier-list-top"></view>
59
-		
60
-		
61
-		
52
+    <view class="cashier-list" v-if="Number(zhuangi) != 7 ? false : true">
53
+      <view class="cashier-list-top">
54
+        <view class="cashier-jilu-top" style="font-weight: bold">
55
+          总贡献值: {{ gongxian || 0 }}
56
+        </view>
57
+        <view class="cashier-jilu-top" style="font-weight: bold">
58
+          总京豆: {{ jingdou || 0 }}
59
+        </view>
60
+      </view>
61
+      <view class="cashier-list-top"></view>
62
+
62 63
       <view class="cashier-list-top">
63
-		  
64 64
         <view class="cashier-list-top-left">
65 65
           <view
66 66
             class="yi"
@@ -76,7 +76,7 @@
76 76
             </view>
77 77
           </view>
78 78
         </view>
79
-		
79
+
80 80
         <view class="cashier-list-top-right" @click="peratingt">
81 81
           <view class="cashier-list-top-right-text"> 经营报表 </view>
82 82
           <view class="cashier-list-top-right-icon">
@@ -88,7 +88,7 @@
88 88
           </view>
89 89
         </view>
90 90
       </view>
91
-	  
91
+
92 92
       <view class="cashier-list-tbot">
93 93
         <view class="yis">
94 94
           <view class="sgjd">
@@ -118,12 +118,12 @@
118 118
 						消费分
119 119
 					</view>
120 120
 				</view> -->
121
-        <view class="yis">
121
+        <!-- <view class="yis">
122 122
           <view class="sgjd">
123 123
             {{ dataList.sun == undefined ? 0 : dataList.sun }}
124 124
           </view>
125 125
           <view class="sf"> 锁定会员数 </view>
126
-        </view>
126
+        </view> -->
127 127
         <view class="yis">
128 128
           <view class="sgjd">
129 129
             {{
@@ -138,6 +138,20 @@
138 138
           </view>
139 139
           <view class="sf"> 支付人数 </view>
140 140
         </view>
141
+        <view class="yis">
142
+          <view class="sgjd">
143
+            {{ dataList.jingdousum == undefined ? 0 : dataList.jingdousum }}
144
+          </view>
145
+          <view class="sf"> 京豆 </view>
146
+        </view>
147
+        <view class="yis">
148
+          <view class="sgjd">
149
+            {{
150
+              dataList.gongxianSumsum == undefined ? 0 : dataList.gongxianSumsum
151
+            }}
152
+          </view>
153
+          <view class="sf"> 贡献值 </view>
154
+        </view>
141 155
         <!-- 默认 -->
142 156
         <view class="yis">
143 157
           <view class="sgjd"> </view>
@@ -145,7 +159,8 @@
145 159
         </view>
146 160
       </view>
147 161
     </view>
148
-    <view
162
+    <latestRecords class="mt26" :records="records"></latestRecords>
163
+    <!-- <view
149 164
       class="cashier-jilu"
150 165
       :style="Number(zhuangi) != 7 ? 'margin-top:170rpx' : ''"
151 166
     >
@@ -176,7 +191,7 @@
176 191
           </view>
177 192
         </view>
178 193
       </view>
179
-    </view>
194
+    </view> -->
180 195
     <view
181 196
       class=""
182 197
       v-if="tihsi == 0"
@@ -193,10 +208,12 @@ import {
193 208
   selectMerchantOrder,
194 209
   payUserList,
195 210
   getZuorijinri,
196
-  getZuixinjilu
211
+  getZuixinjilu,
197 212
 } from "@/commit/shop.js";
198
-import readAppInfo,{getPhpToken} from "@/utils/readAppInfo.js";
213
+import readAppInfo, { getPhpToken } from "@/utils/readAppInfo.js";
214
+import latestRecords from "./latestRecords.vue";
199 215
 export default {
216
+  components: { latestRecords },
200 217
   data() {
201 218
     return {
202 219
       is_panudn: true,
@@ -210,6 +227,7 @@ export default {
210 227
       dataList: [], //今日昨日收益
211 228
       page: 1, //默认1页
212 229
       limit: 10, //默认10条数据
230
+      records: [], //最新记录
213 231
       items: [
214 232
         {
215 233
           name: "今日",
@@ -221,8 +239,8 @@ export default {
221 239
       List: [], //列表数据
222 240
       tihsi: "",
223 241
       zhuangi: "",
224
-	  gongxian: 0,
225
-	  jingdou: 0
242
+      gongxian: 0,
243
+      jingdou: 0,
226 244
     };
227 245
   },
228 246
   async onLoad() {
@@ -233,12 +251,13 @@ export default {
233 251
     this.end_time = this.$time.dateFormat("yyyy-MM-dd", daySart);
234 252
     let selectmerchant = uni.getStorageSync("selectmerchant");
235 253
 
236
-
237
-  let authorization = uni.getStorageSync("authorization");
254
+    let authorization = uni.getStorageSync("authorization");
238 255
     let userinfo = uni.getStorageSync("userinfo");
239
-	    this.mer_id = selectmerchant.merId;
256
+    this.mer_id = selectmerchant.merId;
240 257
     let jurisdiction = uni.getStorageSync("jurisdiction");
241
-     await getPhpToken()
258
+    if (this.mer_id > 0) {
259
+      await getPhpToken();
260
+    }
242 261
     if (jurisdiction) {
243 262
       jurisdiction.forEach((res, index) => {
244 263
         if (res == 7) {
@@ -265,8 +284,8 @@ export default {
265 284
         });
266 285
         this.selectMerchant();
267 286
         this.selectMerchantOrder();
268
-		this.getZuorijinri();
269
-		this.getZuixinjilu();
287
+        this.getZuorijinri();
288
+        this.getZuixinjilu();
270 289
         this.payUserList();
271 290
         return;
272 291
       } else if (
@@ -293,9 +312,6 @@ export default {
293 312
         url: "/pages/user/login/index",
294 313
       });
295 314
     }
296
-
297
-
298
-
299 315
   },
300 316
   onShow() {
301 317
     return;
@@ -370,6 +386,7 @@ export default {
370 386
     this.page = 1;
371 387
     this.is_panudn = true;
372 388
     this.List = [];
389
+    this.getZuixinjilu()
373 390
     this.payUserList();
374 391
     this.selectMerchant();
375 392
     this.selectMerchantOrder();
@@ -468,6 +485,7 @@ export default {
468 485
     },
469 486
     // 最新纪录列表
470 487
     payUserList() {
488
+      return
471 489
       payUserList({
472 490
         mer_id: this.mer_id,
473 491
         pageNum: this.page,
@@ -498,37 +516,59 @@ export default {
498 516
     },
499 517
     // 顶部统计
500 518
     getZuorijinri() {
501
-      getZuorijinri({
502
-      }).then(
519
+      getZuorijinri({}).then(
503 520
         (res) => {
504
-			console.log('顶部统计');
505
-			console.log(res.data);
506
-			console.log(res.data.data.list.gongxian);
507
-			 if (res.data.status == 200) {
508
-				 this.gongxian = res.data.data.list.gongxian;
509
-				 this.jingdou = res.data.data.list.jingdou;
510
-			 }
521
+          console.log("顶部统计");
522
+          console.log(res.data);
523
+          console.log(res.data.data.list.gongxian);
524
+          if (res.data.status == 200) {
525
+            this.gongxian = res.data.data.list.gongxian;
526
+            this.jingdou = res.data.data.list.jingdou;
527
+          }
511 528
         },
512 529
         (fail) => {
513
-			console.log(fail);
530
+          console.log(fail);
514 531
         }
515 532
       );
516 533
     },
517
-	// 最新纪录
518
-	getZuixinjilu() {
519
-	  getZuixinjilu({
534
+    // 最新纪录
535
+    getZuixinjilu() {
536
+      uni.showLoading({
537
+        title: "加载中",
538
+      });
539
+      getZuixinjilu({
520 540
         mer_id: this.mer_id,
521 541
         pageNum: this.page,
522 542
         pageSize: this.limit,
523 543
       }).then(
524
-	    (res) => {
525
-			console.log(res);
526
-	    },
527
-	    (fail) => {
528
-	      console.log(fail);
529
-	    }
530
-	  );
531
-	},
544
+        (res) => {
545
+          uni.stopPullDownRefresh();
546
+          console.log(res);
547
+          if (res.data.status == 200) {
548
+            // this.tihsi = res.data.data.count || 0;
549
+            this.tihsi = res.data.data.list.lenght || 0;
550
+            if (res.data.data.count > 0) {
551
+              if (this.page == 1) {
552
+                this.records = res.data.data.list;
553
+              } else {
554
+                this.records = this.records.concat(res.data.data.list);
555
+              }
556
+            } else {
557
+              if (this.page == 1) {
558
+                this.records = [];
559
+              }
560
+              this.is_panudn = false;
561
+            }
562
+            console.log(this.records,"recordsrecordsrecords")
563
+            uni.hideLoading();
564
+          }
565
+        },
566
+        (fail) => {
567
+          console.log(fail);
568
+          uni.hideLoading();
569
+        }
570
+      );
571
+    },
532 572
   },
533 573
 };
534 574
 </script>
@@ -539,6 +579,9 @@ page {
539 579
 </style>
540 580
 
541 581
 <style lang="scss" scoped>
582
+.mt26 {
583
+  margin-top: 26rpx;
584
+}
542 585
 .cashier-topin {
543 586
   width: 100%;
544 587
   height: 176rpx;

+ 117 - 0
pages/cashier/latestRecords.vue

@@ -0,0 +1,117 @@
1
+<template>
2
+  <view class="record-container">
3
+    <view class="record-title">最新记录</view>
4
+    <view v-for="(item, index) in records" :key="index" class="record-item">
5
+      <view class="user-info">
6
+        <image class="user-avatar" :src="item.avatar" @error="handleError" v-if="item.avatar&&!isError"></image>
7
+        <image class="user-avatar" src="/static/images/new_ui/wutu.png" v-else></image>
8
+        <view class="user-details">
9
+          <view class="user-name">用户 {{ item.nickname }}</view>
10
+          <view class="user-id">ID:{{ item.out_trade_no }}</view>
11
+          <view class="consume-amount">消费金额 {{ item.money || "0.00" }}</view>
12
+        </view>
13
+      </view>
14
+      <view class="record-info">
15
+        <view class="record-time">{{ item.pay_time }}</view>
16
+        <view class="pv-info">pv: {{ item.pv }}</view>
17
+        <view v-for="(reward, rewardIndex) in rewards" :key="rewardIndex" class="reward-info">
18
+          获取 {{ reward.type=="jingdou"?item.jingdou||0 :item.gongxian ||0}} {{ reward.name }}
19
+        </view>
20
+      </view>
21
+    </view>
22
+  </view>
23
+</template>
24
+<script>
25
+
26
+export default {
27
+    props:{
28
+      records:{
29
+        type:Array,
30
+        default:()=>[]
31
+      }
32
+    },
33
+  data() {
34
+    return {
35
+        isError:false,
36
+         rewards: [
37
+            { type:"gongxian", name: '贡献值' },
38
+            { type:"jingdou", name: '京豆' }
39
+          ],
40
+    };
41
+  },
42
+  methods: {
43
+      handleError(e) {
44
+        this.isError = true;
45
+      }
46
+  }
47
+}
48
+</script>
49
+<style lang="scss" scoped>
50
+.record-container {
51
+    width: calc(100% - 55rpx);
52
+  height: 100%;
53
+    background: #ffffff;
54
+    border-radius: 16rpx;
55
+}
56
+.record-title {
57
+  font-size: 36rpx;
58
+  font-weight: bold;
59
+  margin-bottom: 20rpx;
60
+  padding: 15rpx 25rpx;
61
+}
62
+.record-item {
63
+  display: flex;
64
+  justify-content: space-between;
65
+  align-items: flex-start;
66
+  border-bottom: 1rpx solid #e0e0e0;
67
+  padding: 0 20rpx 20rpx 15rpx;
68
+  margin-bottom: 20rpx;
69
+  &:last-child{
70
+     border-bottom:none;
71
+  }
72
+}
73
+.user-info {
74
+  display: flex;
75
+  align-items: center;
76
+}
77
+.user-avatar {
78
+  width: 60rpx;
79
+  height: 60rpx;
80
+  border-radius: 50%;
81
+  margin-right: 20rpx;
82
+}
83
+.user-details {
84
+  display: flex;
85
+  flex-direction: column;
86
+}
87
+.user-name {
88
+  font-size: 32rpx;
89
+  margin-bottom: 10rpx;
90
+}
91
+.user-id {
92
+  font-size: 28rpx;
93
+  color: #999;
94
+  margin-bottom: 10rpx;
95
+}
96
+.consume-amount {
97
+  font-size: 28rpx;
98
+  background-color: #f0f9ff;
99
+  color: #1890ff;
100
+  padding: 6rpx 12rpx;
101
+  border-radius: 4rpx;
102
+}
103
+.record-info {
104
+  text-align: right;
105
+}
106
+.record-time {
107
+  font-size: 28rpx;
108
+  margin-bottom: 10rpx;
109
+}
110
+.pv-info {
111
+  font-size: 28rpx;
112
+  margin-bottom: 10rpx;
113
+}
114
+.reward-info {
115
+  font-size: 28rpx;
116
+}
117
+</style>

+ 1 - 1
pages/user/login/index.vue

@@ -385,7 +385,7 @@ export default {
385 385
                       if (data.data.status == 200) {
386 386
                         uni.setStorageSync("selectmerchant", data.data.data);
387 387
                         let storeStaff = uni.getStorageSync("storeStaff");
388
-						 getPhpToken()
388
+						//  getPhpToken()
389 389
                         if (storeStaff != null) {
390 390
                           queryStoreBranch({
391 391
                             id: storeStaff.department

+ 21 - 11
utils/readAppInfo.js

@@ -4,12 +4,16 @@ import {
4 4
   getImUser
5 5
 } from "@/commit/api.js";
6 6
 import {
7
-	getPhpGlobalToken
7
+  getPhpGlobalToken
8 8
 } from "@/commit/order.js";
9
-import { emConnect } from "@/EaseIM/emApis";
9
+import {
10
+  emConnect
11
+} from "@/EaseIM/emApis";
10 12
 import loginStore from "@/store/modules/login.js";
11 13
 
12
-const { loginWithPassword } = emConnect();
14
+const {
15
+  loginWithPassword
16
+} = emConnect();
13 17
 
14 18
 const setEMUserLoginInfosToStorage = (userId, token) => {
15 19
   const params = {
@@ -203,7 +207,9 @@ const func = async () => {
203 207
 
204 208
     uni.setStorageSync("selectmerchant", data.data.data);
205 209
 
206
-    const { merchantIntention = {} } = userInfoData.data.data || {};
210
+    const {
211
+      merchantIntention = {}
212
+    } = userInfoData.data.data || {};
207 213
 
208 214
     uni.setStorage({
209 215
       key: "myUsername",
@@ -221,7 +227,9 @@ const func = async () => {
221 227
         mer_id: uni.getStorageSync("mer_id")
222 228
       });
223 229
       // actionEMReconnect();
224
-      const { loginWithPassword } = emConnect();
230
+      const {
231
+        loginWithPassword
232
+      } = emConnect();
225 233
       uni.setStorage({
226 234
         key: "im_userid",
227 235
         data: imUserData.data.data.im_userid
@@ -249,15 +257,17 @@ const func = async () => {
249 257
 };
250 258
 export default func;
251 259
 
252
-export async function getPhpToken() {
260
+export async function getPhpToken(merId) {
253 261
   let phpToken = uni.getStorageSync("phpToken");
254 262
   let selectmerchant = uni.getStorageSync("selectmerchant");
255
-  if (!phpToken && selectmerchant) {
256
-
263
+  // console.log("phpToken", phpToken);
264
+  // console.log("selectmerchant", selectmerchant);
265
+  if (!phpToken && (selectmerchant && selectmerchant.merId > 0) || merId > 0) {
266
+     const merIdS = merId || selectmerchant.merId || ""
257 267
     try {
258 268
       const res = await getPhpGlobalToken({
259
-      	merId: selectmerchant.merId || ""
260
-      }, merId)
269
+        merId: merIdS
270
+      }, merIdS)
261 271
       if (res.data.status == 200) {
262 272
         const token = res.data.data.token || "";
263 273
         uni.setStorageSync("phpToken", token);
@@ -266,4 +276,4 @@ export async function getPhpToken() {
266 276
       }
267 277
     } catch (error) {}
268 278
   }
269
-}
279
+}