feat 设备管理

This commit is contained in:
bootx
2025-08-26 16:35:50 +08:00
parent 92cca39a13
commit 842e25d438
11 changed files with 953 additions and 343 deletions

View File

@@ -0,0 +1,175 @@
import { defHttp } from '@/utils/http/axios'
import { PageResult, Result } from '#/axios'
import { MchEntity } from '#/web'
import { LabeledValue } from 'ant-design-vue/lib/select'
/**
* 分页查询
*/
export function page(queryParam) {
return defHttp.get<Result<PageResult<CashierCodeConfig>>>({
url: '/admin/cashier/code/config/page',
params: queryParam,
})
}
/**
* 查询配置详情
*/
export function get(id) {
return defHttp.get<Result<CashierCodeConfig>>({
url: '/admin/cashier/code/config/findById',
params: { id },
})
}
/**
* 码牌配置保存
*/
export function save(data) {
return defHttp.post<Result<string>>({
url: '/admin/cashier/code/config/save',
data,
})
}
/**
* 码牌配置更新
*/
export function update(data) {
return defHttp.post<Result<string>>({
url: '/admin/cashier/code/config/update',
data,
})
}
/**
* 码牌配置删除
*/
export function del(id) {
return defHttp.post<Result<string>>({
url: '/admin/cashier/code/config/remove',
params: { id },
})
}
/**
* 获取码牌支付场景配置列表
*/
export function getCodeSceneConfigs(configId) {
return defHttp.get<Result<Array<CashierCodeSceneConfig>>>({
url: '/admin/cashier/code/config/scene/findAll',
params: { configId },
})
}
/**
* 获取支付场景配置
*/
export function getCodeSceneConfig(id) {
return defHttp.get<Result<CashierCodeSceneConfig>>({
url: '/admin/cashier/code/config/scene/findById',
params: { id },
})
}
/**
* 码牌支付场景配置保存
*/
export function saveCodeSceneConfig(data) {
return defHttp.post<Result<string>>({
url: '/admin/cashier/code/config/scene/save',
data,
})
}
/**
* 码牌支付场景配置更新
*/
export function updateCodeSceneConfig(data) {
return defHttp.post<Result<string>>({
url: '/admin/cashier/code/config/scene/update',
data,
})
}
/**
* 码牌支付场景配置删除
*/
export function removeCodeSceneConfig(id) {
return defHttp.post<Result<string>>({
url: '/admin/cashier/code/config/scene/remove',
params: { id },
})
}
/**
* 码牌支付场景配置是否存在
*/
export function existsCodeSceneConfig(configId, scene) {
return defHttp.get<Result<boolean>>({
url: '/admin/cashier/code/config/scene/exists',
params: { configId, scene },
})
}
/**
* 码牌支付场景配置是否存在
*/
export function existsCodeSceneConfigNotId(configId, scene, id) {
return defHttp.get<Result<boolean>>({
url: '/admin/cashier/code/config/scene/existsNotId',
params: { configId, scene, id },
})
}
/**
* 下拉
*/
export function dropdown(){
return defHttp.get<Result<LabeledValue[]>>({
url: '/admin/cashier/code/config/dropdown',
})
}
/**
* 收银码牌配置
*/
export interface CashierCodeConfig extends MchEntity {
/** 配置名称 */
name?: string
/** 是否启用 */
enable?: boolean
/** 是否开启分账 */
allocation?: boolean
/** 自动分账 */
autoAllocation?: boolean
/** 限制用户支付方式 */
limitPay?: string
/** 备注 */
remark?: string
}
/**
* 码牌支付配置明细
* @author xxm
* @since 2024/11/20
*/
export interface CashierCodeSceneConfig extends MchEntity{
/** 配置ID */
configId?: string
/** 收银场景 */
scene?: string
/** 支付通道 */
channel?: string
/** 支付方式 */
payMethod?: string
/** 其他支付方式 */
otherMethod?: string
/** 需要获取OpenId */
needOpenId?: boolean
/** OpenId获取方式 */
openIdGetType?: string
/** 发起调用的类型 */
callType?: string
}

