empty.vue
2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<template>
<view>
<view class="content-top">
<view class="content-item u-f u-f-aic plr-10">
<view class="title require u-f1">
容器号
</view>
<view class="inp u-f3">
<input v-model="form.containerCode" placeholder="请输入" />
</view>
</view>
<view class="content-item u-f u-f-aic plr-10">
<view class="title u-f1">
库位号
</view>
<view class="inp u-f3">
<input v-model="form.destinationLocation" placeholder="请输入" />
</view>
</view>
</view>
<view class="footer u-f u-f-aic">
<button hover-class="none" class="btn u-f u-f-jcc u-f-aic" :loading="loading" type="warn" @tap="save"
:disabled="disabled">保存</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
loading: false,
disabled: false,
form: {
containerCode: '',
destinationLocation: '',
},
timer: null
}
},
onUnload() {
if (this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
},
methods: {
// 保存按钮操作
save() {
if (this.loading) {
return false;
}
if (!this.form.containerCode.trim()) {
uni.showModal({
title: '提示',
content: '请输入容器号!',
showCancel: false
});
return
}
this.loading = true;
this.disabled = true;
this.$api.task.createEmptyIn(this.form).then(res => {
if (res.data.code == 200) {
this.$wx.showToast({
title: '保存成功!'
});
this.timer = setTimeout(() => {
uni.redirectTo({
url: 'empty?empty'
});
this.loading = false;
this.disabled = false;
}, 400);
} else {
uni.showModal({
title: '提示',
content: res.data.msg
});
this.loading = false;
this.disabled = false;
}
}).catch(err => {
this.loading = false;
this.disabled = false;
})
}
}
}
</script>
<style lang="scss" scoped>
.content-top {
background-color: $uni-bg-color;
.content-item {
height: 90rpx;
line-height: 90rpx;
border-bottom: 2rpx solid $uni-border-color;
.title {
font-size: $uni-font-size-lg;
}
.inp {
text-align: right;
font-size: $uni-font-size-lg;
/deep/ uni-radio .uni-radio-input {
margin-right: 0;
}
.picker {
justify-content: flex-end;
}
}
.require {
position: relative;
// padding-left: 10rpx;
&::after {
position: absolute;
content: '*';
color: red;
font-size: 48rpx;
top: 6rpx;
left: -20rpx;
}
}
}
}
.footer {
position: fixed;
bottom: 0;
width: 100%;
height: 140rpx;
background-color: #fff;
border-top: 2rpx solid #E1F3D8;
.btn {
width: 100%;
height: 80rpx;
line-height: 80rpx;
color: #fff;
text-align: center;
font-size: $uni-font-size-lg;
border-radius: 50rpx;
margin: 0 30rpx;
background-color: $uni-color-primary;
&:after {
border: none;
}
}
}
</style>