CustomerInfo.js
2.81 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
// components/CarBrands/CarBrands.js
import api from '../../api'
let isNum, num, y, time
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
observer: function (n) {
let { isFirst } = this.data
if (n && isFirst) {
this.init()
this.setData({
isFirst: false
})
}
}
}
},
/**
* 组件的初始数据
*/
data: {
orderInfo: {},
// storageData: null,
customerList: [],
isFirst: true
},
pageLifetimes: {
show: function () {},
hide: function () {}
},
/**
* 组件的方法列表
*/
methods: {
init(keyword) {
// console.log('getBrandList')
// console.log(storageData)
let params = {
pageSize: 999999,
pageNum: 1,
// upgradeFinishFlag: 'R',
inviteStatusList: [1, 3],
// ...data
keyword
}
let customerList = []
api.getInviteList(params).then(res => {
// console.log(res)
// this.setCar(res.data, changeMerchantId)
// console.log(res)
let { data, code } = res
if (code == 0 && data?.list.length) {
// data.list = data.list.map(item => {
// if (item.customer && item.customer.carSeriesName) {
// item.carType = `${item.customer.carBrand || ''}-${item.customer.carChildsBrandName || ''}-${item.customer.carSeriesName || ''}`
// }
// return item
// })
customerList = data.list
}
this.setData({
customerList
})
})
},
searchCar(e) {
let { value } = e.detail
this.init(value)
},
choose(e) {
let { item, index } = e.currentTarget.dataset
console.log(item, index)
let { customerList } = this.data
customerList = customerList.map(item => {
item.active = false
return item
})
customerList[index].active = true
let orderInfo = item
orderInfo.orderSource = 4
// delete orderInfo.orderCode
// 去除掉错误订单对应的关联码
// delete orderInfo.associateOrderCode
// 'orderCode',
let deleteList = ['associateOrderCode', 'merchantDistributionList', 'expenseCategoryList', 'profitAllocatinList']
for (var i = 0; i < deleteList.length; i++) {
// console.log(arr[i])
delete orderInfo[deleteList[i]]
}
this.setData({
customerList,
orderInfo
})
},
confirm() {
let { orderInfo, customerList } = this.data
let flag = customerList.some(item => {
return item.active
})
if (!flag) {
return wx.$util.showToast('请选择客户')
}
this.triggerEvent('confirm', orderInfo)
this.setData({
show: false
})
}
}
})