10 Commits
dwb ... test

11 changed files with 604 additions and 378 deletions

View File

@@ -1,10 +1,10 @@
// 桌台管理
import request from "@/utils/request";
//就餐形式,默认堂食后付费
const useType='dine-in-after'
function getUseType(){
const type=localStorage.getItem("useType")
return type?type:useType
import request from '@/utils/request'
// 就餐形式,默认堂食后付费
const useType = 'dine-in-after'
function getUseType() {
const type = localStorage.getItem('useType')
return type || useType
}
/**
* 台桌列表
@@ -13,12 +13,51 @@ function getUseType(){
export function tbShopTableGet(params) {
return request({
url: `/api/tbShopTable`,
method: "get",
params:{
shopId: localStorage.getItem("shopId"),
method: 'get',
params: {
shopId: localStorage.getItem('shopId'),
...params
}
});
})
}
/**
* 获取预约台桌列表
* @returns
*/
export function getShopTableList(params) {
return request({
url: `/api/booking/shop-table/list`,
method: 'get',
params: {
shopId: localStorage.getItem('shopId'),
...params
}
})
}
/**
* 预约
* @returns
*/
export function makeShopTable(data) {
return request({
url: `/api/booking/shop-table`,
method: 'post',
data
})
}
/**
* 标记预约状态
* @returns
*/
export function markStatus(data) {
return request({
url: `/api/booking/shop-table/mark-status`,
method: 'post',
data
})
}
/**
@@ -28,7 +67,7 @@ export function tbShopTableGet(params) {
export function tbShopAreaGet(params) {
return request({
url: `/api/tbShopArea`,
method: "get",
method: 'get',
params
});
}

View File

@@ -666,8 +666,8 @@ export default {
singlePeopleLimit: 0,
weight: '',
days: couponEnum.cycle.map(item => item.value),
startTime: '',
endTime: ''
startTime: '00:00',
endTime: '23:59'
},
useTime: ['00:00', '23:59'],
imgList: [],

View File

@@ -2,8 +2,7 @@
<el-dialog
title="预约"
:visible.sync="dialogVisible"
width="400px"
@open="tbShopAreaGet"
width="500px"
@close="reset"
>
<el-form
@@ -14,17 +13,67 @@
label-position="left"
>
<el-form-item label="就餐人数" prop="number">
<el-input-number v-model="form.number" :min="1" controls-position="right" />
<el-form-item label="预约日期" prop="bookingDate">
<!-- <el-date-picker
v-model="form.bookingDate"
type="date"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions"
placeholder="选择预约日期"
style="width: 200px;margin-right: 10px;"
@change="getShopTableList"
/> -->
<el-radio-group
v-model="form.bookingDate"
class="date"
@change="getShopTableList"
>
<el-radio-button
v-for="(item) in dateList"
:key="item.date"
:label="item.date"
>
<div style="font-size: 12px;margin-bottom: 4px;">{{ item.label }} / {{ item.date.substring(8,10) }}</div>
<div style="font-size: 12px;"> {{ item.day }}</div>
</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" oninput="value= value.replace(/[^0-9]/g, '')" maxlength="11" placeholder="请输入联系电话" />
<el-form-item label="预约类型" prop="bookingType">
<el-radio-group v-model="form.bookingType" @change="getShopTableList">
<el-radio-button label="lunch">午餐</el-radio-button>
<el-radio-button label="dinner">晚餐</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="联系人" prop="name">
<el-input v-model="form.name" placeholder="请输入联系人姓名" />
<el-form-item label="就餐时间" prop="bookingTime">
<el-time-picker
v-model="form.bookingTime"
value-format="HH:mm:ss"
placeholder="选择时间"
style="width: 100%;"
/>
</el-form-item>
<el-form-item label="就餐时间" prop="time">
<el-time-picker v-model="form.time" value-format="HH:mm:ss" placeholder="选择时间" style="width: 100%;" />
<el-form-item label="预约桌台" prop="shopTableId">
<el-select v-model="form.shopTableId" placeholder="选择" style="width: 100%;">
<el-option
v-for="item in shopTableList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="用餐人数" prop="dinerNum">
<el-input-number v-model="form.dinerNum" :min="1" controls-position="right" style="width: 100%;"/>
</el-form-item>
<el-form-item label="订餐人" prop="bookingPerson">
<el-input v-model="form.bookingPerson" style="width: 200px;margin-right: 10px;" placeholder="请输入联系人姓名" />
<el-radio-group v-model="form.gender">
<el-radio-button label="1">先生</el-radio-button>
<el-radio-button label="2">女士</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="联系电话" prop="phoneNumber">
<el-input v-model="form.phoneNumber" oninput="value= value.replace(/[^0-9]/g, '')" maxlength="11" placeholder="请输入联系电话" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@@ -39,46 +88,73 @@
</template>
<script>
import { $fastCreateTable } from '@/api/table'
import { getShopTableList, makeShopTable } from '@/api/table'
import dayjs from 'dayjs'
export default {
data() {
return {
dialogVisible: false,
resetForm: '',
loading: false,
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now() - 8.64e7 // 如果今天之前的日期都不可选减去8.64e7是1天的毫秒数
}
},
dateList: [
{ label: '今', day: '', date: '' },
{ label: '明', day: '', date: '' },
{ label: '后', day: '', date: '' }
],
shopTableList: [],
form: {
id: '',
number: 1,
name: '',
phone: '',
time: ''
bookingDate: '',
bookingType: 'lunch',
shopTableId: null,
dinerNum: 1,
bookingPerson: '',
phoneNumber: '',
gender: '1',
bookingTime: '',
diningType: '普通用餐',
focus: '0',
receiveMarketingSms: '0'
},
rules: {
number: [
shopTableId: [
{
required: true,
message: '请选择就餐人数',
message: '请选择预约桌台',
trigger: ['blur']
}
],
phone: [
dinerNum: [
{
required: true,
message: '请选择用餐人数',
trigger: ['blur']
}
],
phoneNumber: [
{
required: true,
message: '请输入联系方式',
trigger: ['blur']
}
],
name: [
bookingPerson: [
{
required: true,
message: '请输入联系人姓名',
message: '请输入订餐人姓名',
trigger: ['blur']
}
],
time: [
bookingTime: [
{
required: true,
message: '请选择时间',
message: '请选择用餐时间',
trigger: ['change']
}
]
@@ -89,19 +165,59 @@ export default {
this.resetForm = { ...this.form }
},
methods: {
getWeekdays() {
const today = new Date()
const tomorrow = new Date(today)
const dayAfterTomorrow = new Date(today)
// 设置时间为今天
tomorrow.setDate(today.getDate() + 1)
dayAfterTomorrow.setDate(today.getDate() + 2)
// 获取星期几的方法
const getDayOfWeek = (date) => {
const days = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
return days[date.getDay()]
}
// 获取今天、明天和后天的星期几
const todayWeekday = getDayOfWeek(today)
const tomorrowWeekday = getDayOfWeek(tomorrow)
const dayAfterTomorrowWeekday = getDayOfWeek(dayAfterTomorrow)
this.dateList[0].day = todayWeekday
this.dateList[1].day = tomorrowWeekday
this.dateList[2].day = dayAfterTomorrowWeekday
this.dateList[0].date = dayjs(today).format('YYYY-MM-DD')
this.dateList[1].date = dayjs(tomorrow).format('YYYY-MM-DD')
this.dateList[2].date = dayjs(dayAfterTomorrow).format('YYYY-MM-DD')
this.form.bookingDate = this.dateList[0].date
},
/**
* 获取桌台数据
*/
async getShopTableList() {
this.form.shopTableId = null
const params = {
bookingDate: this.form.bookingDate,
bookingType: this.form.bookingType
}
const res = await getShopTableList(params)
this.shopTableList = res
console.log(res)
},
onSubmitHandle() {
this.$refs.form.validate(async(valid) => {
if (valid) {
this.loading = true
try {
const res = await $fastCreateTable(
{
const bookingTime = this.form.bookingDate + ' ' + this.form.bookingTime
const params = {
...this.form,
qrcode: this.form.tableId,
shopId: localStorage.getItem('shopId')
},
this.form.id ? 'put' : 'post'
)
}
params.bookingTime = bookingTime
const res = await makeShopTable(params)
this.$emit('success', res)
this.close()
this.$notify({
@@ -122,6 +238,8 @@ export default {
if (obj && obj.id) {
this.form = JSON.parse(JSON.stringify(obj))
}
this.getShopTableList()
this.getWeekdays()
},
close() {
this.dialogVisible = false
@@ -133,3 +251,19 @@ export default {
}
}
</script>
<style scoped lang="scss">
.date{
::v-deep .el-form-item__content{
// height: 36px;
// display: flex;
// justify-content: space-between;
}
::v-deep .el-radio-button{
height: 100%;
}
::v-deep .el-radio-button__inner{
padding: 4px 20px;
height: 100%;
}
}
</style>

View File

@@ -1,38 +1,10 @@
export default {
pending: {
label: "挂单中",
type: "#E6A23C",
},
using: {
label: "开台中",
type: "#fa5555",
},
paying: {
label: "结算中",
type: "#E6A23C",
},
idle: {
label: "空闲",
type: "#3F9EFF",
},
subscribe: {
label: "预定",
type: "rgb(34, 191, 100)",
},
closed: {
label: "关台",
type: "rgb(221,221,221)",
},
// opening: {
// label: "开台中",
// type: "#67C23A",
// },
cleaning: {
label: "待清台",
type: "#FAAD14",
},
unbind: {
label: "未绑定",
type: "rgb(221,221,221)",
}
pending: { label: '挂单中', type: '#E6A23C' },
cleaning: { label: '待清台', type: '#FAAD14' },
using: { label: '开台中', type: '#FF4D4F' },
idle: { label: '空闲', type: '#3F9EFF' },
paying: { label: '结算中', type: '#E6A23C' },
closed: { label: '关台', type: '#DDDDDD' },
subscribe: { label: '预约', type: '#52C41A ' },
unbind: { label: '未绑定', type: 'rgb(221,221,221)' }
}

View File

@@ -22,6 +22,27 @@
</el-tabs>
<div class="head-container">
<div class="filter_wrap">
<el-radio-group
v-model="query.bookingDate"
class="date"
@change="tbShopTableGet"
>
<el-radio-button
v-for="(item) in dateList"
:key="item.date"
:label="item.date"
>
<div>{{ item.label }}
<!-- / {{ item.date.substring(8,10) }} -->
</div>
<!-- <div style="font-size: 12px;"> {{ item.day }}</div> -->
</el-radio-button>
</el-radio-group>
<el-radio-group v-model="query.bookingType" @change="tbShopTableGet">
<el-radio-button label="lunch">午餐</el-radio-button>
<el-radio-button label="dinner">晚餐</el-radio-button>
</el-radio-group>
<el-button
icon="el-icon-plus"
@click="$refs.addEara.show()"
@@ -43,6 +64,11 @@
icon="el-icon-download"
@click="downloadShopCode"
>下载店铺码</el-button>
<el-button
type="primary"
icon="el-icon-plus"
@click="$refs.subscribe.show()"
>预约</el-button>
</div>
</div>
<div class="u-flex u-p-b-15 u-font-14">
@@ -98,7 +124,7 @@
? status[item.status].type
: '',
}"
></span>
/>
{{ status[item.status] ? status[item.status].label : "" }}
</div>
</div> -->
@@ -115,7 +141,25 @@
<!-- <div class="row">
<span class="tips">客座次数{{ item.maxCapacity }}</span>
</div> -->
<div class="u-font-18 font-600 total-price">
<div v-if="item.status == 'subscribe'">
<div class="row row1" style="align-items: flex-start;">
<span style="font-size: 14px;color: #333;">{{ item.bookingInfo.createUserName }}{{ item.bookingInfo.bookingPerson }}{{ item.bookingInfo.gender==1?'先生':'女士' }}</span>
<div class="state" style="font-size: 12px;color: #666;display: flex;align-items: center;">
<img
style="width: 16px; height: 16px; filter: contrast(0.5)"
src="@/assets/images/perpole.png"
alt=""
>
{{ item.bookingInfo.bookingTime.substring(11,19) }}
</div>
</div>
<div class="row">
<span style="font-size: 14px;color: #333;margin-top: 5px;">{{ item.bookingInfo.phoneNumber }}</span>
</div>
</div>
<div v-else class="u-font-18 font-600 total-price">
<span
v-if="item.status == 'using'"
class="cur-pointer"
@@ -123,30 +167,31 @@
>
¥{{ item.totalAmount || 0 }}{{ item.productNum }}
</span>
<span v-else class="color-fff">|</span>
<!-- <span v-else class="color-fff">|</span> -->
</div>
<div class="row btn-group">
<template v-if="item.status == 'idle'">
<el-button
type="primary"
:disabled="!item.tableId || item.status === 'closed'"
@click="diancanShow(item, 'subscribe')"
>预约</el-button>
</template>
<div class="row btn-group" style="margin-top: 10px;">
<template v-if="item.status == 'subscribe'">
<el-button
type="primary"
type="success"
:disabled="!item.tableId || item.status === 'closed'"
>已预约</el-button>
@click="markStatus(item,-1)"
>取消预约</el-button>
</template>
<template v-if="item.status == 'idle' || item.status == 'subscribe'">
<template v-if="item.status == 'subscribe'&&(item.bookingInfo.status==20)">
<el-button
type="success"
:disabled="!item.tableId || item.status === 'closed'"
@click="markStatus(item,10)"
>到店</el-button>
</template>
<template v-if="item.status == 'idle'||(item.status == 'subscribe'&&(item.bookingInfo.status==10))">
<el-button
type="primary"
:disabled="!item.tableId || item.status === 'closed'"
@click="diancanShow(item)"
>点餐</el-button>
</template>
<template v-else>
<template v-else-if="item.status != 'idle' && item.status != 'subscribe'">
<template v-if="item.status == 'using'">
<el-button
:disabled="!item.tableId || item.status === 'closed'"
@@ -238,9 +283,12 @@ import downloadTableCode from './components/downloadTableCode'
import chooseDinersNumber from './components/table-diancan-components/choose-diners-number.vue'
import { tbShopInfo } from '@/api/user'
import { hasPermission } from '@/utils/limits.js'
import $status from './status.js'
import dayjs from 'dayjs'
import {
tbShopTableGet,
markStatus,
tbShopAreaGet,
tbShopAreaDelete,
tbShopTableDelete,
@@ -277,29 +325,40 @@ export default {
},
data() {
return {
dateList: [
{ label: '今天', day: '', date: '' },
{ label: '明天', day: '', date: '' },
{ label: '后天', day: '', date: '' }
],
query: {
bookingDate: '',
bookingType: 'lunch'
},
tabVlaue: '',
tabs: [],
loading: false,
total: 0,
tableList: [],
status: {
pending: { label: '挂单中', type: '#E6A23C' },
status: $status,
// status: {
// pending: { label: '挂单中', type: '#E6A23C' },
cleaning: { label: '待清台', type: '#FAAD14' },
using: { label: '开台中', type: '#FF4D4F' },
idle: { label: '空闲', type: '#3F9EFF' },
// cleaning: { label: '待清台', type: '#FAAD14' },
// using: { label: '开台中', type: '#FF4D4F' },
// idle: { label: '空闲', type: '#3F9EFF' },
paying: { label: '结算中', type: '#E6A23C' },
// paying: { label: '结算中', type: '#E6A23C' },
closed: { label: '关台', type: '#DDDDDD' },
subscribe: { label: '预定', type: '#52C41A ' },
// closed: { label: '关台', type: '#DDDDDD' },
// subscribe: { label: '预定', type: '#52C41A ' },
unbind: { label: '未绑定', type: 'rgb(221,221,221)' }
// unbind: { label: '未绑定', type: 'rgb(221,221,221)' }
},
// },
selTable: '', // 当前选中的桌台
areaMap: {},
shopInfo: {},
bookingDate: '',
timer: null
}
},
@@ -312,8 +371,53 @@ export default {
this.setTimter(60)
this.tbShopAreaGet()
this.getShopInfo()
this.getWeekdays()
},
methods: {
/**
* 设置日期
*/
getWeekdays() {
const today = new Date()
const tomorrow = new Date(today)
const dayAfterTomorrow = new Date(today)
// 设置时间为今天
tomorrow.setDate(today.getDate() + 1)
dayAfterTomorrow.setDate(today.getDate() + 2)
// 获取星期几的方法
const getDayOfWeek = (date) => {
const days = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
return days[date.getDay()]
}
// 获取今天、明天和后天的星期几
const todayWeekday = getDayOfWeek(today)
const tomorrowWeekday = getDayOfWeek(tomorrow)
const dayAfterTomorrowWeekday = getDayOfWeek(dayAfterTomorrow)
this.dateList[0].day = todayWeekday
this.dateList[1].day = tomorrowWeekday
this.dateList[2].day = dayAfterTomorrowWeekday
this.dateList[0].date = dayjs(today).format('YYYY-MM-DD')
this.dateList[1].date = dayjs(tomorrow).format('YYYY-MM-DD')
this.dateList[2].date = dayjs(dayAfterTomorrow).format('YYYY-MM-DD')
this.query.bookingDate = this.dateList[0].date
},
/**
* 修改预约状态
*/
async markStatus(item, type) {
console.log(item)
const params = {
id: item.bookingInfo.id,
status: type
}
const res = await markStatus(params)
this.tbShopTableGet()
console.log(res)
},
/**
* 下载店铺码
*/
@@ -332,6 +436,9 @@ export default {
console.log(error)
}
},
tbShopSubscribe() {
this.tbShopTableGet()
},
/**
* 清除定时器
*/
@@ -499,11 +606,17 @@ export default {
async tbShopTableGet(showloading = true) {
this.loading = showloading
try {
const { content, total } = await tbShopTableGet({
const res = await tbShopTableGet({
shopId: localStorage.getItem('shopId'),
areaId: this.tabVlaue
areaId: this.tabVlaue === '0' ? '' : this.tabVlaue,
...this.query
})
this.tableList = content
res.content.map(item => {
if (item.status === 'subscribe' && !item.bookingInfo) {
item.status = 'idle'
}
})
this.tableList = res.content
// this.tableList = content.sort((a,b)=>{
// if(a.status=='idle'&&b.status!='idle'){
// return 1
@@ -511,7 +624,7 @@ export default {
// return -1
// }
// });
this.total = total
this.total = res.total
setTimeout(() => {
this.loading = false
}, 300)
@@ -601,8 +714,8 @@ export default {
justify-content: space-between;
border-radius: 6px;
background-color: #1890ff;
max-width: 172px;
min-width: 160px;
max-width: 210px;
min-width: 190px;
&.using {
background-color: rgb(250, 85, 85);
}
@@ -630,8 +743,12 @@ export default {
text-overflow: ellipsis;
}
.box {
height: 100%;
background-color: #fff;
border-radius: 3px 3px 6px 6px;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.bottom {
border-top: 1px solid #f7f7fa;
@@ -642,6 +759,9 @@ export default {
background-color: #fff;
flex: 1;
border-radius: 3px 3px 0 0;
display: flex;
flex-direction: column;
justify-content: flex-end;
.row {
display: flex;
gap: 10px;

View File

@@ -187,7 +187,6 @@ export default {
isActive() {
const isSel =
this.selIndex === this.index && this.placeNum === this.selPlaceNum;
console.log(isSel);
return isSel ? "active" : "";
},
},

View File

@@ -65,7 +65,6 @@ export default {
this.$set(this.listdata.proGroupVo, index, { ...this.listdata.proGroupVo[index], alertshow: this.listdata.proGroupVo[index].number != this.multipleSelection[index].length ? true : false });
},
confirm() {
console.log(listdata.proGroupVo)
this.$emit("dialogpackageconfirm", this.listdata, this.multipleSelection);
this.show = false;
@@ -84,7 +83,6 @@ export default {
return false;
}
this.disabledshow = true
console.log(this.listdata, this.multipleSelection);
this.show = true;
},
},

View File

@@ -7,7 +7,7 @@
</slot>
</div>
<slot name="tips"></slot>
<div class="number_list_box">
<div class="number_list_box" v-if="!disabled">
<div class="yd-keyboard">
<div class="mini-number-box1">
<div class="mini-number">
@@ -65,6 +65,10 @@ export default {
type: Boolean,
default: false,
},
disabled:{
type:Boolean,
default:false
},
max: {
type: [Number, String],
default: Infinity,

View File

@@ -25,6 +25,7 @@
v-model="number"
isFloat
@clear="clear"
:disabled="true"
:max="payMoney"
:maxTips="'超出未结账金额'"
>
@@ -36,7 +37,7 @@
>
{{ tips }}
</div>
<div slot="input" class="u-p-l-20 u-p-r-20 u-flex w-full">
<div slot="input" class="u-p-l-20 u-p-r-20 u-flex w-full u-relative">
<div class="font-bold u-font-32">¥</div>
<el-input
placeholder="请输入挂账金额"
@@ -48,6 +49,7 @@
:type="focus ? 'number' : 'text'"
>
</el-input>
<div class="zhezhao"></div>
</div>
</key-board>
<div class="confirm_btns">
@@ -267,7 +269,14 @@ export default {
font-size: 20px;
position: relative;
}
.zhezhao{
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 1;
}
.select_desk .select_desk_dialog .inputs .close {
color: #aaa;
position: absolute;

View File

@@ -1,14 +1,18 @@
<template>
<div class="select_desk">
<el-dialog title="请选择商品" :visible.sync="show">
<div style="padding: 10px 0;display: flex;justify-content: space-between;align-items: center;">
<div style="
padding: 10px 0;
display: flex;
justify-content: space-between;
align-items: center;
">
<el-checkbox v-model="isFull">并桌</el-checkbox>
<el-select v-model="targetTableId" placeholder="请选择目标台桌">
<el-option v-for="item in originTableList" :key="item.tableId" :label="item.name"
:value="item.tableId" @click="changeTable(item, index)">
:value="item.tableId">
</el-option>
</el-select>
</div>
<div v-if="!isFull">
<div v-if="itemdata.list.length > 0">
@@ -53,7 +57,6 @@
{{ (scope.row.salePrice * scope.row.number).toFixed(2) }}
</div>
</template>
</el-table-column>
</el-table>
</div>
@@ -64,7 +67,6 @@
<el-button @click="toggleSelection">取消</el-button>
</div>
</el-dialog>
</div>
</template>
@@ -74,16 +76,22 @@ import { forEach } from "lodash";
export default {
data() {
return {
selectalllist: [],
show: false,
itemdata: {},
itemdata: {
list: [],
masterId: '',
currentTableId: '',
targetTableId: '',
originTableList: [],//桌台列表
old: {
list: [],
}
},
list: [],
masterId: "",
currentTableId: "",
targetTableId: "",
originTableList: [], //桌台列表
multipleSelection: [],
refcartSelection: [],
isFull: false
isFull: false,
};
},
methods: {
@@ -92,79 +100,80 @@ export default {
this.$refs.refcart.clearSelection();
this.$refs.reftransfertoPinpin.forEach((a) => {
a.clearSelection();
})
} catch (error) {
}
});
} catch (error) { }
},
handleSelectionChange(val, index) {
try {
this.itemdata.old.list.forEach((a, i) => {
this.multipleSelection[index] = i === index ? val : this.multipleSelection[index] || []
})
this.multipleSelection[index] =
i === index ? val : this.multipleSelection[index] || [];
});
} catch (error) { }
},
handlerefcart(val) {
this.refcartSelection = val
this.refcartSelection = val;
},
async confirm() {
console.log(this.itemdata, this.multipleSelection)
if (!this.targetTableId) {
this.$message({
message: '请选择目标台桌!',
type: 'warning'
})
message: "请选择目标台桌!",
type: "warning",
});
return false;
}
// 判断全选增加课桌费
// var tzf = []
// try {
// let one = this.itemdata.old.list.every((i, index) => i.info.length == this.multipleSelection[index].length)
// let tow = this.itemdata.list.every((icon) => icon.length == this.refcartSelection.length)
// if (one && tow) {
// tzf = [999]
// }
// } catch (error) { }
// 数据处理 增加cartId方便判断
if (this.refcartSelection.length) {
this.refcartSelection.forEach((i) => {
i.cartId = i.id
})
i.cartId = i.id;
});
}
let cartIds = [...this.multipleSelection, [...this.refcartSelection]]
console.log(cartIds)
let cartIds = [...this.multipleSelection, [...this.refcartSelection]];
await placeswitch({
masterId: this.masterId,
orderId: this.itemdata.orderId,//当前台桌订单id 可选
cartIds: this.isFull ? '' : cartIds.flatMap(subArray => subArray.map(item => item.cartId)),//转单的购物车商品 并桌时可不传 可选
isFull: this.isFull,//并台会将全部购物车商品转入默认为false 可选
orderId: this.itemdata.orderId, //当前台桌订单id 可选
cartIds: this.isFull ? "" : cartIds.flatMap((subArray) => subArray.map((item) => item.cartId)), //转单的购物车商品 并桌时可不传 可选
isFull: this.isFull, //并台会将全部购物车商品转入默认为false 可选
currentTableId: this.currentTableId,
targetTableId: this.targetTableId,
})
});
this.$forceUpdate();
this.$emit("transfertoPinpin");
this.show = false;
},
open(item, masterId, currentTableId, originTableList) {
// 订单信息,取餐码,用餐类型,桌台号id台桌列表
console.log(item, masterId, currentTableId, originTableList)
this.itemdata = item
this.masterId = masterId//取餐码
this.currentTableId = currentTableId//当前桌台id
this.originTableList = originTableList.filter((i) => i.tableId != currentTableId && i.status == 'using')//台桌列表
// console.log(item, masterId, currentTableId, originTableList);
this.itemdata = item;
this.masterId = masterId; //取餐码
this.currentTableId = currentTableId; //当前桌台id
this.originTableList = originTableList.filter(
(i) => i.tableId != currentTableId && i.status == "using"
); //台桌列表
try {
this.$refs.refcart.clearSelection();
this.$refs.reftransfertoPinpin.forEach((a) => {
a.clearSelection();
})
});
} catch (error) { }
this.multipleSelection = []
this.refcartSelection = []
this.targetTableId = ''
this.show = true;
},
returnTableColor(key) {
const item = $status[key];
return item ? item.type : "";
},
changeTable(item, index) {
console.log(item, index)
},
searchInput(e) {
console.log(e);
// this.tableList = $originTableList.filter((v) =>
// $strMatch(v.name, e.trim())
// );
},
},
};
</script>
@@ -179,7 +188,6 @@ export default {
margin: 20px 10px;
.boxspan {}
}
.buttonbox {

View File

@@ -369,7 +369,8 @@
<div class="btn" :class="{ disabled: !isSku }" @click="orderBtnsClick('sku')">
规格
</div>
<div class="btn" :class="{ disabled: order.selIndex < 0 }" @click="orderBtnsClick('gift')">
<div class="btn" :class="{ disabled: order.selIndex < 0 }" @click="orderBtnsClick('gift')"
v-if="returnGiftTextshow">
{{ returnGiftText }}
</div>
<div class="btn" :class="{ disabled: order.selIndex < 0 }" @click="orderBtnsClick('pack')">
@@ -422,7 +423,6 @@
</div>
<div @click="orderBtnsClick('print')" :class="{ disabled: order.selIndex < 0 }" class="btn">
{{ returnPrintText }}
</div>
<div @click="refPopChangePriceShow" :class="{ disabled: order.selIndex < 0 }" class="btn">
单品改价
@@ -435,7 +435,7 @@
{{ returnWaingAllText }}
</div>
<div class="btn no-wrap u-font-12" @click="clicktransfertoPinpin()"
v-if="table.name && useTypes.sel == 'dine-in' && payAfter">
v-if="table.name && useTypes.sel == 'dine-in' && payAfter && cktableList">
转桌/并桌
</div>
<!-- -->
@@ -1015,8 +1015,7 @@
<pop-tuan-quan :cartGoods="createOrder.data.detailList || []" ref="refPopTuanQuan"
@confirm="tuanQuanConfirm"></pop-tuan-quan>
<!-- 美团/抖音团购券核销 -->
<pop-quan-hexiao ref="refQuanHexiao">
</pop-quan-hexiao>
<pop-quan-hexiao ref="refQuanHexiao"> </pop-quan-hexiao>
<!-- 挂账 -->
<popup-choose-guazhang ref="refGuaZhang" :payMoney="yinFuJinE"
@confirm="guazhangPayConfirm"></popup-choose-guazhang>
@@ -1054,8 +1053,6 @@ import popupWeightGoods from "./components/popup-weight-goods.vue";
import dialogpackage from "./components/dialogpackage.vue";
import transfertoPinpin from "./components/transfertoPinpin.vue";
import dayjs from "dayjs";
import { tbShopInfo } from "@/api/user";
import { hasPermission } from "@/utils/limits.js";
@@ -1108,11 +1105,13 @@ import { returnProductCoupAllPrice } from "./quan_util.js";
let $goodsPayPriceMap = {};
import { $status } from "@/utils/table.js";
import PopupChooseGuazhang from "./components/popup-choose-guazhang.vue";
import { forEach } from "jszip";
let $originTableList = [];
export default {
components: {
popupWeightGoods, popQuanHexiao,
popupWeightGoods,
popQuanHexiao,
popupChooseGuazhang,
cartChangePrice,
popTuanQuan,
@@ -1131,7 +1130,7 @@ export default {
chooseDinersNumber,
PopupChooseGuazhang,
dialogpackage,
transfertoPinpin
transfertoPinpin,
},
data() {
return {
@@ -1354,14 +1353,27 @@ export default {
};
},
computed: {
cktableList() {
// 使用 reduce 方法统计指定值出现的次数
// const count = this.tableList.reduce((acc, cur) => {
// if (cur.status == "using") {
// return acc + 1;
// }
// return acc;
// }, 0);
if (this.tableList) {
let res = this.tableList.filter((i) => i.status == 'using')
return res.length >= 2 ? true : false
} else {
return false
}
},
returnPrintText() {
if (this.order.selIndex < 0) {
return "免厨打";
}
const cart = this.order.list[this.order.selIndex]
return (cart.isPrint || cart.isPrint === null)
? "免厨打"
: "打印";
const cart = this.order.list[this.order.selIndex];
return cart.isPrint || cart.isPrint === null ? "免厨打" : "打印";
},
returnWaingText() {
if (this.order.selIndex < 0) {
@@ -1387,11 +1399,14 @@ export default {
},
gaijia() {
if (!this.createOrder.data.amount) {
return 0
return 0;
}
const disCountOriginPrice =
this.createOrder.data.amount - this.productCouponDiscountAmount;
const discountPrice = ((1 - this.createOrder.discount) * disCountOriginPrice).toFixed(2)
const discountPrice = (
(1 - this.createOrder.discount) *
disCountOriginPrice
).toFixed(2);
return discountPrice;
},
pointsCanDicountMoney() {
@@ -1410,13 +1425,17 @@ export default {
return n;
},
productCouponDiscountAmount() {
const n = this.quansSelArr.filter(v => v.type == 2).reduce((prve, cur) => {
const n = this.quansSelArr
.filter((v) => v.type == 2)
.reduce((prve, cur) => {
return prve + cur.discountAmount * 1;
}, 0);
return n;
},
fullCouponDiscountAmount() {
const n = this.quansSelArr.filter(v => v.type == 1).reduce((prve, cur) => {
const n = this.quansSelArr
.filter((v) => v.type == 1)
.reduce((prve, cur) => {
return prve + cur.discountAmount * 1;
}, 0);
return n;
@@ -1426,13 +1445,16 @@ export default {
const discount = this.createOrder.discount || 1;
// const total=((amount - this.coupdiscount) * this.createOrder.discount - this.points.toMoney)
// const total = amount - this.gaijia - this.coupdiscount;
const total = amount - this.productCouponDiscountAmount - this.gaijia - this.fullCouponDiscountAmount;
const total =
amount -
this.productCouponDiscountAmount -
this.gaijia -
this.fullCouponDiscountAmount;
return total <= 0 ? 0 : total;
},
yinFuJinE() {
const total =
this.currentPayMoney - (this.points.selected ? this.points.toMoney : 0);
console.log(total);
if (this.isCreateOrder) {
return total.toFixed(2);
} else {
@@ -1445,9 +1467,9 @@ export default {
this.order.selIndex >= 0 ||
!this.order.selGoods ||
this.order.old.list.length <= 0 ||
this.order.selGoods.status == "return"
|| this.order.selGoods.useType == 'dine-in'
|| this.order.selGoods.useType == 'dine-in-before'
this.order.selGoods.status == "return" ||
this.order.selGoods.useType == "dine-in" ||
this.order.selGoods.useType == "dine-in-before"
);
},
title() {
@@ -1521,6 +1543,16 @@ export default {
? "取消赠送"
: "赠送";
},
returnGiftTextshow() {
try {
// 选中的购物车里面是否已有
if (this.order.list.filter((i, v) => i.productId == this.order.list[this.order.selIndex].productId).length >= 2) {
return false;
} else {
return true;
}
} catch (error) { }
},
returnPackText() {
if (this.order.selIndex < 0) {
return "打包";
@@ -1634,8 +1666,8 @@ export default {
const cartNumber = this.order.list.reduce((a, b) => {
return a + b.number * 1;
}, 0);
const total = oldNumber + cartNumber
return (Math.floor(total) == total ? total : total.toFixed(2));
const total = oldNumber + cartNumber;
return Math.floor(total) == total ? total : total.toFixed(2);
},
selGoodsHide() {
this.selGoods.show = false;
@@ -1703,7 +1735,6 @@ export default {
}
},
"useTypes.sel": function (newval, oldval) {
console.log(newval);
this.setPostPay();
this.setUseType();
},
@@ -1737,7 +1768,6 @@ export default {
// }
// },
masterId: function (val) {
console.log(val);
},
isCreateOrder: function (val) {
if (!val) {
@@ -1754,8 +1784,6 @@ export default {
// masterId = res.masterId;
// }
// this.masterId = masterId;
console.log("this.createOrder.data");
console.log(this.createOrder.data);
if (this.order.status == "finish") {
return;
}
@@ -1790,20 +1818,17 @@ export default {
} else {
this.prveOrder.selCart = [];
}
console.log(this.prveOrder.selCart);
},
"prveOrder.sel": function (val) {
this.prveOrder.selCart =
this.prveOrder.list.length !== 0
? this.prveOrder.list[val].carList
: [];
console.log(this.prveOrder.selCart);
if (val < 0) {
this.prveOrde.show = false;
}
},
"order.allPack": function (val) {
console.log(val);
if (this.order.list.length <= 0) {
return;
}
@@ -1827,7 +1852,6 @@ export default {
const selItem = item.info[this.order.old.selIndex];
goods = selItem ? selItem : "";
}
console.log(goods);
if (val === -1) {
this.order.cacheNumber = 1;
} else {
@@ -1848,14 +1872,12 @@ export default {
return;
}
this.createOrderClose();
let item = this.order.list[this.order.selIndex];
console.log(item.specSnap);
const { productId, skuId, isPack, isGift, number } = item;
const oldGoods = this.order.old.list.find((v) => {
return v.productId === productId && v.skuId === skuId;
});
const newNum = this.order.number + (oldGoods ? oldGoods.number : 0)
const newNum = this.order.number + (oldGoods ? oldGoods.number : 0);
$updateCart({
cartId: item.id,
productId,
@@ -1897,7 +1919,7 @@ export default {
methods: {
//美团抖音团购券核销弹窗
refQuanHexiaoOpen() {
this.$refs.refQuanHexiao.open()
this.$refs.refQuanHexiao.open();
},
//称重商品弹窗
refWeightGoodsShow(item) {
@@ -1905,13 +1927,18 @@ export default {
},
//称重商品确认
async refWeightGoodsConfirm(item, number) {
console.log(item)
console.log(number)
this.goodsClick(item, number, true)
this.goodsClick(item, number, true);
},
//套餐下单
async dialogpackageconfirm(item, multipleSelection) {
this.goodsClick(item, 1, true, multipleSelection.flatMap(subArray => subArray.map(item => item.proId)))
this.goodsClick(
item,
1,
true,
multipleSelection.flatMap((subArray) =>
subArray.map((item) => item.proId)
)
);
},
//挂账人支付确认
guazhangPayConfirm(guazhangren, price) {
@@ -1930,14 +1957,13 @@ export default {
this.$refs.refPopTuanQuan.open();
},
tuanQuanConfirm(e) {
console.log(e);
this.tuanQuan = e;
},
//更新单品改价数据
updateCartItem(res) {
if (res) {
// this.order.list[this.order.selIndex] = res;
this.$set(this.order.list, this.order.selIndex, res)
this.$set(this.order.list, this.order.selIndex, res);
}
},
// 单品改价
@@ -1946,7 +1972,6 @@ export default {
this.$refs.refPopChangePrice.open(orderGoods);
},
returnProDiscount(row) {
console.log(row);
//相同商品抵扣券数组
const arr = this.quansSelArr.filter((v) => v.proId == row.proId);
const index = arr.findIndex((v) => v.id == row.id);
@@ -1975,7 +2000,6 @@ export default {
},
delQuan(row) {
const index = this.quansSelArr.findIndex((v) => v.id == row.id);
console.log(index);
if (index != -1) {
this.quansSelArr.splice(index, 1);
this.quansSelArr.map((v, index) => {
@@ -2012,7 +2036,6 @@ export default {
},
//根据积分输入值变化计算抵扣金额
pointsValueChange(e) {
console.log(e);
if (e == 0 || !e) {
return (this.points.toMoney = 0);
}
@@ -2026,7 +2049,6 @@ export default {
},
//积分抵扣类型改变
pointsChange(e) {
console.log(e);
if (e == 1) {
this.points.value = Math.min(
this.vipUser.accountPoints,
@@ -2047,7 +2069,6 @@ export default {
);
},
quansConfirm(e, goodsPayPriceMap) {
console.log(e);
// this.createOrder.discount = 1;
this.points.selected = "";
e.map((v, index) => {
@@ -2061,7 +2082,6 @@ export default {
$goodsPayPriceMap = goodsPayPriceMap;
},
searchInput(e) {
console.log(e);
this.tableList = $originTableList.filter((v) =>
$strMatch(v.name, e.trim())
);
@@ -2086,7 +2106,6 @@ export default {
return this.canXiadan;
},
changeOrderExtraSel(index, canChangeNumber, placeNum) {
// console.log(index,canChangeNumber,placeNum)
this.order.selIndex = -1;
this.order.selGoods = this.order.seatFee;
this.order.selPlaceNum = placeNum;
@@ -2151,7 +2170,6 @@ export default {
// ...this.order.old.list,
// { info: this.order.list, placeNum: nowPlaceNum + 1 },
// ];
console.log(this.order.old.list);
return res;
},
async payBeforeClear() {
@@ -2240,8 +2258,6 @@ export default {
//munchies 先付 restaurant 后付
this.payAfter = this.shopInfo.registerType == "munchies" ? false : true;
}
console.log("this.payAfter");
console.log(this.payAfter);
},
//获取店铺信息
async getShopInfo() {
@@ -2258,7 +2274,6 @@ export default {
if (this.order.old.list.length > 0) {
return this.$message("下单后不支持更改就餐方式");
}
console.log(type);
this.useTypes.sel = type;
},
//更改就餐人数
@@ -2279,12 +2294,10 @@ export default {
async onTableChange() {
this.order.list = [];
this.order.old.list = [];
console.log("onTableChange");
const perpole = this.perpole || "";
const tableRes = await $returnTableDetail({
tableId: this.table.tableId,
});
console.log(tableRes);
const orderId = tableRes.orderId || this.table.orderId;
if (orderId) {
return this.getOrderData({ orderId: orderId });
@@ -2351,7 +2364,6 @@ export default {
this.order.old.selIndex = -1;
// this.getCart();
this.getOrderData();
// console.log(this.order.selGoods);
},
// 台桌列表
@@ -2369,7 +2381,6 @@ export default {
);
$originTableList = this.tableList;
} catch (error) {
console.log(error);
}
},
async getTableDetail(tableId) {
@@ -2380,8 +2391,6 @@ export default {
return res;
},
async changeTable(item) {
console.log("changeTable");
console.log(this.table, this.table.tableId);
if (
(this.table && this.table.tableId) ||
(!this.table && !this.tableId && this.order.list.length <= 0)
@@ -2398,7 +2407,6 @@ export default {
if (this.table && this.order.list.length <= 0) {
this.table = item;
this.tableShow = false;
console.log(this.table);
this.onTableChange();
return;
}
@@ -2421,7 +2429,6 @@ export default {
}
);
} catch (e) {
console.log(e);
}
}
this.tableShow = false;
@@ -2495,10 +2502,9 @@ export default {
if (!canDiscount) {
return;
}
const amount = (this.createOrder.data.amount - this.productCouponDiscountAmount).toFixed(
2
);
console.log(amount);
const amount = (
this.createOrder.data.amount - this.productCouponDiscountAmount
).toFixed(2);
this.refToggle("refDiscount", true, {
amount,
discount: this.createOrder.discount * 100,
@@ -2513,7 +2519,6 @@ export default {
//购物车商品输入框数量输入
cartGoodsNumberInput(newval, index) {
const item = this.order.list[index];
console.log(item);
this.order.cacheNumber = newval;
item.number = newval;
},
@@ -2521,7 +2526,6 @@ export default {
cartGoodsNumberChange(newval, index) {
const item = this.order.list[index];
newval = `${newval}`.split(".")[0] * 1;
console.log(newval);
this.order.cacheNumber = newval;
this.order.number = newval;
},
@@ -2578,7 +2582,6 @@ export default {
},
//改变是否打印
changeIsPrint(e) {
console.log(e);
this.isPrint = e;
},
async refOrderNoteConfirm(note) {
@@ -2629,10 +2632,6 @@ export default {
if (this.order.payType == "deposit") {
return this.refToggle("refScanCode", true);
}
console.log({
orderId: this.createOrder.data.id,
payType: this.order.payType,
});
if (this.order.payType == "cash") {
return this.$confirm(
"是否确认已现金收款:" + this.yinFuJinE + "?",
@@ -2701,14 +2700,12 @@ export default {
// this.reset();
},
chooseTableConfirm(item) {
console.log(item);
this.table = item;
},
chooseTableOpen() {
this.$refs.refChooseTable.open();
},
chooseUserConfirm(user) {
console.log(user);
if (user) {
this.vipUser = user;
} else {
@@ -2719,7 +2716,6 @@ export default {
this.$refs.refChooseUser.open();
},
createOrderClose() {
console.log("createOrderClose");
this.isCreateOrder = false;
},
//生成订单
@@ -2737,8 +2733,6 @@ export default {
return;
}
}
console.log(this.createOrder.status);
if (
this.createOrder.status != "" &&
this.createOrder.status != "success"
@@ -2810,7 +2804,6 @@ export default {
//更新购物车商品数据
updateOrder(par = {}) {
let item = this.order.list[this.order.selIndex];
console.log(this.table);
const {
productId,
skuId,
@@ -2842,8 +2835,8 @@ export default {
});
},
keyboradAdd(n) {
if (this.selGoods.isSku != 'weight' && n == '.') {
return
if (this.selGoods.isSku != "weight" && n == ".") {
return;
}
if (Number(this.keyborad.number) === 0) {
return (this.keyborad.number = n);
@@ -2873,12 +2866,12 @@ export default {
},
changeKeyboradShow(show) {
if (show) {
this.selGoods = this.order.list[this.order.selIndex]
this.selGoods = this.order.list[this.order.selIndex];
this.keyborad.number = `${this.order.list[this.order.selIndex].number}`;
}
this.keyborad.show = show;
if (!show) {
this.selGoods = ''
this.selGoods = "";
}
},
// 获取本地缓存挂单
@@ -2891,25 +2884,13 @@ export default {
// });
// },
clicktransfertoPinpin() {
// 使用 reduce 方法统计指定值出现的次数
const count = this.tableList.reduce((acc, cur) => {
if (cur.status == 'using') {
return acc + 1;
}
return acc;
}, 0);
console.log(count)
if (count >= 2) {
// console.log(this.order, this.masterId, this.table.tableId, this.tableList)
// 订单信息,取餐码,用餐类型,桌台号id台桌列表
this.$refs.refransfertoPinpin.open(this.order, this.masterId, this.table.tableId, this.tableList);
} else {
this.$message({
message: '暂无可转台桌!',
type: 'warning'
})
return false;
}
this.$refs.refransfertoPinpin.open(
this.order,
this.masterId,
this.table.tableId,
this.tableList
);
},
//右侧控制按钮点击事件
async orderBtnsClick(key) {
@@ -2921,7 +2902,6 @@ export default {
this.selGoods.title = orderGoods.name;
this.selGoods.isEdit = true;
const item = this.goods.list.find((v) => v.id == orderGoods.productId);
console.log(item);
return this.showSelGoods({ ...item, ...orderGoods });
}
if (key === "gift") {
@@ -2938,7 +2918,8 @@ export default {
return this.removeCart();
}
if (key === "print") {
const isPrint = (orderGoods.isPrint || orderGoods.isPrint === null) ? true : false;
const isPrint =
orderGoods.isPrint || orderGoods.isPrint === null ? true : false;
this.updateOrder({ isPrint: !isPrint });
return;
}
@@ -2952,10 +2933,10 @@ export default {
orderId: this.createOrder.data.id,
masterId: this.masterId,
tableId: this.table.tableId,
isWaitCall: !this.isAllWaitCall ? 1 : 0
})
isWaitCall: !this.isAllWaitCall ? 1 : 0,
});
this.isAllWaitCall = !this.isAllWaitCall;
this.getCart()
this.getCart();
return;
}
if (key === "save") {
@@ -2986,7 +2967,6 @@ export default {
return;
}
if (key === "returnCart") {
console.log(this.order);
let selGoods = undefined;
if (this.order.selPlaceNum == -10) {
selGoods = { ...this.order.seatFee, num: this.order.seatFee.number };
@@ -2996,7 +2976,6 @@ export default {
this.order.old.selIndex
];
}
console.log(selGoods);
this.refToggle("refReturnCart", true, selGoods);
}
},
@@ -3019,11 +2998,8 @@ export default {
isPending: false,
});
this.order.orderId = id;
console.log(this.order.orderId);
this.masterId = masterId;
this.isPrverOrder = true;
console.log(masterId);
const res = await getCart({
masterId,
tableId,
@@ -3060,7 +3036,6 @@ export default {
type: "warning",
}
).catch((err) => {
console.log(err);
});
if (!res) {
return;
@@ -3089,7 +3064,6 @@ export default {
this.prveOrder.list = res;
if (this.prveOrder.list.length && this.prveOrder.sel !== -1) {
const item = this.prveOrder.list[this.prveOrder.sel];
console.log(item);
if (item) {
this.prveOrder.selCart = item.carList;
}
@@ -3142,12 +3116,11 @@ export default {
},
// 点击订单里的加减改变购物车商品数量
async changeOrderNumber(index, isReduce) {
console.log(index, isReduce, '点击订单里的加减改变购物车商品数量')
if (index < 0) {
return;
}
this.changeOrderSel(index);
console.log(index);
console.log(isReduce);
const item = this.order.list[index];
const mumber = item.number * 1;
const newval = mumber + (isReduce ? -1 : 1);
@@ -3174,7 +3147,6 @@ export default {
return;
}
const item = this.order.list[this.order.selIndex];
console.log(item);
const mumber = item.number * 1;
const newval = mumber + (isReduce ? -1 : 1);
if (newval <= 0) {
@@ -3183,7 +3155,6 @@ export default {
if (newval >= 100000) {
return;
}
console.log(newval);
// this.order.list[this.order.selIndex].number = newval;
this.order.number = newval;
@@ -3276,7 +3247,6 @@ export default {
clearTimeout(this.timer);
this.timer = null;
}, 500);
console.log(this.timer);
},
async skuGoodsAdd() {
let name = this.selGoods.skuList.reduce((prve, cur) => {
@@ -3285,9 +3255,6 @@ export default {
name = name.substring(0, name.length - 1);
// const item = this.selGoods.data.specList.find((v) => v.specSnap === name);
const item = this.selGoods.skuMap[name];
console.log(this.selGoods, '调试1')
console.log(name, '调试2')
console.log(item, '调试1')
if (!item.isGrounding) {
//该商品已经下架
return this.$notify({
@@ -3296,8 +3263,6 @@ export default {
});
}
let res = "";
console.log(orderGoods);
//更改购物车订单商品规格数量
if (this.selGoods.isEdit) {
res = await $updateCart({
@@ -3319,13 +3284,11 @@ export default {
this.order.cacheNumber = this.skuGoods.number;
return;
}
const orderGoodsIndex = this.order.list.findIndex((V) => {
return V.skuId == item.id && V.productId == this.selGoods.data.id;
return V.skuId == item.id && V.productId == this.selGoods.data.id && V.isGift == 'false';
});
const orderGoods =
orderGoodsIndex != -1 ? this.order.list[orderGoodsIndex] : undefined;
if (orderGoods) {
//更新
const newNum =
@@ -3352,7 +3315,6 @@ export default {
}
} else {
//添加
console.log(this.table);
res = await addCart({
masterId: this.masterId,
vipUserId: this.vipUser.id,
@@ -3361,7 +3323,7 @@ export default {
tableId: this.table.tableId,
num: this.skuGoods.number, // 0会删除此商品
isPack: false, // 是否打包
isWaitCall: this.isAllWaitCall //是否等叫
isWaitCall: this.isAllWaitCall, //是否等叫
});
this.orderListPush({ ...res, specSnap: name });
// this.orderListPush({
@@ -3394,9 +3356,7 @@ export default {
}
return prve;
}, []);
console.log(selArr);
let selArrAllGroup = generateCombinations(selArr, selArr.length - 1);
console.log(selArrAllGroup);
const matchArr = [];
for (let key in this.selGoods.skuMap) {
const goods = this.selGoods.skuMap[key];
@@ -3408,9 +3368,7 @@ export default {
}
}
}
console.log(matchArr);
const skuList = this.selGoods.skuList;
console.log(skuList);
//全部规格都已下架
if (!matchArr.length) {
for (let k in skuList) {
@@ -3434,7 +3392,6 @@ export default {
}
return prve;
}, {});
console.log(includeSkuMap);
for (let i in includeSkuMap) {
for (let k in skuList) {
const index = skuList[k].valueArr.findIndex((val) => val === i);
@@ -3451,7 +3408,6 @@ export default {
}, "");
specSnap = specSnap.substring(0, specSnap.length - 1);
for (let sku of this.selGoods.skuList) {
console.log(sku);
}
this.setTagDisabled();
const canChooseGoods = this.selGoods.skuList.every((v) => v.sel);
@@ -3500,11 +3456,10 @@ export default {
this.order.orderId = "";
this.perpole = "";
this.useTypes.sel = "dine-in";
this.getTable()
this.getTable();
},
//设置购物车数据
setCart(res) {
console.log(res);
try {
const { seatFee } = res;
this.order.seatFee = seatFee
@@ -3516,7 +3471,6 @@ export default {
totalAmount: seatFee.priceAmount || seatFee.totalAmount,
}
: this.order.seatFee;
console.log(this.order.seatFee);
this.perpole = res.seatFee ? res.seatFee.totalNumber : 1;
const nowCart = res.records.find((v) => v.placeNum == 0);
// this.order.list = nowCart ? nowCart.info.filter(v=>v.isGift!=='true') : [];
@@ -3524,14 +3478,14 @@ export default {
const oldCart = res.records.filter((v) => v.placeNum != 0);
this.order.old.list = oldCart ? oldCart : [];
// this.order.gift.list = returnGiftArr(res.records);
console.log(this.order.old.list);
} catch (error) {
//当购物车数据发生错误时会导致页面报错购物车商品不展示
this.$confirm('购物车数据结构错误,是否清空购物车商品?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$confirm("购物车数据结构错误,是否清空购物车商品?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
$clearCart({
masterId: this.masterId,
tableId: this.table.tableId,
@@ -3543,18 +3497,17 @@ export default {
message: "清除成功!",
});
});
}).catch(() => {
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消'
type: "info",
message: "已取消",
});
});
}
},
//获取购物车数据
async getCart() {
console.log(this.table);
const res = await getCart({
...this.order.query,
masterId: this.masterId,
@@ -3568,7 +3521,6 @@ export default {
// }
},
showSelGoods(item) {
console.log(item);
this.selGoods.data = item;
this.selGoods.skuMap = {};
const specList = item.specList;
@@ -3611,7 +3563,6 @@ export default {
const skuList = this.selGoods.skuList;
const goodsListMap = this.selGoods.skuMap;
const skuGoods = this.findGoods(skuList, goodsListMap);
console.log(skuGoods);
if (skuGoods) {
this.skuGoods.data = skuGoods;
this.skuGoods.number = skuGoods.suit || 1;
@@ -3642,25 +3593,23 @@ export default {
}
},
//根据右侧商品单规格多规格做不同处理
async goodsClick(item, number = 0, isConfirm = false, multipleSelection = '') {
async goodsClick(item, number = 0, isConfirm = false, multipleSelection = "") {
// if (!this.table) {
// return this.$message.error("暂不支持无桌台下单,请先选择桌台");
// }
if (item.type == 'weigh' && !isConfirm) {
return this.refWeightGoodsShow(item)
if (item.type == "weigh" && !isConfirm) {
return this.refWeightGoodsShow(item);
}
// 这是套餐
if (item.type == 'package' && !isConfirm) {
if (item.type == "package" && !isConfirm) {
this.$refs.refdialogpackage.open(item);
return false
return false;
}
if (item.typeEnum === "sku") {
this.selGoods.data = item;
this.selGoods.skuMap = {};
const specList = item.specList;
this.setSelGoodsSkuMap(specList);
console.log(this.selGoods.skuMap);
this.setSelGoodsSkuList(JSON.parse(item.skuResult.tagSnap));
this.setSkugoodsDefaultInit();
this.selGoods.title = item.name;
@@ -3668,14 +3617,10 @@ export default {
return;
}
//单规格
const orderGoodsIndex = this.order.list.findIndex((V) => {
return V.skuId == item.specList[0].id && V.productId == item.id;
let orderGoodsIndex = this.order.list.findIndex((V) => { //默认选择添加不是赠送 V.isGift == 'false'
return V.skuId == item.specList[0].id && V.productId == item.id && V.isGift == 'false';
});
const orderGoods =
orderGoodsIndex != -1 ? this.order.list[orderGoodsIndex] : undefined;
// const orderGoods = this.order.list.find((V) => {
// return V.skuId == item.specList[0].id && V.productId == item.id;
// });
const orderGoods = orderGoodsIndex != -1 ? this.order.list[orderGoodsIndex] : undefined;
let res = "";
if (orderGoods) {
//更新
@@ -3686,13 +3631,12 @@ export default {
// tableId: this.table.tableId,
// num: orderGoods.number * 1 + item.specList[0].suit, // 0会删除此商品
// });
const suit = number || item.specList[0].suit
const suit = number || item.specList[0].suit;
orderGoods.number += suit * 1;
this.order.number = orderGoods.number;
this.changeOrderSel(orderGoodsIndex);
} else {
//增加
console.log(item);
if (item.specList.length <= 0) {
return this.$message.error("该商品缺少skuID,skuList是空数组");
}
@@ -3705,7 +3649,7 @@ export default {
num: number || item.specList[0].suit, // 0会删除此商品
isPack: false, // 是否打包
isWaitCall: this.isAllWaitCall, //是否等叫
groupProductIdList: multipleSelection
groupProductIdList: multipleSelection,
});
this.orderListPush(res);
}
@@ -3777,7 +3721,6 @@ export default {
this.getGoods();
this.getCategory();
this.getTable();
console.log(params);
if (key == "isJieZhang") {
if (params.orderId) {
@@ -3875,7 +3818,6 @@ export default {
}),
placeNum: key,
}));
console.log(this.order.old.list);
return res;
},
close() {
@@ -3898,7 +3840,6 @@ export default {
this.informationdialogshow = false;
},
haocaiConfirm() {
console.log(haocaiSelectedMap);
this.$emit("confirm", haocaiSelectedMap);
this.informationdialogshow = false;
@@ -5208,7 +5149,9 @@ input[type="number"]::-webkit-outer-spin-button {
.weight {
height: 15px;
background: linear-gradient(124deg, rgb(115, 201, 105) 6%, rgb(39, 146, 27) 93%);
background: linear-gradient(124deg,
rgb(115, 201, 105) 6%,
rgb(39, 146, 27) 93%);
border-radius: 2px;
font-size: 12px;
text-align: center;