合并代码

This commit is contained in:
2025-04-30 15:41:00 +08:00
parent d74696fb64
commit b9413abf93
5 changed files with 222 additions and 185 deletions
+2 -1
View File
@@ -41,13 +41,14 @@ export interface ThinkVip {
prices?: string; prices?: string;
// 是否赠送积分:1赠送,2不赠送 // 是否赠送积分:1赠送,2不赠送
isIntegral?: number; isIntegral?: number;
mode?: number;
expiredTime?: string;
// //
createTime?: number; createTime?: number;
// //
updateTime?: number; updateTime?: number;
// 是否有效:1是,0否 // 是否有效:1是,0否
isUse?: number; isUse?: number;
// 是否销售:1是,0否
isSale?: number; isSale?: number;
} }
+3 -2
View File
@@ -56,6 +56,7 @@
v-model:visible="showEdit" v-model:visible="showEdit"
:merchant="data" :merchant="data"
:merchantId="categoryId" :merchantId="categoryId"
:sid="data.id"
:data="current" :data="current"
@done="reload" @done="reload"
/> />
@@ -180,8 +181,8 @@
}, },
{ {
title: '排序', title: '排序',
dataIndex: 'sortNumber', dataIndex: 'sort',
key: 'sortNumber', key: 'sort',
align: 'center' align: 'center'
}, },
{ {
@@ -15,11 +15,11 @@
<span>{{ data.totalPrice }}元</span> <span>{{ data.totalPrice }}元</span>
</a-form-item> </a-form-item>
<a-form-item label="支付金额"> <a-form-item label="支付金额">
<span>{{ data.payPrice }}元</span> <span>{{ data.price }}元</span>
</a-form-item> </a-form-item>
<a-form-item label="退款金额"> <a-form-item label="退款金额">
<a-input-number placeholder="请输入退款金额" style="width: 300px" v-model:value="form.refundAmount" <a-input-number placeholder="请输入退款金额" style="width: 300px" v-model:value="form.refundAmount"
:max="data.payPrice" /> :max="data.price" />
</a-form-item> </a-form-item>
</a-form> </a-form>
</ele-modal> </ele-modal>
@@ -63,7 +63,7 @@ const updateVisible = (value: boolean) => {
}; };
const save = async () => { const save = async () => {
if (!form.refundAmount) return message.error("请输入退款金额"); if (!form.refundAmount && props.data.price > 0) return message.error("请输入退款金额");
loading.value = true; loading.value = true;
await addThinkOrderRefundLog(form); await addThinkOrderRefundLog(form);
loading.value = false; loading.value = false;
+15 -7
View File
@@ -44,14 +44,9 @@
</template> </template>
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<a-space v-if="record.status === 1"> <a-space v-if="record.status === 1">
<template v-if="record.uid"> <ThinkSelectUsers :id="record.id" @done="changeBindCard" />
<a-popconfirm
title="确定要解绑吗?"
@confirm="release(record)"
>
<a class="text-green-600">解绑</a>
</a-popconfirm>
<a-divider type="vertical" /> <a-divider type="vertical" />
<template v-if="record.uid">
<a-popconfirm <a-popconfirm
title="确定要退卡吗?" title="确定要退卡吗?"
@confirm="remove(record)" @confirm="remove(record)"
@@ -106,6 +101,7 @@ import type {
ThinkUsersVipParam ThinkUsersVipParam
} from "@/api/think/thinkUsersVip/model"; } from "@/api/think/thinkUsersVip/model";
import ThinkUsersVipLog from "@/views/think/thinkUsersVip/components/thinkUsersVipLog.vue"; import ThinkUsersVipLog from "@/views/think/thinkUsersVip/components/thinkUsersVipLog.vue";
import { ThinkUsers } from "@/api/think/thinkUsers/model";
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -391,6 +387,18 @@ const query = () => {
loading.value = true; loading.value = true;
}; };
const changeBindCard = (row: ThinkUsers, id: number) => {
updateThinkUsersVip({
id,
uid: row.id,
username: row.truename ?? row.username,
phone: row.phone
}).then(() => {
message.success("操作成功");
reload();
});
};
/* 自定义行属性 */ /* 自定义行属性 */
const customRow = (record: ThinkUsersVip) => { const customRow = (record: ThinkUsersVip) => {
return { return {
@@ -53,6 +53,12 @@
<a-radio :value="2">不赠送</a-radio> <a-radio :value="2">不赠送</a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item label="过期类型" name="mode">
<a-radio-group v-model:value="form.mode">
<a-radio :value="0">按下单时间计算</a-radio>
<a-radio :value="1">按固定时间</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="可选场馆" name="sid"> <a-form-item label="可选场馆" name="sid">
<ThinkSelectSiteMultiple v-model:value="sites" /> <ThinkSelectSiteMultiple v-model:value="sites" />
</a-form-item> </a-form-item>
@@ -98,6 +104,7 @@
v-model:value="form.eachMoney" v-model:value="form.eachMoney"
/> />
</a-form-item> </a-form-item>
<template v-if="form.mode === 0">
<a-form-item label="年限" name="term"> <a-form-item label="年限" name="term">
<a-input <a-input
allow-clear allow-clear
@@ -119,6 +126,11 @@
v-model:value="form.day" v-model:value="form.day"
/> />
</a-form-item> </a-form-item>
</template>
<a-form-item v-else label="过期时间" name="expiredTime">
<a-date-picker v-model:value="form.expiredTime" value-format="YYYY-MM-DD"
placeholder="请选择过期时间"></a-date-picker>
</a-form-item>
<a-form-item label="排序" name="sort"> <a-form-item label="排序" name="sort">
<a-input-number <a-input-number
:min="0" :min="0"
@@ -137,7 +149,13 @@
<a-form-item label="是否有效" name="isUse"> <a-form-item label="是否有效" name="isUse">
<a-radio-group v-model:value="form.isUse"> <a-radio-group v-model:value="form.isUse">
<a-radio :value="1">是</a-radio> <a-radio :value="1">是</a-radio>
<a-radio :value="0">否</a-radio> <a-radio :value="2">否</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="是否在售" name="isSale">
<a-radio-group v-model:value="form.isSale">
<a-radio :value="1">是</a-radio>
<a-radio :value="2">否</a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
</a-form> </a-form>
@@ -145,18 +163,18 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, watch } from 'vue'; import { ref, reactive, watch } from "vue";
import { Form, message } from 'ant-design-vue'; import { Form, message } from "ant-design-vue";
import { assignObject, uuid } from 'ele-admin-pro'; import { assignObject, uuid } from "ele-admin-pro";
import { addThinkVip, updateThinkVip } from '@/api/think/thinkVip'; import { addThinkVip, updateThinkVip } from "@/api/think/thinkVip";
import { ThinkVip } from '@/api/think/thinkVip/model'; import { ThinkVip } from "@/api/think/thinkVip/model";
import { useThemeStore } from '@/store/modules/theme'; import { useThemeStore } from "@/store/modules/theme";
import { storeToRefs } from 'pinia'; import { storeToRefs } from "pinia";
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types'; import { ItemType } from "ele-admin-pro/es/ele-image-upload/types";
import { FormInstance } from 'ant-design-vue/es/form'; import { FormInstance } from "ant-design-vue/es/form";
import { FileRecord } from '@/api/system/file/model'; import { FileRecord } from "@/api/system/file/model";
import { ThinkSite } from '@/api/think/thinkSite/model'; import { ThinkSite } from "@/api/think/thinkSite/model";
import { IMG_URL } from '@/config/setting'; import { IMG_URL } from "@/config/setting";
// 是否是修改 // 是否是修改
const isUpdate = ref(false); const isUpdate = ref(false);
@@ -173,8 +191,8 @@
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'done'): void; (e: "done"): void;
(e: 'update:visible', visible: boolean): void; (e: "update:visible", visible: boolean): void;
}>(); }>();
// 提交状态 // 提交状态
@@ -206,12 +224,16 @@
pic: undefined, pic: undefined,
prices: undefined, prices: undefined,
isIntegral: 2, isIntegral: 2,
isUse: undefined mode: 0,
sort: 0,
isSale: 1,
isUse: undefined,
expiredTime: undefined,
}); });
/* 更新visible */ /* 更新visible */
const updateVisible = (value: boolean) => { const updateVisible = (value: boolean) => {
emit('update:visible', value); emit("update:visible", value);
}; };
// 表单验证规则 // 表单验证规则
@@ -219,9 +241,9 @@
name: [ name: [
{ {
required: true, required: true,
type: 'string', type: "string",
message: '请填写名称', message: "请填写名称",
trigger: 'blur' trigger: "blur"
} }
] ]
}); });
@@ -230,14 +252,14 @@
images.value.push({ images.value.push({
uid: data.id, uid: data.id,
url: data.path, url: data.path,
status: 'done' status: "done"
}); });
form.image = data.path; form.image = data.path;
}; };
const onDeleteItem = (index: number) => { const onDeleteItem = (index: number) => {
images.value.splice(index, 1); images.value.splice(index, 1);
form.image = ''; form.image = "";
}; };
const { resetFields } = useForm(form, rules); const { resetFields } = useForm(form, rules);
@@ -252,25 +274,30 @@
.then(() => { .then(() => {
loading.value = true; loading.value = true;
// 字符串数组用逗号相连 // 字符串数组用逗号相连
const join = sites.value.map((d) => d.id).join(','); const join = sites.value.map((d) => d.id).join(",");
const formData = { const formData = {
...form, ...form,
sid: join sid: join
}; };
if (formData.mode === 1 && !formData.expiredTime) {
message.error("请选择过期时间");
return;
}
const saveOrUpdate = isUpdate.value ? updateThinkVip : addThinkVip; const saveOrUpdate = isUpdate.value ? updateThinkVip : addThinkVip;
saveOrUpdate(formData) saveOrUpdate(formData)
.then((msg) => { .then((msg) => {
loading.value = false; loading.value = false;
message.success(msg); message.success(msg);
updateVisible(false); updateVisible(false);
emit('done'); emit("done");
}) })
.catch((e) => { .catch((e) => {
loading.value = false; loading.value = false;
message.error(e.message); message.error(e.message);
}); });
}) })
.catch(() => {}); .catch(() => {
});
}; };
watch( watch(
@@ -285,11 +312,11 @@
images.value.push({ images.value.push({
uid: uuid(), uid: uuid(),
url: props.data.image, url: props.data.image,
status: 'done' status: "done"
}); });
} }
if (props.data.sid) { if (props.data.sid) {
const split = props.data.sid.split(','); const split = props.data.sid.split(",");
split.map((id) => { split.map((id) => {
sites.value.push({ sites.value.push({
id: Number(id) id: Number(id)