This commit is contained in:
2025-02-26 14:09:18 +08:00
13 changed files with 255 additions and 305 deletions

View File

@@ -49,7 +49,13 @@ const AuthAPI = {
data, data,
}); });
}, },
// 商品详情
getDetail(id: number) {
return request<any, Responseres>({
url: `${baseURL}/${id}`,
method: "get",
});
},
}; };

View File

@@ -798,8 +798,6 @@ function fetchPageData(formData: IObject = {}, isRestart = false) {
if (isRestart) { if (isRestart) {
pagination.currentPage = 1; pagination.currentPage = 1;
} }
console.log(props, 'debug1')
console.log(props.contentConfig, 'debug2')
props.contentConfig props.contentConfig
.indexAction( .indexAction(
showPagination showPagination

View File

@@ -198,6 +198,9 @@ const handlePreviewImage = (imageUrl: string) => {
const handlePreviewClose = () => { const handlePreviewClose = () => {
previewVisible.value = false; previewVisible.value = false;
}; };
watch(modelValue, (newValue) => {
fileList.value = newValue.map((url) => ({ url }) as UploadUserFile);
});
onMounted(() => { onMounted(() => {
fileList.value = modelValue.value.map((url) => ({ url }) as UploadUserFile); fileList.value = modelValue.value.map((url) => ({ url }) as UploadUserFile);

View File

@@ -15,13 +15,10 @@
<el-form-item label="桌型"> <el-form-item label="桌型">
<div style="width: 100%"> <div style="width: 100%">
<div> <div>
<el-button <el-button type="primary" @click="
type="primary" showLocation = true;
@click=" title = '新增';
showLocation = true; ">
title = '新增';
"
>
添加 添加
</el-button> </el-button>
</div> </div>
@@ -48,21 +45,11 @@
<h2>通知模板</h2> <h2>通知模板</h2>
<el-form ref="form" :model="form" :rules="rules" label-width="140px" label-position="left"> <el-form ref="form" :model="form" :rules="rules" label-width="140px" label-position="left">
<el-form-item label="排队成功提醒"> <el-form-item label="排队成功提醒">
<el-input <el-input v-model="form.successMsg" placeholder="请输入排队成功提醒" disabled style="width: 500px"></el-input>
v-model="form.successMsg"
placeholder="请输入排队成功提醒"
disabled
style="width: 500px"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="排队即将排到通知"> <el-form-item label="排队即将排到通知">
<div> <div>
<el-input <el-input v-model="form.nearMsg" placeholder="请输入排队成功提醒" disabled style="width: 500px"></el-input>
v-model="form.nearMsg"
placeholder="请输入排队成功提醒"
disabled
style="width: 500px"
></el-input>
<div class="duoshaozhuo"> <div class="duoshaozhuo">
<div>前面等待</div> <div>前面等待</div>
<el-input v-model="form.nearNum" placeholder="" disabled></el-input> <el-input v-model="form.nearNum" placeholder="" disabled></el-input>
@@ -71,12 +58,7 @@
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="排队到号提醒"> <el-form-item label="排队到号提醒">
<el-input <el-input v-model="form.callingMsg" placeholder="请输入排队到号提醒" disabled style="width: 500px"></el-input>
v-model="form.callingMsg"
placeholder="请输入排队到号提醒"
disabled
style="width: 500px"
></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@@ -107,18 +89,10 @@
<el-input v-model="forms.start" placeholder="请输入开始号码"></el-input> <el-input v-model="forms.start" placeholder="请输入开始号码"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="临近几桌提醒"> <el-form-item label="临近几桌提醒">
<el-input-number <el-input-number step-strictly v-model="forms.nearNum" placeholder="请输入临近几桌提醒"></el-input-number>
step-strictly
v-model="forms.nearNum"
placeholder="请输入临近几桌提醒"
></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="过号保留"> <el-form-item label="过号保留">
<el-input <el-input v-model="forms.postponeNum" :disabled="!forms.isPostpone" placeholder="请输入名称">
v-model="forms.postponeNum"
:disabled="!forms.isPostpone"
placeholder="请输入名称"
>
<template #prepend> <template #prepend>
<div> <div>
<span><el-checkbox v-model="forms.isPostpone">开启顺延</el-checkbox></span> <span><el-checkbox v-model="forms.isPostpone">开启顺延</el-checkbox></span>
@@ -131,13 +105,10 @@
<el-form-item label="" width="120"> <el-form-item label="" width="120">
<template v-slot="scope"> <template v-slot="scope">
<div style="display: flex; gap: 10px"> <div style="display: flex; gap: 10px">
<el-button <el-button plain @click="
plain showLocation = false;
@click=" forms = {};
showLocation = false; ">
forms = {};
"
>
取消 取消
</el-button> </el-button>
<el-button type="primary" @click="submitE">确定</el-button> <el-button type="primary" @click="submitE">确定</el-button>
@@ -218,10 +189,13 @@ export default {
const res = await callTableApi.deleteTable({ const res = await callTableApi.deleteTable({
callTableId: item.id, callTableId: item.id,
}); });
ElSubMenu.success("删除成功"); console.log(res, '挑食 ');
this.init(); if (res) {
this.init();
ElSubMenu.success("删除成功");
}
}) })
.catch(() => {}); .catch(() => { });
}, },
async submitE() { async submitE() {
if (this.title == "新增") { if (this.title == "新增") {
@@ -255,7 +229,7 @@ export default {
size: 10, size: 10,
}); });
this.formtable = data; this.formtable = data;
} catch (error) {} } catch (error) { }
}, },
// 保存 // 保存
submitHandle() { submitHandle() {
@@ -274,7 +248,7 @@ export default {
message: "提交成功", message: "提交成功",
type: "success", type: "success",
}); });
} catch (error) {} } catch (error) { }
} }
}); });
}, },
@@ -289,7 +263,7 @@ export default {
handleBeforeRemove(file, fileList) { handleBeforeRemove(file, fileList) {
for (let i = 0; i < this.files.length; i++) { for (let i = 0; i < this.files.length; i++) {
if (this.files[i].uid === file.uid) { if (this.files[i].uid === file.uid) {
crudQiNiu.del([this.files[i].id]).then((res) => {}); crudQiNiu.del([this.files[i].id]).then((res) => { });
return true; return true;
} }
} }
@@ -394,12 +368,12 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
> input { >input {
width: 120px; width: 120px;
border: none !important; border: none !important;
} }
> div { >div {
color: #999; color: #999;
width: 118px; width: 118px;
height: 33px; height: 33px;

View File

@@ -6,30 +6,27 @@
<div>全部</div> <div>全部</div>
<div>{{ tableData.totalCount || 0 }}</div> <div>{{ tableData.totalCount || 0 }}</div>
<div class="postionStyle" v-if="selecttopType == ''"> <div class="postionStyle" v-if="selecttopType == ''">
<el-icon style="transform: translateY(-4px)" color="#fff"><Check /></el-icon> <el-icon style="transform: translateY(-4px)" color="#fff">
<Check />
</el-icon>
</div> </div>
</li> </li>
<li <li v-for="item in tableData.records" :key="item.id" @click="gettypeevent(item.id)"
v-for="item in tableData.records" :class="[[selecttopType == item.id ? 'active' : '']]">
:key="item.id"
@click="gettypeevent(item.id)"
:class="[[selecttopType == item.id ? 'active' : '']]"
>
<div>{{ item.name }}</div> <div>{{ item.name }}</div>
<div>{{ item.totalCount || 0 }}</div> <div>{{ item.totalCount || 0 }}</div>
<div class="postionStyle" v-if="selecttopType == item.id"> <div class="postionStyle" v-if="selecttopType == item.id">
<el-icon style="transform: translateY(-4px)" color="#fff"><Check /></el-icon> <el-icon style="transform: translateY(-4px)" color="#fff">
<Check />
</el-icon>
</div> </div>
</li> </li>
</ul> </ul>
<div class="buttonstyle"> <div class="buttonstyle">
<el-button <el-button type="primary" @click="
type="primary" dialogVisibles = true;
@click=" phone = '';
dialogVisibles = true; ">
phone = '';
"
>
取号 取号
</el-button> </el-button>
<el-button plain type="primary" @click="toUrl">叫号记录</el-button> <el-button plain type="primary" @click="toUrl">叫号记录</el-button>
@@ -65,10 +62,7 @@
<el-dialog title="提示" v-model="dialogVisible" center width="30%"> <el-dialog title="提示" v-model="dialogVisible" center width="30%">
<div style="text-align: center"> <div style="text-align: center">
<div style="font-size: 16px">正在叫号请稍等</div> <div style="font-size: 16px">正在叫号请稍等</div>
<div <div v-if="profilepicturedata.state == 1" style="color: #52c41a; font-size: 16px; margin-top: 17px">
v-if="profilepicturedata.state == 1"
style="color: #52c41a; font-size: 16px; margin-top: 17px"
>
已发送至用户 已发送至用户
<i class="el-icon-circle-check" style="color: #52c41a"></i> <i class="el-icon-circle-check" style="color: #52c41a"></i>
</div> </div>
@@ -79,31 +73,24 @@
</div> </div>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button <el-button style="
style="
width: 176px; width: 176px;
height: 48px; height: 48px;
background: #f7f7fa; background: #f7f7fa;
box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.02); box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.02);
border-radius: 2px 2px 2px 2px; border-radius: 2px 2px 2px 2px;
border: 1px solid rgba(255, 255, 255, 0); border: 1px solid rgba(255, 255, 255, 0);
" " @click="dialogConfirm(2)">
@click="dialogConfirm(2)"
>
完成 完成
</el-button> </el-button>
<el-button <el-button type="primary" style="
type="primary"
style="
width: 189px; width: 189px;
height: 45px; height: 45px;
background: #ff4d4f; background: #ff4d4f;
box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.02); box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.02);
border-radius: 2px 2px 2px 2px; border-radius: 2px 2px 2px 2px;
border: 1px solid rgba(255, 255, 255, 0.28); border: 1px solid rgba(255, 255, 255, 0.28);
" " @click="dialogConfirm(3)">
@click="dialogConfirm(3)"
>
过号 过号
</el-button> </el-button>
</span> </span>
@@ -113,26 +100,20 @@
<el-dialog title="取号" v-model="dialogVisibles" width="30%"> <el-dialog title="取号" v-model="dialogVisibles" width="30%">
<div> <div>
<div style="color: #000">选择桌型</div> <div style="color: #000">选择桌型</div>
<ul <ul class="lineUpBoxUl" :class="[tableData.records.length > 2 ? 'dfs' : 'dfas']" style="margin-top: 10px">
class="lineUpBoxUl" <li v-for="item in tableData.records" :key="item.id" @click="selectTabletype = item"
:class="[tableData.records.length > 2 ? 'dfs' : 'dfas']" :class="[[selectTabletype.id == item.id ? 'active' : '']]">
style="margin-top: 10px"
>
<li
v-for="item in tableData.records"
:key="item.id"
@click="selectTabletype = item"
:class="[[selectTabletype.id == item.id ? 'active' : '']]"
>
<div>{{ item.name }}</div> <div>{{ item.name }}</div>
<div>{{ item.totalCount }}</div> <div>{{ item.totalCount }}</div>
<div class="postionStyle" v-if="selectTabletype.id == item.id"> <div class="postionStyle" v-if="selectTabletype.id == item.id">
<el-icon style="transform: translateY(-4px)" color="#fff"><Check /></el-icon> <el-icon style="transform: translateY(-4px)" color="#fff">
<Check />
</el-icon>
</div> </div>
</li> </li>
</ul> </ul>
<div style="margin-top: 20px; color: #000">手机号码</div> <div style="margin-top: 20px; color: #000">手机号码</div>
<div style="margin-top: 10px"> <div style="margin-top: 10px; border:1px solid #999">
<input v-model="phone" style="height: 30px" type="text" placeholder="填写号码" /> <input v-model="phone" style="height: 30px" type="text" placeholder="填写号码" />
</div> </div>
</div> </div>
@@ -178,9 +159,19 @@ export default {
}, },
async mounted() { async mounted() {
await this.getlist(); await this.getlist();
await this.getTableData(); // 获取桌台
await this.getTable();
}, },
methods: { methods: {
async getTable() {
const res = await callTableApi.getTable({
page: 1,
size: 9999,
});
this.tableData.records = res.records
this.selectTabletype = res.records[0]
},
// 确认叫号
async callTabletakeNumberEvent() { async callTabletakeNumberEvent() {
const res = await callTableApi.getTakeNumber({ const res = await callTableApi.getTakeNumber({
callTableId: this.selectTabletype.id, callTableId: this.selectTabletype.id,
@@ -189,7 +180,6 @@ export default {
name: this.selectTabletype.name, name: this.selectTabletype.name,
}); });
if (res.callNum) { if (res.callNum) {
this.getTableData();
this.getlist(); this.getlist();
this.dialogVisibles = false; this.dialogVisibles = false;
} }
@@ -212,7 +202,7 @@ export default {
async profilepicture(d) { async profilepicture(d) {
this.handleSpeak("请" + d.callNum + "用餐"); this.handleSpeak("请" + d.callNum + "用餐");
let res = await callTablecall({ let res = await callTableApi.callTableCall({
shopId: localStorage.getItem("shopId"), shopId: localStorage.getItem("shopId"),
callQueueId: d.id, callQueueId: d.id,
}); });
@@ -224,40 +214,25 @@ export default {
}, },
gettypeevent(d) { gettypeevent(d) {
this.selecttopType = d; this.selecttopType = d;
this.getTableData();
this.getlist(); this.getlist();
}, },
async dialogConfirm(value, item) { async dialogConfirm(value, item) {
if (value == 1) { if (value == 1) {
const res = await callTableput({ const res = await callTableApi.updateTableState({
shopId: localStorage.getItem("shopId"), shopId: localStorage.getItem("shopId"),
state: -1, state: -1,
callQueueId: item.id, callQueueId: item.id,
}); });
if (res) { if (res) {
this.getTableData();
this.getlist(); this.getlist();
} }
} else if (value == 2) { } else {
const res = await callTableput({ const res = await callTableApi.updateTableState({
shopId: localStorage.getItem("shopId"), shopId: localStorage.getItem("shopId"),
state: 2, state: value,
callQueueId: this.profilepictureInfo.id, callQueueId: this.profilepictureInfo.id,
}); });
if (res) { if (res) {
this.getTableData();
this.getlist();
this.dialogVisible = false;
}
} else if (value == 3) {
const res = await callTableput({
shopId: localStorage.getItem("shopId"),
state: 3,
callQueueId: this.profilepictureInfo.id,
});
if (res) {
this.getTableData();
this.getlist(); this.getlist();
this.dialogVisible = false; this.dialogVisible = false;
} }
@@ -266,21 +241,6 @@ export default {
toUrl() { toUrl() {
this.$router.push({ path: "/application/lineUpRecord" }); this.$router.push({ path: "/application/lineUpRecord" });
}, },
// 获取商品列表
async getTableData() {
try {
const res = await callTableApi.getTableNumberList({
page: 1,
size: 10,
});
// this.tableData.loading = false
this.tableData = res;
this.selectTabletype = res.records[0];
// this.tableData.total = res.totalElements
} catch (error) {
console.log(error);
}
},
async getlist() { async getlist() {
const res = await callTableApi.getTableNumberList({ const res = await callTableApi.getTableNumberList({
page: 1, page: 1,
@@ -314,8 +274,7 @@ li {
display: block !important; display: block !important;
} }
.lineUpBox { .lineUpBox {}
}
.lineUpBoxTop { .lineUpBoxTop {
display: flex; display: flex;
@@ -326,7 +285,8 @@ li {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0; padding: 0;
> li {
>li {
border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px;
border: 1px solid #dddfe6; border: 1px solid #dddfe6;
width: 112px; width: 112px;
@@ -334,12 +294,12 @@ li {
margin-right: 20px; margin-right: 20px;
position: relative; position: relative;
> div { >div {
margin-top: 8px; margin-top: 8px;
color: #999; color: #999;
} }
> div:first-child { >div:first-child {
color: #333333; color: #333333;
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500; font-weight: 500;
@@ -372,14 +332,14 @@ li {
.active { .active {
border: 2px solid #318afe; border: 2px solid #318afe;
> view:first-child { >view:first-child {
color: #318afe; color: #318afe;
} }
} }
} }
.buttonstyle { .buttonstyle {
> button { >button {
height: 31px; height: 31px;
padding: 5px 16px; padding: 5px 16px;
@@ -397,24 +357,24 @@ li {
border: 1px solid #dddfe6; border: 1px solid #dddfe6;
margin-top: 30px; margin-top: 30px;
> ul { >ul {
padding: 16px; padding: 16px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
> li { >li {
> div:nth-child(2) { >div:nth-child(2) {
margin-top: 15px; margin-top: 15px;
} }
} }
} }
> div { >div {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
> button { >button {
width: 169px; width: 169px;
height: 32px; height: 32px;
box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.02); box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.02);
@@ -422,7 +382,7 @@ li {
border: 1px solid #d9d9d9; border: 1px solid #d9d9d9;
} }
> button:first-child { >button:first-child {
background: #ffffff; background: #ffffff;
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400; font-weight: 400;
@@ -438,7 +398,7 @@ li {
} }
.dfas { .dfas {
> li { >li {
margin-right: 52px; margin-right: 52px;
} }
} }
@@ -448,19 +408,20 @@ li {
align-items: center; align-items: center;
padding: 0; padding: 0;
> li { >li {
border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px;
border: 1px solid #dddfe6; border: 1px solid #dddfe6;
text-align: center; text-align: center;
position: relative; position: relative;
min-width: 110px; min-width: 110px;
cursor: pointer; cursor: pointer;
> div {
>div {
margin-top: 8px; margin-top: 8px;
color: #999; color: #999;
} }
> div:first-child { >div:first-child {
color: #333333; color: #333333;
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500; font-weight: 500;
@@ -501,7 +462,7 @@ li {
.active { .active {
border: 2px solid #318afe; border: 2px solid #318afe;
> view:first-child { >view:first-child {
color: #318afe; color: #318afe;
} }
} }

View File

@@ -4,11 +4,7 @@
<!-- <el-button type="primary" icon="el-icon-plus" @click="$refs.addCoupon.show()"> <!-- <el-button type="primary" icon="el-icon-plus" @click="$refs.addCoupon.show()">
添加优惠券 添加优惠券
</el-button> --> </el-button> -->
<el-button <el-button type="primary" icon="plus" @click="$router.push({ name: 'add_coupon', query: { type: 1 } })">
type="primary"
icon="plus"
@click="$router.push({ name: 'add_coupon', query: { type: 1 } })"
>
添加优惠券 添加优惠券
</el-button> </el-button>
</div> </div>
@@ -19,8 +15,7 @@
<el-table-column label="使用门槛"> <el-table-column label="使用门槛">
<template v-slot="scope"> <template v-slot="scope">
{{ {{
`${scope.row.fullAmount}${ `${scope.row.fullAmount}${scope.row.discountAmount ? "" + scope.row.discountAmount + "" : ""
scope.row.discountAmount ? "" + scope.row.discountAmount + "" : ""
}` }`
}} }}
</template> </template>
@@ -42,10 +37,7 @@
<div style="display: flex; align-items: center; justify-content: center"> <div style="display: flex; align-items: center; justify-content: center">
<div style="width: 30px">{{ scope.row.number - scope.row.leftNumber }}</div> <div style="width: 30px">{{ scope.row.number - scope.row.leftNumber }}</div>
<div style="margin: 0 10px">|</div> <div style="margin: 0 10px">|</div>
<div <div style="color: #3f9eff; cursor: pointer; flex-shrink: 0" @click="couponDetailsOpen(scope.row)">
style="color: #3f9eff; cursor: pointer; flex-shrink: 0"
@click="couponDetailsOpen(scope.row)"
>
详情 详情
</div> </div>
</div> </div>
@@ -55,38 +47,28 @@
<el-table-column label="剩余" prop="leftNumber" /> <el-table-column label="剩余" prop="leftNumber" />
<el-table-column label="操作" width="150"> <el-table-column label="操作" width="150">
<template v-slot="scope"> <template v-slot="scope">
<el-button <el-button type="text" icon="el-icon-edit" @click="
type="text" $router.push({
icon="el-icon-edit" name: 'add_coupon',
@click=" query: { type: scope.row.type, id: scope.row.id },
$router.push({ })
name: 'add_coupon', ">
query: { type: scope.row.type, id: scope.row.id },
})
"
>
编辑 编辑
</el-button> </el-button>
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])"> <!-- <el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
<template #reference> <template #reference>
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important"> <el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important">
删除 删除
</el-button> </el-button>
</template> </template>
</el-popconfirm> </el-popconfirm> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<div class="head-container"> <div class="head-container">
<el-pagination <el-pagination :total="tableData.total" :current-page="tableData.page" :page-size="tableData.size"
:total="tableData.total" layout="total, sizes, prev, pager, next, jumper" @current-change="paginationChange" @size-change="sizeChange" />
:current-page="tableData.page"
:page-size="tableData.size"
layout="total, sizes, prev, pager, next, jumper"
@current-change="paginationChange"
@size-change="sizeChange"
/>
</div> </div>
<couponDetails ref="couponDetails" @success="resetHandle" /> <couponDetails ref="couponDetails" @success="resetHandle" />
</div> </div>

View File

@@ -14,7 +14,9 @@ const modalConfig: IModalConfig<addRequest> = {
labelWidth: 100, labelWidth: 100,
}, },
formAction: function (data) { formAction: function (data) {
return printerApi.add(data); let obj = { ...data }
obj.printType = data.printType.join(',')
return printerApi.add(obj);
}, },
beforeSubmit(data) { beforeSubmit(data) {
console.log("提交之前处理", data); console.log("提交之前处理", data);
@@ -54,6 +56,7 @@ const modalConfig: IModalConfig<addRequest> = {
{ {
label: "ip地址", label: "ip地址",
prop: "address", prop: "address",
rules: [{ required: true, message: "请输入ip地址", trigger: "blur" }],
type: "input", type: "input",
attrs: { attrs: {
placeholder: "请输入ip地址", placeholder: "请输入ip地址",

View File

@@ -32,6 +32,7 @@ export const options: optionObject = {
{ value: "all", label: '全部打印' }, { value: "all", label: '全部打印' },
{ value: "normal", label: '仅打印结账单「前台」' }, { value: "normal", label: '仅打印结账单「前台」' },
{ value: "one", label: '仅打印制作单「厨房」' }, { value: "one", label: '仅打印制作单「厨房」' },
{ value: "queue", label: '仅打印排队取号' },
], ],
printType: [ printType: [
{ label: "确认退款单", value: 'refund' }, { label: "确认退款单", value: 'refund' },

View File

@@ -41,10 +41,11 @@ const contentConfig: IContentConfig<getListRequest> = {
], ],
cols: [ cols: [
// { type: "selection", width: 50, align: "center" }, // { type: "selection", width: 50, align: "center" },
{ label: "设备名称", align: "center", prop: "id", show: false }, { label: "设备名称", align: "center", prop: "name" },
{ label: "设备号", align: "center", prop: "username" }, // { label: "设备号", align: "center", prop: "username" },
{ label: "品牌", align: "center", prop: "avatar", templet: "image" }, { label: "品牌", align: "center", prop: "contentType", slotName: "contentType", templet: "custom", },
{ label: "打印类型", align: "center", prop: "deptName" }, // { label: "品牌", align: "center", prop: "avatar", templet: "image" },
{ label: "打印类型", align: "center", prop: "subType", slotName: "subType", templet: "custom", },
{ {
label: "状态", label: "状态",
align: "center", align: "center",

View File

@@ -14,7 +14,9 @@ const modalConfig: IModalConfig<editRequest> = {
labelWidth: 100, labelWidth: 100,
}, },
formAction: function (data) { formAction: function (data) {
return printerApi.edit(data); let obj = { ...data }
obj.printType = data.printType.join(',')
return printerApi.edit(obj);
}, },
beforeSubmit(data) { beforeSubmit(data) {
console.log("提交之前处理", data); console.log("提交之前处理", data);
@@ -54,6 +56,7 @@ const modalConfig: IModalConfig<editRequest> = {
{ {
label: "ip地址", label: "ip地址",
prop: "address", prop: "address",
rules: [{ required: true, message: "请输入ip地址", trigger: "blur" }],
type: "input", type: "input",
attrs: { attrs: {
placeholder: "请输入ip地址", placeholder: "请输入ip地址",

View File

@@ -2,40 +2,30 @@
<div class="app-container"> <div class="app-container">
<!-- 列表 --> <!-- 列表 -->
<!-- 搜索 --> <!-- 搜索 -->
<page-search <page-search ref="searchRef" :search-config="searchConfig" @query-click="handleQueryClick"
ref="searchRef" @reset-click="handleResetClick" />
:search-config="searchConfig"
@query-click="handleQueryClick"
@reset-click="handleResetClick"
/>
<!-- 列表 --> <!-- 列表 -->
<page-content <page-content ref="contentRef" :content-config="contentConfig" @add-click="handleAddClick"
ref="contentRef" @edit-click="handleEditClick" @export-click="handleExportClick" @search-click="handleSearchClick"
:content-config="contentConfig" @toolbar-click="handleToolbarClick" @operat-click="handleOperatClick" @filter-change="handleFilterChange">
@add-click="handleAddClick"
@edit-click="handleEditClick"
@export-click="handleExportClick"
@search-click="handleSearchClick"
@toolbar-click="handleToolbarClick"
@operat-click="handleOperatClick"
@filter-change="handleFilterChange"
>
<template #status="scope"> <template #status="scope">
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'"> <el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }} {{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
</el-tag> </el-tag>
</template> </template>
<template #contentType="scope">
{{ scope.row.contentType == 'yxyPrinter' ? "云想印" : "飞鹅" }}
</template>
<template #subType="scope">
{{ scope.row.subType == 'label' ? "标签" : "小票" }}
</template>
<template #gender="scope"> <template #gender="scope">
<DictLabel v-model="scope.row[scope.prop]" code="gender" /> <DictLabel v-model="scope.row[scope.prop]" code="gender" />
</template> </template>
<template #mobile="scope"> <template #mobile="scope">
<el-text>{{ scope.row[scope.prop] }}</el-text> <el-text>{{ scope.row[scope.prop] }}</el-text>
<copy-button <copy-button v-if="scope.row[scope.prop]" :text="scope.row[scope.prop]" style="margin-left: 2px" />
v-if="scope.row[scope.prop]"
:text="scope.row[scope.prop]"
style="margin-left: 2px"
/>
</template> </template>
</page-content> </page-content>
@@ -47,11 +37,7 @@
</page-modal> </page-modal>
<!-- 编辑 --> <!-- 编辑 -->
<page-modal <page-modal ref="editModalRef" :modal-config="editModalConfig" @submit-click="handleSubmitClick">
ref="editModalRef"
:modal-config="editModalConfig"
@submit-click="handleSubmitClick"
>
<template #gender="scope"> <template #gender="scope">
<Dict v-model="scope.formData[scope.prop]" code="gender" v-bind="scope.attrs" /> <Dict v-model="scope.formData[scope.prop]" code="gender" v-bind="scope.attrs" />
</template> </template>
@@ -60,7 +46,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import UserAPI from "@/api/system/user"; import UserAPI from "@/api/account/printer";
import type { IObject, IOperatData } from "@/components/CURD/types"; import type { IObject, IOperatData } from "@/components/CURD/types";
import usePage from "@/components/CURD/usePage"; import usePage from "@/components/CURD/usePage";
import addModalConfig from "./config/add"; import addModalConfig from "./config/add";
@@ -92,7 +78,10 @@ async function handleEditClick(row: IObject) {
editModalRef.value?.handleDisabled(false); editModalRef.value?.handleDisabled(false);
editModalRef.value?.setModalVisible(); editModalRef.value?.setModalVisible();
// 根据id获取数据进行填充 // 根据id获取数据进行填充
const data = await UserAPI.getFormData(row.id); let data = await UserAPI.get(row.id);
data.printType = data.printType.split(',');
data.classifyPrint = data.classifyPrint * 1;
editModalRef.value?.setFormData(data); editModalRef.value?.setFormData(data);
} }
// 其他工具栏 // 其他工具栏

View File

@@ -105,16 +105,7 @@ async function handleAddClick() {
} }
// 编辑 // 编辑
async function handleEditClick(row: IObject) { async function handleEditClick(row: IObject) {
console.log('handleEditClick') router.push({ name: 'addgoods', query: { goods_id: row.id } });
// editModalRef.value?.handleDisabled(false);
// 加载部门下拉数据源
// editModalConfig.formItems[2]!.attrs!.data = await UserAPI.getPage({ name: "" });
// editModalConfig.formItems[2]!.attrs!.data = await DeptAPI.getOptions();
// 根据id获取数据进行填充
// const data = await UserAPI.getunitinfo(row.id);
// editModalRef.value?.setFormData(data);
// editModalRef.value?.setModalVisible();
} }
const myDialogRef = ref(null) const myDialogRef = ref(null)
// 其他工具栏 // 其他工具栏

View File

@@ -56,24 +56,12 @@
<!-- <el-radio label="coupon">团购券</el-radio> --> <!-- <el-radio label="coupon">团购券</el-radio> -->
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<!-- <el-form-item label="规格类型">
<el-radio-group v-model="ruleForm.specId">
<el-radio label="normal">单规格</el-radio>
<el-radio label="sku">多规格</el-radio>
</el-radio-group>
</el-form-item> -->
<!-- <el-form-item label="套餐类型">
<el-radio-group v-model="ruleForm.groupType">
<el-radio label="0">固定套餐</el-radio>
<el-radio label="1">可选套餐</el-radio>
</el-radio-group>
</el-form-item> -->
<el-form-item label="套餐商品" v-if="ruleForm.type == 'package'"> <el-form-item label="套餐商品" v-if="ruleForm.type == 'package'">
<div style="display: block;width: 100%;"> <div style="display: block;width: 100%;">
<div class="head-container"> <div class="head-container">
<el-radio-group v-model="ruleForm.groupType" @change="typeChange"> <el-radio-group v-model="ruleForm.groupType" @change="typeChange">
<el-radio-button label="0">固定套餐</el-radio-button> <el-radio-button :label="0">固定套餐</el-radio-button>
<el-radio-button label="1">可选套餐</el-radio-button> <el-radio-button :label="1">可选套餐</el-radio-button>
</el-radio-group> </el-radio-group>
</div> </div>
<div v-if="ruleForm.groupType == '0'"> <div v-if="ruleForm.groupType == '0'">
@@ -88,7 +76,7 @@
</el-table-column> </el-table-column>
<el-table-column width="150"> <el-table-column width="150">
<template #header> <template #header>
<el-button type="primary" @click="addgoods">添加商品</el-button> <el-button type="primary" @click="addgoods(-1)">添加商品</el-button>
</template> </template>
<template v-slot="scope"> <template v-slot="scope">
<el-button type="text" :disabled="scope.row.type != 'sku'" <el-button type="text" :disabled="scope.row.type != 'sku'"
@@ -112,7 +100,7 @@
<el-button @click="ruleForm.proGroupVo.splice(index, 1)">删除</el-button> <el-button @click="ruleForm.proGroupVo.splice(index, 1)">删除</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div> <div style="margin-top: 20px;">
<el-table border :data="item.goods"> <el-table border :data="item.goods">
<el-table-column label="名称" prop="proName"></el-table-column> <el-table-column label="名称" prop="proName"></el-table-column>
<el-table-column label="规格" prop="skuName"></el-table-column> <el-table-column label="规格" prop="skuName"></el-table-column>
@@ -124,8 +112,7 @@
</el-table-column> </el-table-column>
<el-table-column width="150"> <el-table-column width="150">
<template #header> <template #header>
<!-- <el-button type="primary" <el-button type="primary" @click="addgoods(index);">添加商品</el-button>
@click="$refs.shopListRef.show([...form.proGroupVo[index].goods]); addGroupIndex = index">添加商品</el-button> -->
</template> </template>
<template v-slot="scope"> <template v-slot="scope">
<el-button type="text" :disabled="scope.row.type != 'sku'" <el-button type="text" :disabled="scope.row.type != 'sku'"
@@ -147,12 +134,11 @@
:key="item.id"></el-option> :key="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="ele.name" v-if="datas.selectSpeclist.length" v-for="ele in datas.selectSpeclist"
<el-form-item :label="item.name" v-if="datas.selectSpeclist.length" v-for="item in datas.selectSpeclist" :key="ele.name">
:key="item.name"> <el-checkbox-group v-model="ele.selectSpecResult" @change="selectSpecResultChange">
<el-checkbox-group v-model="item.selectSpecResult" @change="selectSpecResultChange"> <el-checkbox :value="element.name" :label="element.name" v-for="(element, index) in ele.children"
<el-checkbox :value="item.name" v-for="(ele, index) in item.children" :key="index">{{ ele.name :key="index"></el-checkbox>
}}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
<!-- 规格属性 --> <!-- 规格属性 -->
@@ -160,10 +146,8 @@
<SpecificationAttribute v-if="ruleForm.type != 'sku'" :info="ruleForm" :list="list" <SpecificationAttribute v-if="ruleForm.type != 'sku'" :info="ruleForm" :list="list"
ref="specificationAttributeRef"> ref="specificationAttributeRef">
</SpecificationAttribute> </SpecificationAttribute>
<SpecificationAttribute v-if="ruleForm.type == 'sku' && list.length" :specTableHeaders="datas.specTableHeaders" <SpecificationAttribute v-if="ruleForm.type == 'sku' && list.length" :specTableHeaders="datas.specTableHeaders"
:info="ruleForm" :list="list" ref="specificationAttributeRef"></SpecificationAttribute> :info="ruleForm" :list="list" ref="specificationAttributeRef"></SpecificationAttribute>
<el-form-item label="重量"> <el-form-item label="重量">
<el-col :span="12"> <el-col :span="12">
<div style="display: block;"> <div style="display: block;">
@@ -204,16 +188,16 @@
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="上架"> <el-form-item label="上架">
<el-switch v-model="ruleForm.isSale" active-value="1" inactive-value="0" /> <el-switch v-model="ruleForm.isSale" :active-value="1" :inactive-value="0" />
</el-form-item> </el-form-item>
<el-form-item label="库存开关"> <el-form-item label="库存开关">
<div style="display: block;"> <div style="display: block;">
<el-switch v-model="ruleForm.isStock" active-value="1" inactive-value="0" /> <el-switch v-model="ruleForm.isStock" :active-value="1" :inactive-value="0" />
<div style="color: #999;">关闭则不计算出入库数据</div> <div style="color: #999;">关闭则不计算出入库数据</div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="设为推荐" prop="delivery"> <el-form-item label="设为推荐" prop="delivery">
<el-switch v-model="ruleForm.isHot" active-value="1" inactive-value="0" /> <el-switch v-model="ruleForm.isHot" :active-value="1" :inactive-value="0" />
</el-form-item> </el-form-item>
<el-form-item label="库存数量"> <el-form-item label="库存数量">
<el-input-number v-model="ruleForm.stockNumber" :min="0" /> <el-input-number v-model="ruleForm.stockNumber" :min="0" />
@@ -311,7 +295,8 @@ let datas = reactive<datasForm>({
selectSkuTableIndex: 0, selectSkuTableIndex: 0,
selectSkuConfirmIndex: 0, selectSkuConfirmIndex: 0,
showSelectSku: false, showSelectSku: false,
selectSkuItem: {} selectSkuItem: {},
addGroupIndex: -1
}) })
let shopListRef = ref(null) let shopListRef = ref(null)
interface datasForm { interface datasForm {
@@ -325,7 +310,8 @@ interface datasForm {
selectSkuTableIndex: any, selectSkuTableIndex: any,
selectSkuConfirmIndex: number, selectSkuConfirmIndex: number,
showSelectSku: boolean, showSelectSku: boolean,
selectSkuItem: any selectSkuItem: any,
addGroupIndex: any
} }
interface RuleForm { interface RuleForm {
name: string, name: string,
@@ -336,7 +322,7 @@ interface RuleForm {
images: string[], images: string[],
type: string, type: string,
specId: any, specId: any,
groupType: string, groupType: any,
skuList: string[], skuList: string[],
weight: any, weight: any,
isAllowTempModifyPrice: any, isAllowTempModifyPrice: any,
@@ -436,7 +422,40 @@ const rules = reactive<FormRules<RuleForm>>({
}) })
onMounted(() => { onMounted(() => {
getList() getList()
if (router.currentRoute.value.query.goods_id) {
tbProductGetDetail(router.currentRoute.value.query.goods_id);
}
}) })
watch(() => router.currentRoute.value.query.goods_id, (val) => {
tbProductGetDetail(val);
})
async function tbProductGetDetail(id: any) {
// 获取商品详情
const res = await UserAPI3.getDetail(id);
changeTypeEnum(res.type)
for (const key in res) {
if (key !== 'images' && key !== 'days') {
(ruleForm as any)[key] = res[key];
}
}
ruleForm.images = res.images.map((item: any, index: number) => item);
ruleForm.days = res.days.split(',');
ruleForm.useTime = [res.startTime, res.endTime];
ruleForm.proGroupVo = res.groupSnap
if (res.type === "sku") {
await tbProductSpecGet()
selectSpecHandle(ruleForm.specId)
datas.selectSpeclist.forEach((item: any) => {
item.children.forEach((ele: any) => {
item.selectSpecResult.push(ele.name)
})
})
selectSpecResultChange()
} else {
list.value = ruleForm.skuList
}
}
// 选择套餐商品sku // 选择套餐商品sku
function selectSkuHandle(item: any, index: number) { function selectSkuHandle(item: any, index: number) {
// 把所有的设置为false // 把所有的设置为false
@@ -483,12 +502,12 @@ function showSelectSkuHandle(row: any, index: any, tabIndex: any) {
datas.selectSkuItem = obj datas.selectSkuItem = obj
} }
// 添加商品 // 添加商品
function addgoods() { function addgoods(index: number = -1) {
datas.addGroupIndex = index;
(shopListRef.value as any)?.opens() (shopListRef.value as any)?.opens()
} }
// 分组选择商品 // 分组选择商品
function selectShopRes(res: Array<any>) { function selectShopRes(res: Array<any>) {
console.log(res, '选择商品')
let newres = res.map(item => { let newres = res.map(item => {
item.proId = item.id item.proId = item.id
item.proName = item.name item.proName = item.name
@@ -507,19 +526,19 @@ function selectShopRes(res: Array<any>) {
} }
ruleForm.proGroupVo = [{ ...obj }] ruleForm.proGroupVo = [{ ...obj }]
} else { } else {
// if (this.addGroupIndex !== false) { if (datas.addGroupIndex != -1) {
// this.form.proGroupVo[this.addGroupIndex].count = newres.length ruleForm.proGroupVo[datas.addGroupIndex].count = newres.length
// this.form.proGroupVo[this.addGroupIndex].goods = newres ruleForm.proGroupVo[datas.addGroupIndex].goods = newres
// } else { } else {
let arr = [...ruleForm.proGroupVo] let arr = [...ruleForm.proGroupVo]
arr.push({ arr.push({
title: '', title: '',
count: newres.length, count: newres.length,
number: '', number: '',
goods: newres goods: newres
}) })
ruleForm.proGroupVo = [...arr] ruleForm.proGroupVo = [...arr]
// } }
} }
} }
// 获取单位、分类数据 // 获取单位、分类数据
@@ -532,10 +551,9 @@ function selectSpecResultChange() {
createSkuHeader(); createSkuHeader();
createSkuBody(); createSkuBody();
} }
// 生成多规格表头
function createSkuHeader() { function createSkuHeader() {
const headers = []; const headers = [];
for (let item of datas.selectSpeclist) { for (let item of datas.selectSpeclist) {
if (item.selectSpecResult.length) { if (item.selectSpecResult.length) {
headers.push({ headers.push({
@@ -546,8 +564,10 @@ function createSkuHeader() {
} }
datas.specTableHeaders = headers; datas.specTableHeaders = headers;
} }
// 可选套餐弹窗 // 可选套餐弹窗
function addtaocan() { function addtaocan() {
datas.addGroupIndex = -1;
(shopListRef.value as any)?.opens() (shopListRef.value as any)?.opens()
} }
// 生成多规格表体 // 生成多规格表体
@@ -604,8 +624,20 @@ function createSkuBody() {
}); });
} }
} }
console.log(newarr, '提交') if (ruleForm.skuList.length) {
list.value = newarr; newarr.forEach((val: any, index: number) => {
val['originPrice'] = ruleForm.skuList[index]['originPrice']
val['costPrice'] = ruleForm.skuList[index]['costPrice']
val['salePrice'] = ruleForm.skuList[index]['salePrice']
val['memberPrice'] = ruleForm.skuList[index]['memberPrice']
val['suitNum'] = ruleForm.skuList[index]['suitNum']
});
list.value = newarr
} else {
list.value = newarr;
}
} }
// 切换类型 // 切换类型
function changeTypeEnum(item: string) { function changeTypeEnum(item: string) {
@@ -620,25 +652,25 @@ function changeTypeEnum(item: string) {
} }
} }
// 笛卡尔积算法 // 笛卡尔积算法
function cartesian(arr: any[]) { function cartesian(arr) {
if (arr.length < 2) return arr[0] || []; if (arr.length < 2) return arr[0] || [];
return [].reduce.call(arr, (col: any, set: any, index) => { return [].reduce.call(arr, (col, set) => {
let res = <any>[]; let res = [];
col.forEach((c: any) => { col.forEach((c) => {
set.forEach((s: any) => { set.forEach((s) => {
let arr: any = Array.isArray(c) ? c : [c] let t = [].concat(Array.isArray(c) ? c : [c]);
let t: any[] = [].concat(arr);
t.push(s); t.push(s);
res.push(t); res.push(t);
}); });
}); });
return res; return res;
}, []); });
} }
// 套餐类型切换 // 套餐类型切换
function typeChange() { function typeChange() {
// ruleForm.typeEnum = 'normal' // ruleForm.typeEnum = 'normal'
if (ruleForm.groupType == '0') { if (ruleForm.groupType == '0') {
ruleForm.proGroupVo = []
ruleForm.proGroupVo[0] = { ruleForm.proGroupVo[0] = {
title: '', title: '',
count: '', count: '',
@@ -661,18 +693,17 @@ function selectSpecHandle(e: any) {
selectSpec[item].selectSpecResult = []; selectSpec[item].selectSpecResult = [];
} }
datas.selectSpeclist = selectSpec; datas.selectSpeclist = selectSpec;
// this.form.skuList = [ ];
} }
const specificationAttributeRef = ref(null) const specificationAttributeRef = ref(null)
const submitForm = async (formEl: FormInstance | undefined) => { const submitForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return if (!formEl) return
await formEl.validate(async (valid, fields) => { await formEl.validate(async (valid, fields) => {
if (valid) { if (valid) {
ruleForm.days = ruleForm.days.join(',')
// 第一张图片作为封面图 // 第一张图片作为封面图
ruleForm.coverImg = ruleForm.images[0] ruleForm.coverImg = ruleForm.images[0]
// 规格id修改 // 规格id修改
ruleForm.specId = specIdFunction(ruleForm.type) // ruleForm.specId = specIdFunction(ruleForm.type)
// 修改时间 // 修改时间
ruleForm.startTime = ruleForm.useTime[0] ruleForm.startTime = ruleForm.useTime[0]
ruleForm.endTime = ruleForm.useTime[1] ruleForm.endTime = ruleForm.useTime[1]
@@ -686,24 +717,31 @@ const submitForm = async (formEl: FormInstance | undefined) => {
}) })
ruleForm.selectSpecInfo = obj ruleForm.selectSpecInfo = obj
} else if (ruleForm.type == 'package') { } else if (ruleForm.type == 'package') {
console.log(ruleForm, '套餐') // console.log(ruleForm, '套餐')
} }
let res = await UserAPI3.addunit(ruleForm) if (ruleForm.id) {
if (res.code == 200) { let res = await UserAPI3.update(ruleForm)
ElMessage.success("添加成功"); if (res.code == 200) {
ElMessage.success("修改成功");
}
} else {
let res = await UserAPI3.addunit(ruleForm)
if (res.code == 200) {
ElMessage.success("添加成功");
}
}
setTimeout(() => {
closeSelectedTag({
"name": "addgoods",
"title": "新增商品",
"path": "/product/addgoods",
"fullPath": "/product/addgoods",
"affix": false,
"keepAlive": true,
"query": {}
})
router.push({ name: 'productIndex' }); router.push({ name: 'productIndex' });
setTimeout(() => { }, 500);
closeSelectedTag({
"name": "addgoods",
"title": "新增商品",
"path": "/product/addgoods",
"fullPath": "/product/addgoods",
"affix": false,
"keepAlive": true,
"query": {}
})
}, 500);
}
} else { } else {
ElMessage.error("请填写完整信息"); ElMessage.error("请填写完整信息");
console.log('error submit!', fields) console.log('error submit!', fields)