111
This commit is contained in:
1 parent
29eb383e2c
commit
c636a03d1b
5 files changed
+308
-23
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function pageJoin(query?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-mch-config/page-join",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-mch-config/page",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-mch-config",
|
||||
method: "post",
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-mch-config/" + id,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-mch-config",
|
||||
method: "delete",
|
||||
data: ids,
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-mch-config",
|
||||
method: "put",
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
@@ -43,6 +43,16 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item prop="sort">
|
||||
<template #label>
|
||||
<span>排序</span>
|
||||
<tip content="越大越在前" />
|
||||
</template>
|
||||
<el-input-number v-model="form.sort" placeholder="" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="联系电话" prop="phone">
|
||||
<el-input v-model.trim="form.phone" placeholder="请输入联系电话" />
|
||||
@@ -90,8 +100,8 @@
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="店铺地址" prop="address">
|
||||
<el-input type="textarea" v-model.trim="form.address" placeholder="请输入店铺地址" />
|
||||
<el-form-item label="店铺地址" prop="addressDes">
|
||||
<el-input type="textarea" v-model.trim="form.addressDes" placeholder="请输入店铺地址" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -131,7 +141,8 @@ const form = reactive({
|
||||
visibleMobile: "0",
|
||||
phone: "",
|
||||
businessTime: "",
|
||||
address: "",
|
||||
addressDes: "",
|
||||
sort: 0,
|
||||
})
|
||||
const jobTime = reactive<{
|
||||
[key: string]: string[]
|
||||
@@ -151,6 +162,7 @@ const dataRules = ref({
|
||||
rangeDate: [{ required: true, message: "请选择营业时间", trigger: "blur" }],
|
||||
deptId: [{ required: true, message: "请选择部门", trigger: "blur" }],
|
||||
merchantType: [{ required: true, message: "请选择商户类型", trigger: "blur" }],
|
||||
sort: [{ required: true, message: "请输入排序", trigger: "blur" }],
|
||||
// jobTime: [{ required: true, message: "请选择营业时间", trigger: "blur" }],
|
||||
})
|
||||
|
||||
|
||||
@@ -79,6 +79,32 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="200" label="支付默认钱包">
|
||||
<template #default="{ row }">
|
||||
<div class="flex items-center justify-center">
|
||||
<div class="color-primary">{{ row.walletTypeName }}</div>
|
||||
<div class="flex items-center just ml5">
|
||||
<dict-tag :options="wallet_type" :value="row.walletTypeUniqueCode" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deptName" label="部门" show-overflow-tooltip min-width="300" />
|
||||
<el-table-column prop="phone" label="联系电话" :min-width="120" />
|
||||
<el-table-column prop="sort" label="排序" :min-width="100">
|
||||
<template #default="{ row }">
|
||||
<span class="color-success">{{ row.sort }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="businessTime" label="营业时间" :min-width="160">
|
||||
<template #default="{ row }">
|
||||
<div>{{ row.jobTime?.split(",")[0] ? "早上:" + row.jobTime?.split(",")[0] : "" }}</div>
|
||||
<div>{{ row.jobTime?.split(",")[1] ? "中午:" + row.jobTime?.split(",")[1] : "" }}</div>
|
||||
<div>{{ row.jobTime?.split(",")[2] ? "晚上:" + row.jobTime?.split(",")[2] : "" }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="addressDes" label="地址" show-overflow-tooltip :min-width="160" />
|
||||
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip :min-width="160" />
|
||||
<el-table-column prop="isSyncZy" label="是否同步正元" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
@@ -101,26 +127,6 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="200" label="支付默认钱包">
|
||||
<template #default="{ row }">
|
||||
<div class="flex items-center justify-center">
|
||||
<div class="color-primary">{{ row.walletTypeName }}</div>
|
||||
<div class="flex items-center just ml5">
|
||||
<dict-tag :options="wallet_type" :value="row.walletTypeUniqueCode" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deptName" label="部门" show-overflow-tooltip min-width="300" />
|
||||
<el-table-column prop="phone" label="联系电话" :min-width="120" />
|
||||
<el-table-column prop="businessTime" label="营业时间" :min-width="160">
|
||||
<template #default="{ row }">
|
||||
<div>{{ row.jobTime?.split(",")[0] ? "早上:" + row.jobTime?.split(",")[0] : "" }}</div>
|
||||
<div>{{ row.jobTime?.split(",")[1] ? "中午:" + row.jobTime?.split(",")[1] : "" }}</div>
|
||||
<div>{{ row.jobTime?.split(",")[2] ? "晚上:" + row.jobTime?.split(",")[2] : "" }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip :min-width="160" />
|
||||
<el-table-column label="操作" fixed="right" min-width="300">
|
||||
<template #default="{ row }">
|
||||
<el-button icon="RefreshRight" text type="primary" v-auth="'wallet_mchManage_refresh_qrcode'" @click="refreshQrcode(row)">
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<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="rulePriceConfigId">
|
||||
<el-input v-model="form.rulePriceConfigId" placeholder="规则" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="目标商户" prop="tragetDeptId">
|
||||
<el-input v-model="form.tragetDeptId" placeholder="请输入目标商户id" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WalletRuleMchConfigFormDialog">
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import * as walletRuleMchConfigApi from "/@/api/wallet/wallet-rule-mch-config"
|
||||
import { rule } from "/@/utils/validate"
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: "",
|
||||
sourceMchId: "",
|
||||
tragetDeptId: "",
|
||||
rulePriceConfigId: "",
|
||||
})
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
tragetDeptId: [{ required: true, message: "请选择目标商户", trigger: "blur" }],
|
||||
rulePriceConfigId: [{ required: true, message: "请选择规则", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ""
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
})
|
||||
|
||||
// 获取walletRuleMchConfig信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwalletRuleMchConfigData(id)
|
||||
}
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
form.id ? await walletRuleMchConfigApi.putObj(form) : await walletRuleMchConfigApi.addObj(form)
|
||||
useMessage().success(form.id ? "修改成功" : "添加成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const getwalletRuleMchConfigData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
walletRuleMchConfigApi
|
||||
.getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="WalletRuleMchConfigFormDialogRef.openDialog()"
|
||||
v-auth="'dzc_walletRuleMchConfig_add'"
|
||||
>
|
||||
新 增
|
||||
</el-button>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="80" />
|
||||
<el-table-column prop="sourceMchId" label="源商户" />
|
||||
<el-table-column prop="tragetDeptId" label="目标部门" />
|
||||
<el-table-column prop="rulePriceConfigId" label="规则名">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="wallet_rule_price_type" :value="row.rulePriceType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="rulePriceConfigId" label="基础金额">
|
||||
<template #default="{ row }">
|
||||
<span class="color-success">{{ displayPrice(row.basePrice) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="rulePriceConfigId" label="额外百分比">
|
||||
<template #default="{ row }">
|
||||
<span class="color-primary">{{ row.multiple }}%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
icon="edit-pen"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'dzc_walletRuleMchConfig_edit'"
|
||||
@click="WalletRuleMchConfigFormDialogRef.openDialog(row.id)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button icon="delete" text type="primary" v-auth="'dzc_walletRuleMchConfig_del'" @click="handleDelete([row.id])"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
<wallet-rule-mch-config-form-dialog ref="WalletRuleMchConfigFormDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="mchRuleConfigDialog">
|
||||
import * as walletRuleMchConfigApi from "/@/api/wallet/wallet-rule-mch-config"
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
|
||||
const WalletRuleMchConfigFormDialog = defineAsyncComponent(() => import("./mch-rule-config-form.vue"))
|
||||
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
// 定义变量内容
|
||||
const WalletRuleMchConfigFormDialogRef = ref()
|
||||
|
||||
// 定义查询字典
|
||||
const { wallet_rule_price_type } = useDict("wallet_rule_price_type")
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: walletRuleMchConfigApi.pageJoin,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await walletRuleMchConfigApi.delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user