This commit is contained in:
魏啾
2024-10-23 14:23:08 +08:00
16 changed files with 898 additions and 234 deletions

View File

@@ -439,3 +439,14 @@ export function $getOrderPayUrl(data) {
} }
}); });
} }
//退款
export function $returnOrder(data) {
return request({
url: '/api/place/returnOrder',
method: "post",
data:{
shopId: localStorage.getItem("shopId"),
...data
}
});
}

View File

@@ -102,7 +102,7 @@ export async function hasPermission (params) {
} }
params = returnFormatParams(params) params = returnFormatParams(params)
if (!params) { if (!params) {
return infoBox.showToast('未找到相关权限请检查代码或在权限配置文件commons/utils/hasPermission.js文件进行修改或增加') return Notification.error('未找到相关权限请检查代码或在权限配置文件commons/utils/hasPermission.js文件进行修改或增加')
} }
const option = Object.assign({ const option = Object.assign({
tips: true, tips: true,

View File

@@ -36,7 +36,7 @@
<div style="margin-left: 80px;color: #FF4D4F;">* 可在打印机设备底部查看打印机编号和秘钥(key)</div> <div style="margin-left: 80px;color: #FF4D4F;">* 可在打印机设备底部查看打印机编号和秘钥(key)</div>
</el-form-item> </el-form-item>
</template> --> </template> -->
<el-form-item label="小票尺寸"> <el-form-item label="小票尺寸">
<el-radio-group v-model="forms.receiptSize"> <el-radio-group v-model="forms.receiptSize">
<el-radio label="58mm"></el-radio> <el-radio label="58mm"></el-radio>
@@ -49,6 +49,7 @@
<el-radio label="1">部分分类</el-radio> <el-radio label="1">部分分类</el-radio>
<!-- <el-radio label="2">部分商品</el-radio> --> <!-- <el-radio label="2">部分商品</el-radio> -->
</el-radio-group> </el-radio-group>
<div style="color: rgb(255, 77, 79);margin-left: 80px;">仅打印制作单[厨房]</div>
<div v-if="forms.classifyPrint == 1" style="margin-left:70px"> <div v-if="forms.classifyPrint == 1" style="margin-left:70px">
<!-- <el-tree :data="partList" show-checkbox node-key="id" ref="tree" :default-checked-keys="this.forms.categoryIds" <!-- <el-tree :data="partList" show-checkbox node-key="id" ref="tree" :default-checked-keys="this.forms.categoryIds"
:props="{ children: 'childrenList', label: 'name' }"> :props="{ children: 'childrenList', label: 'name' }">
@@ -115,9 +116,15 @@ export default {
return { return {
forms: { forms: {
sort: "0", sort: "0",
status: "0", status: 1,
connectionType: "network", printType: [], connectionType: "network",
selectcheckbox: [] selectcheckbox: [],
receiptSize: '58mm',
classifyPrint: '0',
printQty: 'm1^1',
printType: ["refund", 'handover', 'queue'],
printMethod: "all",
}, },
partList: [] partList: []
} }

View File

@@ -103,6 +103,8 @@ border: 1px solid rgba(255,255,255,0.28);" @click="dialogConfirm(3)">过号</el-
<script> <script>
import { callTable, callTablequeue, callTableput, callTabletakeNumber, callTablecall } from '@/api/shop' import { callTable, callTablequeue, callTableput, callTabletakeNumber, callTablecall } from '@/api/shop'
const synth = window.speechSynthesis;
const msg = new SpeechSynthesisUtterance()
export default { export default {
data() { data() {
return { return {
@@ -151,7 +153,27 @@ export default {
} }
}, },
handleSpeak(text) {
msg.text = text; // 文字内容: 小朋友,你是否有很多问号
msg.lang = "zh-CN"; // 使用的语言:中文
msg.volume = 3; // 声音音量1
msg.rate = 1; // 语速1
msg.pitch = 1; // 音高1
synth.speak(msg); // 播放
},
// // 语音停止
// handleStop(e) {
// msg.text = e;
// msg.lang = "zh-CN";
// synth.cancel(msg);
// },
async profilepicture(d) { async profilepicture(d) {
this.handleSpeak(d.callNum)
let res = await callTablecall({ let res = await callTablecall({
shopId: localStorage.getItem('shopId'), shopId: localStorage.getItem('shopId'),
callQueueId: d.id callQueueId: d.id

View File

@@ -115,6 +115,14 @@ export default {
// this.getCookie() // this.getCookie()
// // token 过期提示 // // token 过期提示
// this.point() // this.point()
let getinfo = localStorage.getItem('MerchantId')
let info = JSON.parse(getinfo)
if (info.merchantName) {
this.loginForm.merchantName = info.merchantName
this.loginForm.username = info.username
}
}, },
methods: { methods: {
getCode() { getCode() {
@@ -170,6 +178,14 @@ export default {
user.password = encrypt(user.password) user.password = encrypt(user.password)
this.$store.dispatch('Login', user).then(() => { this.$store.dispatch('Login', user).then(() => {
this.loading = false this.loading = false
// 保存商户号
localStorage.setItem('MerchantId', JSON.stringify({
merchantName: this.loginForm.merchantName,
username: this.loginForm.username,
}))
// this.$router.push({ path: this.redirect || '/' }) // this.$router.push({ path: this.redirect || '/' })
window.location.href = './' window.location.href = './'
}).catch(() => { }).catch(() => {

View File

@@ -130,6 +130,12 @@
{{ scope.row.priceAmount }} {{ scope.row.priceAmount }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作">
<template v-slot="scope">
<el-button v-if="detail.status=='closed'" type="text" size="mini" @click="tuikuan(scope.row)"><span >退款</span></el-button>
<el-button v-if="detail.status=='unpaid'" type="text" size="mini" @click="tuiCai(scope.row)"><span >退菜</span></el-button>
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
<!-- </el-tab-pane> --> <!-- </el-tab-pane> -->
@@ -193,6 +199,19 @@
--> -->
<!-- </el-tabs> --> <!-- </el-tabs> -->
</div> </div>
<return-cart
:modal="false"
ref="refReturnCart"
:max="selGoods.num"
@confirm="refReturnCartConfirm"
></return-cart>
<return-money
:modal="false"
ref="refReturnMoney"
:max="selGoods.num"
:goods="selGoods"
@confirm="refReturnMoneyConfirm"
></return-money>
</el-drawer> </el-drawer>
</template> </template>
@@ -200,7 +219,14 @@
import orderEnum from "../orderEnum"; import orderEnum from "../orderEnum";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { tbOrderInfoDetail, tbOrderInfoData } from "@/api/order"; import { tbOrderInfoDetail, tbOrderInfoData } from "@/api/order";
import returnCart from "@/views/tool/Instead/components/return-cart.vue";
import returnMoney from "@/views/tool/Instead/components/return-money.vue";
import {
$returnCart,$returnOrder
} from "@/api/table";
export default { export default {
components: { returnCart,returnMoney },
data() { data() {
return { return {
orderEnum, orderEnum,
@@ -208,7 +234,8 @@ export default {
type: "1", type: "1",
detail: "", detail: "",
loading: false, loading: false,
refoundList: [] refoundList: [],
selGoods:{num:1}
}; };
}, },
filters: { filters: {
@@ -242,6 +269,38 @@ export default {
} }
}, },
methods: { methods: {
async refReturnMoneyConfirm(e){
const res = await $returnOrder({
...e,
orderId:this.detail.id,
orderDetails:[{
id:this.selGoods.id,
num:e.num
}]
});
this.update();
},
update(){
this.tbOrderInfoDetail(this.detail.id);
},
async refReturnCartConfirm(e){
const res = await $returnCart({
...e,
cartId: this.selGoods.id,
tableId: this.detail.tableId,
});
this.update();
},
tuikuan(item){
this.selGoods=item;
console.log(item);
this.$refs.refReturnMoney.open(item);
},
tuiCai(item){
this.selGoods=item;
console.log(item);
this.$refs.refReturnCart.open(item);
},
// 切换类型 // 切换类型
getTableData() { getTableData() {
if (this.type == "3") { if (this.type == "3") {

View File

@@ -64,6 +64,8 @@
// import Sortable from 'sortablejs' // import Sortable from 'sortablejs'
import addClassify from './components/addClassify' import addClassify from './components/addClassify'
import { tbShopCategoryGet, tbShopCategoryDelete, tbShopCategoryPost, upCategorySort } from '@/api/shop' import { tbShopCategoryGet, tbShopCategoryDelete, tbShopCategoryPost, upCategorySort } from '@/api/shop'
import { hasPermission } from '@/utils/limits.js'
export default { export default {
components: { components: {
addClassify addClassify
@@ -114,6 +116,9 @@ export default {
// }, // },
// 状态切换 // 状态切换
async showChange(e, row) { async showChange(e, row) {
let res = await hasPermission('允许修改分类');
if ( !res) { row.isShow = (e == 0 ? 1 : 0);return; }
try { try {
await tbShopCategoryPost(row, 'put') await tbShopCategoryPost(row, 'put')
this.getTableData() this.getTableData()
@@ -141,6 +146,8 @@ export default {
}, },
// 删除 // 删除
async delHandle(ids) { async delHandle(ids) {
let res = await hasPermission('允许修改分类');
if ( !res) { return; }
try { try {
await tbShopCategoryDelete(ids) await tbShopCategoryDelete(ids)
this.$notify({ this.$notify({

View File

@@ -48,6 +48,7 @@
<script> <script>
import Sortable from 'sortablejs' import Sortable from 'sortablejs'
import addGroup from '../components/addGroup' import addGroup from '../components/addGroup'
import { hasPermission } from '@/utils/limits.js'
import { tbProductGroupGet, tbProductGroupDelete, tbProductGroupPut, upGroupSort } from '@/api/shop' import { tbProductGroupGet, tbProductGroupDelete, tbProductGroupPut, upGroupSort } from '@/api/shop'
export default { export default {
components: { components: {
@@ -92,12 +93,15 @@ export default {
return a + ' - ' + ciri + b return a + ' - ' + ciri + b
}, },
//表格拖拽 //表格拖拽
tableDrag() { async tableDrag() {
const el = document.querySelector('#table_drag .el-table__body-wrapper tbody') const el = document.querySelector('#table_drag .el-table__body-wrapper tbody')
new Sortable(el, { new Sortable(el, {
animation: 150, animation: 150,
onEnd: async e => { onEnd: async e => {
// console.log('拖拽结束===', e); // console.log('拖拽结束===', e);
let res = await hasPermission('允许修改分组');
if ( !res) { return; }
if (e.oldIndex == e.newIndex) return if (e.oldIndex == e.newIndex) return
let oid = this.tableData.list[e.oldIndex].id let oid = this.tableData.list[e.oldIndex].id
let nid = this.tableData.list[e.newIndex].id let nid = this.tableData.list[e.newIndex].id
@@ -117,6 +121,9 @@ export default {
}, },
// 状态切换 // 状态切换
async showChange(e, row) { async showChange(e, row) {
let res = await hasPermission('允许修改分组');
if ( !res) { row.isShow = (e == 0 ? 1 : 0);return; }
try { try {
await tbProductGroupPut(row) await tbProductGroupPut(row)
this.getTableData() this.getTableData()
@@ -136,6 +143,8 @@ export default {
}, },
// 删除 // 删除
async delHandle(ids) { async delHandle(ids) {
let res = await hasPermission('允许修改分组');
if ( !res) { return; }
try { try {
await tbProductGroupDelete(ids) await tbProductGroupDelete(ids)
this.$notify({ this.$notify({

View File

@@ -20,9 +20,9 @@
</div> </div>
<div class="head-container"> <div class="head-container">
<div class="header_wrap"> <div class="header_wrap">
<router-link :to="{ name: 'add_shop' }"> <!-- <router-link :to="{ name: 'add_shop' }" > -->
<el-button type="primary" icon="el-icon-plus">添加商品</el-button> <el-button type="primary" icon="el-icon-plus" @click="toPath( '/product/add_shop')">添加商品</el-button>
</router-link> <!-- </router-link> -->
<el-select v-model="tableData.sort" placeholder="排序" @change="getTableData"> <el-select v-model="tableData.sort" placeholder="排序" @change="getTableData">
<el-option value="createdAt,desc" label="创建时间"></el-option> <el-option value="createdAt,desc" label="创建时间"></el-option>
<el-option value="stockNumber,asc" label="数量由低到高"></el-option> <el-option value="stockNumber,asc" label="数量由低到高"></el-option>
@@ -318,7 +318,11 @@ export default {
async toPath ( path , row) { async toPath ( path , row) {
let res = await hasPermission('允许修改商品'); let res = await hasPermission('允许修改商品');
if ( !res) { return; } if ( !res) { return; }
this.$router.push({path: path, query: { goods_id: row.id }}) let query = {};
if ( row ) {
query.goods_id = row.id;
}
this.$router.push({path: path, query: query})
}, },
// 显示修改商品警告线 // 显示修改商品警告线
showStockWarningHandle() { showStockWarningHandle() {
@@ -431,7 +435,9 @@ export default {
} }
}, },
// 显示绑定耗材 // 显示绑定耗材
showBindCons(item) { async showBindCons(item) {
let res = await hasPermission('允许修改商品');
if ( !res) { return; }
// console.log(item); // console.log(item);
this.$refs.bindCons.show(item) this.$refs.bindCons.show(item)
}, },
@@ -555,6 +561,8 @@ export default {
}, },
// 删除商品 // 删除商品
async delTableHandle(ids) { async delTableHandle(ids) {
let res = await hasPermission('允许修改商品');
if ( !res) { return; }
try { try {
await tbProductDelete(ids) await tbProductDelete(ids)
this.getTableData() this.getTableData()

View File

@@ -38,7 +38,12 @@
> >
下载台桌码 下载台桌码
</el-button> </el-button>
<el-button type="primary" icon="el-icon-download">下载店铺码</el-button> <el-button
type="primary"
icon="el-icon-download"
@click="downloadShopCode"
>下载店铺码</el-button
>
</div> </div>
</div> </div>
<div class="u-flex u-p-b-15 u-font-14"> <div class="u-flex u-p-b-15 u-font-14">
@@ -224,6 +229,7 @@ import tableDiancan from "./components/table-diancan.vue";
import $status from "./status.js"; import $status from "./status.js";
import chooseDinersNumber from "./components/table-diancan-components/choose-diners-number.vue"; import chooseDinersNumber from "./components/table-diancan-components/choose-diners-number.vue";
import { tbShopInfo } from "@/api/user"; import { tbShopInfo } from "@/api/user";
import { hasPermission } from "@/utils/limits.js";
import { import {
tbShopTableGet, tbShopTableGet,
@@ -233,7 +239,7 @@ import {
tbShopTable, tbShopTable,
} from "@/api/table"; } from "@/api/table";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { downloadFile } from "@/utils/index";
export default { export default {
components: { components: {
@@ -255,12 +261,12 @@ export default {
selTable: "", //当前选中的桌台 selTable: "", //当前选中的桌台
areaMap: {}, areaMap: {},
shopInfo: {}, shopInfo: {},
timer:null timer: null,
}; };
}, },
beforeDestroy() { beforeDestroy() {
this.clearTimer(); this.clearTimer();
console.log('beforeDestroy') console.log("beforeDestroy");
}, },
mounted() { mounted() {
this.clearTimer(); this.clearTimer();
@@ -270,7 +276,7 @@ export default {
}, },
filters: { filters: {
formatTime(milliseconds) { formatTime(milliseconds) {
console.log(milliseconds) console.log(milliseconds);
if (!milliseconds) { if (!milliseconds) {
return ""; return "";
} }
@@ -281,21 +287,37 @@ export default {
const minutes = Math.floor( const minutes = Math.floor(
(milliseconds % (1000 * 60 * 60)) / (1000 * 60) (milliseconds % (1000 * 60 * 60)) / (1000 * 60)
); );
return `${days ? days + "天" : ""} ${hours ? hours + "时" : ""} ${minutes + "分" return `${days ? days + "天" : ""} ${hours ? hours + "时" : ""} ${
minutes + "分"
}`; }`;
}, },
}, },
methods: { methods: {
clearTimer(){ async downloadShopCode() {
console.log('clearTimer') try {
clearInterval(this.timer); const link = document.createElement("a");
this.timer=null; link.href = this.shopInfo.smallQrcode;
const fileName = this.shopInfo.shopName +"店铺码"+ ".png";
console.log(fileName)
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
this.$message.success("下载成功");
} catch (error) {
console.log(error);
}
}, },
setTimter(time=60){ clearTimer() {
this.timer=setInterval(() => { console.log("clearTimer");
const showloading=false clearInterval(this.timer);
this.tbShopTableGet(showloading) this.timer = null;
}, time*1000); },
setTimter(time = 60) {
this.timer = setInterval(() => {
const showloading = false;
this.tbShopTableGet(showloading);
}, time * 1000);
}, },
//获取店铺信息 //获取店铺信息
async getShopInfo() { async getShopInfo() {
@@ -348,9 +370,20 @@ export default {
onDiancanClose() { onDiancanClose() {
this.tbShopTableGet(); this.tbShopTableGet();
}, },
diancanShow(item, key) { async diancanShow(item, key) {
if(key=='isPayOrder'){
const canShoukuan=await hasPermission('允许收款')
if(!canShoukuan){
return
}
}
const canXiadan=await hasPermission('允许下单')
if(!canXiadan){
return
}
//key isAddGoods 加菜 //key isAddGoods 加菜
//key isPayOrder结账 //key isPayOrder 结账
this.selTable = item; this.selTable = item;
if (this.shopInfo.isTableFee) { if (this.shopInfo.isTableFee) {
//免餐位费 //免餐位费
@@ -372,9 +405,9 @@ export default {
table_name: this.selTable.name, table_name: this.selTable.name,
tableId: this.selTable.tableId, tableId: this.selTable.tableId,
useType: this.selTable.useType, useType: this.selTable.useType,
maxCapacity:this.selTable.maxCapacity, maxCapacity: this.selTable.maxCapacity,
masterId:this.selTable.masterId, masterId: this.selTable.masterId,
orderId:this.selTable.orderId, orderId: this.selTable.orderId,
...query, ...query,
}, },
}); });
@@ -406,7 +439,7 @@ export default {
} }
}, },
// 台桌列表 // 台桌列表
async tbShopTableGet(showloading=true) { async tbShopTableGet(showloading = true) {
this.loading = showloading; this.loading = showloading;
try { try {
const { content, total } = await tbShopTableGet({ const { content, total } = await tbShopTableGet({

View File

@@ -1,8 +1,12 @@
<template> <template>
<div class="flex order-item relative" :class="[isActive]" @click="itemClick"> <div
class="flex order-item u-m-b-14 relative"
:class="[isActive]"
@click="itemClick"
>
<span class="absolute pack" v-if="item.isPack === 'true'"> </span> <span class="absolute pack" v-if="item.isPack === 'true'"> </span>
<span class="absolute tui" v-if="item.status === 'return'"> 退 </span> <span class="absolute tui" v-if="item.status === 'return'"> 退 </span>
<div class="flex"> <div class="flex u-col-top">
<div class="img"> <div class="img">
<div <div
class="isSeatFee img u-line-1 u-flex u-col-center u-row-center" class="isSeatFee img u-line-1 u-flex u-col-center u-row-center"
@@ -12,7 +16,7 @@
</div> </div>
<img v-else :src="item.coverImg" class="" alt="" /> <img v-else :src="item.coverImg" class="" alt="" />
</div> </div>
<div class="good-info"> <div class="good-info u-p-t-6">
<div class="flex lh-16"> <div class="flex lh-16">
<div class="name" :class="{ 'free-price': item.status === 'return' }"> <div class="name" :class="{ 'free-price': item.status === 'return' }">
{{ item.name }} {{ item.name }}
@@ -24,13 +28,23 @@
<div v-if="item.specSnap" class="specSnap"> <div v-if="item.specSnap" class="specSnap">
{{ item.specSnap }} {{ item.specSnap }}
</div> </div>
<template v-if="item.note">
<div class="note">备注:{{ item.note || "" }}</div> <div class="" v-if="placeNum == 0">
</template> <div class="note" v-if="item.note">
备注:{{ item.note || "" }}
</div>
<div class="note flex" v-else>
<span>备注:</span>
<span class="el-icon-edit u-font-12" @click="editNote"></span>
</div>
</div>
<div class="note" v-if="placeNum != 0 && item.note">
备注:{{ item.note || "" }}
</div>
</div> </div>
</div> </div>
<div class="flex"> <div class="flex u-p-t-6">
<div class="order-number-box"> <div class="order-number-box u-font-12">
<div class="" v-if="isSeatFee">X{{ item.totalNumber }}</div> <div class="" v-if="isSeatFee">X{{ item.totalNumber }}</div>
<div class="" v-else>X{{ item.number }}</div> <div class="" v-else>X{{ item.number }}</div>
<div class="absolute" v-if="canChangeNumber"> <div class="absolute" v-if="canChangeNumber">
@@ -62,7 +76,7 @@
}" }"
> >
<span v-if="isSeatFee"> {{ item.totalAmount }}</span> <span v-if="isSeatFee"> {{ item.totalAmount }}</span>
<span v-else> {{ item.salePrice }}</span> <span v-else> {{ item.totalAmount }}</span>
</div> </div>
</div> </div>
</div> </div>
@@ -136,6 +150,11 @@ export default {
this.number = this.item.number; this.number = this.item.number;
}, },
methods: { methods: {
editNote() {
if (this.placeNum === 0) {
this.$emit("editNote", this.index);
}
},
//购物车商品输入框数量改变 //购物车商品输入框数量改变
cartGoodsNumberChange(newval) { cartGoodsNumberChange(newval) {
if (newval <= 0) { if (newval <= 0) {
@@ -207,13 +226,13 @@ export default {
font-size: 22px; font-size: 22px;
cursor: pointer; cursor: pointer;
} }
.order-item { .flex.order-item {
padding: 4px; padding: 4px;
border-radius: 2px; border-radius: 2px;
display: flex; display: flex;
overflow: hidden; overflow: visible;
cursor: pointer; cursor: pointer;
align-items: center; align-items: flex-start;
justify-content: space-between; justify-content: space-between;
background-color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);
transition: all 0.3s; transition: all 0.3s;
@@ -245,6 +264,7 @@ export default {
.total-price { .total-price {
width: 94px; width: 94px;
font-size: 16px;
text-align: right; text-align: right;
} }
@@ -269,25 +289,25 @@ export default {
} }
.img { .img {
width: 40px; width: 59px;
height: 40px; height: 59px;
position: relative; position: relative;
margin-right: 10px; margin-right: 10px;
img { img {
width: 40px; width: 59px;
height: 40px; height: 59px;
} }
} }
} }
.note{ .note {
max-width: 70%; max-width: 70%;
font-size: 12px; font-size: 12px;
font-weight: 400; font-weight: 400;
text-align: left; text-align: left;
color: #999; color: #999;
margin-top: 2px; margin-top: 5px;
word-break: break-all; word-break: break-all;
} }
.order-number-box { .order-number-box {
position: relative; position: relative;
@@ -295,8 +315,8 @@ export default {
.absolute { .absolute {
width: 60px; width: 60px;
height: 40px; height: 40px;
right: -30px; right: -38px;
top: -12px; top: -14px;
position: absolute; position: absolute;
.order-input-number { .order-input-number {

View File

@@ -0,0 +1,124 @@
<template>
<div>
<div class="flex">
<i class="icon-remove" @click="reduce"></i>
<div style="width: 40px" class="number-box">
<el-input
:min="min"
:max="max"
type="number"
v-model="number"
placeholder="0"
@blur="valChange(number, true)"
@input="valChange"
></el-input>
</div>
<!-- <i class="el-icon-remove"></i> -->
<i class="el-icon-circle-plus icon-add" @click="add"></i>
</div>
</div>
</template>
<script>
import { formatPrice } from "@/utils/format";
export default {
props: {
value: {
type: Number,
default: 1,
},
min: {
type: Number,
default: 0,
},
max: {
type: Number,
default: Infinity,
},
},
watch: {
value(val){
this.number = val;
},
min(val) {
this.number = val;
},
},
data() {
return { number: 1 };
},
methods: {
valChange(val, isNow = false) {
console.log(val);
const max = this.max;
const min = this.min;
const returnNewval = formatPrice(val, min, max, true);
let newval = 0;
if (typeof returnNewval !== "number") {
newval = returnNewval.value;
} else {
newval = returnNewval;
}
newval=parseInt(newval);
console.log(newval);
if (isNow) {
this.number = newval;
this.$emit("input", this.number);
return;
}
setTimeout(() => {
this.number = newval;
this.$emit("input", this.number);
}, 100);
},
emitInput() {
this.$emit("input", this.number);
},
reduce() {
if (this.number > this.min) {
this.number--;
this.emitInput();
}
},
add() {
if (this.number < this.max) {
this.number++;
this.$emit("input", this.number);
}
},
},
mounted(){
this.number = this.value;
}
};
</script>
<style lang="scss" scoped>
::v-deep .number-box .el-input__inner {
border: none;
}
.icon-add {
color: #1890ff;
font-size: 22px;
cursor: pointer;
}
.icon-remove {
border: 1px solid #d8d8d8;
width: 22px;
height: 22px;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
box-sizing: border-box;
cursor: pointer;
&::after {
content: "";
display: block;
width: 10px;
height: 1px;
background: #999;
}
}
</style>

View File

@@ -1,10 +1,19 @@
<template> <template>
<el-dialog title="退菜" width="410px" :visible.sync="show" @close="reset"> <el-dialog title="退菜" width="410px" :visible.sync="show" @close="reset" :modal="modal">
<div> <div class="flex u-row-between u-p-b-20 border-bottom">
<span>退菜数量</span>
<div class="u-flex">
<number-box v-model="number" :min="1" :max="max"></number-box>
</div>
</div>
<div class="u-m-t-10 u-font-12 color-999">
菜品已点数量 {{max}}
</div>
<div class="u-m-t-26">
<div><span>退菜原因</span> <span class="color-red">*</span></div> <div><span>退菜原因</span> <span class="color-red">*</span></div>
</div> </div>
<div class="u-flex u-flex-wrap tags"> <div class="u-flex u-flex-wrap tags ">
<div <div
class="tag" class="tag"
v-for="(tag, index) in tags" v-for="(tag, index) in tags"
@@ -23,9 +32,7 @@
></el-input> ></el-input>
</div> </div>
<div class="u-m-t-20"> <div class="u-m-t-20">
<el-checkbox v-model="isPrint" <el-checkbox v-model="isPrint">打印退菜单</el-checkbox>
>打印退菜单</el-checkbox
>
</div> </div>
<div slot="footer"> <div slot="footer">
<el-button size="medium" @click="close"> 取消 </el-button> <el-button size="medium" @click="close"> 取消 </el-button>
@@ -34,23 +41,48 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import numberBox from './number-box.vue';
export default { export default {
components:{numberBox},
props:{
modal:{
type:Boolean,
default:true
},
goods:{
type:Object,
default:()=>{
return{}
}
},
max:{
type:Number,
default:1
}
},
data() { data() {
return { return {
isPrint:false, number:1,
isPrint: false,
tagSel: -1, tagSel: -1,
show: false, show: false,
tags: [{label:"不想要了",checked:false} ,{label:"食材不足",checked:false} ,{label:"等待时间过长",checked:false}], tags: [
{ label: "不想要了", checked: false },
{ label: "食材不足", checked: false },
{ label: "等待时间过长", checked: false },
],
note: "", note: "",
}; };
}, },
methods: { methods: {
changeSel(item) { changeSel(item) {
item.checked = !item.checked ; item.checked = !item.checked;
}, },
reset() { reset() {
this.note = ""; this.note = "";
this.number=1;
console.log(this.number)
}, },
delTag(index) { delTag(index) {
this.tags.splice(index, 1); this.tags.splice(index, 1);
@@ -63,12 +95,20 @@ export default {
}, },
open(note) { open(note) {
this.show = true; this.show = true;
this.number=1;
}, },
close() { close() {
this.show = false; this.show = false;
this.number=1;
}, },
confirm() { confirm() {
this.$emit("confirm", this.note); const selTag=this.tags.filter(item=>item.checked).map(item=>item.label).join(",")
const note=selTag+(this.note.length>0?","+this.note:"");
console.log(note)
if(!note){
return this.$message.error("请输入退菜原因");
}
this.$emit("confirm", {note:note,num:this.number});
this.close(); this.close();
}, },
}, },
@@ -106,4 +146,12 @@ export default {
} }
} }
} }
::v-deep .number-box .el-input__inner::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
::v-deep .number-box .el-input__inner::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
</style> </style>

View File

@@ -0,0 +1,175 @@
<template>
<el-dialog
title="退款"
width="410px"
:visible.sync="show"
@close="reset"
:modal="modal"
>
<div class="u-flex font-bold color-333">
{{ goods.productName }}
</div>
<div class="u-flex color-999 u-m-t-4">
{{ goods.productSkuName||'' }}
</div>
<div class="flex u-row-between u-p-b-16 u-m-t-10 border-bottom">
<span>退款数量</span>
<div class="u-flex">
<number-box v-model="number" :min="1" :max="max"></number-box>
</div>
</div>
<div class="u-m-t-12 u-font-12 color-999">菜品已点数量 {{ max }} </div>
<div class="u-flex u-m-t-12 ">
<span>支付金额</span>
<span class="">{{ goods.priceAmount }}</span>
</div>
<div class="u-flex u-m-t-12 ">
<span>退款金额</span>
<span class="color-red font-bold">{{ goods.price * number|to2 }}</span>
</div>
<div class="u-m-t-26">
<div><span>退款原因</span> <span class="color-red">*</span></div>
</div>
<div class="u-flex u-flex-wrap tags">
<div
class="tag"
v-for="(tag, index) in tags"
@click="changeSel(tag)"
:key="index"
:class="{ active: tag.checked }"
>
{{ tag.label }}
</div>
</div>
<div class="u-m-t-20">
<el-input
v-model="note"
size="medium"
placeholder="请输入自定义备注"
></el-input>
</div>
<div slot="footer">
<el-button size="medium" @click="close"> 取消 </el-button>
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
</div>
</el-dialog>
</template>
<script>
import numberBox from "./number-box.vue";
export default {
components: { numberBox },
props: {
modal: {
type: Boolean,
default: true,
},
goods: {
type: Object,
default: () => {
return {};
},
},
max: {
type: Number,
default: 1,
},
},
data() {
return {
number: 1,
isPrint: false,
tagSel: -1,
show: false,
tags: [
{ label: "不想要了", checked: false },
{ label: "食材不足", checked: false },
{ label: "等待时间过长", checked: false },
],
note: "",
};
},
filters:{
to2(val){
return val.toFixed(2);
}
},
methods: {
changeSel(item) {
item.checked = !item.checked;
},
reset() {
this.note = "";
this.number = 1;
console.log(this.number);
},
delTag(index) {
this.tags.splice(index, 1);
},
addNote(tag) {
if (this.note.length <= 0) {
return (this.note = tag);
}
this.note = tag + "," + this.note;
},
open(note) {
this.show = true;
this.number = 1;
},
close() {
this.show = false;
this.number = 1;
},
confirm() {
const selTag = this.tags
.filter((item) => item.checked)
.map((item) => item.label)
.join(",");
const note = selTag + (this.note.length > 0 ? "," + this.note : "");
console.log(note);
if (!note) {
return this.$message.error("请输入退款原因");
}
this.$emit("confirm", { note: note, num: this.number });
this.close();
},
},
mounted() {},
};
</script>
<style lang="scss" scoped>
::v-deep .el-tag {
margin-top: 10px;
margin-right: 10px;
margin-bottom: 5px;
cursor: pointer;
font-size: 15px;
line-height: 35px;
height: 35px;
}
.tags {
.tag {
margin: 10px 10px 0 0;
border: 1px solid #dcdfe6;
border-radius: 4px;
padding: 10px 13px;
font-size: 14px;
color: #000;
cursor: pointer;
&.active {
color: #1890ff;
background: #e8f4ff;
border-color: #a3d3ff;
}
}
}
::v-deep .number-box .el-input__inner::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
::v-deep .number-box .el-input__inner::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
</style>

View File

@@ -1,12 +1,76 @@
<!-- eslint-disable no-empty --> <!-- eslint-disable no-empty -->
<template> <template>
<div class="el-dialog"> <div class="el-dialog">
<div class="bg-fff"> <div class="bg-fff u-relative">
<div
class="u-fixed position-all"
style="z-index: 999"
v-if="!canXiadan"
@click="xiadanClick"
></div>
<div class="flex head row-between flex-y-center u-m-l-20"> <div class="flex head row-between flex-y-center u-m-l-20">
<div class="flex" style="width: 500px"> <div class="flex" style="width: 500px">
<div class="el-dialog__title" style="margin-right: 10px"> <div class="u-font-16 color-333 font-bold" style="margin-right: 10px">
{{ title }} {{ title }}
</div> </div>
<div class="choose-user flex u-m-l-24">
<el-button
type="primary"
v-if="vipUser.id === ''"
@click="refChooseUserOpen"
>选择用户</el-button
>
<template v-else>
<div class="flex cur-pointer" @click="refChooseUserOpen">
<img
v-if="vipUser.headImg"
class="headimg"
:src="vipUser.headImg"
alt=""
/>
<div v-else class="headimg flex flex-x-y-center">
<i class="el-icon-user"></i>
</div>
<div>
<div class="ft-13 color-000">{{ vipUser.nickName }}</div>
<div style="margin-top: 2px" class="color-666 ft-12">
余额{{ vipUser.amount }}
</div>
</div>
</div>
</template>
</div>
<el-popover
placement="right"
width="333"
trigger="click"
v-model="tableShow"
>
<div style="max-height: 398px; overflow-y: scroll">
<div
class="u-flex u-row-between u-p-t-8 table-item u-p-b-8 u-p-r-30"
v-for="(item, index) in tableList"
:key="index"
@click="changeTable(item, index)"
>
<span> {{ item.name }}</span>
<span :style="{ color: status[item.status].type }">
{{
status[item.status] ? status[item.status].label : ""
}}</span
>
</div>
<div
class="color-999 u-p-30 u-text-center"
v-if="!tableList.length"
>
无可用桌台
</div>
</div>
<div class="tableId u-m-l-28" slot="reference">
{{ table ? "桌台号:" + table.name : "选择桌号" }}
</div>
</el-popover>
<!-- 先付后付start --> <!-- 先付后付start -->
<!-- <el-dropdown @command="changePostPay"> <!-- <el-dropdown @command="changePostPay">
<el-button plain type="primary" size="mini"> <el-button plain type="primary" size="mini">
@@ -18,9 +82,11 @@
<el-dropdown-item :command="true">后付费</el-dropdown-item> <el-dropdown-item :command="true">后付费</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> --> </el-dropdown> -->
<el-button plain type="primary" size="mini">
<!-- <el-button plain type="primary" size="mini">
{{ postPay ? "后付费" : "先付费" }} {{ postPay ? "后付费" : "先付费" }}
</el-button> </el-button> -->
<!-- 先付后付end --> <!-- 先付后付end -->
<span <span
@click="toggleFullScreen" @click="toggleFullScreen"
@@ -64,6 +130,7 @@
</div> </div>
<div class="flex flex-1"> <div class="flex flex-1">
<div class="flex-1"></div>
<div class="flex-1"> <div class="flex-1">
<el-input <el-input
v-model="goods.query.productId" v-model="goods.query.productId"
@@ -75,7 +142,8 @@
suffix-icon="el-icon-search" suffix-icon="el-icon-search"
/> />
</div> </div>
<div
<!-- <div
style="display: flex; justify-content: flex-end; margin-left: 10px" style="display: flex; justify-content: flex-end; margin-left: 10px"
> >
<div style="width: 100px; margin-left: 20px"> <div style="width: 100px; margin-left: 20px">
@@ -90,7 +158,7 @@
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
</div> </div> -->
</div> </div>
</div> </div>
<div class="head-container search-box flex row-between" v-if="false"> <div class="head-container search-box flex row-between" v-if="false">
@@ -123,10 +191,6 @@
<div <div
style="display: flex; justify-content: flex-end; margin-left: 10px" style="display: flex; justify-content: flex-end; margin-left: 10px"
> >
<!-- <el-button style="margin-right: 10px" type="primary" @click="getGoods"
>查询</el-button
>
<el-button @click="reset">重置</el-button> -->
<div style="width: 100px; margin-left: 20px"> <div style="width: 100px; margin-left: 20px">
<el-select v-model="layout.sel" placeholder="请选择"> <el-select v-model="layout.sel" placeholder="请选择">
<el-option <el-option
@@ -146,33 +210,6 @@
<div class="order"> <div class="order">
<div class="relative u-flex u-flex-col u-row-between"> <div class="relative u-flex u-flex-col u-row-between">
<div class="w-full" style="padding-right: 14px"> <div class="w-full" style="padding-right: 14px">
<div class="choose-user flex u-m-l-20">
<el-button
type="primary"
v-if="vipUser.id === ''"
@click="refChooseUserOpen"
>选择用户</el-button
>
<template v-else>
<div class="flex cur-pointer" @click="refChooseUserOpen">
<img
v-if="vipUser.headImg"
class="headimg"
:src="vipUser.headImg"
alt=""
/>
<div v-else class="headimg flex flex-x-y-center">
<i class="el-icon-user"></i>
</div>
<div>
<div class="ft-13 color-000">{{ vipUser.nickName }}</div>
<div style="margin-top: 2px" class="color-666 ft-12">
余额{{ vipUser.amount }}
</div>
</div>
</div>
</template>
</div>
<div class="u-m-l-20 u-p-b-10 meal_box"> <div class="u-m-l-20 u-p-b-10 meal_box">
<el-button-group> <el-button-group>
<el-button <el-button
@@ -187,31 +224,6 @@
</div> </div>
<div class="flex row-between table-list u-m-l-20"> <div class="flex row-between table-list u-m-l-20">
<!-- <div class="tableId" @click="chooseTableOpen"> --> <!-- <div class="tableId" @click="chooseTableOpen"> -->
<el-popover
placement="right"
width="333"
trigger="click"
v-model="tableShow"
>
<div style="max-height: 398px; overflow-y: scroll">
<div
class="u-flex u-row-between u-p-t-8 table-item u-p-b-8 u-p-r-30"
v-for="(item, index) in tableList"
:key="index"
@click="changeTable(item, index)"
>
<span> {{ item.name }}</span>
<span :style="{ color: status[item.status].type }">
{{
status[item.status] ? status[item.status].label : ""
}}</span
>
</div>
</div>
<div class="tableId" slot="reference">
{{ table ? "桌台号:" + table.name : "桌台号/取餐号" }}
</div>
</el-popover>
<div class="u-flex"> <div class="u-flex">
<div class="u-p-r-14 border-r u-m-r-14"> <div class="u-p-r-14 border-r u-m-r-14">
@@ -260,6 +272,7 @@
@changeOrderNumber="changeOrderNumber" @changeOrderNumber="changeOrderNumber"
@cartGoodsNumberInput="cartGoodsNumberInput" @cartGoodsNumberInput="cartGoodsNumberInput"
@cartGoodsNumberChange="cartGoodsNumberChange" @cartGoodsNumberChange="cartGoodsNumberChange"
@editNote="refNoteShow(true)"
v-for="(item, index) in order.list" v-for="(item, index) in order.list"
:key="index" :key="index"
:index="index" :index="index"
@@ -268,16 +281,30 @@
:selIndex="order.selIndex" :selIndex="order.selIndex"
></cart-item> ></cart-item>
</template> </template>
<div v-if="order.gift.list.length">
<div class="carts_list_title">以下是优惠菜品</div>
</div>
<div v-if="!order.list.length"> <div v-if="!order.list.length">
<el-empty <el-empty
:image-size="50" :image-size="50"
description="点餐列表为空" description="点餐列表为空"
></el-empty> ></el-empty>
</div> </div>
<!-- 优惠菜品 -->
<div v-if="order.gift.list.length">
<div class="carts_list_title">以下是优惠菜品</div>
<template v-if="order.gift.list.length">
<cart-item
@itemClick="changeOrderSel"
@changeOrderNumber="changeOrderNumber"
@cartGoodsNumberInput="cartGoodsNumberInput"
@cartGoodsNumberChange="cartGoodsNumberChange"
v-for="(item, index) in order.gift.list"
:key="index"
:index="index"
:item="item"
:selPlaceNum="order.selPlaceNum"
:selIndex="order.selIndex"
></cart-item>
</template>
</div>
</div> </div>
<!-- 已下单菜品列表 --> <!-- 已下单菜品列表 -->
<template v-if="order.old.list.length"> <template v-if="order.old.list.length">
@@ -321,6 +348,24 @@
></cart-item> ></cart-item>
</div> </div>
</template> </template>
<!-- 打包费 -->
<template v-if="allPackMoney > 0">
<div class="list">
<div class="carts_list_title">打包费</div>
<cart-item
@itemClick="changeOrderExtraSel"
:canChangeNumber="false"
key="seatFee"
:index="0"
:item="order.packFee"
isSeatFee
:selIndex="order.extra.selIndex"
:placeNum="-10"
:selPlaceNum="order.selPlaceNum"
></cart-item>
</div>
</template>
<div class="order_remark" v-if="note.content"> <div class="order_remark" v-if="note.content">
订单备注 {{ note.content }} 订单备注 {{ note.content }}
</div> </div>
@@ -329,7 +374,7 @@
<div class="w-full bottom"> <div class="w-full bottom">
<div class="border-top"> <div class="border-top">
<div class="flex row-right youhui" v-if="giftLen"> <div class="flex row-right youhui" v-if="giftLen">
<span> 已优惠{{ allGiftMoney | to2 }} </span> <span> 已优惠{{ allGiftMoney }} </span>
<i class="el-icon-arrow-right"></i> <i class="el-icon-arrow-right"></i>
</div> </div>
@@ -551,17 +596,17 @@
</div> </div>
<div class="goods"> <div class="goods">
<template v-if="!isCreateOrder"> <template v-if="!isCreateOrder">
<div class="flex categoty"> <div class="flex categoty u-col-center">
<div <div
class="show_more_btn" class="show_more_btn"
:class="{ showAll: category.showAll }" :class="{ showAll: category.showAll }"
@click="toggleShowAll" @click="toggleShowAll"
> >
<div class="flex"> <div class="flex">
<div class="flex"> <div class="flex showmore">
<i class="el-icon-arrow-down"></i> <i class="el-icon-caret-bottom color-fff"></i>
</div> </div>
<span>展开</span> <span>{{ category.showAll ? "收起" : "展开" }}</span>
</div> </div>
</div> </div>
<div <div
@@ -1121,6 +1166,7 @@
<return-cart <return-cart
ref="refReturnCart" ref="refReturnCart"
:max="order.selGoods.number"
@confirm="refReturnCartConfirm" @confirm="refReturnCartConfirm"
></return-cart> ></return-cart>
</div> </div>
@@ -1140,6 +1186,7 @@ import returnCart from "./components/return-cart.vue";
import moneyKeyboard from "./components/money-keyboard.vue"; import moneyKeyboard from "./components/money-keyboard.vue";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { tbShopInfo } from "@/api/user"; import { tbShopInfo } from "@/api/user";
import { hasPermission } from "@/utils/limits.js";
import { import {
getGoodsLists, getGoodsLists,
@@ -1169,6 +1216,7 @@ import {
arrayContainsAll, arrayContainsAll,
generateCombinations, generateCombinations,
returnReverseVal, returnReverseVal,
returnGiftArr,
} from "./util.js"; } from "./util.js";
import { $status } from "@/utils/table.js"; import { $status } from "@/utils/table.js";
export default { export default {
@@ -1186,6 +1234,10 @@ export default {
}, },
data() { data() {
return { return {
//是否允许收款
canShoukuan: false,
//是否允许下单
canXiadan: false,
//是否是单品备注 //是否是单品备注
isDanNote: false, isDanNote: false,
//店铺信息 //店铺信息
@@ -1271,6 +1323,13 @@ export default {
total: 0, total: 0,
}, },
order: { order: {
packFee: {
totalNumber: 0,
status: "",
number: 0,
name: "打包费",
totalAmount: 0,
},
extra: { extra: {
selIndex: -1, selIndex: -1,
}, },
@@ -1341,7 +1400,7 @@ export default {
{ label: "图文显示", value: "img-and-text" }, { label: "图文显示", value: "img-and-text" },
{ label: "文字显示", value: "text" }, { label: "文字显示", value: "text" },
], ],
sel: "img-and-text", sel: "default",
}, },
// 选择用户 // 选择用户
vipUser: { vipUser: {
@@ -1381,15 +1440,53 @@ export default {
return this.table ? "代客下单" + `(${this.table.name})` : "代客下单"; return this.table ? "代客下单" + `(${this.table.name})` : "代客下单";
}, },
allGiftMoney() { allGiftMoney() {
const price = this.order.list const nowprice = this.order.list
.filter((v) => v.isGift === "true" || v.status == "return") .filter((v) => v.isGift === "true" || v.status == "return")
.reduce((a, b) => { .reduce((a, b) => {
return a + b.number * b.salePrice; return a + b.number * b.salePrice;
}, 0); }, 0);
return price;
const oldPrice = this.order.old.list.reduce((a, b) => {
const total = b.info
.filter((v) => v.isGift === "true")
.reduce((prve, cur) => {
return prve + cur.number * cur.salePrice;
}, 0);
return a + total;
}, 0);
return (nowprice + oldPrice).toFixed(2);
},
allPackMoney() {
let n = 0;
const nowPrice = this.order.list
.filter((v) => v.isPack === "true")
.reduce((a, b) => {
n += b.number * 1;
return a + b.packFee * 1;
}, 0);
const oldPrice = this.order.old.list.reduce((a, b) => {
const bPrice = b.info
.filter((v) => v.isPack === "true")
.reduce((prve, cur) => {
n += cur.number * 1;
return prve + cur.packFee * 1;
}, 0);
return a + bPrice;
}, 0);
const total = (nowPrice + oldPrice).toFixed(2);
this.order.packFee.totalAmount = total;
this.order.packFee.totalNumber = n;
return total;
}, },
giftLen() { giftLen() {
return this.order.list.filter((v) => v.isGift === "true").length; const nowlen = this.order.list.filter((v) => v.isGift === "true").length;
const oldlen = this.order.old.list.reduce((prve, cur) => {
const arr = cur.info.filter((v) => v.isGift === "true");
prve.push(...arr);
return prve;
}, []).length;
return nowlen + oldlen;
}, },
isSku() { isSku() {
if (this.order.selIndex < 0 || this.order.list.length <= 0) { if (this.order.selIndex < 0 || this.order.list.length <= 0) {
@@ -1436,6 +1533,7 @@ export default {
return ( return (
oldPrice + oldPrice +
price + price +
+this.order.packFee.totalAmount +
this.order.seatFee.totalAmount * this.order.seatFee.totalAmount *
(this.order.seatFee.status == "return" ? 0 : 1) (this.order.seatFee.status == "return" ? 0 : 1)
).toFixed(2); ).toFixed(2);
@@ -1608,7 +1706,7 @@ export default {
}).then((res) => { }).then((res) => {
this.$set(this.order.list, this.order.selIndex, { this.$set(this.order.list, this.order.selIndex, {
...res, ...res,
specSnap: item.specSnap, specSnap: item.specSnap || res.skuName,
number: this.order.number, number: this.order.number,
}); });
}); });
@@ -1633,6 +1731,7 @@ export default {
}, },
}, },
mounted() { mounted() {
this.xiadanClick();
// this.getGoods(); // this.getGoods();
// this.getCategory(); // this.getCategory();
// this.refToggle('refScanCode',true) // this.refToggle('refScanCode',true)
@@ -1641,8 +1740,19 @@ export default {
this.open(this.$route.query.tableId ? this.$route.query : ""); this.open(this.$route.query.tableId ? this.$route.query : "");
}, },
methods: { methods: {
async shoukuanClick() {
this.canShoukuan = await hasPermission("允许收款");
return this.canShoukuan;
},
// 打开页面
async xiadanClick() {
this.canXiadan = await hasPermission("允许下单");
return this.canXiadan;
},
changeOrderExtraSel(index, canChangeNumber, placeNum) { changeOrderExtraSel(index, canChangeNumber, placeNum) {
// console.log(index,canChangeNumber,placeNum) // console.log(index,canChangeNumber,placeNum)
this.order.selIndex = -1;
this.order.selGoods = this.order.seatFee; this.order.selGoods = this.order.seatFee;
this.order.selPlaceNum = placeNum; this.order.selPlaceNum = placeNum;
this.order.extra.selIndex = index; this.order.extra.selIndex = index;
@@ -1651,6 +1761,10 @@ export default {
if (this.order.list.length <= 0) { if (this.order.list.length <= 0) {
return this.$message("请选择菜品"); return this.$message("请选择菜品");
} }
const canJiesuan = await this.shoukuanClick();
if (!canJiesuan) {
return;
}
// if(this.isCreateOrder){ // if(this.isCreateOrder){
// return // return
// } // }
@@ -1660,7 +1774,11 @@ export default {
this.order.payType = ""; this.order.payType = "";
this.isCreateOrder = true; this.isCreateOrder = true;
}, },
cashPayClick() { async cashPayClick() {
const canJiesuan = await this.shoukuanClick();
if (!canJiesuan) {
return;
}
this.$confirm("是否确认已现金收款:" + this.allPrice + "?", "快捷支付", { this.$confirm("是否确认已现金收款:" + this.allPrice + "?", "快捷支付", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
@@ -1692,9 +1810,9 @@ export default {
return res; return res;
}, },
async payBeforeClear() { async payBeforeClear() {
this.getMasterId().then(res=>{ this.getMasterId().then((res) => {
this.masterId = res.masterId; this.masterId = res.masterId;
}) });
this.loading = false; this.loading = false;
this.order.list = []; this.order.list = [];
this.order.query.page = 1; this.order.query.page = 1;
@@ -1721,27 +1839,36 @@ export default {
this.key = ""; this.key = "";
this.order.orderId = ""; this.order.orderId = "";
this.perpole = ""; this.perpole = "";
this.useTypes.sel = "dine-in"; // this.useTypes.sel = "dine-in";
}, },
async cachePay() { async cachePay() {
const canJiesuan = await this.shoukuanClick();
if (!canJiesuan) {
return;
}
await this.returnCreateOrderData(); await this.returnCreateOrderData();
this.payBeforeClear({}); this.payBeforeClear({});
this.pays(); this.pays();
}, },
async scanPayClick() { async scanPayClick() {
const canJiesuan = await this.shoukuanClick();
if (!canJiesuan) {
return;
}
await this.returnCreateOrderData(); await this.returnCreateOrderData();
this.payBeforeClear(); this.payBeforeClear();
this.order.payType = "scanCode"; this.order.payType = "scanCode";
this.payTypeItemClick({ payType: "scanCode" }); this.payTypeItemClick({ payType: "scanCode" });
}, },
changeOrderUseType(useType) { async changeOrderUseType(useType) {
if (useType && this.order.list.length) { if (useType && this.order.list.length) {
const tableId = useType == "takeout" ? undefined : this.table.tableId; const tableId = useType == "takeout" ? undefined : this.table.tableId;
$changeUseType({ await $changeUseType({
useType, useType,
tableId, tableId,
cartIds: this.order.list.map((v) => v.id), cartIds: this.order.list.map((v) => v.id),
}); });
this.getCart();
} }
}, },
//设置用餐类型 //设置用餐类型
@@ -1867,15 +1994,18 @@ export default {
.catch(() => {}); .catch(() => {});
}, },
//退菜 //退菜
async refReturnCartConfirm() { async refReturnCartConfirm(e) {
const res = await $returnCart({ const res = await $returnCart({
...e,
cartId: this.order.selGoods.id, cartId: this.order.selGoods.id,
tableId: this.table.tableId, tableId: this.table.tableId,
}); });
this.order.selGoods.status = "return"; this.order.selGoods.status = "return";
this.order.old.selIndex = -1; this.order.old.selIndex = -1;
this.getCart();
console.log(this.order.selGoods); console.log(this.order.selGoods);
}, },
// 台桌列表 // 台桌列表
async getTable() { async getTable() {
try { try {
@@ -1923,7 +2053,11 @@ export default {
ChangeDiscount(discount) { ChangeDiscount(discount) {
this.createOrder.discount = discount; this.createOrder.discount = discount;
}, },
disCountShow() { async disCountShow() {
const canDiscount = await hasPermission("允许打折");
if (!canDiscount) {
return;
}
const { amount } = this.createOrder.data; const { amount } = this.createOrder.data;
this.refToggle("refDiscount", true, { this.refToggle("refDiscount", true, {
amount, amount,
@@ -1955,7 +2089,8 @@ export default {
isSellOut(item) { isSellOut(item) {
return ( return (
item.isPauseSale || item.isPauseSale ||
(item.typeEnum !== "sku" && item.specList[0].stockNumber <= 0) (item.typeEnum !== "sku" &&
(item.isStock == 1 ? item.stockNumber <= 0 : false))
); );
}, },
toggleFullScreen() { toggleFullScreen() {
@@ -2020,7 +2155,10 @@ export default {
note: note, note: note,
num: cart.number, // 0会删除此商品 num: cart.number, // 0会删除此商品
}); });
this.$set(this.order.list, this.order.selIndex, res); this.$set(this.order.list, this.order.selIndex, {
...res,
specSnap: res.skuName,
});
this.$notify({ this.$notify({
title: "更新成功", title: "更新成功",
type: "success", type: "success",
@@ -2104,7 +2242,21 @@ export default {
this.isCreateOrder = false; this.isCreateOrder = false;
}, },
//生成订单 //生成订单
toCreateOrderDebounce(isNowPay) { async toCreateOrderDebounce(isNowPay) {
if (!isNowPay) {
//仅下单
const canXiadan = await this.xiadanClick();
if (!canXiadan) {
return;
}
}else{
//去结算
const canJiesuan = await this.shoukuanClick();
if (!canJiesuan) {
return;
}
}
console.log(this.createOrder.status); console.log(this.createOrder.status);
if ( if (
this.createOrder.status != "" && this.createOrder.status != "" &&
@@ -2120,6 +2272,14 @@ export default {
console.log(this.order.orderId); console.log(this.order.orderId);
let res = ""; let res = "";
try { try {
const seatFee = await $choseCount({
masterId: this.masterId,
tableId: this.table.tableId,
num: this.perpole,
});
this.order.seatFee = seatFee;
this.order.seatFee = res;
res = await $createOrder({ res = await $createOrder({
masterId: this.order.masterId || this.masterId, masterId: this.order.masterId || this.masterId,
vipUserId: this.vipUser.id, vipUserId: this.vipUser.id,
@@ -2183,8 +2343,9 @@ export default {
updateOrder(par = {}) { updateOrder(par = {}) {
let item = this.order.list[this.order.selIndex]; let item = this.order.list[this.order.selIndex];
console.log(item.specSnap); console.log(item.specSnap);
const { productId, skuId, isPack, isGift, number } = item; const { productId, skuId, isPack, isGift, number, id } = item;
addCart({ $updateCart({
cartId: id,
masterId: this.masterId, masterId: this.masterId,
vipUserId: this.vipUser.id, vipUserId: this.vipUser.id,
productId, productId,
@@ -2794,12 +2955,16 @@ export default {
}, },
//设置购物车数据 //设置购物车数据
setCart(res) { setCart(res) {
console.log(res);
this.order.seatFee = res.seatFee ? res.seatFee : this.order.seatFee; this.order.seatFee = res.seatFee ? res.seatFee : this.order.seatFee;
this.perpole = res.seatFee ? res.seatFee.totalNumber : 1; this.perpole = res.seatFee ? res.seatFee.totalNumber : 1;
const nowCart = res.records.find((v) => v.placeNum == 0); const nowCart = res.records.find((v) => v.placeNum == 0);
// this.order.list = nowCart ? nowCart.info.filter(v=>v.isGift!=='true') : [];
this.order.list = nowCart ? nowCart.info : []; this.order.list = nowCart ? nowCart.info : [];
const oldCart = res.records.filter((v) => v.placeNum != 0); const oldCart = res.records.filter((v) => v.placeNum != 0);
this.order.old.list = oldCart ? oldCart : []; this.order.old.list = oldCart ? oldCart : [];
// this.order.gift.list = returnGiftArr(res.records);
console.log(this.order.old.list);
}, },
//获取购物车数据 //获取购物车数据
async getCart() { async getCart() {
@@ -2951,9 +3116,9 @@ export default {
return false; return false;
} }
let isShow = true; let isShow = true;
if (v.typeEnum !== "sku") { // if (v.typeEnum !== "sku") {
isShow = v.specList.length >= 1; // isShow = v.specList.length >= 1;
} // }
v.specList.map((spe) => { v.specList.map((spe) => {
$goodsMap[`${v.id}_${spe.id}`] = spe; $goodsMap[`${v.id}_${spe.id}`] = spe;
}); });
@@ -3318,7 +3483,7 @@ input[type="number"]::-webkit-outer-spin-button {
} }
.tableId { .tableId {
padding: 9px 15px; padding: 8px 15px;
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;
font-size: 12px; font-size: 12px;
border-radius: 3px; border-radius: 3px;
@@ -3512,7 +3677,7 @@ input[type="number"]::-webkit-outer-spin-button {
.show_more_btn { .show_more_btn {
padding: 0 10px; padding: 0 10px;
color: #1890ff; color: #333;
font-size: 16px; font-size: 16px;
display: flex; display: flex;
align-items: center; align-items: center;
@@ -3528,12 +3693,21 @@ input[type="number"]::-webkit-outer-spin-button {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.el-icon-arrow-down { .showmore {
transition: all 0.2s; transition: all 0.2s;
margin-right: 8px;
width: 21px;
height: 21px;
border-radius: 50%;
background: #3f9eff;
display: flex;
justify-content: center;
align-items: center;
} }
&.showAll {
&.showAll .el-icon-arrow-down { .showmore {
transform: rotate(180deg); transform: rotate(180deg);
}
} }
} }
} }
@@ -3756,7 +3930,7 @@ input[type="number"]::-webkit-outer-spin-button {
.list { .list {
width: 352px; width: 352px;
padding: 12px 12px 0 0; padding: 0 12px 0 0;
} }
.controls { .controls {
@@ -3788,69 +3962,6 @@ input[type="number"]::-webkit-outer-spin-button {
} }
} }
} }
.order-item {
padding: 4px;
border-radius: 2px;
display: flex;
cursor: pointer;
align-items: center;
justify-content: space-between;
background-color: rgba(0, 0, 0, 0);
transition: all 0.3s;
.pack {
right: 100%;
width: 18px;
height: 18px;
background: #35ac6a;
border-radius: 4px 0 4px 0;
font-size: 12px;
color: #fff;
text-align: center;
line-height: 17px;
z-index: 2;
}
&.active {
background-color: rgba(0, 0, 0, 0.04);
}
.total-price {
width: 94px;
text-align: right;
}
.good-info {
display: flex;
flex-direction: column;
justify-content: center;
min-width: 70px;
.specSnap {
color: #999;
font-size: 12px;
margin-top: 3px;
}
}
.name {
font-size: 13px;
text-align: left;
color: #212121;
overflow: hidden;
}
.img {
width: 40px;
height: 40px;
position: relative;
margin-right: 10px;
img {
width: 40px;
height: 40px;
}
}
}
} }
.goods { .goods {
@@ -3877,12 +3988,13 @@ input[type="number"]::-webkit-outer-spin-button {
.timeSale { .timeSale {
text-align: center; text-align: center;
border-radius: 10px; border-radius: 10px;
background-color: hsla(0, 0%, 99.2%, 0.5); background-color: rgb(245, 245, 245, 0.6);
color: #fff; color: #fff;
font-size: 10px; font-size: 10px;
line-height: 16px; line-height: 16px;
padding: 2px 10px; padding: 3px 10px;
margin-top: 2px; margin-top: 4px;
width: 100%;
} }
.sell-out { .sell-out {
width: 100%; width: 100%;
@@ -3915,7 +4027,7 @@ input[type="number"]::-webkit-outer-spin-button {
font-size: 14px; font-size: 14px;
position: absolute; position: absolute;
inset: 0; inset: 0;
background: rgba(0, 0, 0, 0.4); background: rgba(46, 46, 46, 0.38);
color: #fff; color: #fff;
box-sizing: border-box; box-sizing: border-box;
padding: 10px; padding: 10px;

View File

@@ -45,3 +45,16 @@ export function returnReverseVal(val, isReturnString = true) {
} }
return reverseNewval; return reverseNewval;
} }
export function returnGiftArr(arr){
let result=[]
for(let i=0;i<arr.length;i++){
const info=arr[i].info
for(let j=0;j<info.length;j++){
if(info[j].isGift==='true'){
result.push(info[j])
}
}
}
return result
}