View File

@@ -0,0 +1,172 @@
<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="enable">-->
<!-- <a-switch-->
<!-- :disabled="showable"-->
<!-- v-model:checked="form.enable"-->
<!-- checked-children="是"-->
<!-- un-checked-children="否"-->
<!-- />-->
<!-- </a-form-item>-->
<a-form-item label="开启分账" name="allocation">
<a-switch
:disabled="showable"
v-model:checked="form.allocation"
checked-children=""
un-checked-children=""
/>
</a-form-item>
<a-form-item label="自动分账" name="autoAllocation">
<a-switch
:disabled="showable"
v-model:checked="form.autoAllocation"
checked-children=""
un-checked-children=""
/>
</a-form-item>
<a-form-item label="限制用户支付类型" name="limitPay">
<a-select
allow-clear
:disabled="showable"
v-model:value="form.limitPay"
:options="[{ label: '信用卡支付', value: 'no_credit' }]"
placeholder="请选择限制用户支付的类型"
/>
</a-form-item>
<a-form-item label="备注" name="remark">
<a-textarea
:rows="3"
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>
<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 { save, update, CashierCodeConfig, get } from './CashierCodeConfig.api'
import { nextTick, ref, unref } from 'vue'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
const {
handleCancel,
initFormEditType,
formEditType,
confirmLoading,
visible,
showable,
labelCol,
wrapperCol,
} = useFormEdit()
const addOrEdit = ref('')
const formRef = ref<FormInstance>()
let form = ref<CashierCodeConfig>({
enable: true,
allocation: false,
autoAllocation: false,
})
// 校验
const rules = {
code: [{ required: true, message: '' }],
name: [{ required: true, message: '请输入配置名称' }],
enable: [{ required: true, message: '请选择码牌是否启用' }],
allocation: [{ required: true, message: '请选择是否开启分账' }],
autoAllocation: [{ 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)) {
addOrEdit.value = 'edit'
confirmLoading.value = true
get(id).then(({ data }) => {
form.value = data
confirmLoading.value = false
})
} else {
addOrEdit.value = 'add'
confirmLoading.value = false
}
}
/**
* 保存
*/
function handleOk() {
formRef.value?.validate().then(async () => {
confirmLoading.value = true
if (formEditType.value === FormEditType.Add) {
await save(unref(form)).finally(() => (confirmLoading.value = false))
} else if (formEditType.value === FormEditType.Edit) {
await update(unref(form)).finally(() => (confirmLoading.value = false))
}
handleCancel()
emits('ok')
})
}
// 重置表单的校验
function resetForm() {
nextTick(() => {
formRef.value?.resetFields()
})
}
defineExpose({ init })
</script>
<style scoped lang="less"></style>

View File

