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

150 lines
3.6 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-p-b-100">
<view v-if="list.length">
<view v-for="(item, index) in list" :key="index" class="table-box">
<view class="hm-text-center hm-font-b hm-font-30 hm-p-b-20 hm-border-b hm-col-main">{{item.table_name}}</view>
<view class="hm-p-t-20">
<text class="hm-col-content">餐桌状态</text>
<view v-if="item.status.value==10" class="tag success">{{item.status.text}}</view>
<view v-if="item.status.value==20" class="tag error">{{item.status.text}}</view>
<view v-if="item.status.value==30" class="tag warning">{{item.status.text}}</view>
</view>
<view>
<text class="hm-col-content">餐桌编号</text>
<text :class="item.row_no?'hm-col-success':'hm-col-warning'">{{item.row_no?item.row_no:'无'}}</text>
</view>
<view class="hm-p-t-20 hm-text-right hm-border-t hm-m-t-20">
<view class="hm-dis-block-inline hm-m-l-20"
@click="goTo('user/table/edit?id='+item.table_id)">
<view class="hm-dis-block-inline"><u-icon name="edit-pen"></u-icon></view>编辑
</view>
<view class="hm-dis-block-inline hm-m-l-20" @click="del(item.table_id)">
<view class="hm-dis-block-inline"><u-icon name="trash"></u-icon></view>删除
</view>
</view>
</view>
</view>
<view v-else class="hm">
<img :src="applet.domain + '/addons/food/img/empty/data.png'" />
<view class="text">暂无餐桌数据</view>
</view>
<!-- 技术支持 -->
<view class="hm">
{{applet.copyright}} <text class="v">V{{applet.version}}</text>
</view>
</view>
<view class="hm-footer-fixed">
<view class="hm-p-lr-b25 hm-w-b100">
<u-button @click="goTo('user/table/add')" type="success" text="添加餐桌"></u-button>
</view>
</view>
</view>
</template>
<script>
let App = getApp();
export default {
data() {
return {
list: {},
applet: {}
};
},
components: {},
props: {},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
let _this = this;
_this.applet = App.getApplet();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
let _this = this;
_this.getTable();
},
methods: {
/**
* 获取餐桌、包间列表
*/
getTable: function() {
let _this = this;
App._get('user.table/lists', {}, function(result) {
_this.setData(result.data);
});
},
/**
* 删除
*/
del: function(table_id) {
let _this = this;
uni.showModal({
title: "提示",
content: "确定要删除?",
success: function(o) {
if (o.confirm) {
App._get('user.table/delete', {
id: table_id
}, function(result) {
App.showSuccess(result.msg, function() {
_this.getTable();
});
});
}
}
});
},
/**
* 跳转
*/
goTo: function(url) {
App.goTo(url);
},
}
};
</script>
<style lang="scss" scoped>
.table-box {
padding: 20rpx;
width: 41%;
margin: 20rpx 0rpx 0rpx 20rpx;
border-radius: 10rpx;
background-color: #fff;
color: #999;
font-size: 26rpx;
box-shadow: 6rpx 6rpx 8rpx rgba(26, 26, 26, 0.2);
display: inline-block;
.tag{
display: inline-block;
border-radius: 10rpx;
font-size: 22rpx;
padding: 5rpx 15rpx;
}
.success{
border: 1rpx solid #19be6b;
background-color: #dbf1e1;
color: #19be6b;
}
.error{
border: 1rpx solid #fa3534;
background-color: #fef0f0;
color: #fa3534;
}
.warning{
border: 1rpx solid #ff9900;
background-color: #fdf6ec;
color: #ff9900;
}
}
</style>