一些页面实现
This commit is contained in:
2
.env
2
.env
@@ -1,5 +1,5 @@
|
||||
# 标题
|
||||
VITE_APP_TITLE=超级管理系统
|
||||
VITE_APP_TITLE=自助下单
|
||||
|
||||
# 项目本地运行端口号
|
||||
VITE_PORT=80
|
||||
|
18
src/api/kfc/outInterface/agiso/index.ts
Normal file
18
src/api/kfc/outInterface/agiso/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
/** 阿奇索配置信息 */
|
||||
// export interface LoginConfig {
|
||||
// id: number // 主键ID
|
||||
// username?: string // 登录用户名
|
||||
// password?: string // 登录密码
|
||||
// status?: number // 状态:0-禁用,1-启用
|
||||
// remark: string // 备注
|
||||
// }
|
||||
|
||||
// 阿奇索配置 API
|
||||
export const AgisoApi = {
|
||||
// 获取阿奇索code认证授权链接
|
||||
getAuthCodeUrl: async () => {
|
||||
return await request.get({ url: `/agiso/get/code-url` })
|
||||
}
|
||||
}
|
49
src/api/kfc/outInterface/third/index.ts
Normal file
49
src/api/kfc/outInterface/third/index.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
/** KFC登录配置信息 */
|
||||
export interface LoginConfig {
|
||||
id: number // 主键ID
|
||||
username?: string // 登录用户名
|
||||
password?: string // 登录密码
|
||||
type?: string //账号类型
|
||||
status?: number // 状态:1-禁用,0-启用
|
||||
remark: string // 备注
|
||||
}
|
||||
|
||||
// KFC登录配置 API
|
||||
export const LoginConfigApi = {
|
||||
// 查询KFC登录配置分页
|
||||
getLoginConfigPage: async (params: any) => {
|
||||
return await request.get({ url: `/kfc/login-config/page`, params })
|
||||
},
|
||||
|
||||
// 查询KFC登录配置详情
|
||||
getLoginConfig: async (id: number) => {
|
||||
return await request.get({ url: `/kfc/login-config/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增KFC登录配置
|
||||
createLoginConfig: async (data: LoginConfig) => {
|
||||
return await request.post({ url: `/kfc/login-config/create`, data })
|
||||
},
|
||||
|
||||
// 修改KFC登录配置
|
||||
updateLoginConfig: async (data: LoginConfig) => {
|
||||
return await request.put({ url: `/kfc/login-config/update`, data })
|
||||
},
|
||||
|
||||
// 删除KFC登录配置
|
||||
deleteLoginConfig: async (id: number) => {
|
||||
return await request.delete({ url: `/kfc/login-config/delete?id=` + id })
|
||||
},
|
||||
|
||||
/** 批量删除KFC登录配置 */
|
||||
deleteLoginConfigList: async (ids: number[]) => {
|
||||
return await request.delete({ url: `/kfc/login-config/delete-list?ids=${ids.join(',')}` })
|
||||
},
|
||||
|
||||
// 导出KFC登录配置 Excel
|
||||
exportLoginConfig: async (params) => {
|
||||
return await request.download({ url: `/kfc/login-config/export-excel`, params })
|
||||
}
|
||||
}
|
@@ -2,22 +2,22 @@ import request from '@/config/axios'
|
||||
|
||||
/** 商品基本信息信息 */
|
||||
export interface Product {
|
||||
id: number; // ID
|
||||
activityId: string; // 活动ID
|
||||
buyType?: number; // 购买类型
|
||||
categoryName: string; // 分类名称
|
||||
imageUrl: string; // 图片URL
|
||||
inventory?: number; // 库存数量
|
||||
linkId: string; // 关联ID
|
||||
notify: string; // 通知信息
|
||||
orderPrice?: number; // 订单价格
|
||||
price?: number; // 商品价格
|
||||
showNameCn: string; // 中文显示名称
|
||||
singleFlag?: number; // 单品标记(0-否,1-是)
|
||||
source?: number; // 来源渠道
|
||||
timeEnd?: number; // 结束时间(时间戳)
|
||||
timeStart?: number; // 开始时间(时间戳)
|
||||
}
|
||||
id: number // ID
|
||||
activityId: string // 活动ID
|
||||
buyType?: number // 购买类型
|
||||
categoryName: string // 分类名称
|
||||
imageUrl: string // 图片URL
|
||||
inventory?: number // 库存数量
|
||||
linkId: string // 关联ID
|
||||
notify: string // 通知信息
|
||||
orderPrice?: number // 订单价格
|
||||
price?: number // 商品价格
|
||||
showNameCn: string // 中文显示名称
|
||||
singleFlag?: number // 单品标记(0-否,1-是)
|
||||
source?: number // 来源渠道
|
||||
timeEnd?: number // 结束时间(时间戳)
|
||||
timeStart?: number // 开始时间(时间戳)
|
||||
}
|
||||
|
||||
// 商品基本信息 API
|
||||
export const ProductApi = {
|
||||
@@ -55,16 +55,19 @@ export const ProductApi = {
|
||||
exportProduct: async (params) => {
|
||||
return await request.download({ url: `/kfc/product/export-excel`, params })
|
||||
},
|
||||
//查询kfc商品分类
|
||||
getKFCProductCategory: async()=>{
|
||||
|
||||
//通过第三方查询kfc商品分类
|
||||
getKFCProductCategory: async () => {
|
||||
return await request.get({ url: `/kfc/product/get/outProduct/sort` })
|
||||
},
|
||||
//查询kfc商品表单
|
||||
getKFCProductForm: async(id:string)=>{
|
||||
return await request.get({ url: `/kfc/product/get/outProduct/form?id=${id}`})
|
||||
|
||||
//通过第三方查询kfc商品表单
|
||||
getKFCProductForm: async (id: string) => {
|
||||
return await request.get({ url: `/kfc/product/get/outProduct/form?id=${id}` })
|
||||
},
|
||||
//查询kfc商品规格详情
|
||||
getKFCProductDetail: async(linkId:string)=>{
|
||||
|
||||
//通过第三方查询kfc商品规格详情
|
||||
getKFCProductDetail: async (linkId: string) => {
|
||||
return await request.get({ url: `/kfc/product/get/outProduct/detail?linkId=${linkId}` })
|
||||
}
|
||||
}
|
||||
|
@@ -53,7 +53,8 @@ const whiteList = [
|
||||
'/auth-redirect',
|
||||
'/bind',
|
||||
'/register',
|
||||
'/oauthLogin/gitee'
|
||||
'/oauthLogin/gitee',
|
||||
'/store'
|
||||
]
|
||||
|
||||
// 路由加载前
|
||||
|
@@ -12,7 +12,7 @@ const router = createRouter({
|
||||
})
|
||||
|
||||
export const resetRouter = (): void => {
|
||||
const resetWhiteNameList = ['Redirect', 'Login', 'NoFound', 'Home']
|
||||
const resetWhiteNameList = ['Redirect', 'Login', 'NoFound', 'Home', 'Store']
|
||||
router.getRoutes().forEach((route) => {
|
||||
const { name } = route
|
||||
if (name && !resetWhiteNameList.includes(name as string)) {
|
||||
|
@@ -33,6 +33,15 @@ const { t } = useI18n()
|
||||
}
|
||||
**/
|
||||
const remainingRouter: AppRouteRecordRaw[] = [
|
||||
{
|
||||
path: '/store',
|
||||
component: () => import('@/views/kfc/store/index.vue'),
|
||||
name: 'Store',
|
||||
meta: {
|
||||
hidden: true,
|
||||
noTagsView: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/redirect',
|
||||
component: Layout,
|
||||
|
@@ -247,12 +247,13 @@ export enum DICT_TYPE {
|
||||
IOT_DATA_BRIDGE_TYPE_ENUM = 'iot_data_bridge_type_enum', // 桥梁类型
|
||||
|
||||
// ============代下单模块=============
|
||||
ALARM_TYPE='alarm_type',
|
||||
TRADE_LOG_TYPE='trade_log_type',
|
||||
ALARM_STATUS='alarm_status',
|
||||
ALARM_CONFIG_STATUS='alarm_config_status',
|
||||
ALARM_NOTIFY_WAY='alarm_notify_way',
|
||||
ALARM_TYPE = 'alarm_type',
|
||||
TRADE_LOG_TYPE = 'trade_log_type',
|
||||
ALARM_STATUS = 'alarm_status',
|
||||
ALARM_CONFIG_STATUS = 'alarm_config_status',
|
||||
ALARM_NOTIFY_WAY = 'alarm_notify_way',
|
||||
KFC_INT_STRING = 'kfc_int_string',
|
||||
COUPON_RULE_TYPE = 'coupon_rule_type',
|
||||
MEMBER_CARD_TYPE = 'member_card_type'
|
||||
MEMBER_CARD_TYPE = 'member_card_type',
|
||||
THIRD_PARTY_LOGIN_ACCOUNT_TYPE = 'third_party_login_account_type'
|
||||
}
|
||||
|
@@ -71,7 +71,7 @@
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="账户创建时间" prop="createTime">
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
@@ -138,8 +138,8 @@
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="账户ID" align="center" prop="id" />
|
||||
<el-table-column label="关联会员ID(外键)" align="center" prop="memberId" />
|
||||
<el-table-column label="账户编号(唯一)" align="center" prop="accountNo" />
|
||||
<el-table-column label="关联会员ID" align="center" prop="memberId" />
|
||||
<el-table-column label="账户编号" align="center" prop="accountNo" />
|
||||
<el-table-column label="账户总余额" align="center" prop="totalBalance" />
|
||||
<el-table-column label="可用余额" align="center" prop="availableBalance" />
|
||||
<el-table-column label="冻结余额" align="center" prop="frozenBalance" />
|
||||
|
258
src/views/kfc/outInterface/agiso/index.vue
Normal file
258
src/views/kfc/outInterface/agiso/index.vue
Normal file
@@ -0,0 +1,258 @@
|
||||
<template>
|
||||
<div class="auth-container">
|
||||
<div class="card">
|
||||
<h2 class="card-title">
|
||||
<i class="fa fa-key text-primary mr-2"></i>
|
||||
阿奇索授权链接生成
|
||||
</h2>
|
||||
|
||||
<p class="card-description"> 点击下方按钮获取授权链接,用于阿奇索系统认证 </p>
|
||||
|
||||
<button @click="fetchAuthUrl" :disabled="isLoading" class="generate-btn">
|
||||
<i class="fa fa-refresh mr-2" :class="{ 'fa-spin': isLoading }"></i>
|
||||
{{ isLoading ? '获取中...' : '生成授权链接,有效期10分钟' }}
|
||||
</button>
|
||||
|
||||
<!-- 链接展示与复制区域 -->
|
||||
<div v-if="authUrl" class="url-box mt-4">
|
||||
<div class="url-display">
|
||||
<input
|
||||
type="text"
|
||||
v-model="authUrl"
|
||||
readonly
|
||||
class="url-input"
|
||||
:class="{ copied: isCopied }"
|
||||
placeholder="授权链接将显示在这里"
|
||||
/>
|
||||
<button @click="copyToClipboard" class="copy-btn">
|
||||
<i class="fa fa-copy mr-1"></i>
|
||||
{{ isCopied ? '已复制' : '复制' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="url-hint text-sm text-gray-500 mt-2">
|
||||
复制链接后,在浏览器中打开进行授权操作
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 错误提示 -->
|
||||
<div v-if="errorMessage" class="error-message mt-4">
|
||||
<i class="fa fa-exclamation-circle mr-2"></i>
|
||||
{{ errorMessage }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { AgisoApi } from '@/api/kfc/outInterface/agiso'
|
||||
|
||||
// 状态管理
|
||||
const authUrl = ref('')
|
||||
const isLoading = ref(false)
|
||||
const isCopied = ref(false)
|
||||
const errorMessage = ref('')
|
||||
|
||||
/**
|
||||
* 调用API获取授权链接
|
||||
*/
|
||||
const fetchAuthUrl = async () => {
|
||||
try {
|
||||
// 重置状态
|
||||
isLoading.value = true
|
||||
errorMessage.value = ''
|
||||
authUrl.value = ''
|
||||
|
||||
// 调用API
|
||||
const response = await AgisoApi.getAuthCodeUrl()
|
||||
|
||||
// 假设接口返回格式为 { code: 200, data: string }
|
||||
authUrl.value = response
|
||||
} catch (error) {
|
||||
console.error('获取授权链接出错:', error)
|
||||
errorMessage.value = '网络错误,无法获取授权链接'
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制链接到剪贴板
|
||||
*/
|
||||
const copyToClipboard = () => {
|
||||
if (!authUrl.value) return
|
||||
|
||||
navigator.clipboard
|
||||
.writeText(authUrl.value)
|
||||
.then(() => {
|
||||
isCopied.value = true
|
||||
// 3秒后重置复制状态
|
||||
setTimeout(() => {
|
||||
isCopied.value = false
|
||||
}, 3000)
|
||||
})
|
||||
.catch(() => {
|
||||
errorMessage.value = '复制失败,请手动复制链接'
|
||||
// 5秒后清除错误提示
|
||||
setTimeout(() => {
|
||||
errorMessage.value = ''
|
||||
}, 5000)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.auth-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 300px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
padding: 24px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.card-title {
|
||||
margin: 0 0 16px;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #1f2329;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.card-description {
|
||||
margin: 0 0 24px;
|
||||
color: #6b7280;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.generate-btn {
|
||||
width: 100%;
|
||||
padding: 10px 16px;
|
||||
background-color: #2563eb;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.generate-btn:hover:not(:disabled) {
|
||||
background-color: #1d4ed8;
|
||||
}
|
||||
|
||||
.generate-btn:disabled {
|
||||
background-color: #93c5fd;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.url-box {
|
||||
animation: fadeIn 0.3s ease;
|
||||
}
|
||||
|
||||
.url-display {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.url-input {
|
||||
flex: 1;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
color: #1f2329;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
.url-input:focus {
|
||||
outline: none;
|
||||
border-color: #60a5fa;
|
||||
}
|
||||
|
||||
.url-input.copied {
|
||||
border-color: #10b981;
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
padding: 0 12px;
|
||||
background-color: #10b981;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.copy-btn:hover {
|
||||
background-color: #059669;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
padding: 8px 12px;
|
||||
background-color: #fee2e2;
|
||||
border: 1px solid #fecaca;
|
||||
border-radius: 6px;
|
||||
color: #dc2626;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
animation: shake 0.5s ease;
|
||||
}
|
||||
|
||||
.url-hint {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.url-hint::before {
|
||||
content: '💡';
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
0%,
|
||||
100% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
20%,
|
||||
60% {
|
||||
transform: translateX(-3px);
|
||||
}
|
||||
40%,
|
||||
80% {
|
||||
transform: translateX(3px);
|
||||
}
|
||||
}
|
||||
</style>
|
130
src/views/kfc/outInterface/third/LoginConfigForm.vue
Normal file
130
src/views/kfc/outInterface/third/LoginConfigForm.vue
Normal file
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="登录用户名" prop="username">
|
||||
<el-input v-model="formData.username" placeholder="请输入登录用户名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="登录密码" prop="password">
|
||||
<el-input v-model="formData.password" placeholder="请输入登录密码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="账号类型" prop="t'y'petype">
|
||||
<el-select v-model="formData.type" placeholder="请选择类型" clearable class="!w-240px">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.THIRD_PARTY_LOGIN_ACCOUNT_TYPE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="formData.status">
|
||||
<el-radio
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { LoginConfigApi, LoginConfig } from '@/api/kfc/outInterface/third'
|
||||
|
||||
/** KFC登录配置 表单 */
|
||||
defineOptions({ name: 'LoginConfigForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
username: undefined,
|
||||
password: undefined,
|
||||
type: undefined,
|
||||
status: undefined,
|
||||
remark: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
username: [{ required: true, message: '登录用户名不能为空', trigger: 'blur' }],
|
||||
password: [{ required: true, message: '登录密码不能为空', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '状态:0-禁用,1-启用不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await LoginConfigApi.getLoginConfig(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as LoginConfig
|
||||
if (formType.value === 'create') {
|
||||
await LoginConfigApi.createLoginConfig(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await LoginConfigApi.updateLoginConfig(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
username: undefined,
|
||||
type: undefined,
|
||||
password: undefined,
|
||||
status: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
276
src/views/kfc/outInterface/third/index.vue
Normal file
276
src/views/kfc/outInterface/third/index.vue
Normal file
@@ -0,0 +1,276 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input
|
||||
v-model="queryParams.username"
|
||||
placeholder="请输入用户名"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="登录密码" prop="password">
|
||||
<el-input
|
||||
v-model="queryParams.password"
|
||||
placeholder="请输入登录密码"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="账号类型" prop="t'y'petype">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择类型" clearable class="!w-240px">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.THIRD_PARTY_LOGIN_ACCOUNT_TYPE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="queryParams.remark"
|
||||
placeholder="请输入备注"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-220px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['kfc:login-config:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['kfc:login-config:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
:disabled="isEmpty(checkedIds)"
|
||||
@click="handleDeleteBatch"
|
||||
v-hasPermi="['kfc:login-config:delete']"
|
||||
>
|
||||
<Icon icon="ep:delete" class="mr-5px" /> 批量删除
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table
|
||||
row-key="id"
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
@selection-change="handleRowCheckboxChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="主键ID" align="center" prop="id" />
|
||||
<el-table-column label="登录用户名" align="center" prop="username" />
|
||||
<el-table-column label="登录密码" align="center" prop="password" />
|
||||
<el-table-column label="账号类型" align="center" prop="type">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.THIRD_PARTY_LOGIN_ACCOUNT_TYPE" :value="scope.row.type" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center" min-width="120px">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['kfc:login-config:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['kfc:login-config:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<LoginConfigForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { isEmpty } from '@/utils/is'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { LoginConfigApi, LoginConfig } from '@/api/kfc/outInterface/third'
|
||||
import LoginConfigForm from './LoginConfigForm.vue'
|
||||
|
||||
/** KFC登录配置 列表 */
|
||||
defineOptions({ name: 'LoginConfig' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<LoginConfig[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
username: undefined,
|
||||
password: undefined,
|
||||
type: undefined,
|
||||
status: undefined,
|
||||
remark: undefined,
|
||||
createTime: []
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await LoginConfigApi.getLoginConfigPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await LoginConfigApi.deleteLoginConfig(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 批量删除KFC登录配置 */
|
||||
const handleDeleteBatch = async () => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
await LoginConfigApi.deleteLoginConfigList(checkedIds.value)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
const checkedIds = ref<number[]>([])
|
||||
const handleRowCheckboxChange = (records: LoginConfig[]) => {
|
||||
checkedIds.value = records.map((item) => item.id)
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await LoginConfigApi.exportLoginConfig(queryParams)
|
||||
download.excel(data, 'KFC登录配置.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
@@ -2,47 +2,38 @@
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="80%">
|
||||
<div v-loading="formLoading" class="loading-container">
|
||||
<!-- 基础信息表格 -->
|
||||
<el-table :data="baseInfoTableData" border style="margin-bottom: 20px;">
|
||||
<el-table :data="baseInfoTableData" border style="margin-bottom: 20px">
|
||||
<el-table-column prop="label" label="基础信息" width="180" align="center" />
|
||||
<el-table-column prop="value" label="详情" align="left" />
|
||||
</el-table>
|
||||
|
||||
<!-- 餐品分类表格 -->
|
||||
<el-table
|
||||
:data="categoryTableData"
|
||||
border
|
||||
style="margin-bottom: 10px;"
|
||||
row-key="round"
|
||||
>
|
||||
<el-table :data="categoryTableData" border style="margin-bottom: 10px" row-key="round">
|
||||
<el-table-column prop="roundNameCn" label="分类名称" width="150" />
|
||||
<el-table-column prop="round" label="排序" width="80" align="center" />
|
||||
<el-table-column label="餐品列表" align="left">
|
||||
<template #default="scope">
|
||||
<el-table
|
||||
:data="scope.row.condimentItemList"
|
||||
border
|
||||
<el-table
|
||||
:data="scope.row.condimentItemList"
|
||||
border
|
||||
size="small"
|
||||
style="width: 100%;"
|
||||
style="width: 100%"
|
||||
row-key="linkId"
|
||||
>
|
||||
<el-table-column prop="showNameCn" label="显示名称" width="180" />
|
||||
<el-table-column prop="nameCn" label="商品名称" width="180" />
|
||||
<el-table-column
|
||||
prop="price"
|
||||
label="价格"
|
||||
width="100"
|
||||
<el-table-column
|
||||
prop="price"
|
||||
label="价格"
|
||||
width="100"
|
||||
align="right"
|
||||
:formatter="(row) => row.price === 0 ? '0' : (row.price / 100).toFixed(2)"
|
||||
:formatter="(row) => (row.price === 0 ? '0' : (row.price / 100).toFixed(2))"
|
||||
/>
|
||||
<el-table-column prop="quantity" label="数量" width="80" align="center" />
|
||||
<el-table-column prop="linkId" label="商品ID" width="150" />
|
||||
<el-table-column prop="imageUrl" label="图片URL">
|
||||
<template #default="itemScope">
|
||||
<el-input
|
||||
v-model="itemScope.row.imageUrl"
|
||||
disabled
|
||||
style="width: 300px;"
|
||||
/>
|
||||
<el-input v-model="itemScope.row.imageUrl" disabled style="width: 300px" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -50,7 +41,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">关 闭</el-button>
|
||||
</template>
|
||||
@@ -95,13 +86,13 @@ const formData = ref({
|
||||
// 基础信息表格数据(转换为键值对格式)
|
||||
const baseInfoTableData = computed(() => [
|
||||
{ label: '关联ID', value: formData.value.linkId },
|
||||
{
|
||||
label: '禁用状态',
|
||||
value: formData.value.disabledStatus === 0 ? '启用' : '禁用'
|
||||
{
|
||||
label: '禁用状态',
|
||||
value: formData.value.disabledStatus === 0 ? '启用' : '禁用'
|
||||
},
|
||||
{
|
||||
label: '销售状态',
|
||||
value: formData.value.saleFlag === 'Y' ? '在售' : '下架'
|
||||
{
|
||||
label: '销售状态',
|
||||
value: formData.value.saleFlag === 'Y' ? '在售' : '下架'
|
||||
}
|
||||
])
|
||||
|
||||
@@ -113,13 +104,9 @@ const open = async (linkId: string) => {
|
||||
dialogVisible.value = true
|
||||
formLoading.value = true
|
||||
try {
|
||||
// 调用接口获取数据(假设接口返回格式为 {code:0, data: {disabledStatus, ...}})
|
||||
const response = await ProductApi.getKFCProductDetail(linkId)
|
||||
// if (response.code === 0) {
|
||||
formData.value = { ...formData.value, ...response}
|
||||
// } else {
|
||||
// message.error(`加载失败:${response.msg || '未知错误'}`)
|
||||
// }
|
||||
|
||||
formData.value = { ...formData.value, ...response }
|
||||
} catch (error) {
|
||||
message.error(t('common.loadFail'))
|
||||
console.error('数据加载失败:', error)
|
||||
@@ -135,4 +122,4 @@ defineExpose({ open })
|
||||
min-height: 300px;
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@@ -351,7 +351,6 @@ const submitOrder = async () => {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('订单提交失败', error)
|
||||
ElMessage.error('网络异常,订单提交失败,请重试')
|
||||
} finally {
|
||||
loadingInstance.close()
|
||||
}
|
||||
|
Reference in New Issue
Block a user