Merge branch 'master' of http://gitea.zianxin.com/zianxin-tec/biz-pc-cloud
This commit is contained in:
commit
3a378bba2f
8 files changed
+428
-5
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: "/wallet/mch-catgory/page",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function select(query?: Object) {
|
||||
return request({
|
||||
url: "/wallet/mch-catgory/select",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: "/wallet/mch-catgory",
|
||||
method: "post",
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: "/wallet/mch-catgory/" + id,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: "/wallet/mch-catgory",
|
||||
method: "delete",
|
||||
data: ids,
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: "/wallet/mch-catgory",
|
||||
method: "put",
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
v-model="state.selectId"
|
||||
:placeholder="props.placeholder"
|
||||
clearable
|
||||
remote-show-suffix
|
||||
filterable
|
||||
remote
|
||||
:disabled="props.disabled"
|
||||
:remote-method="remoteSearch"
|
||||
:loading="state.loading"
|
||||
@visible-change="(e: boolean) => e && getOptions()"
|
||||
>
|
||||
<el-option v-for="v in state.options" :key="v.id" :label="`${v.name}`" :value="v.id">
|
||||
<div class="flex items-center">
|
||||
<div class="color-primary">{{ v.name }}</div>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="select-mch-catory">
|
||||
import { reactive } from "vue"
|
||||
import * as mchCatgoryApi from "/@/api/wallet/mch-catgory"
|
||||
|
||||
const selectId = defineModel()
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
placeholder?: string
|
||||
apiParams?: any
|
||||
autoFirst?: boolean
|
||||
disabled?: boolean
|
||||
}>(),
|
||||
{
|
||||
placeholder: "请选择",
|
||||
apiParams: {},
|
||||
autoFirst: false,
|
||||
disabled: false,
|
||||
},
|
||||
)
|
||||
|
||||
const queryForm = reactive<any>({
|
||||
name: null,
|
||||
current: 1,
|
||||
size: 9999,
|
||||
})
|
||||
|
||||
const state = reactive<any>({
|
||||
loading: true,
|
||||
selectId: selectId,
|
||||
options: [],
|
||||
})
|
||||
|
||||
watch(
|
||||
selectId,
|
||||
(newVal, oldValue) => {
|
||||
if (newVal == oldValue) return
|
||||
state.selectId = newVal
|
||||
getOptions()
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
async function getOptions() {
|
||||
try {
|
||||
state.loading = true
|
||||
const _pa = {
|
||||
...queryForm,
|
||||
...props.apiParams,
|
||||
}
|
||||
const { data } = await mchCatgoryApi.select(_pa)
|
||||
state.options = data.records ?? []
|
||||
if (props.autoFirst && state.options.length != 0) {
|
||||
state.selectId = state.options[0].id
|
||||
}
|
||||
} finally {
|
||||
setTimeout(() => (state.loading = false), 500)
|
||||
}
|
||||
}
|
||||
|
||||
function remoteSearch(params: string) {
|
||||
if (params != queryForm.name) {
|
||||
queryForm.name = params
|
||||
getOptions()
|
||||
}
|
||||
}
|
||||
|
||||
function clear() {
|
||||
state.selectId = null
|
||||
getOptions()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
props.autoFirst && getOptions()
|
||||
})
|
||||
</script>
|
||||
@@ -33,6 +33,7 @@ import SelectHardSpu from "/@/components/Select/SelectHardSpu.vue"
|
||||
import SelectHardGroup from "/@/components/Select/selectHardGroup.vue"
|
||||
import SelectRole from "/@/components/Select/SelectRole.vue"
|
||||
import SelectCabinet from "/@/components/Select/SelectCabinet.vue"
|
||||
import SelectMchCatory from "/@/components/Select/SelectMchCatory.vue"
|
||||
|
||||
// 第三方组件
|
||||
import ElementPlus from "element-plus"
|
||||
@@ -74,6 +75,7 @@ export default {
|
||||
app.component("SelectHard", SelectHard)
|
||||
app.component("SelectHardSpuCategory", SelectHardSpuCategory)
|
||||
app.component("SelectHardSpu", SelectHardSpu)
|
||||
app.component("SelectMchCatory", SelectMchCatory)
|
||||
|
||||
app.component("SelectUser", SelectUser)
|
||||
app.component("SelectWalletType", SelectWalletType)
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<el-dialog width="40%" :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="name">
|
||||
<el-input v-model="form.name" placeholder="请输入分类名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="类型" prop="bizType">
|
||||
<dict-select v-model="form.bizType" dict-code="merchant_type" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<template #label>
|
||||
<span>排序</span>
|
||||
<tip content="越大越在前" />
|
||||
</template>
|
||||
<el-input-number :min="0" :step="1" v-model="form.sort" placeholder="" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" type="textarea" :autosize="{ minRows: 6 }" />
|
||||
</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="MchCatgoryDialog">
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import * as mchCatgoryApi from "/@/api/wallet/mch-catgory"
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: "",
|
||||
name: "",
|
||||
bizType: "",
|
||||
sort: "",
|
||||
remark: "",
|
||||
})
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
name: [{ required: true, message: "分类名不能为空", trigger: "blur" }],
|
||||
bizType: [{ required: true, message: "类型不能为空", trigger: "change" }],
|
||||
sort: [{ required: true, message: "排序不能为空", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ""
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
})
|
||||
|
||||
// 获取mchCatgory信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getmchCatgoryData(id)
|
||||
}
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
form.id ? await mchCatgoryApi.putObj(form) : await mchCatgoryApi.addObj(form)
|
||||
useMessage().success(form.id ? "修改成功" : "添加成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const getmchCatgoryData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
mchCatgoryApi
|
||||
.getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-form-item style="width: 300px" label="分类名" prop="name">
|
||||
<el-input v-model="state.queryForm.name" placeholder="分类名" />
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 300px" label="类型" prop="bizType">
|
||||
<dict-select v-model="state.queryForm.bizType" dict-code="merchant_type" />
|
||||
</el-form-item>
|
||||
<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>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()" v-auth="'waller_mchCatgory_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button
|
||||
plain
|
||||
:disabled="multiple"
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'waller_mchCatgory_del'"
|
||||
@click="handleDelete(selectObjs)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<!-- :export="'waller_mchCatgory_export'" -->
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
@exportExcel="exportExcel"
|
||||
class="ml10 mr20"
|
||||
style="float: right"
|
||||
@queryTable="getDataList"
|
||||
></right-toolbar>
|
||||
</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="40" />
|
||||
<el-table-column prop="name" label="分类名" />
|
||||
<el-table-column prop="bizType" label="分类名类型">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="merchant_type" :value="row.bizType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sort" label="排序" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="{ row }">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'waller_mchCatgory_edit'" @click="formDialogRef.openDialog(row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'waller_mchCatgory_del'" @click="handleDelete([scope.row.id])">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemMchCatgory">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import * as mchCatgoryApi from "/@/api/wallet/mch-catgory"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
// 定义查询字典
|
||||
const { merchant_type } = useDict("merchant_type")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: mchCatgoryApi.fetchList,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile("/waller/mchCatgory/export", Object.assign(state.queryForm, { ids: selectObjs }), "mchCatgory.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
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 mchCatgoryApi.delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -47,6 +47,11 @@
|
||||
<select-mch v-model="form.parentId" :apiParams="{ types: '2', supType: '10' }" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-show="form.types == '2' && form.supType == '20'" :span="24" class="mb20">
|
||||
<el-form-item label="分类:" prop="catgoryId">
|
||||
<select-mch-catory v-model="form.catgoryId" :apiParams="{ bizType: form.types }" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商户logo:" prop="logoPic">
|
||||
<upload-img v-model:imageUrl="form.logoPic" />
|
||||
@@ -161,6 +166,7 @@ const form = reactive({
|
||||
supType: "",
|
||||
cooperationStatus: "1",
|
||||
parentId: "",
|
||||
catgoryId: "",
|
||||
discountsPrice: "",
|
||||
})
|
||||
const jobTime = reactive<{
|
||||
@@ -181,6 +187,7 @@ const dataRulesArr = {
|
||||
rangeDate: [{ required: true, message: "请选择营业时间", trigger: "change" }],
|
||||
deptId: [{ required: true, message: "请选择部门", trigger: "change" }],
|
||||
sort: [{ required: true, message: "请输入排序", trigger: "change" }],
|
||||
catgoryId: [{ required: true, message: "请选择分类", trigger: "change" }],
|
||||
}
|
||||
const dataRules = computed(() => {
|
||||
if (form.types == "2" && form.supType == "20") {
|
||||
|
||||
@@ -75,12 +75,15 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="merchantType" label="商户类型" align="center" show-overflow-tooltip :min-width="100">
|
||||
<el-table-column prop="merchantType" label="商户类型" align="center" show-overflow-tooltip :min-width="160">
|
||||
<template #default="{ row }">
|
||||
<div class="flex justify-center items-center">
|
||||
<div v-for="(v, i) in row.types?.split(',')" :key="i" class="mr-1">
|
||||
<dict-tag :options="merchant_type" :value="v" />
|
||||
<div class="flex">
|
||||
<div class="flex justify-center items-center">
|
||||
<div v-for="(v, i) in row.types?.split(',')" :key="i" class="mr-1">
|
||||
<dict-tag :options="merchant_type" :value="v" />
|
||||
</div>
|
||||
</div>
|
||||
<el-tag v-if="row.catgoryName" type="primary">{{ row.catgoryName }}</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<el-form-item style="width: 200px" label="充值方式" prop="bizType">
|
||||
<dict-select v-model="state.queryForm.bizType" dict-code="wallet_biz" />
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 200px" label="充值类型" prop="type">
|
||||
<el-form-item v-if="false" style="width: 200px" label="充值类型" prop="type">
|
||||
<dict-select v-model="state.queryForm.type" dict-code="wallet_biz_recharge" />
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 300px" label="充值时间" prop="createTimeList">
|
||||
|
||||
Reference in new issue
Block a user