2024-01-03 14:19:05 +08:00

171 lines
3.8 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<view class="hm-header-xian"></view>
<view class="form-box">
<view class="form-item">
<view class="title">餐桌名称<text class="hm-col-error">*</text></view>
<view class="right">
<u--input :customStyle="{'padding':'15rpx'}" v-model="data.table_name" border="none" :clearable="true" placeholder="请输入餐桌、包间名称"></u--input>
</view>
</view>
<view class="form-item">
<view class="title">餐桌编号<text class="hm-col-error">*</text></view>
<view class="right">
<u--input :customStyle="{'padding':'15rpx'}" v-model="data.row_no" type="number" border="none" :clearable="true" placeholder="自定义编号"></u--input>
</view>
</view>
<view class="form-item">
<view class="title">显示排序<text class="hm-col-error">*</text></view>
<view class="right">
<u--input :customStyle="{'padding':'15rpx'}" v-model="data.sort" type="number" border="none" :clearable="true" placeholder="数字越小越靠前"></u--input>
</view>
</view>
<view class="hm-m-t-50 hm-p-lr-b25 hm-text-center">
<u-button @click="edit()" type="success" text="确认提交"></u-button>
</view>
</view>
<!-- 技术支持 -->
<view class="hm">
{{applet.copyright}} <text class="v">V{{applet.version}}</text>
</view>
</view>
</template>
<script>
let App = getApp();
export default {
data() {
return {
id:'',
data:{
table_name: '',
row_no:'',
sort:100
},
applet: {},
};
},
components: {},
props: {},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(opt) {
let _this = this;
_this.id = opt.id;
_this.getDetail();
_this.applet = App.getApplet();
},
methods: {
/**
* 获取餐桌详情
*/
getDetail: function() {
let _this = this;
App._get('user.table/edit', {
id: _this.id
}, function(result) {
_this.data.table_name = result.data.detail.table_name;
_this.data.row_no = result.data.detail.row_no;
_this.data.sort = result.data.detail.sort;
});
},
/**
* 修改
*/
edit: function(e) {
let _this = this,
data = _this.data;
data.id = _this.id;
if (data.table_name == '') {
App.showError('餐桌、包间名称不可为空');
return false;
}
if (data.row_no == '') {
App.showError('餐桌编号不可为空');
return false;
}
if (data.sort == '') {
App.showError('显示排序不可为空');
return false;
}
App._post_form('user.table/edit', data, function(result) {
App.showSuccess(result.msg, function() {
uni.navigateBack(); //返回上一页
});
}, false, function() {});
}
}
};
</script>
<style lang="scss" scoped>
/* 表单样式 */
.form-box {
background-color: #FFF;
padding: 0rpx 20rpx 20rpx 20rpx;
.form-item {
border-bottom: 1rpx solid #f0f0f0;
.input{
padding: 15rpx;
background-color: #ff0000;
}
.title {
font-size: 30rpx;
width: 23%;
display: inline-block;
}
.right {
width: 77%;
display: inline-block;
.radio{
margin-left: 15rpx;
padding: 20rpx 0rpx;
}
}
.image {
display: inline-block;
padding: 20rpx 20rpx 10rpx 15rpx;
}
.upload {
height: 105rpx;
width: 105rpx;
background-color: #F2F2F2;
padding: 45rpx 0rpx 0rpx 45rpx;
border-radius: 10rpx;
}
.logo{
image {
width: 150rpx;
height: 150rpx;
}
}
.start-time {
display: inline-block;
width: 33%;
}
.end-time {
display: inline-block;
width: 33%;
}
.time {
display: inline-block;
padding: 0rpx 20rpx;
}
.center {
display: inline-block;
width: 64%;
}
.arrow-right {
display: inline-block;
float: right;
margin-top: 22rpx;
}
}
}
</style>