feat 初始化客户管理规范
This commit is contained in:
parent
3cebbb54c7
commit
dd3b354f4d
@ -24,6 +24,7 @@
|
||||
"axios": "^0.27.2",
|
||||
"countup.js": "^2.1.0",
|
||||
"echarts": "5.2.2",
|
||||
"element-china-area-data": "^6.0.2",
|
||||
"element-plus": "^2.3.2",
|
||||
"file-saver": "2.0.5",
|
||||
"fuse.js": "6.4.6",
|
||||
|
@ -1,5 +1,14 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* @Descripttion: 小程序客户Api接口
|
||||
* @version: (1.0)
|
||||
* @Author: (黎文豪)
|
||||
* @Date: (2023-06-05)
|
||||
* @LastEditors: (黎文豪)
|
||||
* @LastEditTime: (2023-06-05)
|
||||
*/
|
||||
|
||||
// 小程序客户分页查询列表
|
||||
export function customerList(query) {
|
||||
return request({
|
||||
@ -9,7 +18,6 @@ export function customerList(query) {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 小程序客户新增或修改
|
||||
export function addOrUpdateCustomer(data) {
|
||||
return request({
|
||||
@ -30,8 +38,9 @@ export function delCustomer(ids) {
|
||||
// 小程序客户导出
|
||||
export function exportCustomer(query) {
|
||||
return request({
|
||||
url: 'business/Customer/export',
|
||||
url: 'business/Customer/exportCustomer',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
200
src/views/business/Custom/Customers/components/AddDialog.vue
Normal file
200
src/views/business/Custom/Customers/components/AddDialog.vue
Normal file
@ -0,0 +1,200 @@
|
||||
<!--
|
||||
* @Descripttion: (小程序客户/tb_customer 添加弹窗)
|
||||
* @version: (1.0)
|
||||
* @Author: (黎文豪)
|
||||
* @Date: (2023-06-05)
|
||||
* @LastEditors: (黎文豪)
|
||||
* @LastEditTime: (2023-06-05)
|
||||
-->
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="添加小程序客户信息" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||
<el-row :gutter="20">
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="自己的省市区" prop="RegionPid">
|
||||
<el-cascader class="w100" :options="dataList"
|
||||
:props="{ checkStrictly: false, value: 'regionId', label: 'regionName', emitPath: true }"
|
||||
placeholder="请选择自己的省市区" clearable v-model="formData.regionPid" @change="handleCascaderChange">
|
||||
<template #default="{ node, data }">
|
||||
<span>{{ data.regionName }}</span>
|
||||
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
||||
</template>
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="openid" prop="customerXcxOpenid">
|
||||
<el-input v-model="formData.customerXcxOpenid" placeholder="请输入openid" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="昵称" prop="customerNickname">
|
||||
<el-input v-model="formData.customerNickname" placeholder="请输入昵称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="手机号" prop="customerMobilePhoneNumber">
|
||||
<el-input v-model="formData.customerMobilePhoneNumber" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="头像" prop="customerAvatar">
|
||||
<UploadImage ref="uploadRef" v-model="formData.customerAvatar" :data=imgData :limit="1" :fileSize="5"
|
||||
:drag="true" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="性别" prop="customerGender">
|
||||
<el-select v-model="formData.customerGender" placeholder="请选择性别">
|
||||
<el-option v-for="item in sys_user_sex " :key="item.dictValue" :label="item.dictLabel"
|
||||
:value="parseInt(item.dictValue)"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="可用余额" prop="customerAvailableBalance">
|
||||
<el-input-number v-model.number="formData.customerAvailableBalance" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="可用积分" prop="customerAvailablePoints">
|
||||
<el-input-number v-model.number="formData.customerAvailablePoints" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="总支付金额" prop="customerTotalPaymentAmount">
|
||||
<el-input-number v-model.number="formData.customerTotalPaymentAmount" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="实际消费金额" prop="customerActualConsumptionAmount">
|
||||
<el-input-number v-model.number="formData.customerActualConsumptionAmount" controls-position="right"
|
||||
:min="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="最后登录时间" prop="customerLastLoginTime">
|
||||
<el-date-picker v-model="formData.customerLastLoginTime" type="datetime" :teleported="false"
|
||||
placeholder="选择日期时间"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<div key="dialog-footer">
|
||||
<el-button type="primary" @click="handleAddClick(formRef)">添加</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { ElMessage } from 'element-plus'
|
||||
import modal from '@/plugins/modal.js'
|
||||
import { addOrUpdateCustomer } from '@/api/business/Custom/Customers/customer.js';
|
||||
import { regionTreeList } from '@/api/business/Custom/Regions/region.js';
|
||||
|
||||
|
||||
// 打开弹窗时回调
|
||||
const openDialog = async () => {
|
||||
|
||||
await getTreeList()
|
||||
await getsys_user_sex()
|
||||
|
||||
}
|
||||
|
||||
// -业务参数
|
||||
// 性别字典选项列表
|
||||
const sys_user_sex = ref([]);
|
||||
const dataList = ref([])
|
||||
|
||||
// -业务方法
|
||||
// 字典获取
|
||||
async function getsys_user_sex() {
|
||||
await proxy.getDicts('sys_user_sex').then((res) => {
|
||||
sys_user_sex.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取省市区数据
|
||||
async function getTreeList() {
|
||||
regionTreeList().then((res) => {
|
||||
if (res.code == 200) {
|
||||
dataList.value = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function handleCascaderChange(selectedValues) {
|
||||
// 处理选中的值
|
||||
console.log(selectedValues);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -基础参数
|
||||
const labelWidth = 100;
|
||||
const formRef = ref();
|
||||
const { proxy } = getCurrentInstance()
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const formData = reactive({
|
||||
});
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
done: Function,
|
||||
});
|
||||
const imgData = ref({
|
||||
fileDir: "Customer"
|
||||
})
|
||||
|
||||
// 验证
|
||||
const rules = reactive({
|
||||
customerGuid: [{ required: true, message: "不能为空", trigger: "blur", type: "number" }],
|
||||
customerXcxOpenid: [{ required: true, message: "openid不能为空", trigger: "blur" }],
|
||||
customerNickname: [{ required: true, message: "昵称不能为空", trigger: "blur" }],
|
||||
customerMobilePhoneNumber: [{ required: true, message: "手机号不能为空", trigger: "blur" }],
|
||||
customerAvatar: [{ required: true, message: "头像不能为空", trigger: "blur" }],
|
||||
customerGender: [{ required: true, message: "性别不能为空", trigger: "change", type: "number" }],
|
||||
customerAvailableBalance: [{ required: true, message: "可用余额不能为空", trigger: "blur" }],
|
||||
customerAvailablePoints: [{ required: true, message: "可用积分不能为空", trigger: "blur" }],
|
||||
customerTotalPaymentAmount: [{ required: true, message: "总支付金额不能为空", trigger: "blur" }],
|
||||
customerActualConsumptionAmount: [{ required: true, message: "实际消费金额不能为空", trigger: "blur" }],
|
||||
customerLastLoginTime: [{ required: true, message: "最后登录时间不能为空", trigger: "blur" }],
|
||||
});
|
||||
|
||||
// -基础方法
|
||||
|
||||
// 提交
|
||||
const handleAddClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const { code } = await addOrUpdateCustomer(formData);
|
||||
if (code == 200) {
|
||||
modal.msgSuccess('添加成功')
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
};
|
||||
const closeDialog = () => {
|
||||
handleResetClick(formRef.value);
|
||||
props.done();
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
142
src/views/business/Custom/Customers/components/DetailDialog.vue
Normal file
142
src/views/business/Custom/Customers/components/DetailDialog.vue
Normal file
@ -0,0 +1,142 @@
|
||||
<!--
|
||||
* @Descripttion: (小程序客户/tb_customer 详情弹窗)
|
||||
* @version: (1.0)
|
||||
* @Author: (黎文豪)
|
||||
* @Date: (2023-06-05)
|
||||
* @LastEditors: (黎文豪)
|
||||
* @LastEditTime: (2023-06-05)
|
||||
-->
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="小程序客户信息详情" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :disabled="true">
|
||||
|
||||
<el-row :gutter="20">
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="openid">
|
||||
<el-input v-model="formData.customerXcxOpenid" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="昵称">
|
||||
<el-input v-model="formData.customerNickname" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="手机号">
|
||||
<el-input v-model="formData.customerMobilePhoneNumber" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="头像">
|
||||
<UploadImage ref="uploadRef" v-model="formData.customerAvatar" :limit="1" :fileSize="5" :drag="true"
|
||||
:isShowTip="false" :isDisabled="true" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="性别">
|
||||
<el-select v-model="formData.customerGender">
|
||||
<el-option v-for="item in sys_user_sex " :key="item.dictValue" :label="item.dictLabel"
|
||||
:value="parseInt(item.dictValue)"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="可用余额">
|
||||
<el-input-number v-model.number="formData.customerAvailableBalance" controls-position="right"
|
||||
:precision="2" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="可用积分">
|
||||
<el-input-number v-model.number="formData.customerAvailablePoints" controls-position="right" :precision="2" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="总支付金额">
|
||||
<el-input-number v-model.number="formData.customerTotalPaymentAmount" controls-position="right"
|
||||
:precision="2" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="实际消费金额">
|
||||
<el-input-number v-model.number="formData.customerActualConsumptionAmount" controls-position="right"
|
||||
:precision="2" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="最后登录时间">
|
||||
<el-date-picker v-model="formData.customerLastLoginTime" type="datetime" :teleported="false"
|
||||
isabledStr></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { reactive, ref, watch } from "vue";
|
||||
|
||||
|
||||
// 打开弹窗时回调
|
||||
const openDialog = async () => {
|
||||
await getsys_user_sex()
|
||||
|
||||
}
|
||||
|
||||
const formData = ref({
|
||||
...props.data,
|
||||
});
|
||||
watch(props, async (v) => {
|
||||
formData.value = v.data;
|
||||
});
|
||||
|
||||
// -业务参数
|
||||
// 性别字典选项列表
|
||||
const sys_user_sex = ref([]);
|
||||
|
||||
// -业务方法
|
||||
// 字典获取
|
||||
async function getsys_user_sex() {
|
||||
await proxy.getDicts('sys_user_sex').then((res) => {
|
||||
sys_user_sex.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 基础参数
|
||||
const formRef = ref();
|
||||
const labelWidth = 100;
|
||||
const { proxy } = getCurrentInstance()
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
data: Object,
|
||||
done: Function,
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
|
||||
|
||||
// -基础方法
|
||||
const closeDialog = () => {
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
</script>
|
192
src/views/business/Custom/Customers/components/EditDialog.vue
Normal file
192
src/views/business/Custom/Customers/components/EditDialog.vue
Normal file
@ -0,0 +1,192 @@
|
||||
<!--
|
||||
* @Descripttion: (小程序客户/tb_customer 编辑弹窗)
|
||||
* @version: (1.0)
|
||||
* @Author: (黎文豪)
|
||||
* @Date: (2023-06-05)
|
||||
* @LastEditors: (黎文豪)
|
||||
* @LastEditTime: (2023-06-05)
|
||||
-->
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="修改小程序客户信息" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||
<el-row :gutter="20">
|
||||
|
||||
|
||||
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="openid" prop="customerXcxOpenid">
|
||||
<el-input v-model="formData.customerXcxOpenid" placeholder="请输入openid" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="昵称" prop="customerNickname">
|
||||
<el-input v-model="formData.customerNickname" placeholder="请输入昵称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="手机号" prop="customerMobilePhoneNumber">
|
||||
<el-input v-model="formData.customerMobilePhoneNumber" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="头像" prop="customerAvatar">
|
||||
<UploadImage ref="uploadRef" v-model="formData.customerAvatar" :data=imgData :limit="1" :fileSize="5"
|
||||
:drag="true" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="性别" prop="customerGender">
|
||||
<el-select v-model="formData.customerGender" placeholder="请选择性别">
|
||||
<el-option v-for="item in sys_user_sex " :key="item.dictValue" :label="item.dictLabel"
|
||||
:value="parseInt(item.dictValue)"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="可用余额" prop="customerAvailableBalance">
|
||||
<el-input-number v-model.number="formData.customerAvailableBalance" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="可用积分" prop="customerAvailablePoints">
|
||||
<el-input-number v-model.number="formData.customerAvailablePoints" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="总支付金额" prop="customerTotalPaymentAmount">
|
||||
<el-input-number v-model.number="formData.customerTotalPaymentAmount" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="实际消费金额" prop="customerActualConsumptionAmount">
|
||||
<el-input-number v-model.number="formData.customerActualConsumptionAmount" controls-position="right"
|
||||
:min="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="最后登录时间" prop="customerLastLoginTime">
|
||||
<el-date-picker v-model="formData.customerLastLoginTime" type="datetime" :teleported="false"
|
||||
placeholder="选择日期时间"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="handleEditClick(formRef)">编辑</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import modal from '@/plugins/modal.js'
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { addOrUpdateCustomer } from "@/api/business/Custom/Customers/customer.js";
|
||||
|
||||
|
||||
// 打开弹窗时回调
|
||||
const openDialog = async () => {
|
||||
await getsys_user_sex()
|
||||
|
||||
}
|
||||
|
||||
const formData = ref({
|
||||
...props.data,
|
||||
});
|
||||
watch(props, async (v) => {
|
||||
formData.value = v.data;
|
||||
|
||||
});
|
||||
|
||||
// 业务参数
|
||||
// 性别字典选项列表
|
||||
const sys_user_sex = ref([]);
|
||||
|
||||
// -业务方法
|
||||
//字典获取
|
||||
async function getsys_user_sex() {
|
||||
await proxy.getDicts('sys_user_sex').then((res) => {
|
||||
sys_user_sex.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -基础参数
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
data: Object,
|
||||
done: Function,
|
||||
});
|
||||
|
||||
const labelWidth = 100;
|
||||
const formRef = ref();
|
||||
const { proxy } = getCurrentInstance()
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const imgData = ref({
|
||||
fileDir: "Customer"
|
||||
})
|
||||
|
||||
// 验证
|
||||
const rules = reactive({
|
||||
customerGuid: [{ required: true, message: "不能为空", trigger: "blur", type: "number" }],
|
||||
customerXcxOpenid: [{ required: true, message: "openid不能为空", trigger: "blur" }],
|
||||
customerNickname: [{ required: true, message: "昵称不能为空", trigger: "blur" }],
|
||||
customerMobilePhoneNumber: [{ required: true, message: "手机号不能为空", trigger: "blur" }],
|
||||
customerAvatar: [{ required: true, message: "头像不能为空", trigger: "blur" }],
|
||||
customerGender: [{ required: true, message: "性别不能为空", trigger: "change", type: "number" }],
|
||||
customerAvailableBalance: [{ required: true, message: "可用余额不能为空", trigger: "blur" }],
|
||||
customerAvailablePoints: [{ required: true, message: "可用积分不能为空", trigger: "blur" }],
|
||||
customerTotalPaymentAmount: [{ required: true, message: "总支付金额不能为空", trigger: "blur" }],
|
||||
customerActualConsumptionAmount: [{ required: true, message: "实际消费金额不能为空", trigger: "blur" }],
|
||||
customerLastLoginTime: [{ required: true, message: "最后登录时间不能为空", trigger: "blur" }],
|
||||
});
|
||||
|
||||
// -基础方法
|
||||
// 提交
|
||||
const handleEditClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const { code } = await addOrUpdateCustomer(formData.value);
|
||||
if (code == 200) {
|
||||
modal.msgSuccess('修改成功')
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
}
|
||||
const closeDialog = () => {
|
||||
props.done();
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
</script>
|
262
src/views/business/Custom/Customers/index.vue
Normal file
262
src/views/business/Custom/Customers/index.vue
Normal file
@ -0,0 +1,262 @@
|
||||
<!--
|
||||
* @Descripttion: (小程序客户/tb_customer)
|
||||
* @version: (1.0)
|
||||
* @Author: (黎文豪)
|
||||
* @Date: (2023-06-05)
|
||||
* @LastEditors: (黎文豪)
|
||||
* @LastEditTime: (2023-06-05)
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="24">
|
||||
<!-- 搜索框 queryParams.需要搜索的字段 -->
|
||||
<el-form :model="queryParams" label-position="left" style="margin:15px;" inline ref="queryForm" label-width="68px" v-show="showSearch"
|
||||
@submit.prevent>
|
||||
<el-form-item label="小程序openid" prop="customerXcxOpenid">
|
||||
<el-input v-model="queryParams.customerXcxOpenid" placeholder="请输入小程序openid" clearable @keyup.enter="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="昵称" prop="customerNickname">
|
||||
<el-input v-model="queryParams.customerNickname" placeholder="请输入昵称" clearable @keyup.enter="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="customerMobilePhoneNumber">
|
||||
<el-input v-model="queryParams.customerMobilePhoneNumber" placeholder="请输入手机号" clearable @keyup.enter="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="最后登录时间">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
style="width: 240px"
|
||||
type="daterange"
|
||||
@change="handleQuery"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
placeholder="请选择最后登录时间"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
:shortcuts="dateOptions">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button>
|
||||
<el-button icon="refresh" @click="resetQuery">{{ $t('btn.reset') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<!-- 工具按钮 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" v-hasPermi="['business:customer:addOrUpdateKey']" plain icon="plus" @click="AddDialogVisible = true">
|
||||
{{ $t('btn.add') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" :disabled="multiple" v-hasPermi="['business:customer:delete']" plain icon="delete" @click="handleDelete">
|
||||
{{ $t('btn.delete') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="download" @click="handleExport" v-hasPermi="['business:customer:export']">
|
||||
{{ $t('btn.export') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 表格渲染 prop="对应的字段"-->
|
||||
<el-table v-loading="loading" :data="dataList" ref="tableRef" border highlight-current-row @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
|
||||
<el-table-column prop="customerXcxOpenid" label="小程序openid" align="center" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="customerNickname" label="昵称" align="center" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="customerMobilePhoneNumber" label="手机号" align="center" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="customerAvatar" label="头像" align="center">
|
||||
<template #default="scope">
|
||||
<el-image preview-teleported :hide-on-click-modal="true" lazy class="table-td-thumb" fit="contain" :src="scope.row.customerAvatar.split(',')[0]" :preview-src-list="scope.row.customerAvatar.split(',')">
|
||||
<div><el-icon :size="15"><document /></el-icon></div>
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="customerGender" label="性别(字典)" align="center">
|
||||
<template #default="scope">
|
||||
<dict-tag :options=" sys_user_sex " :value="scope.row.customerGender" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="customerAvailableBalance" label="可用余额" align="center" sortable />
|
||||
<el-table-column prop="customerAvailablePoints" label="可用积分" align="center" sortable />
|
||||
<el-table-column prop="customerTotalPaymentAmount" label="总支付金额" align="center" sortable />
|
||||
<el-table-column prop="customerActualConsumptionAmount" label="实际消费金额" align="center" sortable />
|
||||
<el-table-column prop="customerLastLoginTime" label="最后登录时间" align="center" :show-overflow-tooltip="true" sortable />
|
||||
|
||||
<el-table-column label="操作" width="350" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" size="small" icon="edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['business:customer:addOrUpdateKey']">编辑</el-button>
|
||||
<el-button type="danger" size="small" icon="delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['business:customer:delete']">删除</el-button>
|
||||
<el-button size="small" icon="view" @click="handleDetail(scope.row)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
</div>
|
||||
|
||||
<!-- 添加 -->
|
||||
<AddDialog v-model="AddDialogVisible" :done="() => resetQuery()"></AddDialog>
|
||||
<!-- 编辑 -->
|
||||
<EditDialog v-model="EditDialogVisible" :data="EditDialogRow" :done="() => resetQuery()"></EditDialog>
|
||||
<!-- 详情 -->
|
||||
<DetailDialog v-model="DetailDialogVisible" :data="DetailDialogRow" :done="() => resetQuery()"></DetailDialog>
|
||||
</template>
|
||||
<script setup name="customer">
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import modal from '@/plugins/modal.js'
|
||||
import { exportCustomer, customerList , delCustomer } from '@/api/business/Custom/Customers/customer.js'
|
||||
import AddDialog from "./components/AddDialog.vue";
|
||||
import EditDialog from "./components/EditDialog.vue";
|
||||
import DetailDialog from "./components/DetailDialog.vue";
|
||||
|
||||
const AddDialogVisible = ref(false);
|
||||
const EditDialogVisible = ref(false);
|
||||
const EditDialogRow = ref({});
|
||||
const DetailDialogVisible = ref(false);
|
||||
const DetailDialogRow = ref({});
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
// 选中categoryId数组数组
|
||||
const ids = ref([])
|
||||
// 非单选禁用
|
||||
const single = ref(true)
|
||||
// 非多个禁用
|
||||
const multiple = ref(true)
|
||||
// 显示搜索条件
|
||||
const showSearch = ref(true)
|
||||
// 数据列表
|
||||
const dataList = ref([])
|
||||
// 总记录数
|
||||
const total = ref(0)
|
||||
// 是否加载
|
||||
const loading = ref(true)
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
})
|
||||
const { queryParams } = toRefs(data)
|
||||
const dateRange = ref([])
|
||||
|
||||
|
||||
// 业务参数
|
||||
|
||||
|
||||
// 业务方法
|
||||
|
||||
// 字典获取
|
||||
const sys_user_sex = ref([]);
|
||||
async function getsys_user_sex() {
|
||||
await proxy.getDicts('sys_user_sex').then((res) => {
|
||||
sys_user_sex.value = res.data
|
||||
})
|
||||
}
|
||||
getsys_user_sex()
|
||||
|
||||
|
||||
|
||||
|
||||
//基础方法
|
||||
|
||||
// 查询数据
|
||||
function getList() {
|
||||
loading.value = true
|
||||
customerList(proxy.addDateRange(queryParams.value, dateRange.value)).then((res) => {
|
||||
if (res.code == 200) {
|
||||
loading.value = false
|
||||
dataList.value = res.data.result
|
||||
total.value = res.data.totalNum
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.customerId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 重置查询操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm('queryForm')
|
||||
handleQuery()
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
getList()
|
||||
}
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const Ids = row.customerId || ids.value
|
||||
|
||||
ElMessageBox.confirm("是否确认删除?", "系统提示", {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: "warning",
|
||||
})
|
||||
.then(function () {
|
||||
return delCustomer(Ids)
|
||||
})
|
||||
.then(() => {
|
||||
handleQuery()
|
||||
modal.msgSuccess("删除成功")
|
||||
})
|
||||
.catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport(row) {
|
||||
const Ids = row.customerId || ids.value
|
||||
const name = ref("所有")
|
||||
|
||||
if (Ids.length != 0) {
|
||||
let str = ''
|
||||
for (const key in Ids) {
|
||||
str += Ids[key] + ','
|
||||
}
|
||||
str = str.slice(0, str.length - 1)
|
||||
queryParams.value.ids = str
|
||||
name.value = "选中"
|
||||
}
|
||||
|
||||
ElMessageBox.confirm('是否确认导出' + name.value + '数据?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(function () {
|
||||
return exportCustomer(queryParams.value)
|
||||
})
|
||||
.then((response) => {
|
||||
proxy.download(response.data.path)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 修改
|
||||
function handleUpdate(row) {
|
||||
EditDialogVisible.value = true
|
||||
EditDialogRow.value = row
|
||||
}
|
||||
|
||||
// 详情
|
||||
function handleDetail(row) {
|
||||
DetailDialogVisible.value = true
|
||||
DetailDialogRow.value = row
|
||||
}
|
||||
|
||||
handleQuery()
|
||||
</script>
|
@ -49,7 +49,7 @@
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { ElMessage } from 'element-plus'
|
||||
import modal from '@/plugins/modal.js'
|
||||
import { regionTreeList, addOrUpdateRegion } from '@/api/business/Regions/region.js';
|
||||
import { regionTreeList, addOrUpdateRegion } from '@/api/business/Custom/Regions/region.js';
|
||||
|
||||
|
||||
// 打开弹窗时回调
|
@ -54,7 +54,7 @@
|
||||
<script setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { regionTreeList } from "@/api/business/Regions/region.js";
|
||||
import { regionTreeList } from "@/api/business/Custom/Regions/region.js";
|
||||
|
||||
|
||||
// 打开弹窗时回调
|
@ -61,7 +61,7 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import modal from '@/plugins/modal.js'
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { regionTreeList, addOrUpdateRegion } from "@/api/business/Regions/region.js";
|
||||
import { regionTreeList, addOrUpdateRegion } from "@/api/business/Custom/Regions/region.js";
|
||||
|
||||
|
||||
// 打开弹窗时回调
|
@ -76,7 +76,7 @@
|
||||
<script setup name="region">
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import modal from '@/plugins/modal.js'
|
||||
import { exportRegion, regionTreeList , delRegion } from '@/api/business/Regions/region.js'
|
||||
import { exportRegion, regionTreeList , delRegion } from '@/api/business/Custom/Regions/region.js'
|
||||
import AddDialog from "./components/AddDialog.vue";
|
||||
import EditDialog from "./components/EditDialog.vue";
|
||||
import DetailDialog from "./components/DetailDialog.vue";
|
@ -1,126 +0,0 @@
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="添加小程序客户信息" width="900px" @closed="closeDialog">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||
<el-row :gutter="20">
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户姓名" prop="customerName">
|
||||
<el-input v-model="formData.customerName" placeholder="请输入客户姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户生日" prop="customerBirth">
|
||||
<el-input v-model="formData.customerBirth" placeholder="请输入客户生日" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户头像 (人脸识别)" prop="customerImg">
|
||||
<UploadImage ref="uploadRef" v-model="formData.customerImg" :data=imgData :limit="1" :fileSize="5"
|
||||
:drag="true" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户性别 1: 男 2: 女" prop="customerSex">
|
||||
<el-radio-group v-model="formData.customerSex">
|
||||
<el-radio v-for="item in customerSexOptions" :key="item.dictValue" :label="parseInt(item.dictValue)">{{item.dictLabel}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户电话" prop="customerPhone">
|
||||
<el-input v-model="formData.customerPhone" placeholder="请输入客户电话" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="小程序openid" prop="customerXcxOpenid">
|
||||
<el-input v-model="formData.customerXcxOpenid" placeholder="请输入小程序openid" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="小程序名称" prop="customerXcxName">
|
||||
<el-input v-model="formData.customerXcxName" placeholder="请输入小程序名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="小程序头像" prop="customerXcxImg">
|
||||
<UploadImage ref="uploadRef" v-model="formData.customerXcxImg" :data=imgData :limit="1" :fileSize="5"
|
||||
:drag="true" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<div key="dialog-footer">
|
||||
<el-button type="primary" @click="handleAddClick(formRef)">添加</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { ElMessage } from 'element-plus'
|
||||
import modal from '@/plugins/modal.js'
|
||||
import { addOrUpdateCustomer } from '@/api/business/customers/customer.js';
|
||||
|
||||
// 基础参数
|
||||
const labelWidth = 100;
|
||||
const formRef = ref();
|
||||
const { proxy } = getCurrentInstance()
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const formData = reactive({
|
||||
});
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
done: Function,
|
||||
});
|
||||
const imgData = ref({
|
||||
fileDir: "Customer"
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 验证
|
||||
const rules = reactive({
|
||||
customerId: [{ required: true, message: "不能为空", trigger: "blur", type: "number" }],
|
||||
customerGuid: [{ required: true, message: "不能为空", trigger: "blur", type: "number" }],
|
||||
});
|
||||
|
||||
// 客户性别 1: 男 2: 女选项列表
|
||||
const customerSexOptions = ref([
|
||||
{ dictLabel: '', dictValue: '1' },
|
||||
{ dictLabel: '', dictValue: '2' },
|
||||
]);
|
||||
|
||||
// 业务参数
|
||||
|
||||
|
||||
// -业务方法
|
||||
|
||||
|
||||
// -基础方法
|
||||
const handleAddClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const { code } = await addOrUpdateCustomer(formData);
|
||||
if (code == 200) {
|
||||
modal.msgSuccess('添加成功')
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
};
|
||||
const closeDialog = () => {
|
||||
handleResetClick(formRef.value);
|
||||
props.done();
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
@ -1,112 +0,0 @@
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="小程序客户信息详情" width="900px" @closed="closeDialog">
|
||||
<el-form ref="formRef" :model="formData" :disabled="true">
|
||||
|
||||
<el-row :gutter="20">
|
||||
|
||||
|
||||
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户姓名" prop="customerName">
|
||||
<el-input v-model="formData.customerName" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户生日" prop="customerBirth">
|
||||
<el-input v-model="formData.customerBirth" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户头像" prop="customerImg">
|
||||
<UploadImage ref="uploadRef" v-model="formData.customerImg" :limit="1" :fileSize="5"
|
||||
:drag="true" :isShowTip="false" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="小程序头像" prop="customerXcxImg">
|
||||
<UploadImage ref="uploadRef" v-model="formData.customerXcxImg" :limit="1" :fileSize="5"
|
||||
:drag="true" :isShowTip="false" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户性别" prop="customerSex">
|
||||
<div v-if="formData.customerSex == 0">未知</div>
|
||||
<div v-if="formData.customerSex == 1">男</div>
|
||||
<div v-if="formData.customerSex == 2">女</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户电话" prop="customerPhone">
|
||||
<el-input v-model="formData.customerPhone" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="小程序openid" prop="customerXcxOpenid">
|
||||
<el-input v-model="formData.customerXcxOpenid" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="小程序名称" prop="customerXcxName">
|
||||
<el-input v-model="formData.customerXcxName" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import Editor from '@/components/Editor'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { reactive, ref, watch } from "vue";
|
||||
|
||||
|
||||
// 业务参数
|
||||
const formRef = ref();
|
||||
const labelWidth = 100;
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
// 客户性别 1: 男 2: 女选项列表
|
||||
const customerSexOptions = ref([
|
||||
{ dictLabel: '', dictValue: '1' },
|
||||
{ dictLabel: '', dictValue: '2' },
|
||||
]);
|
||||
|
||||
// -业务方法
|
||||
|
||||
|
||||
// 基础参数
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
data: Object,
|
||||
done: Function,
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const formData = ref({
|
||||
...props.data,
|
||||
});
|
||||
|
||||
watch(props, async (v) => {
|
||||
formData.value = v.data;
|
||||
});
|
||||
|
||||
// -基础方法
|
||||
const closeDialog = () => {
|
||||
props.done();
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
const handeldisable = editor => {
|
||||
editor.disable()
|
||||
}
|
||||
</script>
|
@ -1,145 +0,0 @@
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="修改小程序客户信息" width="900px" @closed="closeDialog">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||
<el-row :gutter="20">
|
||||
|
||||
|
||||
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户姓名" prop="customerName">
|
||||
<el-input v-model="formData.customerName" placeholder="请输入客户姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户生日" prop="customerBirth">
|
||||
<el-input v-model="formData.customerBirth" placeholder="请输入客户生日" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户头像" prop="customerImg">
|
||||
<UploadImage ref="uploadRef" v-model="formData.customerImg" :data=imgData :limit="1" :fileSize="5"
|
||||
:drag="true" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="小程序头像" prop="customerXcxImg">
|
||||
<UploadImage ref="uploadRef" v-model="formData.customerXcxImg" :limit="1" :fileSize="5"
|
||||
:drag="true" :isDisabled="true" :isShowTip="false"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户性别" prop="customerSex">
|
||||
<el-radio-group v-model="formData.customerSex">
|
||||
<el-radio v-for="item in customerSexOptions" :key="item.dictValue" :label="parseInt(item.dictValue)">{{item.dictLabel}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户电话" prop="customerPhone">
|
||||
<el-input v-model="formData.customerPhone" placeholder="请输入客户电话" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="小程序openid" prop="customerXcxOpenid">
|
||||
<el-input v-model="formData.customerXcxOpenid" disabled placeholder="请输入小程序openid" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="小程序名称" prop="customerXcxName">
|
||||
<el-input v-model="formData.customerXcxName" disabled placeholder="请输入小程序名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="handleEditClick(formRef)">编辑</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import modal from '@/plugins/modal.js'
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { addOrUpdateCustomer } from "@/api/business/customers/customer.js";
|
||||
|
||||
// 基础参数
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
data: Object,
|
||||
done: Function,
|
||||
});
|
||||
|
||||
const labelWidth = 100;
|
||||
const formRef = ref();
|
||||
const { proxy } = getCurrentInstance()
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const formData = ref({
|
||||
...props.data,
|
||||
});
|
||||
const imgData = ref({
|
||||
fileDir: "Customer"
|
||||
})
|
||||
|
||||
watch(props, async (v) => {
|
||||
formData.value = v.data;
|
||||
});
|
||||
|
||||
// 验证
|
||||
const rules = reactive({
|
||||
});
|
||||
|
||||
// 客户性别 1: 男 2: 女选项列表
|
||||
const customerSexOptions = ref([
|
||||
{ dictLabel: '男', dictValue: '1' },
|
||||
{ dictLabel: '女', dictValue: '2' },
|
||||
]);
|
||||
|
||||
// 业务参数
|
||||
|
||||
|
||||
// -业务方法
|
||||
|
||||
|
||||
// -基础方法
|
||||
// 提交
|
||||
const handleEditClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const { code } = await addOrUpdateCustomer(formData.value);
|
||||
if (code == 200) {
|
||||
modal.msgSuccess('修改成功')
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
}
|
||||
const closeDialog = () => {
|
||||
props.done();
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
</script>
|
@ -1,178 +0,0 @@
|
||||
<!--
|
||||
* @Descripttion: (小程序客户/tb_customer)
|
||||
* @version: (1.0)
|
||||
* @Author: (admin)
|
||||
* @Date: (2022-12-06)
|
||||
* @LastEditors: (admin)
|
||||
* @LastEditTime: (2022-12-06)
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="24">
|
||||
<!-- 搜索框 queryParams.需要搜索的字段 -->
|
||||
<el-form :model="queryParams" label-position="left" style="margin:15px;" inline ref="queryForm" label-width="100px" v-show="showSearch"
|
||||
@submit.prevent>
|
||||
<el-form-item label="客户姓名" prop="customerName">
|
||||
<el-input v-model="queryParams.customerName" placeholder="请输入客户姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="小程序名称" prop="customerXcxName">
|
||||
<el-input v-model="queryParams.customerXcxName" placeholder="请输入小程序名称" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button>
|
||||
<el-button icon="refresh" @click="resetQuery">{{ $t('btn.reset') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<!-- 工具按钮 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="download" @click="handleExport" v-hasPermi="['business:customer:export']">
|
||||
{{ $t('btn.export') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 表格渲染 prop="对应的字段"-->
|
||||
<el-table v-loading="loading" :data="dataList" ref="tableRef" border highlight-current-row @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
|
||||
<el-table-column prop="customerName" label="客户姓名" align="center" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="customerPhone" label="客户电话" align="center" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="customerXcxOpenid" label="小程序openid" align="center" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="customerXcxName" label="小程序名称" align="center" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="customerXcxImg" label="小程序头像" align="center">
|
||||
<template #default="scope">
|
||||
<el-image preview-teleported :hide-on-click-modal="true" lazy class="table-td-thumb" fit="contain" :src="scope.row.customerXcxImg" :preview-src-list="[scope.row.customerXcxImg]">
|
||||
<div><el-icon :size="15"><document /></el-icon></div>
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="350">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" size="small" icon="edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['business:product:addOrUpdateKey']">编辑</el-button>
|
||||
<el-button size="small" icon="view" @click="handleDetail(scope.row)">查看</el-button>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑 -->
|
||||
<EditDialog v-model="EditDialogVisible" :data="EditDialogRow" :done="() => resetQuery()"></EditDialog>
|
||||
<!-- 详情 -->
|
||||
<DetailDialog v-model="DetailDialogVisible" :data="DetailDialogRow" :done="() => resetQuery()"></DetailDialog>
|
||||
</template>
|
||||
<script setup name="customer">
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import modal from '@/plugins/modal.js'
|
||||
import { exportCustomer, customerList, delCustomer } from '@/api/business/customers/customer.js'
|
||||
import EditDialog from "./components/EditDialog.vue";
|
||||
import DetailDialog from "./components/DetailDialog.vue";
|
||||
|
||||
const EditDialogVisible = ref(false);
|
||||
const EditDialogRow = ref({});
|
||||
const DetailDialogVisible = ref(false);
|
||||
const DetailDialogRow = ref({});
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
// 选中categoryId数组数组
|
||||
const ids = ref([])
|
||||
// 非单选禁用
|
||||
const single = ref(true)
|
||||
// 非多个禁用
|
||||
const multiple = ref(true)
|
||||
// 显示搜索条件
|
||||
const showSearch = ref(true)
|
||||
// 数据列表
|
||||
const dataList = ref([])
|
||||
// 总记录数
|
||||
const total = ref(0)
|
||||
// 是否加载
|
||||
const loading = ref(true)
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
})
|
||||
|
||||
// 客户性别 1: 男 2: 女选项列表
|
||||
const customerSexOptions = ref([
|
||||
{ dictLabel: '', dictValue: '1' },
|
||||
{ dictLabel: '', dictValue: '2' },
|
||||
]);
|
||||
const { queryParams } = toRefs(data)
|
||||
|
||||
// 业务参数
|
||||
|
||||
|
||||
// 查询数据
|
||||
function getList() {
|
||||
loading.value = true
|
||||
customerList(queryParams.value).then((res) => {
|
||||
if (res.code == 200) {
|
||||
loading.value = false
|
||||
dataList.value = res.data.result
|
||||
total.value = res.data.totalNum
|
||||
}
|
||||
})
|
||||
}
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.CustomerId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 重置查询操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm('queryForm')
|
||||
handleQuery()
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
getList()
|
||||
}
|
||||
|
||||
// 导出按钮操作
|
||||
function handleExport() {
|
||||
ElMessageBox.confirm('是否确认导出所有数据?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(function () {
|
||||
return exportCustomer(queryParams)
|
||||
})
|
||||
.then((response) => {
|
||||
proxy.download(response.data.path)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 修改
|
||||
function handleUpdate(row) {
|
||||
EditDialogVisible.value = true
|
||||
EditDialogRow.value = row
|
||||
}
|
||||
|
||||
// 详情
|
||||
function handleDetail(row) {
|
||||
DetailDialogVisible.value = true
|
||||
DetailDialogRow.value = row
|
||||
}
|
||||
|
||||
|
||||
handleQuery()
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user