<template>
|
<view class="content">
|
<view class="">
|
<image class="logo" src="../../static/images/w-home.png"></image>
|
</view>
|
|
<view>
|
<view>
|
<u--form class="m1" labelPosition="left" :model="model1" :labelStyle="labelStyle" ref="form1">
|
<u-form-item class="u-form-item__body" label="库区名称:" labelWidth="100" prop="deptName"
|
@click="selectDept" ref="item1">
|
<u--input v-model="model1.deptName" placeholder="请选择库区名称" fontSize="35rpx" disabled>
|
</u--input>
|
</u-form-item>
|
|
</u--form>
|
|
<u-picker :show="showDept" :columns="dept" closeOnClickOverlay @confirm="deptConfirm"
|
@cancel="deptClose" @close="deptClose" keyName="deptName" immediateChange ></u-picker>
|
</view>
|
</view>
|
<view class="index-btn">
|
<ul class="mui-table-view mui-grid-view mui-grid-9">
|
<li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
|
<a @click="goPage('/pages/booking/outbound')">
|
<span class="iconfont icon-chuku f1"></span>
|
<view class="mui-media-body">出库预约</view>
|
</a>
|
</li>
|
<li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
|
<a @click="goPage('/pages/booking/warehousing')">
|
<span class="iconfont icon-ruku"></span>
|
<view class="mui-media-body">入库预约</view>
|
</a>
|
</li>
|
<li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
|
<a @click="goPage('/pages/booking/repast')">
|
<span class="iconfont icon-jiucan"></span>
|
<view class="mui-media-body">就餐预约</view>
|
</a>
|
</li>
|
<li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
|
<a @click="goRecord('../record/inAndOut')">
|
<span class="iconfont icon-jilu"></span>
|
<view class="mui-media-body">预约记录</view>
|
</a>
|
</li>
|
</ul>
|
</view>
|
</view>
|
</template>
|
<script>
|
export default {
|
data() {
|
return {
|
model1: {
|
deptId: '',
|
deptName: '',
|
openid: ''
|
},
|
showDept: false,
|
index: 0,
|
dept: [
|
|
],
|
labelStyle:{
|
fontSize: '19px'
|
},
|
rules: {
|
deptName: {
|
type: 'string',
|
required: true,
|
min: 1,
|
message: '请选择库区',
|
trigger: ["change", "blur"],
|
}
|
}
|
|
}
|
},
|
|
|
onReady() {
|
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
|
this.$refs.form1.setRules(this.rules)
|
},
|
onLoad() {
|
|
|
uni.login({
|
onlyAuthorize: true,
|
success: (res) => {
|
console.log(res.code, "login")
|
// uni.setStorageSync("program_code",JSON.parse(res.code))
|
uni.request({
|
url: 'https://app.fzzygf.com/igds-wx/gateway',
|
data: {
|
interfaceId: '2001',
|
data: {
|
code: res.code
|
}
|
},
|
method: 'POST',
|
header: {
|
'Content-Type': 'application/json'
|
},
|
success: (obj) => {
|
console.log(obj,"obj")
|
this.model1.openid = obj.data.data.openid
|
this.model1.deptId = obj.data.data.deptId
|
this.model1.deptName = obj.data.data.deptName
|
uni.request({
|
url: 'https://app.fzzygf.com/igds-wx/gateway',
|
data: {
|
interfaceId: '2002',
|
outId:'',
|
reqDateTime:'',
|
data: {
|
openid: this.model1.openid
|
}
|
},
|
method: 'POST',
|
header: {
|
'Content-Type': 'application/json'
|
},
|
success: (res) => {
|
if (res.data.code == "0000") {
|
this.dept.push(res.data.data)
|
console.log(this.dept, "dept")
|
} else{
|
uni.$u.toast("请求库区名失败")
|
}
|
},
|
})
|
},fail: (obj) => {
|
uni.$u.toast("用户添加失败")
|
}
|
})
|
}
|
})
|
|
},
|
onShow() {},
|
methods: {
|
//选择库区
|
selectDept() {
|
console.log(this.dept, "selectDept")
|
|
// console.log(JSON.stringify(this.dept[0]))
|
this.showDept = true
|
|
},
|
//关闭客户名称的下拉框
|
deptClose() {
|
this.showDept = false
|
this.$refs.form1.validateField('deptName')
|
},
|
//点击客户名称确认键触发该事件
|
deptConfirm(e) {
|
this.showDept = false
|
this.index = e.indexs[0]
|
this.model1.deptName = this.dept[0][e.indexs[0]].deptName
|
this.model1.deptId = this.dept[0][e.indexs[0]].deptId
|
this.$refs.form1.validateField('deptName')
|
|
|
//进行提交
|
uni.request({
|
url: 'https://app.fzzygf.com/igds-wx/gateway',
|
data: {
|
interfaceId: '2003',
|
data: this.model1
|
},
|
method: 'POST',
|
header: {
|
'Content-Type': 'application/json'
|
},
|
success: (res) => {
|
if (res.data.code == "0000") {
|
console.log(this.dept, "dept")
|
} else{
|
uni.$u.toast(res.data.msg)
|
}
|
},fail: (res) => {
|
uni.$u.toast(res.data.msg)
|
}
|
})
|
},
|
|
//跳转页面,e为需要跳转到的页面路径
|
goPage(e) {
|
|
// 如果有错误,会在catch中返回报错信息数组,校验通过则在then中返回true
|
this.$refs.form1.validate().then(res => {
|
uni.navigateTo({
|
url: e
|
}),
|
//保存数据需要使用同步的方法,不然在下一个页面可以获取数据,但不能把数据绑定到页面上
|
//此方法需要放在uni.navigateTo的下面,不然无法跳转
|
uni.setStorageSync('dept', JSON.stringify(this.model1))
|
console.log(JSON.stringify(this.model1))
|
}).catch(errors => {
|
uni.$u.toast('请选择库区')
|
})
|
|
},
|
goRecord(e) {
|
uni.navigateTo({
|
url: e
|
}),
|
//保存数据需要使用同步的方法,不然在下一个页面可以获取数据,但不能把数据绑定到页面上
|
//此方法需要放在uni.navigateTo的下面,不然无法跳转
|
uni.setStorageSync('dept', JSON.stringify(this.model1))
|
console.log(JSON.stringify(this.model1))
|
},
|
hideKeyboard() {
|
uni.hideKeyboard()
|
}
|
|
|
}
|
}
|
</script>
|
|
|
<style lang="scss" scoped>
|
.content {
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
padding: 0 5rpx;
|
|
.m1 {
|
width: 730rpx;
|
background-color: #FFFFFF;
|
}
|
|
|
|
.u-form-item__body {
|
flex-direction: column;
|
padding: 5rpx 10rpx;
|
}
|
|
|
.uni-list {
|
width: 730rpx;
|
|
.uni-list-cell {
|
line-height: 70rpx;
|
|
.uni-list-cell-left {
|
padding: unset;
|
margin-right: 100rpx;
|
font-size: 1.3rem;
|
|
.m01 {
|
-webkit-padding-start: 10rpx;
|
-webkit-margin-before: 0px;
|
|
.m02 {
|
padding: 0 5rpx;
|
display: flex;
|
justify-content: space-between;
|
box-sizing: border-box;
|
|
.m03 {
|
padding-left: 5rpx;
|
}
|
}
|
}
|
}
|
|
.uni-list-cell-db {
|
.uni-input {
|
padding: unset;
|
font-size: 1.3rem;
|
}
|
}
|
}
|
}
|
|
.index-btn {
|
width: 730rpx;
|
margin-top: 5rpx;
|
|
.mui-grid-view {
|
.mui-grid-9 {
|
.mui-table-view-cell {
|
border: 1rpx solid #bbb;
|
margin: 1.5% 1.5% 1.5% 1.5%;
|
background: #FFFFFF;
|
}
|
}
|
}
|
|
.mui-col-sm-3 {
|
width: 28%;
|
}
|
.mui-col-xs-4 {
|
width: 28%;
|
}
|
.mui-grid-view.mui-grid-9 .mui-table-view-cell
|
{
|
margin: 0;
|
padding: 11rpx 15rpx;
|
|
vertical-align: top;
|
|
border-right: 1px solid #eee;
|
border-bottom: 1px solid #eee;
|
}
|
.mui-grid-view.mui-grid-9 .mui-table-view-cell>a:not(.mui-btn) {
|
padding: 40rpx 0;
|
}
|
|
.mui-table-view.mui-grid-view .mui-table-view-cell .mui-media-body {
|
margin-top: 30rpx;
|
}
|
|
}
|
}
|
|
.logo {
|
display: flex;
|
justify-content: center;
|
height: 430rpx;
|
width: 730rpx;
|
}
|
|
page {
|
background-color: #d7d9dd;
|
}
|
</style>
|