gasCylinderOutbound.vue
8.09 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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
<template>
<view class="container">
<Navbar title="气瓶出库" bgColor="#EA5504" leftIconColor="#fff" textColor="#fff" canBack></Navbar>
<view class="topBodyCss">
<view class="padding-lg flex justify-between">
<view class="">
<view class="text-white">
出库前需确认出库气瓶信息是否准确
</view>
<view class="text-white margin-top-lg">
类型:气瓶出库
</view>
</view>
<view class="">
<u-image width="100px" height="90px" src="/static/images/gas-icon/receiveBg.png"></u-image>
</view>
</view>
<view class="usuallyCard topCardCss">
<view class="text-sm text-bold">
出库接收车辆信息
</view>
<view class="flex margin-top">
<view class="w20 text-gray">
接收车辆
</view>
<view class="w70" @click="pickerCl">
{{clpz}}
</view>
<view class="" @click="pickerCl">
<u-icon name="arrow-right"></u-icon>
</view>
</view>
<view class="flex margin-top">
<view class="w20 text-gray">
车辆类型
</view>
<view class="w70">
{{cllx}}
</view>
</view>
</view>
<view class="CardCss">
<view class="">
<u-tabs :list="list" lineColor="#EA5504" :activeStyle="{fontSize:'18px',fontWeight:'bold'}"
:current="current" :itemStyle="{width:'50%',height:'50px'}" @change="tabChange"></u-tabs>
</view>
<view class="qpCardCss">
<view class="qpTopCss flex justify-between align-center padding-lg">
<view class="">
气瓶条码
</view>
<view class="">
操作
</view>
</view>
<view class="" v-if="!current">
<view class="qpItemCss flex justify-between align-center padding-lr-lg padding-tb-sm"
v-for="(item,index) in kpck" :key="index">
<view class="">
{{item}}
</view>
<view class="">
<u-icon name="trash"></u-icon>
</view>
</view>
<view class="text-center padding" v-if="!kpck.length">
扫码添加条码
</view>
</view>
<view class="" v-else>
<view class="qpItemCss flex justify-between align-center padding-lr-lg padding-tb-sm"
v-for="(item,index) in mpck" :key="index">
<view class="">
{{item}}
</view>
<view class="">
<u-icon name="trash"></u-icon>
</view>
</view>
<view class="text-center padding" v-if="!mpck.length">
扫码添加条码
</view>
</view>
</view>
</view>
<view class="btnCss">
<view class="roundBtnCss flex flex-direction" @click="handleCode">
<view class="">
<u-icon name="scan" color="#fff" size="45"></u-icon>
</view>
<view class="">
{{current?'满瓶出库':'空瓶出库'}}
</view>
</view>
<view class="w90 margin-top" @click="handleSubmit">
<u-button color="#EA5504">全部出库</u-button>
</view>
</view>
</view>
<u-picker :show="pickerShow" :columns="columns" keyName="label" @cancel="pickerShow = false"
@confirm="handleConfirm" closeOnClickOverlay @close="pickerShow = false"></u-picker>
</view>
</template>
<script>
export default {
components: {},
props: {
},
data() {
return {
current: 0,
list: [{
name: '空瓶出库'
},
{
name: '满瓶出库'
},
],
clpz: "",
cllx: "",
clId: "",
kpck: [],
mpck: [],
kpckList:[],
mpckList:[],
columns: [],
pickerShow: false,
}
},
computed: {
},
onLoad() {
this.initData();
uni.$on('scanCode', (code,name,fQptmObj) => {
if (name === 'gasCylinderOutbound') {
console.log("气瓶对象",fQptmObj);
// if (this.current) {
// if (!this.mpck.includes(code)) {
// this.mpck.push(code);
// this.mpckList.push(fQptmObj);
// } else {
// setTimeout(() => {
// uni.$u.toast('已录入');
// }, 100)
// }
// } else {
// if (!this.kpck.includes(code)) {
// this.kpck.push(code);
// this.kpckList.push(fQptmObj);
// } else {
// setTimeout(() => {
// uni.$u.toast('已录入');
// }, 100)
// }
// }
if (!this.mpck.includes(code) && !this.kpck.includes(code)) {
this.current ? this.mpck.push(code) : this.kpck.push(code)
this.current ? this.mpckList.push(fQptmObj) : this.kpckList.push(fQptmObj)
} else {
uni.$u.toast(`已录入`);
// setTimeout(() => {
// if(this.mpck.includes(code)){
// uni.$u.toast(`满瓶已录入`);
// }else if(this.kpck.includes(code)){
// uni.$u.toast(`空瓶已录入`);
// }
// }, 100)
}
this.changeState();
}
});
},
methods: {
changeState() {
this.list[0].name = `空瓶出库(${this.kpck.length})`
this.list[1].name = `满瓶出库(${this.mpck.length})`;
},
async initData() {
// 查询车辆信息
let query = {
page: 1,
size: 10
}
const result = await this.$api.employeeApi.getClxxPage(query);
let {
code,
state,
value
} = result;
if (state && code === 200) {
let {
records
} = value;
let data = records.map(res => {
return {
type: res.fCllx,
label: res.fCph,
value: res.id
}
})
this.columns.push(data);
if (this.columns.length) {
this.cllx = this.columns[0][0].label
this.clpz = this.columns[0][0].type
this.clId = this.columns[0][0].value;
}
console.log("车辆信息", this.columns);
}
},
tabChange(e) {
this.current = e.index;
},
handleCode() {
// 组件扫码
// this.$refs.scanCode.open();
let lx = this.current ? 'mpck' : 'kpck';
uni.navigateTo({
url: '/pages/scan/scanCode?mode=2&lx=' + lx
})
},
// 打开车辆选择
pickerCl() {
this.pickerShow = true;
},
handleConfirm(e) {
console.log(e);
let temp = e.value[0];
this.clId = temp.value;
this.cllx = temp.type;
this.clpz = temp.label;
console.log("选择车辆id", this.clId);
this.pickerShow = false;
},
async handleSubmit() {
if (!this.clId) {
uni.$u.toast('请先选择车辆');
return;
}
if (!this.kpck.length && !this.mpck.length) {
uni.$u.toast('请先扫码添加条码');
return;
}
// let queryParams = {
// czlx:''
// kpck: this.kpck,
// mpck: this.mpck,
// clId: this.clId
// }
// const result = await this.$api.gasApi.submitQpcrk(queryParams);
// console.log("提交出库");
let queryParams = {
czlx: "ck",
mpckList: this.mpckList,
kpckList: this.kpckList,
clId: this.clId
}
console.log("提交出库", queryParams);
const result = await this.$api.gasApi.savaLiquefiedGasBottle(queryParams);
let {
code,
state,
message
} = result;
if (state && code === 200) {
uni.$u.toast("全部出库成功");
this.kpck = [];
this.mpck = [];
this.mpckList = [];
this.kpckList = [];
this.changeState();
} else {
uni.$u.toast(message)
}
}
}
}
</script>
<style lang="scss" scoped>
.topBodyCss {
height: 316px;
background: #EA5504;
.topCardCss {
margin: 0 12px 10px 12px;
padding: 15px 10px;
}
.CardCss {
width: calc(100% - 24px);
position: absolute;
margin: 0 12px;
background: #fff;
border-radius: 15px;
padding-bottom: 20px;
overflow-y: scroll;
padding-bottom: 180px;
}
.qpCardCss {
margin: 0 12px;
border: 1px solid #FBDDCD;
border-radius: 8px 8px 0 0;
overflow-y: scroll;
.qpTopCss {
background: #FBDDCD;
height: 30px;
border-radius: 8px 8px 0 0;
}
.qpItemCss {
border-bottom: 1px solid #FBDDCD;
}
}
.btnCss {
position: fixed;
bottom: 0;
height: 120px;
width: 100%;
background: #fff;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.roundBtnCss {
position: absolute;
top: -50px;
width: 85px;
height: 85px;
border-radius: 50%;
background: #EA5504;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
}
}
}
</style>