599 lines
14 KiB
Vue
599 lines
14 KiB
Vue
<template>
|
||
<view class="hzIndex">
|
||
<hzHeader title="留餐申请"></hzHeader>
|
||
<view class="hzContent">
|
||
<view class="main" >
|
||
<view class="tab-box">
|
||
<view class="tab-item" :class="currentTabIndex == 0 ? 'active' : ''" @click="currentTabIndex = 0">留餐申请<view class="activeLine" v-if="currentTabIndex == 0"></view></view>
|
||
<view class="tab-item" :class="currentTabIndex == 1 ? 'active' : ''" @click="currentTabIndex = 1">申请记录<view class="activeLine" v-if="currentTabIndex == 1"></view></view>
|
||
</view>
|
||
</view>
|
||
<view class="content" v-if="currentTabIndex == 0">
|
||
<view class="interviewee" style="position: relative;">
|
||
<view class="form-box" style="border-radius: 10upx;">
|
||
<view class="form-item" >
|
||
<text class="label">姓 名:</text>
|
||
<view class="ipt-box"><input class="top-t" v-model="foodApply.USER_NAME" placeholder="请输入姓名" type="text" maxlength="50" disabled="true" /></view>
|
||
</view>
|
||
<view class="form-item" >
|
||
<text class="label">联系方式:</text>
|
||
<view class="ipt-box"><input class="top-t" v-model="foodApply.PHONE" placeholder="请输入联系方式" type="text" maxlength="50" disabled="true" /></view>
|
||
</view>
|
||
<view class="form-item" >
|
||
<text class="label">部 门:</text>
|
||
<view class="ipt-box"><input class="top-t" v-model="foodApply.ORG_NAME" placeholder="请输入部门" type="text" maxlength="50" disabled="true" /></view>
|
||
</view>
|
||
<view class="form-item" >
|
||
<text class="label"><text style="color: red;">*</text>选择食堂:</text>
|
||
<view class="ipt-box select">
|
||
<radio-group @change="changeGenders" style="display: flex;justify-content: flex-start;align-items: center">
|
||
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in genders" :key="item.id" style="display: flex;justify-content: flex-start;align-items: center;margin-right: 40upx;min-width: 140upx;">
|
||
<view>
|
||
<radio color="#4db4ea" :value="item.id" />
|
||
</view>
|
||
<view>{{item.name}}</view>
|
||
</label>
|
||
</radio-group>
|
||
</view>
|
||
</view>
|
||
<view class="form-item">
|
||
<text class="label"><text style="color: red;">*</text>留餐类别:</text>
|
||
<view class="ipt-box select">
|
||
<image class="arrow" src="/static/icons/right-arrow.png" mode=""></image>
|
||
<picker class="picker" v-if="foodTypes.length > 0" :range="foodTypes" @change="changeUserType" range-key="name">
|
||
<view>{{ foodTypes[foodTypeIndex].name }}</view>
|
||
</picker>
|
||
</view>
|
||
</view>
|
||
<view class="form-item" >
|
||
<text class="label"><text style="color: red;">*</text>就餐人数:</text>
|
||
<view class="ipt-box">
|
||
<input type="number" class="top-t" v-model="foodApply.NEAL_NUM" placeholder="请输入就餐人数" @input="changeNumber()"/>
|
||
<!-- <input class="top-t" v-model="foodApply.NEAL_NUM" placeholder="请输入就餐人数" type="text" maxlength="50" /> -->
|
||
</view>
|
||
</view>
|
||
<view class="form-item">
|
||
<text class="label"><text style="color: red;">*</text>取餐时间:</text>
|
||
<view class=""><uni-datetime-picker :clear-icon="false" v-model="foodApply.NEAL_TIME" type="datetime" :start="today"/></view>
|
||
</view>
|
||
|
||
|
||
</view>
|
||
<view class="form-box" style="border-radius: 10upx;">
|
||
|
||
</view>
|
||
</view>
|
||
<view class="occupied"></view>
|
||
<view class="footer-btn" @click="submit"><view class="btn">提交</view></view>
|
||
</view>
|
||
<!-- 检查列表 -->
|
||
<view v-if="currentTabIndex == 1">
|
||
<view class="list-content" v-if="reportList.length > 0">
|
||
<view class="details" v-for="(item, i) in reportList" :key="i" >
|
||
<view class="detail_header" @click="details(item)">
|
||
<!-- <text class="blueSign"></text> -->
|
||
<image src="/static/img/foodIcon.png" mode="" style="width: 35upx;height: 40upx;margin-left: 20upx;vertical-align: middle;"></image>
|
||
<text class="font-tilte">留餐申请</text>
|
||
<text v-if="item.EXAMINE_STATE ==0" class="statusred" style="color: #ff9000;background-color: #FFEFE3;">待处理</text>
|
||
<text v-if="item.EXAMINE_STATE ==2" class="statusred" style="color: #BD1515;background-color: #F6DFDF;">已拒绝</text>
|
||
<text v-if="item.EXAMINE_STATE ==1" class="statusred" style="color: #0DB0A7;background-color: #C1EFEA;">已通过</text>
|
||
|
||
</view>
|
||
|
||
<view class="detail_msg">
|
||
<view class="info-item" @click="details(item)">
|
||
<text>留餐类别:</text>
|
||
<text class="infoSpan">{{formatFoodType(item.NEA_TYPE)}}</text>
|
||
</view>
|
||
<view class="info-item" @click="details(item)">
|
||
<text>就餐人数:</text>
|
||
<text class="infoSpan">{{ item.NEAL_NUM }}</text>
|
||
</view>
|
||
<view class="info-item" @click="details(item)">
|
||
<text>取餐时间:</text>
|
||
<text class="infoSpan">{{ item.NEAL_TIME }}</text>
|
||
</view>
|
||
<view class="info-item" @click="details(item)">
|
||
<text>申请时间:</text>
|
||
<text class="infoSpan">{{ item.CTEATE_TIME }}</text>
|
||
</view>
|
||
<!-- <view class="info-item" style="width: 100%;text-align: center;" @click="details(item)">
|
||
<text style="width: 100%;color: #4db4ea;">点击查看详情及回复</text>
|
||
</view> -->
|
||
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<content-none v-else :padTop="20"></content-none>
|
||
</view>
|
||
</view>
|
||
<load-more v-if="currentTabIndex == 1" :loadingType="loadingType" :contentText="contentText"></load-more>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import { addWeekMeal ,getHouseType,getWeekMeallist } from '@/common/api.js';
|
||
import { callbackRequest,callbackRequestNoLoading, getStorage, alertTip, convertImgToBase64, formatDate,wxSdk } from '@/common/util.js';
|
||
import loadMore from '@/components/loadMore.vue';
|
||
import contentNone from '@/components/contentNone.vue';
|
||
export default {
|
||
components: {
|
||
loadMore,
|
||
contentNone
|
||
},
|
||
data() {
|
||
return {
|
||
today:new Date().getTime(),
|
||
formatDate: formatDate,
|
||
//分页
|
||
page: 1,
|
||
pageSize: 10,
|
||
loadingType: 0, //0-loading前;1-loading中;2-没有更多了
|
||
contentText: {
|
||
contentdown: '上拉加载更多',
|
||
contentrefresh: '正在加载...',
|
||
contentnomore: '没有更多数据了'
|
||
},
|
||
currentTabIndex:0,
|
||
genders: [{ id: '梨园', name: '梨园' }, { id: '科技楼', name: '科技楼' }],
|
||
foodTypes:[{ id: '0', name: '早餐' }, { id: '1', name: '午餐' },{ id: '2', name: '晚餐' }],
|
||
foodTypeIndex:0,
|
||
foodApply:{
|
||
USER_ID: getStorage('userInfo').userId,
|
||
USER_NAME: getStorage('userInfo').userName,
|
||
LOCATION: '',
|
||
PHONE: getStorage('userInfo').telnumber,
|
||
ORG_ID: getStorage('userInfo').department_id,
|
||
ORG_NAME: getStorage('userInfo').departmentName,
|
||
NEAL_NUM: 1,
|
||
NEA_TYPE: '',
|
||
NEAL_TIME: ''
|
||
},
|
||
reportType:0,
|
||
reportList:[],
|
||
imgs:[],
|
||
showAlert:false,
|
||
submitFlag:true
|
||
};
|
||
},
|
||
watch: {
|
||
currentTabIndex: function(newVal, oldVal) {
|
||
if (newVal ==1) {
|
||
this.page = 1;
|
||
this.loadingType = 0;
|
||
this.dataList();
|
||
}else{
|
||
this.foodApply.LOCATION= '';
|
||
this.foodApply.NEAL_NUM= 1;
|
||
this.foodApply.NEA_TYPE= '';
|
||
this.foodApply.NEAL_TIME= '';
|
||
|
||
}
|
||
}
|
||
},
|
||
|
||
onLoad(option) {
|
||
this.currentTabIndex = option.currentTabIndex || 0;
|
||
},
|
||
onShow() {
|
||
if (this.currentTabIndex == 0) {
|
||
|
||
}else{
|
||
this.page = 1;
|
||
this.loadingType = 0;
|
||
this.dataList();
|
||
}
|
||
},
|
||
methods: {
|
||
dataList() {
|
||
let params = {
|
||
method: getWeekMeallist,
|
||
data: {
|
||
USER_ID:getStorage('userInfo').userId,
|
||
pageNum: this.page,
|
||
pageSize: this.pageSize,
|
||
}
|
||
};
|
||
callbackRequest(params).then(res => {
|
||
res = res.data;
|
||
if (res.returnCode == 1) {
|
||
if (this.page == 1) {
|
||
this.reportList = res.returnData || [];
|
||
console.log(this.reportList)
|
||
} else {
|
||
if (res.returnData.length > 0) {
|
||
this.reportList = this.reportList.concat(res.returnData);
|
||
this.loadingType = 0;
|
||
} else {
|
||
this.loadingType = 2;
|
||
}
|
||
}
|
||
} else {
|
||
alertTip(res.returnMsg);
|
||
}
|
||
});
|
||
},
|
||
submit() {
|
||
if(this.submitFlag){
|
||
this.submitFlag = false;
|
||
if (!this.foodApply.LOCATION) {
|
||
alertTip('请选择食堂');
|
||
this.submitFlag = true;
|
||
return false;
|
||
}
|
||
if(!this.foodApply.NEA_TYPE){
|
||
this.foodApply.NEA_TYPE = this.foodTypes[0].id;
|
||
}
|
||
// if (!this.foodApply.NEA_TYPE) {
|
||
// alertTip('请选择留餐类别');
|
||
// this.submitFlag = true;
|
||
// return false;
|
||
// }
|
||
if (!this.foodApply.NEAL_NUM || this.foodApply.NEAL_NUM==0) {
|
||
alertTip('请输入就餐人数,至少为1');
|
||
this.submitFlag = true;
|
||
return false;
|
||
}
|
||
if (!this.foodApply.NEAL_TIME) {
|
||
alertTip('请选择取餐时间');
|
||
this.submitFlag = true;
|
||
return false;
|
||
}
|
||
|
||
|
||
let params = {
|
||
method: addWeekMeal,
|
||
data: this.foodApply
|
||
};
|
||
callbackRequest(params).then(res => {
|
||
res = res.data;
|
||
if (res.returnCode == 1) {
|
||
this.submitFlag = true;
|
||
alertTip(res.returnMsg);
|
||
setTimeout(_ => {
|
||
this.currentTabIndex = 1;
|
||
}, 2000);
|
||
} else {
|
||
this.submitFlag = true;
|
||
alertTip(res.returnMsg);
|
||
}
|
||
});
|
||
}
|
||
|
||
},
|
||
changeNumber() {
|
||
console.log(this.foodApply.NEAL_NUM)
|
||
console.log(typeof(this.foodApply.NEAL_NUM))
|
||
if(Number(this.foodApply.NEAL_NUM)>0){
|
||
if(Number(this.foodApply.NEAL_NUM)>=1000){
|
||
setTimeout(()=>{
|
||
this.foodApply.NEAL_NUM = 1000;
|
||
},100)
|
||
}else if(Number(this.foodApply.NEAL_NUM)>0 && Number(this.foodApply.NEAL_NUM)<10){
|
||
this.foodApply.NEAL_NUM = this.foodApply.NEAL_NUM.replace('0',"");
|
||
}
|
||
}else{
|
||
setTimeout(()=>{
|
||
this.foodApply.NEAL_NUM = 0;
|
||
},100)
|
||
}
|
||
console.log(this.foodApply.NEAL_NUM)
|
||
},
|
||
|
||
formatFoodType(NEA_TYPE){
|
||
for(let i=0;i<this.foodTypes.length;i++){
|
||
let obj = this.foodTypes[i];
|
||
if(obj.id == NEA_TYPE){
|
||
return obj.name;
|
||
}
|
||
}
|
||
},
|
||
details: function(item) {
|
||
// console.log(item)
|
||
uni.navigateTo({
|
||
url: '/pages/foodMenu/foodStayDetail?id=' + item.ID
|
||
});
|
||
},
|
||
|
||
changeGenders(e) {
|
||
this.foodApply.LOCATION = e.detail.value;
|
||
},
|
||
changeUserType(e){
|
||
this.foodTypeIndex = e.detail.value;
|
||
this.foodApply.NEA_TYPE = this.foodTypes[this.foodTypeIndex].id;
|
||
},
|
||
},
|
||
onReachBottom() {
|
||
if (this.loadingType !== 0 || this.currentTabIndex == 0) {
|
||
return;
|
||
}
|
||
this.loadingType = 1;
|
||
this.page = this.page + 1;
|
||
this.dataList();
|
||
},
|
||
};
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
@import url('../../static/css/repair/malfunction-repair.css');
|
||
@import '@/static/css/common.scss';
|
||
.uni-textarea-textarea{
|
||
text-align:left
|
||
}
|
||
.nolist {
|
||
font-size: 30upx;
|
||
color: #797979;
|
||
text-align: center;
|
||
margin-top: 20upx;
|
||
}
|
||
|
||
|
||
.main {
|
||
margin: 180upx 40upx 0;
|
||
position: relative;
|
||
z-index: 10;
|
||
margin-bottom: 20upx;
|
||
.tab-box {
|
||
overflow: hidden;
|
||
// border-radius: 10upx 10upx 0 0;
|
||
// background: rgba(132, 149, 167, 0.8);
|
||
height: 80upx;
|
||
|
||
.tab-item {
|
||
float: left;
|
||
height: 70upx;
|
||
width: 30%;
|
||
font-size: 30upx;
|
||
// color: #e5f6ff;
|
||
// text-align: center;
|
||
line-height: 70upx;
|
||
}
|
||
|
||
.active {
|
||
// background: #fff;
|
||
color: #333;
|
||
border-radius: 10upx 10upx 0 0;
|
||
font-weight: bold;
|
||
}
|
||
.activeLine{
|
||
background: linear-gradient( 90deg, #50CBA1 0%, #06AEA6 100%), #5685F2;
|
||
border-radius: 10upx;
|
||
width: 80upx;
|
||
height: 10upx;
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
.list-content {
|
||
font-size: 28upx;
|
||
position: relative;
|
||
margin: 0 40rpx;
|
||
.details {
|
||
background: white;
|
||
padding: 0 15upx 15upx;
|
||
border-radius: 20upx;
|
||
margin-bottom: 20upx;
|
||
.detail_header {
|
||
border-bottom: #f8f8f8 5upx solid;
|
||
height: 100upx;
|
||
line-height: 100upx;
|
||
// margin: 0;
|
||
// border-radius: 10upx;
|
||
|
||
.blueSign {
|
||
height: 28upx;
|
||
width: 5upx;
|
||
background: #00c277;
|
||
display: inline-block;
|
||
margin-left: 20upx;
|
||
vertical-align: middle;
|
||
}
|
||
|
||
.font-tilte {
|
||
font-size: 32upx;
|
||
font-weight: bold;
|
||
margin-left: 20upx;
|
||
vertical-align: middle;
|
||
}
|
||
}
|
||
|
||
.detail_msg {
|
||
margin-left: 20upx;
|
||
border-radius: 10upx;
|
||
overflow: hidden;
|
||
view {
|
||
height: 60upx;
|
||
line-height: 60upx;
|
||
}
|
||
|
||
.status {
|
||
position: absolute;
|
||
color: red;
|
||
margin-left: 580upx;
|
||
margin-top: -15upx;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.statusgr {
|
||
float: right;
|
||
margin-right: 30upx;
|
||
color: #00c277;
|
||
}
|
||
|
||
.statusred {
|
||
width: 160upx;
|
||
height: 60upx;
|
||
line-height: 60upx;
|
||
text-align: center;
|
||
border-radius: 50upx;
|
||
float: right;
|
||
margin-right: 30upx;
|
||
margin-top: 25upx;
|
||
}
|
||
|
||
.img-box {
|
||
overflow: hidden;
|
||
padding-top: 20rpx;
|
||
padding-bottom: 10rpx;
|
||
|
||
.img-item {
|
||
float: left;
|
||
width: 200upx;
|
||
height: 200upx;
|
||
border: 1px solid #ddd;
|
||
margin: 0 22rpx 20upx 0upx;
|
||
position: relative;
|
||
box-sizing: border-box;
|
||
|
||
.img {
|
||
display: block;
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
|
||
.remove-btn {
|
||
position: absolute;
|
||
top: -18upx;
|
||
right: -18upx;
|
||
width: 44upx;
|
||
height: 44upx;
|
||
z-index: 2;
|
||
}
|
||
}
|
||
|
||
.upload-btn {
|
||
.img {
|
||
width: 60upx;
|
||
height: 60upx;
|
||
margin: unset;
|
||
}
|
||
}
|
||
}
|
||
.detail_msg .info-item {
|
||
font-size: 28upx;
|
||
margin-right: 30upx;
|
||
text {
|
||
display: inline-block;
|
||
width: 140upx;
|
||
color: #999;
|
||
}
|
||
|
||
.infoSpan {
|
||
width: auto;
|
||
font-size: 28upx;
|
||
color: #999;
|
||
float: right;
|
||
}
|
||
}
|
||
.form-box {
|
||
background: #fff;
|
||
.form-item {
|
||
overflow: hidden;
|
||
border-bottom: 1px solid #eee;
|
||
padding: 30upx 20upx;
|
||
.label {
|
||
float: left;
|
||
width: 150upx;
|
||
font-size: 28upx;
|
||
color: #333;
|
||
font-weight: bold;
|
||
line-height: 50upx;
|
||
}
|
||
.ipt-box {
|
||
margin-left: 160upx;
|
||
input {
|
||
width: 100%;
|
||
height: 50upx;
|
||
line-height: 50upx;
|
||
font-size: 26upx;
|
||
color: #666;
|
||
}
|
||
}
|
||
.select {
|
||
.arrow {
|
||
float: right;
|
||
width: 16upx;
|
||
height: 29upx;
|
||
margin-top: 10upx;
|
||
}
|
||
.picker {
|
||
height: 50upx;
|
||
line-height: 50upx;
|
||
font-size: 26upx;
|
||
color: #666;
|
||
margin-left: 10upx;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.comment-btn {
|
||
float: right;
|
||
font-size: 24upx;
|
||
border-radius: 10upx;
|
||
color: #fff;
|
||
// line-height: 30upx;
|
||
text-align: center;
|
||
min-width: 120upx;
|
||
margin-right: 30upx;
|
||
background-color: #00c277;
|
||
padding:0px 20upx
|
||
}
|
||
.common-shade{
|
||
position:fixed;
|
||
top:0;
|
||
left:0;
|
||
width:100%;
|
||
height:100vh;
|
||
background: rgba(0,0,0,0.7);
|
||
z-index:9999;
|
||
}
|
||
|
||
.box {
|
||
display: flex;
|
||
display: -webkit-flex;
|
||
}
|
||
|
||
.box-row-reverse {
|
||
flex-direction: row;
|
||
}
|
||
|
||
/*上下排列*/
|
||
.box-column {
|
||
flex-direction: column;
|
||
}
|
||
|
||
/*上下排列*/
|
||
.box-left {
|
||
justify-content: flex-start;
|
||
}
|
||
|
||
/*居右*/
|
||
.box-right {
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
/*居左*/
|
||
.box-center {
|
||
justify-content: center;
|
||
}
|
||
|
||
/*居中*/
|
||
.box-between {
|
||
justify-content: space-between;
|
||
}
|
||
|
||
/*两端对齐*/
|
||
.box-align-center {
|
||
align-items: center;
|
||
}
|
||
|
||
.box-wrap {
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
</style>
|