This commit is contained in:
parent
d99c6bf261
commit
695898484e
|
|
@ -114,6 +114,7 @@
|
|||
"unplugin-vue-components": "^28.0.0",
|
||||
"vite": "^6.1.0",
|
||||
"vite-plugin-mock-dev-server": "^1.8.3",
|
||||
"vite-plugin-strip-code": "^1.1.0",
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vue-eslint-parser": "^9.4.3",
|
||||
"vue-tsc": "^2.2.0"
|
||||
|
|
|
|||
|
|
@ -450,6 +450,110 @@ export function getAcPushEventUser(data) {
|
|||
});
|
||||
}
|
||||
|
||||
// 充值兑换 配置开关
|
||||
export function rechargeRedemptionPut(data) {
|
||||
return request({
|
||||
url: `${Market_BaseUrl}/admin/rechargeRedemption/enable`,
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 充值兑换 开关状态
|
||||
export function rechargeRedemptionEnableStatus() {
|
||||
return request({
|
||||
url: `${Market_BaseUrl}/admin/rechargeRedemption/enable/status`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
// 充值兑换 配置信息获取 列表
|
||||
export function rechargeRedemptionList(params) {
|
||||
return request({
|
||||
url: `${Market_BaseUrl}/admin/rechargeRedemption/list`,
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
// 充值兑换 配置信息添加/编辑
|
||||
export function rechargeRedemption(data, method = 'post') {
|
||||
return request({
|
||||
url: `${Market_BaseUrl}/admin/rechargeRedemption`,
|
||||
method: method,
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 充值兑换 充值兑换码列表
|
||||
export function rechargeRedemptionCodeList(params) {
|
||||
return request({
|
||||
url: `${Market_BaseUrl}/admin/rechargeRedemption/code/list`,
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
// 充值兑换 配置信息详情
|
||||
export function rechargeRedemptionDetail(params) {
|
||||
return request({
|
||||
url: `${Market_BaseUrl}/admin/rechargeRedemption`,
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
// 充值兑换 配置信息详情
|
||||
export function rechargeRedemptionExport(params) {
|
||||
return request({
|
||||
url: `${Market_BaseUrl}/admin/rechargeRedemption/code/export`,
|
||||
method: 'get',
|
||||
params,
|
||||
responseType: "blob",
|
||||
});
|
||||
}
|
||||
|
||||
// 券兑换码 开关。可用门店修改
|
||||
export function couponRedemptionEnable(data) {
|
||||
return request({
|
||||
url: `${Market_BaseUrl}/admin/couponRedemption/enable`,
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 券兑换码 开关状态,可用门店详情
|
||||
export function couponRedemptionEnableStatus() {
|
||||
return request({
|
||||
url: `${Market_BaseUrl}/admin/couponRedemption/enable/status`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
// 券兑换码 配置信息获取 列表
|
||||
export function couponRedemptionList(params) {
|
||||
return request({
|
||||
url: `${Market_BaseUrl}/admin/couponRedemption/list`,
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
// 券兑换码 配置信息添加/编辑
|
||||
export function couponRedemption(data, method = 'post') {
|
||||
return request({
|
||||
url: `${Market_BaseUrl}/admin/couponRedemption`,
|
||||
method: method,
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
// 声明模块,告诉 TypeScript 该模块存在且默认导出为函数
|
||||
declare module 'vite-plugin-strip-code' {
|
||||
import { Plugin } from 'vite';
|
||||
|
||||
// 插件配置选项的类型(根据插件实际参数定义)
|
||||
interface StripCodeOptions {
|
||||
start_comment: string;
|
||||
end_comment: string;
|
||||
// 其他可能的配置项(可选,按需添加)
|
||||
}
|
||||
|
||||
// 插件函数的类型
|
||||
function stripCode(options: StripCodeOptions): Plugin;
|
||||
|
||||
export default stripCode;
|
||||
}
|
||||
|
|
@ -9,11 +9,13 @@
|
|||
<el-radio-button :value="1">员工</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<!-- DEV-START -->
|
||||
<el-form-item label="快捷输入账号" label-width="100px" v-if="env == 'development'">
|
||||
<el-button :type="item.type" v-for="item in accountList" @click="accountHandle(item)">
|
||||
{{ item.username }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<!-- DEV-END -->
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="state.loginForm.username" type="text" auto-complete="off" placeholder="商户号"></el-input>
|
||||
</el-form-item>
|
||||
|
|
@ -63,20 +65,22 @@ const route = useRoute();
|
|||
|
||||
const env = process.env.NODE_ENV
|
||||
|
||||
// DEV-START
|
||||
const accountList = reactive([
|
||||
{ username: "admin", type: 'primary' },
|
||||
{ username: "19191703856", type: 'warning' },
|
||||
// { username: "19191703856", type: 'danger' },
|
||||
{ username: "19107220837", type: 'danger' },
|
||||
]);
|
||||
|
||||
// 快捷模拟登录
|
||||
function accountHandle(item) {
|
||||
state.loginForm.username = item.username;
|
||||
state.loginForm.code = 666666
|
||||
const d = new Date();
|
||||
state.loginForm.password = `czg${d.getHours().toString().padStart(2, '0')}${d.getMinutes().toString().padStart(2, '0')}`;
|
||||
|
||||
handleLogin()
|
||||
}
|
||||
// DEV-END
|
||||
|
||||
const state = reactive({
|
||||
Background: Background,
|
||||
|
|
@ -84,9 +88,9 @@ const state = reactive({
|
|||
cookiePass: "",
|
||||
loginForm: {
|
||||
username: "",
|
||||
password: process.env.NODE_ENV === "development" ? `czg${new Date().getHours().toString().padStart(2, '0')}${new Date().getMinutes().toString().padStart(2, '0')}` : "",
|
||||
password: "",
|
||||
// rememberMe: false,
|
||||
code: process.env.NODE_ENV === "development" ? "666666" : "",
|
||||
code: "",
|
||||
uuid: "",
|
||||
staffUserName: "",
|
||||
loginType: 0,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
<template>
|
||||
<div class="m-4 bg-white p-4">
|
||||
<HeaderCard
|
||||
name="生日有礼"
|
||||
intro="用户生日管理设置"
|
||||
icon="birthdayGift"
|
||||
showSwitch
|
||||
v-model:isOpen="basicForm.isEnable"
|
||||
></HeaderCard>
|
||||
<HeaderCard name="生日有礼" intro="用户生日管理设置" icon="birthdayGift" showSwitch v-model:isOpen="basicForm.isEnable">
|
||||
</HeaderCard>
|
||||
<el-tabs class="mt-4" v-model="activeTab" type="border-card">
|
||||
<el-tab-pane :label="item.label" v-for="item in configs" :key="item.name" :name="item.name">
|
||||
<template v-if="item.name == 'basic'">
|
||||
|
|
@ -48,11 +43,7 @@
|
|||
</el-form-item>
|
||||
|
||||
<el-form-item label="短信祝福">
|
||||
<el-switch
|
||||
v-model="basicForm.sendSms"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
></el-switch>
|
||||
<el-switch v-model="basicForm.sendSms" :active-value="1" :inactive-value="0"></el-switch>
|
||||
<span class="color-666 font-size-[12px] m-l-4">
|
||||
开启后,将会在用户生日当天,发送祝福短信
|
||||
</span>
|
||||
|
|
@ -63,15 +54,8 @@
|
|||
</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div class="flex mt-10 justify-center gap-10">
|
||||
<el-button
|
||||
style="width: 100px"
|
||||
type="primary"
|
||||
@click="basicSubmit"
|
||||
size="large"
|
||||
v-if="shopInfo.isHeadShop"
|
||||
>
|
||||
<div class="flex mt-10 justify-center gap-10" v-if="shopInfo.isHeadShop">
|
||||
<el-button style="width: 100px" type="primary" @click="basicSubmit" size="large">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button @click="close" style="width: 100px" size="large">取消</el-button>
|
||||
|
|
@ -198,20 +182,23 @@ function close() {
|
|||
router.back();
|
||||
}
|
||||
//
|
||||
function levelTabChange(index) {}
|
||||
function levelTabChange(index) { }
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-tabs--border-card) {
|
||||
border: none;
|
||||
}
|
||||
|
||||
:deep(.el-tabs--border-card > .el-tabs__header) {
|
||||
border: none;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
:deep(.el-tabs--border-card > .el-tabs__header .el-tabs__item) {
|
||||
border: none;
|
||||
}
|
||||
|
||||
:deep(.el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active) {
|
||||
border: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,15 +58,17 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item" v-if="shopInfo.isHeadShop == 1 && shopInfo.shopType != 'only'">
|
||||
<div class="item" v-if="shopInfo.isHeadShop == 1 || shopInfo.shopType == 'only'">
|
||||
<el-button type="primary" @click="addCashBackItem">添加阶梯</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-top: 50px;" v-if="shopInfo.isHeadShop == 1 && shopInfo.shopType != 'only'">
|
||||
<el-button type="primary" @click="submitHandle">保存</el-button>
|
||||
<el-button @click="router.back()">取消</el-button>
|
||||
</el-form-item>
|
||||
<div v-if="shopInfo.isHeadShop == 1 || shopInfo.shopType == 'only'">
|
||||
<el-form-item style="margin-top: 50px;">
|
||||
<el-button type="primary" @click="submitHandle">保存</el-button>
|
||||
<el-button @click="router.back()">取消</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="返现明细" :name="2">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,273 @@
|
|||
<template>
|
||||
<el-dialog title="添加兑换码" width="500px" v-model="visible" @closed="onClosed">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px" label-position="right">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入" :maxlength="50" show-word-limit
|
||||
style="width: 350px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="活动日期" prop="timeScope">
|
||||
<div style="width: 350px;">
|
||||
<el-date-picker v-model="form.timeScope" type="datetimerange" range-separator="至" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
|
||||
style="width: 100%;" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="发行数量" prop="total">
|
||||
<el-input v-model="form.total" placeholder="请输入" :maxlength="8" show-word-limit style="width: 350px;"
|
||||
@input="e => form.total = filterNumberInput(e, true)">
|
||||
<template #append>个</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="赠送优惠券" style="margin-top: 14px;" prop="coupon">
|
||||
<div class="center" v-for="(item, index) in selectCoupons" :key="item.id">
|
||||
<el-select v-model="item.id" @change="selectCouponChnge($event, index)">
|
||||
<el-option :label="val.title" :value="val.id" v-for="val in couponList" :key="val.id"></el-option>
|
||||
</el-select>
|
||||
<el-input v-model="item.num" input-style="text-align:center;">
|
||||
<template #append>张/1个码</template>
|
||||
</el-input>
|
||||
<div class="del" @click="selectCoupons.splice(index, 1)">
|
||||
<el-icon size="18" color="#FF2F2F">
|
||||
<Delete />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="center">
|
||||
<el-button link type="primary" icon="CirclePlus" @click="addCoupon">新增券</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="visible = false;">取 消</el-button>
|
||||
<el-button type="primary" @click="handleOk" :loading="confirmLoading">确 定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import _ from 'lodash'
|
||||
import { ref } from "vue";
|
||||
import { filterNumberInput } from '@/utils'
|
||||
import { couponRedemption, couponPage } from "@/api/coupon/index.js";
|
||||
|
||||
const visible = ref(false);
|
||||
const confirmLoading = ref(false);
|
||||
const formRef = ref(null);
|
||||
|
||||
const form = ref({
|
||||
id: '',
|
||||
stock: '',
|
||||
name: '',
|
||||
timeScope: [],
|
||||
amount: '',
|
||||
total: 0,
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
});
|
||||
|
||||
const resetForm = () => {
|
||||
form.value = {
|
||||
id: '',
|
||||
stock: '',
|
||||
name: '',
|
||||
timeScope: [],
|
||||
amount: '',
|
||||
total: 0,
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
};
|
||||
};
|
||||
|
||||
const rules = {
|
||||
name: [
|
||||
{ required: true, message: '请输入名称', trigger: 'blur' },
|
||||
],
|
||||
timeScope: [
|
||||
{ type: 'array', required: true, message: '请选择有效期', trigger: 'change' },
|
||||
],
|
||||
amount: [
|
||||
{ required: true, message: '请输入金额', trigger: 'blur' },
|
||||
],
|
||||
total: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
const num = Number(value);
|
||||
if (value === '' || value == null) {
|
||||
callback(new Error('请输入发行数量'));
|
||||
return;
|
||||
}
|
||||
if (isNaN(num) || !Number.isInteger(num)) {
|
||||
callback(new Error('请输入有效整数'));
|
||||
return;
|
||||
}
|
||||
if (num < 1) {
|
||||
callback(new Error('发行数量需大于1'));
|
||||
return;
|
||||
}
|
||||
if (num > 1000) {
|
||||
callback(new Error('发行数量最大1000'));
|
||||
return;
|
||||
}
|
||||
callback();
|
||||
},
|
||||
trigger: 'blur'
|
||||
},
|
||||
],
|
||||
stock: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
const num = Number(value);
|
||||
if (value === '' || value == null) {
|
||||
callback(new Error('请输入库存'));
|
||||
return;
|
||||
}
|
||||
if (num > stockFlagNum.value) {
|
||||
callback(new Error(`修改库存不能大于${stockFlagNum.value}`));
|
||||
return;
|
||||
}
|
||||
callback();
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
coupon: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
// value 是 selectCoupons.value 的 JSON 字符串
|
||||
let coupons = selectCoupons.value;
|
||||
if (coupons.length === 0) {
|
||||
callback(new Error('至少添加1种优惠券'));
|
||||
return;
|
||||
} else {
|
||||
// 校验每个优惠券
|
||||
for (let i = 0; i < coupons.length; i++) {
|
||||
if (!coupons[i].id) {
|
||||
callback(new Error('请选择优惠券'));
|
||||
return;
|
||||
}
|
||||
if (!coupons[i].num || !Number.isInteger(Number(coupons[i].num)) || Number(coupons[i].num) <= 0) {
|
||||
callback(new Error('请输入大于零的优惠券数量'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
// 开始提交
|
||||
const emit = defineEmits(['success']);
|
||||
const handleOk = () => {
|
||||
formRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
confirmLoading.value = true;
|
||||
const data = { ...form.value };
|
||||
data.startTime = form.value.timeScope[0];
|
||||
data.endTime = form.value.timeScope[1];
|
||||
data.couponInfoList = selectCoupons.value;
|
||||
await couponRedemption(data, form.value.id ? 'put' : 'post');
|
||||
emit('success');
|
||||
visible.value = false;
|
||||
} catch (error) {
|
||||
console.log('error', error);
|
||||
}
|
||||
setTimeout(() => {
|
||||
confirmLoading.value = false;
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const onClosed = () => {
|
||||
visible.value = false;
|
||||
resetForm();
|
||||
};
|
||||
|
||||
// 选择优惠券开始
|
||||
const couponList = ref([])
|
||||
const selectCoupons = ref([]);
|
||||
const couponObj = ref({ id: '', num: 1, title: '' });
|
||||
|
||||
// 选择优惠券添加标题
|
||||
function selectCouponChnge(e, index) {
|
||||
const coupon = couponList.value.find(item => item.id === e)
|
||||
if (coupon) {
|
||||
selectCoupons.value[index].title = coupon.title
|
||||
}
|
||||
}
|
||||
|
||||
// 新增优惠券
|
||||
function addCoupon() {
|
||||
selectCoupons.value.push(_.cloneDeep(couponObj.value));
|
||||
}
|
||||
|
||||
// 获取优惠券列表
|
||||
async function couponPageAjax() {
|
||||
try {
|
||||
const res = await couponPage({
|
||||
shopId: form.value.shopId,
|
||||
page: 1,
|
||||
size: 500
|
||||
})
|
||||
couponList.value = res.records
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
// 选择优惠券结束
|
||||
|
||||
const stockFlagNum = ref(0)
|
||||
|
||||
function show(obj) {
|
||||
couponPageAjax()
|
||||
console.log(obj);
|
||||
if (obj && obj.id) {
|
||||
form.value = {
|
||||
id: obj.id || '',
|
||||
stock: obj.stock || '',
|
||||
name: obj.name || '',
|
||||
timeScope: obj.startTime && obj.endTime ? [obj.startTime, obj.endTime] : [],
|
||||
amount: obj.amount || '',
|
||||
total: obj.total || 0,
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
};
|
||||
stockFlagNum.value = obj.stock || 0
|
||||
} else {
|
||||
resetForm();
|
||||
}
|
||||
visible.value = true;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
|
||||
&:not(:first-child) {
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.del {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,224 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-dialog title="充值兑换码" top="5vh" width="800px" v-model="visible" @closed="closedHandle">
|
||||
<el-form label-width="80px" label-position="right">
|
||||
<el-form-item label="名称">
|
||||
{{ form.name }}
|
||||
</el-form-item>
|
||||
<el-form-item label="活动日期">
|
||||
{{ form.startTime }} ~ {{ form.endTime }}
|
||||
</el-form-item>
|
||||
<el-form-item label="金额">
|
||||
{{ form.amount }}
|
||||
</el-form-item>
|
||||
<el-form-item label="总数">
|
||||
{{ form.total }}
|
||||
</el-form-item>
|
||||
<el-form-item label="库存">
|
||||
{{ form.stock }}
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="addRef.show({ ...form })">编辑</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="row mt14">
|
||||
<el-form :model="queryForm" inline>
|
||||
<el-form-item>
|
||||
<el-select v-model="queryForm.status" style="width: 200px;" placeholder="请选择状态" @change="getTableData">
|
||||
<el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input v-model="queryForm.code" placeholder="请输入兑换码" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="searchHandle">搜索</el-button>
|
||||
<el-button type="primary" plain @click="exportHandle">导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="row mt14">
|
||||
<el-table :data="tableData.list" border stripe v-loading="tableData.loading" height="300px">
|
||||
<el-table-column label="兑换码" prop="code" />
|
||||
<el-table-column label="状态" prop="status" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag disable-transitions :type="statusList.find(item => item.value === scope.row.status).type">
|
||||
{{statusList.find(item => item.value === scope.row.status).label}}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="兑换时间" prop="redemptionTime" />
|
||||
<el-table-column label="兑换用户" prop="nickName" />
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="row mt14">
|
||||
<el-pagination v-model:current-page="tableData.page" v-model:page-size="tableData.size"
|
||||
:page-sizes="[10, 30, 50, 100]" background layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="tableData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
</div>
|
||||
</el-dialog>
|
||||
<add ref="addRef" @success="rechargeRedemptionDetailAjax" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import add from "./add.vue";
|
||||
import { rechargeRedemptionCodeList, rechargeRedemptionDetail, rechargeRedemptionExport } from "@/api/coupon/index.js";
|
||||
import { downloadFile } from "@/utils/index";
|
||||
|
||||
const emit = defineEmits(['update']);
|
||||
|
||||
const addRef = ref(null);
|
||||
|
||||
const visible = ref(false);
|
||||
|
||||
const form = ref({
|
||||
id: '',
|
||||
name: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
amount: '',
|
||||
total: 0,
|
||||
stock: 0,
|
||||
});
|
||||
|
||||
const resetForm = () => {
|
||||
form.value = {
|
||||
id: '',
|
||||
name: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
amount: '',
|
||||
total: 0,
|
||||
stock: 0,
|
||||
};
|
||||
};
|
||||
|
||||
// 关闭
|
||||
function closedHandle() {
|
||||
resetForm();
|
||||
tableData.list = [];
|
||||
tableData.page = 1;
|
||||
tableData.size = 10;
|
||||
tableData.total = 0;
|
||||
queryForm.value = {
|
||||
status: "",
|
||||
code: '',
|
||||
};
|
||||
emit('update')
|
||||
}
|
||||
|
||||
const statusList = ref([
|
||||
{ label: "全部", value: "" },
|
||||
{ label: "已兑换", value: 1, type: 'info' },
|
||||
{ label: "未兑换", value: 0, type: 'success' },
|
||||
]);
|
||||
|
||||
const queryForm = ref({
|
||||
status: "",
|
||||
code: '', // 兑换码
|
||||
});
|
||||
|
||||
const tableData = reactive({
|
||||
list: [],
|
||||
loading: false,
|
||||
page: 1,
|
||||
size: 10,
|
||||
total: 0,
|
||||
});
|
||||
|
||||
// 分页大小发生变化
|
||||
function handleSizeChange(e) {
|
||||
tableData.size = e;
|
||||
getTableData();
|
||||
}
|
||||
|
||||
// 分页发生变化
|
||||
function handleCurrentChange(e) {
|
||||
tableData.page = e;
|
||||
getTableData();
|
||||
}
|
||||
|
||||
function searchHandle() {
|
||||
tableData.page = 1;
|
||||
getTableData();
|
||||
}
|
||||
|
||||
const redemptionId = ref('')
|
||||
async function getTableData(id) {
|
||||
// 获取表格数据
|
||||
try {
|
||||
tableData.loading = true
|
||||
const res = await rechargeRedemptionCodeList({
|
||||
redemptionId: redemptionId.value,
|
||||
...queryForm.value,
|
||||
page: tableData.page,
|
||||
size: tableData.size,
|
||||
})
|
||||
tableData.totalAmount = res.totalAmount
|
||||
tableData.list = res.records
|
||||
tableData.total = +res.totalRow
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
setTimeout(() => {
|
||||
tableData.loading = false
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// 导出配置
|
||||
const exportLoading = ref(false)
|
||||
async function exportHandle() {
|
||||
try {
|
||||
exportLoading.value = true
|
||||
const file = await rechargeRedemptionExport({
|
||||
redemptionId: redemptionId.value,
|
||||
...queryForm.value,
|
||||
});
|
||||
downloadFile(file, "数据", "xlsx");
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
setTimeout(() => {
|
||||
exportLoading.value = false
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// 获取配置详情
|
||||
async function rechargeRedemptionDetailAjax() {
|
||||
try {
|
||||
const res = await rechargeRedemptionDetail({ id: redemptionId.value });
|
||||
form.value = {
|
||||
id: res.id || '',
|
||||
name: res.name || '',
|
||||
startTime: res.startTime || '',
|
||||
endTime: res.endTime || '',
|
||||
amount: res.amount || '',
|
||||
total: res.total || 0,
|
||||
stock: res.stock || 0,
|
||||
};
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
function show(obj) {
|
||||
visible.value = true;
|
||||
redemptionId.value = obj.id
|
||||
getTableData()
|
||||
rechargeRedemptionDetailAjax()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.row {
|
||||
&.mt14 {
|
||||
margin-top: 14px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
<template>
|
||||
<el-dialog title="适用门店" width="400px" v-model="visible" @closed="resetForm">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="80px" label-position="right">
|
||||
<el-form-item label="适用门店">
|
||||
<el-radio-group v-model="form.useType">
|
||||
<el-radio value="all" label="全部门店"></el-radio>
|
||||
<el-radio value="part" label="指定门店"></el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择门店" v-if="form.useType == 'part'" prop="shopIds">
|
||||
<selectBranchs all v-model="form.shopIdList" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleOk" :loading="confirmLoading">确 定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { ElNotification } from "element-plus";
|
||||
import selectBranchs from "../../components/selectBranchs.vue";
|
||||
import { couponRedemptionEnable, couponRedemptionEnableStatus } from "@/api/coupon/index.js";
|
||||
|
||||
const visible = ref(false);
|
||||
const confirmLoading = ref(false);
|
||||
const formRef = ref(null);
|
||||
const form = ref({
|
||||
useType: 1,
|
||||
shopIdList: [],
|
||||
});
|
||||
|
||||
const resetForm = () => {
|
||||
form.value = {
|
||||
useType: 1,
|
||||
shopIdList: [],
|
||||
};
|
||||
};
|
||||
|
||||
const rules = {
|
||||
shopIdList: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择门店",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// 提交保存
|
||||
const handleOk = () => {
|
||||
formRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
confirmLoading.value = true;
|
||||
await couponRedemptionEnable({
|
||||
useType: form.value.useType,
|
||||
shopIdList: form.value.shopIdList,
|
||||
});
|
||||
visible.value = false;
|
||||
ElNotification({
|
||||
type: "success",
|
||||
title: '注意',
|
||||
message: "保存成功",
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
setTimeout(() => {
|
||||
confirmLoading.value = false;
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 获取状态
|
||||
async function rechargeRedemptionEnableStatusAjax() {
|
||||
try {
|
||||
const res = await couponRedemptionEnableStatus();
|
||||
form.value.useType = res.useType || 'all';
|
||||
form.value.shopIdList = res.shopIdList || [];
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
function show() {
|
||||
visible.value = true;
|
||||
rechargeRedemptionEnableStatusAjax();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
|
|
@ -0,0 +1,196 @@
|
|||
<!-- 券兑换码 -->
|
||||
<template>
|
||||
<div class="gyq_container">
|
||||
<div class="gyq_content">
|
||||
<header-card name="券兑换码" intro="可添加多券组合兑换" icon="qdhm" showSwitch v-model:isOpen="queryForm.isEnable" />
|
||||
<div class="row mt14">
|
||||
<el-form inline>
|
||||
<el-form-item>
|
||||
<el-select v-model="queryForm.status" @change="getTableData" style="width: 200px;" placeholder="请选择状态">
|
||||
<el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="addRef.show()">添加</el-button>
|
||||
<el-button type="primary" plain @click="useShopsRef.show()">适用门店</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="row">
|
||||
<el-table :data="tableData.list" border stripe v-loading="tableData.loading">
|
||||
<el-table-column label="ID" prop="id" width="80" />
|
||||
<el-table-column label="名称" prop="name" />
|
||||
<el-table-column label="优惠券(张)" prop="couponInfoList" width="200">
|
||||
<template #default="scope">
|
||||
<div class="column">
|
||||
<div v-for="item in scope.row.couponInfoList" :key="item.id">
|
||||
<el-tag effect="dark" round disable-transitions :type="getRandomStatus()">
|
||||
{{ item.title }} x{{ item.num }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库存" prop="stock" />
|
||||
<el-table-column label="总数" prop="total" />
|
||||
<el-table-column label="有效期" width="320">
|
||||
<template #default="scope">
|
||||
<div>{{ scope.row.startTime }} ~ {{ scope.row.endTime }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="operateTime">
|
||||
<template #default="scope">
|
||||
<el-tag disable-transitions :type="statusList.find(item => item.value === scope.row.status).type">
|
||||
{{statusList.find(item => item.value === scope.row.status).label}}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="addRef.show(scope.row)">编辑</el-button>
|
||||
<el-button link type="primary" @click="recordRef.show(scope.row)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="row mt14">
|
||||
<el-pagination v-model:current-page="tableData.page" v-model:page-size="tableData.size"
|
||||
:page-sizes="[10, 30, 50, 100]" background layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="tableData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
</div>
|
||||
</div>
|
||||
<useShops ref="useShopsRef" />
|
||||
<add ref="addRef" @success="getTableData" />
|
||||
<record ref="recordRef" @update="getTableData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import HeaderCard from "../components/headerCard.vue";
|
||||
import useShops from "./components/useShops.vue";
|
||||
import add from "./components/add.vue";
|
||||
import record from "./components/record.vue";
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import { couponRedemptionEnable, couponRedemptionList, couponRedemptionEnableStatus } from "@/api/coupon/index.js";
|
||||
|
||||
const useShopsRef = ref(null);
|
||||
const addRef = ref(null);
|
||||
const recordRef = ref(null);
|
||||
|
||||
const statusList = ref([
|
||||
{ label: "全部", value: "" },
|
||||
{ label: "有效", value: 0, type: 'success' },
|
||||
{ label: "无效", value: 1, type: 'info' },
|
||||
]);
|
||||
|
||||
function getRandomStatus() {
|
||||
const statusList = ['primary', 'success', 'warning', 'danger'];
|
||||
// 生成0到数组长度之间的随机整数索引
|
||||
const randomIndex = Math.floor(Math.random() * statusList.length);
|
||||
// 返回随机索引对应的元素
|
||||
return statusList[randomIndex];
|
||||
}
|
||||
|
||||
const queryForm = ref({
|
||||
status: "",
|
||||
isEnable: 0,
|
||||
});
|
||||
|
||||
watch(
|
||||
() => queryForm.value.isEnable,
|
||||
(newVal) => {
|
||||
if (!tableData.loading) {
|
||||
updateStatus();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const tableData = reactive({
|
||||
loading: true,
|
||||
list: [],
|
||||
total: 0,
|
||||
page: 1,
|
||||
size: 10,
|
||||
});
|
||||
|
||||
// 更新状态
|
||||
async function updateStatus() {
|
||||
try {
|
||||
await couponRedemptionEnable({
|
||||
isEnable: queryForm.value.isEnable,
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 分页大小发生变化
|
||||
function handleSizeChange(e) {
|
||||
tableData.pageSize = e;
|
||||
consumeCashbackRecordAjax();
|
||||
}
|
||||
|
||||
// 分页发生变化
|
||||
function handleCurrentChange(e) {
|
||||
tableData.page = e;
|
||||
consumeCashbackRecordAjax();
|
||||
}
|
||||
|
||||
// 配置信息获取 列表
|
||||
async function getTableData() {
|
||||
try {
|
||||
tableData.loading = true;
|
||||
const res = await couponRedemptionList({
|
||||
status: queryForm.value.status,
|
||||
page: tableData.page,
|
||||
size: tableData.size,
|
||||
});
|
||||
tableData.list = res.records;
|
||||
tableData.total = res.totalRow;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
setTimeout(() => {
|
||||
tableData.loading = false;
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// 开关状态
|
||||
async function rechargeRedemptionEnableStatusAjax() {
|
||||
try {
|
||||
const res = await couponRedemptionEnableStatus();
|
||||
queryForm.value.isEnable = res.isEnable;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getTableData();
|
||||
rechargeRedemptionEnableStatusAjax()
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.gyq_container {
|
||||
padding: 14px;
|
||||
|
||||
.gyq_content {
|
||||
padding: 14px;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.row {
|
||||
&.mt14 {
|
||||
margin-top: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -48,10 +48,12 @@
|
|||
<el-form-item label="可与积分同享">
|
||||
<el-switch v-model="form.withPoints"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-top: 50px;" v-if="shopInfo.isHeadShop == 1 && shopInfo.shopType != 'only'">
|
||||
<el-button type="primary" @click="submitHandle">保存</el-button>
|
||||
<el-button @click="router.back()">取消</el-button>
|
||||
</el-form-item>
|
||||
<div v-if="shopInfo.isHeadShop == 1 || shopInfo.shopType == 'only'">
|
||||
<el-form-item style="margin-top: 50px;">
|
||||
<el-button type="primary" @click="submitHandle">保存</el-button>
|
||||
<el-button @click="router.back()">取消</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
<!-- <el-tab-pane label="充值记录" :name="2">
|
||||
|
|
|
|||
|
|
@ -93,10 +93,10 @@ const menus = ref([
|
|||
{
|
||||
name: "充值兑换码",
|
||||
icon: "czdhm",
|
||||
pathName: "",
|
||||
pathName: "recharge_exchange",
|
||||
intro: "兑换码直充余额,可当作礼品赠送",
|
||||
},
|
||||
{ name: "券兑换码", icon: "qdhm", pathName: "", intro: "可添加多券组合兑换" },
|
||||
{ name: "券兑换码", icon: "qdhm", pathName: "coupon_exchange_code", intro: "可添加多券组合兑换" },
|
||||
{ name: "限时折扣", icon: "xszk", pathName: "", intro: "批量设置商品折扣" },
|
||||
{ name: "商品拼团", icon: "sppt", pathName: "", intro: "拼团" },
|
||||
],
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<div class="item">
|
||||
<el-form-item label="发送对象">
|
||||
<el-radio-group v-model="form.userType">
|
||||
<el-radio label="全部绑定手机号用户" :value="1"></el-radio>
|
||||
<el-radio label="全部已关注公众号用户" :value="1"></el-radio>
|
||||
<el-radio label="自定义用户" :value="2"></el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,181 @@
|
|||
<template>
|
||||
<el-dialog title="添加兑换码" width="500px" v-model="visible" @closed="onClosed">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="80px" label-position="right">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入" :maxlength="50" show-word-limit
|
||||
style="width: 350px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="有效期" prop="timeScope">
|
||||
<div style="width: 350px;">
|
||||
<el-date-picker v-model="form.timeScope" type="datetimerange" range-separator="至" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
|
||||
style="width: 100%;" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="金额" prop="amount">
|
||||
<el-input v-model="form.amount" placeholder="请输入" :maxlength="8" show-word-limit
|
||||
style="width: 350px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="发行数量" prop="total">
|
||||
<el-input v-model="form.total" placeholder="请输入" :maxlength="4" show-word-limit style="width: 350px;"
|
||||
@input="e => form.total = filterNumberInput(e, true)"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="库存" prop="stock" v-if="form.id">
|
||||
<el-input v-model="form.stock" placeholder="请输入" :maxlength="4" show-word-limit style="width: 350px;"
|
||||
@input="e => form.stock = filterNumberInput(e, true)"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="visible = false;">取 消</el-button>
|
||||
<el-button type="primary" @click="handleOk" :loading="confirmLoading">确 定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { filterNumberInput } from '@/utils'
|
||||
import { rechargeRedemption } from "@/api/coupon/index.js";
|
||||
|
||||
const visible = ref(false);
|
||||
const confirmLoading = ref(false);
|
||||
const formRef = ref(null);
|
||||
|
||||
const form = ref({
|
||||
id: '',
|
||||
stock: '',
|
||||
name: '',
|
||||
timeScope: [],
|
||||
amount: '',
|
||||
total: 0,
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
});
|
||||
|
||||
const resetForm = () => {
|
||||
form.value = {
|
||||
id: '',
|
||||
stock: '',
|
||||
name: '',
|
||||
timeScope: [],
|
||||
amount: '',
|
||||
total: 0,
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
};
|
||||
};
|
||||
|
||||
const rules = {
|
||||
name: [
|
||||
{ required: true, message: '请输入名称', trigger: 'blur' },
|
||||
],
|
||||
timeScope: [
|
||||
{ type: 'array', required: true, message: '请选择有效期', trigger: 'change' },
|
||||
],
|
||||
amount: [
|
||||
{ required: true, message: '请输入金额', trigger: 'blur' },
|
||||
],
|
||||
total: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
const num = Number(value);
|
||||
if (value === '' || value == null) {
|
||||
callback(new Error('请输入发行数量'));
|
||||
return;
|
||||
}
|
||||
if (isNaN(num) || !Number.isInteger(num)) {
|
||||
callback(new Error('请输入有效整数'));
|
||||
return;
|
||||
}
|
||||
if (num < 1) {
|
||||
callback(new Error('发行数量需大于1'));
|
||||
return;
|
||||
}
|
||||
if (num > 1000) {
|
||||
callback(new Error('发行数量最大1000'));
|
||||
return;
|
||||
}
|
||||
callback();
|
||||
},
|
||||
trigger: 'blur'
|
||||
},
|
||||
],
|
||||
stock: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
const num = Number(value);
|
||||
if (value === '' || value == null) {
|
||||
callback(new Error('请输入库存'));
|
||||
return;
|
||||
}
|
||||
if (num > stockFlagNum.value) {
|
||||
callback(new Error(`修改库存不能大于${stockFlagNum.value}`));
|
||||
return;
|
||||
}
|
||||
callback();
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// 开始提交
|
||||
const emit = defineEmits(['success']);
|
||||
const handleOk = () => {
|
||||
formRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
confirmLoading.value = true;
|
||||
const data = { ...form.value };
|
||||
data.startTime = form.value.timeScope[0];
|
||||
data.endTime = form.value.timeScope[1];
|
||||
await rechargeRedemption(data, form.value.id ? 'put' : 'post');
|
||||
emit('success');
|
||||
visible.value = false;
|
||||
} catch (error) {
|
||||
console.log('error', error);
|
||||
}
|
||||
setTimeout(() => {
|
||||
confirmLoading.value = false;
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const onClosed = () => {
|
||||
visible.value = false;
|
||||
resetForm();
|
||||
};
|
||||
|
||||
const stockFlagNum = ref(0)
|
||||
|
||||
function show(obj) {
|
||||
console.log(obj);
|
||||
if (obj && obj.id) {
|
||||
form.value = {
|
||||
id: obj.id || '',
|
||||
stock: obj.stock || '',
|
||||
name: obj.name || '',
|
||||
timeScope: obj.startTime && obj.endTime ? [obj.startTime, obj.endTime] : [],
|
||||
amount: obj.amount || '',
|
||||
total: obj.total || 0,
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
};
|
||||
stockFlagNum.value = obj.stock || 0
|
||||
} else {
|
||||
resetForm();
|
||||
}
|
||||
visible.value = true;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
|
|
@ -0,0 +1,224 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-dialog title="充值兑换码" top="5vh" width="800px" v-model="visible" @closed="closedHandle">
|
||||
<el-form label-width="80px" label-position="right">
|
||||
<el-form-item label="名称">
|
||||
{{ form.name }}
|
||||
</el-form-item>
|
||||
<el-form-item label="活动日期">
|
||||
{{ form.startTime }} ~ {{ form.endTime }}
|
||||
</el-form-item>
|
||||
<el-form-item label="金额">
|
||||
{{ form.amount }}
|
||||
</el-form-item>
|
||||
<el-form-item label="总数">
|
||||
{{ form.total }}
|
||||
</el-form-item>
|
||||
<el-form-item label="库存">
|
||||
{{ form.stock }}
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="addRef.show({ ...form })">编辑</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="row mt14">
|
||||
<el-form :model="queryForm" inline>
|
||||
<el-form-item>
|
||||
<el-select v-model="queryForm.status" style="width: 200px;" placeholder="请选择状态" @change="getTableData">
|
||||
<el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input v-model="queryForm.code" placeholder="请输入兑换码" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="searchHandle">搜索</el-button>
|
||||
<el-button type="primary" plain @click="exportHandle">导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="row mt14">
|
||||
<el-table :data="tableData.list" border stripe v-loading="tableData.loading" height="300px">
|
||||
<el-table-column label="兑换码" prop="code" />
|
||||
<el-table-column label="状态" prop="status" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag disable-transitions :type="statusList.find(item => item.value === scope.row.status).type">
|
||||
{{statusList.find(item => item.value === scope.row.status).label}}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="兑换时间" prop="redemptionTime" />
|
||||
<el-table-column label="兑换用户" prop="nickName" />
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="row mt14">
|
||||
<el-pagination v-model:current-page="tableData.page" v-model:page-size="tableData.size"
|
||||
:page-sizes="[10, 30, 50, 100]" background layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="tableData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
</div>
|
||||
</el-dialog>
|
||||
<add ref="addRef" @success="rechargeRedemptionDetailAjax" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import add from "./add.vue";
|
||||
import { rechargeRedemptionCodeList, rechargeRedemptionDetail, rechargeRedemptionExport } from "@/api/coupon/index.js";
|
||||
import { downloadFile } from "@/utils/index";
|
||||
|
||||
const emit = defineEmits(['update']);
|
||||
|
||||
const addRef = ref(null);
|
||||
|
||||
const visible = ref(false);
|
||||
|
||||
const form = ref({
|
||||
id: '',
|
||||
name: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
amount: '',
|
||||
total: 0,
|
||||
stock: 0,
|
||||
});
|
||||
|
||||
const resetForm = () => {
|
||||
form.value = {
|
||||
id: '',
|
||||
name: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
amount: '',
|
||||
total: 0,
|
||||
stock: 0,
|
||||
};
|
||||
};
|
||||
|
||||
// 关闭
|
||||
function closedHandle() {
|
||||
resetForm();
|
||||
tableData.list = [];
|
||||
tableData.page = 1;
|
||||
tableData.size = 10;
|
||||
tableData.total = 0;
|
||||
queryForm.value = {
|
||||
status: "",
|
||||
code: '',
|
||||
};
|
||||
emit('update')
|
||||
}
|
||||
|
||||
const statusList = ref([
|
||||
{ label: "全部", value: "" },
|
||||
{ label: "已兑换", value: 1, type: 'info' },
|
||||
{ label: "未兑换", value: 0, type: 'success' },
|
||||
]);
|
||||
|
||||
const queryForm = ref({
|
||||
status: "",
|
||||
code: '', // 兑换码
|
||||
});
|
||||
|
||||
const tableData = reactive({
|
||||
list: [],
|
||||
loading: false,
|
||||
page: 1,
|
||||
size: 10,
|
||||
total: 0,
|
||||
});
|
||||
|
||||
// 分页大小发生变化
|
||||
function handleSizeChange(e) {
|
||||
tableData.size = e;
|
||||
getTableData();
|
||||
}
|
||||
|
||||
// 分页发生变化
|
||||
function handleCurrentChange(e) {
|
||||
tableData.page = e;
|
||||
getTableData();
|
||||
}
|
||||
|
||||
function searchHandle() {
|
||||
tableData.page = 1;
|
||||
getTableData();
|
||||
}
|
||||
|
||||
const redemptionId = ref('')
|
||||
async function getTableData(id) {
|
||||
// 获取表格数据
|
||||
try {
|
||||
tableData.loading = true
|
||||
const res = await rechargeRedemptionCodeList({
|
||||
redemptionId: redemptionId.value,
|
||||
...queryForm.value,
|
||||
page: tableData.page,
|
||||
size: tableData.size,
|
||||
})
|
||||
tableData.totalAmount = res.totalAmount
|
||||
tableData.list = res.records
|
||||
tableData.total = +res.totalRow
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
setTimeout(() => {
|
||||
tableData.loading = false
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// 导出配置
|
||||
const exportLoading = ref(false)
|
||||
async function exportHandle() {
|
||||
try {
|
||||
exportLoading.value = true
|
||||
const file = await rechargeRedemptionExport({
|
||||
redemptionId: redemptionId.value,
|
||||
...queryForm.value,
|
||||
});
|
||||
downloadFile(file, "数据", "xlsx");
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
setTimeout(() => {
|
||||
exportLoading.value = false
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// 获取配置详情
|
||||
async function rechargeRedemptionDetailAjax() {
|
||||
try {
|
||||
const res = await rechargeRedemptionDetail({ id: redemptionId.value });
|
||||
form.value = {
|
||||
id: res.id || '',
|
||||
name: res.name || '',
|
||||
startTime: res.startTime || '',
|
||||
endTime: res.endTime || '',
|
||||
amount: res.amount || '',
|
||||
total: res.total || 0,
|
||||
stock: res.stock || 0,
|
||||
};
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
function show(obj) {
|
||||
visible.value = true;
|
||||
redemptionId.value = obj.id
|
||||
getTableData()
|
||||
rechargeRedemptionDetailAjax()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.row {
|
||||
&.mt14 {
|
||||
margin-top: 14px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
<template>
|
||||
<el-dialog title="适用门店" width="400px" v-model="visible" @closed="resetForm">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="80px" label-position="right">
|
||||
<el-form-item label="适用门店">
|
||||
<el-radio-group v-model="form.useType">
|
||||
<el-radio value="all" label="全部门店"></el-radio>
|
||||
<el-radio value="part" label="指定门店"></el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择门店" v-if="form.useType == 'part'" prop="shopIds">
|
||||
<selectBranchs all v-model="form.shopIdList" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleOk" :loading="confirmLoading">确 定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { ElNotification } from "element-plus";
|
||||
import selectBranchs from "../../components/selectBranchs.vue";
|
||||
import { rechargeRedemptionPut, rechargeRedemptionEnableStatus } from "@/api/coupon/index.js";
|
||||
|
||||
const visible = ref(false);
|
||||
const confirmLoading = ref(false);
|
||||
const formRef = ref(null);
|
||||
const form = ref({
|
||||
useType: 1,
|
||||
shopIdList: [],
|
||||
});
|
||||
|
||||
const resetForm = () => {
|
||||
form.value = {
|
||||
useType: 1,
|
||||
shopIdList: [],
|
||||
};
|
||||
};
|
||||
|
||||
const rules = {
|
||||
shopIdList: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择门店",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// 提交保存
|
||||
const handleOk = () => {
|
||||
formRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
confirmLoading.value = true;
|
||||
await rechargeRedemptionPut({
|
||||
useType: form.value.useType,
|
||||
shopIdList: form.value.shopIdList,
|
||||
});
|
||||
visible.value = false;
|
||||
ElNotification({
|
||||
type: "success",
|
||||
title: '注意',
|
||||
message: "保存成功",
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
setTimeout(() => {
|
||||
confirmLoading.value = false;
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 获取状态
|
||||
async function rechargeRedemptionEnableStatusAjax() {
|
||||
try {
|
||||
const res = await rechargeRedemptionEnableStatus();
|
||||
form.value.useType = res.useType || 'all';
|
||||
form.value.shopIdList = res.shopIdList || [];
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
function show() {
|
||||
visible.value = true;
|
||||
rechargeRedemptionEnableStatusAjax();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
<!-- 充值兑换码 -->
|
||||
<template>
|
||||
<div class="gyq_container">
|
||||
<div class="gyq_content">
|
||||
<header-card name="充值兑换码" intro="兑换码直充余额,可当作礼品赠送" icon="czdhm" showSwitch v-model:isOpen="queryForm.isEnable" />
|
||||
<div class="row mt14">
|
||||
<el-form inline>
|
||||
<el-form-item>
|
||||
<el-select v-model="queryForm.status" @change="getTableData" style="width: 200px;">
|
||||
<el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="addRef.show()">添加</el-button>
|
||||
<el-button type="primary" plain @click="useShopsRef.show()">适用门店</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="row">
|
||||
<el-table :data="tableData.list" border stripe v-loading="tableData.loading">
|
||||
<el-table-column label="ID" prop="id" width="80" />
|
||||
<el-table-column label="名称" prop="name" />
|
||||
<el-table-column label="金额" prop="amount" />
|
||||
<el-table-column label="库存" prop="stock" />
|
||||
<el-table-column label="总数" prop="total" />
|
||||
<el-table-column label="有效期" width="320">
|
||||
<template #default="scope">
|
||||
<div>{{ scope.row.startTime }} ~ {{ scope.row.endTime }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="operateTime">
|
||||
<template #default="scope">
|
||||
<el-tag disable-transitions :type="statusList.find(item => item.value === scope.row.status).type">
|
||||
{{statusList.find(item => item.value === scope.row.status).label}}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="addRef.show(scope.row)">编辑</el-button>
|
||||
<el-button link type="primary" @click="recordRef.show(scope.row)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="row mt14">
|
||||
<el-pagination v-model:current-page="tableData.page" v-model:page-size="tableData.size"
|
||||
:page-sizes="[10, 30, 50, 100]" background layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="tableData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
</div>
|
||||
</div>
|
||||
<useShops ref="useShopsRef" />
|
||||
<add ref="addRef" @success="getTableData" />
|
||||
<record ref="recordRef" @update="getTableData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import HeaderCard from "../components/headerCard.vue";
|
||||
import useShops from "./components/useShops.vue";
|
||||
import add from "./components/add.vue";
|
||||
import record from "./components/record.vue";
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import { rechargeRedemptionPut, rechargeRedemptionList, rechargeRedemptionEnableStatus } from "@/api/coupon/index.js";
|
||||
|
||||
const useShopsRef = ref(null);
|
||||
const addRef = ref(null);
|
||||
const recordRef = ref(null);
|
||||
|
||||
const statusList = ref([
|
||||
{ label: "全部", value: "" },
|
||||
{ label: "有效", value: 0, type: 'success' },
|
||||
{ label: "无效", value: 1, type: 'info' },
|
||||
]);
|
||||
|
||||
const queryForm = ref({
|
||||
status: "",
|
||||
isEnable: 0,
|
||||
});
|
||||
|
||||
watch(
|
||||
() => queryForm.value.isEnable,
|
||||
(newVal) => {
|
||||
if (!tableData.loading) {
|
||||
updateStatus();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const tableData = reactive({
|
||||
loading: true,
|
||||
list: [],
|
||||
total: 0,
|
||||
page: 1,
|
||||
size: 10,
|
||||
});
|
||||
|
||||
// 更新状态
|
||||
async function updateStatus() {
|
||||
try {
|
||||
await rechargeRedemptionPut({
|
||||
isEnable: queryForm.value.isEnable,
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 分页大小发生变化
|
||||
function handleSizeChange(e) {
|
||||
tableData.pageSize = e;
|
||||
consumeCashbackRecordAjax();
|
||||
}
|
||||
|
||||
// 分页发生变化
|
||||
function handleCurrentChange(e) {
|
||||
tableData.page = e;
|
||||
consumeCashbackRecordAjax();
|
||||
}
|
||||
|
||||
// 配置信息获取 列表
|
||||
async function getTableData() {
|
||||
try {
|
||||
tableData.loading = true;
|
||||
const res = await rechargeRedemptionList({
|
||||
status: queryForm.value.status,
|
||||
page: tableData.page,
|
||||
size: tableData.size,
|
||||
});
|
||||
tableData.list = res.records;
|
||||
tableData.total = res.totalRow;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
setTimeout(() => {
|
||||
tableData.loading = false;
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// 开关状态
|
||||
async function rechargeRedemptionEnableStatusAjax() {
|
||||
try {
|
||||
const res = await rechargeRedemptionEnableStatus();
|
||||
queryForm.value.isEnable = res.isEnable;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getTableData();
|
||||
rechargeRedemptionEnableStatusAjax()
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.gyq_container {
|
||||
padding: 14px;
|
||||
|
||||
.gyq_content {
|
||||
padding: 14px;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.row {
|
||||
&.mt14 {
|
||||
margin-top: 14px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,19 +1,8 @@
|
|||
<template>
|
||||
<div class="m-4 bg-white p-4">
|
||||
<HeaderCard
|
||||
name="超级会员"
|
||||
intro="用户会员管理设置"
|
||||
icon="super_vip"
|
||||
showSwitch
|
||||
v-model:isOpen="basicForm.isOpen"
|
||||
></HeaderCard>
|
||||
<HeaderCard name="超级会员" intro="用户会员管理设置" icon="super_vip" showSwitch v-model:isOpen="basicForm.isOpen"></HeaderCard>
|
||||
<el-tabs class="mt-4" v-model="activeTab" type="border-card">
|
||||
<el-tab-pane
|
||||
:label="item.label"
|
||||
v-for="item in configs"
|
||||
:key="item.name"
|
||||
:name="item.name"
|
||||
>
|
||||
<el-tab-pane :label="item.label" v-for="item in configs" :key="item.name" :name="item.name">
|
||||
<template v-if="item.name == 'basic'">
|
||||
<h3>基础设置</h3>
|
||||
<el-form ref="form" :model="basicForm">
|
||||
|
|
@ -43,40 +32,25 @@
|
|||
<el-table :data="basicForm.configList" border style="width: 60%">
|
||||
<el-table-column prop="name" label="名称" align="center" />
|
||||
<el-table-column prop="price" label="价格" align="center" />
|
||||
<el-table-column
|
||||
prop="reward"
|
||||
label="赠送成长值"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column prop="reward" label="赠送成长值" align="center" />
|
||||
<el-table-column label="赠送优惠券" align="center">
|
||||
<template #default="scope">
|
||||
{{ totalCount(scope.row.couponList) }}张优惠券
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="is_auto_renew"
|
||||
label="会员周期"
|
||||
align="center"
|
||||
>
|
||||
<el-table-column prop="is_auto_renew" label="会员周期" align="center">
|
||||
<template #default="scope">
|
||||
{{ scope.row.circleTime }} {{ scope.row.circleUnit }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
@click="
|
||||
refDialogPlans.open(scope.row, scope.$index)
|
||||
"
|
||||
>
|
||||
<el-button type="text" @click="
|
||||
refDialogPlans.open(scope.row, scope.$index)
|
||||
">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
style="color: red"
|
||||
@click="deletePlan(scope.row)"
|
||||
>
|
||||
<el-button type="text" style="color: red" @click="deletePlan(scope.row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
|
|
@ -88,23 +62,13 @@
|
|||
<div v-if="basicForm.openType == 'CONDITION'">
|
||||
<el-form-item label="成为会员条件">
|
||||
<div>
|
||||
<div
|
||||
class="m-b-2"
|
||||
v-for="(item, index) in conditionLists"
|
||||
:key="index"
|
||||
>
|
||||
<div class="m-b-2" v-for="(item, index) in conditionLists" :key="index">
|
||||
<el-checkbox v-model="item.checked">
|
||||
{{ item.label }}
|
||||
</el-checkbox>
|
||||
<el-input-number
|
||||
style="margin-left: 20px"
|
||||
v-if="item.label != '绑定手机号' && item.checked"
|
||||
v-model="item.value"
|
||||
:step="item.step"
|
||||
:precision="item.precision || 0"
|
||||
:step-strictly="item.stepStrictly || false"
|
||||
:min="item.min || 0"
|
||||
/>
|
||||
<el-input-number style="margin-left: 20px" v-if="item.label != '绑定手机号' && item.checked"
|
||||
v-model="item.value" :step="item.step" :precision="item.precision || 0"
|
||||
:step-strictly="item.stepStrictly || false" :min="item.min || 0" />
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
|
@ -115,22 +79,10 @@
|
|||
<el-radio value="PART">指定门店</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="选择门店"
|
||||
v-if="basicForm.memberPriceShopType == 'PART'"
|
||||
>
|
||||
<el-select
|
||||
style="max-width: 600px"
|
||||
v-model="basicForm.memberPriceShopIdList"
|
||||
multiple
|
||||
placeholder="请选择门店"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in shops"
|
||||
:key="item.shopId"
|
||||
:label="item.shopName"
|
||||
:value="item.shopId"
|
||||
/>
|
||||
<el-form-item label="选择门店" v-if="basicForm.memberPriceShopType == 'PART'">
|
||||
<el-select style="max-width: 600px" v-model="basicForm.memberPriceShopIdList" multiple
|
||||
placeholder="请选择门店">
|
||||
<el-option v-for="item in shops" :key="item.shopId" :label="item.shopName" :value="item.shopId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="享受会员价">
|
||||
|
|
@ -140,13 +92,8 @@
|
|||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="规则说明">
|
||||
<el-input
|
||||
v-model="basicForm.remark"
|
||||
style="width: 400px"
|
||||
:autosize="{ minRows: 4, maxRows: 5 }"
|
||||
type="textarea"
|
||||
placeholder="请输入内容"
|
||||
></el-input>
|
||||
<el-input v-model="basicForm.remark" style="width: 400px" :autosize="{ minRows: 4, maxRows: 5 }"
|
||||
type="textarea" placeholder="请输入内容"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<h3>升级规则</h3>
|
||||
|
|
@ -156,20 +103,12 @@
|
|||
<div>
|
||||
<div class="m-b-4">
|
||||
<span>每消费1元获得</span>
|
||||
<el-input-number
|
||||
class="m-x-2"
|
||||
v-model="basicForm.costReward"
|
||||
placeholder="请输入内容"
|
||||
/>
|
||||
<el-input-number class="m-x-2" v-model="basicForm.costReward" placeholder="请输入内容" />
|
||||
<span>成长值</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>每充值1元获得</span>
|
||||
<el-input-number
|
||||
class="m-x-2"
|
||||
v-model="basicForm.rechargeReward"
|
||||
placeholder="请输入内容"
|
||||
/>
|
||||
<el-input-number class="m-x-2" v-model="basicForm.rechargeReward" placeholder="请输入内容" />
|
||||
<span>成长值</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -181,13 +120,8 @@
|
|||
</div>
|
||||
</el-form-item>
|
||||
<div class="flex mt-10 justify-center gap-10">
|
||||
<el-button
|
||||
style="width: 100px"
|
||||
type="primary"
|
||||
@click="basicSubmit"
|
||||
size="large"
|
||||
v-if="shopInfo.isHeadShop"
|
||||
>
|
||||
<el-button style="width: 100px" type="primary" @click="basicSubmit" size="large"
|
||||
v-if="shopInfo.isHeadShop || shopInfo.shopType == 'only'">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button @click="close" style="width: 100px" size="large">取消</el-button>
|
||||
|
|
@ -199,52 +133,22 @@
|
|||
<div>
|
||||
<el-button type="primary" @click="addLevel">添加会员等级</el-button>
|
||||
</div>
|
||||
<el-tabs
|
||||
v-model="activeLevelId"
|
||||
type="card"
|
||||
style="margin-top: 20px"
|
||||
@tab-remove="removeLevel"
|
||||
@tab-add="addLevel"
|
||||
@tab-change="levelTabChange"
|
||||
editable
|
||||
>
|
||||
<el-tab-pane
|
||||
v-for="(level, index) in levels"
|
||||
:key="level.id"
|
||||
:label="index + 1 + '级:' + level.name || '未命名等级'"
|
||||
:name="index"
|
||||
>
|
||||
<el-tabs v-model="activeLevelId" type="card" style="margin-top: 20px" @tab-remove="removeLevel"
|
||||
@tab-add="addLevel" @tab-change="levelTabChange" editable>
|
||||
<el-tab-pane v-for="(level, index) in levels" :key="level.id"
|
||||
:label="index + 1 + '级:' + level.name || '未命名等级'" :name="index">
|
||||
<!-- 编辑会员等级参数 -->
|
||||
<el-form :model="level" label-width="150px">
|
||||
<el-form-item label="会员标题" required>
|
||||
<el-input
|
||||
v-model="level.name"
|
||||
:style="inputStyle"
|
||||
maxlength="30"
|
||||
placeholder="请输入会员标题"
|
||||
/>
|
||||
<el-input v-model="level.name" :style="inputStyle" maxlength="30" placeholder="请输入会员标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所需成长值" required>
|
||||
<el-input-number
|
||||
:disabled="index == 0"
|
||||
v-model="level.experienceValue"
|
||||
type="number"
|
||||
placeholder="请输入所需成长值"
|
||||
:style="inputStyle"
|
||||
:min="levelExperienceValueMin(index, level)"
|
||||
/>
|
||||
<el-input-number :disabled="index == 0" v-model="level.experienceValue" type="number"
|
||||
placeholder="请输入所需成长值" :style="inputStyle" :min="levelExperienceValueMin(index, level)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="会员折扣" required>
|
||||
<el-input-number
|
||||
v-model="level.discount"
|
||||
:style="inputStyle"
|
||||
:step="1"
|
||||
step-strictly
|
||||
:min="1"
|
||||
:max="100"
|
||||
type="number"
|
||||
placeholder="请输入会员折扣"
|
||||
/>
|
||||
<el-input-number v-model="level.discount" :style="inputStyle" :step="1" step-strictly :min="1"
|
||||
:max="100" type="number" placeholder="请输入会员折扣" />
|
||||
</el-form-item>
|
||||
<el-form-item label="等级标识">
|
||||
<div>
|
||||
|
|
@ -256,43 +160,22 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="消费送积分">
|
||||
<div>
|
||||
<el-switch
|
||||
v-model="level.isCostRewardPoints"
|
||||
:inactive-value="0"
|
||||
:active-value="1"
|
||||
/>
|
||||
<el-switch v-model="level.isCostRewardPoints" :inactive-value="0" :active-value="1" />
|
||||
<!-- <el-radio-group v-model="level.isPointsEnabled">
|
||||
<el-radio :value="true">已启用</el-radio>
|
||||
<el-radio :value="false">已禁用</el-radio>
|
||||
</el-radio-group> -->
|
||||
<div
|
||||
v-if="level.isCostRewardPoints"
|
||||
style="margin-top: 10px"
|
||||
class="color-666 flex"
|
||||
>
|
||||
<div v-if="level.isCostRewardPoints" style="margin-top: 10px" class="color-666 flex">
|
||||
<span class="no-wrap">每消费</span>
|
||||
<el-input-number
|
||||
:min="0.01"
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
class="m-x-2"
|
||||
v-model="level.costRewardPoints"
|
||||
type="number"
|
||||
placeholder="请输入内容"
|
||||
/>
|
||||
<el-input-number :min="0.01" :precision="2" :controls="false" class="m-x-2"
|
||||
v-model="level.costRewardPoints" type="number" placeholder="请输入内容" />
|
||||
<span class="no-wrap">元赠送1积分</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="等级说明" required>
|
||||
<el-input
|
||||
v-model="level.remark"
|
||||
style="width: 400px"
|
||||
:maxlength="200"
|
||||
:autosize="{ minRows: 4, maxRows: 5 }"
|
||||
type="textarea"
|
||||
placeholder="请输入等级说明,最多 250 字"
|
||||
/>
|
||||
<el-input v-model="level.remark" style="width: 400px" :maxlength="200"
|
||||
:autosize="{ minRows: 4, maxRows: 5 }" type="textarea" placeholder="请输入等级说明,最多 250 字" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="周期时间">
|
||||
<div class="flex w-full gap-2">
|
||||
|
|
@ -311,11 +194,7 @@
|
|||
</el-form-item> -->
|
||||
<el-form-item label="自动发放">
|
||||
<div>
|
||||
<el-switch
|
||||
v-model="level.isCycleReward"
|
||||
:inactive-value="0"
|
||||
:active-value="1"
|
||||
/>
|
||||
<el-switch v-model="level.isCycleReward" :inactive-value="0" :active-value="1" />
|
||||
<!-- <el-radio-group v-model="level.isCycleReward">
|
||||
<el-radio :value="true">已启用</el-radio>
|
||||
<el-radio :value="false">已禁用</el-radio>
|
||||
|
|
@ -323,15 +202,8 @@
|
|||
<div v-if="level.isCycleReward" style="margin-top: 10px">
|
||||
<div class="flex">
|
||||
<span class="color-666 no-wrap mr-4">周期时间</span>
|
||||
<el-input
|
||||
v-model="level.cycleTime"
|
||||
type="number"
|
||||
placeholder="请输入周期时间"
|
||||
/>
|
||||
<el-select
|
||||
v-model="level.cycleUnit"
|
||||
placeholder="选择单位"
|
||||
>
|
||||
<el-input v-model="level.cycleTime" type="number" placeholder="请输入周期时间" />
|
||||
<el-select v-model="level.cycleUnit" placeholder="选择单位">
|
||||
<el-option label="周" value="周" />
|
||||
<el-option label="月" value="月" />
|
||||
<el-option label="年" value="年" />
|
||||
|
|
@ -339,20 +211,12 @@
|
|||
</div>
|
||||
<div class="flex mt-4">
|
||||
<span class="color-666 no-wrap mr-4">赠送积分</span>
|
||||
<el-input-number
|
||||
:step="1"
|
||||
step-strictly
|
||||
:min="1"
|
||||
v-model="level.cycleRewardPoints"
|
||||
type="number"
|
||||
placeholder="赠送积分"
|
||||
/>
|
||||
<el-input-number :step="1" step-strictly :min="1" v-model="level.cycleRewardPoints"
|
||||
type="number" placeholder="赠送积分" />
|
||||
</div>
|
||||
<div class="flex mt-4" style="align-items: flex-start">
|
||||
<span class="color-666 no-wrap mr-4">送优惠券</span>
|
||||
<CouponLists
|
||||
v-model="level.cycleRewardCouponList"
|
||||
/>
|
||||
<CouponLists v-model="level.cycleRewardCouponList" />
|
||||
<!-- <el-select v-model="level.autoSendCoupon" placeholder="选择赠送优惠券">
|
||||
<el-option
|
||||
v-for="coupon in couponList"
|
||||
|
|
@ -366,14 +230,8 @@
|
|||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="flex mt-10 justify-center gap-10">
|
||||
<el-button
|
||||
style="width: 100px"
|
||||
type="primary"
|
||||
@click="saveLevel(level)"
|
||||
size="large"
|
||||
v-if="shopInfo.isHeadShop"
|
||||
>
|
||||
<div class="flex mt-10 justify-center gap-10" v-if="shopInfo.isHeadShop || shopInfo.shopType == 'only'">
|
||||
<el-button style="width: 100px" type="primary" @click="saveLevel(level)" size="large">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button @click="close" style="width: 100px" size="large">
|
||||
|
|
@ -700,20 +558,23 @@ function close() {
|
|||
router.back();
|
||||
}
|
||||
//
|
||||
function levelTabChange(index) {}
|
||||
function levelTabChange(index) { }
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-tabs--border-card) {
|
||||
border: none;
|
||||
}
|
||||
|
||||
:deep(.el-tabs--border-card > .el-tabs__header) {
|
||||
border: none;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
:deep(.el-tabs--border-card > .el-tabs__header .el-tabs__item) {
|
||||
border: none;
|
||||
}
|
||||
|
||||
:deep(.el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active) {
|
||||
border: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@
|
|||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="footer">
|
||||
<el-button type="primary" size="large" @click="submitHandle" v-if="shopInfo.isHeadShop">
|
||||
<div class="footer" v-if="shopInfo.isHeadShop || shopInfo.shopType == 'only'">
|
||||
<el-button type="primary" size="large" @click="submitHandle">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button size="large" @click="back">取消</el-button>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ import UnoCSS from "unocss/vite";
|
|||
import { resolve } from "path";
|
||||
import { name, version, engines, dependencies, devDependencies } from "./package.json";
|
||||
|
||||
import stripCode from 'vite-plugin-strip-code'; // 导入插件
|
||||
|
||||
// 平台的名称、版本、运行所需的 node 版本、依赖、构建时间的类型提示
|
||||
const __APP_INFO__ = {
|
||||
pkg: { name, version, engines, dependencies, devDependencies },
|
||||
|
|
@ -100,6 +102,12 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
|||
iconDirs: [resolve(pathSrc, "assets/icons")],
|
||||
symbolId: "icon-[dir]-[name]",
|
||||
}),
|
||||
mode === 'production' && stripCode({
|
||||
// 定义需要剔除的代码块的「开始标记」和「结束标记」
|
||||
// 注意:标记可以自定义,只要前后一致即可
|
||||
start_comment: 'DEV-START', // 开始标记(自定义)
|
||||
end_comment: 'DEV-END' // 结束标记(自定义)
|
||||
})
|
||||
],
|
||||
// 预加载项目必需的组件
|
||||
optimizeDeps: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue