88 lines
2.2 KiB
Vue
88 lines
2.2 KiB
Vue
<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
|
|
:disabled="!auth('wallet_setting_edit')"
|
|
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 { storePrice } from "/@/utils/formatMoney"
|
|
import { useMessage } from "/@/hooks/message"
|
|
import { getObj, putObj } from "/@/api/wallet/wallet-setting"
|
|
import { auth } from "/@/utils/authFunction"
|
|
|
|
// 定义变量内容
|
|
const dataFormRef = ref()
|
|
const loading = ref(false)
|
|
// 提交表单数据
|
|
const form = reactive({
|
|
id: "",
|
|
offLineOrderApplyEnable: "",
|
|
})
|
|
// 定义校验规则
|
|
const dataRules = ref({
|
|
offLineOrderApplyEnable: [{ required: true, message: "离线订单是否需要审批", trigger: "change" }],
|
|
})
|
|
|
|
onMounted(() => {
|
|
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 getwalletRechargePackageData = (id: string) => {
|
|
// 获取数据
|
|
loading.value = true
|
|
getObj(id)
|
|
.then((res: any) => {
|
|
Object.assign(form, res.data)
|
|
})
|
|
.finally(() => {
|
|
loading.value = false
|
|
})
|
|
}
|
|
</script>
|