diff --git a/src/api/account/bwc.ts b/src/api/account/bwc.ts new file mode 100644 index 0000000..3a5fd8c --- /dev/null +++ b/src/api/account/bwc.ts @@ -0,0 +1,60 @@ +import request from "@/utils/request"; +import { Account_BaseUrl } from "@/api/config"; +const baseURL = Account_BaseUrl + "/admin/freeDing"; +const API = { + getList() { + return request({ + url: `${baseURL}`, + method: "get", + }); + }, + + edit(data: editRequest) { + return request({ + url: `${baseURL}`, + method: "put", + data: data, + }); + }, +} +export default API; +/** + * 修改信息 + * + * FreeDineConfigEditDTO + */ +export interface editRequest { + /** + * 是否启用 + */ + enable?: boolean | null; + /** + * 主键id + */ + id: number | null; + /** + * 充值说明 + */ + rechargeDesc?: null | string; + /** + * 满多少可用 + */ + rechargeThreshold?: number | null; + /** + * 充值倍数 + */ + rechargeTimes?: number | null; + /** + * 使用类型 dine-in店内 takeout 自取 post快递,takeaway外卖 + */ + useType?: string[] | null; + /** + * 与优惠券同享 + */ + withCoupon?: boolean | null; + /** + * 积分同享 + */ + withPoints?: boolean | null; + [property: string]: any; +} \ No newline at end of file diff --git a/src/api/account/callTable.ts b/src/api/account/callTable.ts new file mode 100644 index 0000000..fb5b4e1 --- /dev/null +++ b/src/api/account/callTable.ts @@ -0,0 +1,277 @@ +import request from "@/utils/request"; +import { Account_BaseUrl } from "@/api/config"; +const baseURL = Account_BaseUrl + "/admin/callTable"; +const API = { + // 获取叫号配置 + getConfig() { + return request({ + url: `${baseURL}/config`, + method: "get", + }); + }, + // 修改叫号配置 + editConfig(data: editConfigRequest) { + return request({ + url: `${baseURL}/config`, + method: "put", + data: data + }); + }, + // 叫号桌型获取 + getTable(params: getTableRequest) { + return request({ + url: `${baseURL}`, + method: "get", + params + }); + }, + addTable(data: addTableRequest) { + return request({ + url: `${baseURL}`, + method: "post", + data + }); + }, + editTable(data: editTableRequest) { + return request({ + url: `${baseURL}`, + method: "put", + data + }); + }, + deleteTable(data: deleteTableRequest) { + return request({ + url: `${baseURL}`, + method: "delete", + data + }); + }, + // 获取叫号号码 + getTakeNumber(data: getTableNumberRequest) { + return request({ + url: `${baseURL}/takeNumber`, + method: "post", + data + }); + }, + //获取叫号队列 + getTableNumberList(params: getTableNumberListRequest) { + return request({ + url: `${baseURL}/queue`, + method: "get", + params + }); + }, + //执行号码 + callTableCall(data: callTableCallRequest) { + return request({ + url: `${baseURL}/call`, + method: "post", + data + }); + }, + //获取叫号页面二维码 + callTableCode(params: callTableCodeRequest) { + return request({ + url: `${baseURL}/takeNumberCode`, + method: "get", + params + }); + }, + //修改叫号队列状态 + updateTableState(data: updateTableStateRequest) { + return request({ + url: `${baseURL}/updateState`, + method: "put", + data + }); + }, + // 获取叫号记录列表 + + getCallRecord(params: getCallRecordRequest) { + return request({ + url: `${baseURL}/callRecord`, + method: "get", + params + }); + }, +} +export default API; + +/** + * UpdateConfigDTO + */ +export interface editConfigRequest { + /** + * 背景图 + */ + bgCover?: null | string; + /** + * 是否线上取号 + */ + isOnline?: number | null; + /** + * 临近几桌提醒 + */ + nearNum?: number | null; + [property: string]: any; +} + +export interface getTableRequest { + /** + * 叫号桌型id + */ + callTableId?: number; + page?: string; + size?: string; + /** + * 0禁用 1使用 + */ + state?: number; + [property: string]: any; +} + +/** + * 新增数据 + * + * CallTableDTO + */ +export interface addTableRequest { + /** + * 是否顺延 + */ + isPostpone?: number | null; + /** + * 台桌名称 + */ + name: null | string; + /** + * 临近几桌提醒 + */ + nearNum: number | null; + /** + * 备注 + */ + note?: null | string; + /** + * 顺延数量 + */ + postponeNum?: number | null; + /** + * 前缀 + */ + prefix: null | string; + /** + * 起始号码 + */ + start: number | null; + /** + * 等待时间 + */ + waitTime: number | null; + [property: string]: any; +} + +/** + * UpdateCallTableDTO + */ +export interface editTableRequest { + callTableId: number | null; + name?: null | string; + nearNum?: number | null; + note?: null | string; + prefix?: null | string; + start?: number | null; + waitTime?: number | null; + [property: string]: any; +} + +/** + * BaseCallTableDTO + */ +export interface deleteTableRequest { + /** + * 叫号桌型id + */ + callTableId: number | null; + [property: string]: any; +} + +/** + * TakeNumberDTO + */ +export interface getTableNumberRequest { + /** + * 叫号桌型id + */ + callTableId: number | null; + /** + * 姓名 + */ + name?: null | string; + /** + * 备注 + */ + note?: null | string; + /** + * 手机号 + */ + phone: null | string; + /** + * 对应小程序用户id + */ + userId?: number | null; + [property: string]: any; +} +export interface Request { + /** + * 桌型id + */ + callTableId?: number; + /** + * 状态 -1已取消 0排队中 1叫号中 2已入座 3 已过号 + */ + state?: number; + [property: string]: any; +} +export interface getTableNumberListRequest { + /** + * 桌型id + */ + callTableId?: number; + /** + * 状态 -1已取消 0排队中 1叫号中 2已入座 3 已过号 + */ + state?: number; + [property: string]: any; +} +/** + * CallQueueDTO + */ +export interface callTableCallRequest { + callQueueId: number | null; + [property: string]: any; +} + +export interface callTableCodeRequest { + /** + * 叫号桌型id + */ + callTableId: number; + [property: string]: any; +} +/** + * UpdateCallQueueDTO + */ +export interface updateTableStateRequest { + callQueueId: number | null; + state: number | null; + [property: string]: any; +} +export interface getCallRecordRequest { + /** + * 桌型id + */ + callTableId?: number; + [property: string]: any; +} \ No newline at end of file diff --git a/src/api/account/coupon.ts b/src/api/account/coupon.ts new file mode 100644 index 0000000..67aa566 --- /dev/null +++ b/src/api/account/coupon.ts @@ -0,0 +1,130 @@ +import request from "@/utils/request"; +import { Account_BaseUrl } from "@/api/config"; +const baseURL = Account_BaseUrl + "/admin/coupon"; +const API = { + getList(params: getListRequest) { + return request({ + url: `${baseURL}`, + method: "get", + params + }); + }, + add(data: addRequest) { + return request({ + url: `${baseURL}`, + method: "post", + data: data, + }); + }, + + edit(data: editRequest) { + return request({ + url: `${baseURL}`, + method: "put", + data: data, + }); + }, +} +export default API; +export interface getListRequest { + status?: number; + type?: number; + [property: string]: any; +} +/** + * ShopCouponDTO + */ +export interface addRequest { + createTime?: string; + /** + * 隔多少天生效 + */ + daysToTakeEffect?: number; + /** + * 描述 + */ + description?: string; + /** + * 减多少金额 + */ + discountAmount?: number; + /** + * 发放人 + */ + editor?: string; + /** + * 满多少金额 + */ + fullAmount?: number; + /** + * 自增 + */ + id?: number; + /** + * 剩余数量 + */ + leftNumber?: number; + /** + * 发放数量 + */ + number?: number; + shopId?: number; + /** + * 状态0-关闭 1 正常 + */ + status?: number; + /** + * 名称(无意义) + */ + title?: string; + /** + * 1-满减 2-商品 + */ + type?: number; + updateTime?: string; + /** + * 可用结束时间 + */ + useEndTime?: string; + /** + * 已使用数量 + */ + useNumber?: number; + /** + * 周 数组["周一","周二"] + */ + userDays?: string; + /** + * 可用开始时间 + */ + useStartTime?: string; + /** + * all-全时段 custom-指定时段 + */ + useTimeType?: string; + /** + * 有效天数 + */ + validDays?: number; + /** + * 有效结束时间 + */ + validEndTime?: string; + /** + * 有效期类型,可选值为 fixed(固定时间)/custom(自定义时间) + */ + validityType?: string; + /** + * 有效开始时间 + */ + validStartTime?: string; + [property: string]: any; +} + +export interface editRequest extends addRequest { + /** + * 主键id + */ + id: number; + [property: string]: any; +} \ No newline at end of file diff --git a/src/api/account/printer.ts b/src/api/account/printer.ts new file mode 100644 index 0000000..386861b --- /dev/null +++ b/src/api/account/printer.ts @@ -0,0 +1,118 @@ +import request from "@/utils/request"; +import { Account_BaseUrl } from "@/api/config"; +const baseURL = Account_BaseUrl + "/admin/printer"; +const API = { + getList(data: getListRequest) { + return request({ + url: `${baseURL}`, + method: "get", + params: data + }); + }, + add(data: addRequest) { + return request({ + url: `${baseURL}`, + method: "post", + data: data, + }); + }, + delete(id: number | string) { + return request({ + url: `${baseURL}`, + method: "delete", + data: { id }, + }); + }, + edit(data: editRequest) { + return request({ + url: `${baseURL}`, + method: "put", + data: data, + }); + }, + get(id: number | string) { + return request({ + url: `${baseURL}/detail`, + method: "get", + params: { id } + }); + }, +} +export default API; +export interface getListRequest { + /** + * 类型 USB 网络 蓝牙 + */ + connectionType?: string; + /** + * 名称 + */ + name?: string; + [property: string]: any; +} +/** + * PrinterAddDTO + */ +export interface addRequest { + /** + * ip地址 + */ + address?: null | string; + /** + * 打印分类Id + */ + categoryIds?: null | string; + /** + * 分类 + */ + categoryList?: null | string; + /** + * 分类打印 0-所有 1-部分分类 2-部分商品 + */ + classifyPrint: null | string; + /** + * 现在打印机支持USB 和 网络、蓝牙 + */ + connectionType: null | string; + /** + * 打印机品牌 + */ + contentType: null | string; + /** + * 设备名称 + */ + name: null | string; + /** + * 端口 + */ + port?: null | string; + /** + * 打印方式 all-全部打印 normal-仅打印结账单「前台」one-仅打印制作单「厨房」 + */ + printMethod: null | string; + /** + * 打印数量 c1m1^2=顾客+商家[2张] m1^1=商家[1张] c1^1顾客[1张] c2m1^3顾客2+商家1[3张] + */ + printQty: null | string; + /** + * 打印类型,JSON数组 refund-确认退款单 handover-交班单 queue-排队取号 + */ + printType: null | string; + /** + * 小票尺寸 58mm 80mm + */ + receiptSize?: null | string; + /** + * 排序 + */ + sort?: number | null; + /** + * 打印类型(分类)label标签cash小票kitchen出品 + */ + subType?: null | string; + [property: string]: any; +} + +export interface editRequest extends addRequest { + id: number | string +} \ No newline at end of file diff --git a/src/assets/images/application/ad.png b/src/assets/images/application/ad.png new file mode 100644 index 0000000..23718f0 Binary files /dev/null and b/src/assets/images/application/ad.png differ diff --git a/src/assets/images/application/bear.png b/src/assets/images/application/bear.png new file mode 100644 index 0000000..f091bf8 Binary files /dev/null and b/src/assets/images/application/bear.png differ diff --git a/src/assets/images/application/call.png b/src/assets/images/application/call.png new file mode 100644 index 0000000..91bf630 Binary files /dev/null and b/src/assets/images/application/call.png differ diff --git a/src/assets/images/application/song.png b/src/assets/images/application/song.png new file mode 100644 index 0000000..327b330 Binary files /dev/null and b/src/assets/images/application/song.png differ diff --git a/src/assets/images/marketing/card.png b/src/assets/images/marketing/card.png new file mode 100644 index 0000000..efa5f45 Binary files /dev/null and b/src/assets/images/marketing/card.png differ diff --git a/src/assets/images/marketing/charge.png b/src/assets/images/marketing/charge.png new file mode 100644 index 0000000..41fc1ce Binary files /dev/null and b/src/assets/images/marketing/charge.png differ diff --git a/src/assets/images/marketing/invite.png b/src/assets/images/marketing/invite.png new file mode 100644 index 0000000..6ef58dc Binary files /dev/null and b/src/assets/images/marketing/invite.png differ diff --git a/src/assets/images/marketing/score.png b/src/assets/images/marketing/score.png new file mode 100644 index 0000000..00dabe6 Binary files /dev/null and b/src/assets/images/marketing/score.png differ diff --git a/src/router/index.ts b/src/router/index.ts index b26f593..f531eb5 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -342,7 +342,7 @@ export const constantRoutes: RouteRecordRaw[] = [ children: [ { path: "marketing", - component: () => import("@/views/application/marketing.vue"), + component: () => import("@/views/application/marketing/index.vue"), name: "applicationMarketing", meta: { title: "营销中心", @@ -352,14 +352,75 @@ export const constantRoutes: RouteRecordRaw[] = [ }, { path: "index", - component: () => import("@/views/application/index.vue"), + component: () => import("@/views/application/list/index.vue"), name: "applicationIndex", meta: { title: "列表管理", affix: false, - keepAlive: true, + keepAlive: false, + }, + + }, + /** + * 营销中心 start + */ + { + path: "coupon", + component: () => import("@/views/application/marketing/coupon/list.vue"), + name: "coupon", + meta: { + title: "优惠券", + affix: false, + hidden: true }, }, + { + path: "bwc", + component: () => import("@/views/application/marketing/bwc.vue"), + name: "bwc", + meta: { + title: "霸王餐", + affix: false, + hidden: true + }, + }, + { + path: "ad", + component: () => import("@/views/application/list/ad/index.vue"), + name: "ad", + meta: { + title: "广告", + affix: false, + hidden: true + }, + }, + /** 营销中心end */ + + /**列表start */ + + { + path: "lineUplist", + component: () => import("@/views/application/list/lineUplist/index.vue"), + name: "lineUplist", + meta: { + title: "叫号", + affix: false, + hidden: true + }, + }, + { + path: "lineUpRecord", + component: () => import("@/views/application/list/lineUplist/record.vue"), + name: "lineUpRecord", + meta: { + title: "叫号记录", + affix: false, + hidden: true + }, + }, + /**列表end */ + + ], }, { diff --git a/src/views/application/index.vue b/src/views/application/list/ad/index.vue similarity index 100% rename from src/views/application/index.vue rename to src/views/application/list/ad/index.vue diff --git a/src/views/application/list/index.vue b/src/views/application/list/index.vue new file mode 100644 index 0000000..0dbd5ee --- /dev/null +++ b/src/views/application/list/index.vue @@ -0,0 +1,93 @@ + + + + + \ No newline at end of file diff --git a/src/views/application/list/lineUplist/components/basic.vue b/src/views/application/list/lineUplist/components/basic.vue new file mode 100644 index 0000000..1680f11 --- /dev/null +++ b/src/views/application/list/lineUplist/components/basic.vue @@ -0,0 +1,413 @@ + + + + + \ No newline at end of file diff --git a/src/views/application/list/lineUplist/components/index.vue b/src/views/application/list/lineUplist/components/index.vue new file mode 100644 index 0000000..42788db --- /dev/null +++ b/src/views/application/list/lineUplist/components/index.vue @@ -0,0 +1,533 @@ + + + + + \ No newline at end of file diff --git a/src/views/application/list/lineUplist/index.vue b/src/views/application/list/lineUplist/index.vue new file mode 100644 index 0000000..adf6982 --- /dev/null +++ b/src/views/application/list/lineUplist/index.vue @@ -0,0 +1,34 @@ + + + + + \ No newline at end of file diff --git a/src/views/application/list/lineUplist/record.vue b/src/views/application/list/lineUplist/record.vue new file mode 100644 index 0000000..f367356 --- /dev/null +++ b/src/views/application/list/lineUplist/record.vue @@ -0,0 +1,119 @@ + + + + + \ No newline at end of file diff --git a/src/views/application/marketing.vue b/src/views/application/marketing.vue deleted file mode 100644 index 41a40c8..0000000 --- a/src/views/application/marketing.vue +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/views/application/marketing/bwc.vue b/src/views/application/marketing/bwc.vue new file mode 100644 index 0000000..48ecc8a --- /dev/null +++ b/src/views/application/marketing/bwc.vue @@ -0,0 +1,99 @@ + + + + + \ No newline at end of file diff --git a/src/views/application/marketing/coupon/components/coupon_details.vue b/src/views/application/marketing/coupon/components/coupon_details.vue new file mode 100644 index 0000000..c97ea19 --- /dev/null +++ b/src/views/application/marketing/coupon/components/coupon_details.vue @@ -0,0 +1,325 @@ + + + + + diff --git a/src/views/application/marketing/coupon/couponEnum.js b/src/views/application/marketing/coupon/couponEnum.js new file mode 100644 index 0000000..0b246e5 --- /dev/null +++ b/src/views/application/marketing/coupon/couponEnum.js @@ -0,0 +1,51 @@ +export default { + classType: [ + { + value: "product", + label: "商品券" + }, + { + value: "common", + label: "通用券" + } + ], + type: [ + { + value: "0", + label: "满减" + }, + { + value: "1", + label: "折扣" + } + ], + cycle: [ + { label: "周一", value: "Monday" }, + { label: "周二", value: "Tuesday" }, + { label: "周三", value: "Wednesday" }, + { label: "周四", value: "Thursday" }, + { label: "周五", value: "Friday" }, + { label: "周六", value: "Saturday" }, + { label: "周七", value: "Sunday" } + ], + validityType: [ + { + value: "fixed", + label: "领券后有效期内可用" + }, + { + value: "custom", + label: "固定有效期范围内可用" + } + ], + useTimeType: [ + { + value: "all", + label: "全时段可用" + }, + { + value: "custom", + label: "指定时间段" + } + ] +}; diff --git a/src/views/application/marketing/coupon/list.vue b/src/views/application/marketing/coupon/list.vue new file mode 100644 index 0000000..9183067 --- /dev/null +++ b/src/views/application/marketing/coupon/list.vue @@ -0,0 +1,183 @@ + + + diff --git a/src/views/application/marketing/index.vue b/src/views/application/marketing/index.vue new file mode 100644 index 0000000..bff30b5 --- /dev/null +++ b/src/views/application/marketing/index.vue @@ -0,0 +1,90 @@ + + + + + \ No newline at end of file diff --git a/src/views/devices/config/add.ts b/src/views/devices/config/add.ts index 4cf1e5f..315fe31 100644 --- a/src/views/devices/config/add.ts +++ b/src/views/devices/config/add.ts @@ -1,28 +1,32 @@ -import UserAPI, { type UserForm } from "@/api/system/user"; +import printerApi, { type addRequest } from "@/api/account/printer"; +import { options } from './config' + import type { IModalConfig } from "@/components/CURD/types"; -const modalConfig: IModalConfig = { +const modalConfig: IModalConfig = { pageName: "sys:user", dialog: { - title: "新增用户", + title: "新增打印机", width: 800, draggable: true, }, form: { labelWidth: 100, }, - formAction: UserAPI.add, + formAction: function (data) { + return printerApi.add(data); + }, beforeSubmit(data) { console.log("提交之前处理", data); }, formItems: [ { - label: "用户名", - prop: "username", - rules: [{ required: true, message: "用户名不能为空", trigger: "blur" }], + label: "设备名称", + prop: "name", + rules: [{ required: true, message: "设备名称不能为空", trigger: "blur" }], type: "input", attrs: { - placeholder: "请输入用户名", + placeholder: "请输入设备名称", }, col: { xs: 24, @@ -30,90 +34,127 @@ const modalConfig: IModalConfig = { }, }, { - label: "用户昵称", - prop: "nickname", - rules: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }], - type: "input", - attrs: { - placeholder: "请输入用户昵称", - }, - col: { - xs: 24, - sm: 12, - }, - }, - { - label: "所属部门", - prop: "deptId", - rules: [{ required: true, message: "所属部门不能为空", trigger: "blur" }], - type: "tree-select", - attrs: { - placeholder: "请选择所属部门", - data: [], - filterable: true, - "check-strictly": true, - "render-after-expand": false, - }, - }, - { - type: "custom", - label: "性别", - prop: "gender", - initialValue: 1, - }, - { - label: "角色", - prop: "roleIds", - rules: [{ required: true, message: "用户角色不能为空", trigger: "blur" }], type: "select", + label: "类型", + prop: "connectionType", + rules: [{ required: true, message: "请选择设备类型", trigger: "blur" }], attrs: { - placeholder: "请选择", - multiple: true, - }, - options: [], - initialValue: [], - }, - { - type: "input", - label: "手机号码", - prop: "mobile", - rules: [ - { - pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, - message: "请输入正确的手机号码", - trigger: "blur", + placeholder: "请选择设备类型", + clearable: true, + style: { + width: "200px", }, - ], - attrs: { - placeholder: "请输入手机号码", - maxlength: 11, + }, + options: options.connectionType, + col: { + xs: 24, + sm: 12, }, }, { - label: "邮箱", - prop: "email", - rules: [ - { - pattern: /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/, - message: "请输入正确的邮箱地址", - trigger: "blur", - }, - ], + label: "ip地址", + prop: "address", type: "input", attrs: { - placeholder: "请输入邮箱", - maxlength: 50, + placeholder: "请输入ip地址", + }, + col: { + xs: 24, + sm: 12, }, }, { - label: "状态", - prop: "status", + label: "端口", + prop: "port", + type: "input", + attrs: { + placeholder: "请输入端口", + }, + col: { + xs: 24, + sm: 12, + }, + }, + { + type: "select", + label: "打印类型", + prop: "subType", + rules: [{ required: false, message: "请选择打印类型", trigger: "blur" }], + attrs: { + placeholder: "请选择打印类型", + clearable: true, + style: { + width: "200px", + }, + }, + options: options.subType, + col: { + xs: 24, + sm: 12, + }, + }, + { + type: "select", + label: "打印机品牌", + prop: "contentType", + rules: [{ required: true, message: "请选择打印机品牌", trigger: "blur" }], + attrs: { + placeholder: "请选择打印机品牌", + clearable: true, + style: { + width: "200px", + }, + }, + options: options.contentType, + col: { + xs: 24, + sm: 12, + }, + }, + { + type: "radio-button", + label: "小票尺寸", + prop: "receiptSize", + options: options.receiptSize, + initialValue: options.receiptSize[0].value + }, + { + type: "radio-button", + label: "分类打印", + prop: "classifyPrint", + options: options.classifyPrint, + initialValue: options.classifyPrint[0].value + }, + { type: "radio", - options: [ - { label: "正常", value: 1 }, - { label: "禁用", value: 0 }, - ], + label: "打印数量", + prop: "printQty", + options: options.printQty, + initialValue: options.printQty[0].value + }, + { + type: "radio", + label: "打印方式", + prop: "printMethod", + options: options.printMethod, + initialValue: options.printMethod[0].value + }, + { + type: "checkbox", + label: "打印类型", + prop: "printType", + options: options.printType, + initialValue: options.printType.map(v => v.value) + }, + { + label: "打印机状态", + prop: "status", + type: "switch", initialValue: 1, + attrs: { + activeValue: 1, + inactiveValue: 0, + } }, ], }; diff --git a/src/views/devices/config/config.ts b/src/views/devices/config/config.ts new file mode 100644 index 0000000..661ff13 --- /dev/null +++ b/src/views/devices/config/config.ts @@ -0,0 +1,65 @@ +export const options: optionObject = { + connectionType: [ + { label: "USB", value: 'USB' }, + { label: "网络", value: '网络' }, + { label: "蓝牙", value: '蓝牙' }, + ], + subType: [ + { label: "标签", value: 'label' }, + { label: "小票", value: 'cash' }, + { label: "出品", value: 'kitchen' }, + ], + contentType: [ + { label: "云想印", value: '云想印' }, + { label: "飞鹅", value: '飞鹅' }, + ], + receiptSize: [ + { label: "58mm", value: '58mm' }, + { label: "80mm", value: '80mm' }, + ], + classifyPrint: [ + { label: "所有", value: 0 }, + { label: "部分分类", value: 1 }, + { label: "部分商品", value: 2 }, + ], + printQty: [ + { label: "顾客+商家[2张] ", value: 'c1m1^2' }, + { label: "商家[1张]", value: 'm1^1' }, + { label: "顾客[1张]", value: 'c1^1' }, + { label: "顾客2+商家1[3张]", value: 'c2m1^3' }, + ], + printMethod: [ + { value: "all", label: '全部打印' }, + { value: "normal", label: '仅打印结账单「前台」' }, + { value: "one", label: '仅打印制作单「厨房」' }, + ], + printType: [ + { label: "确认退款单", value: 'refund' }, + { label: "交班单", value: 'handover' }, + { label: "排队取号", value: 'queue' }, + ] +} + +export type optionsType = string; + +export function returnOptions(type: optionsType) { + return options[type] +} + +export function returnOptionsLabel(optionsType: optionsType, value: string | number) { + const options = returnOptions(optionsType); + if (!options) { + return ""; + } + const option = options.find((item) => item.value === value); + return option ? option.label : ""; +} + +export interface options { + label: string; + value: string | number; + [property: string]: any; +} +export interface optionObject { + [property: string]: options[]; +} \ No newline at end of file diff --git a/src/views/devices/config/content.ts b/src/views/devices/config/content.ts index bd20eec..d22e36b 100644 --- a/src/views/devices/config/content.ts +++ b/src/views/devices/config/content.ts @@ -1,14 +1,17 @@ -import UserAPI from "@/api/system/user"; -import RoleAPI from "@/api/system/role"; -import type { UserPageQuery } from "@/api/system/user"; +import printerApi, { type getListRequest } from "@/api/account/printer"; import type { IContentConfig } from "@/components/CURD/types"; -const contentConfig: IContentConfig = { + +const contentConfig: IContentConfig = { pageName: "sys:user", table: { border: true, highlightCurrentRow: true, }, + indexActionData: function (data: any) { + // Add your implementation here + return Promise.resolve(data); + }, pagination: { background: true, layout: "prev,pager,next,jumper,total,sizes", @@ -16,14 +19,11 @@ const contentConfig: IContentConfig = { pageSizes: [10, 20, 30, 50], }, indexAction: function (params) { - return UserAPI.getPage(params); + return printerApi.getList(params); }, - deleteAction: UserAPI.deleteByIds, - importAction(file) { - return UserAPI.import(1, file); + deleteAction: function (id) { + return printerApi.delete(id) }, - exportAction: UserAPI.export, - importTemplate: UserAPI.downloadTemplate, importsAction(data) { // 模拟导入数据 console.log("importsAction", data); @@ -31,7 +31,7 @@ const contentConfig: IContentConfig = { }, exportsAction: async function (params) { // 模拟获取到的是全量数据 - const res = await UserAPI.getPage(params); + const res = await printerApi.getPage(params); console.log("exportsAction", res.list); return res.list; }, diff --git a/src/views/devices/config/content2.ts b/src/views/devices/config/content2.ts deleted file mode 100644 index 3da3999..0000000 --- a/src/views/devices/config/content2.ts +++ /dev/null @@ -1,133 +0,0 @@ -import type { IContentConfig } from "@/components/CURD/types"; - -const contentConfig: IContentConfig = { - pageName: "sys:user", - table: { - showOverflowTooltip: true, - }, - toolbar: [], - indexAction: function (params) { - // 模拟发起网络请求获取列表数据 - console.log("indexAction:", params); - return Promise.resolve({ - total: 2, - list: [ - { - id: 1, - username: "tom", - avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", - percent: 99, - price: 10, - url: "https://www.baidu.com", - icon: "el-icon-setting", - gender: 1, - status: 1, - status2: 1, - sort: 99, - createTime: 1715647982437, - }, - { - id: 2, - username: "jerry", - avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", - percent: 88, - price: 999, - url: "https://www.google.com", - icon: "el-icon-user", - gender: 0, - status: 0, - status2: 0, - sort: 0, - createTime: 1715648977426, - }, - ], - }); - }, - modifyAction(data) { - // 模拟发起网络请求修改字段 - // console.log("modifyAction:", data); - ElMessage.success(JSON.stringify(data)); - return Promise.resolve(null); - }, - cols: [ - { type: "index", width: 50, align: "center" }, - { label: "ID", align: "center", prop: "id", show: false }, - { label: "文本", align: "center", prop: "username" }, - { label: "图片", align: "center", prop: "avatar", templet: "image" }, - { - label: "百分比", - align: "center", - prop: "percent", - templet: "percent", - }, - { - label: "货币符", - align: "center", - prop: "price", - templet: "price", - priceFormat: "$", - }, - { label: "链接", align: "center", prop: "url", width: 180, templet: "url" }, - { label: "图标", align: "center", prop: "icon", templet: "icon" }, - { - label: "列表值", - align: "center", - prop: "gender", - templet: "list", - selectList: { "0": "女", "1": "男" }, - }, - { - label: "自定义", - align: "center", - prop: "status", - templet: "custom", - slotName: "status", - }, - { - label: "Switch", - align: "center", - prop: "status2", - templet: "switch", - activeValue: 1, - inactiveValue: 0, - activeText: "启用", - inactiveText: "禁用", - }, - { - label: "输入框", - align: "center", - prop: "sort", - templet: "input", - inputType: "number", - }, - { - label: "日期格式化", - align: "center", - prop: "createTime", - minWidth: 120, - templet: "date", - dateFormat: "YYYY/MM/DD HH:mm:ss", - }, - { - label: "操作栏", - align: "center", - fixed: "right", - width: 220, - templet: "tool", - operat: [ - { - name: "reset_pwd", - auth: "password:reset", - icon: "refresh-left", - text: "重置密码", - type: "primary", - render(row) { - return row.id === 1; - }, - }, - ], - }, - ], -}; - -export default contentConfig; diff --git a/src/views/devices/config/edit.ts b/src/views/devices/config/edit.ts index bbc0f61..7f3f625 100644 --- a/src/views/devices/config/edit.ts +++ b/src/views/devices/config/edit.ts @@ -1,117 +1,163 @@ -import UserAPI, { type UserForm } from "@/api/system/user"; -import type { IModalConfig } from "@/components/CURD/types"; -import { DeviceEnum } from "@/enums/DeviceEnum"; -import { useAppStore } from "@/store"; +import printerApi, { type editRequest } from "@/api/account/printer"; +import { options } from './config' -const modalConfig: IModalConfig = { +import type { IModalConfig } from "@/components/CURD/types"; + +const modalConfig: IModalConfig = { pageName: "sys:user", - component: "drawer", - drawer: { - title: "修改用户", - size: useAppStore().device === DeviceEnum.MOBILE ? "80%" : 500, + dialog: { + title: "修改打印机", + width: 800, + draggable: true, + }, + form: { + labelWidth: 100, }, - pk: "id", formAction: function (data) { - return UserAPI.update(data.id as number, data); + return printerApi.edit(data); }, beforeSubmit(data) { console.log("提交之前处理", data); }, formItems: [ { - label: "用户名", - prop: "username", - rules: [{ required: true, message: "用户名不能为空", trigger: "blur" }], + label: "设备名称", + prop: "name", + rules: [{ required: true, message: "设备名称不能为空", trigger: "blur" }], type: "input", attrs: { - placeholder: "请输入用户名", - readonly: true, + placeholder: "请输入设备名称", + }, + col: { + xs: 24, + sm: 12, }, }, { - label: "用户昵称", - prop: "nickname", - rules: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }], - type: "input", - attrs: { - placeholder: "请输入用户昵称", - }, - }, - { - label: "所属部门", - prop: "deptId", - rules: [{ required: true, message: "所属部门不能为空", trigger: "blur" }], - type: "tree-select", - attrs: { - placeholder: "请选择所属部门", - data: [], - filterable: true, - "check-strictly": true, - "render-after-expand": false, - }, - }, - { - type: "custom", - label: "性别", - prop: "gender", - initialValue: 1, - }, - { - label: "角色", - prop: "roleIds", - rules: [{ required: true, message: "用户角色不能为空", trigger: "blur" }], type: "select", + label: "类型", + prop: "connectionType", + rules: [{ required: true, message: "请选择设备类型", trigger: "blur" }], attrs: { - placeholder: "请选择", - multiple: true, - }, - options: [], - initialValue: [], - }, - { - type: "input", - label: "手机号码", - prop: "mobile", - rules: [ - { - pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, - message: "请输入正确的手机号码", - trigger: "blur", + placeholder: "请选择设备类型", + clearable: true, + style: { + width: "200px", }, - ], - attrs: { - placeholder: "请输入手机号码", - maxlength: 11, + }, + options: options.connectionType, + col: { + xs: 24, + sm: 12, }, }, { - label: "邮箱", - prop: "email", - rules: [ - { - pattern: /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/, - message: "请输入正确的邮箱地址", - trigger: "blur", - }, - ], + label: "ip地址", + prop: "address", type: "input", attrs: { - placeholder: "请输入邮箱", - maxlength: 50, + placeholder: "请输入ip地址", + }, + col: { + xs: 24, + sm: 12, }, }, { - label: "状态", + label: "端口", + prop: "port", + type: "input", + attrs: { + placeholder: "请输入端口", + }, + col: { + xs: 24, + sm: 12, + }, + }, + { + type: "select", + label: "打印类型", + prop: "subType", + rules: [{ required: false, message: "请选择打印类型", trigger: "blur" }], + attrs: { + placeholder: "请选择打印类型", + clearable: true, + style: { + width: "200px", + }, + }, + options: options.subType, + col: { + xs: 24, + sm: 12, + }, + }, + { + type: "select", + label: "打印机品牌", + prop: "contentType", + rules: [{ required: true, message: "请选择打印机品牌", trigger: "blur" }], + attrs: { + placeholder: "请选择打印机品牌", + clearable: true, + style: { + width: "200px", + }, + }, + options: options.contentType, + col: { + xs: 24, + sm: 12, + }, + }, + { + type: "radio-button", + label: "小票尺寸", + prop: "receiptSize", + options: options.receiptSize, + initialValue: options.receiptSize[0].value + }, + { + type: "radio-button", + label: "分类打印", + prop: "classifyPrint", + options: options.classifyPrint, + initialValue: options.classifyPrint[0].value + }, + { + type: "radio", + label: "打印数量", + prop: "printQty", + options: options.printQty, + initialValue: options.printQty[0].value + }, + { + type: "radio", + label: "打印方式", + prop: "printMethod", + options: options.printMethod, + initialValue: options.printMethod[0].value + }, + { + type: "checkbox", + label: "打印类型", + prop: "printType", + options: options.printType, + initialValue: options.printType.map(v => v.value) + }, + { + label: "打印机状态", prop: "status", type: "switch", + initialValue: 1, attrs: { - activeText: "正常", - inactiveText: "禁用", activeValue: 1, inactiveValue: 0, - }, + } }, ], }; +// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出 export default reactive(modalConfig); diff --git a/src/views/devices/config/search.ts b/src/views/devices/config/search.ts index 6c2931e..0a6c9c6 100644 --- a/src/views/devices/config/search.ts +++ b/src/views/devices/config/search.ts @@ -1,13 +1,12 @@ -import DeptAPI from "@/api/system/dept"; import type { ISearchConfig } from "@/components/CURD/types"; - +import { options } from './config' const searchConfig: ISearchConfig = { pageName: "sys:user", formItems: [ { type: "input", label: "设备名称", - prop: "keywords", + prop: "name", attrs: { placeholder: "请输入设备名称", clearable: true, @@ -18,19 +17,16 @@ const searchConfig: ISearchConfig = { }, { type: "select", - label: "状态", - prop: "status", + label: "类型", + prop: "connectionType", attrs: { - placeholder: "全部", + placeholder: "请选择设备类型", clearable: true, style: { - width: "100px", + width: "200px", }, }, - options: [ - { label: "启用", value: 1 }, - { label: "禁用", value: 0 }, - ], + options: options.connectionType, }, ], diff --git a/src/views/devices/printer.vue b/src/views/devices/printer.vue index ff418d1..b1c2a85 100644 --- a/src/views/devices/printer.vue +++ b/src/views/devices/printer.vue @@ -1,64 +1,70 @@