@@ -0,0 +1,182 @@
<template>
<div>
<div class="m-3 p-3 pt-5 bg-white">
<b-query
:query-params="model.queryParam"
:fields="fields"
@query="queryPage"
@reset="resetQueryParams"
/>
</div>
<div class="m-3 p-3 bg-white">
<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>
<div class="h-65vh">
<vxe-table
height="auto"
ref="xTable"
key-field="id"
:data="pagination.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="allocation" title="分账" align="center" :min-width="100">
<template #default="{ row }">
<a-tag :color="row.allocation ? 'green' : 'red'">
{{ row.allocation ? '开启' : '关闭' }}
</a-tag>
</template>
</vxe-column>
<vxe-column field="autoAllocation" title="自动分账" align="center" :min-width="100">
<template #default="{ row }">
<a-tag :color="row.autoAllocation ? 'green' : 'red'">
{{ row.autoAllocation ? '开启' : '关闭' }}
</a-tag>
</template>
</vxe-column>
<vxe-column field="remark" title="备注" :min-width="150" />
<vxe-column field="createTime" title="创建时间" :min-width="140" />
<vxe-column fixed="right" :width="200" :showOverflow="false" title="操作">
<template #default="{ row }">
<a-link @click="edit(row)">编辑</a-link>
<a-divider type="vertical" />
<a-link @click="sceneConfig(row)">场景配置</a-link>
<a-divider type="vertical" />
<a-link danger @click="remove(row)">删除</a-link>
</template>
</vxe-column>
</vxe-table>
</div>
<vxe-pager
size="medium"
:loading="loading"
:current-page="pagination.current"
:page-size="pagination.size"
:total="pagination.total"
@page-change="handleTableChange"
/>
</div>
<CashierCodeConfigEdit ref="cashierCodeConfigEdit" @ok="queryPage" />
<CashierCodeSceneList ref="cashierCodeSceneConfig" />
</div>
</template>
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue'
import { del, page } from './CashierCodeConfig.api'
import useTablePage from '@/hooks/bootx/useTablePage'
import BQuery from '@/components/Bootx/Query/BQuery.vue'
import { LIST, QueryField, STRING } from '@/components/Bootx/Query/Query'
import { useMessage } from '@/hooks/web/useMessage'
import { VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
import CashierCodeConfigEdit from './CashierCodeConfigEdit.vue'
import { FormEditType } from '@/enums/formTypeEnum'
import CashierCodeSceneList from './CashierCodeSceneList.vue'
import ALink from '@/components/Link/Link.vue'
// 使用hooks
const {
handleTableChange,
pageQueryResHandel,
resetQueryParams,
pagination,
pages,
model,
loading,
} = useTablePage(queryPage)
const { createMessage, createConfirm } = useMessage()
// 查询条件
const fields = computed(() => {
return [
{
type: STRING,
field: 'name',
name: '配置名称',
placeholder: '请输入配置名称',
},
] as QueryField[]
})
const xTable = ref<VxeTableInstance>()
const xToolbar = ref<VxeToolbarInstance>()
const cashierCodeConfigEdit = ref<any>()
const cashierCodeSceneConfig = ref<any>()
onMounted(() => {
vxeBind()
queryPage()
})
function vxeBind() {
xTable.value?.connect(xToolbar.value as VxeToolbarInstance)
}
/**
* 分页查询
*/
function queryPage() {
loading.value = true
page({
...model.queryParam,
...pages,
}).then(({ data }) => {
pageQueryResHandel(data)
})
return Promise.resolve()
}
/**
* 创建配置
*/
function add() {
cashierCodeConfigEdit.value.init(null, FormEditType.Add)
}
/**
* 编辑
*/
function edit(record) {
cashierCodeConfigEdit.value.init(record.id, FormEditType.Edit)
}
/**
* 查看
*/
function show(record) {
cashierCodeConfigEdit.value.init(record.id, FormEditType.Show)
}
/**
* 支付场景配置
*/
function sceneConfig(record) {
cashierCodeSceneConfig.value.init(record.id)
}
// 删除
function remove(record) {
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否删除该条数据',
onOk: () => {
del(record.id).then(() => {
createMessage.success('删除成功')
queryPage()
})
},
})
}
</script>
<style lang="less" scoped></style>

View File

