Commit 9b45d0c0 by xinla

--no commit message

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