<template>
	<view class="w1005">
		<view class="flex" style="padding: 20upx 24upx;background-color: #fff;margin-bottom: 20rpx;">
			<view class="">
				开始桌号：
			</view>
			<view class="">
				<input type="number" v-model="startName" placeholder="桌号 整数" placeholder-style="font-size:24upx" />
			</view>
		</view>
		<view class="flex" style="padding: 20upx 24upx;background-color: #fff;margin-bottom: 20rpx;">
			<view class="">
				结束桌号：
			</view>
			<view class="">
				<input type="number" v-model="endName" placeholder="桌号 整数" placeholder-style="font-size:24upx" />
			</view>
		</view>
		<button class="submitbtn" type="default" @click="addTable">添加桌码</button>
	</view>
</template>

<script>
	import {
		addTable
	} from "@/utils/api/api.js";
	export default {
		data() {
			return {
				startName:'',
				endName:''
			}
		},
		onLoad() {
			// this.addTable('add', '05');

		},
		
		
		onShow() {

		},
		methods: {
			//name，修改 传 table_id
			addTable() {
				let that = this
				if(this.tableName == ""){
					uni.showToast({
						title:"请填写桌号",
						icon:"none"
					})
					return;
				}
				uni.showLoading({
					title:'正在添加，请稍后...'
				})
					addTable({
						name: that.startName,
						end_name:that.endName
					}).then(res => {
						if(res.code==0){
							uni.hideLoading()
							uni.showToast({
								title:res.msg,
								icon:"none",
								success() {
									that.startName = '',
									that.endName =''
								}
							})
						}
					})
			},
		}
	}
</script>

<style>
	.submitbtn {
		margin: 60upx 24upx;
		height: 88upx;
		line-height: 88upx;
		text-align: center;
		background: #f64f15;
		border-radius: 6upx;
		font-size: 32upx;
		color: rgba(255, 255, 255, 1);
	}
</style>
