feat:商户规则绑定
This commit is contained in:
1 parent
1f08b2eb8f
commit
d8cf18efb7
7 files changed
+71
-48
No files matched your search
@@ -7,6 +7,7 @@
|
|||||||
remote-show-suffix
|
remote-show-suffix
|
||||||
filterable
|
filterable
|
||||||
remote
|
remote
|
||||||
|
:disabled="props.disabled"
|
||||||
:remote-method="remoteSearch"
|
:remote-method="remoteSearch"
|
||||||
:loading="state.loading"
|
:loading="state.loading"
|
||||||
@visible-change="(e: boolean) => e && getOptions()"
|
@visible-change="(e: boolean) => e && getOptions()"
|
||||||
@@ -34,10 +35,12 @@ const props = withDefaults(
|
|||||||
defineProps<{
|
defineProps<{
|
||||||
placeholder?: string
|
placeholder?: string
|
||||||
apiParams?: any
|
apiParams?: any
|
||||||
|
disabled?: boolean
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
placeholder: "请选择",
|
placeholder: "请选择",
|
||||||
apiParams: {},
|
apiParams: {},
|
||||||
|
disabled: false,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
:loading="state.loading"
|
:loading="state.loading"
|
||||||
@visible-change="(e: boolean) => e && getOptions()"
|
@visible-change="(e: boolean) => e && getOptions()"
|
||||||
>
|
>
|
||||||
<el-option v-for="v in state.options" :key="v.id" :label="getDictById(v.rulePriceType, v)" :value="v.rulePriceType">
|
<el-option v-for="v in state.options" :key="v.id" :label="getDictById(v.rulePriceType, v)" :value="v.id">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<div class="flex items-center ml5">
|
<div class="flex items-center ml5">
|
||||||
<dict-tag :options="state.walletRulePriceType" :value="v.rulePriceType" />
|
<dict-tag :options="state.walletRulePriceType" :value="v.rulePriceType" />
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24" class="mb20">
|
<el-col :span="24" class="mb20">
|
||||||
<el-form-item label="源商户" prop="sourceMchId">
|
<el-form-item label="源商户" prop="sourceMchId">
|
||||||
<select-mch v-model="form.sourceMchId" :apiParams="{ types: '1' }" />
|
<select-mch disabled v-model="form.sourceMchId" :apiParams="{ types: '1' }" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24" class="mb20">
|
<el-col :span="24" class="mb20">
|
||||||
@@ -19,10 +19,13 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24" class="mb20">
|
<el-col :span="24" class="mb20">
|
||||||
<el-alert title="提示" type="info" :closable="false">
|
<el-alert title="提示" type="info" :closable="false">
|
||||||
<span class="color-primary">老县府</span>
|
<span class="color-primary">{{ form.sourceMchName ? form.sourceMchName : "???" }}</span>
|
||||||
<span>到</span>
|
<span>到</span>
|
||||||
<span class="color-primary">新县府</span>
|
<span class="color-primary">{{ form.targetMchName ? form.targetMchName : "???" }}</span>
|
||||||
<span>消费</span>
|
<span>消费,超过</span>
|
||||||
|
<span class="color-success">{{ form.basePrice ? displayPrice(form.basePrice) : "???" }}</span>
|
||||||
|
<span>额外支付</span>
|
||||||
|
<span class="color-danger">{{ form.multiple ? form.multiple : "???" }}%</span>
|
||||||
</el-alert>
|
</el-alert>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -37,10 +40,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="WalletRuleMchConfigFormDialog">
|
<script setup lang="ts" name="WalletRuleMchConfigFormDialog">
|
||||||
import { useDict } from "/@/hooks/dict"
|
|
||||||
import { useMessage } from "/@/hooks/message"
|
import { useMessage } from "/@/hooks/message"
|
||||||
import * as walletRuleMchConfigApi from "/@/api/wallet/mch-rule-join"
|
import * as walletRuleMchConfigApi from "/@/api/wallet/mch-rule-join"
|
||||||
import { rule } from "/@/utils/validate"
|
import { displayPrice } from "/@/utils/formatMoney"
|
||||||
|
|
||||||
const emit = defineEmits(["refresh"])
|
const emit = defineEmits(["refresh"])
|
||||||
|
|
||||||
// 定义变量内容
|
// 定义变量内容
|
||||||
@@ -50,23 +53,20 @@ const loading = ref(false)
|
|||||||
// 定义字典
|
// 定义字典
|
||||||
|
|
||||||
// 提交表单数据
|
// 提交表单数据
|
||||||
const form = reactive({
|
const defaultForm = {
|
||||||
id: "",
|
id: "",
|
||||||
sourceMchId: "",
|
sourceMchId: "",
|
||||||
targetMchId: "",
|
targetMchId: "",
|
||||||
targetDeptId: "",
|
targetDeptId: "",
|
||||||
rulePriceConfigId: "",
|
rulePriceConfigId: "",
|
||||||
})
|
|
||||||
|
|
||||||
const detail = reactive({
|
|
||||||
id: "",
|
|
||||||
sourceMchId: "",
|
|
||||||
tragetDeptId: "",
|
|
||||||
rulePriceConfigId: "",
|
|
||||||
basePrice: "",
|
|
||||||
multiple: "",
|
|
||||||
sourceMchName: "",
|
sourceMchName: "",
|
||||||
targetMchName: "",
|
targetMchName: "",
|
||||||
|
basePrice: "",
|
||||||
|
multiple: "",
|
||||||
|
}
|
||||||
|
|
||||||
|
const form = reactive({
|
||||||
|
...defaultForm,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 定义校验规则
|
// 定义校验规则
|
||||||
@@ -77,10 +77,12 @@ const dataRules = ref({
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = (id: string) => {
|
const openDialog = (id: string, sourceMchId: string) => {
|
||||||
visible.value = true
|
visible.value = true
|
||||||
form.id = ""
|
Object.assign(form, defaultForm)
|
||||||
|
if (sourceMchId) {
|
||||||
|
form.sourceMchId = sourceMchId
|
||||||
|
}
|
||||||
// 重置表单数据
|
// 重置表单数据
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
dataFormRef.value?.resetFields()
|
dataFormRef.value?.resetFields()
|
||||||
@@ -104,7 +106,6 @@ const onSubmit = async () => {
|
|||||||
// visible.value = false
|
// visible.value = false
|
||||||
// 更新
|
// 更新
|
||||||
await getwalletRuleMchConfigData(data)
|
await getwalletRuleMchConfigData(data)
|
||||||
await getDetails(data)
|
|
||||||
emit("refresh")
|
emit("refresh")
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
useMessage().error(err.msg)
|
useMessage().error(err.msg)
|
||||||
@@ -118,7 +119,7 @@ const getwalletRuleMchConfigData = async (id: string) => {
|
|||||||
// 获取数据
|
// 获取数据
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const { data } = await walletRuleMchConfigApi.getObj(id)
|
const { data } = await walletRuleMchConfigApi.getJoinDetail(id)
|
||||||
Object.assign(form, data)
|
Object.assign(form, data)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
@@ -127,15 +128,6 @@ const getwalletRuleMchConfigData = async (id: string) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDetails = async (id: any) => {
|
|
||||||
try {
|
|
||||||
const { data } = await walletRuleMchConfigApi.getJoinDetail(id)
|
|
||||||
Object.assign(detail, data)
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 暴露变量
|
// 暴露变量
|
||||||
defineExpose({
|
defineExpose({
|
||||||
openDialog,
|
openDialog,
|
||||||
|
|||||||
@@ -2,15 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-row>
|
<el-row>
|
||||||
<div class="mb8" style="width: 100%">
|
<div class="mb8" style="width: 100%">
|
||||||
<el-button
|
<el-button icon="folder-add" type="primary" class="ml10" @click="doAdd" v-auth="'dzc_walletRuleMchConfig_add'"> 新 增 </el-button>
|
||||||
icon="folder-add"
|
|
||||||
type="primary"
|
|
||||||
class="ml10"
|
|
||||||
@click="WalletRuleMchConfigFormDialogRef.openDialog()"
|
|
||||||
v-auth="'dzc_walletRuleMchConfig_add'"
|
|
||||||
>
|
|
||||||
新 增
|
|
||||||
</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-table
|
<el-table
|
||||||
@@ -24,8 +16,8 @@
|
|||||||
>
|
>
|
||||||
<el-table-column type="selection" width="40" align="center" />
|
<el-table-column type="selection" width="40" align="center" />
|
||||||
<el-table-column type="index" label="#" width="80" />
|
<el-table-column type="index" label="#" width="80" />
|
||||||
<el-table-column prop="sourceMchId" label="源商户" />
|
<el-table-column prop="sourceMchName" label="源商户" />
|
||||||
<el-table-column prop="tragetDeptId" label="目标部门" />
|
<el-table-column prop="targetMchName" label="目标商户" />
|
||||||
<el-table-column prop="rulePriceConfigId" label="规则名">
|
<el-table-column prop="rulePriceConfigId" label="规则名">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<dict-tag :options="wallet_rule_price_type" :value="row.rulePriceType" />
|
<dict-tag :options="wallet_rule_price_type" :value="row.rulePriceType" />
|
||||||
@@ -41,6 +33,17 @@
|
|||||||
<span class="color-primary">{{ row.multiple }}%</span>
|
<span class="color-primary">{{ row.multiple }}%</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column min-width="300" label="描述">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span class="color-primary">{{ row.sourceMchName ? row.sourceMchName : "???" }}</span>
|
||||||
|
<span>到</span>
|
||||||
|
<span class="color-primary">{{ row.targetMchName ? row.targetMchName : "???" }}</span>
|
||||||
|
<span>消费,超过</span>
|
||||||
|
<span class="color-success">{{ row.basePrice ? displayPrice(row.basePrice) : "???" }}</span>
|
||||||
|
<span>额外支付</span>
|
||||||
|
<span class="color-danger">{{ row.multiple ? row.multiple : "???" }}%</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="150">
|
<el-table-column label="操作" width="150">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button
|
<el-button
|
||||||
@@ -58,7 +61,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||||
<wallet-rule-mch-config-form-dialog ref="WalletRuleMchConfigFormDialogRef" />
|
<wallet-rule-mch-config-form-dialog ref="WalletRuleMchConfigFormDialogRef" @refresh="getDataList(false)" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -71,6 +74,13 @@ import { displayPrice } from "/@/utils/formatMoney"
|
|||||||
|
|
||||||
const WalletRuleMchConfigFormDialog = defineAsyncComponent(() => import("./mch-rule-config-form.vue"))
|
const WalletRuleMchConfigFormDialog = defineAsyncComponent(() => import("./mch-rule-config-form.vue"))
|
||||||
|
|
||||||
|
export type Props = {
|
||||||
|
sourceMchId?: string
|
||||||
|
}
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
sourceMchId: "",
|
||||||
|
})
|
||||||
|
|
||||||
// 多选变量
|
// 多选变量
|
||||||
const selectObjs = ref([]) as any
|
const selectObjs = ref([]) as any
|
||||||
const multiple = ref(true)
|
const multiple = ref(true)
|
||||||
@@ -82,6 +92,7 @@ const WalletRuleMchConfigFormDialogRef = ref()
|
|||||||
const { wallet_rule_price_type } = useDict("wallet_rule_price_type")
|
const { wallet_rule_price_type } = useDict("wallet_rule_price_type")
|
||||||
|
|
||||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
|
createdIsNeed: false,
|
||||||
queryForm: {},
|
queryForm: {},
|
||||||
pageList: walletRuleMchConfigApi.pageJoin,
|
pageList: walletRuleMchConfigApi.pageJoin,
|
||||||
})
|
})
|
||||||
@@ -95,6 +106,11 @@ const selectionChangHandle = (objs: { id: string }[]) => {
|
|||||||
multiple.value = !objs.length
|
multiple.value = !objs.length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const doAdd = () => {
|
||||||
|
WalletRuleMchConfigFormDialogRef.value.openDialog(null, props.sourceMchId)
|
||||||
|
}
|
||||||
|
|
||||||
// 删除操作
|
// 删除操作
|
||||||
const handleDelete = async (ids: string[]) => {
|
const handleDelete = async (ids: string[]) => {
|
||||||
try {
|
try {
|
||||||
@@ -110,4 +126,9 @@ const handleDelete = async (ids: string[]) => {
|
|||||||
useMessage().error(err.msg)
|
useMessage().error(err.msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
state.queryForm.sourceMchId = props.sourceMchId
|
||||||
|
getDataList()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog width="60%" v-model="visible" :close-on-click-modal="false" draggable>
|
<el-dialog width="80%" v-model="visible" :close-on-click-modal="false" @closed="dialogClosed" draggable>
|
||||||
<div>
|
<div>
|
||||||
<el-tabs v-model="form.activeTab" class="demo-tabs">
|
<el-tabs v-model="form.activeTab" class="demo-tabs">
|
||||||
<div v-for="v in data.tabList" :key="v.id">
|
<div v-for="v in data.tabList" :key="v.id">
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<mch-rule-config-dialog v-if="form.activeTab == 20 && form.merchantType == '1'" />
|
<mch-rule-config-dialog :sourceMchId="form.id" v-if="form.activeTab == 20 && form.merchantType == '1'" />
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="visible = false">取消</el-button>
|
<el-button @click="visible = false">取消</el-button>
|
||||||
@@ -43,13 +43,15 @@ const data = reactive({
|
|||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
// 提交表单数据
|
const defualtForm = {
|
||||||
const form = reactive({
|
|
||||||
activeTab: data.tabList[0].id,
|
activeTab: data.tabList[0].id,
|
||||||
id: "",
|
id: "",
|
||||||
merchantType: "",
|
merchantType: "",
|
||||||
defaultWalletTypeId: "",
|
defaultWalletTypeId: "",
|
||||||
})
|
}
|
||||||
|
|
||||||
|
// 提交表单数据
|
||||||
|
const form = reactive({ ...defualtForm })
|
||||||
|
|
||||||
// 定义校验规则
|
// 定义校验规则
|
||||||
const dataRules = ref({
|
const dataRules = ref({
|
||||||
@@ -69,6 +71,11 @@ const openDialog = (id: string) => {
|
|||||||
getmerchantInfoData(id)
|
getmerchantInfoData(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 关闭弹框
|
||||||
|
const dialogClosed = () => {
|
||||||
|
Object.assign(form, defualtForm)
|
||||||
|
}
|
||||||
|
|
||||||
// 初始化表单数据
|
// 初始化表单数据
|
||||||
const getmerchantInfoData = async (id: string) => {
|
const getmerchantInfoData = async (id: string) => {
|
||||||
// 获取数据
|
// 获取数据
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user