mirror of
https://gitee.com/bootx/dax-pay-ui
synced 2026-08-06 21:26:27 +08:00
feat(config): 新增收银台配置功能
- 添加收银台配置相关的 API 接口 - 实现收银台配置的编辑和列表展示功能 - 新增聚合支付配置、分组配置和配置项功能 - 优化码牌配置界面布局
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
</style>
|
||||
@@ -8,36 +8,38 @@
|
||||
:mask-closable="showable"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<a-form
|
||||
class="small-from-item"
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:validate-trigger="['blur', 'change']"
|
||||
:label-col="labelCol"
|
||||
:wrapper-col="wrapperCol"
|
||||
>
|
||||
<a-form-item label="主键" name="id" :hidden="true">
|
||||
<a-input v-model:value="form.id" :disabled="showable" />
|
||||
</a-form-item>
|
||||
<a-form-item label="码牌编码" name="code" v-if="form.code">
|
||||
<a-input v-model:value="form.code" disabled />
|
||||
</a-form-item>
|
||||
<a-form-item label="码牌名称" name="name">
|
||||
<a-input v-model:value="form.name" :disabled="showable" placeholder="请输入码牌名称" />
|
||||
</a-form-item>
|
||||
<a-form-item label="是否启用" name="enable">
|
||||
<a-switch
|
||||
checked-children="启用"
|
||||
un-checked-children="停用"
|
||||
v-model:checked="form.enable"
|
||||
:disabled="showable"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="备注" name="remark">
|
||||
<a-textarea v-model:value="form.remark" :disabled="showable" placeholder="请输入备注" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form
|
||||
class="small-from-item"
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:validate-trigger="['blur', 'change']"
|
||||
:label-col="labelCol"
|
||||
:wrapper-col="wrapperCol"
|
||||
>
|
||||
<a-form-item label="主键" name="id" :hidden="true">
|
||||
<a-input v-model:value="form.id" :disabled="showable" />
|
||||
</a-form-item>
|
||||
<a-form-item label="码牌编码" name="code" v-if="form.code">
|
||||
<a-input v-model:value="form.code" disabled />
|
||||
</a-form-item>
|
||||
<a-form-item label="码牌名称" name="name">
|
||||
<a-input v-model:value="form.name" :disabled="showable" placeholder="请输入码牌名称" />
|
||||
</a-form-item>
|
||||
<a-form-item label="是否启用" name="enable">
|
||||
<a-switch
|
||||
checked-children="启用"
|
||||
un-checked-children="停用"
|
||||
v-model:checked="form.enable"
|
||||
:disabled="showable"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="备注" name="remark">
|
||||
<a-textarea v-model:value="form.remark" :disabled="showable" placeholder="请输入备注" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
<template #footer>
|
||||
<a-space>
|
||||
<a-button key="cancel" @click="handleCancel">取消</a-button>
|
||||
|
||||
@@ -157,6 +157,7 @@
|
||||
form.value.cashierCodeId = unref(configId)
|
||||
getInfo(id, editType)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
<template>
|
||||
<basic-modal
|
||||
title="聚合支付配置"
|
||||
v-bind="$attrs"
|
||||
:loading="confirmLoading"
|
||||
:width="750"
|
||||
:open="visible"
|
||||
:mask-closable="showable"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form
|
||||
class="small-from-item"
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:validate-trigger="['blur', 'change']"
|
||||
:label-col="labelCol"
|
||||
:wrapper-col="wrapperCol"
|
||||
>
|
||||
<a-form-item label="主键" name="id" :hidden="true">
|
||||
<a-input v-model:value="form.id" :disabled="showable" />
|
||||
</a-form-item>
|
||||
<a-form-item label="聚合支付类型" validate-first name="type">
|
||||
<a-select
|
||||
style="width: 300px"
|
||||
v-model:value="form.type"
|
||||
:disabled="showable"
|
||||
:options="aggregateTypeList"
|
||||
allow-clear
|
||||
placeholder="请选择聚合支付类型"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="支付通道" name="channel">
|
||||
<a-select
|
||||
style="width: 300px"
|
||||
v-model:value="form.channel"
|
||||
:disabled="showable"
|
||||
:options="channelList"
|
||||
allow-clear
|
||||
placeholder="请选择支付通道"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="支付方式" name="payMethod">
|
||||
<a-select
|
||||
style="width: 300px"
|
||||
v-model:value="form.payMethod"
|
||||
:disabled="showable"
|
||||
:options="methodList"
|
||||
allow-clear
|
||||
placeholder="请选择支付方式"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="自动拉起支付" name="allocation">
|
||||
<a-switch
|
||||
checked-children="是"
|
||||
un-checked-children="否"
|
||||
v-model:checked="form.autoLaunch"
|
||||
:disabled="showable"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
<template #footer>
|
||||
<a-space>
|
||||
<a-button key="cancel" @click="handleCancel">取消</a-button>
|
||||
<a-button
|
||||
v-if="!showable"
|
||||
key="forward"
|
||||
:loading="confirmLoading"
|
||||
type="primary"
|
||||
@click="handleOk"
|
||||
>保存</a-button
|
||||
>
|
||||
</a-space>
|
||||
</template>
|
||||
</basic-modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { BasicModal } from '@/components/Modal'
|
||||
import useFormEdit from '@/hooks/bootx/useFormEdit'
|
||||
import { FormEditType } from '@/enums/formTypeEnum'
|
||||
import {
|
||||
saveAggregateConfig,
|
||||
updateAggregateConfig,
|
||||
CheckoutAggregateConfig,
|
||||
getAggregateConfig,
|
||||
existsAggregateConfig,
|
||||
existsAggregateConfigNotId,
|
||||
} from './CheckoutConfig.api'
|
||||
import { nextTick, ref, unref } from 'vue'
|
||||
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
|
||||
import { LabeledValue } from 'ant-design-vue/lib/select'
|
||||
import { useDict } from '@/hooks/bootx/useDict'
|
||||
|
||||
const props = defineProps({
|
||||
appId: String,
|
||||
})
|
||||
|
||||
const { dictDropDown } = useDict()
|
||||
|
||||
const {
|
||||
handleCancel,
|
||||
initFormEditType,
|
||||
formEditType,
|
||||
confirmLoading,
|
||||
visible,
|
||||
showable,
|
||||
labelCol,
|
||||
wrapperCol,
|
||||
} = useFormEdit()
|
||||
|
||||
const aggregateTypeList = ref<LabeledValue[]>([])
|
||||
const channelList = ref<LabeledValue[]>([])
|
||||
const methodList = ref<LabeledValue[]>([])
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
let form = ref<CheckoutAggregateConfig>({
|
||||
autoLaunch: true,
|
||||
})
|
||||
// 校验
|
||||
const rules = {
|
||||
type: [
|
||||
{ required: true, message: '请选择聚合支付类型' },
|
||||
{ validator: validateCode, trigger: 'blur' },
|
||||
],
|
||||
channel: [{ required: true, message: '请选择支付通道类型' }],
|
||||
payMethod: [{ required: true, message: '请选择支付方式' }],
|
||||
autoLaunch: [{ required: true, message: '' }],
|
||||
} as Record<string, Rule[]>
|
||||
|
||||
// 事件
|
||||
const emits = defineEmits(['ok'])
|
||||
|
||||
/**
|
||||
* 入口
|
||||
*/
|
||||
function init(id, editType: FormEditType) {
|
||||
initFormEditType(editType)
|
||||
resetForm()
|
||||
getInfo(id, editType)
|
||||
form.value.appId = props.appId
|
||||
initData()
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
async function initData() {
|
||||
aggregateTypeList.value = await dictDropDown('checkout_aggregate')
|
||||
channelList.value = await dictDropDown('channel')
|
||||
methodList.value = await dictDropDown('pay_method')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息
|
||||
*/
|
||||
function getInfo(id, editType: FormEditType) {
|
||||
if ([FormEditType.Edit, FormEditType.Show].includes(editType)) {
|
||||
confirmLoading.value = true
|
||||
getAggregateConfig(id).then(({ data }) => {
|
||||
form.value = data
|
||||
confirmLoading.value = false
|
||||
})
|
||||
} else {
|
||||
confirmLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
function handleOk() {
|
||||
formRef.value?.validate().then(async () => {
|
||||
confirmLoading.value = true
|
||||
if (formEditType.value === FormEditType.Add) {
|
||||
await saveAggregateConfig(unref(form)).finally(() => (confirmLoading.value = false))
|
||||
} else if (formEditType.value === FormEditType.Edit) {
|
||||
await updateAggregateConfig(unref(form)).finally(() => (confirmLoading.value = false))
|
||||
}
|
||||
handleCancel()
|
||||
emits('ok')
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验编码重复
|
||||
*/
|
||||
async function validateCode() {
|
||||
const { appId, type, id } = form.value
|
||||
if (id) {
|
||||
const res = await existsAggregateConfigNotId(appId, type, id)
|
||||
return res.data ? Promise.reject('该聚合支付类型已存在') : Promise.resolve()
|
||||
} else {
|
||||
const res = await existsAggregateConfig(appId, type)
|
||||
return res.data ? Promise.reject('该聚合支付类型已存在') : Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
// 重置表单的校验
|
||||
function resetForm() {
|
||||
nextTick(() => {
|
||||
formRef.value?.resetFields()
|
||||
})
|
||||
}
|
||||
defineExpose({ init })
|
||||
</script>
|
||||
|
||||
<style scoped lang="less"></style>
|
||||
@@ -0,0 +1,126 @@
|
||||
<template>
|
||||
<div>
|
||||
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }">
|
||||
<template #buttons>
|
||||
<a-space>
|
||||
<a-button type="primary" pre-icon="ant-design:plus-outlined" @click="add">新建</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</vxe-toolbar>
|
||||
<vxe-table ey-field="id" ref="xTable" :data="records" :loading="loading">
|
||||
<vxe-column type="seq" width="60" />
|
||||
|
||||
<vxe-column field="type" title="类型" :min-width="150">
|
||||
<template #default="{ row }">
|
||||
<a href="javascript:" @click="show(row)">{{
|
||||
dictConvert('checkout_aggregate', row.type)
|
||||
}}</a>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="channel" title="支付通道" :min-width="150">
|
||||
<template #default="{ row }">
|
||||
{{ dictConvert('channel', row.channel) }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="payMethod" title="支付方式" :min-width="150">
|
||||
<template #default="{ row }">
|
||||
{{ dictConvert('pay_method', row.payMethod) }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="autoLaunch" title="自动拉起支付" :min-width="150">
|
||||
<template #default="{ row }">
|
||||
<a-tag color="green" v-if="row.autoLaunch">是</a-tag>
|
||||
<a-tag color="red" v-else>否</a-tag>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="createTime" title="创建时间" :min-width="170" />
|
||||
<vxe-column fixed="right" :width="180" :showOverflow="false" title="操作">
|
||||
<template #default="{ row }">
|
||||
<a href="javascript:" @click="edit(row)">编辑</a>
|
||||
<a-divider type="vertical" />
|
||||
<a href="javascript:" style="color: red" @click="del(row)">删除</a>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
<CheckoutAggregateConfigEdit ref="checkoutAggregateConfigEdit" :appId="appId" @ok="queryPage" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import {
|
||||
CheckoutAggregateConfig,
|
||||
delAggregateConfig,
|
||||
getAggregateConfigs,
|
||||
} from './CheckoutConfig.api'
|
||||
import { useMessage } from '@/hooks/web/useMessage'
|
||||
import CheckoutAggregateConfigEdit from './CheckoutAggregateConfigEdit.vue'
|
||||
import { FormEditType } from '@/enums/formTypeEnum'
|
||||
import { useDict } from '@/hooks/bootx/useDict'
|
||||
|
||||
const { createMessage, createConfirm } = useMessage()
|
||||
const { dictConvert } = useDict()
|
||||
|
||||
const loading = ref(false)
|
||||
const records = ref<CheckoutAggregateConfig[]>([])
|
||||
|
||||
const checkoutAggregateConfigEdit = ref<any>()
|
||||
|
||||
const props = defineProps({
|
||||
appId: String,
|
||||
type: String,
|
||||
})
|
||||
|
||||
onMounted(() => queryPage())
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
function queryPage() {
|
||||
loading.value = true
|
||||
getAggregateConfigs(props.appId).then(({ data }) => {
|
||||
records.value = data
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
checkoutAggregateConfigEdit.value.init(null, FormEditType.Add)
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
checkoutAggregateConfigEdit.value.init(record.id, FormEditType.Edit)
|
||||
}
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
function show(record) {
|
||||
checkoutAggregateConfigEdit.value.init(record.id, FormEditType.Show)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function del(record) {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '删除',
|
||||
content: '是否删除该数据',
|
||||
onOk: () => {
|
||||
loading.value = true
|
||||
delAggregateConfig(record.id).then(() => {
|
||||
createMessage.success('删除成功')
|
||||
queryPage()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less"></style>
|
||||
279
src/views/daxpay/common/config/checkout/CheckoutConfig.api.ts
Normal file
279
src/views/daxpay/common/config/checkout/CheckoutConfig.api.ts
Normal file
@@ -0,0 +1,279 @@
|
||||
import { defHttp } from '@/utils/http/axios'
|
||||
import { Result } from '#/axios'
|
||||
import { MchEntity } from '#/web'
|
||||
|
||||
/**
|
||||
* 获取收银台配置
|
||||
*/
|
||||
export function getConfig(appId) {
|
||||
return defHttp.get<Result<CheckoutConfig>>({
|
||||
url: '/checkout/config/get',
|
||||
params: {
|
||||
appId,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存收银台配置
|
||||
*/
|
||||
export function saveConfig(data: CheckoutConfig) {
|
||||
return defHttp.post<Result<CheckoutConfig>>({
|
||||
url: '/checkout/config/save',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新收银台配置
|
||||
*/
|
||||
export function updateConfig(data: CheckoutConfig) {
|
||||
return defHttp.post<Result<CheckoutConfig>>({
|
||||
url: '/checkout/config/update',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分组配置列表
|
||||
*/
|
||||
export function getGroupConfigs(appId, checkoutType) {
|
||||
return defHttp.get<Result<CheckoutGroupConfig[]>>({
|
||||
url: '/checkout/config/group/list',
|
||||
params: {
|
||||
appId,
|
||||
checkoutType,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分组配置列表
|
||||
*/
|
||||
export function getGroupConfig(id) {
|
||||
return defHttp.get<Result<CheckoutGroupConfig>>({
|
||||
url: '/checkout/config/group/get',
|
||||
params: { id },
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存分组配置
|
||||
*/
|
||||
export function saveGroupConfig(data: CheckoutGroupConfig) {
|
||||
return defHttp.post<Result<CheckoutGroupConfig>>({
|
||||
url: '/checkout/config/group/save',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新分组配置
|
||||
*/
|
||||
export function updateGroupConfig(data: CheckoutGroupConfig) {
|
||||
return defHttp.post<Result<CheckoutGroupConfig>>({
|
||||
url: '/checkout/config/group/update',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分组配置
|
||||
*/
|
||||
export function delGroupConfig(id) {
|
||||
return defHttp.post({
|
||||
url: '/checkout/config/group/delete',
|
||||
params: { id },
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置项配置
|
||||
*/
|
||||
export function getItemConfigs(groupId) {
|
||||
return defHttp.get<Result<CheckoutItemConfig[]>>({
|
||||
url: '/checkout/config/item/list',
|
||||
params: {
|
||||
groupId,
|
||||
},
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 获取配置项配置
|
||||
*/
|
||||
export function getItemConfig(id) {
|
||||
return defHttp.get<Result<CheckoutItemConfig>>({
|
||||
url: '/checkout/config/item/get',
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存配置项配置
|
||||
*/
|
||||
export function saveItemConfig(data: CheckoutItemConfig) {
|
||||
return defHttp.post<Result<CheckoutItemConfig>>({
|
||||
url: '/checkout/config/item/save',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新配置项配置
|
||||
*/
|
||||
export function updateItemConfig(data: CheckoutItemConfig) {
|
||||
return defHttp.post<Result<CheckoutItemConfig>>({
|
||||
url: '/checkout/config/item/update',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除配置项配置
|
||||
*/
|
||||
export function delItemConfig(id) {
|
||||
return defHttp.post({
|
||||
url: '/checkout/config/item/delete',
|
||||
params: { id },
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取聚合支付配置
|
||||
*/
|
||||
export function getAggregateConfigs(appId) {
|
||||
return defHttp.get<Result<CheckoutAggregateConfig[]>>({
|
||||
url: '/checkout/config/aggregate/list',
|
||||
params: {
|
||||
appId,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取聚合支付配置
|
||||
*/
|
||||
export function getAggregateConfig(id) {
|
||||
return defHttp.get<Result<CheckoutAggregateConfig>>({
|
||||
url: '/checkout/config/aggregate/get',
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 聚合支付配置是否存在
|
||||
*/
|
||||
export function existsAggregateConfig(appId, type) {
|
||||
return defHttp.get<Result<boolean>>({
|
||||
url: '/checkout/config/aggregate/exists',
|
||||
params: {
|
||||
appId,
|
||||
type
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 聚合支付配置是否存在(不包含自身)
|
||||
*/
|
||||
export function existsAggregateConfigNotId(appId, type, id) {
|
||||
return defHttp.get<Result<boolean>>({
|
||||
url: '/checkout/config/aggregate/existsNotId',
|
||||
params: {
|
||||
appId,
|
||||
type,
|
||||
id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存聚合支付配置
|
||||
*/
|
||||
export function saveAggregateConfig(data: CheckoutAggregateConfig) {
|
||||
return defHttp.post<Result<CheckoutAggregateConfig>>({
|
||||
url: '/checkout/config/aggregate/save',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新聚合支付配置
|
||||
*/
|
||||
export function updateAggregateConfig(data: CheckoutAggregateConfig) {
|
||||
return defHttp.post<Result<CheckoutAggregateConfig>>({
|
||||
url: '/checkout/config/aggregate/update',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除聚合支付配置
|
||||
*/
|
||||
export function delAggregateConfig(id) {
|
||||
return defHttp.post({
|
||||
url: '/checkout/config/aggregate/delete',
|
||||
params: { id },
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 收银台配置
|
||||
*/
|
||||
export interface CheckoutConfig extends MchEntity {
|
||||
/** 收银台名称 */
|
||||
name?: string
|
||||
/** PC收银台是否同时显示聚合收银码 */
|
||||
aggregateShow?: boolean
|
||||
/** h5收银台自动升级聚合支付 */
|
||||
h5AutoUpgrade?: boolean
|
||||
}
|
||||
/**
|
||||
* 收银台类目配置
|
||||
*/
|
||||
export interface CheckoutGroupConfig extends MchEntity {
|
||||
/** 类型 web/h5/小程序 */
|
||||
type?: string
|
||||
/** 名称 */
|
||||
name?: string
|
||||
/** 图标 */
|
||||
icon?: string
|
||||
/** 排序 */
|
||||
sortNo?: number
|
||||
}
|
||||
/**
|
||||
* 收银台配置项
|
||||
*/
|
||||
export interface CheckoutItemConfig extends MchEntity {
|
||||
/** 类目配置Id */
|
||||
groupId?: string
|
||||
/** 名称 */
|
||||
name?: string
|
||||
/** 图标 */
|
||||
icon?: string
|
||||
/** 排序 */
|
||||
sortNo?: number
|
||||
/** 发起调用的类型 */
|
||||
callType?: string
|
||||
/** 支付通道 */
|
||||
channel?: string
|
||||
/** 支付方式 */
|
||||
payMethod?: string
|
||||
}
|
||||
/**
|
||||
* 收银台聚合扫码支付配置
|
||||
*/
|
||||
export interface CheckoutAggregateConfig extends MchEntity {
|
||||
/** 支付类型 */
|
||||
type?: string
|
||||
/** 通道 */
|
||||
channel?: string
|
||||
/** 支付方式 */
|
||||
payMethod?: string
|
||||
/** 自动拉起支付 */
|
||||
autoLaunch?: boolean
|
||||
}
|
||||
111
src/views/daxpay/common/config/checkout/CheckoutConfigEdit.vue
Normal file
111
src/views/daxpay/common/config/checkout/CheckoutConfigEdit.vue
Normal file
@@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form
|
||||
class="small-from-item"
|
||||
:model="form"
|
||||
ref="formRef"
|
||||
:validate-trigger="['blur', 'change']"
|
||||
:rules="rules"
|
||||
:label-col="labelCol"
|
||||
:wrapper-col="wrapperCol"
|
||||
>
|
||||
<a-form-item label="主键" name="id" :hidden="true">
|
||||
<a-input v-model:value="form.id" :disabled="showable" />
|
||||
</a-form-item>
|
||||
<a-form-item label="收银台名称" name="name">
|
||||
<a-input v-model:value="form.name" :disabled="!edit" placeholder="请输入收银台名称" />
|
||||
</a-form-item>
|
||||
<a-form-item label="同时显示聚合收银码" name="aggregateShow">
|
||||
<a-radio-group v-model:value="form.aggregateShow" :disabled="!edit" button-style="solid">
|
||||
<a-radio-button :value="false">不显示</a-radio-button>
|
||||
<a-radio-button :value="true">显示</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item label="H5收银台自动升级聚合支付" name="h5AutoUpgrade">
|
||||
<a-radio-group v-model:value="form.h5AutoUpgrade" :disabled="!edit" button-style="solid">
|
||||
<a-radio-button :value="false">不升级</a-radio-button>
|
||||
<a-radio-button :value="true">升级</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<a-space :size="55" class="flex justify-center">
|
||||
<a-button v-if="edit" @click="initData">取消</a-button>
|
||||
<a-button v-if="edit" type="primary" @click="update">{{
|
||||
form.id ? '更新' : '保存'
|
||||
}}</a-button>
|
||||
<a-button v-if="!edit" @click="edit = true">编辑信息</a-button>
|
||||
</a-space>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import useFormEdit from '@/hooks/bootx/useFormEdit'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
|
||||
import { CheckoutConfig, getConfig, saveConfig, updateConfig } from './CheckoutConfig.api'
|
||||
import { useMessage } from '@/hooks/web/useMessage'
|
||||
|
||||
const { labelCol, wrapperCol, confirmLoading, showable } = useFormEdit()
|
||||
const { createMessage } = useMessage()
|
||||
|
||||
const edit = ref<boolean>(false)
|
||||
|
||||
const props = defineProps({
|
||||
appId: String,
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
initData()
|
||||
})
|
||||
// 表单
|
||||
const formRef = ref<FormInstance>()
|
||||
const form = ref<CheckoutConfig>({
|
||||
aggregateShow: false,
|
||||
h5AutoUpgrade: false,
|
||||
})
|
||||
|
||||
const rules = {
|
||||
name: [{ required: true, message: '请输入收银台名称' }],
|
||||
aggregateShow: [{ required: true, message: '' }],
|
||||
h5AutoUpgrade: [{ required: true, message: '' }],
|
||||
} as Record<string, Rule[]>
|
||||
|
||||
/**
|
||||
* 重置信息
|
||||
*/
|
||||
function initData() {
|
||||
confirmLoading.value = true
|
||||
edit.value = false
|
||||
getConfig(props.appId).then(({ data }) => {
|
||||
form.value = data
|
||||
confirmLoading.value = false
|
||||
form.value.appId = props.appId
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新配置
|
||||
*/
|
||||
function update() {
|
||||
formRef.value?.validate().then(async () => {
|
||||
confirmLoading.value = true
|
||||
if (form.value.id) {
|
||||
updateConfig(form.value)
|
||||
.then(() => {
|
||||
edit.value = false
|
||||
createMessage.success('更新成功')
|
||||
})
|
||||
.finally(() => (confirmLoading.value = false))
|
||||
} else {
|
||||
saveConfig(form.value)
|
||||
.then(() => {
|
||||
createMessage.success('保存成功')
|
||||
initData()
|
||||
})
|
||||
.finally(() => (confirmLoading.value = false))
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less"></style>
|
||||
@@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<basic-drawer
|
||||
destroyOnClose
|
||||
v-bind="$attrs"
|
||||
width="60%"
|
||||
title="码牌配置"
|
||||
:mask-closable="true"
|
||||
:open="visible"
|
||||
@close="handleCancel"
|
||||
>
|
||||
<a-tabs v-model:activeKey="activeKey" type="card">
|
||||
<a-tab-pane :key="1" tab="公共配置">
|
||||
<checkout-config-edit :appId="currentAppId" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane :key="2" tab="PC收银配置">
|
||||
<checkout-group-config-list :appId="currentAppId" type="pc" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane :key="3" tab="H5收银配置">
|
||||
<checkout-group-config-list :appId="currentAppId" type="h5" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane :key="4" tab="聚合支付配置">
|
||||
<checkout-aggregate-config-list :appId="currentAppId" />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</basic-drawer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { BasicDrawer } from '@/components/Drawer'
|
||||
import { ref } from 'vue'
|
||||
import CheckoutConfigEdit from './CheckoutConfigEdit.vue'
|
||||
import CheckoutGroupConfigList from './CheckoutGroupConfigList.vue'
|
||||
import CheckoutAggregateConfigList from './CheckoutAggregateConfigList.vue'
|
||||
|
||||
const visible = ref(false)
|
||||
const activeKey = ref(1)
|
||||
const currentAppId = ref('')
|
||||
|
||||
/**
|
||||
* 入口
|
||||
*/
|
||||
function init(appId: string) {
|
||||
visible.value = true
|
||||
activeKey.value = 1
|
||||
currentAppId.value = appId
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭页面
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false
|
||||
}
|
||||
|
||||
defineExpose({ init })
|
||||
</script>
|
||||
|
||||
<style scoped lang="less"></style>
|
||||
@@ -0,0 +1,148 @@
|
||||
<template>
|
||||
<basic-modal
|
||||
title="收银台分组配置"
|
||||
v-bind="$attrs"
|
||||
:loading="confirmLoading"
|
||||
:width="750"
|
||||
:open="visible"
|
||||
:mask-closable="showable"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form
|
||||
class="small-from-item"
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:validate-trigger="['blur', 'change']"
|
||||
:label-col="labelCol"
|
||||
:wrapper-col="wrapperCol"
|
||||
>
|
||||
<a-form-item label="主键" name="id" :hidden="true">
|
||||
<a-input v-model:value="form.id" :disabled="showable" />
|
||||
</a-form-item>
|
||||
<a-form-item label="分类名称" name="name">
|
||||
<a-input
|
||||
v-model:value="form.name"
|
||||
:disabled="showable"
|
||||
placeholder="请输入分类配置名称"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" name="sort">
|
||||
<a-input-number
|
||||
v-model:value="form.sortNo"
|
||||
:disabled="showable"
|
||||
placeholder="请输入排序"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
<template #footer>
|
||||
<a-space>
|
||||
<a-button key="cancel" @click="handleCancel">取消</a-button>
|
||||
<a-button
|
||||
v-if="!showable"
|
||||
key="forward"
|
||||
:loading="confirmLoading"
|
||||
type="primary"
|
||||
@click="handleOk"
|
||||
>保存</a-button
|
||||
>
|
||||
</a-space>
|
||||
</template>
|
||||
</basic-modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { BasicModal } from '@/components/Modal'
|
||||
import useFormEdit from '@/hooks/bootx/useFormEdit'
|
||||
import { FormEditType } from '@/enums/formTypeEnum'
|
||||
import {
|
||||
saveGroupConfig,
|
||||
updateGroupConfig,
|
||||
CheckoutGroupConfig,
|
||||
getGroupConfig,
|
||||
} from './CheckoutConfig.api'
|
||||
import { nextTick, ref, unref } from 'vue'
|
||||
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
|
||||
|
||||
const props = defineProps({
|
||||
appId: String,
|
||||
type: String,
|
||||
})
|
||||
|
||||
const {
|
||||
handleCancel,
|
||||
initFormEditType,
|
||||
formEditType,
|
||||
confirmLoading,
|
||||
visible,
|
||||
showable,
|
||||
labelCol,
|
||||
wrapperCol,
|
||||
} = useFormEdit()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
let form = ref<CheckoutGroupConfig>({
|
||||
sortNo: 0,
|
||||
})
|
||||
// 校验
|
||||
const rules = {
|
||||
code: [{ required: true, message: '' }],
|
||||
name: [{ required: true, message: '请输入码牌名称' }],
|
||||
enable: [{ required: true, message: '是否启用' }],
|
||||
} as Record<string, Rule[]>
|
||||
|
||||
// 事件
|
||||
const emits = defineEmits(['ok'])
|
||||
|
||||
/**
|
||||
* 入口
|
||||
*/
|
||||
function init(id, editType: FormEditType) {
|
||||
initFormEditType(editType)
|
||||
resetForm()
|
||||
getInfo(id, editType)
|
||||
}
|
||||
|
||||
// 获取信息
|
||||
function getInfo(id, editType: FormEditType) {
|
||||
if ([FormEditType.Edit, FormEditType.Show].includes(editType)) {
|
||||
confirmLoading.value = true
|
||||
getGroupConfig(id).then(({ data }) => {
|
||||
form.value = data
|
||||
confirmLoading.value = false
|
||||
})
|
||||
} else {
|
||||
confirmLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
function handleOk() {
|
||||
formRef.value?.validate().then(async () => {
|
||||
confirmLoading.value = true
|
||||
form.value.appId = props.appId
|
||||
form.value.type = props.type
|
||||
if (formEditType.value === FormEditType.Add) {
|
||||
await saveGroupConfig(unref(form)).finally(() => (confirmLoading.value = false))
|
||||
} else if (formEditType.value === FormEditType.Edit) {
|
||||
await updateGroupConfig(unref(form)).finally(() => (confirmLoading.value = false))
|
||||
}
|
||||
handleCancel()
|
||||
emits('ok')
|
||||
})
|
||||
}
|
||||
// 重置表单的校验
|
||||
function resetForm() {
|
||||
nextTick(() => {
|
||||
formRef.value?.resetFields()
|
||||
})
|
||||
}
|
||||
defineExpose({ init })
|
||||
</script>
|
||||
|
||||
<style scoped lang="less"></style>
|
||||
@@ -0,0 +1,119 @@
|
||||
<template>
|
||||
<div>
|
||||
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }">
|
||||
<template #buttons>
|
||||
<a-space>
|
||||
<a-button type="primary" pre-icon="ant-design:plus-outlined" @click="add">新建</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</vxe-toolbar>
|
||||
<vxe-table ey-field="id" ref="xTable" :data="records" :loading="loading">
|
||||
<vxe-column type="seq" width="60" />
|
||||
|
||||
<vxe-column field="name" title="分组名称" :min-width="150">
|
||||
<template #default="{ row }">
|
||||
<a href="javascript:" @click="show(row)">{{ row.name }}</a>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="sortNo" title="排序" :min-width="150" />
|
||||
<vxe-column field="createTime" title="创建时间" :min-width="170" />
|
||||
<vxe-column fixed="right" :width="180" :showOverflow="false" title="操作">
|
||||
<template #default="{ row }">
|
||||
<a href="javascript:" @click="edit(row)">编辑</a>
|
||||
<a-divider type="vertical" />
|
||||
<a href="javascript:" @click="list(row)">配置项</a>
|
||||
<a-divider type="vertical" />
|
||||
<a href="javascript:" style="color: red" @click="del(row)">删除</a>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
<CheckoutItemConfigList ref="checkoutItemConfigList" :appId="appId" :type="type" />
|
||||
<CheckoutGroupConfigEdit
|
||||
ref="checkoutGroupConfigEdit"
|
||||
:appId="appId"
|
||||
:type="type"
|
||||
@ok="queryPage"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { CheckoutGroupConfig, delGroupConfig, getGroupConfigs } from './CheckoutConfig.api'
|
||||
import { useMessage } from '@/hooks/web/useMessage'
|
||||
import CheckoutItemConfigList from './CheckoutItemConfigList.vue'
|
||||
import CheckoutGroupConfigEdit from '@/views/daxpay/common/config/checkout/CheckoutGroupConfigEdit.vue'
|
||||
import { FormEditType } from '@/enums/formTypeEnum'
|
||||
|
||||
const { createMessage, createConfirm } = useMessage()
|
||||
|
||||
const loading = ref(false)
|
||||
const records = ref<CheckoutGroupConfig[]>([])
|
||||
|
||||
const checkoutItemConfigList = ref<any>()
|
||||
const checkoutGroupConfigEdit = ref<any>()
|
||||
|
||||
const props = defineProps({
|
||||
appId: String,
|
||||
type: String,
|
||||
})
|
||||
|
||||
onMounted(() => queryPage())
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
function queryPage() {
|
||||
loading.value = true
|
||||
getGroupConfigs(props.appId, props.type).then(({ data }) => {
|
||||
records.value = data
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
checkoutGroupConfigEdit.value.init(null, FormEditType.Add)
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
checkoutGroupConfigEdit.value.init(record.id, FormEditType.Edit)
|
||||
}
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
function show(record) {
|
||||
checkoutGroupConfigEdit.value.init(record.id, FormEditType.Show)
|
||||
}
|
||||
/**
|
||||
* 配置项列表
|
||||
*/
|
||||
function list(record) {
|
||||
checkoutItemConfigList.value.init(record.id)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function del(record) {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '删除',
|
||||
content: '是否删除该数据',
|
||||
onOk: () => {
|
||||
loading.value = true
|
||||
delGroupConfig(record.id).then(() => {
|
||||
createMessage.success('删除成功')
|
||||
queryPage()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less"></style>
|
||||
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<basic-modal
|
||||
v-bind="$attrs"
|
||||
:loading="confirmLoading"
|
||||
:width="modalWidth"
|
||||
:title="title"
|
||||
:open="visible"
|
||||
:mask-closable="showable"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<a-form
|
||||
class="small-from-item"
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:validate-trigger="['blur', 'change']"
|
||||
:label-col="labelCol"
|
||||
:wrapper-col="wrapperCol"
|
||||
>
|
||||
<a-form-item label="主键" name="id" :hidden="true">
|
||||
<a-input v-model:value="form.id" :disabled="showable" />
|
||||
</a-form-item>
|
||||
<a-form-item label="名称" name="name">
|
||||
<a-input v-model:value="form.name" :disabled="showable" placeholder="请输入配置项名称" />
|
||||
</a-form-item>
|
||||
<a-form-item label="调用方式" validate-first name="callType">
|
||||
<a-select
|
||||
v-model:value="form.callType"
|
||||
:disabled="showable"
|
||||
:options="callTypeTypeList"
|
||||
allow-clear
|
||||
placeholder="请选择收银台类型"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="支付通道" name="channel">
|
||||
<a-select
|
||||
v-model:value="form.channel"
|
||||
:disabled="showable"
|
||||
:options="channelList"
|
||||
allow-clear
|
||||
placeholder="请选择支付通道"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="支付方式" name="payMethod">
|
||||
<a-select
|
||||
v-model:value="form.payMethod"
|
||||
:disabled="showable"
|
||||
:options="methodList"
|
||||
allow-clear
|
||||
placeholder="请选择支付方式"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" name="sort">
|
||||
<a-input-number v-model:value="form.sortNo" :disabled="showable" placeholder="请输入排序" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<template #footer>
|
||||
<a-space>
|
||||
<a-button key="cancel" @click="handleCancel">取消</a-button>
|
||||
<a-button
|
||||
v-if="!showable"
|
||||
key="forward"
|
||||
:loading="confirmLoading"
|
||||
type="primary"
|
||||
@click="handleOk"
|
||||
>保存</a-button
|
||||
>
|
||||
</a-space>
|
||||
</template>
|
||||
</basic-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { nextTick, onMounted, reactive, ref, unref } from 'vue'
|
||||
import useFormEdit from '@/hooks/bootx/useFormEdit'
|
||||
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
|
||||
import { FormEditType } from '@/enums/formTypeEnum'
|
||||
import { BasicModal } from '@/components/Modal'
|
||||
import { LabeledValue } from 'ant-design-vue/lib/select'
|
||||
import {
|
||||
getItemConfig,
|
||||
saveItemConfig,
|
||||
updateItemConfig,
|
||||
CheckoutItemConfig,
|
||||
} from './CheckoutConfig.api'
|
||||
import { useDict } from '@/hooks/bootx/useDict'
|
||||
|
||||
const {
|
||||
initFormEditType,
|
||||
handleCancel,
|
||||
labelCol,
|
||||
wrapperCol,
|
||||
modalWidth,
|
||||
title,
|
||||
confirmLoading,
|
||||
visible,
|
||||
showable,
|
||||
formEditType,
|
||||
} = useFormEdit()
|
||||
|
||||
const { dictDropDown } = useDict()
|
||||
|
||||
// 表单
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
const callTypeTypeList = ref<LabeledValue[]>([])
|
||||
const channelList = ref<LabeledValue[]>([])
|
||||
const methodList = ref<LabeledValue[]>([])
|
||||
|
||||
let form = ref<CheckoutItemConfig>({})
|
||||
// 校验
|
||||
const rules = reactive({
|
||||
name: [{ required: true, message: '请输入配置项名称' }],
|
||||
callType: [{ required: true, message: '请选择支付通道' }],
|
||||
channel: [{ required: true, message: '请选择支付通道' }],
|
||||
payMethod: [{ required: true, message: '请选择支付方式' }],
|
||||
} as Record<string, Rule[]>)
|
||||
|
||||
// 事件
|
||||
const emits = defineEmits(['ok'])
|
||||
|
||||
onMounted(() => {
|
||||
initData()
|
||||
})
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
async function initData() {
|
||||
callTypeTypeList.value = await dictDropDown('checkout_call_type')
|
||||
channelList.value = await dictDropDown('channel')
|
||||
methodList.value = await dictDropDown('pay_method')
|
||||
}
|
||||
|
||||
/**
|
||||
* 入口
|
||||
*/
|
||||
function init(id, editType: FormEditType, groupId: string) {
|
||||
initFormEditType(editType)
|
||||
resetForm()
|
||||
form.value.groupId = unref(groupId)
|
||||
getInfo(id, editType)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息
|
||||
*/
|
||||
function getInfo(id, editType: FormEditType) {
|
||||
if ([FormEditType.Edit, FormEditType.Show].includes(editType)) {
|
||||
confirmLoading.value = true
|
||||
getItemConfig(id).then(({ data }) => {
|
||||
form.value = data
|
||||
confirmLoading.value = false
|
||||
})
|
||||
} else {
|
||||
confirmLoading.value = false
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
function handleOk() {
|
||||
formRef.value?.validate().then(async () => {
|
||||
confirmLoading.value = true
|
||||
if (formEditType.value === FormEditType.Add) {
|
||||
await saveItemConfig(form.value).finally(() => (confirmLoading.value = false))
|
||||
} else if (formEditType.value === FormEditType.Edit) {
|
||||
await updateItemConfig(form.value).finally(() => (confirmLoading.value = false))
|
||||
}
|
||||
handleCancel()
|
||||
emits('ok')
|
||||
})
|
||||
}
|
||||
|
||||
// 重置表单的校验
|
||||
function resetForm() {
|
||||
nextTick(() => {
|
||||
formRef.value?.resetFields()
|
||||
})
|
||||
}
|
||||
defineExpose({
|
||||
init,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -0,0 +1,142 @@
|
||||
<template>
|
||||
<basic-drawer
|
||||
v-bind="$attrs"
|
||||
width="70%"
|
||||
title="收银台配置项管理"
|
||||
:mask-closable="true"
|
||||
:open="visible"
|
||||
@close="handleCancel"
|
||||
>
|
||||
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }">
|
||||
<template #buttons>
|
||||
<a-space>
|
||||
<a-button type="primary" pre-icon="ant-design:plus-outlined" @click="add">新建</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</vxe-toolbar>
|
||||
<vxe-table ey-field="id" ref="xTable" :data="records" :loading="loading">
|
||||
<vxe-column type="seq" width="60" />
|
||||
<vxe-column field="name" title="名称" :min-width="150" />
|
||||
<vxe-column field="callType" title="调用方式" :min-width="150">
|
||||
<template #default="{ row }">
|
||||
{{ dictConvert('checkout_call_type', row.callType) }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="channel" title="支付通道" :min-width="150">
|
||||
<template #default="{ row }">
|
||||
{{ dictConvert('channel', row.channel) }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="payMethod" title="支付方式" :min-width="150">
|
||||
<template #default="{ row }">
|
||||
{{ dictConvert('pay_method', row.payMethod) }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="sortNo" title="排序" :min-width="50" />
|
||||
<vxe-column field="createTime" title="创建时间" :min-width="170" />
|
||||
<vxe-column fixed="right" :width="150" :showOverflow="false" title="操作">
|
||||
<template #default="{ row }">
|
||||
<a href="javascript:" @click="show(row)">查看</a>
|
||||
<a-divider type="vertical" />
|
||||
<a href="javascript:" @click="edit(row)">编辑</a>
|
||||
<a-divider type="vertical" />
|
||||
<a href="javascript:" style="color: red" @click="del(row)">删除</a>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
<CheckoutItemConfigEdit ref="checkoutItemConfigEdit" @ok="queryPage" :appId="appId" />
|
||||
</basic-drawer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { BasicDrawer } from '@/components/Drawer'
|
||||
import { ref } from 'vue'
|
||||
import { delItemConfig, getItemConfigs, CheckoutItemConfig } from './CheckoutConfig.api'
|
||||
import { FormEditType } from '@/enums/formTypeEnum'
|
||||
import { useMessage } from '@/hooks/web/useMessage'
|
||||
import { useDict } from '@/hooks/bootx/useDict'
|
||||
import CheckoutItemConfigEdit from './CheckoutItemConfigEdit.vue'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const props = defineProps({
|
||||
appId: String,
|
||||
})
|
||||
|
||||
const { createConfirm, createMessage } = useMessage()
|
||||
const { dictConvert } = useDict()
|
||||
|
||||
const currentGroupId = ref<string>('')
|
||||
const loading = ref(false)
|
||||
const visible = ref(false)
|
||||
const records = ref<CheckoutItemConfig[]>([])
|
||||
|
||||
const checkoutItemConfigEdit = ref<any>()
|
||||
/**
|
||||
* 初始化并展示
|
||||
*/
|
||||
async function init(groupId) {
|
||||
visible.value = true
|
||||
loading.value = false
|
||||
currentGroupId.value = groupId
|
||||
queryPage()
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function queryPage() {
|
||||
// 列表信息
|
||||
loading.value = true
|
||||
getItemConfigs(currentGroupId.value).then(({ data }) => {
|
||||
records.value = data
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭页面
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
checkoutItemConfigEdit.value.init(null, FormEditType.Add, currentGroupId.value)
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
checkoutItemConfigEdit.value.init(record.id, FormEditType.Edit, currentGroupId.value)
|
||||
}
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
function show(record) {
|
||||
checkoutItemConfigEdit.value.init(record.id, FormEditType.Show, currentGroupId.value)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function del(record) {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '删除',
|
||||
content: '是否删除该数据',
|
||||
onOk: () => {
|
||||
loading.value = true
|
||||
delItemConfig(record.id).then(() => {
|
||||
createMessage.success('删除成功')
|
||||
queryPage()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
defineExpose({
|
||||
init,
|
||||
})
|
||||
</script>
|
||||
<style scoped lang="less"></style>
|
||||
@@ -117,7 +117,6 @@
|
||||
const {
|
||||
initFormEditType,
|
||||
handleCancel,
|
||||
search,
|
||||
labelCol,
|
||||
wrapperCol,
|
||||
title,
|
||||
|
||||
@@ -67,9 +67,9 @@
|
||||
<a-menu-item>
|
||||
<a-link @click="showCashierCode(row)">码牌配置</a-link>
|
||||
</a-menu-item>
|
||||
<!-- <a-menu-item>-->
|
||||
<!-- <a-link @click="showAllocConfig(row)">分账配置</a-link>-->
|
||||
<!-- </a-menu-item>-->
|
||||
<!-- <a-menu-item>-->
|
||||
<!-- <a-link @click="showAllocConfig(row)">分账配置</a-link>-->
|
||||
<!-- </a-menu-item>-->
|
||||
<a-menu-item>
|
||||
<a-link @click="showAllocReceiver(row)">分账接收方</a-link>
|
||||
</a-menu-item>
|
||||
@@ -98,6 +98,7 @@
|
||||
<channel-config-list ref="channelSetup" />
|
||||
<MerchantNotifyConfigList ref="merchantNotifyConfigList" />
|
||||
<CashierCodeConfigList ref="cashierCodeConfigList" />
|
||||
<CheckoutConfigModel ref="checkoutConfigModel" />
|
||||
<AllocationReceiverList ref="allocationReceiverList" />
|
||||
<AllocationGroupList ref="allocationGroupList" />
|
||||
</div>
|
||||
@@ -122,6 +123,7 @@
|
||||
import AllocationReceiverList from '@/views/daxpay/common/allocation/receiver/AllocationReceiverList.vue'
|
||||
import AllocationGroupList from '@/views/daxpay/common/allocation/group/AllocationGroupList.vue'
|
||||
import CashierCodeConfigList from '@/views/daxpay/common/config/cashier/code/CashierCodeConfigList.vue'
|
||||
import CheckoutConfigModel from '@/views/daxpay/common/config/checkout/CheckoutConfigModel.vue'
|
||||
|
||||
// 使用hooks
|
||||
const {
|
||||
@@ -149,6 +151,7 @@
|
||||
const channelSetup = ref<any>()
|
||||
const merchantNotifyConfigList = ref<any>()
|
||||
const cashierCodeConfigList = ref<any>()
|
||||
const checkoutConfigModel = ref<any>()
|
||||
const allocationReceiverList = ref<any>()
|
||||
const allocationGroupList = ref<any>()
|
||||
|
||||
@@ -207,13 +210,13 @@
|
||||
* 收银台配置
|
||||
*/
|
||||
function showCheckoutConfig(record) {
|
||||
checkoutConfigModel.value.init(record.appId)
|
||||
}
|
||||
/**
|
||||
* 收银码牌配置
|
||||
*/
|
||||
function showCashierCode(record) {
|
||||
cashierCodeConfigList.value.init(record.appId)
|
||||
|
||||
}
|
||||
/**
|
||||
* 分账配置
|
||||
|
||||
Reference in New Issue
Block a user