feat 添加优惠券记录管理,优惠券列表展示领取数量
This commit is contained in:
parent
4f226d37f4
commit
84e75a1899
@ -0,0 +1,38 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Descripttion: 领券记录Api接口
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (lwh)
|
||||||
|
* @Date: (2023-07-31)
|
||||||
|
* @LastEditors: (lwh)
|
||||||
|
* @LastEditTime: (2023-07-31)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 领券记录分页查询列表
|
||||||
|
export function customerCouponList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/business/CustomerCoupon/getCustomerCouponList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 领券记录新增或修改
|
||||||
|
export function addOrUpdateCustomerCoupon(data) {
|
||||||
|
return request({
|
||||||
|
url: '/business/CustomerCoupon/addOrUpdateCustomerCoupon',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 领券记录删除
|
||||||
|
export function delCustomerCoupon(ids) {
|
||||||
|
return request({
|
||||||
|
url: '/business/CustomerCoupon/'+ ids,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -78,6 +78,7 @@
|
|||||||
<div v-else>{{ scope.row.couponSendNumber }}</div>
|
<div v-else>{{ scope.row.couponSendNumber }}</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="couponGetNumber" label="领取数量" align="center" />
|
||||||
<el-table-column prop="couponDisplayStatus" label="显示状态" align="center">
|
<el-table-column prop="couponDisplayStatus" label="显示状态" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="display_status" :value="scope.row.couponDisplayStatus" />
|
<dict-tag :options="display_status" :value="scope.row.couponDisplayStatus" />
|
||||||
|
@ -0,0 +1,182 @@
|
|||||||
|
<!--
|
||||||
|
* @Descripttion: (领券记录/tb_customer_coupon 添加弹窗)
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (lwh)
|
||||||
|
* @Date: (2023-07-31)
|
||||||
|
* @LastEditors: (lwh)
|
||||||
|
* @LastEditTime: (2023-07-31)
|
||||||
|
-->
|
||||||
|
<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="couponGuid">
|
||||||
|
<el-input v-model='formData.couponName' disabled type="text" placeholder='点击选择优惠券'>
|
||||||
|
<template #append>
|
||||||
|
<div @click="handleChooseCoupon">选择</div>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="客户" prop="customerGuid">
|
||||||
|
<el-input v-model='formData.customerNickname' disabled type="text" placeholder='点击选择客户'>
|
||||||
|
<template #append>
|
||||||
|
<div @click="handleChooseCustomer">选择</div>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="是否过期" prop="customerCouponIsExpired">
|
||||||
|
<el-select v-model="formData.customerCouponIsExpired" placeholder="请选择是否过期">
|
||||||
|
<el-option v-for="item in is_expired " :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="customerCouponIsUsed">
|
||||||
|
<el-select v-model="formData.customerCouponIsUsed" placeholder="请选择是否已使用">
|
||||||
|
<el-option v-for="item in is_used " :key="item.dictValue" :label="item.dictLabel"
|
||||||
|
:value="parseInt(item.dictValue)"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col> -->
|
||||||
|
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div key="dialog-footer">
|
||||||
|
<el-button type="primary" @click="handleAddClick(formRef)" :loading="loadingStatus">添加</el-button>
|
||||||
|
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 选择客户 -->
|
||||||
|
<ChooseCustomerDialog v-model="ChooseCustomerDialogVisible" :data="ChooseCustomerDialogRow">
|
||||||
|
</ChooseCustomerDialog>
|
||||||
|
<!-- 选择商品 -->
|
||||||
|
<ChooseCouponDialog v-model="ChooseCouponDialogVisible" :data="ChooseCouponDialogRow">
|
||||||
|
</ChooseCouponDialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref, watch } from "vue";
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import modal from '@/plugins/modal.js'
|
||||||
|
import { addOrUpdateCustomerCoupon } from '@/api/business/Marketing/CouponManage/CustomerCoupons/customerCoupon.js';
|
||||||
|
import ChooseCustomerDialog from '@/views/business/components/ChooseCustomerDialog.vue';
|
||||||
|
import ChooseCouponDialog from '@/views/business/components/ChooseCouponDialog.vue';
|
||||||
|
|
||||||
|
|
||||||
|
// 打开弹窗时回调
|
||||||
|
const openDialog = async () => {
|
||||||
|
|
||||||
|
await getis_expired()
|
||||||
|
await getis_used()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -业务参数
|
||||||
|
// 是否过期字典选项列表
|
||||||
|
const is_expired = ref([]);
|
||||||
|
// 是否已使用字典选项列表
|
||||||
|
const is_used = ref([]);
|
||||||
|
// 选择客户弹窗参数
|
||||||
|
const ChooseCustomerDialogVisible = ref(false);
|
||||||
|
const ChooseCustomerDialogRow = ref({});
|
||||||
|
// 选择优惠券弹窗参数
|
||||||
|
const ChooseCouponDialogVisible = ref(false);
|
||||||
|
const ChooseCouponDialogRow = ref({});
|
||||||
|
|
||||||
|
// -业务方法
|
||||||
|
// 字典获取
|
||||||
|
async function getis_expired() {
|
||||||
|
await proxy.getDicts('is_expired').then((res) => {
|
||||||
|
is_expired.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 字典获取
|
||||||
|
async function getis_used() {
|
||||||
|
await proxy.getDicts('is_used').then((res) => {
|
||||||
|
is_used.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 打开选择客户弹窗
|
||||||
|
const handleChooseCustomer = () => {
|
||||||
|
ChooseCustomerDialogVisible.value = true
|
||||||
|
ChooseCustomerDialogRow.value = formData
|
||||||
|
}
|
||||||
|
// 打开选择优惠券弹窗
|
||||||
|
const handleChooseCoupon = () => {
|
||||||
|
ChooseCouponDialogVisible.value = true
|
||||||
|
ChooseCouponDialogRow.value = formData
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -基础参数
|
||||||
|
const loadingStatus = ref(false)
|
||||||
|
const labelWidth = 100;
|
||||||
|
const formRef = ref();
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const emits = defineEmits(["update:modelValue"]);
|
||||||
|
const formData = reactive({
|
||||||
|
customerCouponIsExpired: 1,
|
||||||
|
customerCouponIsUsed: 1,
|
||||||
|
});
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: Boolean,
|
||||||
|
done: Function,
|
||||||
|
});
|
||||||
|
const imgData = ref({
|
||||||
|
fileDir: "CustomerCoupon"
|
||||||
|
})
|
||||||
|
|
||||||
|
// 验证
|
||||||
|
const rules = reactive({
|
||||||
|
couponGuid: [{ required: true, message: "优惠劵guid不能为空", trigger: "blur"}],
|
||||||
|
customerGuid: [{ required: true, message: "客户guid不能为空", trigger: "blur"}],
|
||||||
|
customerCouponIsExpired: [{ required: true, message: "是否过期不能为空", trigger: "change", type: "number" }],
|
||||||
|
customerCouponIsUsed: [{ required: true, message: "是否已使用不能为空", trigger: "change", type: "number" }],
|
||||||
|
});
|
||||||
|
|
||||||
|
// -基础方法
|
||||||
|
|
||||||
|
// 提交
|
||||||
|
const handleAddClick = async (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate(async (valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loadingStatus.value = true
|
||||||
|
|
||||||
|
|
||||||
|
const { code } = await addOrUpdateCustomerCoupon(formData);
|
||||||
|
if (code == 200) {
|
||||||
|
modal.msgSuccess('添加成功')
|
||||||
|
closeDialog();
|
||||||
|
loadingStatus.value = false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const closeDialog = () => {
|
||||||
|
formData.couponName = ""
|
||||||
|
formData.customerNickname = ""
|
||||||
|
handleResetClick(formRef.value);
|
||||||
|
props.done();
|
||||||
|
emits("update:modelValue", false);
|
||||||
|
};
|
||||||
|
const handleResetClick = async (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.resetFields();
|
||||||
|
};
|
||||||
|
</script>
|
@ -0,0 +1,115 @@
|
|||||||
|
<!--
|
||||||
|
* @Descripttion: (领券记录/tb_customer_coupon 详情弹窗)
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (lwh)
|
||||||
|
* @Date: (2023-07-31)
|
||||||
|
* @LastEditors: (lwh)
|
||||||
|
* @LastEditTime: (2023-07-31)
|
||||||
|
-->
|
||||||
|
<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="优惠劵guid" >
|
||||||
|
<el-input v-model="formData.couponGuid" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="客户guid" >
|
||||||
|
<el-input v-model="formData.customerGuid" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="是否过期" >
|
||||||
|
<el-select v-model="formData.customerCouponIsExpired" >
|
||||||
|
<el-option v-for="item in is_expired " :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-select v-model="formData.customerCouponIsUsed" >
|
||||||
|
<el-option v-for="item in is_used " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</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 getis_expired()
|
||||||
|
await getis_used()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const formData = ref({
|
||||||
|
...props.data,
|
||||||
|
});
|
||||||
|
watch(props, async (v) => {
|
||||||
|
formData.value = v.data;
|
||||||
|
});
|
||||||
|
|
||||||
|
// -业务参数
|
||||||
|
// 是否过期字典选项列表
|
||||||
|
const is_expired = ref([]);
|
||||||
|
// 是否已使用字典选项列表
|
||||||
|
const is_used = ref([]);
|
||||||
|
|
||||||
|
// -业务方法
|
||||||
|
// 字典获取
|
||||||
|
async function getis_expired() {
|
||||||
|
await proxy.getDicts('is_expired').then((res) => {
|
||||||
|
is_expired.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 字典获取
|
||||||
|
async function getis_used() {
|
||||||
|
await proxy.getDicts('is_used').then((res) => {
|
||||||
|
is_used.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>
|
@ -0,0 +1,161 @@
|
|||||||
|
<!--
|
||||||
|
* @Descripttion: (领券记录/tb_customer_coupon 编辑弹窗)
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (lwh)
|
||||||
|
* @Date: (2023-07-31)
|
||||||
|
* @LastEditors: (lwh)
|
||||||
|
* @LastEditTime: (2023-07-31)
|
||||||
|
-->
|
||||||
|
<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="优惠劵guid" prop="couponGuid">
|
||||||
|
<el-input v-model="formData.couponGuid" placeholder="请输入优惠劵guid" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="客户guid" prop="customerGuid">
|
||||||
|
<el-input v-model="formData.customerGuid" placeholder="请输入客户guid" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="是否过期" prop="customerCouponIsExpired">
|
||||||
|
<el-select v-model="formData.customerCouponIsExpired" placeholder="请选择是否过期">
|
||||||
|
<el-option v-for="item in is_expired " :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="customerCouponIsUsed">
|
||||||
|
<el-select v-model="formData.customerCouponIsUsed" placeholder="请选择是否已使用">
|
||||||
|
<el-option v-for="item in is_used " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="handleEditClick(formRef)" :loading="loadingStatus">编辑</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 { addOrUpdateCustomerCoupon } from "@/api/business/Marketing/CouponManage/CustomerCoupons/customerCoupon.js";
|
||||||
|
|
||||||
|
|
||||||
|
// 打开弹窗时回调
|
||||||
|
const openDialog = async () => {
|
||||||
|
await getis_expired()
|
||||||
|
await getis_used()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const formData = ref({
|
||||||
|
...props.data,
|
||||||
|
});
|
||||||
|
watch(props, async (v) => {
|
||||||
|
formData.value = v.data;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// 业务参数
|
||||||
|
// 是否过期字典选项列表
|
||||||
|
const is_expired = ref([]);
|
||||||
|
// 是否已使用字典选项列表
|
||||||
|
const is_used = ref([]);
|
||||||
|
|
||||||
|
// -业务方法
|
||||||
|
//字典获取
|
||||||
|
async function getis_expired() {
|
||||||
|
await proxy.getDicts('is_expired').then((res) => {
|
||||||
|
is_expired.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//字典获取
|
||||||
|
async function getis_used() {
|
||||||
|
await proxy.getDicts('is_used').then((res) => {
|
||||||
|
is_used.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -基础参数
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: Boolean,
|
||||||
|
data: Object,
|
||||||
|
done: Function,
|
||||||
|
});
|
||||||
|
|
||||||
|
const loadingStatus = ref(false)
|
||||||
|
const labelWidth = 100;
|
||||||
|
const formRef = ref();
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const emits = defineEmits(["update:modelValue"]);
|
||||||
|
const imgData = ref({
|
||||||
|
fileDir: "CustomerCoupon"
|
||||||
|
})
|
||||||
|
|
||||||
|
// 验证
|
||||||
|
const rules = reactive({
|
||||||
|
customerCouponGuid: [{ required: true, message: "不能为空", trigger: "blur", type: "number" }],
|
||||||
|
couponGuid: [{ required: true, message: "优惠劵guid不能为空", trigger: "blur", type: "number" }],
|
||||||
|
customerGuid: [{ required: true, message: "客户guid不能为空", trigger: "blur", type: "number" }],
|
||||||
|
customerCouponIsExpired: [{ required: true, message: "是否过期不能为空", trigger: "change", type: "number" }],
|
||||||
|
customerCouponIsUsed: [{ required: true, message: "是否已使用不能为空", trigger: "change", type: "number" }],
|
||||||
|
});
|
||||||
|
|
||||||
|
// -基础方法
|
||||||
|
// 提交
|
||||||
|
const handleEditClick = async (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate(async (valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loadingStatus.value = true
|
||||||
|
|
||||||
|
|
||||||
|
const { code } = await addOrUpdateCustomerCoupon(formData.value);
|
||||||
|
if (code == 200) {
|
||||||
|
modal.msgSuccess('修改成功')
|
||||||
|
closeDialog();
|
||||||
|
loadingStatus.value = false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleResetClick = async (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.resetFields();
|
||||||
|
}
|
||||||
|
const closeDialog = () => {
|
||||||
|
props.done();
|
||||||
|
emits("update:modelValue", false);
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
@ -0,0 +1,218 @@
|
|||||||
|
<!--
|
||||||
|
* @Descripttion: (领券记录/tb_customer_coupon)
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (lwh)
|
||||||
|
* @Date: (2023-07-31)
|
||||||
|
* @LastEditors: (lwh)
|
||||||
|
* @LastEditTime: (2023-07-31)
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<!-- 搜索框 queryParams.需要搜索的字段 -->
|
||||||
|
<el-form :model="queryParams" label-position="left" style="margin:15px;" inline ref="queryForm" v-show="showSearch"
|
||||||
|
@submit.prevent>
|
||||||
|
<el-form-item label="是否过期" prop="customerCouponIsExpired">
|
||||||
|
<el-select v-model="queryParams.customerCouponIsExpired" placeholder="请选择是否过期" clearable @change="handleQuery">
|
||||||
|
<el-option v-for="item in is_expired " :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否已使用" prop="customerCouponIsUsed">
|
||||||
|
<el-select v-model="queryParams.customerCouponIsUsed" placeholder="请选择是否已使用" clearable @change="handleQuery">
|
||||||
|
<el-option v-for="item in is_used " :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</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:customercoupon:addOrUpdate']" 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:customercoupon:delete']" plain icon="delete" @click="handleDelete">
|
||||||
|
{{ $t('btn.delete') }}
|
||||||
|
</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="couponName" label="优惠劵名称" align="center" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column prop="customerName" label="客户名称" align="center" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column prop="customerCouponIsExpired" label="是否过期" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options=" is_expired " :value="scope.row.customerCouponIsExpired" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="customerCouponIsUsed" label="是否已使用" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options=" is_used " :value="scope.row.customerCouponIsUsed" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<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:customercoupon:addOrUpdate']">编辑</el-button>
|
||||||
|
<el-button type="danger" size="small" icon="delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['business:customercoupon: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="customercoupon">
|
||||||
|
import { ElMessageBox } from 'element-plus'
|
||||||
|
import modal from '@/plugins/modal.js'
|
||||||
|
import { customerCouponList , delCustomerCoupon } from '@/api/business/Marketing/CouponManage/CustomerCoupons/customerCoupon.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 is_expired = ref([]);
|
||||||
|
async function getis_expired() {
|
||||||
|
await proxy.getDicts('is_expired').then((res) => {
|
||||||
|
is_expired.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getis_expired()
|
||||||
|
// 字典获取
|
||||||
|
const is_used = ref([]);
|
||||||
|
async function getis_used() {
|
||||||
|
await proxy.getDicts('is_used').then((res) => {
|
||||||
|
is_used.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getis_used()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//基础方法
|
||||||
|
|
||||||
|
// 查询数据
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
|
||||||
|
|
||||||
|
customerCouponList(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.customerCouponId)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置查询操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm('queryForm')
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const Ids = row.customerCouponId || ids.value
|
||||||
|
|
||||||
|
ElMessageBox.confirm("是否确认删除?", "系统提示", {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
return delCustomerCoupon(Ids)
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
handleQuery()
|
||||||
|
modal.msgSuccess("删除成功")
|
||||||
|
})
|
||||||
|
.catch(() => { })
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
function handleUpdate(row) {
|
||||||
|
EditDialogVisible.value = true
|
||||||
|
EditDialogRow.value = row
|
||||||
|
}
|
||||||
|
|
||||||
|
// 详情
|
||||||
|
function handleDetail(row) {
|
||||||
|
DetailDialogVisible.value = true
|
||||||
|
DetailDialogRow.value = row
|
||||||
|
}
|
||||||
|
|
||||||
|
handleQuery()
|
||||||
|
</script>
|
124
src/views/business/components/ChooseCouponDialog.vue
Normal file
124
src/views/business/components/ChooseCouponDialog.vue
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog v-model="props.modelValue" title="选择优惠券" width="900px" @closed="closeDialog" @open="openDialog">
|
||||||
|
|
||||||
|
<el-form inline :model="queryParams">
|
||||||
|
<el-form-item label="优惠券名称">
|
||||||
|
<el-input v-model='queryParams.couponName' placeholder='请输入优惠券名称'></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handleQuery">
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 表格渲染 prop="对应的字段"-->
|
||||||
|
<el-table v-loading="loading" :data="couponsList" ref="tableRef" border highlight-current-row
|
||||||
|
@row-click="handleRowClick">
|
||||||
|
<el-table-column prop="couponName" label="优惠券名称" align="left" :show-overflow-tooltip="true" />
|
||||||
|
</el-table>
|
||||||
|
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getCouponListFun" />
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="handleEditClick()">添加</el-button>
|
||||||
|
<el-button @click="handleResetClick()">重置</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref, watch, nextTick } from 'vue';
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { couponList } from '@/api/business/Marketing/CouponManage/Coupons/coupon.js'
|
||||||
|
|
||||||
|
|
||||||
|
// 业务参数
|
||||||
|
const total = ref(0)
|
||||||
|
const loading = ref(false)
|
||||||
|
|
||||||
|
// 基础参数
|
||||||
|
const tableRef = ref(null);
|
||||||
|
// 查询参数
|
||||||
|
const queryParams = reactive({
|
||||||
|
couponName: "",
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10
|
||||||
|
});
|
||||||
|
|
||||||
|
const emits = defineEmits(['update:modelValue']);
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: Boolean,
|
||||||
|
data: Object,
|
||||||
|
});
|
||||||
|
const formData = ref({
|
||||||
|
...props.data
|
||||||
|
});
|
||||||
|
|
||||||
|
let couponsList = ref([]);
|
||||||
|
// 打开窗口时运行
|
||||||
|
const openDialog = async () => {
|
||||||
|
await getCouponListFun()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
getCouponListFun()
|
||||||
|
}
|
||||||
|
|
||||||
|
const getCouponListFun = async () => {
|
||||||
|
loading.value = true
|
||||||
|
await couponList(queryParams).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
couponsList.value = res.data.result
|
||||||
|
total.value = res.data.totalNum
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(props, (v) => {
|
||||||
|
formData.value = v.data;
|
||||||
|
});
|
||||||
|
|
||||||
|
// -业务方法
|
||||||
|
let couponName = ref("");
|
||||||
|
let couponGuid = ref("");
|
||||||
|
|
||||||
|
|
||||||
|
// -基础方法
|
||||||
|
|
||||||
|
// 点击行
|
||||||
|
const handleRowClick = (row) => {
|
||||||
|
couponName.value = row.couponName
|
||||||
|
couponGuid.value = row.couponGuid
|
||||||
|
}
|
||||||
|
|
||||||
|
const closeDialog = () => {
|
||||||
|
queryParams.couponName = ""
|
||||||
|
couponName.value = ""
|
||||||
|
emits('update:modelValue', false);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 提交
|
||||||
|
const handleEditClick = async () => {
|
||||||
|
if (couponName.value !== "") {
|
||||||
|
|
||||||
|
formData.value.couponName = couponName.value
|
||||||
|
formData.value.couponGuid = couponGuid.value
|
||||||
|
if (formData.value.couponName != null) {
|
||||||
|
closeDialog();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ElMessage.error("请选择优惠券")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleResetClick = async formEl => {
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user