deaerationList.vue
6.04 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
<template>
<view class="container">
<Navbar title="退瓶列表" :canBack="true"></Navbar>
<view class="" v-show="!isScan">
<view class="lineCss">
<u-line></u-line>
</view>
<view class="searchCss flex justify-between">
<view class="flex">
<u-search v-model="keyword" bgColor="#fff" borderColor="#EC1E19" :clearabled="true"
placeholder="请输入气瓶条码搜索" :actionStyle="actionStyle" @custom="onSearch"></u-search>
</view>
<view class="flex" @click="openScan">
<u-icon name="scan" size="25"></u-icon>
</view>
</view>
<view class="gasCardCss usuallyCard" v-for="(item,index) in gasBottleList" :key="`${$assignKeys(item.id)}`">
<view class="flex flex-direction">
<view class="flex justify-between align-center">
<view class="text-lg">
气瓶条码:{{item.fQptm}}
</view>
<view class="">
<u-tag :text="item.fZt" :bgColor="item.fZt=='使用中'?'#E6F7F7':'#fff6e6'"
:color="item.fZt=='使用中'?'#00AEAA':'#ffa500'"
:borderColor="item.fZt=='使用中'?'#E6F7F7':'#fff6e6'"></u-tag>
</view>
</view>
<view class="flex justify-between align-center margin-top">
<view class="text-gray">
气瓶规格:<text class="text-black">{{item.fQpgg}} {{item.fCzjz}} </text>
</view>
<view class="text-gray">
气瓶重量:<text class="text-black">{{item.fQpgg}}</text>
</view>
</view>
<view class="flex justify-between align-center margin-top-sm">
<view class="text-gray">
安装时间:{{item.fCjsj}}
</view>
</view>
<u-divider></u-divider>
<view class="flex justify-between align-center">
<view class="flex flex-direction">
<view class="text-gray">
供应商家:<text class="text-black">{{item.fAzczmc}}</text>
</view>
<view class="text-gray margin-top-xs">
对应单号:{{item.fDddh}}
</view>
</view>
<!-- <view class="flex" v-if="current === 0">
<u-button plain shape="circle" style="height: 30px;" color="#EA5504">退瓶</u-button>
</view> -->
</view>
</view>
</view>
</view>
<u-empty mode="list" icon="http://cdn.uviewui.com/uview/empty/list.png" v-if="!gasBottleList.length"></u-empty>
<u-loadmore :status="status" marginTop="20" height="10" marginBottom="10" v-else />
<ScanCode ref="scanCode" @scanCode="getCode" @close="closeScanWindow"></ScanCode>
</view>
</template>
<script>
export default {
name: 'deaerationList',
components: {},
props: {
},
data() {
return {
// statusList: [{
// name: `在用气瓶(0)`,
// id: 1
// }, {
// name: '历史用气(0)',
// id: 2
// }],
total: null,
gasBottleList: [],
status: "loadmore",
activeStyle: {
'color': '#EA5707',
'fontSize': '16px',
'fontWeight': 'bold'
},
itemStyle: {
'width': '50%',
'height': '50px',
},
actionStyle: {
'color': '#fff',
'background': '#EC1E19',
'borderRadius': "15px",
'width': '60px',
'height': '25px',
'line-height': '25px',
},
keyword: "",
current: 0,
stats: {
zyqp: 0,
ydqp: 0,
},
pageParams: {
current: 1,
size: 10,
tabCurrent: '已归还'
},
isScan: false
}
},
computed: {
},
onShow() {},
async onLoad(options) {
this.pageParams.current = 1;
await this.getGasBottleData();
uni.$on('scanCode', (code) => {
console.log("获取code", code);
this.keyword = code;
this.getCode(code);
});
},
onPullDownRefresh() {
this.gasBottleList = []
//调用获取数据方法
this.getGasBottleData()
setTimeout(() => {
//结束下拉刷新
uni.stopPullDownRefresh();
}, 500);
},
onReachBottom() {
let allTotal = this.pageParams.current * this.pageParams.size
if (allTotal < this.total) {
//当前条数小于总条数 则增加请求页数
this.pageParams.current++;
this.status = 'loading';
setTimeout(() => {
this.getGasBottleData()
}, 500)
} else {
this.status = 'nomore'
// console.log('已加载全部数据')
}
},
methods: {
async getGasBottleData() {
let params = {
size: 10,
current: this.pageParams.current,
zt: this.pageParams.tabCurrent
}
if (this.keyword) {
params.qptm = this.keyword;
}
let result = await this.$api.gasBottleApi.getGasBottleList(params);
let {
code,
value
} = result;
if (code == 200) {
let {
current,
records,
size,
total
} = value;
let allTotal = this.pageParams.current * this.pageParams.size
this.total = total
const newlist = records;
if (this.pageParams.current === 1) {
this.gasBottleList = newlist;
} else {
this.gasBottleList.push(...newlist)
}
if (this.gasBottleList.length < allTotal) {
this.status = 'nomore'
}
}
},
onSearch(e) {
this.getGasBottleData();
},
async getCode(code) {
let query = {
qptm: code
}
const result = await this.$api.gasApi.getDetailByQuery(query);
let {
state,
message
} = result;
this.$modal.closeLoading();
if (!state) {
uni.$u.toast(message)
return;
}
this.keyword = code;
this.$refs.scanCode.close();
this.initQuery();
},
//初始化搜索
async initQuery() {
this.pageParams.current = 1;
await this.getGasBottleData();
},
openScan() {
//组件模式
// this.isScan = true;
// this.$refs.scanCode.open();
uni.navigateTo({
url: "/pages/scan/scanCode?mode=2"
})
},
closeScanWindow() {
this.isScan = false;
}
}
}
</script>
<style lang="scss" scoped>
.container {
padding-bottom: 10px;
// background-color: #f1f1f1 !important;
}
.searchCss {
// margin: 10px;
padding: 10px;
background: #fff;
}
.gasCardCss {
margin: 10px;
padding: 20px 10px;
}
/deep/.u-search__content {
width: 85vw;
padding-right: 70px;
}
/deep/.u-search__action {
position: absolute;
right: 15%;
}
</style>