index.js
23.1 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
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
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
// tabWorkOrder/pages/index/index.js
import api from './api'
import order_mixins from './order_mixins.js'
const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
import {
checkDailyReport,
checkStudyTask,
checkOrderLockGate
} from '~/store/ModalToQueueControl'
import commonApi from '~/api/api'
import { normalizeMarketingFlagOnItem } from '~/utils/marketingFlag'
import {
buildApprovalStatusCounts,
resolveApprovalStatusFilter
} from './services/lowPriceOrder.helpers'
import { resolveDirectWorkOrderAction } from '~/pages/tab/workspace/services/workOrderEntry.helpers'
import {
resolveOrderGoodsUnitPrice,
resolveOrderPackageFinalPrice,
sumOrderMoney
} from '../../utils/orderDisplay.helpers.js'
Page({
/**
* 页面的初始数据
*/
data: {
IMG_URL,
...order_mixins.data,
activeIndex: 0,
//分润
pointsMultiObj: [
{
label: '订单类型',
key: 'djOrderTypeText'
},
{
label: '场景名称',
key: 'baseSceneName'
},
{
label: '审批状态',
key: 'goodsOrderApplyStatusText',
hideIfEmpty: true
},
{
label: '销售顾问 /录单员',
arr: ['merchantName', 'employeeName']
},
{
label: '交付人员',
arr: ['merchantName', 'deliveryEmployeeName']
},
{
label: '转化人员',
arr: ['sellerMerchantName', 'sellerName']
},
{
label: '工单编号',
key: 'orderCode'
},
{
label: '工单时间',
key: 'orderTime'
}
],
orderObj: [
{
label: '订单类型',
key: 'djOrderTypeText'
},
{
label: '场景名称',
key: 'baseSceneName'
},
{
label: '审批状态',
key: 'goodsOrderApplyStatusText'
},
{
label: '销售顾问',
arr: ['merchantName', 'employeeName']
},
{
label: '转化人员',
arr: ['sellerMerchantName', 'sellerName']
},
{
label: '工单编号',
key: 'orderCode'
},
{
label: '工单时间',
key: 'orderTime'
}
],
searchObj: {},
pageNum: 1,
keyword: '',
list: [],
tabIndex: 0,
tabList: ['全部', '待审批', '已通过', '已驳回'],
tabListTemplate: ['全部', '待审批', '已通过', '已驳回'],
isMake: false,
selectType: 1,
showLowPriceOrderPrompt: false,
showOrderpop: false,
pendingWorkOrderParams: null,
isSettingExpiredTraffic: false // 是否启用流量失效
},
// 创建一个动画实例
// createAnimation: function () {
// const animation = wx.createAnimation({
// duration: 300, // 动画持续时间,单位毫秒
// timingFunction: 'ease', // 缓动函数,这里使用了默认的缓动效果
// });
// const iconAnimation = this.selectComponent('#iconAnimation'); // 获取animation组件的实例
// console.log(iconAnimation);
// animation.translateY(0).step(); // 初始状态
// iconAnimation.animationData = animation.export();
// this.setData({
// animationData: animation.export(),
// });
// return animation;
// },
selectType(e) {
let { type } = e.currentTarget.dataset
console.log(e, e.currentTarget.dataset, type)
this.setData({
selectType: type
})
},
foldUp(e) {
let { tabIndex, list } = this.data
let { item, index, listindex } = e.currentTarget.dataset
// 是套餐才展开收起
if (item.packageName) {
console.log(item)
console.log(list[tabIndex][listindex].subOrderList[index])
let foldValue =
list[tabIndex][listindex].subOrderList[index]?.foldUp || false
this.setData({
[`list[${tabIndex}][${listindex}].subOrderList[${index}].foldUp`]:
!foldValue
})
}
},
// 确定是否要显示
showSelectType({ item = {} }) {
let { isSettingExpiredTraffic } = this.data
// 当切换门店后,不支持录入失效客户工单,将selectType置为1录入工单
if (!isSettingExpiredTraffic && this.data.selectType == 3) {
this.setData({
selectType: 1
})
}
wx.$modal(
this,
{
show: true,
title: '请选择录单入口',
tabTitleShow: false,
success: async res => {
// 跳转新增订单页面 并带特定参数
let { orderInfo, selectType } = this.data
console.log(item, 'showSelectType')
if (selectType == 1) {
if (await wx.$globalDataFunction.inspectionOfProhibitionBill())
return
wx.$router.go('tabWorkOrder.createOrder', item)
} else {
wx.$util.showToast('战败单和失效客户录入不在本次迁移范围内')
}
},
error: () => { }
},
'#modal2'
)
},
navbarReady(e) {
// console.log(e)
let navBarHeight = e.detail.height
// console.log('123', navBarHeight)
this.setData({
navBarHeight
})
},
tabClick(e) {
let { searchObj } = this.data
delete searchObj.statusList
delete searchObj.goodsOrderApplyStatusList
delete searchObj.goodsOrderApplyStatus
this.setData({
tabIndex: e.detail,
activeIndex: e.detail,
searchObj
})
this.search()
},
input(e) {
let { value } = e.detail
value = wx.$util.replaceEmoji(value)
this.setData({
keyword: value
})
},
clear() {
this.setData({
keyword: ''
})
this.search()
},
handleBack() {
if (this.data.show_confirm) {
this.closeFilter()
return
}
wx.navigateBack()
},
closeFilter() {
this.setData({
show_confirm: false
})
wx.showTabBar()
},
showConfirm() {
this.setData({
showRendering: true,
show_confirm: true
})
wx.hideTabBar()
},
jump(e) {
const { item, name } = e.currentTarget.dataset
const params = name === 'createOrder' ? { ...item, page: 'edit' } : item
wx.$router.go('tabWorkOrder.' + name, params)
},
// 查看全部商品
showAllGoodsList(e) {
let { item } = e.currentTarget.dataset
let { list } = this.data
list.forEach(val => {
val?.forEach(subVal => {
if (subVal.id == item.id)
subVal.showAllGoodsListFlag = !subVal?.showAllGoodsListFlag
})
})
this.setData({
list
})
},
async delBtn(e) {
// 校验是否填写昨日日报
let staffCheck = await checkDailyReport()
if (staffCheck) return false
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
let lockCheck = await checkOrderLockGate()
if (lockCheck) return false
let _this = this
// let { list } = this.data
// index, ind
let {
item: { orderCode }
} = e.currentTarget.dataset
// 校验订单是否可撤销(退款流程中无法撤销)
let refundStep = await commonApi.getOrderRefundStep({ orderCode })
if (refundStep?.data == 'Y') return _this.showRefundAlert()
wx.showModal({
title: '',
content: '是否确认撤销该工单?',
confirmText: '是',
confirmColor: '#347BFF',
cancelText: '否',
async success(res) {
if (res.confirm) {
_this.showLoading('取消中...')
// 校验订单是否可撤销(退款流程中无法撤销)防止弹出二次确认时长时间未操作,未拦截导致订单状态变更了
let canRefundStep = await commonApi.getOrderRefundStep({ orderCode })
if (canRefundStep?.data == 'Y') return _this.showRefundAlert()
_this.repeal(orderCode)
}
}
})
// list[index][ind]['confirmIndex'] = true
// this.setData({
// list
// })
},
// 拦截订单状态变更弹窗
showRefundAlert() {
wx.showModal({
title: '提示',
content: '订单已发起退款,禁止撤销!如需撤销请联系总部运营。',
showCancel: false,
confirmText: '好的'
})
},
// 撤销该工单
async repeal(orderCode) {
// 校验是否填写昨日日报
let staffCheck = await checkDailyReport()
if (staffCheck) return false
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
let lockCheck = await checkOrderLockGate()
if (lockCheck) return false
let _this = this
api
.revokeOrder({
orderCode
})
.then(_res_ => {
let { code, message } = _res_
if (code == 0) {
// wx.$util.showToast('操作成功')
wx.showToast({
title: '操作成功',
icon: 'success'
})
setTimeout(() => {
_this.search()
}, 500)
} else {
wx.$util.showToast(message)
}
})
},
touchE: function (e) {
// console.log(e)
var that = this
// console.log(e.changedTouches.length)
// debugger
let { item: li } = e.currentTarget.dataset
// console.log(!li.repeal)
if (!li.repeal) return
if (e.changedTouches.length == 1) {
//手指移动结束后触摸点位置的X坐标
var endX = e.changedTouches[0].clientX
//触摸开始与结束,手指移动的距离
var disX = that.data.startX - endX
// console.log(disX)
var delBtnWidth = that.data.delBtnWidth
//如果距离小于删除按钮的1/2,不显示删除按钮
var txtStyle =
disX > delBtnWidth / 2 ? 'left:-' + delBtnWidth + 'rpx' : 'left:0'
//获取手指触摸的是哪一项
var index = e.currentTarget.dataset.index
var ind = e.currentTarget.dataset.ind
var list = that.data.list
list[index][ind].txtStyle = txtStyle
// console.log(list)
//更新列表的状态
that.setData({
list: list
})
}
},
//手指触摸动作开始 记录起点X坐标
async touchstart(e) {
// console.log(e)
// 权限控制 员工不能删除 和没选具体门店的管理员也不能
// canRemark 处理不是员工并且只有一个店的情况
// let { userInfo, canRemark, dataDateStr, today } = this.data
// // (userInfo.userType != 2 || userInfo.isSuper) && (userInfo.subLoginUser.merchantId != userInfo.merchantId || canRemark)
// let canDelete = userInfo.subLoginUser.merchantId != userInfo.merchantId || canRemark
//开始触摸时 重置所有删除
this.data.list.forEach(item => {
// console.log(item)
item.forEach(function (v, i) {
if (v.isTouchMove)
//只操作为true的
v.isTouchMove = false
v.confirmIndex = false
})
})
this.setData({
startX: e.changedTouches[0].clientX,
startY: e.changedTouches[0].clientY,
list: this.data.list
})
},
//滑动事件处理
async touchmove(e) {
if (!this.data.isMake) {
return
}
// console.log(e)
// if (condition) {
// }
// let { userInfo } = this.data
let { item: li } = e.currentTarget.dataset
// console.log(!li.repeal)
if (!li.repeal) return
// let userType = !userInfo.isSuper && userInfo.merchantType
// let orderType = userInfo.userType == 1 && li.status != 9 && li.status != 1 && li.selectPayType != 3 && li.selectPayType != 1
// // 权限检验
// // console.log(!userType || !orderType)
// if (!userType || !orderType) return
var that = this,
index = e.currentTarget.dataset.index, //当前索引
ind = e.currentTarget.dataset.ind, //当前索引
startX = that.data.startX, //开始X坐标
startY = that.data.startY, //开始Y坐标
touchMoveX = e.changedTouches[0].clientX, //滑动变化坐标
touchMoveY = e.changedTouches[0].clientY, //滑动变化坐标
//获取滑动角度
angle = that.angle(
{
X: startX,
Y: startY
},
{
X: touchMoveX,
Y: touchMoveY
}
)
// console.log(that.data.list[index])
that.data.list[index].forEach(function (v, i) {
v.isTouchMove = false
//滑动超过30度角 return
if (Math.abs(angle) > 30) return
if (i == ind) {
if (touchMoveX > startX)
//右滑
v.isTouchMove = false
//左滑
else v.isTouchMove = true
}
})
//更新数据
that.setData({
list: that.data.list
})
},
/**
* 计算滑动角度
* @param {Object} start 起点坐标
* @param {Object} end 终点坐标
*/
angle: function (start, end) {
var _X = end.X - start.X,
_Y = end.Y - start.Y
//返回角度 /Math.atan()返回数字的反正切值
return (360 * Math.atan(_Y / _X)) / (2 * Math.PI)
},
init(userInfo) { },
syncUserContext(done) {
let userInfo = wx.$util.getUserInfo() || {}
let nextShopMerchantId = userInfo?.shopMerchantId || ''
let prevShopMerchantId = this.data.userInfo?.shopMerchantId || ''
let searchObj = { ...(this.data.searchObj || {}) }
let merchantType =
userInfo?.merchantAccountList?.includes('6') ||
userInfo?.merchantAccountList?.includes('8')
let nextUserInfo = {
...userInfo,
merchantType
}
let updateData = {
userInfo: nextUserInfo,
isMake: false
}
// 门店切换后清空筛选里的 merchantId,避免首次进入仍查旧门店数据
if (prevShopMerchantId && prevShopMerchantId !== nextShopMerchantId) {
searchObj.merchantId = ''
updateData.searchObj = searchObj
}
this.setData(updateData, () => {
typeof done === 'function' && done()
})
},
/**
* 生命周期唯一数据入口(onShow 调用);onRoute 禁止拉列表 API。
*/
loadPageData() {
const force = !!wx.$orderListRefresh
wx.$orderListRefresh = false
const runSearch = () => {
this.search()
if (!this._orderConfigLoaded) {
this.getCreateOrderSetting()
this._orderConfigLoaded = true
}
}
if (force) {
this.setData({ searchObj: {}, keyword: '' }, runSearch)
} else {
runSearch()
}
},
search() {
this.setData({
list: [],
pageNum: 1,
flag: false,
nothing: false
})
this.getWorkList()
this.getStatByStatus()
},
getWorkList() {
//
// console.log('getWorkList', this.showLoading)
// this.showLoading('加载中...')
// 解决loading只能有一个的兼容问题
this.showLoading && this.showLoading('加载中...')
let { searchObj, pageNum, keyword, tabIndex, userInfo, status } = this.data
let obj = {
keyword,
pageNum,
...searchObj
}
const approvalStatus = resolveApprovalStatusFilter(tabIndex)
delete obj.statusList
delete obj.goodsOrderApplyStatusList
delete obj.goodsOrderApplyStatus
if (approvalStatus !== undefined) {
obj.goodsOrderApplyStatus = approvalStatus
}
api.getWorkPackageGoodsList(obj).then(res => {
wx.$util.hideLoading()
// console.log('工单', obj, res)
let { code, data, errId, message } = res
let total = 0
let list = []
if (code == 0) {
// 这个是用来判断哪些用户可以撤销的
let userType =
(!wx.$hasPermission?.isSuper?.(userInfo) && userInfo.merchantType) ||
(wx.$hasPermission?.isNotMentor?.(userInfo) && !wx.$hasPermission?.canViewRecruit?.(userInfo))
// let userType = true
data.list.map(e => {
// Mapping for djOrderType
const djOrderTypeMap = {
1: '正常订单',
2: '打折策略',
3: '买赠策略',
4: '冲量活动',
5: '组合付款',
6: '内部结算'
}
e.djOrderTypeText = djOrderTypeMap[e.djOrderType] || ''
// Mapping for goodsOrderApplyStatus
const goodsOrderApplyStatusMap = {
1: '待审批',
2: '待审批',
3: '已通过',
4: '已驳回'
}
e.goodsOrderApplyStatusText =
goodsOrderApplyStatusMap[e.goodsOrderApplyStatus] || ''
e.lowPriceOrderTypeText = '低价订单'
e.salesConsultantText = [e.merchantName, e.employeeName]
.filter(Boolean)
.join('|')
e.conversionStaffText = [e.sellerMerchantName, e.sellerName]
.filter(Boolean)
.join('|')
const approvalPresentationMap = {
1: { color: '#E6A23C', background: '#FFF8E8' },
2: { color: '#E6A23C', background: '#FFF8E8' },
3: { color: '#24B36B', background: '#EDFAF3' },
4: { color: '#EB4E4E', background: '#FFF1F1' }
}
if (e.orderTime)
e.orderTime = new Date(e.orderTime).format('yyyy-MM-dd hh:mm:ss')
// 判断一下是否所有子订单都已经施工,是就跳转 施工完成
e.allConstructionFlag = true
e.subOrderList.map(i => {
normalizeMarketingFlagOnItem(i)
// 判断一下是否所有子订单都已经施工
if (![1, 2].includes(i.constructionStatus)) {
e.allConstructionFlag = false
}
i.finalPrice = Number(wx.$util.decimal(i.finalPrice, 2)).toFixed(2)
})
e.total_price = e.finalPrice
e.finalPrice = Number(wx.$util.decimal(e.finalPrice, 2)).toFixed(2)
// 开票按钮
e.invoiceName = e.invoiceStatus == 2 ? '查看发票' : '申请开票'
// && e.status != 1 待跟进现在也能撤销
let orderType =
(userInfo.userType == 1 || userInfo.userType == 2) &&
e.status != 9 &&e.status != 14 &&
![1, 3, 4].includes(e.selectPayType)
// &&
// e.approveStatus != 0
// let orderType = userInfo.userType !== 1 && e.status != 9 && e.status != 1 && e.selectPayType != 3 && e.selectPayType != 1
// console.log(userType);
// console.log(orderType);
e.repeal = userType && orderType
// 处理subOrderList 商品为空的情况
e.subOrderList = e.subOrderList.filter(item => item.merchantGoodsId)
e.packageGoodsList?.forEach(item => {
item.packageGoodsOrderList.forEach(g => {
g.price = resolveOrderGoodsUnitPrice(g)
// 判断一下是否所有子订单都已经施工
if (![1, 2].includes(g.constructionStatus)) {
e.allConstructionFlag = false
}
})
item.goodsList = item.packageGoodsOrderList
item.price = sumOrderMoney(
item.goodsList.map(resolveOrderGoodsUnitPrice)
)
item.count = item.goodsList.length ? item.goodsList[0].number : 1
item.finalPrice = resolveOrderPackageFinalPrice(item.goodsList)
normalizeMarketingFlagOnItem(item)
})
if (e.packageGoodsList && e.packageGoodsList.length) {
e.subOrderList = e.subOrderList.concat(e.packageGoodsList)
}
// e.subOrderList = e.subOrderList.filter(item => item.id)
// 处理显示订单右上角文字
// console.log(status[e.status])
// console.log(' status[e.status]', status[e.status])
const orderStatus = status[e.status] || {}
const approvalPresentation =
approvalPresentationMap[e.goodsOrderApplyStatus] || {}
let text = e.goodsOrderApplyStatusText || orderStatus.text || ''
let color = approvalPresentation.color || orderStatus.color
let background =
approvalPresentation.background || orderStatus.background
// 不是订单失效状态优先显示已施工 现在不施工
// if (![9, 11, 12].includes(e.status) && e.constructionFlag == 'Y') {
// text = '已施工'
// color = '#347BFF'
// background = '#F3F7FC'
// }
e.statusText = text
e.statuscolor = color
e.statusbackground = background
// 商品是否包含太阳膜
e.isFilmOrder =
e.subOrderList?.findIndex(subE => subE?.upgradeGoodsType == 1) > -1
})
list = data.list
total = data.total
} else {
if (errId != '-5003') wx.$util.showToast(message)
}
if (total != 0) {
this.setData({
[`list[${pageNum - 1}]`]: list
})
}
this.setData({
total,
flag: true,
triggered: false
})
})
},
getStatByStatus() {
let { searchObj, keyword, tabList, tabListTemplate } = this.data
api
.statByStatus({
...searchObj,
keyword
})
.then(result => {
// console.log(result)
let { data, code } = result
if (code == 0) {
const countList = buildApprovalStatusCounts(data)
countList.map((count, index) => {
tabList[index] = {
text: tabListTemplate[index],
count
}
})
this.setData({
tabList
})
}
})
.catch(err => {
console.log(err)
})
},
openLowPriceOrderPrompt() {
this.setData({
showLowPriceOrderPrompt: true,
pendingWorkOrderParams: null
})
},
onLowPriceOrderPromptCancel() {
this.setData({ showLowPriceOrderPrompt: false })
},
onLowPriceOrderPromptConfirm(e) {
const result = resolveDirectWorkOrderAction(e.detail)
this.setData({
showLowPriceOrderPrompt: false,
pendingWorkOrderParams: result.params
})
if (result.action === 'recording') {
this.setData({ showOrderpop: true })
return
}
this.navigateToCreateOrder(result.params)
},
onRecordingOrderSuccess(e) {
const selectOutTradeNoArr = e.detail?.selectOutTradeNoArr || []
if (!selectOutTradeNoArr.length) return
wx.$storage.set('outTradeNo', selectOutTradeNoArr)
this.setData({ showOrderpop: false })
this.navigateToCreateOrder({
...(this.data.pendingWorkOrderParams || {}),
selectOutTradeNoArr,
orderCreateType: 'additionRecordOrder'
})
},
navigateToCreateOrder(params) {
wx.$router.go('tabWorkOrder.createOrder', {
...params,
skipOrderGuards: true
})
},
// test() {
// console.log('test')
// // debugger
// let orderCode = deleteList.splice(0, 1).join('')
// orderCode &&
// api
// .revokeOrder({
// orderCode
// })
// .then(_res_ => {
// let { code } = _res_
// console.log(_res_)
// if (code == 0) {
// // wx.$util.showToast('操作成功')
// wx.showToast({
// title: '操作成功',
// icon: 'success'
// })
// this.test()
// } else {
// wx.setStorageSync('errorCode', orderCode)
// wx.setStorageSync('waitCode', list)
// }
// })
// .catch(error => {
// console.log(error)
// wx.setStorageSync('errorCode', orderCode)
// wx.setStorageSync('waitCode', list)
// })
// },
onRoute(options) {
// console.log('activeIndex' in options);
if ('activeIndex' in options) {
const activeIndex = Number(options.activeIndex) || 0
// let { searchObj } = this.data
// delete searchObj.inviteStatus
this.setData({
activeIndex,
tabIndex: activeIndex,
keyword: '',
searchObj: {}
// searchObj.inviteStatusList
})
}
let { searchObj } = this.data
let userInfo = wx.$util.getUserInfo()
searchObj.merchantId = ''
this.setData({
userInfo: {
...userInfo,
merchantType:
userInfo?.merchantAccountList.includes('6') ||
userInfo?.merchantAccountList.includes('8')
},
searchObj
})
},
// 获取轻改录单配置是否启用流量失效
getCreateOrderSetting() {
let userInfo = wx.$util.getUserInfo()
let merchantType =
userInfo?.merchantAccountList.includes('6') ||
userInfo?.merchantAccountList.includes('8')
if (
merchantType &&
!userInfo?.isSuper &&
userInfo?.loginRole != 3 &&
userInfo?.userType == 2 &&
userInfo?.shopMerchantId
) {
api
.getServiceBaseInfo({ merchantId: userInfo?.shopMerchantId })
.then(res => {
this.setData({
isSettingExpiredTraffic: res?.data?.trafficExpireFlag == 'Y'
})
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.onRoute(options || {})
this.syncUserContext()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () { },
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.syncUserContext(() => {
this.loadPageData()
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () { },
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () { },
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () { },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () { },
scrollonReachBottom() {
let { total, pageNum } = this.data
wx.$util.onReachBottom(
{
total,
pageNum
},
res => {
this.getWorkList()
this.getStatByStatus()
}
)
},
/**
* 监听 TabBar 切换点击
*/
// onTabItemTap(item) {
// console.log(item, 'item')
// },
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () { }
})