@@ -0,0 +1,266 @@
<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="支付场景" validate-first name="scene">
<a-select
v-model:value="form.scene"
:disabled="showable"
:options="sceneList"
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
@change="changeChannel"
placeholder="请选择支付通道"
/>
</a-form-item>
<a-form-item label="支付方式" name="payMethod">
<a-select
v-model:value="form.payMethod"
:disabled="showable"
:options="methodList"
@change="changePayMethod"
allow-clear
placeholder="请选择支付方式"
/>
</a-form-item>
<a-form-item label="其他支付方式" name="otherMethod" v-if="form.payMethod == 'other'">
<a-select
v-model:value="form.otherMethod"
:disabled="showable"
:options="otherMethodList"
allow-clear
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="获取OpenId" name="needOpenId">
<a-switch
checked-children=""
un-checked-children=""
v-model:checked="form.needOpenId"
:disabled="showable"
/>
</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 { computed, nextTick, onMounted, 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 {
saveCodeSceneConfig,
getCodeSceneConfig,
existsCodeSceneConfig,
existsCodeSceneConfigNotId,
updateCodeSceneConfig,
CashierCodeSceneConfig,
} from './CashierCodeConfig.api'
import { useDict } from '@/hooks/bootx/useDict'
import { payMethodList } from '@/views/daxpay/common/assist/basic/ChannelBasic.api'
const {
initFormEditType,
handleCancel,
labelCol,
wrapperCol,
modalWidth,
title,
confirmLoading,
visible,
showable,
formEditType,
} = useFormEdit()
const { dictDropDown } = useDict()
// 表单
const formRef = ref<FormInstance>()
const sceneList = ref<LabeledValue[]>([])
const channelList = ref<LabeledValue[]>([])
const methodList = ref<LabeledValue[]>([])
const otherMethodList = ref<LabeledValue[]>([])
const callTypeTypeList = ref<LabeledValue[]>([])
let form = ref<CashierCodeSceneConfig>({
needOpenId: false,
})
// 校验
const rules = computed(() => {
return {
scene: [
{ required: true, message: '请选择码牌支付场景' },
{ validator: validateCode, trigger: 'blur' },
],
channel: [{ required: true, message: '请选择支付通道' }],
payMethod: [{ required: true, message: '请选择支付方式' }],
otherMethod: [{ required: true, message: '请选择其他付方式' }],
callType: [{ required: true, message: '请选择支付调用方式' }],
needOpenId: [{ required: true, message: '请选择是否需要获取OpenId' }],
} as Record<string, Rule[]>
})
// 事件
const emits = defineEmits(['ok'])
onMounted(() => {
initData()
})
/**
* 初始化数据
*/
async function initData() {
callTypeTypeList.value = await dictDropDown('gateway_call_type')
sceneList.value = await dictDropDown('cashier_scene')
channelList.value = await dictDropDown('channel')
}
/**
* 入口
*/
function init(id, editType: FormEditType, configId: string) {
initFormEditType(editType)
resetForm()
form.value.configId = unref(configId)
getInfo(id, editType)
}
/**
* 支付方式发生改变(只要切换,就将其他支付方式置空)
*/
function changePayMethod() {
form.value.otherMethod = undefined
}
/**
* 支付通道切换
*/
function changeChannel() {
form.value.payMethod = undefined
form.value.otherMethod = undefined
initPayMethod()
}
/**
* 获取支付方式
*/
async function initPayMethod() {
if (form.value.channel) {
payMethodList(form.value.channel).then(({ data }) => {
methodList.value = data
})
} else {
methodList.value = []
}
// 获取其他支付方式列表
otherMethodList.value = await dictDropDown(`${form.value.channel}_method`)
}
/**
* 获取信息
*/
function getInfo(id, editType: FormEditType) {
if ([FormEditType.Edit, FormEditType.Show].includes(editType)) {
confirmLoading.value = true
getCodeSceneConfig(id).then(({ data }) => {
form.value = data
initPayMethod()
confirmLoading.value = false
})
} else {
confirmLoading.value = false
}
}
/**
* 保存
*/
function handleOk() {
formRef.value?.validate().then(async () => {
confirmLoading.value = true
if (formEditType.value === FormEditType.Add) {
await saveCodeSceneConfig(form.value).finally(() => (confirmLoading.value = false))
} else if (formEditType.value === FormEditType.Edit) {
await updateCodeSceneConfig(form.value).finally(() => (confirmLoading.value = false))
}
handleCancel()
emits('ok')
})
}
/**
* 校验编码重复(明天搞这里)
*/
async function validateCode() {
const { configId, scene, id } = form.value
if (id) {
const res = await existsCodeSceneConfigNotId(configId, scene, id)
return res.data ? Promise.reject('该码牌类型已存在') : Promise.resolve()
} else {
const res = await existsCodeSceneConfig(configId, scene)
return res.data ? Promise.reject('该码牌类型已存在') : Promise.resolve()
}
}
// 重置表单的校验
function resetForm() {
nextTick(() => {
formRef.value?.resetFields()
})
}
defineExpose({
init,
})
</script>
<style lang="less" scoped></style>

View File

@@ -0,0 +1,156 @@
<template>
<basic-modal
destroyOnClose
:footer="null"
width="75%"
title="码牌支付场景配置"
:mask-closable="true"
:open="visible"
@cancel="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="scene" title="场景" align="center" :min-width="150">
<template #default="{ row }">
{{ dictConvert('cashier_scene', row.scene) }}
</template>
</vxe-column>
<vxe-column field="channel" title="支付通道" align="center" :min-width="100">
<template #default="{ row }">
{{ dictConvert('channel', row.channel) }}
</template>
</vxe-column>
<vxe-column field="payMethod" title="支付方式" align="center" :min-width="150">
<template #default="{ row }">
<template v-if="row.payMethod === PayMethodEnum.OTHER">
{{ dictConvert(`${row.channel}_method`, row.otherMethod) }}
</template>
<template v-else>
{{ dictConvert('pay_method', row.payMethod) }}
</template>
</template>
</vxe-column>
<vxe-column field="needOpenId" title="获取OpenId" align="center" :min-width="150">
<template #default="{ row }">
<a-tag :color="row.needOpenId ? 'green' : 'red'">
{{ row.needOpenId ? '需要' : '不需要' }}
</a-tag>
</template>
</vxe-column>
<vxe-column field="callType" title="调用类型" align="center" :min-width="150">
<template #default="{ row }">
{{ dictConvert('gateway_call_type', row.callType) }}
</template>
</vxe-column>
<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>
<cashier-code-scene-edit ref="codeCardSceneConfigEdit" @ok="queryPage" />
</basic-modal>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import {
CashierCodeSceneConfig,
getCodeSceneConfigs,
removeCodeSceneConfig,
} from './CashierCodeConfig.api'
import { FormEditType } from '@/enums/formTypeEnum'
import { useMessage } from '@/hooks/web/useMessage'
import { useDict } from '@/hooks/bootx/useDict'
import BasicModal from '@/components/Modal/src/BasicModal.vue'
import { PayMethodEnum } from '@/enums/daxpay/daxpayEnum'
import CashierCodeSceneEdit from '@/views/daxpay/admin/device/qrcode/config/CashierCodeSceneEdit.vue'
const { createConfirm, createMessage } = useMessage()
const { dictConvert } = useDict()
const currentConfigId = ref<string>('')
const loading = ref(false)
const visible = ref(false)
const records = ref<CashierCodeSceneConfig[]>([])
const codeCardSceneConfigEdit = ref<any>()
/**
* 初始化并展示
*/
async function init(configId) {
visible.value = true
currentConfigId.value = configId
queryPage()
}
/**
* 查询
*/
function queryPage() {
// 列表信息
loading.value = true
getCodeSceneConfigs(currentConfigId.value).then(({ data }) => {
records.value = data
loading.value = false
})
}
/**
* 关闭页面
*/
function handleCancel() {
visible.value = false
}
/**
* 新增
*/
function add() {
codeCardSceneConfigEdit.value.init(null, FormEditType.Add, currentConfigId.value)
}
/**
* 编辑
*/
function edit(record) {
codeCardSceneConfigEdit.value.init(record.id, FormEditType.Edit, currentConfigId.value)
}
/**
* 查看
*/
function show(record) {
codeCardSceneConfigEdit.value.init(record.id, FormEditType.Show, currentConfigId.value)
}
/**
* 删除
*/
function del(record) {
createConfirm({
iconType: 'warning',
title: '删除',
content: '是否删除该数据',
onOk: () => {
loading.value = true
removeCodeSceneConfig(record.id).then(() => {
createMessage.success('删除成功')
queryPage()
})
},
})
}
defineExpose({
init,
})
</script>
<style scoped lang="less"></style>

View File

@@ -1,114 +0,0 @@
<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="agentNo">
<a-select
style="width: 100%"
v-model:value="form.agentNo"
:options="agentOptions"
allow-clear
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/src/BasicModal.vue'
import useFormEdit from '@/hooks/bootx/useFormEdit'
import { computed, nextTick, ref } from 'vue'
import { Rule } from 'ant-design-vue/lib/form'
import { dropdown as agentDropdown } from '@/views/daxpay/common/assist/basic/AgentQuery.api'
import { LabeledValue } from 'ant-design-vue/lib/select'
import { useMessage } from '@/hooks/web/useMessage'
import { assignAgent } from '@/views/daxpay/common/device/qrcode/CashierCode.api'
import type { FormInstance } from 'ant-design-vue'
const { createConfirm, createMessage } = useMessage()
const { handleCancel, confirmLoading, visible, showable, labelCol, wrapperCol } = useFormEdit()
const form = ref({
agentNo: undefined,
ids: [] as string[],
})
const formRef = ref<FormInstance>()
const agentOptions = ref<LabeledValue[]>([])
const emits = defineEmits(['ok'])
// 校验
const rules = computed(() => {
return {
agentNo: [{ required: true, message: '请选择要划拨的代理商' }],
} as Record<string, Rule[]>
})
/**
* 初始化
*/
function init(ids: string[]) {
initData()
visible.value = true
nextTick(() => formRef.value?.resetFields())
form.value.ids = ids
}
function initData() {
// 初始化所属代理商列表
agentDropdown().then(({ data }) => (agentOptions.value = data))
}
/**
* 保存
*/
function handleOk() {
formRef.value?.validate().then(() => {
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否将选中的码牌划拨给该代理商',
onOk: () => {
return assignAgent(form.value).then(() => {
createMessage.success('划拨成功')
handleCancel()
emits('ok')
})
},
})
})
}
defineExpose({
init,
})
</script>
<style scoped lang="less"></style>

