call.vue
6.27 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<template>
<view>
<view class="header">
<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">
<picker @change="locationPickerChange" :value="locationIndex" :range-key="'code'" :range="locationArr">
<view class="u-f u-f-aic fr">
<view class="uni-input"><text class="placeholder-color" v-if="locationIndex == -1">请选择</text><text v-else>{{locationArr[locationIndex].code}}</text></view>
</view>
</picker>
</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="containerCode" :disabled="true" />
</view>
</view>
</view>
<view class="center">
<view class="common u-f u-f-jcsb plr-10">
<view>
物料
</view>
<view class="num">
合计数量:{{materialTotal}}
</view>
</view>
<view class="select-content">
<view class="select-list u-f u-f-jcsb u-f-aic plr-10" v-for="(item,index) in materialArr" :key="index">
<view class="left-content">
<view class="name">
{{item.materialName}}
</view>
<view class="code">
编号:{{item.materialCode}}
</view>
<view class="total">
<text class="mr">数量:{{item.qty}},</text><text class="mr">重量:{{item.weight}},</text>单位:{{item.materialUnit}}
</view>
</view>
<view class="spec u-f u-f-aic">
<text class="model">型号:{{item.materialSpec}}</text>
<uni-icons type="arrowright" size="18" color="gray"></uni-icons>
</view>
</view>
</view>
</view>
</view>
<view class="footer u-f u-f-aic">
<button class="btn" :loading="loading" type="warn" @tap="save" :disabled="disabled">保存</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
loading: false,
disabled: false,
containerCode: '',
destinationLocation: '',
locationIndex: -1,
locationArr: [],
materialArr: [],
materialTotal: null,
companyCode: '',
timer: null
}
},
onLoad() {
this.$http.inventory.pickLocation().then(res => {
console.log(res)
this.locationArr = res.data.data
});
try {
const value = uni.getStorageSync('userData').companies;
if (value) {
this.companyCode = value.toString()
}
} catch (e) {
// error
}
},
onUnload() {
if (this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
},
methods: {
// 库位号选择点击
locationPickerChange(e) {
this.locationIndex = e.target.value;
this.destinationLocation = this.locationArr[this.locationIndex].code;
this.containerCode = this.locationArr[this.locationIndex].containerCode;
this.materialTotal = null;
this.$http.inventory.inventoryDetailList({containerCode:this.containerCode}).then(res => {
console.log(res)
this.materialArr = res.data.rows;
this.materialArr.forEach(item => {
this.materialTotal += item.qty;
});
})
},
// 保存按钮操作
save() {
if (this.loading) {
return false;
}
if (!this.destinationLocation) {
uni.showModal({
title: '提示',
content: '库位号不能为空!',
showCancel: false
});
return
}
let params = {
containerCode: this.containerCode,
destinationLocation: this.destinationLocation,
type: 200,
companyCode: this.companyCode,
};
this.loading = true;
this.disabled = true;
this.$http.task.callBox(params).then(res => {
console.log(res);
if (res.data.code == 200) {
this.loading = false;
this.disabled = false;
this.$msg('保存成功!');
this.timer = setTimeout(() => {
uni.redirectTo({
url: 'fast?empty'
});
},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>
.header {
overflow-y: auto;
padding-bottom: 140rpx;
.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;
}
}
}
}
.center {
margin: $uni-spacing-col-base 0;
background-color: $uni-bg-color;
.common {
height: 90rpx;
line-height: 90rpx;
font-size: $uni-font-size-lg;
border-bottom: 2rpx solid $uni-border-color;
.num {
color: $uni-color-primary;
font-size: $uni-font-size-base;
}
}
.select-content {
.select-list {
height: 170rpx;
background-color: $uni-bg-color;
border-bottom: 2rpx solid $uni-border-color;
.left-content {
.name {
font-size: $uni-font-size-lg;
font-weight: bold;
}
.code,
.total {
margin-top: $uni-spacing-col-sm;
}
.code {
color: $uni-text-color-gray;
}
.total {
color: $uni-color-primary;
.mr {
margin-right: $uni-spacing-row-sm;
}
}
}
.spec {
color: $uni-text-color-gray;
.model {
margin-right: $uni-spacing-row-sm;
}
.uni-icons {
margin-right: -5px;
}
}
}
}
}
}
.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;
}
}
</style>