10 Commits
dwb ... test

11 changed files with 604 additions and 378 deletions

View File

@@ -1,10 +1,10 @@
// 桌台管理 // 桌台管理
import request from "@/utils/request"; import request from '@/utils/request'
//就餐形式,默认堂食后付费 // 就餐形式,默认堂食后付费
const useType='dine-in-after' const useType = 'dine-in-after'
function getUseType(){ function getUseType() {
const type=localStorage.getItem("useType") const type = localStorage.getItem('useType')
return type?type:useType return type || useType
} }
/** /**
* 台桌列表 * 台桌列表
@@ -13,12 +13,51 @@ function getUseType(){
export function tbShopTableGet(params) { export function tbShopTableGet(params) {
return request({ return request({
url: `/api/tbShopTable`, url: `/api/tbShopTable`,
method: "get", method: 'get',
params:{ params: {
shopId: localStorage.getItem("shopId"), shopId: localStorage.getItem('shopId'),
...params ...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) { export function tbShopAreaGet(params) {
return request({ return request({
url: `/api/tbShopArea`, url: `/api/tbShopArea`,
method: "get", method: 'get',
params params
}); });
} }

View File

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

View File

@@ -2,8 +2,7 @@
<el-dialog <el-dialog
title="预约" title="预约"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="400px" width="500px"
@open="tbShopAreaGet"
@close="reset" @close="reset"
> >
<el-form <el-form
@@ -14,17 +13,67 @@
label-position="left" label-position="left"
> >
<el-form-item label="就餐人数" prop="number"> <el-form-item label="预约日期" prop="bookingDate">
<el-input-number v-model="form.number" :min="1" controls-position="right" /> <!-- <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>
<el-form-item label="联系电话" prop="phone"> <el-form-item label="预约类型" prop="bookingType">
<el-input v-model="form.phone" oninput="value= value.replace(/[^0-9]/g, '')" maxlength="11" placeholder="请输入联系电话" /> <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>
<el-form-item label="联系人" prop="name"> <el-form-item label="就餐时间" prop="bookingTime">
<el-input v-model="form.name" placeholder="请输入联系人姓名" /> <el-time-picker
v-model="form.bookingTime"
value-format="HH:mm:ss"
placeholder="选择时间"
style="width: 100%;"
/>
</el-form-item> </el-form-item>
<el-form-item label="就餐时间" prop="time"> <el-form-item label="预约桌台" prop="shopTableId">
<el-time-picker v-model="form.time" value-format="HH:mm:ss" placeholder="选择时间" style="width: 100%;" /> <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-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@@ -39,46 +88,73 @@
</template> </template>
<script> <script>
import { $fastCreateTable } from '@/api/table' import { getShopTableList, makeShopTable } from '@/api/table'
import dayjs from 'dayjs'
export default { export default {
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
resetForm: '', resetForm: '',
loading: false, 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: { form: {
id: '', bookingDate: '',
number: 1, bookingType: 'lunch',
name: '', shopTableId: null,
phone: '', dinerNum: 1,
time: '' bookingPerson: '',
phoneNumber: '',
gender: '1',
bookingTime: '',
diningType: '普通用餐',
focus: '0',
receiveMarketingSms: '0'
}, },
rules: { rules: {
number: [ shopTableId: [
{ {
required: true, required: true,
message: '请选择就餐人数', message: '请选择预约桌台',
trigger: ['blur'] trigger: ['blur']
} }
], ],
phone: [ dinerNum: [
{
required: true,
message: '请选择用餐人数',
trigger: ['blur']
}
],
phoneNumber: [
{ {
required: true, required: true,
message: '请输入联系方式', message: '请输入联系方式',
trigger: ['blur'] trigger: ['blur']
} }
], ],
name: [ bookingPerson: [
{ {
required: true, required: true,
message: '请输入联系人姓名', message: '请输入订餐人姓名',
trigger: ['blur'] trigger: ['blur']
} }
], ],
time: [ bookingTime: [
{ {
required: true, required: true,
message: '请选择时间', message: '请选择用餐时间',
trigger: ['change'] trigger: ['change']
} }
] ]
@@ -89,19 +165,59 @@ export default {
this.resetForm = { ...this.form } this.resetForm = { ...this.form }
}, },
methods: { 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() { onSubmitHandle() {
this.$refs.form.validate(async(valid) => { this.$refs.form.validate(async(valid) => {
if (valid) { if (valid) {
this.loading = true this.loading = true
try { try {
const res = await $fastCreateTable( const bookingTime = this.form.bookingDate + ' ' + this.form.bookingTime
{ const params = {
...this.form, ...this.form,
qrcode: this.form.tableId, shopId: localStorage.getItem('shopId')
shopId: localStorage.getItem('shopId') }
}, params.bookingTime = bookingTime
this.form.id ? 'put' : 'post' const res = await makeShopTable(params)
)
this.$emit('success', res) this.$emit('success', res)
this.close() this.close()
this.$notify({ this.$notify({
@@ -122,6 +238,8 @@ export default {
if (obj && obj.id) { if (obj && obj.id) {
this.form = JSON.parse(JSON.stringify(obj)) this.form = JSON.parse(JSON.stringify(obj))
} }
this.getShopTableList()
this.getWeekdays()
}, },
close() { close() {
this.dialogVisible = false this.dialogVisible = false
@@ -133,3 +251,19 @@ export default {
} }
} }
</script> </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 { export default {
pending: { pending: { label: '挂单中', type: '#E6A23C' },
label: "挂单中", cleaning: { label: '待清台', type: '#FAAD14' },
type: "#E6A23C", using: { label: '开台中', type: '#FF4D4F' },
}, idle: { label: '空闲', type: '#3F9EFF' },
using: { paying: { label: '结算中', type: '#E6A23C' },
label: "开台中", closed: { label: '关台', type: '#DDDDDD' },
type: "#fa5555", subscribe: { label: '预约', type: '#52C41A ' },
}, unbind: { label: '未绑定', type: 'rgb(221,221,221)' }
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)",
}
}

View File

@@ -22,6 +22,27 @@
</el-tabs> </el-tabs>
<div class="head-container"> <div class="head-container">
<div class="filter_wrap"> <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 <el-button
icon="el-icon-plus" icon="el-icon-plus"
@click="$refs.addEara.show()" @click="$refs.addEara.show()"
@@ -43,6 +64,11 @@
icon="el-icon-download" icon="el-icon-download"
@click="downloadShopCode" @click="downloadShopCode"
>下载店铺码</el-button> >下载店铺码</el-button>
<el-button
type="primary"
icon="el-icon-plus"
@click="$refs.subscribe.show()"
>预约</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">
@@ -89,33 +115,51 @@
<div class="box"> <div class="box">
<div class="top"> <div class="top">
<!-- <div class="row row1"> <!-- <div class="row row1">
<span>{{ item.name }}</span> <span>{{ item.name }}</span>
<div class="state"> <div class="state">
<span <span
class="dot" class="dot"
:style="{ :style="{
backgroundColor: status[item.status] backgroundColor: status[item.status]
? status[item.status].type ? status[item.status].type
: '', : '',
}" }"
></span> />
{{ status[item.status] ? status[item.status].label : "" }} {{ status[item.status] ? status[item.status].label : "" }}
</div>
</div> -->
<!-- <div class="row">
<el-tag type="warning" size="mini">{{
item.type == 0 ? "低消" : "计时"
}}</el-tag>
<el-tag :type="item.isPredate == 1 ? '' : 'info'" size="mini">{{
item.isPredate == 1 ? "可预约" : "不可预约"
}}</el-tag>
</div> -->
<!-- <div class="row">
<span class="tips">客座次数{{ item.maxCapacity }}</span>
</div> -->
<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>
</div> -->
<!-- <div class="row"> <div v-else class="u-font-18 font-600 total-price">
<el-tag type="warning" size="mini">{{
item.type == 0 ? "低消" : "计时"
}}</el-tag>
<el-tag :type="item.isPredate == 1 ? '' : 'info'" size="mini">{{
item.isPredate == 1 ? "可预约" : "不可预约"
}}</el-tag>
</div> -->
<!-- <div class="row">
<span class="tips">客座次数{{ item.maxCapacity }}</span>
</div> -->
<div class="u-font-18 font-600 total-price">
<span <span
v-if="item.status == 'using'" v-if="item.status == 'using'"
class="cur-pointer" class="cur-pointer"
@@ -123,30 +167,31 @@
> >
¥{{ item.totalAmount || 0 }}{{ item.productNum }} ¥{{ item.totalAmount || 0 }}{{ item.productNum }}
</span> </span>
<span v-else class="color-fff">|</span> <!-- <span v-else class="color-fff">|</span> -->
</div> </div>
<div class="row btn-group"> <div class="row btn-group" style="margin-top: 10px;">
<template v-if="item.status == 'idle'">
<el-button
type="primary"
:disabled="!item.tableId || item.status === 'closed'"
@click="diancanShow(item, 'subscribe')"
>预约</el-button>
</template>
<template v-if="item.status == 'subscribe'"> <template v-if="item.status == 'subscribe'">
<el-button <el-button
type="primary" type="success"
:disabled="!item.tableId || item.status === 'closed'" :disabled="!item.tableId || item.status === 'closed'"
>已预约</el-button> @click="markStatus(item,-1)"
>取消预约</el-button>
</template> </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 <el-button
type="primary" type="primary"
:disabled="!item.tableId || item.status === 'closed'" :disabled="!item.tableId || item.status === 'closed'"
@click="diancanShow(item)" @click="diancanShow(item)"
>点餐</el-button> >点餐</el-button>
</template> </template>
<template v-else> <template v-else-if="item.status != 'idle' && item.status != 'subscribe'">
<template v-if="item.status == 'using'"> <template v-if="item.status == 'using'">
<el-button <el-button
:disabled="!item.tableId || item.status === 'closed'" :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 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 { hasPermission } from '@/utils/limits.js'
import $status from './status.js'
import dayjs from 'dayjs'
import { import {
tbShopTableGet, tbShopTableGet,
markStatus,
tbShopAreaGet, tbShopAreaGet,
tbShopAreaDelete, tbShopAreaDelete,
tbShopTableDelete, tbShopTableDelete,
@@ -277,29 +325,40 @@ export default {
}, },
data() { data() {
return { return {
dateList: [
{ label: '今天', day: '', date: '' },
{ label: '明天', day: '', date: '' },
{ label: '后天', day: '', date: '' }
],
query: {
bookingDate: '',
bookingType: 'lunch'
},
tabVlaue: '', tabVlaue: '',
tabs: [], tabs: [],
loading: false, loading: false,
total: 0, total: 0,
tableList: [], tableList: [],
status: { status: $status,
pending: { label: '挂单中', type: '#E6A23C' }, // status: {
// pending: { label: '挂单中', type: '#E6A23C' },
cleaning: { label: '待清台', type: '#FAAD14' }, // cleaning: { label: '待清台', type: '#FAAD14' },
using: { label: '开台中', type: '#FF4D4F' }, // using: { label: '开台中', type: '#FF4D4F' },
idle: { label: '空闲', type: '#3F9EFF' }, // idle: { label: '空闲', type: '#3F9EFF' },
paying: { label: '结算中', type: '#E6A23C' }, // paying: { label: '结算中', type: '#E6A23C' },
closed: { label: '关台', type: '#DDDDDD' }, // closed: { label: '关台', type: '#DDDDDD' },
subscribe: { label: '预定', type: '#52C41A ' }, // subscribe: { label: '预定', type: '#52C41A ' },
unbind: { label: '未绑定', type: 'rgb(221,221,221)' } // unbind: { label: '未绑定', type: 'rgb(221,221,221)' }
}, // },
selTable: '', // 当前选中的桌台 selTable: '', // 当前选中的桌台
areaMap: {}, areaMap: {},
shopInfo: {}, shopInfo: {},
bookingDate: '',
timer: null timer: null
} }
}, },
@@ -312,8 +371,53 @@ export default {
this.setTimter(60) this.setTimter(60)
this.tbShopAreaGet() this.tbShopAreaGet()
this.getShopInfo() this.getShopInfo()
this.getWeekdays()
}, },
methods: { 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) console.log(error)
} }
}, },
tbShopSubscribe() {
this.tbShopTableGet()
},
/** /**
* 清除定时器 * 清除定时器
*/ */
@@ -499,11 +606,17 @@ export default {
async tbShopTableGet(showloading = true) { async tbShopTableGet(showloading = true) {
this.loading = showloading this.loading = showloading
try { try {
const { content, total } = await tbShopTableGet({ const res = await tbShopTableGet({
shopId: localStorage.getItem('shopId'), 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)=>{ // this.tableList = content.sort((a,b)=>{
// if(a.status=='idle'&&b.status!='idle'){ // if(a.status=='idle'&&b.status!='idle'){
// return 1 // return 1
@@ -511,7 +624,7 @@ export default {
// return -1 // return -1
// } // }
// }); // });
this.total = total this.total = res.total
setTimeout(() => { setTimeout(() => {
this.loading = false this.loading = false
}, 300) }, 300)
@@ -601,8 +714,8 @@ export default {
justify-content: space-between; justify-content: space-between;
border-radius: 6px; border-radius: 6px;
background-color: #1890ff; background-color: #1890ff;
max-width: 172px; max-width: 210px;
min-width: 160px; min-width: 190px;
&.using { &.using {
background-color: rgb(250, 85, 85); background-color: rgb(250, 85, 85);
} }
@@ -630,8 +743,12 @@ export default {
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.box { .box {
height: 100%;
background-color: #fff; background-color: #fff;
border-radius: 3px 3px 6px 6px; border-radius: 3px 3px 6px 6px;
display: flex;
flex-direction: column;
justify-content: flex-end;
} }
.bottom { .bottom {
border-top: 1px solid #f7f7fa; border-top: 1px solid #f7f7fa;
@@ -642,6 +759,9 @@ export default {
background-color: #fff; background-color: #fff;
flex: 1; flex: 1;
border-radius: 3px 3px 0 0; border-radius: 3px 3px 0 0;
display: flex;
flex-direction: column;
justify-content: flex-end;
.row { .row {
display: flex; display: flex;
gap: 10px; gap: 10px;

View File

@@ -187,7 +187,6 @@ export default {
isActive() { isActive() {
const isSel = const isSel =
this.selIndex === this.index && this.placeNum === this.selPlaceNum; this.selIndex === this.index && this.placeNum === this.selPlaceNum;
console.log(isSel);
return isSel ? "active" : ""; 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 }); this.$set(this.listdata.proGroupVo, index, { ...this.listdata.proGroupVo[index], alertshow: this.listdata.proGroupVo[index].number != this.multipleSelection[index].length ? true : false });
}, },
confirm() { confirm() {
console.log(listdata.proGroupVo)
this.$emit("dialogpackageconfirm", this.listdata, this.multipleSelection); this.$emit("dialogpackageconfirm", this.listdata, this.multipleSelection);
this.show = false; this.show = false;
@@ -84,7 +83,6 @@ export default {
return false; return false;
} }
this.disabledshow = true this.disabledshow = true
console.log(this.listdata, this.multipleSelection);
this.show = true; this.show = true;
}, },
}, },

View File

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

View File

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

View File

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

View File

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