View File

@@ -42,26 +42,6 @@ export function update(data) {
})
}
/**
* 分配代理商
*/
export function assignAgent(data) {
return defHttp.post<Result<void>>({
url: '/cashier/code/assignAgent',
data,
})
}
/**
* 取消分配代理商
*/
export function recoverAgent(data){
return defHttp.post<Result<void>>({
url: '/cashier/code/recoverAgent',
data,
})
}
/**
* 绑定商户和应用
*/

View File

@@ -19,12 +19,6 @@
<a-button post-icon="ant-design:down-outlined"> 批量操作 </a-button>
<template #overlay>
<a-menu>
<a-menu-item v-if="isAdmin()">
<a-link @click="assistAgent()">代理商划拨</a-link>
</a-menu-item>
<a-menu-item v-if="isAdmin()">
<a-link @click="recoverAgentInfo()">代理商回收</a-link>
</a-menu-item>
<a-menu-item v-if="isAgent() || isAdmin()">
<a-link @click="bindMchApp()">商户应用绑定</a-link>
</a-menu-item>
@@ -131,7 +125,6 @@
</a-modal>
<CashierCodeCreate ref="cashierCodeCreate" @ok="queryPage" />
<CashierCodeEdit ref="cashierCodeEdit" @ok="queryPage" />
<AssistAgentModel ref="assistAgentModel" @ok="queryPage" />
<BindMchAppModel ref="bindMchAppModel" @ok="queryPage" />
<BindAppModel ref="bindAppModel" @ok="queryPage" />
</div>
@@ -149,7 +142,6 @@
import CashierCodeCreate from './CashierCodeCreate.vue'
import CashierCodeEdit from './CashierCodeEdit.vue'
import ALink from '@/components/Link/Link.vue'
import AssistAgentModel from './AssistAgentModel.vue'
import BindMchAppModel from './BindMchAppModel.vue'
import BindAppModel from './BindAppModel.vue'
import { isAdmin, isAgent, isMerchant } from '@/utils/env'
@@ -196,7 +188,6 @@
const xToolbar = ref<VxeToolbarInstance>()
const cashierCodeCreate = ref<any>()
const cashierCodeEdit = ref<any>()
const assistAgentModel = ref<any>()
const bindMchAppModel = ref<any>()
const bindAppModel = ref<any>()
@@ -268,31 +259,6 @@
cashierCodeEdit.value.init(record.id, FormEditType.Show)
}
/**
* 分配代理商
*/
function assistAgent() {
const ids = xTable.value?.getCheckboxRecords().map((o) => o.id)
assistAgentModel.value.init(ids)
}
/**
* 回收代理商
*/
function recoverAgentInfo() {
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否从代理商中回收选中的码牌',
onOk: () => {
const ids = xTable.value?.getCheckboxRecords().map((o) => o.id)
recoverAgent({ ids }).then(() => {
createMessage.success('回收成功')
queryPage()
})
},
})
}
/**
* 绑定商户和应用
*/

