更换正式环境,测试修改
This commit is contained in:
@@ -1,358 +0,0 @@
|
||||
<template>
|
||||
<my-model ref="model" :title="title" :borderRadius="16" @confirm="submit" :confirmClickClose="false">
|
||||
<template #desc>
|
||||
<view>
|
||||
<uni-forms ref="refform" label-position="left" :model="form" label-align="left" :label-width="400"
|
||||
:rules="rules">
|
||||
<view class="form">
|
||||
<view class="border-bottom u-p-b-10 u-p-t-10">
|
||||
<uni-forms-item required label="" name="areaId">
|
||||
<template #label>
|
||||
<view class="u-text-left ">
|
||||
<text class="color-red">*</text>
|
||||
<text class="color-333 u-font-28">选择区域</text>
|
||||
</view>
|
||||
</template>
|
||||
<picker @change="areaChange"
|
||||
:value="area.selIndex"
|
||||
range-key="name" :range="area.list">
|
||||
<view class=" u-flex u-row-between u-relative ">
|
||||
<view class="zhezhao u-absolute position-all" style="z-index: 1;"></view>
|
||||
<view class="u-flex-1">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="area.sel.name"
|
||||
placeholder="请选择区域"></uni-easyinput>
|
||||
|
||||
</view>
|
||||
<uni-icons type="right" size="18" color="#999"></uni-icons>
|
||||
</view>
|
||||
|
||||
</picker>
|
||||
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<view class="border-bottom u-p-b-10 u-p-t-10">
|
||||
<uni-forms-item required label="" name="status">
|
||||
<template #label>
|
||||
<view class="u-text-left ">
|
||||
<!-- <text class="color-red">*</text> -->
|
||||
<text class="color-333 u-font-28">桌台状态</text>
|
||||
</view>
|
||||
</template>
|
||||
<picker @change="statusChange" range-key="label"
|
||||
:value="status.selIndex"
|
||||
:range="status.list">
|
||||
<view class=" u-flex u-row-between u-relative ">
|
||||
<view class="zhezhao u-absolute position-all" style="z-index: 1;"></view>
|
||||
<view class="u-flex-1">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="status.sel.label"
|
||||
placeholder="请选择桌台状态"></uni-easyinput>
|
||||
</view>
|
||||
<uni-icons type="right" size="18" color="#999"></uni-icons>
|
||||
</view>
|
||||
|
||||
</picker>
|
||||
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<view class="border-bottom u-p-b-10">
|
||||
<uni-forms-item required label="" name="name">
|
||||
<template #label>
|
||||
<view class="u-text-left">
|
||||
<text class="color-333 u-font-28">桌台名称</text>
|
||||
<!-- <text class="color-red">*</text> -->
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex-1">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.name"
|
||||
placeholder="请输入桌台名称"></uni-easyinput>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
|
||||
<view class="border-bottom u-p-b-10">
|
||||
<uni-forms-item required label="" name="maxCapacity">
|
||||
<template #label>
|
||||
<view class="u-text-left">
|
||||
<text class="color-333 u-font-28">客座数</text>
|
||||
<!-- <text class="color-red">*</text> -->
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex-1">
|
||||
<uni-number-box v-model="form.maxCapacity"></uni-number-box>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<view class="border-bottom u-p-b-10">
|
||||
<uni-forms-item required label="" name="isPredate">
|
||||
<template #label>
|
||||
<view class="u-text-left">
|
||||
<text class="color-333 u-font-28">网络预定开关</text>
|
||||
<!-- <text class="color-red">*</text> -->
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex-1 u-flex u-row-right">
|
||||
<my-switch v-model="form.isPredate"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<view class="border-bottom u-p-b-10">
|
||||
<uni-forms-item required label="" name="types">
|
||||
<template #label>
|
||||
<view class="u-text-left">
|
||||
<text class="color-333 u-font-28">类型</text>
|
||||
<!-- <text class="color-red">*</text> -->
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex-1">
|
||||
<my-tabs @change="tabsChange" :list="tabs.list" v-model="tabs.sel"></my-tabs>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<view class="border-bottom u-p-b-10">
|
||||
<uni-forms-item required label="" name="types">
|
||||
<template #label>
|
||||
<view class="u-text-left">
|
||||
<text class="color-333 u-font-28">清台管理</text>
|
||||
<!-- <text class="color-red">*</text> -->
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex-1">
|
||||
<my-tabs @change="autoClearsChange" :list="autoClears.list" v-model="form.autoClear"></my-tabs>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<template v-if="tabs.sel==1">
|
||||
<view class=" u-p-b-10">
|
||||
<uni-forms-item required label="" >
|
||||
<template #label>
|
||||
<view class="u-text-left">
|
||||
<text class="color-333 u-font-28">每小时收费</text>
|
||||
<!-- <text class="color-red">*</text> -->
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex-1">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.perhour" type="number"
|
||||
placeholder="请输入每小时收费"></uni-easyinput>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class=" u-p-b-10">
|
||||
<uni-forms-item required label="" >
|
||||
<template #label>
|
||||
<view class="u-text-left">
|
||||
<text class="color-333 u-font-28">最低消费</text>
|
||||
<!-- <text class="color-red">*</text> -->
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex-1">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.amount" type="number"
|
||||
placeholder="请输入最低消费"></uni-easyinput>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</uni-forms>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</my-model>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
$tableArea,$table
|
||||
} from '@/http/yskApi/table.js'
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import {
|
||||
$status
|
||||
} from '@/commons/table-status.js'
|
||||
import {objToArrary} from '@/commons/utils/returrn-data.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const emits= defineEmits(['update'])
|
||||
const tabs=reactive({
|
||||
list:['低消','计时'],
|
||||
sel:1
|
||||
})
|
||||
//清台管理
|
||||
const autoClears=reactive({
|
||||
list:['手动清台','自动清台']
|
||||
})
|
||||
function autoClearsChange(i){
|
||||
form.autoClearsChange=i
|
||||
}
|
||||
const status = reactive({
|
||||
list:objToArrary($status),
|
||||
sel: '',
|
||||
selIndex:0
|
||||
})
|
||||
console.log(status.list);
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: '编辑桌台'
|
||||
}
|
||||
})
|
||||
const model = ref(null)
|
||||
const area = reactive({
|
||||
list: [],
|
||||
sel: '',
|
||||
selIndex:0
|
||||
})
|
||||
async function getArea() {
|
||||
const {
|
||||
content
|
||||
} = await $tableArea.get({
|
||||
page: 0,
|
||||
size: 300
|
||||
})
|
||||
area.list = content.map(v => {
|
||||
return {
|
||||
...v,
|
||||
name: v.name,
|
||||
value: v.id,
|
||||
label: v.name
|
||||
}
|
||||
})
|
||||
console.log(area.list);
|
||||
|
||||
}
|
||||
|
||||
function tabsChange(e){
|
||||
if(e){
|
||||
form.type=2
|
||||
}else{
|
||||
form.type=0
|
||||
}
|
||||
}
|
||||
function statusChange(e){
|
||||
status.sel = status.list[e.detail.value]
|
||||
form.status = status.sel.key
|
||||
}
|
||||
function areaChange(e) {
|
||||
console.log(e);
|
||||
area.sel = area.list[e.detail.value]
|
||||
form.areaId = area.sel.id
|
||||
}
|
||||
onMounted(()=>{
|
||||
getArea()
|
||||
})
|
||||
function open(tableData) {
|
||||
Object.assign(form,tableData)
|
||||
getArea()
|
||||
model.value.open()
|
||||
if(tableData){//编辑
|
||||
const {areaId,type}=tableData
|
||||
area.sel=area.list.find(v=>v.id==areaId)
|
||||
area.selIndex=area.list.findIndex(v=>v.id==areaId)
|
||||
status.sel=status.list.find(v=>v.key==tableData.status)
|
||||
status.selIndex=status.list.findIndex(v=>v.key==tableData.status)
|
||||
tabs.sel=form.type==2?1:0
|
||||
}
|
||||
}
|
||||
|
||||
function close() {
|
||||
model.value.close()
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
close
|
||||
})
|
||||
|
||||
|
||||
function unitChange(e) {
|
||||
units.current = e.detail.value
|
||||
form.unit = units.list[e.detail.value].name
|
||||
}
|
||||
|
||||
const refform = ref(null)
|
||||
const form = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
areaId: '',
|
||||
status:'',
|
||||
maxCapacity: 0,
|
||||
isPredate: 1,
|
||||
type: 2,
|
||||
perhour: 0,
|
||||
amount: 0
|
||||
})
|
||||
// 校验规则
|
||||
const rules = {
|
||||
areaId: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请选择区域'
|
||||
}]
|
||||
},
|
||||
name: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入桌台名称'
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
function submit() {
|
||||
refform.value.validate(res => {
|
||||
console.log(res)
|
||||
console.log(form);
|
||||
$table.update({...form,qrcode:form.tableId}).then(Response=>{
|
||||
infoBox.showSuccessToast('更新成功')
|
||||
close()
|
||||
emits('update')
|
||||
})
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
})
|
||||
}
|
||||
const page = reactive({
|
||||
type: 'add'
|
||||
})
|
||||
|
||||
function cancel() {
|
||||
uni.navigateBack()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.border-bottom {
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
|
||||
.form {
|
||||
margin-top: 32rpx;
|
||||
background-color: #fff;
|
||||
padding: 32rpx 24rpx 32rpx 24rpx;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
|
||||
.u-text-left {
|
||||
min-width: 160rpx;
|
||||
}
|
||||
|
||||
// background-color: transparent;
|
||||
}
|
||||
|
||||
::v-deep.uni-forms-item {
|
||||
min-height: 80rpx;
|
||||
}
|
||||
|
||||
::v-deep.uni-forms-item .uni-forms-item__label {
|
||||
font-size: 28rpx !important;
|
||||
}
|
||||
|
||||
::v-deep.uni-easyinput__placeholder-class {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
::v-deep.uni-forms-item__error {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
<view class="input-wrapper">
|
||||
<view class="input-main">
|
||||
<view class="u-flex u-p-r-30 u-font-28" @click="showstatusToggle">
|
||||
<text class="u-m-r-10 u-line-1" :class="{'color-main':status.active!=0}"
|
||||
style="max-width: 100rpx;">{{status.list[status.active].label }}</text>
|
||||
<view class="u-flex u-p-r-30 u-font-28" @click="pageData.statusShow = !pageData.statusShow">
|
||||
<text class="u-m-r-10 u-line-1 " :class="{'color-main':pageData.query.status!=''}"
|
||||
style="max-width: 100rpx;">{{pageData.statusName }}</text>
|
||||
<up-icon name="arrow-down" size="16"></up-icon>
|
||||
</view>
|
||||
<uni-easyinput clearable class='jeepay-search' :inputBorder="false"
|
||||
@@ -26,20 +26,8 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view :style="{height:status.show?statusHeight:0}" class="tranistion status overflow-hide">
|
||||
<view @tap="changestatusActive(index,item)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
|
||||
v-for="(item,index) in status.list" :key="index">
|
||||
<view>{{item.label}}</view>
|
||||
<uni-icons v-if="status.active===index" type="checkmarkempty" :color="$utils.ColorMain"></uni-icons>
|
||||
</view>
|
||||
<view :style="{height: status.bottomHeight+'px'}"></view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</up-sticky>
|
||||
|
||||
|
||||
|
||||
|
||||
<view class="list u-p-30">
|
||||
<view class="my-bg-main table-type u-flex border-r-12 color-fff ">
|
||||
@@ -74,38 +62,25 @@
|
||||
<view class="color-999 u-p-30 u-text-center border-bottom">桌号:{{actionSheet.title}}</view>
|
||||
</template>
|
||||
</my-action-sheet>
|
||||
<my-mask ref="mask" @close="hideType"></my-mask>
|
||||
<up-picker :show="pageData.statusShow" :columns="pageData.statusList" keyName="label" @cancel="pageData.statusShow=false" @confirm="confirmStatus" ></up-picker>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad, onReady, onShow, } from '@dcloudio/uni-app';
|
||||
import { ref, reactive, computed, watch } from 'vue';
|
||||
|
||||
import { objToArrary } from '@/commons/utils/returrn-data.js'
|
||||
import { $status } from '@/commons/table-status.js'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import myMask from '@/components/my-components/my-mask'
|
||||
import addTable from './components/add-table'
|
||||
import myActionSheet from '@/components/my-components/my-action-sheet';
|
||||
import tableItem from './components/table-item'
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js'
|
||||
import { getShopTable, shopTableBind, shopTableClear } from '@/http/api/table.js'
|
||||
import { getShopArea } from '@/http/api/area.js'
|
||||
import { printOrder } from '@/http/api/order.js'
|
||||
|
||||
const statusList = objToArrary($status)
|
||||
statusList.unshift({
|
||||
key: '',
|
||||
label: '全部'
|
||||
})
|
||||
const status = reactive({
|
||||
list: statusList,
|
||||
active: 0,
|
||||
show: false,
|
||||
bottomHeight: 14
|
||||
})
|
||||
import { getHistoryOrder } from '@/http/api/order.js'
|
||||
|
||||
const pageData = reactive({
|
||||
statusShow: false,
|
||||
hasAjax: false,
|
||||
areaMap: {},
|
||||
query: {
|
||||
@@ -116,34 +91,30 @@
|
||||
name: '',
|
||||
},
|
||||
totalElements:0,
|
||||
statusList: [[{
|
||||
key: '',
|
||||
label: '全部'
|
||||
},...uni.$utils.objToArrary($status)]],
|
||||
statusName: '全部',
|
||||
tabList: [],
|
||||
area: {
|
||||
list: [],
|
||||
sel: ''
|
||||
}
|
||||
})
|
||||
const search = reactive({
|
||||
show: false
|
||||
},
|
||||
orderInfo: null,
|
||||
})
|
||||
|
||||
const refMoreSheet = ref(null)
|
||||
const actionSheet = reactive({
|
||||
list: ['结账', '清台', '增减菜', '换台', '打印订单', '历史订单','绑定码牌'],
|
||||
title: '',
|
||||
selTable: ''
|
||||
})
|
||||
|
||||
const statusHeight = computed(() => {
|
||||
return 30 * status.list.length + status.bottomHeight + 'px'
|
||||
})
|
||||
|
||||
watch(() => pageData.area.sel, (newval) => {
|
||||
pageData.query.page = 1
|
||||
getTable()
|
||||
})
|
||||
watch(() => status.active, (newval) => {
|
||||
pageData.query.page = 1
|
||||
getTable()
|
||||
})
|
||||
|
||||
onShow(opt => {
|
||||
getData()
|
||||
@@ -175,6 +146,17 @@
|
||||
}, {})
|
||||
}
|
||||
|
||||
/**
|
||||
* 类型选择
|
||||
* @param {Object} e
|
||||
*/
|
||||
function confirmStatus(e){
|
||||
pageData.statusShow = false
|
||||
pageData.query.status = e.value[0].key
|
||||
pageData.statusName = e.value[0].label
|
||||
getTable()
|
||||
}
|
||||
|
||||
/**
|
||||
* 区域选择确定
|
||||
* @param {Object} item
|
||||
@@ -192,6 +174,11 @@
|
||||
actionSheet.title = table.name
|
||||
actionSheet.selTable = table
|
||||
refMoreSheet.value.open()
|
||||
if( actionSheet.selTable.orderId ){
|
||||
getHistoryOrder({orderId: actionSheet.selTable.orderId}).then(res=>{
|
||||
pageData.orderInfo = res
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -239,8 +226,9 @@
|
||||
//打印订单
|
||||
if (!item.orderId) {
|
||||
return uni.$utils.showToast('该桌台暂无要打印的订单!')
|
||||
}
|
||||
let res = await printOrder( {id: actionSheet.selTable.orderId } )
|
||||
}
|
||||
|
||||
let res = await printOrder( {id: actionSheet.selTable.orderId, type: pageData.orderInfo.status == 'unpaid' ? 1 : 0 } )
|
||||
return
|
||||
}
|
||||
if (index == 6) {
|
||||
@@ -313,61 +301,14 @@
|
||||
* 搜索
|
||||
*/
|
||||
function searchConfirm() {
|
||||
search.show = false
|
||||
pageData.query.page = 1;
|
||||
maskHide()
|
||||
getTable()
|
||||
}
|
||||
|
||||
const times = reactive({
|
||||
list: [10, 15, 20, 30],
|
||||
active: 0,
|
||||
show: false,
|
||||
bottomHeight: 14
|
||||
})
|
||||
|
||||
function hideType() {
|
||||
status.show = false
|
||||
search.show = false
|
||||
times.show = false
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开类型
|
||||
* 页数改变事件
|
||||
* @param {Object} page
|
||||
*/
|
||||
function showstatusToggle() {
|
||||
status.show = !status.show
|
||||
search.show = false
|
||||
times.show = false
|
||||
if (status.show) {
|
||||
maskShow()
|
||||
} else {
|
||||
maskHide()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 类型选择
|
||||
* @param {Object} i
|
||||
*/
|
||||
function changestatusActive(i) {
|
||||
status.active = i
|
||||
status.show = false
|
||||
pageData.query.status = status.list[i].key
|
||||
mask.value.toggle()
|
||||
}
|
||||
|
||||
const mask = ref(null)
|
||||
|
||||
function maskShow() {
|
||||
mask.value.open()
|
||||
}
|
||||
|
||||
function maskHide() {
|
||||
mask.value.close()
|
||||
}
|
||||
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
pageData.query.page = page
|
||||
getTable()
|
||||
|
||||
Reference in New Issue
Block a user