陶杰
2024-12-18 d5f269a4155d4e7cd08d85f44861c7d6076d9b2a
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
<template>
    <view class="main-container home relative">
        <!--         <image class="component-bg" 
        src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/21/21c95c14e9504be69edff7785e3b44a9bg.png" mode="scaleToFill" />
         -->
        <!--         <view>
            我的
        </view> -->
        <!-- 背景图 -->
 
        <view class="top-bg" :style="{ 'padding-top': (StatusBar) + 'px', 'line-height': CustomBar + 'rpx' }">
            <view class="title" style="position: relative;">
                首页
 
            </view>
            <view class="flex user-info" v-if="currentInfo && (currentInfo.id)">
 
                <image class="user-icon" v-if="
                    (currentInfo.customerDTO && currentInfo.customerDTO.cover)
                    || (currentInfo.supplierDTO && currentInfo.supplierDTO.cover)
                    || (currentInfo.partnerDTO && currentInfo.partnerDTO.cover)
                    || currentInfo.picture
                " :src="(currentInfo.customerDTO && currentInfo.customerDTO.cover)
                        || (currentInfo.supplierDTO && currentInfo.supplierDTO.cover)
                        || (currentInfo.partnerDTO && currentInfo.partnerDTO.cover)
                        || currentInfo.picture
                        " mode="scaleToFill"></image>
 
                <image class="user-icon" v-else
                    src='https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png'
                    mode="scaleToFill"></image>
 
                <!-- 头像 -->
                <!--     <image class="user-icon" v-if="!currentInfo.picture"
                    src='https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png'
                    mode="aspectFit"></image>
                <image class="user-icon" v-if="currentInfo.picture" :src="currentInfo.picture" mode="aspectFit"></image> -->
 
                <view class="name">
                    <view class="t1 flex" style="align-items: center; justify-content: start;">
                        <!-- {{ (!!currentInfo.supplierDTO?(currentInfo.supplierDTO.name):"") || currentInfo.nickName || currentInfo.loginName || '-'}} -->
                        <span v-if="currentInfo.partnerDTO && currentInfo.partnerDTO.name">
                            {{ currentInfo.partnerDTO.name }}
                        </span>
                        <span v-else-if="currentInfo.supplierSub && currentInfo.supplierSub.name">
                            {{ currentInfo.supplierSub.name }}
                        </span>
                        <span v-else-if="currentInfo.supplierDTO && currentInfo.supplierDTO.name">
                            {{ currentInfo.supplierDTO.name }}
                        </span>
                        <span v-else-if="currentInfo.customerDTO && currentInfo.customerDTO.name">
                            {{ currentInfo.customerDTO.name }}
                        </span>
                        <span v-else-if="currentInfo.nickName">
                            {{ currentInfo.nickName }}
                        </span>
                        <span v-else-if="currentInfo.loginName">
                            {{ currentInfo.loginName }}
                        </span>
                        <span v-else>-</span>
 
                        <span v-if="currentInfo.supplierDTO && currentInfo.supplierDTO.status !== 'P'">
                            ({{ currentInfo.supplierDTO ? currentInfo.supplierDTO.statusStr : '' }})</span>
                        <span v-if="currentInfo.partnerDTO && currentInfo.partnerDTO.status !== 'P'">
                            ({{ currentInfo.partnerDTO ? currentInfo.partnerDTO.statusStr : '' }})</span>
                        <span v-if="!currentInfo.partnerDTO && currentInfo.type === 'partner'">(信息待完善)</span>
                        <view v-if="selftype === 'supplier' && currentInfo.switchFlag " style="margin-left: 10px; display: flex; justify-content: start; align-items: center;">
                            <u--image v-if="selftype === 'supplier' && currentInfo.switchFlag "
                                src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/96/96f6ea502bac4360bf35399e86e463efswitch2.png"
                                width="10px" height="10px" style="margin-left: 20px; margin-right: 20px;"
                                @click="switchSubAccount"></u--image>
                            <!-- <u--text v-if="selftype === 'supplier' && currentInfo.switchFlag " style="color: black;" text="切换账号" @click="switchSubAccount"></u--text> -->
                            <view  v-if="selftype === 'supplier' && currentInfo.switchFlag "  @click="switchSubAccount" style="font-size: 10px; ">切换账号</view>
                        </view>
                    </view>
                    <view class="t2 flex " style="align-items: center; justify-content: start;" >
                        <view>{{ currentInfo.supplierSub.phone || currentInfo.tel || '暂无电话' }}</view>
                        <!-- <view v-if="selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions:sub:account')  ">
                            <view v-if="currentInfo.isSubSupplier" class="account_sub  m-l-a m-r-0"  >子账号</view>
                            <view v-else class="account_sub  m-l-a m-r-0"  >主账号</view>
                        </view> -->
                    </view>
                    <view class="t2" v-if="currentInfo.partnerDTO && currentInfo.partnerDTO.id">
                        ID: {{ currentInfo.partnerDTO.id }}
                    </view>
 
                </view>
            </view>
 
 
        </view>
        <view class="item-container" :class="[selftype ? selftype : '']"
            v-if="
                (selftype === 'supplier' && $hasPermission('supplier:workbench:mine:profit'))
            ||  (selftype === 'partner' && $hasPermission('partner:workbench:mine:profit'))
 
            ">
            <view class="title">我的收益</view>
            <view class="flex tj-container" v-if="selftype === 'partner'">
                <view class="tj-each">
                    <view class="num total">
                        ¥{{ tj.income || '0.00' }}
                    </view>
                </view>
                <view class="tj-each" style="flex: 1;">
                    <view class="num status">
                        待结算
                    </view>
                </view>
            </view>
            <view class="line"></view>
 
            <view class="flex tj-container" v-if="selftype === 'supplier'">
                <view class="tj-each" @click="goto('/sub_pages/supplier/data-statis/data-statis', true)">
                    <view class="num">
                        {{ tj.dealCountLastMonth || 0 }}扎
                    </view>
                    <view class="name">
                        上月成交
                    </view>
                </view>
                <view class="tj-each" @click="goto('/sub_pages/supplier/data-statis/data-statis', true)">
                    <view class="num">
                        {{ tj.dealCountToday || 0 }}扎
                    </view>
                    <view class="name">
                        今日成交
                    </view>
                </view>
                <view class="tj-each" @click="goto('/sub_pages/supplier/data-statis/data-statis', true)">
                    <view class="num">
                        {{ tj.dealCountDay30 || 0 }}扎
                    </view>
                    <view class="name">
                        近30天成交
                    </view>
                </view>
            </view>
            <view class="flex tj-container">
                <view class="tj-each"
                    @click="selftype == 'supplier' && goto('/pages/order/order-delivery?range=today', true)">
                    <view class="num">
                        {{ tj.orderCountToday || 0 }}单
                    </view>
                    <view class="name">
                        今日订单数
                    </view>
                </view>
                <view class="tj-each"
                    @click="selftype == 'supplier' && goto('/pages/order/order-delivery?range=yesterday', true)">
                    <view class="num">
                        {{ tj.orderCountYesterday || 0 }}单
                    </view>
                    <view class="name">
                        昨日订单数
                    </view>
                </view>
                <view class="tj-each"
                    @click="selftype == 'supplier' && goto('/pages/order/order-delivery?range=month', true)">
                    <view class="num">
                        {{ tj.orderCountMonth || 0 }}单
                    </view>
                    <view class="name">
                        本月订单数
                    </view>
                </view>
            </view>
        </view>
        <view class="item-container flex m-t-12" style="padding: 34rpx 44rpx;"
            v-if="(selftype == 'supplier' && $hasPermission('supplier:workbench:after:sale'))">
            <view class="rate-view flex1" style="max-width: 140rpx;">
                <view class="title">售后率</view>
                <view class="title" style="color: red;">{{ ((tj.salesRate || 0) * 100).toFixed(2) }}%</view>
            </view>
            <view class="tj-panel  pink flex1"
                @click="goto('/pages/order/order-delivery?status=PENDING&range=today', true)">
                <view class="name">今日待配送</view>
                <view class="title">{{ tj.deliverCount || 0 }}扎</view>
            </view>
            <view class="tj-panel green flex1"
                @click="goto('/pages/order/order-delivery?status=ARRIVED&range=today', true)">
                <view class="name green">今日配送汇总</view>
                <view class="title">{{ tj.deliverTotal || 0 }}扎</view>
            </view>
        </view>
        <view v-if="
                (selftype === 'supplier' && $hasPermission('supplier:workbench:notice') )
            ||  (selftype === 'partner' && $hasPermission('partner:workbench:notice'))
            "
            class="m-t-12" @click="getNoticeMore">
            <uni-notice-bar class="notice-bar" color="#333" background-color="#fff" show-get-more show-icon
                :scrollable="scrollable" :text="currentNotice.title || '暂无公告'" :key="currentNotice.id" />
            <span v-if="!currentNotice || !currentNotice.id">&nbsp;</span>
        </view>
        <view class="item-container  m-t-12"
            v-if="
            (selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions') )
            ||  (selftype === 'partner' && $hasPermission('partner:workbench:common:functions'))
            ">
            <view class="title">常用功能</view>
            <view class="flex order-icons m-t-12 function-container ">
                <view class="nav row margin-tb function-item " 
                v-if="(selftype === 'partner' && $hasPermission('partner:workbench:common:functions:order:management'))"
                    @click="goto('/sub_pages/partner/order-manage/order-manage', true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon ddgl"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/23/23a7ad86e00c4ba28cd962dc4910433cuser-icon-ddgl.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc tg">订单管理</view>
                </view>
                <view class="nav row margin-tb function-item "
                    v-if="(selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions:order:statistics'))"
                    @click="goto('/sub_pages/supplier/order-manage/order-manage', true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon ddgl"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/23/23a7ad86e00c4ba28cd962dc4910433cuser-icon-ddgl.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc tg">订单统计</view>
                </view>
 
                <view 
                    v-if="(selftype==='partner' && $hasPermission('partner:workbench:common:functions:bill:settlement'))"
                    class="nav row margin-tb function-item "
                    @click="goto('/sub_pages/supplier/order-settlement/order-settlement',true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon zdjs"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/7b/7b7ed1488fd64f6fa9bc6b557f141f37user-icon-zdjs.png" mode="scaleToFill" />
                    </view>
                    <view class="order-desc tg">账单结算</view>
                </view>
                <view class="nav row margin-tb function-item " @click="toFlowManage"
                    v-if="selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions:product:management')">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon spgl"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/47/478e007ad07a43ea9f40a962d83cedb4user-icon-spgl.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc cqw">商品管理</view>
                </view>
                <view class="nav row margin-tb function-item " 
                v-if="(selftype === 'partner' && $hasPermission('partner:workbench:common:functions:markup:configuration'))"
                    @click="goto('/sub_pages/partner/markup-config/markup-config', true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon jjpz"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/93/93356ec339074b49b04c1a3a37146f22user-icon-jjpz.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc tg">加价配置</view>
                </view>
                <view class="nav row margin-tb function-item "
                    v-if="(selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions:after:sale:claim')) || 
                    (selftype === 'partner' && $hasPermission('partner:workbench:common:functions:after:sale:claim') )"
                    @click="goto('/pages/order/order-sale/order-sale', true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon shlp"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/47/47b54c52e4c2430c8f9e91645fbf9ebduser-icon-shlp.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc syst">售后理赔</view>
                </view>
 
                <!-- <view class="nav row margin-tb function-item " @click="printDeliveryOrder">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon kkjl"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/22/22db478554ec436a8c7e6e89c346767duser-icon-kkjl.png" mode="scaleToFill" />
                    </view>
                    <view class="order-desc wbsp">测试蓝牙</view>
                </view> -->
            <!-- </view>
            <view class="flex order-icons m-t-12"> -->
                <view class="nav row margin-tb function-item " 
                    v-if="(selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions:my:wallet'))" @click="goto('/sub_pages/supplier/wallet/my-wallet', true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon shlp"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/8d/8d72f2df8a4348ac90bfbfb553a9cc71qianbao.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc syst">我的钱包</view>
                </view>
 
 
                <!-- <view class="nav row margin-tb function-item "
                    v-if="(selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions:sub:account'))"
                    @click="goto('/sub_pages/supplier/sub-account/sub-account-list', true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon shlp"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/56/56d1a93862a4470e9b4481b970fd6fc9子账号管理.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc syst">子账号</view>
                </view> -->
                <!-- <view class="nav row margin-tb function-item "></view> -->
            </view>
        </view>
 
        <view style="padding-bottom:200rpx">
        </view>
        <common-footer flg="0"></common-footer>
 
 
    </view>
</template>
 
<script>
export default {
    data() {
        return {
            CustomBar: uni.getStorageSync('CustomBar'),
            StatusBar: uni.getStorageSync('StatusBar'),
            tcode: '',
            inviterName: '',
            // StatusBar:0,
 
            //公告的
            noticeList: [],
            currentNoticeIndex: 0,
            currentNotice: {
 
            },
            scrollable: false,
            cacheUserId: '',
            tj: {}
 
        };
    },
    onShareAppMessage() {
        let that = this;
        var name = that.currentInfo.customerDTO && that.currentInfo.customerDTO.name || that.currentInfo.supplierDTO &&
            that.currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && that.currentInfo.partnerDTO.name || ''
        var url =
            `/pages/login/supplier-login?shareId=${this.currentInfo && this.currentInfo.id || ''}&shareName=${name || ''}`; //你的转发页面路径拼接参数
        return {
            title: "花满芫",
            path: url,
        }
    },
    onShareTimeline() {
        let that = this;
        var name = that.currentInfo.customerDTO && that.currentInfo.customerDTO.name || that.currentInfo.supplierDTO &&
            that.currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && that.currentInfo.partnerDTO.name || ''
        var url =
            `/pages/login/supplier-login?shareId=${this.currentInfo && this.currentInfo.id || ''}&shareName=${name || ''}`; //你的转发页面路径拼接参数
        return {
            title: "花满芫",
            path: url,
        }
    },
    async onPullDownRefresh() {
        // 需要判断当前是否是子账号,如果是子账号则需要刷新账号切换的信息
        // const currentInfo = this.$store.state.currentInfo
        // if(currentInfo&&currentInfo.supplierSub&&currentInfo.supplierSub.id){
        //     await this.$store.dispatch('getSwitchSubAccount',currentInfo.supplierSub)
        // }else{
        //     await this.$store.dispatch('getCurrentInfo')
        // }
        await this.$store.dispatch('getCurrentInfo')
        await this.getTj(true)
        uni.stopPullDownRefresh()
    },
    onLoad(options) {
        const url = options.q ? decodeURIComponent(options.q) : '';
        const urlcode = options.url && decodeURIComponent(options.url) || ''
    },
    onShow() {
        this.getTj(true)
    },
    created() {
        //公告
        var type = ''
        // #ifdef PUB_CUSTOMER
        type = 'customer'
        // #endif
        // #ifdef PUB_SUPPLIER
        type = 'supplier'
        // #endif
        // #ifdef PUB_PARTNER
        type = 'partner'
        // #endif
 
        this.$http.request('get', '/api/pub/announcement/list/' + type, {
            params: {
                size: 5,
                status: 'A'
            }
        }).then(res => {
            if (res.code == 0) {
                this.noticeList = (res.data && res.data || [])
                console.log('this.noticeList', this.noticeList)
                if (this.noticeList.length > 0) {
                    this.currentNotice = this.noticeList[0]
                    if (this.currentNotice.title && this.currentNotice.title.length >= 30) {
                        this.scrollable = true
                    } else {
                        this.scrollable = false
                    }
                    let that = this
                    // if (this.noticeList.length >= 1) {
                    //     setInterval(() => {
                    //         console.log('interval,1')
                    //         that.currentNoticeIndex += 1
                    //         that.currentNoticeIndex %= that.noticeList.length
                    //         that.currentNotice = that.noticeList[that.currentNoticeIndex]
                    //         that.scrollable = false
                    //         that.$nextTick(() => {
                    //             if (that.currentNotice.title && that.currentNotice.title
                    //                 .length >= 30) {
                    //                 that.scrollable = true
                    //             } else {
                    //                 that.scrollable = false
                    //             }
                    //         })
 
                    //     }, 8000)
                    // }
 
                }
            }
        })
 
    },
    methods: {
        switchSubAccount() {
            uni.navigateTo({
                url: '/sub_pages/supplier/sub-account/sub-account-switch-list'
            })
        },
        printDeliveryOrder(item) {
            //蓝牙打印
            var that = this;
            wx.getBluetoothAdapterState({
                success: (result) => {
                    // debugger;
                    console.log('b s', result)
                    console.log("蓝牙状态:\n" + result.errMsg)
                    if (result.adapterState.available) {
                        if (result.adapterState.discovering) {
                            that.blueSearchDeviceCheck()
                        } else {
                            that.blueSearchDevice()
                        }
                    } else {
                        //打开蓝牙
                        wx.openBluetoothAdapter({
                            success: function (res) {
                                console.log("蓝牙已打开")
                                that.blueSearchDevice()
 
                            },
                            fail: function (res) {
                                console.log('res', res)
                                that.$message.showToast('蓝牙未打开')
                            }
                        })
 
                    }
                },
                fail: (res) => {
                    console.log("蓝牙状态", res)
                    that.$message.showToast('获取蓝牙状态失败')
 
                }
            })
        },
        blueSearchDevice() {
            var that = this;
 
            wx.startBluetoothDevicesDiscovery({
                success: (res) => {
                    //打印调试日志
                    console.log("搜索设备返回" + JSON.stringify(res))
                    that.blueSearchDeviceCheck()
 
                },
                fail: (res) => {
                    console.log('error search', res)
                    that.$message.showToast('打开蓝牙搜索设备失败')
 
                }
            })
 
        },
        blueSearchDeviceCheck() {
            let that = this
            wx.getBluetoothDevices({
                success: (res) => {
                    var printDevice = undefined
                    for (var device of res.devices) {
                        if (device.name.indexOf('GP-M') >= 0) {
                            printDevice = device
                            // RSSI: -57
                            // advertisServiceUUIDs: Array(2)
                            // 0: "000018f0-0000-1000-8000-00805f9b34fb"
                            // 1: "e7810a71-73ae-499d-8c15-faa9aef0c3f2"
                            // length: 2
                            // nv_length: (...)
                            // __proto__: Array(0)
                            // deviceId: "89:E2:AF:33:46:2B"
                            // name: "GP-M322-5565_BLE"
                            break
                        } else {
 
                        }
                    }
                    if (!printDevice) {
                        that.$message.showToast('未找到可用打印机,请联系客服')
                        that.stopBluetoothDevicesDiscovery()
 
                    } else {
                        wx.createBLEConnection({
                            deviceId: printDevice.deviceId,
                            success: function (res) {
                                // https: //blog.csdn.net/weixin_51375107/article/details/116009436
                                console.log('连接设备返回:' + res.errMsg);
                                that.$message.showToast('连接设备返回:' + res.errMsg)
                                // escpos怎么来 →点击查看智谱清言的回答https://chatglm.cn/share/FEXaC
 
                            },
                            fail: function (res) {
                                console.log('createBLEConnection fail', res)
                                that.$message.showToast('连接打印机失败')
                            },
                            complete() {
                                that.stopBluetoothDevicesDiscovery()
 
                            }
                        })
                    }
                    // res.devices.forEach((device, i) => {
                    //     console.log('device',
                    //         device)
                    //     // if (device.deviceId == that.data
                    //     //     .deviceId) {
                    //     //     console.log("物联网设备已找到")
                    //     //     that.$message.showToast(
                    //     //         '打印设备已找到')
                    //     //     return;
                    //     // }
                    // })
                },
                fail: (res) => {
                    console.log('getBluetoothDevices',
                        res)
                    that.$message.showToast('获取蓝牙设备失败')
 
                }
            })
        },
        stopBluetoothDevicesDiscovery() {
            var that = this;
            wx.stopBluetoothDevicesDiscovery({
                success: (res) => {
                    console.log("停止扫描设备")
                },
            })
        },
        getTj(refresh = false) {
            // /api/supplier/delivery    
 
            if (this.currentInfo.id && (this.currentInfo.id !== this.cacheUserId || refresh)) {
                this.cacheUserId = this.currentInfo.id
                let that = this
                setTimeout(() => {
                    //其他统计
                    // #ifdef PUB_SUPPLIER
                    this.$http.request('get', '/api/supplier/delivery/statistics', {}).then(res => {
                        if (res.code === 0) {
                            that.tj = res.data || {}
                        }
                    })
                    // #endif
                    // #ifdef PUB_PARTNER
                    this.$http.request('get', '/api/partner/order/statistics', {}).then(res => {
                        if (res.code === 0) {
                            that.tj = res.data || {}
                        }
                    })
                    // #endif
 
                }, 200)
            }
 
        },
        async toFlowManage() {
 
 
            if (!this.currentInfo.supplierDTO) {
                await this.$message.confirm('尚未入驻店铺信息,是否前往入驻?')
                this.goto('/sub_pages/supplier/supplier-info/supplier-info', true)
                return
            }
            if (this.currentInfo.supplierDTO) {
                //需要刷新一下当前用户信息
                this.$message.showLoading()
                await this.$store.dispatch('getCurrentInfo')
                this.$message.hideLoading()
 
                if (this.currentInfo.supplierDTO.status == 'P') {
 
                } else {
                    if (this.currentInfo.supplierDTO.status == 'R') {
                        await this.$message.confirm('店铺信息审核不通过,是否前往修改信息?')
                        this.goto('/sub_pages/supplier/supplier-info/supplier-info', true)
                        return
                    } else {
                        this.$message.showToast('审核中请耐心等待')
                        return
                    }
 
                }
            }
            console.log('goto')
            this.goto('/sub_pages/supplier/flower-manage/flower-manage', true)
        },
        getNoticeMore() {
            uni.navigateTo({
                url: '/pages/notice/list?id=' + this.currentNotice.id
            })
        },
 
 
 
 
    }
}
</script>
 
<style lang="scss" scoped>
@import "../user/user.scss";
 
@import "./home.scss";
</style>
 
<style lang="css" scoped>
 
.function-container {
  display: flex;
  flex-wrap: wrap; 
  justify-content: space-start; 
}
 
.function-item {
  min-width: 25%;
  max-width: 25%;
  text-align: center; 
  padding: 10px; 
  box-sizing: border-box;
  margin-bottom: 10px; 
}
.account_sub {
    width: 80rpx;
    height: 24rpx;
    border-radius: 30rpx;
    border: 2rpx solid #23A9F2;
    font-size: 18rpx;
    color: white;
    line-height: 20rpx;
    text-align: center;
    background-color: #23A9F2;
    margin-left: 10px !important;
}
</style>