feat:钱包、设备权限

This commit is contained in:
dzc committed 2025-01-19 11:54:56 +08:00
1 parent 611f1d634d
commit ef3dea40fa
19 files changed
+484 -361

No files matched your search

+4 -4
View File
@@ -10,15 +10,15 @@ ENV = 'development'
# ADMIN 服务地址
# VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # 线上
# VITE_ADMIN_PROXY_PATH = http://pjcloud.center.takin.cc/
# VITE_ADMIN_PROXY_PATH = http://localhost:9999/
VITE_ADMIN_PROXY_PATH = http://192.168.101.29:9999/ # 邓-本地
VITE_ADMIN_PROXY_PATH = http://localhost:9999
# VITE_ADMIN_PROXY_PATH = http://192.168.101.29:9999/ # 邓-本地
# VITE_ADMIN_PROXY_PATH = http://59.202.170.152:81/api # 正式环境
# 图片访问基础地址
# VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api # 线上
# VITE_IMAGE_BASE_PATH = http://pjcloud.center.takin.cc
# VITE_IMAGE_BASE_PATH = http://localhost:9999
VITE_IMAGE_BASE_PATH = http://192.168.101.29:9999 # 邓-本地
VITE_IMAGE_BASE_PATH = http://localhost:9999
# VITE_IMAGE_BASE_PATH = http://192.168.101.29:9999 # 邓-本地
# VITE_IMAGE_BASE_PATH = http://59.202.170.152:81/api/ # 正式环境
# 代码生成服务地址
+1 -1
View File
@@ -108,4 +108,4 @@
"type": "git",
"url": "https://gitee.com/log4j/pig"
}
}
}
+1 -1
View File
@@ -30,7 +30,7 @@ export type Props = {
placeholder?: string
}
const props = withDefaults(defineProps<Props>(), {
placeholder: "请选择",
placeholder: "输入姓名、手机号",
})
const queryForm = reactive<any>({
+6
View File
@@ -34,6 +34,11 @@
<div class="layout-padding-auto layout-padding-view">
<el-row v-show="showSearch">
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-form-item label="用户" prop="userIds">
<div style="width: 180px">
<select-user v-model="state.queryForm.userIds" clearable />
</div>
</el-form-item>
<el-form-item :label="$t('sysuser.username')" prop="username">
<el-input v-model="state.queryForm.username" :placeholder="$t('sysuser.inputUsernameTip')" clearable />
</el-form-item>
@@ -46,6 +51,7 @@
</el-form-item>
</el-form>
</el-row>
<el-row>
<div class="mb8" style="width: 100%">
<el-button v-auth="'sys_user_add'" icon="folder-add" type="primary" @click="userDialogRef.openDialog()">
+50 -43
View File
@@ -1,62 +1,69 @@
<template>
<el-dialog title="购物车" v-model="visible" :close-on-click-modal="false" draggable>
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle">
<el-table-column label="商品名" align="center" prop="productName" />
<el-table-column label="商品图片" align="center" prop="code">
<template #default="{ row }">
<preview-image v-if="row.productPic" :src="row.productPic" />
</template>
</el-table-column>
<el-table-column label="商品价格" align="center" prop="ticketId">
<template #default="{ row }">
<span>{{ displayPrice(row.productPrice) }}</span>
</template>
</el-table-column>
<el-table-column label="商品数量" align="center" prop="productCount" />
<el-table-column label="商品总额" align="center" prop="totalPrice">
<template #default="{ row }">
<span>{{ displayPrice(row.totalPrice) }}</span>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
</span>
</template>
</el-dialog>
<el-dialog title="购物车" v-model="visible" :close-on-click-modal="false" draggable>
<el-table
:data="state.dataList"
v-loading="state.loading"
border
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
@sort-change="sortChangeHandle"
>
<el-table-column label="商品名" align="center" prop="productName" />
<el-table-column label="商品图片" align="center" prop="code">
<template #default="{ row }">
<preview-image v-if="row.productPic" :src="row.productPic" />
</template>
</el-table-column>
<el-table-column label="商品价格" align="center" prop="ticketId">
<template #default="{ row }">
<span>{{ displayPrice(row.productPrice) }}</span>
</template>
</el-table-column>
<el-table-column label="商品数量" align="center" prop="productCount" />
<el-table-column label="商品总额" align="center" prop="totalPrice">
<template #default="{ row }">
<span>{{ displayPrice(row.totalPrice) }}</span>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="shop-car">
import { BasicTableProps, useTable } from "/@/hooks/table";
import * as hardCar from "/@/api/hard/hard-car";
import { BasicTableProps, useTable } from "/@/hooks/table"
import * as hardCar from "/@/api/hard/hard-car"
import { displayPrice } from "/@/utils/formatMoney"
// 定义变量内容
const visible = ref(false)
const state: BasicTableProps = reactive<BasicTableProps>({
createdIsNeed: false,
queryForm: {},
pageList: hardCar.getCarByOrderId
createdIsNeed: false,
queryForm: {},
pageList: hardCar.getCarByOrderId,
})
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
useTable(state)
// 打开弹窗
const openDialog = (id: string) => {
visible.value = true
if (id) {
state.queryForm.orderId = id
getDataList()
}
};
visible.value = true
if (id) {
state.queryForm.orderId = id
getDataList()
}
}
// 暴露变量
defineExpose({
openDialog
});
</script>
openDialog,
})
</script>
@@ -78,6 +78,7 @@
<el-descriptions-item
:column="1"
v-if="globalData.type == 'apply' && globalData.afterSaleData.status == 10"
v-auth="'hard_hardAfterSale_change'"
label="操作: "
label-class-name="no-colon"
>
@@ -1,70 +1,70 @@
<template>
<el-dialog title="拒绝售后" v-model="visible" width="45%" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" label-width="80px" :rules="dataRules" v-loading="loading">
<el-form-item label="审批备注" prop="auditReason">
<el-input v-model="form.auditReason" :rows="3" placeholder="请输入审批备注" type="textarea" />
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" @click="onSubmit">确 定</el-button>
<el-button @click="visible = false">取 消</el-button>
</template>
</el-dialog>
<el-dialog title="拒绝售后" v-model="visible" width="45%" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" label-width="80px" :rules="dataRules" v-loading="loading">
<el-form-item label="审批备注" prop="auditReason">
<el-input v-model="form.auditReason" :rows="3" placeholder="请输入审批备注" type="textarea" />
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" @click="onSubmit">确 定</el-button>
<el-button @click="visible = false">取 消</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="refund-reject">
import { useMessage } from "/@/hooks/message";
import * as hardAfterSaleApi from '/@/api/hard/hard-after-sale'
import { useMessage } from "/@/hooks/message"
import * as hardAfterSaleApi from "/@/api/hard/hard-after-sale"
const emit = defineEmits(['refresh']);
const emit = defineEmits(["refresh"])
// 定义变量内容
const dataFormRef = ref();
const dataFormRef = ref()
const visible = ref(false)
const loading = ref(false)
const form = reactive<any>({
id: undefined,
auditReason: "",
id: undefined,
auditReason: "",
})
// 定义校验规则
const dataRules = ref({
auditReason: [{ required: true, message: '请输入拒绝原因', trigger: 'blur' }],
auditReason: [{ required: true, message: "请输入拒绝原因", trigger: "blur" }],
})
// 打开弹窗
const openDialog = async (id: string) => {
visible.value = true
form.id = ''
if (!id) return
nextTick(() => {
dataFormRef.value?.resetFields();
});
form.id = id
const { data } = await hardAfterSaleApi.detailByOrderId({ orderId: id })
Object.assign(form, data)
};
visible.value = true
form.id = ""
if (!id) return
nextTick(() => {
dataFormRef.value?.resetFields()
})
form.id = id
const { data } = await hardAfterSaleApi.detailByOrderId({ orderId: id })
Object.assign(form, data)
}
// 提交
const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => { });
if (!valid) return false;
try {
loading.value = true;
await hardAfterSaleApi.disagree(form);
useMessage().success(form.id ? '修改成功' : '添加成功');
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};
const valid = await dataFormRef.value.validate().catch(() => {})
if (!valid) return false
try {
loading.value = true
await hardAfterSaleApi.disagree(form)
useMessage().success(form.id ? "修改成功" : "添加成功")
visible.value = false
emit("refresh")
} catch (err: any) {
useMessage().error(err.msg)
} finally {
loading.value = false
}
}
// 暴露变量
defineExpose({
openDialog
});
</script>
openDialog,
})
</script>
+1 -1
View File
@@ -57,7 +57,7 @@
<el-table-column type="index" label="#" width="40" />
<el-table-column prop="id" label="编号" />
<el-table-column prop="name" label="分组名" />
<el-table-column v-if="false" prop="deptName" label="部门" />
<el-table-column prop="deptName" label="部门" />
<el-table-column label="操作" width="150">
<template #default="scope">
<el-button
+24 -12
View File
@@ -4,13 +4,8 @@
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-row :gutter="24">
<el-col :span="4">
<el-form-item class="w100" label="设备名" prop="name">
<el-input v-model="state.queryForm.name" placeholder="设备名" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item class="w100" label="设备类型" prop="type">
<dict-select v-model="state.queryForm.type" dict-code="hard_type" />
<el-form-item class="w100" label="用户" prop="userIdChild">
<select-user v-model="state.queryForm.userIdChild" />
</el-form-item>
</el-col>
<el-col :span="4">
@@ -18,6 +13,16 @@
<select-mch v-model="state.queryForm.merchantIds" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item class="w100" label="设备类型" prop="hardType">
<dict-select v-model="state.queryForm.hardType" dict-code="hard_type" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item class="w100" label="打印时间" prop="createTimeList">
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD" type="daterange" />
</el-form-item>
</el-col>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
@@ -34,8 +39,18 @@
@sort-change="sortChangeHandle"
>
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="40" />
<el-table-column label="部门" prop="deptName" />
<el-table-column type="index" label="#" width="60" />
<el-table-column width="200" label="用户">
<template #default="{ row }">
<div class="flex flex-row items-center justify-center">
<preview-image width="50px" height="50px" :src="row.userAvatar" />
<div class="flex flex-col ml-2 items-start cursor-pointer hover:underline hover:text-blue-500">
<span> {{ row.username }}</span>
<span> {{ row.userMobile }}</span>
</div>
</div>
</template>
</el-table-column>
<el-table-column width="250px" label="设备信息">
<template #default="{ row }">
<div class="status">
@@ -184,17 +199,14 @@ const handleDelete = async (ids: string[]) => {
display: flex;
align-items: center;
margin-bottom: 2px;
span {
display: inline-block;
}
span:nth-child(1) {
min-width: 60px;
max-width: 100px;
text-align: left;
}
span:nth-child(2) {
flex: 1;
min-width: 50px;
+22 -4
View File
@@ -103,15 +103,33 @@
@click="formDialogRef.openDialog(row.id)"
>编辑</el-button
>
<el-button icon="TrendCharts" link type="primary" @click="mqformDialogRef.openDialog(row.id)">
<el-button
icon="TrendCharts"
link
type="primary"
v-auth="'hard_hardManager_edit'"
@click="mqformDialogRef.openDialog(row.id)"
>
mq设置
</el-button>
<el-button icon="SetUp" link type="primary" @click="faceFormDialogRef.openDialog(row.id)">
<el-button
icon="SetUp"
link
type="primary"
v-auth="'hard_hardManager_edit'"
@click="faceFormDialogRef.openDialog(row.id)"
>
人脸sdk设置
</el-button>
<el-button icon="delete" text type="primary" v-auth="'hard_hardManager_del'" @click="handleDelete([row.id])"
>删除</el-button
<el-button
icon="delete"
text
type="primary"
v-auth="'hard_hardManager_del'"
@click="handleDelete([row.id])"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
+40 -11
View File
@@ -13,7 +13,12 @@
<select-mch v-model="state.queryForm.mchIds" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-col :span="4">
<el-form-item class="w100" label="用户部门" prop="deptIdIdDeepen">
<select-dept v-model="state.queryForm.deptIdIdDeepen" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item class="w100" label="创建时间" prop="payTimeList">
<el-date-picker v-model="state.queryForm.payTimeList" value-format="YYYY-MM-DD" type="daterange" />
</el-form-item>
@@ -42,13 +47,17 @@
>
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="50" />
<el-table-column prop="username" width="100" label="用户" />
<el-table-column prop="userAvatar" width="100" label="头像">
<el-table-column width="200" label="用户">
<template #default="{ row }">
<preview-image :src="row.userAvatar" />
<div class="flex flex-row items-center justify-center">
<preview-image width="50px" height="50px" :src="row.userAvatar" />
<div class="flex flex-col ml-2 items-start cursor-pointer hover:underline hover:text-blue-500">
<span> {{ row.username }}</span>
<span> {{ row.userMobile }}</span>
</div>
</div>
</template>
</el-table-column>
<el-table-column prop="userMobile" width="120" label="手机号" />
<el-table-column width="200px" label="商品简要信息">
<template #default="{ row }">
<div class="desc">
@@ -167,13 +176,30 @@
</div>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="250">
<el-table-column fixed="right" label="操作" width="200">
<template #default="{ row }">
<el-button icon="Printer" text type="primary" @click="print(row)"> 打印发票 </el-button>
<el-button icon="ShoppingCartFull" text type="primary" @click="shopCarDialogRef.openDialog(row.id)">
购物车
</el-button>
<el-button icon="InfoFilled" link type="primary" @click="doRefund(row)"> 详情 </el-button>
<div class="flex justify-between">
<el-button icon="Printer" text type="primary" @click="print(row)" v-auth="'hard_hardInvoice_admin_print'">
打印发票
</el-button>
<el-button icon="ShoppingCartFull" text type="primary" @click="shopCarDialogRef.openDialog(row.id)">
购物车
</el-button>
</div>
<div class="flex justify-between">
<el-button icon="Money" link type="primary" @click="transactionListRef.openDialog(row.walletId)">
钱包明细
</el-button>
<el-button
icon="InfoFilled"
link
type="primary"
v-auth="'wallet_walletTransaction_update_balance'"
@click="doRefund(row)"
>
订单详情
</el-button>
</div>
<el-button
v-if="false"
icon="edit-pen"
@@ -198,6 +224,7 @@
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
</div>
<!-- 编辑、新增 -->
<transaction-list ref="transactionListRef" @refresh="getDataList(false)" />
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
<shop-car ref="shopCarDialogRef" />
</div>
@@ -218,6 +245,7 @@ const { push } = useRouter()
// 引入组件
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
const ShopCar = defineAsyncComponent(() => import("../components/shop-car.vue"))
const TransactionList = defineAsyncComponent(() => import("/@/views/wallet/components/transaction-list.vue"))
// 定义查询字典
const { hard_pay_type, hard_order_type, hard_order_status, hard_type, hard_refund_status, daily_menu } = useDict(
"hard_pay_type",
@@ -230,6 +258,7 @@ const { hard_pay_type, hard_order_type, hard_order_status, hard_type, hard_refun
// 定义变量内容
const formDialogRef = ref()
const shopCarDialogRef = ref()
const transactionListRef = ref()
const tabList = ref<any>([{}])
const activeName = ref(null)
// 搜索变量
+2 -2
View File
@@ -107,7 +107,7 @@
icon="Money"
text
type="primary"
v-auth="'wallet_walletManage_edit'"
v-auth="'wallet_walletTransaction_update_balance'"
@click="changeBalanceRef.openDialog(row.userId, row.id)"
>充值/扣款</el-button
>
@@ -129,7 +129,7 @@ import { useDict } from "/@/hooks/dict"
import { displayPrice } from "/@/utils/formatMoney"
// 引入组件
const TransactionList = defineAsyncComponent(() => import("./transaction-list.vue"))
const TransactionList = defineAsyncComponent(() => import("../components/transaction-list.vue"))
const ChangeBalance = defineAsyncComponent(() => import("./change-balance.vue"))
// 定义查询字典
const { wallet_type, yes_no_type } = useDict("wallet_type", "yes_no_type")
@@ -100,7 +100,7 @@
icon="Connection"
text
type="primary"
v-auth="'wallet_walletRechargeApply_edit'"
v-auth="'wallet_walletRechargeApply_apply'"
@click="doApply(row)"
>申请</el-button
>
@@ -1,91 +1,107 @@
<template>
<div class="w100">
<div class="layout-padding-auto layout-padding-view">
<div class="flex justify-center flex-col">
<div>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="180px"
v-loading="loading">
<el-row :gutter="24">
<el-col :span="24" class="mb20">
<el-form-item label="钱包二维码自动刷新" prop="refreshQrCodeEnable">
<el-switch active-value="1" inactive-value="0" v-model="form.refreshQrCodeEnable"
active-text="开启" inactive-text="关闭" inline-prompt />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="钱包二维码自动刷新间隔" prop="refreshQrCodeFre">
<el-input style="width: 300px;" type="number" v-model="form.refreshQrCodeFre"
placeholder="请输入钱包二维码自动刷新间隔">
<template #append>秒</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
<div class="flex items-center">
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
</div>
</div>
</div>
<div class="w100">
<div class="layout-padding-auto layout-padding-view">
<div class="flex justify-center flex-col">
<div>
<el-form
ref="dataFormRef"
:model="form"
:rules="dataRules"
formDialogRef
label-width="180px"
v-loading="loading"
>
<el-row :gutter="24">
<el-col :span="24" class="mb20">
<el-form-item label="钱包二维码自动刷新" prop="refreshQrCodeEnable">
<el-switch
active-value="1"
inactive-value="0"
v-model="form.refreshQrCodeEnable"
active-text="开启"
inactive-text="关闭"
inline-prompt
/>
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="钱包二维码自动刷新间隔" prop="refreshQrCodeFre">
<el-input
style="width: 300px"
type="number"
v-model="form.refreshQrCodeFre"
placeholder="请输入钱包二维码自动刷新间隔"
>
<template #append>秒</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
<div class="flex items-center" v-auth="'wallet_setting_edit'">
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
</div>
</div>
</div>
</template>
<script setup lang="ts" name="code">
import { useDict } from '/@/hooks/dict'
import { useDict } from "/@/hooks/dict"
import { storePrice } from "/@/utils/formatMoney"
import { useMessage } from "/@/hooks/message"
import { getObj, putObj } from "/@/api/wallet/wallet-setting"
// 定义变量内容
const dataFormRef = ref();
const dataFormRef = ref()
const loading = ref(false)
// 提交表单数据
const form = reactive({
id: undefined,
refreshQrCodeEnable: undefined,
refreshQrCodeFre: undefined,
});
id: undefined,
refreshQrCodeEnable: undefined,
refreshQrCodeFre: undefined,
})
// 定义校验规则
const dataRules = ref({
refreshQrCodeEnable: [{ required: true, message: '是否开启钱包二维码自动刷新', trigger: 'change' }],
refreshQrCodeFre: [{ required: true, message: '钱包二维码自动刷新间隔', trigger: 'blur' }],
refreshQrCodeEnable: [{ required: true, message: "是否开启钱包二维码自动刷新", trigger: "change" }],
refreshQrCodeFre: [{ required: true, message: "钱包二维码自动刷新间隔", trigger: "blur" }],
})
onMounted(() => {
getwalletRechargePackageData('1')
getwalletRechargePackageData("1")
})
// 提交
const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => { });
if (!valid) return false;
try {
loading.value = true;
const pa = {
...form,
payPrice: storePrice(form.payPrice),
bonusPrice: storePrice(form.bonusPrice),
}
await putObj(pa)
useMessage().success('修改成功');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};
const valid = await dataFormRef.value.validate().catch(() => {})
if (!valid) return false
try {
loading.value = true
const pa = {
...form,
payPrice: storePrice(form.payPrice),
bonusPrice: storePrice(form.bonusPrice),
}
await putObj(pa)
useMessage().success("修改成功")
} catch (err: any) {
useMessage().error(err.msg)
} finally {
loading.value = false
}
}
// 初始化表单数据
const getwalletRechargePackageData = (id: string) => {
// 获取数据
loading.value = true
getObj(id).then((res: any) => {
Object.assign(form, res.data)
}).finally(() => {
loading.value = false
})
};
</script>
// 获取数据
loading.value = true
getObj(id)
.then((res: any) => {
Object.assign(form, res.data)
})
.finally(() => {
loading.value = false
})
}
</script>
@@ -50,7 +50,7 @@
</el-col>
</el-row>
</el-form>
<div class="flex items-center">
<div class="flex items-center" v-auth="'wallet_setting_edit'">
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
</div>
</div>
@@ -1,80 +1,91 @@
<template>
<div class="w100">
<div class="layout-padding-auto layout-padding-view">
<div class="flex justify-center flex-col">
<div>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="180px"
v-loading="loading">
<el-row :gutter="24">
<el-col :span="24" class="mb20">
<el-form-item label="离线订单是否需要审批" prop="offLineOrderApplyEnable">
<el-switch active-value="1" inactive-value="0"
v-model="form.offLineOrderApplyEnable" active-text="开启" inactive-text="关闭"
inline-prompt />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="flex items-center">
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
</div>
</div>
</div>
</div>
<div class="w100">
<div class="layout-padding-auto layout-padding-view">
<div class="flex justify-center flex-col">
<div>
<el-form
ref="dataFormRef"
:model="form"
:rules="dataRules"
formDialogRef
label-width="180px"
v-loading="loading"
>
<el-row :gutter="24">
<el-col :span="24" class="mb20">
<el-form-item label="离线订单是否需要审批" prop="offLineOrderApplyEnable">
<el-switch
active-value="1"
inactive-value="0"
v-model="form.offLineOrderApplyEnable"
active-text="开启"
inactive-text="关闭"
inline-prompt
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="flex items-center" v-auth="'wallet_setting_edit'">
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts" name="code">
import { useDict } from '/@/hooks/dict'
import { useDict } from "/@/hooks/dict"
import { storePrice } from "/@/utils/formatMoney"
import { useMessage } from "/@/hooks/message"
import { getObj, putObj } from "/@/api/wallet/wallet-setting"
// 定义变量内容
const dataFormRef = ref();
const dataFormRef = ref()
const loading = ref(false)
// 提交表单数据
const form = reactive({
id: '',
offLineOrderApplyEnable: '',
});
id: "",
offLineOrderApplyEnable: "",
})
// 定义校验规则
const dataRules = ref({
offLineOrderApplyEnable: [{ required: true, message: '离线订单是否需要审批', trigger: 'change' }],
offLineOrderApplyEnable: [{ required: true, message: "离线订单是否需要审批", trigger: "change" }],
})
onMounted(() => {
getwalletRechargePackageData('1')
getwalletRechargePackageData("1")
})
// 提交
const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => { });
if (!valid) return false;
try {
loading.value = true;
const pa = {
...form,
}
await putObj(pa)
useMessage().success('修改成功');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};
const valid = await dataFormRef.value.validate().catch(() => {})
if (!valid) return false
try {
loading.value = true
const pa = {
...form,
}
await putObj(pa)
useMessage().success("修改成功")
} catch (err: any) {
useMessage().error(err.msg)
} finally {
loading.value = false
}
}
// 初始化表单数据
const getwalletRechargePackageData = (id: string) => {
// 获取数据
loading.value = true
getObj(id).then((res: any) => {
Object.assign(form, res.data)
}).finally(() => {
loading.value = false
})
};
</script>
// 获取数据
loading.value = true
getObj(id)
.then((res: any) => {
Object.assign(form, res.data)
})
.finally(() => {
loading.value = false
})
}
</script>
@@ -1,38 +1,64 @@
<template>
<div class="w100">
<div class="layout-padding-auto layout-padding-view">
<div class="flex justify-center flex-col">
<div>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px"
v-loading="loading">
<el-row :gutter="24">
<el-col :span="24" class="mb20">
<el-form-item label="退款理由" prop="afterSaleRefundReasons">
<el-select style="width: 500px;" v-model="form.afterSaleRefundReasons" allow-create
filterable multiple placeholder="请输入退款理由">
<el-option v-for="reason in form.afterSaleRefundReasons" :key="reason"
:label="reason" :value="reason" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="退货理由" prop="afterSaleReturnReasons">
<el-select style="width: 500px;" v-model="form.afterSaleReturnReasons" allow-create
filterable multiple placeholder="请输入退货理由">
<el-option v-for="reason in form.afterSaleReturnReasons" :key="reason"
:label="reason" :value="reason" />
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="flex items-center">
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
</div>
</div>
</div>
</div>
</div>
<div class="w100">
<div class="layout-padding-auto layout-padding-view">
<div class="flex justify-center flex-col">
<div>
<el-form
ref="dataFormRef"
:model="form"
:rules="dataRules"
formDialogRef
label-width="90px"
v-loading="loading"
>
<el-row :gutter="24">
<el-col :span="24" class="mb20">
<el-form-item label="退款理由" prop="afterSaleRefundReasons">
<el-select
style="width: 500px"
v-model="form.afterSaleRefundReasons"
allow-create
filterable
multiple
placeholder="请输入退款理由"
>
<el-option
v-for="reason in form.afterSaleRefundReasons"
:key="reason"
:label="reason"
:value="reason"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="退货理由" prop="afterSaleReturnReasons">
<el-select
style="width: 500px"
v-model="form.afterSaleReturnReasons"
allow-create
filterable
multiple
placeholder="请输入退货理由"
>
<el-option
v-for="reason in form.afterSaleReturnReasons"
:key="reason"
:label="reason"
:value="reason"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="flex items-center" v-auth="'wallet_setting_edit'">
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts" name="refund">
@@ -40,61 +66,61 @@ import { storePrice } from "/@/utils/formatMoney"
import { useMessage } from "/@/hooks/message"
import { getObj, putObj } from "/@/api/wallet/wallet-setting"
// 定义变量内容
const dataFormRef = ref();
const dataFormRef = ref()
const loading = ref(false)
// 提交表单数据
const form = reactive<any>({
id: undefined,
afterSaleRefundReasons: undefined,
afterSaleReturnReasons: undefined,
});
id: undefined,
afterSaleRefundReasons: undefined,
afterSaleReturnReasons: undefined,
})
// 定义校验规则
const dataRules = ref({
afterSaleRefundReasons: [{ required: true, message: '请输入退款理由', trigger: 'blur' }],
afterSaleReturnReasons: [{ required: true, message: '请输入退货理由', trigger: 'blur' }],
afterSaleRefundReasons: [{ required: true, message: "请输入退款理由", trigger: "blur" }],
afterSaleReturnReasons: [{ required: true, message: "请输入退货理由", trigger: "blur" }],
})
onMounted(() => {
getwalletRechargePackageData('1')
getwalletRechargePackageData("1")
})
// 提交
const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => { });
if (!valid) return false;
try {
loading.value = true;
const pa = {
...form,
afterSaleRefundReasons: form.afterSaleRefundReasons?.join(","),
afterSaleReturnReasons: form.afterSaleReturnReasons?.join(",")
}
await putObj(pa)
useMessage().success('修改成功');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};
const valid = await dataFormRef.value.validate().catch(() => {})
if (!valid) return false
try {
loading.value = true
const pa = {
...form,
afterSaleRefundReasons: form.afterSaleRefundReasons?.join(","),
afterSaleReturnReasons: form.afterSaleReturnReasons?.join(","),
}
await putObj(pa)
useMessage().success("修改成功")
} catch (err: any) {
useMessage().error(err.msg)
} finally {
loading.value = false
}
}
// 初始化表单数据
const getwalletRechargePackageData = (id: string) => {
// 获取数据
loading.value = true
getObj(id).then((res: any) => {
const data: any = res.data;
if (data.afterSaleRefundReasons) {
data.afterSaleRefundReasons = data.afterSaleRefundReasons?.split(",")
}
if (data.afterSaleReturnReasons) {
data.afterSaleReturnReasons = data.afterSaleReturnReasons?.split(",")
}
Object.assign(form, data)
}).finally(() => {
loading.value = false
})
};
</script>
// 获取数据
loading.value = true
getObj(id)
.then((res: any) => {
const data: any = res.data
if (data.afterSaleRefundReasons) {
data.afterSaleRefundReasons = data.afterSaleRefundReasons?.split(",")
}
if (data.afterSaleReturnReasons) {
data.afterSaleReturnReasons = data.afterSaleReturnReasons?.split(",")
}
Object.assign(form, data)
})
.finally(() => {
loading.value = false
})
}
</script>
+32 -35
View File
@@ -1,45 +1,42 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<div v-for="(v) in data.tabList" :key="v.id">
<el-tab-pane :label="v.label" :name="v.id">
<div></div>
</el-tab-pane>
</div>
</el-tabs>
<div class="flex justify-center">
<recharge-package v-if="activeName == 10" />
<extra-price v-if="activeName == 20" />
<refund v-if="activeName == 30" />
<Code v-if="activeName == 40" />
<off-line v-if="activeName == 50" />
</div>
</div>
</div>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<div v-for="v in data.tabList" :key="v.id">
<el-tab-pane :label="v.label" :name="v.id">
<div></div>
</el-tab-pane>
</div>
</el-tabs>
<div class="flex justify-center">
<recharge-package v-if="activeName == 10" />
<extra-price v-if="activeName == 20" />
<refund v-if="activeName == 30" />
<Code v-if="activeName == 40" />
<off-line v-if="activeName == 50" />
</div>
</div>
</div>
</template>
<script setup lang="ts">
const RechargePackage = defineAsyncComponent(() => import('./components/recharge-package/index.vue'));
const Code = defineAsyncComponent(() => import('./components/code/index.vue'));
const Refund = defineAsyncComponent(() => import('./components/refund/index.vue'));
const OffLine = defineAsyncComponent(() => import('./components/off-line/index.vue'));
const ExtraPrice = defineAsyncComponent(() => import('./components/extra-price/index.vue'));
const RechargePackage = defineAsyncComponent(() => import("./components/recharge-package/index.vue"))
const Code = defineAsyncComponent(() => import("./components/code/index.vue"))
const Refund = defineAsyncComponent(() => import("./components/refund/index.vue"))
const OffLine = defineAsyncComponent(() => import("./components/off-line/index.vue"))
const ExtraPrice = defineAsyncComponent(() => import("./components/extra-price/index.vue"))
const data = {
tabList: [
{ id: 10, label: "充值套餐" },
{ id: 20, label: "每餐额定金额配置" },
{ id: 30, label: "退款配置" },
{ id: 40, label: "二维码配置" },
{ id: 50, label: "离线配置" },
]
tabList: [
{ id: 10, label: "充值套餐" },
{ id: 20, label: "每餐额定金额配置" },
{ id: 30, label: "退款配置" },
{ id: 40, label: "二维码配置" },
{ id: 50, label: "离线配置" },
],
}
const activeName = ref(data.tabList[0].id)
const handleClick = (e: any) => {
}
</script>
const handleClick = (e: any) => {}
</script>