batch.vue
5.88 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
<template>
<view>
<view class="header">
<uni-search-bar @confirm="search" @input="handleSearch" placeholder="输入入库单号"></uni-search-bar>
</view>
<view class='receipt-list'>
<template v-for="item in receiptList">
<view class="list-item p-15">
<view class="item-header u-f u-f-jcsb ">
<view class="left-content ">
<view class="code">
单号:{{item.code}}
</view>
<view>
入库仓库:{{warehouseCodeFormat(item.warehouseCode)}}
</view>
<view>
入库行数:{{item.totalLines}}
</view>
<view>
入库数量:{{item.totalQty}}
</view>
</view>
<view>
<uni-tag text="已完成" type="success" size="small" v-if="item.lastStatus == 800"></uni-tag>
<uni-tag text="未完成" type="error" size="small" v-else-if="item.lastStatus == 200"></uni-tag>
<uni-tag text="全部" type="primary" size="small" v-else></uni-tag>
</view>
</view>
<view class="item-footer u-f u-f-aic u-f-jcsb">
<view>
<uni-tag :text="receiptTypeFormat(item.receiptType)" type="warning" :inverted="true" size="small"></uni-tag>
</view>
<view class="time">
【{{item.createdBy}}】创建于{{formatDate(item.created)}}
</view>
</view>
</view>
</template>
<uni-load-more :iconSize="18" :status="loadStatus"></uni-load-more>
</view>
<uni-fab :pattern="pattern" :horizontal="'right'" :popMenu="false"
@fabClick="fabClick"></uni-fab>
<uni-drawer mode="right" ref="showDrawer" :width="320">
<view style="">
<view class="drawer-title">筛选</view>
<view class=""><uni-list>
<uni-list-item>
<view slot="header" class="slot-box"><text class="require">物料名称</text></view>
<template slot="footer">
<input class="uni-input" type="text" placeholder="请输入名称" />
</template>
</uni-list-item>
<uni-list-item>
<view slot="header" class="slot-box"><text class="require">物料编号</text></view>
<template slot="footer">
<input class="uni-input" type="number" placeholder="请输入编号" />
</template>
</uni-list-item>
<uni-list-item title="规格">
<template slot="footer">
<input class="uni-input" type="number" placeholder="请输入规格" />
</template>
</uni-list-item>
<uni-list-item title="单位">
<template slot="footer">
<input class="uni-input" type="number" placeholder="请输入单位" />
</template>
</uni-list-item>
<uni-list-item title="物料类型">
<template slot="footer">
<label class="radio"><radio value="r1" />成品</label>
<label class="radio"><radio value="r2" />原材料</label>
</template>
</uni-list-item>
</uni-list></view>
</view>
</uni-drawer>
</view>
</template>
<script>
export default {
data() {
return {
receiptList: [],
receiptTypeArr: [],
warehouseArr: [],
// 查询参数
queryParams: {
code: undefined,
companyCode: uni.getStorageSync("userData").companies.toString(),
pageNum: 1,
pageSize: 10
},
total: null,
loadStatus: "",
pattern: {
buttonColor: '#007aff'
},
}
},
onLoad() {
this.getReceiptList();
this.getReceiptTypeDict();
this.getWarehouse();
},
onNavigationBarButtonTap(e) {
this.$refs.showDrawer.open()
},
onPullDownRefresh() {
this.getReceiptList()
},
onReachBottom() {
if (this.queryParams.pageNum >= this.total / 10) {
this.loadStatus = "noMore";
return
}
this.loadStatus = "loading";
this.queryParams.pageNum++;
this.getReceiptList();
},
methods: {
//获取入库列表
getReceiptList() {
this.$http.receipt.searchReceiptInCondition(this.queryParams).then(res => {
console.log(res)
if (this.queryParams.pageNum > 1) {
this.receiptList = this.receiptList.concat(res.data.rows);
} else {
this.receiptList = res.data.rows;
}
this.total = res.data.total;
uni.stopPullDownRefresh();
})
},
// 顶部搜索
handleSearch(e) {
this.queryParams.code = e.value;
this.getReceiptList()
},
// 获取仓库字典数据
getWarehouse() {
let params = {
username: uni.getStorageSync('historyUser').username
}
this.$http.dict.getWarehouseByUserCode(params).then(res => {
this.warehouseArr = res.data.data
});
},
// 仓库字典翻译
warehouseCodeFormat(warehouseCode) {
return this.selectCommonLabel(this.warehouseArr, warehouseCode);
},
// 获取入库类型字典数据
getReceiptTypeDict() {
this.$http.dict.getReceiptType().then(res => {
console.log(res)
this.receiptTypeArr = res.data.data
})
},
// 入库类型字典翻译
receiptTypeFormat(receiptType) {
return ;
},
// 悬浮按钮点击
fabClick() {
uni.navigateTo({
url:"add"
})
}
}
}
</script>
<style lang='scss' scoped>
.header {
position: fixed;
top: 88rpx;
width: 100%;
z-index: 1;
border-bottom: 1px solid $uni-border-color;
}
.receipt-list {
margin: 126rpx 0;
.list-item {
margin-top: 20rpx;
padding-top: 20rpx;
background-color: $uni-bg-color;
.item-header {
.left-content {
color: $uni-text-color-gray;
.code {
color: $uni-text-color;
font-size: $uni-font-size-lg;
font-weight: bold;
}
.warehouse {
margin-top: 10rpx;
}
}
}
.item-footer {
hegiht: 90rpx;
line-height: 90rpx;
margin-top: 10rpx;
border-top: 2rpx solid #e5e5e5;
.time {
color: $uni-text-color-gray;
}
}
}
}
.drawer-title {
height: 88rpx!important;
line-height: 88rpx;
}
</style>