|
|
|
@ -15,16 +15,6 @@
|
|
|
|
|
>
|
|
|
|
|
<template #search>
|
|
|
|
|
<el-form inline>
|
|
|
|
|
<el-form-item label="所属店铺" prop="storeId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="state.condition.storeId"
|
|
|
|
|
:config="{ label: 'name', value: 'id' }"
|
|
|
|
|
:opts="opts.store"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="客服ID" prop="waiterId">
|
|
|
|
|
<el-input v-model="state.condition.waiterId" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="客服昵称" prop="waiterNickname">
|
|
|
|
|
<el-input v-model="state.condition.waiterNickname" />
|
|
|
|
|
</el-form-item>
|
|
|
|
@ -39,23 +29,17 @@
|
|
|
|
|
:model="formState.form"
|
|
|
|
|
:rules="formState.rules"
|
|
|
|
|
>
|
|
|
|
|
<el-form-item label="所属店铺" prop="storeId">
|
|
|
|
|
<el-form-item label="客服员工" prop="userId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="formState.form.storeId"
|
|
|
|
|
:config="{ label: 'name', value: 'id' }"
|
|
|
|
|
:disabled="formState.form.id"
|
|
|
|
|
:opts="opts.store"
|
|
|
|
|
v-model="formState.form.userId"
|
|
|
|
|
:config="{ label: 'employeeName', value: 'id' }"
|
|
|
|
|
:disabled="!!formState.form.id"
|
|
|
|
|
:opts="opts.employee"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="客服类型" prop="type">
|
|
|
|
|
<el-input v-model="formState.form.type" maxlength="20" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="客服头像" prop="waiterAvatar">
|
|
|
|
|
<el-upload-image v-model="formState.form.waiterAvatar" config-id="im/" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="客服ID" prop="waiterId">
|
|
|
|
|
<el-input v-model="formState.form.waiterId" :disabled="!!formState.form.id" maxlength="20" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="客服昵称" prop="waiterNickname">
|
|
|
|
|
<el-input v-model="formState.form.waiterNickname" maxlength="20" />
|
|
|
|
|
</el-form-item>
|
|
|
|
@ -72,7 +56,6 @@
|
|
|
|
|
import ElButton from '@/components/extra/ElButton.vue';
|
|
|
|
|
import ElImage from '@/components/extra/ElImage.vue';
|
|
|
|
|
const store = useStore();
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
|
const loading = ref(false);
|
|
|
|
|
const code = computed(() => store.state.chatWaiter.code);
|
|
|
|
@ -84,36 +67,19 @@
|
|
|
|
|
}
|
|
|
|
|
const state = reactive({
|
|
|
|
|
condition: {
|
|
|
|
|
storeId: null,
|
|
|
|
|
waiterId: null,
|
|
|
|
|
waiterNickname: null,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
const handleReset = () => {
|
|
|
|
|
state.condition = {
|
|
|
|
|
storeId: unref(opts).store?.[0]?.id,
|
|
|
|
|
waiterId: null,
|
|
|
|
|
waiterNickname: null,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
const handleSearch = async () => {
|
|
|
|
|
if (state.condition.storeId) {
|
|
|
|
|
loading.value = true;
|
|
|
|
|
await store.dispatch('chatWaiter/search');
|
|
|
|
|
loading.value = false;
|
|
|
|
|
} else {
|
|
|
|
|
store.commit('chatWaiter/setList', []);
|
|
|
|
|
store.commit('chatWaiter/setTotal', 0);
|
|
|
|
|
}
|
|
|
|
|
loading.value = true;
|
|
|
|
|
await store.dispatch('chatWaiter/search');
|
|
|
|
|
loading.value = false;
|
|
|
|
|
};
|
|
|
|
|
watch(
|
|
|
|
|
() => unref(opts).store,
|
|
|
|
|
(value) => {
|
|
|
|
|
if (!state.condition.storeId) {
|
|
|
|
|
state.condition.storeId = value[0]?.id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
watch(
|
|
|
|
|
() => state.condition,
|
|
|
|
|
(value) => {
|
|
|
|
@ -121,20 +87,7 @@
|
|
|
|
|
},
|
|
|
|
|
{ immediate: true, deep: true }
|
|
|
|
|
);
|
|
|
|
|
watch(
|
|
|
|
|
() => state.condition.storeId,
|
|
|
|
|
() => {
|
|
|
|
|
handleSearch();
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
onActivated(() => {
|
|
|
|
|
let storeId = route.query.storeId;
|
|
|
|
|
if (storeId) {
|
|
|
|
|
state.condition.storeId = +storeId;
|
|
|
|
|
} else {
|
|
|
|
|
handleSearch();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
onActivated(handleSearch);
|
|
|
|
|
|
|
|
|
|
/* 表单 */
|
|
|
|
|
const refsForm = ref(null);
|
|
|
|
@ -143,17 +96,13 @@
|
|
|
|
|
submitting: false,
|
|
|
|
|
form: {
|
|
|
|
|
id: null,
|
|
|
|
|
storeId: null,
|
|
|
|
|
type: null,
|
|
|
|
|
waiterAvatar: null,
|
|
|
|
|
waiterId: null,
|
|
|
|
|
userId: null,
|
|
|
|
|
waiterNickname: null,
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
|
|
|
|
storeId: [{ required: true, message: '所属店铺不能为空' }],
|
|
|
|
|
type: [{ required: true, message: '客服类型不能为空' }],
|
|
|
|
|
waiterAvatar: [{ required: true, message: '客服头像不能为空' }],
|
|
|
|
|
waiterId: [{ required: true, message: '客服ID不能为空' }],
|
|
|
|
|
userId: [{ required: true, message: '客服员工不能为空' }],
|
|
|
|
|
waiterNickname: [{ required: true, message: '客服昵称不能为空' }],
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
@ -163,10 +112,8 @@
|
|
|
|
|
formState.form,
|
|
|
|
|
row || {
|
|
|
|
|
id: null,
|
|
|
|
|
storeId: null,
|
|
|
|
|
type: null,
|
|
|
|
|
waiterAvatar: null,
|
|
|
|
|
waiterId: null,
|
|
|
|
|
userId: null,
|
|
|
|
|
waiterNickname: null,
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
@ -189,10 +136,10 @@
|
|
|
|
|
formState.submitting = false;
|
|
|
|
|
};
|
|
|
|
|
const handleRemove = async (rows) => {
|
|
|
|
|
store.dispatch('chatWaiter/remove', {
|
|
|
|
|
storeId: state.condition.storeId,
|
|
|
|
|
waiterIds: rows.map((item) => item.waiterId),
|
|
|
|
|
});
|
|
|
|
|
store.dispatch(
|
|
|
|
|
'chatWaiter/remove',
|
|
|
|
|
rows.map((row) => row.id)
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
const config = reactive({
|
|
|
|
|
// 表格列配置
|
|
|
|
@ -202,23 +149,19 @@
|
|
|
|
|
width: 60,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '所属店铺',
|
|
|
|
|
width: 160,
|
|
|
|
|
label: '客服员工',
|
|
|
|
|
slots: {
|
|
|
|
|
default: ({ row }) => proxy.$dict(unref(opts).store, row.storeId, { label: 'name', value: 'id' }),
|
|
|
|
|
default: ({ row }) =>
|
|
|
|
|
proxy.$dict(unref(opts).employee, row.userId, { label: 'employeeName', value: 'id' }),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '客服头像',
|
|
|
|
|
width: 160,
|
|
|
|
|
slots: {
|
|
|
|
|
default: ({ row }) => <ElImage src={row.waiterAvatar} alt={row.waiterNickname} />,
|
|
|
|
|
default: ({ row }) => <ElImage src={row.waiterAvatar} alt={row.waiterNickname} width="64px" />,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '客服ID',
|
|
|
|
|
prop: 'waiterId',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '客服昵称',
|
|
|
|
|
prop: 'waiterNickname',
|
|
|
|
|