Commit 9b45d0c0 by xinla

--no commit message

1 parent b8b57dfd
......@@ -20,21 +20,21 @@ export function getCustomerList(params, isTrans) {
url: base + '/customer/findAllWeCustomerList',
method: 'get',
params,
}).then((res) => {
}).then(({ data }) => {
if (isTrans) {
let map = {}
let data = []
for (let i = 0; i < res.data?.length; i++) {
let _data = []
for (let i = 0; i < data.length; i++) {
let ai = data[i]
if (!map[ai.firstUserId]) {
data.push({
_data.push({
userId: ai.firstUserId,
customerList: [ai.externalUserid],
})
map[ai.firstUserId] = ai
} else {
for (let j = 0; j < data.length; j++) {
let dj = data[j]
for (let j = 0; j < _data.length; j++) {
let dj = _data[j]
if (dj.userId == ai.firstUserId) {
dj.customerList.push(ai.externalUserid)
break
......@@ -42,9 +42,9 @@ export function getCustomerList(params, isTrans) {
}
}
}
return { data }
return { data: _data }
} else {
return res
return { data }
}
})
}
......
......@@ -149,17 +149,23 @@ export default {
/** 获取详情 */
getDetail(id) {
this.loading = true
getDetail(id).then(({ data }) => {
this.form = data
this.loading = false
})
getDetail(id)
.then(({ data }) => {
this.form = data
})
.finally(() => {
this.loading = false
})
},
sync() {
this.loading = false
sync(this.id).then(() => {
this.msgSuccess('操作成功')
this.loading = false
})
sync(this.id)
.then(() => {
this.msgSuccess('操作成功')
})
.finally(() => {
this.loading = false
})
},
submit() {
this.$refs.form.validate((valid) => {
......@@ -179,20 +185,18 @@ export default {
trackState: ranges.trackState,
isContain: ranges.tags?.length ? ranges.isContain : undefined,
}
debugger
this.loading = true
getCustomerList(params)
getCustomerList(params, 1)
.then(({ data }) => {
if (data?.length) {
form.senderList = data
return this.sendData(form)
this.sendData(form)
} else {
this.msgError('未找到可发送客户!')
this.loading = false
}
})
.finally(() => {
.catch(() => {
this.loading = false
})
} else {
......@@ -202,10 +206,10 @@ export default {
})
},
sendData(form) {
this.loading = true
;(this.id ? update : add)(form)
.then(() => {
this.msgSuccess('添加成功')
this.loading = false
this.$router.back()
})
.finally(() => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!