View File

@@ -1,114 +0,0 @@
<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="agentNo">
<a-select
style="width: 100%"
v-model:value="form.agentNo"
:options="agentOptions"
allow-clear
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/src/BasicModal.vue'
import useFormEdit from '@/hooks/bootx/useFormEdit'
import { computed, nextTick, ref } from 'vue'
import { Rule } from 'ant-design-vue/lib/form'
import { dropdown as agentDropdown } from '@/views/daxpay/common/assist/basic/AgentQuery.api'
import { LabeledValue } from 'ant-design-vue/lib/select'
import { useMessage } from '@/hooks/web/useMessage'
import { assignAgent } from './TerminalDevice.api'
import type { FormInstance } from 'ant-design-vue'
const { createConfirm, createMessage } = useMessage()
const { handleCancel, confirmLoading, visible, showable, labelCol, wrapperCol } = useFormEdit()
const form = ref({
agentNo: undefined,
ids: [] as string[],
})
const formRef = ref<FormInstance>()
const agentOptions = ref<LabeledValue[]>([])
const emits = defineEmits(['ok'])
// 校验
const rules = computed(() => {
return {
agentNo: [{ required: true, message: '请选择要划拨的代理商' }],
} as Record<string, Rule[]>
})
/**
* 初始化
*/
function init(ids: string[]) {
initData()
visible.value = true
nextTick(() => formRef.value?.resetFields())
form.value.ids = ids
}
function initData() {
// 初始化所属代理商列表
agentDropdown().then(({ data }) => (agentOptions.value = data))
}
/**
* 保存
*/
function handleOk() {
formRef.value?.validate().then(() => {
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否将选中的支付辅助终端划拨给该代理商',
onOk: () => {
return assignAgent(form.value).then(() => {
createMessage.success('划拨成功')
handleCancel()
emits('ok')
})
},
})
})
}
defineExpose({
init,
})
</script>
<style scoped lang="less"></style>

