Merge branch 'master' of https://e.coding.net/g-cphe0354/cashier/cashier-web into dwb
This commit is contained in:
commit
41cecad886
|
|
@ -36,6 +36,7 @@
|
|||
"@vueuse/core": "^12.5.0",
|
||||
"@wangeditor-next/editor": "^5.6.31",
|
||||
"@wangeditor-next/editor-for-vue": "^5.1.14",
|
||||
"ali-oss": "^6.22.0",
|
||||
"axios": "^1.7.9",
|
||||
"bwip-js": "^4.5.1",
|
||||
"codemirror": "^5.65.18",
|
||||
|
|
@ -57,6 +58,7 @@
|
|||
"sockjs-client": "^1.6.1",
|
||||
"sortablejs": "^1.15.6",
|
||||
"vue": "^3.5.13",
|
||||
"vue-clipboard3": "^2.0.0",
|
||||
"vue-i18n": "^11.1.0",
|
||||
"vue-router": "^4.5.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -37,7 +37,15 @@ const API = {
|
|||
method: "delete",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
},
|
||||
// pad布局列表
|
||||
getLayout() {
|
||||
return request<any>({
|
||||
url: `${baseURL}/layout`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
export default API;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
import request from "@/utils/request";
|
||||
import { Account_BaseUrl } from "@/api/config";
|
||||
const baseURL = Account_BaseUrl + "/admin/payType";
|
||||
const Api = {
|
||||
getList() {
|
||||
return request<any>({
|
||||
url: `${baseURL}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
get(params: getRequset) {
|
||||
return request<any>({
|
||||
url: `${baseURL}/detail`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
edit(data: payType) {
|
||||
return request<any>({
|
||||
url: `${baseURL}`,
|
||||
method: "put",
|
||||
data
|
||||
});
|
||||
},
|
||||
add(data: payType) {
|
||||
return request<any>({
|
||||
url: `${baseURL}`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export default Api;
|
||||
|
||||
interface getRequset {
|
||||
id?: string
|
||||
}
|
||||
|
||||
export interface payType {
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
icon?: null | string;
|
||||
/**
|
||||
* 自增id
|
||||
*/
|
||||
id?: number | null;
|
||||
/**
|
||||
* 0-不显示1显示
|
||||
*/
|
||||
isDisplay?: number | null;
|
||||
/**
|
||||
* 0-非虚拟 1虚拟 virtual
|
||||
*/
|
||||
isIdeal?: number | null;
|
||||
/**
|
||||
* 是否打开钱箱
|
||||
*/
|
||||
isOpenCashDrawer?: number | null;
|
||||
/**
|
||||
* 0允许退款 1-不允许退款
|
||||
*/
|
||||
isRefundable?: number | null;
|
||||
/**
|
||||
* 是否快捷展示1是0否
|
||||
*/
|
||||
isShowShortcut?: number | null;
|
||||
/**
|
||||
* 0不是 1是 [系统级支付]
|
||||
*/
|
||||
isSystem?: number | null;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
sorts?: number | null;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
|
@ -3,11 +3,10 @@ import { Account_BaseUrl } from "@/api/config";
|
|||
const baseURL = Account_BaseUrl + "/admin/shopTable";
|
||||
const API = {
|
||||
// 批量生成桌码
|
||||
fasetAdd(num: number) {
|
||||
downloadTableCode(num: number) {
|
||||
return request({
|
||||
url: `${baseURL}/code`,
|
||||
url: `${baseURL}/code?num=` + num,
|
||||
method: "post",
|
||||
data: { num },
|
||||
});
|
||||
},
|
||||
getList(data: getListRequest) {
|
||||
|
|
@ -17,6 +16,14 @@ const API = {
|
|||
params: data
|
||||
});
|
||||
},
|
||||
// 获取台桌详情
|
||||
get(id: string | number) {
|
||||
return request({
|
||||
url: `${baseURL}/detail`,
|
||||
method: "get",
|
||||
params: { id }
|
||||
});
|
||||
},
|
||||
edit(data: editRequest) {
|
||||
return request({
|
||||
url: `${baseURL}`,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ import request from "@/utils/request";
|
|||
import { Order_BaseUrl } from "@/api/config";
|
||||
const baseURL = Order_BaseUrl + "/admin/order";
|
||||
const OrderApi = {
|
||||
getList(params: getListRequest) {
|
||||
getList(data: getListRequest) {
|
||||
return request<any, getListResponse>({
|
||||
url: `${baseURL}`,
|
||||
method: "get",
|
||||
params: params,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
},
|
||||
add(data: addRequest) {
|
||||
|
|
@ -16,11 +16,76 @@ const OrderApi = {
|
|||
data
|
||||
});
|
||||
},
|
||||
// 历史订单(多次下单使用)
|
||||
getHistoryList(params: getHistoryListRequest) {
|
||||
return request<any>({
|
||||
url: `${baseURL}/historyOrder`,
|
||||
method: "get",
|
||||
params: params,
|
||||
});
|
||||
},
|
||||
// 订单全额退款 只传订单id
|
||||
refundOrder(data: refundOrderRequest) {
|
||||
return request<any>({
|
||||
url: `${baseURL}/refundOrder`,
|
||||
method: "post",
|
||||
params: data,
|
||||
});
|
||||
},
|
||||
|
||||
edit() { },
|
||||
delete() { },
|
||||
};
|
||||
|
||||
export default OrderApi;
|
||||
|
||||
export interface refundOrderRequest {
|
||||
/**
|
||||
* 现金退款,是否
|
||||
*/
|
||||
cash?: boolean;
|
||||
/**
|
||||
* 自定义退款金额,退款金额 默认为 退单数量*单价 的和
|
||||
* 整单退款 为订单orderAmount
|
||||
* 如果自定义退款金额 则金额不进行校验 直接退款
|
||||
*/
|
||||
modify?: boolean;
|
||||
orderId: number;
|
||||
/**
|
||||
* 退单总金额
|
||||
*/
|
||||
refundAmount: number;
|
||||
/**
|
||||
* 退单明细
|
||||
* id: orderDetailId
|
||||
* num: 退单数量
|
||||
* returnAmount: 退单金额
|
||||
*/
|
||||
refundDetails?: RefundDetail[];
|
||||
refundReason?: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情 实体类。
|
||||
*/
|
||||
export interface RefundDetail {
|
||||
id?: number;
|
||||
/**
|
||||
* 退单数量
|
||||
*/
|
||||
num?: number;
|
||||
/**
|
||||
* 退单金额
|
||||
*/
|
||||
returnAmount?: number;
|
||||
[property: string]: any;
|
||||
}
|
||||
export interface getHistoryListRequest {
|
||||
orderId?: number;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
// 订单状态
|
||||
export type statusType =
|
||||
| "unpaid"
|
||||
|
|
|
|||
|
|
@ -29,10 +29,27 @@ const VersionApi = {
|
|||
method: "delete",
|
||||
});
|
||||
},
|
||||
//获取上传临时凭证
|
||||
getCredentials() {
|
||||
return request<any, ossConfig>({
|
||||
url: `${baseURL}/getCredentials`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
export default VersionApi;
|
||||
|
||||
export interface ossConfig {
|
||||
accessKeyId: string;
|
||||
accessKeySecret: string;
|
||||
expiration: string;
|
||||
securityToken: number;
|
||||
}
|
||||
|
||||
|
||||
export interface versionForm {
|
||||
/**
|
||||
* 版本 id
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
<template>
|
||||
<el-dialog title="选择商品" top="5vh" v-model="dialogVisible">
|
||||
<el-dialog title="选择商品" top="5vh" v-model="dialogVisible" @close="resetHandle">
|
||||
<el-form :model="searhForm" inline>
|
||||
<el-form-item>
|
||||
<el-input v-model="searhForm.name" placeholder="商品名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="searhForm.category" placeholder="商品分类" :disabled="disableCategory">
|
||||
<el-select
|
||||
style="width: 200px"
|
||||
v-model="searhForm.category"
|
||||
placeholder="商品分类"
|
||||
:disabled="disableCategory"
|
||||
>
|
||||
<el-option
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
|
|
@ -110,7 +115,7 @@ export default {
|
|||
},
|
||||
categoryList: [],
|
||||
tableData: {
|
||||
page: 0,
|
||||
page: 1,
|
||||
size: 10,
|
||||
total: 0,
|
||||
loading: false,
|
||||
|
|
@ -131,14 +136,14 @@ export default {
|
|||
this.$emit("success", res);
|
||||
this.close();
|
||||
},
|
||||
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.searhForm.name = "";
|
||||
this.searhForm.category = "";
|
||||
this.tableData.page = 0;
|
||||
this.tableData.page = 1;
|
||||
this.tableData.size = 10;
|
||||
this.tableData.list = [];
|
||||
this.getTableData();
|
||||
},
|
||||
// 分页大小改变
|
||||
sizeChange(e) {
|
||||
|
|
@ -147,7 +152,7 @@ export default {
|
|||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1;
|
||||
this.tableData.page = e;
|
||||
this.getTableData();
|
||||
},
|
||||
// 商品列表
|
||||
|
|
@ -160,8 +165,8 @@ export default {
|
|||
name: this.searhForm.name,
|
||||
categoryId: this.searhForm.category,
|
||||
});
|
||||
this.tableData.list = res.content;
|
||||
this.tableData.total = res.totalElements;
|
||||
this.tableData.list = res.records;
|
||||
this.tableData.total = res.totalRow;
|
||||
|
||||
if (this.goods.length) {
|
||||
this.$nextTick(() => {
|
||||
|
|
@ -179,10 +184,10 @@ export default {
|
|||
async tbShopCategoryGet() {
|
||||
try {
|
||||
const res = await paoductCategoryApi.getPage({
|
||||
page: 0,
|
||||
size: 100,
|
||||
page: 1,
|
||||
size: 600,
|
||||
});
|
||||
this.categoryList = res.content;
|
||||
this.categoryList = res.records;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
|
@ -194,17 +199,12 @@ export default {
|
|||
} else {
|
||||
this.goods = [];
|
||||
}
|
||||
this.resetHandle();
|
||||
|
||||
console.log(categoryId);
|
||||
|
||||
if (categoryId) {
|
||||
this.searhForm.category = categoryId;
|
||||
}
|
||||
|
||||
console.log(this.searhForm);
|
||||
|
||||
await this.tbShopCategoryGet();
|
||||
|
||||
await this.getTableData();
|
||||
},
|
||||
close() {
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ export const constantRoutes: RouteRecordRaw[] = [
|
|||
children: [
|
||||
{
|
||||
path: "pay-types",
|
||||
component: () => import("@/views/system-setting/pay-types.vue"),
|
||||
component: () => import("@/views/system-setting/pay-types/index.vue"),
|
||||
name: "payTypes",
|
||||
meta: {
|
||||
title: "支付方式",
|
||||
|
|
|
|||
|
|
@ -27,12 +27,24 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
const isEmpty = computed(() => {
|
||||
return list.value.length === 0 && giftList.value.length === 0
|
||||
})
|
||||
//当前购物车选中数据
|
||||
const selCart = computed(() => {
|
||||
if (isSelGift.value) {
|
||||
return giftList.value[selListIndex.value] || defaultCart
|
||||
}
|
||||
return list.value[selListIndex.value] || defaultCart
|
||||
})
|
||||
//当前购物车选中对应商品数据
|
||||
const selGoods = computed(() => {
|
||||
return goodsMap[selCart.value.product_id]
|
||||
})
|
||||
//当前选中购物车数据是否是可选套餐商品
|
||||
const isCanSelectGroup = computed(() => {
|
||||
if (!selGoods.value) {
|
||||
return false
|
||||
}
|
||||
return selGoods.value.type == 'package' && selGoods.value.groupType == 1
|
||||
})
|
||||
//赠菜总价
|
||||
const giftMoney = computed(() => {
|
||||
return giftList.value.reduce((acc: number, cur: any) => {
|
||||
|
|
@ -96,18 +108,30 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
}
|
||||
}
|
||||
|
||||
const basic_msg = {
|
||||
number: 1,
|
||||
is_pack: 0,
|
||||
is_gift: 0,
|
||||
is_temporary: 0,
|
||||
discount_sale_amount: 0,
|
||||
discount_sale_note: "",
|
||||
is_print: 0,
|
||||
is_wait_call: 0,
|
||||
product_name: "",
|
||||
remark: "",
|
||||
sku_id: '',
|
||||
}
|
||||
//当前购物车直接添加
|
||||
function cartsPush(data: any) {
|
||||
sendMessage('add', {
|
||||
...basic_msg,
|
||||
...data
|
||||
});
|
||||
}
|
||||
|
||||
function add(data: any) {
|
||||
const msg = {
|
||||
number: 1,
|
||||
is_pack: 0,
|
||||
is_gift: 0,
|
||||
is_temporary: 0,
|
||||
discount_sale_amount: 0,
|
||||
discount_sale_note: "",
|
||||
is_print: 0,
|
||||
is_wait_call: 0,
|
||||
product_name: "",
|
||||
remark: "",
|
||||
...basic_msg,
|
||||
...data
|
||||
}
|
||||
const hasCart = list.value.find((cartItem) => {
|
||||
|
|
@ -116,10 +140,21 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
if (hasCart) {
|
||||
update({ ...hasCart, ...msg, number: hasCart.number * 1 + msg.number * 1 })
|
||||
} else {
|
||||
console.log(msg);
|
||||
sendMessage('add', msg);
|
||||
}
|
||||
}
|
||||
|
||||
// 换桌
|
||||
function changeTable(newVal: string | number) {
|
||||
if (table_code.value) {
|
||||
sendMessage('rottable', {
|
||||
new_table_code: newVal,
|
||||
id: list.value[0].id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function del(data: any) {
|
||||
sendMessage('del', data);
|
||||
}
|
||||
|
|
@ -183,27 +218,40 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
return ElMessage.error(msg.message || '操作失败')
|
||||
}
|
||||
if (msg && msg.data) {
|
||||
const tableCode = Array.isArray(msg.data) ? msg.data[0].table_code : msg.data.table_code
|
||||
table_code.value = table_code.value ? table_code.value : tableCode
|
||||
console.log(table_code.value)
|
||||
if (Array.isArray(msg.data) && msg.data.length) {
|
||||
table_code.value = msg.data[0].table_code
|
||||
}
|
||||
if (msg.data.table_code) {
|
||||
table_code.value = table_code.value ? table_code.value : msg.data.table_code
|
||||
}
|
||||
}
|
||||
// 初始化
|
||||
if (msg.operate_type === "manage_init") {
|
||||
// 设置单价
|
||||
list.value = msg.data.filter((v: { is_gift: any; }) => !v.is_gift).map((v: Record<string, any>) => {
|
||||
list.value = msg.data.filter((v: Record<string, any>) => {
|
||||
const skuData = getProductDetails({ product_id: v.product_id, sku_id: v.sku_id })
|
||||
return {
|
||||
...skuData,
|
||||
...v,
|
||||
if (skuData) {
|
||||
(Object.keys(skuData) as (keyof typeof skuData)[]).forEach((key) => {
|
||||
v[key] = skuData[key];
|
||||
});
|
||||
} else {
|
||||
del({ id: v.id })
|
||||
return false
|
||||
}
|
||||
});
|
||||
giftList.value = msg.data.filter((v: { is_gift: any; }) => v.is_gift).map((v: Record<string, any>) => {
|
||||
return !v.is_gift
|
||||
})
|
||||
giftList.value = msg.data.filter((v: Record<string, any>) => {
|
||||
const skuData = getProductDetails({ product_id: v.product_id, sku_id: v.sku_id })
|
||||
return {
|
||||
...skuData,
|
||||
...v,
|
||||
if (skuData) {
|
||||
(Object.keys(skuData) as (keyof typeof skuData)[]).forEach((key) => {
|
||||
v[key] = skuData[key];
|
||||
});
|
||||
} else {
|
||||
del({ id: v.id })
|
||||
return false
|
||||
}
|
||||
});
|
||||
return v.is_gift
|
||||
})
|
||||
console.log(giftList.value)
|
||||
}
|
||||
//广播
|
||||
|
|
@ -211,6 +259,9 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
msg.operate_type = 'manage_' + msg.operate_type
|
||||
}
|
||||
if (msg.operate_type === "manage_add") {
|
||||
if (list.value.find(v => v.id == msg.data.id)) {
|
||||
return ElMessage.warning(msg.message || '该商品已存在')
|
||||
}
|
||||
const skuData = getProductDetails({ product_id: msg.data.product_id, sku_id: msg.data.sku_id })
|
||||
list.value.push({ ...skuData, ...msg.data })
|
||||
return ElMessage.success(msg.message || '添加成功')
|
||||
|
|
@ -283,6 +334,9 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
WebSocketManager.sendMessage(msg);
|
||||
}
|
||||
return {
|
||||
isCanSelectGroup,
|
||||
selGoods,
|
||||
cartsPush,
|
||||
table_code,
|
||||
updateTag,
|
||||
list,
|
||||
|
|
@ -293,7 +347,8 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
changeNumber, isEmpty,
|
||||
selCart, totalNumber,
|
||||
changeSelCart, payMoney,
|
||||
clear, yiyouhui, giftList
|
||||
clear, yiyouhui, giftList,
|
||||
changeTable
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -56,3 +56,63 @@ export function formatGrowthRate(growthRate: number) {
|
|||
.replace(/\.?0+$/, "");
|
||||
return formattedRate + "%";
|
||||
}
|
||||
/**
|
||||
* Parse the time to string
|
||||
* @param {(Object|string|number)} time
|
||||
* @param {string} cFormat
|
||||
* @returns {string}
|
||||
*/
|
||||
export function parseTime(time: string | number | Date | null, cFormat: string | undefined) {
|
||||
if (arguments.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const format = cFormat || "{y}-{m}-{d} {h}:{i}:{s}";
|
||||
let date;
|
||||
if (typeof time === "undefined" || time === null || time === "null") {
|
||||
return "";
|
||||
} else if (typeof time === "object") {
|
||||
date = time;
|
||||
} else {
|
||||
if (typeof time === "string" && /^[0-9]+$/.test(time)) {
|
||||
time = parseInt(time);
|
||||
}
|
||||
if (typeof time === "number" && time.toString().length === 10) {
|
||||
time = time * 1000;
|
||||
}
|
||||
date = new Date(time);
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
};
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key: keyof typeof formatObj): string => {
|
||||
let value = formatObj[key];
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === "a") {
|
||||
return ["日", "一", "二", "三", "四", "五", "六"][value];
|
||||
}
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = Number("0" + value.toString());
|
||||
}
|
||||
return value.toString() || "0";
|
||||
});
|
||||
return time_str;
|
||||
}
|
||||
|
||||
// 下载文件
|
||||
export function downloadFile(obj: BlobPart, name: string, suffix: string) {
|
||||
const url = window.URL.createObjectURL(new Blob([obj]));
|
||||
const link = document.createElement("a");
|
||||
link.style.display = "none";
|
||||
link.href = url;
|
||||
const fileName = parseTime(new Date(), undefined) + "-" + name + "." + suffix;
|
||||
link.setAttribute("download", fileName);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
import OSS from "ali-oss";
|
||||
import versionApi from "@/api/system/version";
|
||||
|
||||
const $headers = {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
};
|
||||
const $config = {
|
||||
region: "oss-cn-beijing",
|
||||
accessKeyId: "",
|
||||
accessKeySecret: "",
|
||||
bucket: "cashier-oss",
|
||||
};
|
||||
import { ElMessage } from "element-plus";
|
||||
function urlConversion(path) {
|
||||
let reg = /^(https?:\/\/)([0-9a-z.]+)(:[0-9]+)?([/0-9a-z.]+)?(\?[0-9a-z&=]+)?(#[0-9-a-z]+)?/i;
|
||||
path = path.replace(reg, "https://$2$3$4$5$6");
|
||||
return path;
|
||||
}
|
||||
|
||||
async function uploadAndDownloadFile(name, file, headers) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
ossClient.put(name, file, { ...$headers, ...headers }).then((res) => {
|
||||
console.log(res);
|
||||
resolve(res);
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
class ossClient {
|
||||
constructor(config) {
|
||||
this.ossClient = new OSS({
|
||||
...$config,
|
||||
...config,
|
||||
refreshSTSToken: async () => {
|
||||
// 向您搭建的STS服务获取临时访问凭证。
|
||||
const res = await versionApi.getCredentials();
|
||||
return {
|
||||
accessKeyId: res.accessKeyId, // 自己账户的accessKeyId或临时秘钥
|
||||
accessKeySecret: res.accessKeySecret, // 自己账户的accessKeySecret或临时秘钥
|
||||
stsToken: res.securityToken, // 从STS服务获取的安全令牌(SecurityToken)。
|
||||
};
|
||||
},
|
||||
// 刷新临时访问凭证的时间间隔,单位为毫秒。
|
||||
refreshSTSTokenInterval: 3600 * 1000,
|
||||
});
|
||||
}
|
||||
async upload(name, file, progressCallback) {
|
||||
try {
|
||||
let options = {
|
||||
// 获取分片上传进度、断点和返回值。
|
||||
progress: progressCallback,
|
||||
headers: $headers,
|
||||
};
|
||||
const { res: resp } = await this.ossClient.put(name, file, options).catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
return resp.requestUrls;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
reject(error);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 分片上传
|
||||
* @param {Object} client oss客户端
|
||||
* @param {Object} file 上传的文件
|
||||
* @param {Object} dir 上传oss的文件夹
|
||||
* @param {Object} progressCallback 分片进度回调
|
||||
*/
|
||||
async partUpload(name, file, progressCallback) {
|
||||
try {
|
||||
let options = {
|
||||
// 获取分片上传进度、断点和返回值。
|
||||
progress: progressCallback,
|
||||
|
||||
// 设置并发上传的分片数量。
|
||||
parallel: 8,
|
||||
// 设置分片大小。默认值为1 MB,最小值为100 KB。
|
||||
partSize: 100 * 1024,
|
||||
mime: file.type,
|
||||
};
|
||||
const { res: resp } = await this.ossClient.multipartUpload(
|
||||
name ? name : file.name,
|
||||
file,
|
||||
options
|
||||
);
|
||||
// return resp.requestUrls
|
||||
console.log("------resp---");
|
||||
console.log(resp);
|
||||
return urlConversion(`${resp.requestUrls[0]}`.split("?")[0]);
|
||||
} catch (e) {
|
||||
console.log("------e---");
|
||||
console.log(e);
|
||||
if (e.name == "cancel") {
|
||||
ElMessage.error({
|
||||
title: "上传已取消",
|
||||
duration: 3000,
|
||||
});
|
||||
return e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束上传并删除碎片
|
||||
* @param {Object} client
|
||||
* @param {Object} uploadId
|
||||
* @param {Object} name
|
||||
*/
|
||||
async abortUpload(uploadId, name) {
|
||||
try {
|
||||
const res = await this.ossClient.abortMultipartUpload(name, uploadId);
|
||||
return res;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
export default ossClient;
|
||||
|
|
@ -20,7 +20,7 @@ export interface ApifoxModel {
|
|||
type: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
export type msgType = 'add' | 'reduce' | 'remove' | 'edit' | 'init' | 'cleanup' | 'del'
|
||||
export type msgType = 'add' | 'reduce' | 'remove' | 'edit' | 'init' | 'cleanup' | 'del' | 'rottable'
|
||||
class WebSocketManager {
|
||||
private client: WebSocket | null = null;
|
||||
private connected: boolean = false;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,296 @@
|
|||
<!-- 文件上传组件 -->
|
||||
<template>
|
||||
<div>
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
:auto-upload="true"
|
||||
:style="props.style"
|
||||
:before-upload="handleBeforeUpload"
|
||||
:http-request="handleUpload"
|
||||
:on-progress="handleProgress"
|
||||
:on-success="handleSuccess"
|
||||
:on-error="handleError"
|
||||
:accept="props.accept"
|
||||
:limit="props.limit"
|
||||
multiple
|
||||
>
|
||||
<!-- 上传文件按钮 -->
|
||||
<el-button type="primary" :disabled="fileList.length >= props.limit">
|
||||
{{ props.uploadBtnText }}
|
||||
</el-button>
|
||||
|
||||
<!-- 文件列表 -->
|
||||
<template #file="{ file }">
|
||||
<div class="el-upload-list__item-info">
|
||||
<a class="el-upload-list__item-name" @click="handleDownload(file)">
|
||||
<el-icon><Document /></el-icon>
|
||||
<span class="el-upload-list__item-file-name">{{ file.name }}</span>
|
||||
<span class="el-icon--close" @click="handleRemove(file.url!)">
|
||||
<el-icon><Close /></el-icon>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
|
||||
<el-progress
|
||||
:style="{
|
||||
display: showProgress ? 'inline-flex' : 'none',
|
||||
width: '100%',
|
||||
}"
|
||||
:percentage="progressPercent"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
UploadRawFile,
|
||||
UploadUserFile,
|
||||
UploadProgressEvent,
|
||||
UploadRequestOptions,
|
||||
} from "element-plus";
|
||||
import VersionApi from "@/api/system/version";
|
||||
import OSS from "@/utils/oss-upload.js";
|
||||
let ossClient: any = null;
|
||||
async function getCredentials() {
|
||||
const res = await VersionApi.getCredentials();
|
||||
ossClient = new OSS({ ...res, stsToken: res.securityToken });
|
||||
console.log(ossClient);
|
||||
}
|
||||
onMounted(() => {
|
||||
getCredentials();
|
||||
});
|
||||
import CommonApi, { FileInfo, uploadResponse } from "@/api/account/common";
|
||||
|
||||
const props = defineProps({
|
||||
version: {
|
||||
type: [Boolean, Number],
|
||||
default: "",
|
||||
},
|
||||
/**
|
||||
* 请求携带的额外参数
|
||||
*/
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
/**
|
||||
* 上传文件的参数名
|
||||
*/
|
||||
name: {
|
||||
type: String,
|
||||
default: "file",
|
||||
},
|
||||
/**
|
||||
* 文件上传数量限制
|
||||
*/
|
||||
limit: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
/**
|
||||
* 单个文件上传大小限制(单位MB)
|
||||
*/
|
||||
maxFileSize: {
|
||||
type: Number,
|
||||
default: 300,
|
||||
},
|
||||
/**
|
||||
* 上传文件类型
|
||||
*/
|
||||
accept: {
|
||||
type: String,
|
||||
default: "*",
|
||||
},
|
||||
/**
|
||||
* 上传按钮文本
|
||||
*/
|
||||
uploadBtnText: {
|
||||
type: String,
|
||||
default: "上传文件",
|
||||
},
|
||||
|
||||
/**
|
||||
* 样式
|
||||
*/
|
||||
style: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
width: "300px",
|
||||
};
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const modelValue = defineModel("modelValue", {
|
||||
type: [Array] as PropType<string[]>,
|
||||
required: true,
|
||||
default: () => [],
|
||||
});
|
||||
|
||||
const fileList = ref([] as UploadUserFile[]);
|
||||
|
||||
const showProgress = ref(false);
|
||||
const progressPercent = ref(0);
|
||||
|
||||
// 监听 modelValue 转换用于显示的 fileList
|
||||
watch(
|
||||
modelValue,
|
||||
(value) => {
|
||||
fileList.value = value.map((url) => {
|
||||
const name = url.substring(url.lastIndexOf("/") + 1);
|
||||
return {
|
||||
name: name,
|
||||
url: url,
|
||||
} as UploadUserFile;
|
||||
});
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* 上传前校验
|
||||
*/
|
||||
function handleBeforeUpload(file: UploadRawFile) {
|
||||
// 限制文件大小
|
||||
if (file.size > props.maxFileSize * 1024 * 1024) {
|
||||
ElMessage.warning("上传图片不能大于" + props.maxFileSize + "M");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* 上传文件
|
||||
*/
|
||||
function handleUpload(options: UploadRequestOptions) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const file = options.file;
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append(props.name, file);
|
||||
|
||||
// 处理附加参数
|
||||
Object.keys(props.data).forEach((key) => {
|
||||
formData.append(key, props.data[key]);
|
||||
});
|
||||
const name = file.name;
|
||||
showProgress.value = true;
|
||||
ossClient
|
||||
.partUpload(`/version/${props.version}${name.replace(".apk", "")}`, file, (p: number) => {
|
||||
console.log("进度", p);
|
||||
handleProgress({
|
||||
percent: Math.floor(p * 100),
|
||||
lengthComputable: true,
|
||||
loaded: p * file.size,
|
||||
total: file.size,
|
||||
target: null,
|
||||
timeStamp: Date.now(),
|
||||
type: "",
|
||||
eventPhase: 0,
|
||||
bubbles: false,
|
||||
cancelable: false,
|
||||
defaultPrevented: false,
|
||||
isTrusted: true,
|
||||
returnValue: true,
|
||||
srcElement: null,
|
||||
currentTarget: null,
|
||||
composed: false,
|
||||
cancelBubble: false,
|
||||
NONE: 0,
|
||||
CAPTURING_PHASE: 1,
|
||||
AT_TARGET: 2,
|
||||
BUBBLING_PHASE: 3,
|
||||
composedPath: () => [],
|
||||
initEvent: () => {},
|
||||
preventDefault: () => {},
|
||||
stopImmediatePropagation: () => {},
|
||||
stopPropagation: () => {},
|
||||
});
|
||||
// 这里可以根据进度做相应的处理,例如更新UI等
|
||||
})
|
||||
.then((data: any) => {
|
||||
console.log(data);
|
||||
resolve(data);
|
||||
})
|
||||
.catch((error: any) => {
|
||||
reject(error);
|
||||
});
|
||||
// CommonApi.upload(formData)
|
||||
// .then((data) => {
|
||||
// resolve(data);
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// reject(error);
|
||||
// });
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传进度
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
const handleProgress = (event: UploadProgressEvent) => {
|
||||
progressPercent.value = event.percent;
|
||||
if (progressPercent.value >= 100) {
|
||||
showProgress.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 上传成功
|
||||
*/
|
||||
const handleSuccess = (fileInfo: string) => {
|
||||
ElMessage.success("上传成功");
|
||||
modelValue.value = [...modelValue.value, fileInfo];
|
||||
};
|
||||
|
||||
const handleError = (error: any) => {
|
||||
ElMessage.error("上传失败");
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*/
|
||||
function handleRemove(fileUrl: string) {
|
||||
// CommonApi.delete(fileUrl).then(() => {
|
||||
modelValue.value = modelValue.value.filter((url) => url !== fileUrl);
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*/
|
||||
function handleDownload(file: UploadUserFile) {
|
||||
// const { url, name } = file;
|
||||
// if (url) {
|
||||
// CommonApi.download(url, name);
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-upload-list__item .el-icon--close {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 5px;
|
||||
color: var(--el-text-color-regular);
|
||||
cursor: pointer;
|
||||
opacity: 0.75;
|
||||
transition: opacity var(--el-transition-duration);
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
:deep(.el-upload-list) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:deep(.el-upload-list__item) {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -51,6 +51,7 @@ const modalConfig: IModalConfig<addRequest> = {
|
|||
attrs: {
|
||||
placeholder: "请输入版本号",
|
||||
},
|
||||
watch: () => { }
|
||||
},
|
||||
{
|
||||
type: "radio",
|
||||
|
|
@ -80,6 +81,7 @@ const modalConfig: IModalConfig<addRequest> = {
|
|||
attrs: {
|
||||
placeholder: "请上传版本文件",
|
||||
},
|
||||
hidden: true,
|
||||
initialValue: [],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -42,10 +42,18 @@
|
|||
</page-content>
|
||||
|
||||
<!-- 新增 -->
|
||||
<page-modal ref="addModalRef" :modal-config="addModalConfig" @submit-click="handleSubmitClick">
|
||||
<page-modal
|
||||
ref="addModalRef"
|
||||
@form-data-change="handleFormDataChange"
|
||||
:modal-config="addModalConfig"
|
||||
@submit-click="handleSubmitClick"
|
||||
>
|
||||
<template #url="scope">
|
||||
<FileUpload v-model="scope.formData[scope.prop]" :limit="1" v-bind="scope.attrs" />
|
||||
<!-- <Dict v-model="scope.formData[scope.prop]" code="gender" v-bind="scope.attrs" /> -->
|
||||
<version-file
|
||||
:version="version"
|
||||
v-model="scope.formData[scope.prop]"
|
||||
v-bind="scope.attrs"
|
||||
></version-file>
|
||||
</template>
|
||||
</page-modal>
|
||||
|
||||
|
|
@ -56,14 +64,18 @@
|
|||
@submit-click="handleSubmitClick"
|
||||
>
|
||||
<template #url="scope">
|
||||
<FileUpload v-model="scope.formData[scope.prop]" :limit="1" v-bind="scope.attrs" />
|
||||
<!-- <Dict v-model="scope.formData[scope.prop]" code="gender" v-bind="scope.attrs" /> -->
|
||||
<version-file
|
||||
:version="version"
|
||||
v-model="scope.formData[scope.prop]"
|
||||
v-bind="scope.attrs"
|
||||
></version-file>
|
||||
</template>
|
||||
</page-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import versionFile from "./components/version-file.vue";
|
||||
import VersionApi from "@/api/system/version";
|
||||
import type { IObject, IOperatData } from "@/components/CURD/types";
|
||||
import usePage from "@/components/CURD/usePage";
|
||||
|
|
@ -73,6 +85,19 @@ import editModalConfig from "./config/edit";
|
|||
import searchConfig from "./config/search";
|
||||
import { returnOptionsLabel } from "./config/config";
|
||||
|
||||
let version = ref<string | number>("");
|
||||
function handleFormDataChange(type: string, value: string | number) {
|
||||
version.value = value;
|
||||
if (type === "version" && value !== "") {
|
||||
addModalConfig.formItems[5].hidden = false;
|
||||
return;
|
||||
}
|
||||
if (type === "version" && value == "") {
|
||||
addModalConfig.formItems[5].hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
const refVersionFile = ref<any>();
|
||||
const {
|
||||
searchRef,
|
||||
contentRef,
|
||||
|
|
|
|||
|
|
@ -15,17 +15,17 @@
|
|||
<el-radio-button :value="1">员工</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item prop="merchantName" v-if="state.loginForm.loginType == 1">
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
v-model="state.loginForm.merchantName"
|
||||
v-model="state.loginForm.username"
|
||||
type="text"
|
||||
auto-complete="off"
|
||||
placeholder="商户号"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="username">
|
||||
<el-form-item prop="staffUserName" v-if="state.loginForm.loginType == 1">
|
||||
<el-input
|
||||
v-model="state.loginForm.username"
|
||||
v-model="state.loginForm.staffUserName"
|
||||
type="text"
|
||||
auto-complete="off"
|
||||
placeholder="账号"
|
||||
|
|
@ -97,19 +97,30 @@ const state = reactive({
|
|||
// rememberMe: false,
|
||||
code: "",
|
||||
uuid: "",
|
||||
merchantName: "",
|
||||
staffUserName: "",
|
||||
loginType: 0,
|
||||
},
|
||||
loginRules: {
|
||||
username: [{ required: true, trigger: "blur", message: "用户名不能为空" }],
|
||||
username: [{ required: true, trigger: "blur", message: "商户号不能为空" }],
|
||||
password: [{ required: true, trigger: "blur", message: "密码不能为空" }],
|
||||
code: [{ required: true, trigger: "change", message: "验证码不能为空" }],
|
||||
merchantName: [{ required: true, trigger: "change", message: "商户号不能为空" }],
|
||||
staffUserName: [{ required: true, trigger: "change", message: "用户名不能为空" }],
|
||||
},
|
||||
loading: false,
|
||||
redirect: undefined,
|
||||
});
|
||||
|
||||
watch(
|
||||
() => state.loginForm.loginType,
|
||||
(newval) => {
|
||||
if (1) {
|
||||
delete state.loginForm.staffUserName;
|
||||
} else {
|
||||
state.loginForm.staffUserName = "";
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
// 获取验证码
|
||||
getCode();
|
||||
|
|
@ -120,8 +131,8 @@ onMounted(() => {
|
|||
|
||||
let getinfo = localStorage.getItem("MerchantId");
|
||||
let info = JSON.parse(getinfo);
|
||||
if (info && info.merchantName) {
|
||||
state.loginForm.merchantName = info.merchantName;
|
||||
if (info && info.staffUserName) {
|
||||
state.loginForm.staffUserName = info.staffUserName;
|
||||
state.loginForm.username = info.username;
|
||||
}
|
||||
});
|
||||
|
|
@ -144,7 +155,6 @@ function getCookie() {
|
|||
password: password,
|
||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
|
||||
code: "",
|
||||
merchantName: "",
|
||||
loginType: 0,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
</div>
|
||||
<div class="tab" v-if="!preview">
|
||||
<el-radio-group v-model="typeListActive" @change="tabChange">
|
||||
<el-radio-button :label="item.id" v-for="item in typeList" :key="item.id">
|
||||
<el-radio-button :value="item.id" v-for="item in typeList" :key="item.id">
|
||||
{{ item.name }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
|
|
@ -61,16 +61,19 @@
|
|||
<el-button type="primary" :loading="loading" @click="submitHandle">保 存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<GoodsSelect ref="refSelGoods"></GoodsSelect>
|
||||
<GoodsSelect
|
||||
ref="refSelGoods"
|
||||
radio
|
||||
disableCategory
|
||||
@success="selectConfirmGoods"
|
||||
></GoodsSelect>
|
||||
<!-- <shopList ref="shopList" disableCategory radio @success="selectConfirmGoods" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { layoutList } from "./layout.js";
|
||||
// import shopList from "@/components/shopList/index.vue";
|
||||
// import { tbProduct } from "@/api/shop.js";
|
||||
// import { layoutlist, productGroup, productCategoryDetail, productGroupPut } from "@/api/pad.js";
|
||||
import { ElNotification } from "element-plus";
|
||||
import padApi from "@/api/account/padProd";
|
||||
export default {
|
||||
props: {
|
||||
category: {
|
||||
|
|
@ -88,7 +91,7 @@ export default {
|
|||
id: "",
|
||||
list: [],
|
||||
},
|
||||
typeListActive: 1,
|
||||
typeListActive: "1",
|
||||
typeList: [],
|
||||
preview: false,
|
||||
};
|
||||
|
|
@ -128,7 +131,7 @@ export default {
|
|||
try {
|
||||
if (this.typeList.find((item) => item.id == this.typeListActive).code == "text-menu") {
|
||||
if (!this.form.list.length) {
|
||||
this.$notify.error({
|
||||
ElNotification.error({
|
||||
title: "错误",
|
||||
message: "请生成菜单",
|
||||
});
|
||||
|
|
@ -142,7 +145,7 @@ export default {
|
|||
});
|
||||
|
||||
if (!isEmpty) {
|
||||
this.$notify.error({
|
||||
ElNotification.error({
|
||||
title: "错误",
|
||||
message: "请添加商品",
|
||||
});
|
||||
|
|
@ -152,35 +155,27 @@ export default {
|
|||
this.loading = true;
|
||||
let res = null;
|
||||
if (this.form.id) {
|
||||
await productGroupPut({
|
||||
await padApi.edit({
|
||||
id: this.form.id,
|
||||
padLayoutId: this.typeListActive,
|
||||
customName: "",
|
||||
productCategoryId: this.category || this.form.list[0].categoryId,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
sort: 1,
|
||||
remark: "",
|
||||
productIdList: this.form.list.map((item) => item.id),
|
||||
});
|
||||
} else {
|
||||
res = await productGroup({
|
||||
res = await padApi.add({
|
||||
padLayoutId: this.typeListActive,
|
||||
customName: "",
|
||||
productCategoryId: this.category,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
sort: 1,
|
||||
remark: "",
|
||||
productIdList: this.form.list.map((item) => item.id),
|
||||
});
|
||||
}
|
||||
this.loading = false;
|
||||
if (this.form.id) {
|
||||
this.$notify.success({
|
||||
ElNotification.success({
|
||||
title: "提示",
|
||||
message: "编辑成功",
|
||||
});
|
||||
} else {
|
||||
this.$notify.success({
|
||||
ElNotification.success({
|
||||
title: "提示",
|
||||
message: "添加成功",
|
||||
});
|
||||
|
|
@ -194,11 +189,9 @@ export default {
|
|||
},
|
||||
// 获取
|
||||
async layoutlist() {
|
||||
this.typeList = layoutList;
|
||||
return;
|
||||
try {
|
||||
const res = await layoutlist();
|
||||
this.typeList = res;
|
||||
const res = await padApi.getLayout();
|
||||
this.typeList = res.records;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
|
@ -212,15 +205,16 @@ export default {
|
|||
selectConfirmGoods(res) {
|
||||
// this.form.list = res
|
||||
const flag = this.form.list.filter((item) => item.id == res[0].id);
|
||||
this.form.list[this.activeItem] = { ...res[0] };
|
||||
|
||||
if (flag.length) {
|
||||
this.$notify({
|
||||
ElNotification({
|
||||
title: "注意",
|
||||
message: "请勿重复添加",
|
||||
type: "error",
|
||||
});
|
||||
} else {
|
||||
this.$set(this.form.list, this.activeItem, { ...res[0] });
|
||||
this.form.list[this.activeItem] = { ...res[0] };
|
||||
}
|
||||
},
|
||||
// 切换tab
|
||||
|
|
@ -241,7 +235,7 @@ export default {
|
|||
async productCategoryDetail(id) {
|
||||
try {
|
||||
this.pageLoading = true;
|
||||
const res = await productCategoryDetail(id);
|
||||
const res = await padApi.get({ id });
|
||||
this.pageLoading = false;
|
||||
this.typeListActive = res.padLayoutId;
|
||||
this.form.id = res.id;
|
||||
|
|
@ -259,7 +253,7 @@ export default {
|
|||
// 显示 type=1 编辑 type=2预览
|
||||
async show(id = "", type = 1) {
|
||||
this.reset();
|
||||
this.typeListActive = 1;
|
||||
this.typeListActive = "1";
|
||||
this.dialogVisible = true;
|
||||
this.tabChange();
|
||||
if (id) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
<el-table-column label="自定义分类" prop="customName"></el-table-column>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" v-if="isPcBowser">拖动排序</el-button>
|
||||
<el-button type="text" @click="editorHandle(scope.row, 1)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle(scope.row.id)">
|
||||
<template #reference>
|
||||
|
|
@ -76,7 +75,7 @@ import AddPadPage from "./components/addPadPage.vue";
|
|||
import paoductCategoryApi from "@/api/product/productclassification";
|
||||
import padProdApi from "@/api/account/padProd";
|
||||
import { swapArrayEle } from "@/utils/tools.js";
|
||||
|
||||
import { ElMessage, ElNotification } from "element-plus";
|
||||
export default {
|
||||
components: {
|
||||
AddPadPage,
|
||||
|
|
@ -101,11 +100,6 @@ export default {
|
|||
},
|
||||
mounted() {
|
||||
this.tbShopCategoryGet();
|
||||
if (this.isPcBowser) {
|
||||
this.$nextTick(() => {
|
||||
this.tableDrag();
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 搜索分类
|
||||
|
|
@ -150,8 +144,8 @@ export default {
|
|||
// 删除
|
||||
async delTableHandle(id) {
|
||||
try {
|
||||
await padProdApi.delete(id);
|
||||
this.$message.success("已删除");
|
||||
await padProdApi.delete({ id });
|
||||
ElMessage.success("已删除");
|
||||
this.getTableData();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
@ -171,7 +165,7 @@ export default {
|
|||
if (this.selectCatory.id) {
|
||||
this.$refs.AddPadPage.show();
|
||||
} else {
|
||||
this.$notify.error({
|
||||
ElNotification.error({
|
||||
title: "错误",
|
||||
message: "请选择分类",
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<el-button type="primary" @click="resetting">重置</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="安全手机号">
|
||||
{{ form.phone | phoneFilter }}
|
||||
{{ phoneFilter(form.phone) }}
|
||||
</el-form-item>
|
||||
<el-form-item label="验证码">
|
||||
<el-input
|
||||
|
|
@ -118,8 +118,6 @@ export default {
|
|||
type: "success",
|
||||
});
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
phoneFilter(d) {
|
||||
let str = d + "";
|
||||
return str.substr(0, 3) + "***" + str.substr(-4);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ const contentConfig = {
|
|||
label: "优惠类型",
|
||||
align: "center",
|
||||
prop: "discountType",
|
||||
templet: "custom",
|
||||
slotName: "options",
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
<template></template>
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
import VersionApi, { type payType } from "@/api/account/payType";
|
||||
|
||||
|
||||
import { returnOptions, switchAttr } from "./config";
|
||||
import type { IModalConfig } from "@/components/CURD/types";
|
||||
|
||||
const modalConfig: IModalConfig<payType> = {
|
||||
pageName: "sys:user",
|
||||
dialog: {
|
||||
title: "添加支付方式",
|
||||
width: 800,
|
||||
draggable: true,
|
||||
},
|
||||
form: {
|
||||
labelWidth: 140,
|
||||
},
|
||||
formAction: function (data) {
|
||||
return VersionApi.add({ ...data });
|
||||
},
|
||||
beforeSubmit(data) {
|
||||
console.log("提交之前处理", data);
|
||||
},
|
||||
formItems: [
|
||||
|
||||
{
|
||||
label: "支付类型",
|
||||
prop: "payType",
|
||||
rules: [{ required: true, message: "请选择支付类型", trigger: "blur" }],
|
||||
type: "select",
|
||||
attrs: {
|
||||
placeholder: "请选择支付类型",
|
||||
},
|
||||
options: returnOptions("payType"),
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "支付名称",
|
||||
prop: "payName",
|
||||
rules: [{ required: true, message: "请输入支付名称", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入支付名称",
|
||||
},
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "switch",
|
||||
label: "是否是系统级支付",
|
||||
prop: "isSystem",
|
||||
attrs: { ...switchAttr },
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
initialValue: 0
|
||||
|
||||
},
|
||||
{
|
||||
type: "switch",
|
||||
label: "是否快捷展示",
|
||||
prop: "isShowShortcut",
|
||||
attrs: { ...switchAttr },
|
||||
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
initialValue: 0
|
||||
|
||||
}, {
|
||||
type: "switch",
|
||||
label: "是否允许退款",
|
||||
prop: "isRefundable",
|
||||
attrs: { ...switchAttr },
|
||||
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
initialValue: 0
|
||||
},
|
||||
{
|
||||
type: "switch",
|
||||
label: "是否打开钱箱",
|
||||
prop: "isOpenCashDrawer",
|
||||
attrs: { ...switchAttr },
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
initialValue: 0
|
||||
|
||||
},
|
||||
{
|
||||
type: "radio",
|
||||
label: "是否虚拟",
|
||||
prop: "isIdeal",
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
initialValue: 1,
|
||||
options: returnOptions('isIdeal')
|
||||
},
|
||||
{
|
||||
type: "switch",
|
||||
label: "是否显示",
|
||||
attrs: { ...switchAttr },
|
||||
prop: "isDisplay",
|
||||
initialValue: 0
|
||||
},
|
||||
|
||||
{
|
||||
type: "input-number",
|
||||
label: "排序",
|
||||
prop: "sorts",
|
||||
},
|
||||
{
|
||||
type: "UpImage",
|
||||
label: "图标",
|
||||
prop: "icon",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||||
export default reactive(modalConfig);
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
export interface options {
|
||||
label: string;
|
||||
value: string | number;
|
||||
[property: string]: any;
|
||||
}
|
||||
export interface optionObject {
|
||||
[property: string]: options[];
|
||||
}
|
||||
const options: optionObject = {
|
||||
payType: [
|
||||
{ label: "现金", value: "cash" },
|
||||
{ label: "微信", value: "weixin" },
|
||||
{ label: "银行卡", value: "bank" },
|
||||
{ label: "支付宝", value: "alipay" },
|
||||
{ label: "刷卡", value: "deposit" },
|
||||
{ label: "挂单", value: "arrears" },
|
||||
{ label: "刷卡", value: "deposit" },
|
||||
{ label: "储值", value: "member-account" },
|
||||
{ label: "自定义", value: "virtual" },
|
||||
],
|
||||
isIdeal: [
|
||||
{ label: "否", value: 0 },
|
||||
{ label: "是", value: 1 },
|
||||
]
|
||||
};
|
||||
|
||||
export const switchAttr = {
|
||||
"active-value": 1,
|
||||
"inactive-value": 0,
|
||||
}
|
||||
|
||||
|
||||
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 : "";
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
import Api from "@/api/account/payType";
|
||||
import type { IContentConfig } from "@/components/CURD/types";
|
||||
|
||||
const contentConfig: IContentConfig = {
|
||||
pageName: "sys:user",
|
||||
table: {
|
||||
border: true,
|
||||
highlightCurrentRow: true,
|
||||
},
|
||||
pagination: {
|
||||
background: true,
|
||||
layout: "prev,pager,next,jumper,total,sizes",
|
||||
pageSize: 20,
|
||||
pageSizes: [10, 20, 30, 50],
|
||||
},
|
||||
indexAction: function (params) {
|
||||
return Api.getList();
|
||||
},
|
||||
modifyAction: function (data) {
|
||||
return Api.edit(data);
|
||||
},
|
||||
pk: "id",
|
||||
toolbar: ["add"],
|
||||
defaultToolbar: ["refresh", "filter", "search"],
|
||||
cols: [
|
||||
// { type: "selection", width: 50, align: "center" },
|
||||
{
|
||||
label: "图标",
|
||||
align: "center",
|
||||
prop: "icon",
|
||||
templet: 'image'
|
||||
},
|
||||
{
|
||||
label: "支付方式",
|
||||
align: "center",
|
||||
prop: "payName",
|
||||
},
|
||||
{
|
||||
label: "支付类型",
|
||||
align: "center",
|
||||
prop: "payType",
|
||||
},
|
||||
|
||||
{
|
||||
label: "开钱箱权限",
|
||||
align: "center",
|
||||
prop: "isOpenCashDrawer",
|
||||
templet: 'custom',
|
||||
slotName: 'switch'
|
||||
},
|
||||
{
|
||||
label: "是否生效",
|
||||
align: "center",
|
||||
prop: "isDisplay",
|
||||
templet: 'custom',
|
||||
slotName: 'switch'
|
||||
},
|
||||
{
|
||||
label: "条件排序",
|
||||
align: "center",
|
||||
prop: "sorts",
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
align: "center",
|
||||
fixed: "right",
|
||||
width: 280,
|
||||
templet: "tool",
|
||||
operat: ["edit"],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default contentConfig;
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
import VersionApi, { type payType } from "@/api/account/payType";
|
||||
|
||||
|
||||
import { returnOptions, switchAttr } from "./config";
|
||||
import type { IModalConfig } from "@/components/CURD/types";
|
||||
|
||||
const modalConfig: IModalConfig<payType> = {
|
||||
pageName: "sys:user",
|
||||
dialog: {
|
||||
title: "编辑支付方式",
|
||||
width: 800,
|
||||
draggable: true,
|
||||
},
|
||||
form: {
|
||||
labelWidth: 140,
|
||||
},
|
||||
formAction: function (data) {
|
||||
return VersionApi.edit({ ...data });
|
||||
},
|
||||
beforeSubmit(data) {
|
||||
console.log("提交之前处理", data);
|
||||
},
|
||||
formItems: [
|
||||
|
||||
{
|
||||
label: "支付类型",
|
||||
prop: "payType",
|
||||
rules: [{ required: true, message: "请选择支付类型", trigger: "blur" }],
|
||||
type: "select",
|
||||
attrs: {
|
||||
placeholder: "请选择支付类型",
|
||||
},
|
||||
options: returnOptions("payType"),
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "支付名称",
|
||||
prop: "payName",
|
||||
rules: [{ required: true, message: "请输入支付名称", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入支付名称",
|
||||
},
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "switch",
|
||||
label: "是否是系统级支付",
|
||||
prop: "isSystem",
|
||||
attrs: { ...switchAttr },
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
initialValue: 0
|
||||
|
||||
},
|
||||
{
|
||||
type: "switch",
|
||||
label: "是否快捷展示",
|
||||
prop: "isShowShortcut",
|
||||
attrs: { ...switchAttr },
|
||||
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
initialValue: 0
|
||||
|
||||
}, {
|
||||
type: "switch",
|
||||
label: "是否允许退款",
|
||||
prop: "isRefundable",
|
||||
attrs: { ...switchAttr },
|
||||
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
initialValue: 0
|
||||
},
|
||||
{
|
||||
type: "switch",
|
||||
label: "是否打开钱箱",
|
||||
prop: "isOpenCashDrawer",
|
||||
attrs: { ...switchAttr },
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
initialValue: 0
|
||||
|
||||
},
|
||||
{
|
||||
type: "radio",
|
||||
label: "是否虚拟",
|
||||
prop: "isIdeal",
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
initialValue: 1,
|
||||
options: returnOptions('isIdeal')
|
||||
},
|
||||
{
|
||||
type: "switch",
|
||||
label: "是否显示",
|
||||
attrs: { ...switchAttr },
|
||||
prop: "isDisplay",
|
||||
initialValue: 0
|
||||
},
|
||||
|
||||
{
|
||||
type: "input-number",
|
||||
label: "排序",
|
||||
prop: "sorts",
|
||||
},
|
||||
{
|
||||
type: "UpImage",
|
||||
label: "图标",
|
||||
prop: "icon",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||||
export default reactive(modalConfig);
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import type { ISearchConfig } from "@/components/CURD/types";
|
||||
|
||||
const searchConfig: ISearchConfig = {
|
||||
pageName: "sys:user",
|
||||
formItems: [
|
||||
{
|
||||
type: "input",
|
||||
label: "版本号",
|
||||
prop: "keywords",
|
||||
attrs: {
|
||||
placeholder: "请输入版本号",
|
||||
clearable: true,
|
||||
style: {
|
||||
width: "200px",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default searchConfig;
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 列表 -->
|
||||
<!-- 搜索 -->
|
||||
<!-- <page-search
|
||||
ref="searchRef"
|
||||
:search-config="searchConfig"
|
||||
@query-click="handleQueryClick"
|
||||
@reset-click="handleResetClick"
|
||||
/> -->
|
||||
<!-- 列表 -->
|
||||
<page-content
|
||||
ref="contentRef"
|
||||
:content-config="contentConfig"
|
||||
@add-click="handleAddClick"
|
||||
@edit-click="handleEditClick"
|
||||
@export-click="handleExportClick"
|
||||
@search-click="handleSearchClick"
|
||||
@toolbar-click="handleToolbarClick"
|
||||
@operat-click="handleOperatClick"
|
||||
@filter-change="handleFilterChange"
|
||||
>
|
||||
<template #status="scope">
|
||||
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
||||
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #options="scope">
|
||||
{{ returnOptionsLabel(scope.prop, scope.row[scope.prop]) }}
|
||||
</template>
|
||||
<template #switch="scope">
|
||||
<el-switch v-model="scope.row[scope.prop]" disabled></el-switch>
|
||||
</template>
|
||||
<template #mobile="scope">
|
||||
<el-text>{{ scope.row[scope.prop] }}</el-text>
|
||||
<copy-button
|
||||
v-if="scope.row[scope.prop]"
|
||||
:text="scope.row[scope.prop]"
|
||||
style="margin-left: 2px"
|
||||
/>
|
||||
</template>
|
||||
</page-content>
|
||||
|
||||
<!-- 新增 -->
|
||||
<page-modal
|
||||
ref="addModalRef"
|
||||
:modal-config="addModalConfig"
|
||||
@submit-click="handleSubmitClick"
|
||||
></page-modal>
|
||||
|
||||
<!-- 编辑 -->
|
||||
<page-modal
|
||||
ref="editModalRef"
|
||||
:modal-config="editModalConfig"
|
||||
@submit-click="handleSubmitClick"
|
||||
></page-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import VersionApi from "@/api/system/version";
|
||||
import type { IObject, IOperatData } from "@/components/CURD/types";
|
||||
import usePage from "@/components/CURD/usePage";
|
||||
import addModalConfig from "./config/add";
|
||||
import contentConfig from "./config/content";
|
||||
import editModalConfig from "./config/edit";
|
||||
import searchConfig from "./config/search";
|
||||
import { returnOptionsLabel } from "./config/config";
|
||||
|
||||
const {
|
||||
searchRef,
|
||||
contentRef,
|
||||
addModalRef,
|
||||
editModalRef,
|
||||
handleQueryClick,
|
||||
handleResetClick,
|
||||
// handleAddClick,
|
||||
// handleEditClick,
|
||||
handleSubmitClick,
|
||||
handleExportClick,
|
||||
handleSearchClick,
|
||||
handleFilterChange,
|
||||
} = usePage();
|
||||
|
||||
// 新增
|
||||
async function handleAddClick() {
|
||||
addModalRef.value?.setModalVisible();
|
||||
// addModalConfig.formItems[2]!.attrs!.data =
|
||||
}
|
||||
// 编辑
|
||||
async function handleEditClick(row: IObject) {
|
||||
editModalRef.value?.handleDisabled(false);
|
||||
editModalRef.value?.setModalVisible();
|
||||
// 根据id获取数据进行填充
|
||||
console.log(row);
|
||||
editModalRef.value?.setFormData({ ...row });
|
||||
}
|
||||
1;
|
||||
// 其他工具栏
|
||||
function handleToolbarClick(name: string) {
|
||||
console.log(name);
|
||||
if (name === "custom1") {
|
||||
ElMessage.success("点击了自定义1按钮");
|
||||
}
|
||||
}
|
||||
// 其他操作列
|
||||
async function handleOperatClick(data: IOperatData) {
|
||||
console.log(data);
|
||||
}
|
||||
</script>
|
||||
|
|
@ -34,10 +34,14 @@
|
|||
<span class="totalPrice">¥{{ carts.payMoney }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<el-button type="primary" @click="createOrder">微信/支付宝</el-button>
|
||||
<el-button type="primary" @click="createOrder">现金</el-button>
|
||||
<el-button type="primary" @click="createOrder">更多支付</el-button>
|
||||
<div class="btn-group" v-if="isXianFuKuan">
|
||||
<el-button type="primary" size="large" @click="createOrder">微信/支付宝</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder">现金</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder">更多支付</el-button>
|
||||
</div>
|
||||
<div class="btn-group" v-else>
|
||||
<el-button type="primary" size="large" @click="createOrder">仅下单</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder">去结账</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -47,6 +51,8 @@
|
|||
import cartsItem from "./item.vue";
|
||||
import { useCartsStore } from "@/store/modules/carts";
|
||||
|
||||
let isXianFuKuan = ref(true);
|
||||
|
||||
const props = defineProps({
|
||||
goodsList: {
|
||||
type: Array,
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
<template>
|
||||
<div class="controls">
|
||||
<div class="input-number">
|
||||
<div class="reduce" @click="carts.changeNumber(-1, carts.selCart)">
|
||||
<div class="input-number" :class="{ disabled: canEdit }">
|
||||
<div class="reduce" @click="changeCartNumber(-1)">
|
||||
<el-icon><Minus /></el-icon>
|
||||
</div>
|
||||
<span class="text">{{ carts.selCart.number || 1 }}</span>
|
||||
<div class="add" @click="carts.changeNumber(1, carts.selCart)">
|
||||
<div class="add" @click="changeCartNumber(1)">
|
||||
<el-icon><Plus /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-button
|
||||
v-for="(item, index) in controls"
|
||||
:key="index"
|
||||
v-bund="item"
|
||||
:disabled="btnDisabled(item)"
|
||||
@click="controlsClick(item)"
|
||||
>
|
||||
|
|
@ -30,7 +30,7 @@ const controls = ref([
|
|||
{ label: "规格", key: "", disabled: false, per: "sku" },
|
||||
{ label: "赠送", key: "is_gift", disabled: false, per: "cart" },
|
||||
{ label: "打包", key: "is_pack", disabled: false, per: "cart" },
|
||||
{ label: "删除", key: "del", disabled: false, per: "cart" },
|
||||
{ label: "删除", key: "del", disabled: false, per: "del" },
|
||||
{ label: "存单", key: "", disabled: false, per: "save" },
|
||||
{ label: "取单", key: "", disabled: false },
|
||||
{ label: "单品备注", key: "one-note", disabled: false, per: "one-note" },
|
||||
|
|
@ -78,9 +78,15 @@ const perList = computed(() => {
|
|||
if (!carts.selCart.id) {
|
||||
return ["all-wating", "all-note"];
|
||||
}
|
||||
if (carts.selCart.id) {
|
||||
return ["cart", "save", "one-note", "all-note", "all-wating"];
|
||||
if (carts.isCanSelectGroup) {
|
||||
return ["all-wating", "all-note", "del"];
|
||||
}
|
||||
if (carts.selCart.id) {
|
||||
return ["cart", "del", "save", "one-note", "all-note", "all-wating"];
|
||||
}
|
||||
});
|
||||
const canEdit = computed(() => {
|
||||
return !perList.value.includes("cart");
|
||||
});
|
||||
|
||||
function btnDisabled(item) {
|
||||
|
|
@ -101,6 +107,11 @@ function returnLabel(item) {
|
|||
}
|
||||
return item.label;
|
||||
}
|
||||
function changeCartNumber(step) {
|
||||
if (perList.value.includes("cart")) {
|
||||
carts.changeNumber(step, carts.selCart);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
@ -143,4 +154,7 @@ $gap: 10px;
|
|||
.add {
|
||||
}
|
||||
}
|
||||
.disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,274 @@
|
|||
<template>
|
||||
<div class="select_desk">
|
||||
<el-dialog width="410px" title="就餐人数" v-model="show">
|
||||
<div class="select_desk_dialog u-p-b-20">
|
||||
<key-board
|
||||
isCanEmpty
|
||||
v-model="number"
|
||||
@clear="clear"
|
||||
:max="max"
|
||||
:maxTips="'最多' + max + '位'"
|
||||
>
|
||||
<template #clear>
|
||||
<div>清空</div>
|
||||
</template>
|
||||
<template #input>
|
||||
<div class="u-p-l-20 u-p-r-20 u-flex w-full">
|
||||
<el-input
|
||||
placeholder="请输入就餐人数"
|
||||
v-model="number"
|
||||
@input="inputNumber"
|
||||
@change="inputChange"
|
||||
type="number"
|
||||
>
|
||||
<template #append>位</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</template>
|
||||
</key-board>
|
||||
<div class="confirm_btns">
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="confirm">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import keyBoard from "./keyboard.vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
export default {
|
||||
components: { keyBoard },
|
||||
props: {
|
||||
max: {
|
||||
type: Number,
|
||||
default: 99,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
number: "",
|
||||
show: false,
|
||||
hasOpen: false,
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
number(newval) {
|
||||
if (newval > this.max) {
|
||||
this.number = this.max;
|
||||
ElMessage.error("最多只能选择" + this.max + "位就餐人数");
|
||||
}
|
||||
// 使用正则表达式匹配正整数
|
||||
const regex = /^[1-9]\d*$/;
|
||||
// 如果输入的值不是正整数,则将其设置为上一个有效值
|
||||
if (!regex.test(newval)) {
|
||||
this.number = newval.substring(0, newval.length - 1);
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
inputNumber(e) {},
|
||||
inputChange(e) {},
|
||||
clear(e) {
|
||||
console.log(e);
|
||||
this.number = "";
|
||||
},
|
||||
confirm() {
|
||||
if (this.number > this.max) {
|
||||
ElMessage.error("最多只能选择" + this.max + "位就餐人数");
|
||||
}
|
||||
if (!this.number) {
|
||||
ElMessage.error("请选择就餐人数");
|
||||
}
|
||||
console.log(this.number);
|
||||
this.$emit("confirm", this.number);
|
||||
this.close();
|
||||
},
|
||||
open(number) {
|
||||
this.number = number || "";
|
||||
this.show = true;
|
||||
},
|
||||
close() {
|
||||
this.show = false;
|
||||
this.number = "";
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-button) {
|
||||
padding: 12px 20px;
|
||||
}
|
||||
|
||||
:deep(.el-input__inner::-webkit-inner-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
:deep(.el-input__inner::-webkit-outer-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
:deep(.el-button--success) {
|
||||
border-color: #22bf64;
|
||||
background-color: #22bf64;
|
||||
}
|
||||
.select_desk .btn {
|
||||
height: 34px;
|
||||
}
|
||||
.tags {
|
||||
font-size: 16px;
|
||||
&.using {
|
||||
color: rgb(234, 64, 37);
|
||||
}
|
||||
&.wait {
|
||||
color: rgb(252, 236, 79);
|
||||
}
|
||||
&.idle {
|
||||
color: rgb(137, 234, 71);
|
||||
}
|
||||
&.closed {
|
||||
color: rgb(221, 221, 221);
|
||||
filter: grayscale(1);
|
||||
}
|
||||
}
|
||||
::v-deep .inputs .el-input__inner {
|
||||
border-color: transparent !important;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
letter-spacing: 1.25px;
|
||||
font-size: 20px;
|
||||
}
|
||||
.select_desk .select_desk_dialog {
|
||||
display: flex;
|
||||
|
||||
flex-direction: column;
|
||||
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .nav {
|
||||
width: 286px;
|
||||
height: 38px;
|
||||
background: #dcf0e8;
|
||||
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .nav .li,
|
||||
.select_desk .select_desk_dialog .nav {
|
||||
border-radius: 4px;
|
||||
|
||||
display: flex;
|
||||
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .nav .li {
|
||||
width: 140px;
|
||||
height: 34px;
|
||||
color: #0fc161;
|
||||
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .nav .lion {
|
||||
background: #0fc161;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .inputs {
|
||||
width: 370px;
|
||||
line-height: 54px;
|
||||
margin-top: 24px;
|
||||
height: 54px;
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
letter-spacing: 1.25px;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .inputs .close {
|
||||
color: #aaa;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
line-height: 30px;
|
||||
top: 50%;
|
||||
margin-top: -15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard {
|
||||
display: flex;
|
||||
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 10px;
|
||||
border-right: 1px solid #dcdfe6;
|
||||
border-bottom: 1px solid #dcdfe6;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .li {
|
||||
height: 60px;
|
||||
width: 33.333%;
|
||||
|
||||
display: flex;
|
||||
|
||||
justify-content: center;
|
||||
|
||||
align-items: center;
|
||||
font-size: 24px;
|
||||
color: #212121;
|
||||
cursor: pointer;
|
||||
|
||||
user-select: none;
|
||||
border-left: 1px solid #dcdfe6;
|
||||
border-top: 1px solid #dcdfe6;
|
||||
|
||||
transition: all 0.1s;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .li:hover {
|
||||
background: #dcdfe6;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .li .icon {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .confirm {
|
||||
height: 140px;
|
||||
background: #ff9f2e;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .confirm:hover {
|
||||
background: #f88502;
|
||||
}
|
||||
|
||||
.confirm_btns {
|
||||
display: flex;
|
||||
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.confirm_btns .el-button {
|
||||
width: 175px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -61,6 +61,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ElMessage } from "element-plus";
|
||||
const props = defineProps({
|
||||
isCanEmpty: {
|
||||
type: Boolean,
|
||||
|
|
@ -108,6 +109,7 @@ function clearFunction() {
|
|||
if (props.isFloat) {
|
||||
return keyboradAdd(".");
|
||||
}
|
||||
number.value = "";
|
||||
}
|
||||
function keyboradAdd(n) {
|
||||
if (n == "." && `${number.value}`.includes(".")) {
|
||||
|
|
@ -120,7 +122,7 @@ function keyboradAdd(n) {
|
|||
}
|
||||
const newval = number.value + n;
|
||||
if (newval * 1 > props.max * 1) {
|
||||
return ElMessage.error(this.maxTips);
|
||||
return ElMessage.error(props.maxTips);
|
||||
}
|
||||
console.log(number.value);
|
||||
number.value = newval;
|
||||
|
|
|
|||
|
|
@ -73,9 +73,15 @@ function handleSelectionChange(val, index) {
|
|||
};
|
||||
}
|
||||
|
||||
const emits = defineEmits(["dialogpackageconfirm"]);
|
||||
const emits = defineEmits(["confirm"]);
|
||||
function confirm() {
|
||||
emits("dialogpackageconfirm", listdata.value, multipleSelection.value);
|
||||
const pro_group_info = listdata.value.groupSnap.map((v, index) => {
|
||||
return {
|
||||
...v,
|
||||
goods: [...multipleSelection.value[index]],
|
||||
};
|
||||
});
|
||||
emits("confirm", listdata.value, pro_group_info);
|
||||
show.value = false;
|
||||
}
|
||||
function open(item) {
|
||||
|
|
@ -87,11 +93,6 @@ function open(item) {
|
|||
});
|
||||
} catch (error) {}
|
||||
multipleSelection.value = [];
|
||||
// 不用选套餐
|
||||
if (item.groupType == 0) {
|
||||
emits("dialogpackageconfirm", listdata.value, [item.groupSnap[0].goods]);
|
||||
return false;
|
||||
}
|
||||
disabledshow.value = true;
|
||||
show.value = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,10 +88,11 @@
|
|||
|
||||
<div class="u-flex u-font-14 clear u-m-t-10 perpoles">
|
||||
<div
|
||||
@click="showDinerNumber"
|
||||
class="u-flex u-p-r-14 u-m-r-14"
|
||||
style="border-right: 1px solid #ebebeb; line-height: 1"
|
||||
>
|
||||
<span>就餐人数:-位</span>
|
||||
<span>就餐人数:{{ perpole || "-" }} 位</span>
|
||||
<el-icon><ArrowRight /></el-icon>
|
||||
</div>
|
||||
<a @click="clearCarts" style="color: #1890ff">清空</a>
|
||||
|
|
@ -181,11 +182,14 @@
|
|||
<chooseUser ref="refChooseUser" @chooseUser="chooseUserConfirm"></chooseUser>
|
||||
<!-- 打折 -->
|
||||
<discount ref="refDiscount" @confirm="discountConfirm"></discount>
|
||||
<!-- 就餐人数 -->
|
||||
<dinerNumber ref="refDinerNumber" @confirm="dinerNumberConfirm"></dinerNumber>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import Controls from "./components/control.vue";
|
||||
import discount from "./components/discount.vue";
|
||||
import dinerNumber from "./components/diner-number.vue";
|
||||
import note from "./components/note.vue";
|
||||
import Order from "./components/order.vue";
|
||||
import pack from "./components/pack.vue";
|
||||
|
|
@ -202,6 +206,16 @@ import productApi from "@/api/product/index";
|
|||
import tableApi from "@/api/account/table";
|
||||
import $status from "@/views/tool/table/status.js";
|
||||
import orderApi from "@/api/order/order";
|
||||
//就餐人数
|
||||
let perpole = ref("");
|
||||
const refDinerNumber = ref();
|
||||
function dinerNumberConfirm(e) {
|
||||
perpole.value = e;
|
||||
}
|
||||
function showDinerNumber() {
|
||||
refDinerNumber.value.open(perpole.value);
|
||||
}
|
||||
|
||||
//打折
|
||||
const refDiscount = ref();
|
||||
function discountConfirm(e) {}
|
||||
|
|
@ -224,17 +238,37 @@ function showChooseUser() {
|
|||
|
||||
//订单
|
||||
const showOrder = ref(false);
|
||||
function createOrder() {
|
||||
async function createOrder() {
|
||||
console.log(refCart.value.carts.table_code);
|
||||
orderApi.add({
|
||||
const res = await orderApi.add({
|
||||
orderId: "",
|
||||
shopId: "",
|
||||
userId: "",
|
||||
seatNum: 0,
|
||||
packFee: 0,
|
||||
originAmount: 29,
|
||||
tableCode: refCart.value.carts.table_code,
|
||||
dineMode: "dine-in",
|
||||
dineMode: diners.sel == 0 ? "dine-in" : "take-out",
|
||||
remark: "",
|
||||
placeNum: "",
|
||||
waitCall: false,
|
||||
vipPrice: false,
|
||||
});
|
||||
if (res) {
|
||||
showOrder.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
//套餐商品
|
||||
//可选套餐商品
|
||||
const refAddTaocan = ref();
|
||||
function taocanConfirm() {}
|
||||
function taocanConfirm(goods, pro_group_info) {
|
||||
refCart.value.carts.cartsPush({
|
||||
goods_type: "package",
|
||||
product_id: goods.id,
|
||||
sku_id: goods.skuList[0].id,
|
||||
pro_group_info: JSON.stringify(pro_group_info),
|
||||
});
|
||||
}
|
||||
function taocanShow(item) {
|
||||
refAddTaocan.value.open(item);
|
||||
}
|
||||
|
|
@ -264,6 +298,10 @@ function getTableList() {
|
|||
tableList.value = res.records;
|
||||
});
|
||||
}
|
||||
function getTableDetail(table_code) {
|
||||
tableApi.get(table_code);
|
||||
}
|
||||
function tablesearchInput() {}
|
||||
//返回台桌状态颜色
|
||||
function returnTableColor(key) {
|
||||
const item = $status[key];
|
||||
|
|
@ -276,7 +314,9 @@ function returnTableLabel(key) {
|
|||
}
|
||||
function tableClick(item) {
|
||||
console.log(item);
|
||||
getTableDetail(item.tableCode);
|
||||
table.value = item;
|
||||
refCart.value.carts.changeTable(item.tableCode);
|
||||
refTable.value.hide();
|
||||
}
|
||||
|
||||
|
|
@ -422,11 +462,18 @@ function goodsClick(item) {
|
|||
if (item.type === "package") {
|
||||
//固定套餐
|
||||
if (item.groupType == 0) {
|
||||
addCarts({
|
||||
const sendmsg = {
|
||||
goods_type: "package",
|
||||
sku_id: item.groupSnap[0].goods[0].skuId,
|
||||
product_id: item.id,
|
||||
number: item.groupSnap[0].goods[0].number,
|
||||
});
|
||||
};
|
||||
addCarts(sendmsg);
|
||||
// refCart.value.carts.cartsPush({
|
||||
// sku_id: item.groupSnap[0].goods[0].skuId,
|
||||
// product_id: item.id,
|
||||
// number: item.groupSnap[0].goods[0].number,
|
||||
// });
|
||||
return;
|
||||
}
|
||||
//可选套餐
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
<template>
|
||||
<el-dialog title="下载桌码" width="400px" v-model="dialogVisible" @open="reset">
|
||||
<el-form ref="form" :model="form" label-position="left">
|
||||
<el-form-item label="下载数量">
|
||||
<el-input-number v-model="form.number" :min="1" :max="500"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">下 载</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { downloadFile } from "@/utils/index";
|
||||
import TableApi from "@/api/account/table";
|
||||
import { ElMessage } from "element-plus";
|
||||
export default {
|
||||
props: {
|
||||
total: {
|
||||
type: [Number, String],
|
||||
default: 1,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
form: {
|
||||
number: 1,
|
||||
},
|
||||
resetForm: "",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.resetForm = { ...this.form };
|
||||
},
|
||||
methods: {
|
||||
async onSubmitHandle() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const file = await TableApi.downloadTableCode(this.form.number);
|
||||
this.loading = false;
|
||||
this.dialogVisible = false;
|
||||
ElMessage.success("下载成功");
|
||||
downloadFile(file, "桌码", "zip");
|
||||
} catch (error) {
|
||||
this.loading = false;
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
show(obj) {
|
||||
this.dialogVisible = true;
|
||||
// if (obj && obj.id) {
|
||||
// this.form = JSON.parse(JSON.stringify(obj))
|
||||
// }
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
reset() {
|
||||
this.form = { ...this.resetForm };
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -27,7 +27,9 @@
|
|||
<div class="">
|
||||
<el-button icon="plus" @click="addEaraShow()">添加区域</el-button>
|
||||
<el-button type="primary" icon="plus" @click="addTableShow()">添加台桌</el-button>
|
||||
<el-button type="primary" icon="download" @click="downloadTableCpde">下载桌台码</el-button>
|
||||
<el-button type="primary" icon="download" @click="showDownloadTableCode">
|
||||
下载桌台码
|
||||
</el-button>
|
||||
<el-button type="primary" icon="download" @click="downloadShopCpde">下载店铺码</el-button>
|
||||
</div>
|
||||
|
||||
|
|
@ -218,6 +220,8 @@
|
|||
<!-- 弹窗 -->
|
||||
<addEara ref="refAddEara" @success="areainit" />
|
||||
<addTable ref="refAddTable" @success="tableinit" />
|
||||
<!-- 下载桌台码 -->
|
||||
<downloadTableCode ref="refDownloadTableCode" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -228,6 +232,13 @@ import shopAreaApi from "@/api/account/shopArea";
|
|||
import tableApi from "@/api/account/table";
|
||||
import addEara from "./components/addEara.vue";
|
||||
import addTable from "./components/addTable.vue";
|
||||
import downloadTableCode from "./components/downloadTableCode.vue";
|
||||
|
||||
//桌台二维码
|
||||
const refDownloadTableCode = ref();
|
||||
function showDownloadTableCode() {
|
||||
refDownloadTableCode.value.show();
|
||||
}
|
||||
|
||||
let loading = ref(false);
|
||||
//工具方法
|
||||
|
|
|
|||
Loading…
Reference in New Issue