cashier_app/pageLineUp/index.vue

513 lines
11 KiB
Vue

<template>
<view class="container" style="display: flex;flex-direction: column;height: 100vh;">
<view class="pageLineUpTop">
<view :class="[[datas.selecttopType==''?'active':'']]" @tap="gettypeevent('')">
<view style="border-bottom: 1px dashed #ccc;line-height: 70rpx;">全部</view>
<view style="line-height: 50rpx;">{{datas.list.totalCount}}</view>
</view>
<view v-for='item in datas.list.records' :key="item.id" @tap="gettypeevent(item.id)"
:class="[[datas.selecttopType==item.id?'active':'']]">
<view class="up-line-1" style="border-bottom: 1px dashed #ccc;line-height: 70rpx;">{{item.name}}</view>
<view style="line-height: 50rpx;color: #999;">{{item.totalCount}}({{item.note}})</view>
</view>
</view>
<view class="userinfo">
<view>用户</view>
<span>号码</span>
<span>等待</span>
</view>
<view class="" style="overflow-y: auto;flex: 1;padding-bottom: 186rpx;">
<view class="userinfoBox" v-for="item in datas.listType.records" :key="item.id">
<view class="userinfo1">
<view>
<image src="./avation.svg" style="width: 64rpx;height: 64rpx;margin-right: 16rpx;" mode=""></image>
<view>
<view> {{item.phone}} </view>
<view> {{item.callTime}} </view>
</view>
</view>
<span>{{item.callNum}}</span>
<span>{{item.waitingCount}}桌</span>
</view>
<view class="userinfo2">
<view>{{item.name}}{{item.note}}</view>
<button type="primary" class="mini-btn" size="mini" style="border-radius: 200rpx;" @tap="quxiaoevent(item)"
plain="true">取消</button>
<button class="mini-btn" type="primary" style="border-radius: 200rpx;" @tap="profilepicture(item)"
size="mini">播报</button>
</view>
</view>
</view>
<view class="bottomBUtton" style="padding-bottom: 30rpx;">
<button class="mini-btn" type="primary" @tap="showFalse">取号</button>
<button type="text" class="mini-btn" plain="true" @tap="toUrl">叫号记录</button>
</view>
</view>
<!-- 播报弹窗 -->
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog :type="datas.msgType" cancelText="完成" confirmText="过号" confirmText-color="#000" title="播报"
@confirm="dialogConfirm(1)" @close="dialogConfirm(2)">
<view class="">
<view class="">
正在叫号请稍后
</view>
<view style="font-size: 24rpx; text-align:center;color: #52C41A;"
v-if="datas.profilepicturedata.state==1">
已发送至用户
</view>
<view style="font-size: 24rpx;text-align:center;color: #F02C45;" v-else>
用户未订阅消息
</view>
</view>
</uni-popup-dialog>
</uni-popup>
<!-- 取号遮罩层 -->
<up-popup :show="datas.show" :round="18" mode="center">
<view class="zhezhaopop">
<view class="">
<span></span>
<span>取号</span>
<up-icon @tap="datas.show = false" name="close-circle-fill"></up-icon>
</view>
<view class="">
选择桌型
</view>
<view class="pageLineUpTop">
<view v-for='item in datas.list.records' :key="item.id"
:class="[datas.selectTabletype.id==item.id?'active':'']" @tap="selectTypeEvent(item)">
<view class="up-line-1" style="border-bottom: 1px dashed #ccc;line-height: 70rpx;">{{item.name}}</view>
<view style="line-height: 50rpx;">等待{{item.totalCount}}桌</view>
</view>
</view>
<view class=""> 手机号码 </view>
<view style="margin-bottom: 48rpx;">
<input v-model="datas.phone" type="text" placeholder="填写号码" maxlength="11"/>
</view>
<up-button text="确认取号" @tap="callTabletakeNumberEvent" type="primary" class="buttomStyle"
shape="circle"></up-button>
</view>
</up-popup>
<!-- 取号成功 -->
<up-popup :show="datas.showtwo" :round="18" mode="center">
<view class="zhezhaopops">
<view class="">
<span></span>
<span>取号成功</span>
<up-icon @tap="confirmtow" name="close-circle-fill"></up-icon>
</view>
<view class="">
{{datas.showtowData.callNum}}
</view>
<view style="margin-bottom: 48rpx;">
{{datas.showtowData.tableName}} ({{datas.showtowData.tableNote}})
</view>
<up-button text="确认" @tap="confirmtow" type="primary" class="buttomStyle" shape="circle"></up-button>
</view>
</up-popup>
</template>
<script setup>
import { reactive, ref, onMounted } from 'vue';
import go from '@/commons/utils/go.js'
import { getCallTableQueue, getCallTable, callTableTakeNumber, callTableCall, updateCallTableState } from '@/http/api/callTable.js'
let datas = reactive({
msgType: "",
// 关闭取号弹窗
show: false,
showtwo: false,
showtowData: "",
// 桌形列表
list: [],
// 正在排号
listType: [],
// 选中的桌型
selectTabletype: undefined,
// 手机号
phone: null,
// 顶部全部\大桌选择
selecttopType: '',
// 选中拨号的id
dialId: "",
// 拨号是否订阅
profilepicturedata: ""
})
onMounted(() => {
getList()
})
const alertDialog = ref()
/**
* 获取列表
*/
function getList() {
getCallTable({
page: 1,
size: 9999,
// callTableId: datas.selecttopType,
state: 1
}).then((res) => {
datas.list = res
datas.selectTabletype = res.records[0]
})
getCallTableQueue({
page: 1,
size: 9999,
callTableId: datas.selecttopType,
state: 0
}).then((res) => {
datas.listType = res
})
}
/**
* 选择桌型
* @param {Object} d
*/
function selectTypeEvent(d) {
datas.selectTabletype = d
}
/**
* 取号
*/
function callTabletakeNumberEvent() {
if( !datas.phone ){
return uni.$utils.showToast("请输入取号手机号码")
}
callTableTakeNumber({
callTableId: datas.selectTabletype.id,
phone: datas.phone,
note: datas.selectTabletype.note,
name: datas.selectTabletype.name,
}).then((res) => {
if (res) {
datas.show = false;
datas.showtwo = true;
datas.showtowData = res
datas.phone = ''
getList()
}
})
}
/**
* 叫号
* @param {Object} item
*/
function profilepicture(item) {
datas.dialId = item.id
callTableCall({
callQueueId: item.id
}).then((res) => {
datas.profilepicturedata = res
alertDialog.value.open()
})
}
/**
* 修改叫号状态
* @param {Object} value
*/
function dialogConfirm(value) {
if (value == 1) {
updateCallTableState({
state: 3,
callQueueId: datas.dialId
}).then((res) => {
getList()
})
} else {
// value=2完成
updateCallTableState({
state: 2,
callQueueId: datas.dialId
}).then((res) => {
getList()
})
}
}
/**
* 切换筛选桌型
* @param {Object} d
*/
function gettypeevent(d) {
datas.selecttopType = d
getList()
}
/**
* 取消排队
* @param {Object} item
*/
function quxiaoevent(item) {
updateCallTableState({
state: -1,
callQueueId: item.id
}).then((res) => {
getList()
})
}
/**
* 取号
*/
function showFalse() {
datas.show = true;
}
/**
* 关闭取号成功弹窗
*/
const confirmtow = () => {
datas.showtwo = false;
};
/**
* 前往叫号记录
*/
function toUrl() {
go.to('PAGES_CALLRE_CORD')
}
</script>
<style scoped lang="less">
page {
height: 100%;
background-color: #f9f9f9;
}
.pageLineUpTop {
display: flex;
// justify-content: space-around;
flex-wrap: wrap;
margin: 36rpx 0;
>view {
width: 208rpx;
height: 136rpx;
background: #FFFFFF;
border-radius: 8rpx 8rpx 8rpx 8rpx;
border: 2rpx solid #E5E5E5;
margin-top: 20rpx;
margin-left: 22rpx;
>view {
text-align: center;
}
}
// >view:last-child {
// margin-right: auto;
// margin-left: 22rpx;
// }
.active {
border: 2rpx solid #318AFE;
>view:first-child {
color: #318AFE;
}
}
}
.userinfo {
width: 750rpx;
height: 84rpx;
background: #E9E9E9;
border-radius: 12rpx 12rpx 0rpx 0rpx;
padding: 0 44rpx;
.df;
justify-content: space-between;
>view:first-child {
width: 300rpx;
}
}
.userinfoBox {
margin-bottom: 32rpx;
.userinfo1 {
width: 750rpx;
height: 84rpx;
background: #fff;
border-radius: 12rpx 12rpx 0rpx 0rpx;
padding: 0 44rpx;
.df;
justify-content: space-between;
padding-top: 32rpx;
>view:first-child {
width: 280rpx;
.df;
}
}
.userinfo2 {
width: 750rpx;
height: 84rpx;
background: #fff;
border-radius: 12rpx 12rpx 0rpx 0rpx;
padding: 58rpx 0;
padding-left: 44rpx;
.df;
justify-content: space-between;
background-color: #fff;
// margin-top: 32rpx;
>view:first-child {
margin-right: 260rpx;
background: #E5E5E5;
width: 130rpx;
height: 32rpx;
line-height: 32rpx;
text-align: center;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 22rpx;
color: #999999;
}
}
}
.bottomBUtton {
width: 100%;
background-color: #fff;
position: fixed;
bottom: 0;
left: 50%;
transform: translate(-50%);
padding-top: 24rpx;
>button {
width: 530rpx;
background: #318AFE;
border-radius: 200rpx;
}
>button:last-child {
background-color: rgba(0, 0, 0, 0);
border: none;
color: #318AFE;
}
}
.zhezhaopop {
padding: 34rpx 32rpx;
width: 594rpx;
// height: 668rpx;
background: #FFFFFF;
// border-radius: 18rpx 18rpx 18rpx 18rpx;
>view:first-child {
.df;
justify-content: space-between;
>span:nth-child(2) {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
}
>view:nth-child(2) {
margin-top: 48rpx;
}
>view:nth-child(3) {
margin-top: 32rpx;
}
>view:nth-child(4) {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
>view:nth-child(5) {
margin-top: 22rpx;
>input {
width: 500rpx;
height: 84rpx;
padding-left: 24rpx;
background: #FFFFFF;
border-radius: 8rpx 8rpx 8rpx 8rpx;
border: 2rpx solid #E5E5E5;
// margin-top: 32rpx;
}
}
.buttomStyle {
margin-top: 48rpx;
width: 506rpx;
height: 80rpx;
}
}
.zhezhaopops {
padding: 34rpx 32rpx;
width: 594rpx;
background: #FFFFFF;
// border-radius: 18rpx 18rpx 18rpx 18rpx;
border-radius: 18rpx 18rpx 18rpx 18rpx;
>view:first-child {
border-radius: 18rpx 18rpx 18rpx 18rpx;
.df;
justify-content: space-between;
>span:nth-child(2) {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
}
>view:nth-child(2) {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 80rpx;
color: #333333;
margin-top: 64rpx;
width: 100%;
text-align: center;
}
>view:nth-child(3) {
margin-top: 48rpx;
margin-left: 34%;
}
.buttomStyle {
margin-top: 48rpx;
width: 506rpx;
height: 80rpx;
}
}
.df {
display: flex;
align-items: center;
}
</style>