View File

@@ -23,26 +23,6 @@ export function get(id: string) {
})
}
/**
* 分配代理商
*/
export function assignAgent(data) {
return defHttp.post<Result<void>>({
url: '/device/terminal/assignAgent',
data,
})
}
/**
* 取消分配代理商
*/
export function recoverAgent(data) {
return defHttp.post<Result<void>>({
url: '/device/terminal/recoverAgent',
data,
})
}
/**
* 绑定商户和应用
*/

View File

@@ -23,15 +23,9 @@
<template #overlay>
<a-menu>
<a-menu-item v-if="isAdmin()">
<a-link @click="assistAgent()">代理商划拨</a-link>
</a-menu-item>
<a-menu-item v-if="isAdmin()">
<a-link @click="recoverAgentInfo()">代理商回收</a-link>
</a-menu-item>
<a-menu-item v-if="isAgent() || isAdmin()">
<a-link @click="bindMchApp()">商户应用绑定</a-link>
</a-menu-item>
<a-menu-item v-if="isAgent() || isAdmin()">
<a-menu-item v-if="isAdmin()">
<a-link @click="unbindMchApp()">商户应用解绑</a-link>
</a-menu-item>
<a-menu-item v-if="isMerchant()">
@@ -77,11 +71,6 @@
<a-tag :color="row.gps ? 'green' : 'red'">{{ row.gps ? '支持' : '不支持' }}</a-tag>
</template>
</vxe-column>
<vxe-column field="agentName" title="代理商" v-if="isAdmin()" :min-width="150">
<template #default="{ row }">
{{ row.agentName }}
</template>
</vxe-column>
<vxe-column field="mchName" title="商户" v-if="isAdmin() || isAgent()" :min-width="150">
<template #default="{ row }">
{{ row.mchName || '未绑定' }}
@@ -115,7 +104,6 @@
</div>
<TerminalDeviceEdit :app-id="currentAppId" ref="terminalDeviceEdit" @ok="queryPage" />
<ChannelTerminalList ref="channelTerminalList" />
<AssistAgentModel ref="assistAgentModel" @ok="queryPage" />
<BindMchAppModel ref="bindMchAppModel" @ok="queryPage" />
<BindAppModel ref="bindAppModel" @ok="queryPage" />
</div>
@@ -123,7 +111,7 @@
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue'
import { page, recoverAgent, remove, unbindApp, unbindMch } from './TerminalDevice.api'
import { page, remove, unbindApp, unbindMch } from './TerminalDevice.api'
import useTablePage from '@/hooks/bootx/useTablePage'
import { VxeTable, VxeTableInstance, VxeToolbar, VxeToolbarInstance } from 'vxe-table'
import BQuery from '@/components/Bootx/Query/BQuery.vue'
@@ -135,7 +123,6 @@
import { LabeledValue } from 'ant-design-vue/lib/select'
import TerminalDeviceEdit from './TerminalDeviceEdit.vue'
import ChannelTerminalList from './channel/ChannelTerminalList.vue'
import AssistAgentModel from './AssistAgentModel.vue'
import BindMchAppModel from './BindMchAppModel.vue'
import { isAdmin, isAgent, isMerchant } from '@/utils/env'
import BindAppModel from './BindAppModel.vue'
@@ -179,7 +166,6 @@
const xToolbar = ref<VxeToolbarInstance>()
const terminalDeviceEdit = ref<any>()
const channelTerminalList = ref<any>()
const assistAgentModel = ref<any>()
const bindMchAppModel = ref<any>()
const bindAppModel = ref<any>()
@@ -269,31 +255,6 @@
channelTerminalList.value.init(record.id)
}
/**
* 分配代理商
*/
function assistAgent() {
const ids = xTable.value?.getCheckboxRecords().map((o) => o.id)
assistAgentModel.value.init(ids)
}
/**
* 回收代理商
*/
function recoverAgentInfo() {
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否从代理商中回收选中的码牌',
onOk: () => {
const ids = xTable.value?.getCheckboxRecords().map((o) => o.id)
recoverAgent({ ids }).then(() => {
createMessage.success('回收成功')
queryPage()
})
},
})
}
/**
* 绑定商户和应用
*/