stock-taking-detail.vue
17.7 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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<template>
<div class="container resource close-left-menu">
<div class="pop-banner clearfix">
<div class="operate-btns">
<!--v-show='trmedplan.billstate=="PD1"'-->
<a class="fbtn fb-save" @click='submit(1)' v-if="trmedplan.billstate!='PD2'">保存盘点单</a>
<a class="fbtn fb-submit" @click='submit(2)' v-if="trmedplan.billstate!='PD2'">提交盘点单</a>
<a class="fbtn fb-del" @click='delect()'>删除盘点单</a>
</div>
<h3 class="current-module">盘点单明细</h3>
</div>
<!--purchase-month-plan start-->
<div class="purchase-month-plan">
<div class="pd-form mb-20">
<div class="group-row group-row-3">
<div class="form-group form-label">
<label for="cn1" class="label">盘点单号</label>
<div class="control">
<input type="text" id="cn1" readonly v-model="trmedplan.billno" class="inp4"> </div>
</div>
<div class="form-group form-label">
<label for="cn2" class="label">盘点日期</label>
<div class="control">
<input type="text" id="cn2" readonly :value="trmedplan.pddate | getYMD" class="inp4"> </div>
</div>
<div class="form-group form-label">
<label for="cn3" class="label"> 盘点库房</label>
<div class="control">
<input type="text" id="cn3" readonly v-model="trmedplan.depotname" class="inp4"> </div>
</div>
</div>
<div class="group-row group-row-3">
<div class="form-group form-label">
<label for="cn4" class="label">盘点状态</label>
<div class="control">
<input type="text" id="cn4" readonly :value="trmedplan.billstate | pdstate" class="inp4"> </div>
</div>
<div class="form-group form-label">
<label for="cn5" class="label">录入人</label>
<div class="control">
<input type="text" id="cn5" readonly v-model="trmedplan.operatername" class="inp3">
</div>
</div>
<div class="form-group form-label">
<label for="cn6" class="label">录入日期</label>
<div class="control">
<input type="text" id="cn6" readonly v-model="trmedplan.createTime|getYMD" class="inp4">
</div>
</div>
</div>
<div class="group-row group-row-3">
<div class="form-group form-label">
<label for="cn4" class="label">锁定库存</label>
<div class="control">
<input type="text" id="cn4" readonly :value="trmedplan.pdsource==1?'未锁定':'锁定' " class="inp4"> </div>
</div>
</div>
<div class="form-group form-label">
<label for="cn9" class="label">备 注</label>
<div class="control">
<textarea id="cn9" rows="1" :value="trmedplan.memo" class="inp2" v-if="trmedplan.billstate=='PD2'" readonly="readonly"></textarea>
<textarea id="cn9" rows="1" v-model="trmedplan.memo" class="inp2" v-else></textarea>
</div>
</div>
</div>
<!-- 已保存列表处理 -->
<table class="itable itable-thead-13px itable-td-long-text">
<thead id="t_header">
<tr>
<th class="w50">序号</th>
<th class="w150 ">商品名称</th>
<th class="w70">单价(元)</th>
<th class="w70">单位</th>
<th class="w100">库存数量</th>
<th class="w100">盘点数量</th>
<th class="w100">金额(元)</th>
<th class="w100">差异数量</th>
<th class="w120">批次号</th>
<th class="w120">批号/有效期</th>
</tr>
</thead>
<tbody>
<tr v-for='item in goodList' track-by="$index">
<td>
<div>{{$index+1}}</div>
</td>
<td class="t-left pr10">{{item.goodscode}}<br><span class="text-color-blue">{{item.goodsname}}</span><br>{{item.goodsspec}}<br>{{item.producer}}<br>{{item.registkey}}</td>
<td class="t-right v-top">{{item.price | numDigit 2 | numFmt}} </td>
<td>{{item.unit}}</td>
<td>{{item.number}}</td>
<td>
<input type="text" class="t-right" style='width:80px;' :value="item.storcknum" readonly="readonly" v-if="trmedplan.billstate=='PD2'">
<input type="text" class="t-right" style='width:80px;' v-model="item.storcknum" @input="inputNun(item.number,item.storcknum,$index)" v-else>
</td>
<td class="t-right v-top pr10">{{item.price * item.storcknum | numDigit 2 | numFmt}} </td>
<td>{{item.differencenum=item.number-item.storcknum}}</td>
<td class="t-left">{{item.stockbatchno}}</td>
<td>
<span class="text-color-yellow" v-if="sh[$index]">
{{item.lot}}<br>
{{item.productiondate|getYMD}}<br>
{{item.expiredate|getYMD}}
</span>
<span v-else>
{{item.lot}}<br>
{{item.productiondate|getYMD}}<br>
{{item.expiredate|getYMD}}
</span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="modal" v-if='modelFlag'>
<div class="container resource">
<div class="audit-detail" style="margin:200px auto;">
<span class="close-win" @click='close'></span>
<div class="fheader no-bottom" style="margin-left:100px;">
<h4 class="fh-book no-icon">盘点单【{{trmedplan.billno}}】已提交成功!</h4>
</div>
<div class="pd-form">
<a href="javascript:void(0);" class="button-green btn" style='margin:30px 0 0 200px;' @click='close'>确定</a>
</div>
</div>
</div>
</div>
<!--purchase-month-plan end-->
<!--提示 start-->
<div class="modal" v-if="showDialog">
<div class="container resource">
<div class="audit-detail" style="width:500px;margin-left:300px">
<span class="close-win" @click="closeModal()"></span>
<div class="sdiv-9-9b no-border pb0">
<p class="t-left" style="font-size: 16px;font-weight: bold;">
<span v-if="zeroList.length >0">
<span v-for="zero in zeroList">{{zero.goodsname}},</span>共计{{zeroList.length}}个品规数,盘点数量都为0!
</span>
</p>
</div>
<div class="status-process wbe-0 clearfix" style="padding:2px 20px">
<div class="sp-head sp-headb mb-0" style="font-size:16px;">
<p style="text-align: left;height: 30px;line-height: 30px;color: #7d7c7c;font-size: 16px;margin-top: 10px;">确定操作盘点单商品吗?</p>
<div class="w240" style="margin:0 auto;">
<button class="btn button-green fl mt-15" @click="closeModal()">取 消</button>
<button class="btn button-green fr mt-15" @click="commitos()">确 认</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!--提示 end-->
<div class="roll-bg" v-show='requestS'>
<div class="w60" style="margin:0 auto;">
<img src="/images/roll.gif">
</div>
<div class="container resource t-center text-color-red">
正在处理中,请勿关闭!
</div>
</div>
</div>
</template>
<script>
module.exports = {
data: function() {
return {
search: {
pageSize: 50,
page: 1,
totalPages: 0,
total: 0,
guid: '',
},
trmedplan: '',
goodList: [],
modelFlag: false,
billno: '',
sh:[],
showDialog:false,
zeroList:[],
mark:'',
requestS:false,
noSubmit:false,
showMsg:false,
};
},
methods: {
// 明细
getPdstockdetail: function() {
var self = this;
self.search.guid = this.$route.params.guid;
Ajax.post('/procurment/getPdstockdetail', self.search)
.then(function(response) {
var res = response.data.data;
if(response.data.errorCode == 0) {
self.$set('trmedplan', res.trmedpdstock);
self.$set('goodList', res.trmedpdstockdetails);
for (var i = 0; i < self.goodList.length; i++) {
var storcknum = self.goodList[i].storcknum
if(!storcknum && !(typeof storcknum == 'number' && storcknum==0)){//为false但不为0
self.goodList[i].storcknum = self.goodList[i].number;
}
}
self.sh = [];
for(var a=0;a<res.trmedpdstockdetails.length;a++){
self.sh.push(false);
var date1 = new Date();
var date2 = new Date(date1);
date2.setMonth(date1.getMonth()+6);
var times = date2.getFullYear()+"-"+(date2.getMonth()+1)+"-"+date2.getDate();
var mxListss = res.trmedpdstockdetails[a];
//有效期
var mxLists = mxListss.expiredate;
if(mxLists != null && mxLists != ''){
var da1 = mxLists.replace(/\-/gi,"/");
var da2 = times.replace(/\-/gi,"/");
}
var time1 = new Date(da1).getTime();
var time2 = new Date(da2).getTime();
if(time1 <= time2){
self.sh.splice(a,1,true);
}
}
} else {
self.MessageBox({
title: '提示',
message: data.message,
type: 'alert'
})
}
})
},
// 提交
submit: function(mark) {
var self = this;
self.mark = mark;
self.zeroList = [];
for(var a = 0; a < self.goodList.length; a++) {
var storcknum = self.goodList[a].storcknum;
if((typeof storcknum == "number" && storcknum == 0) || storcknum=="0"){
self.zeroList.push({
goodsguid:self.goodList[a].goodsguid,
goodsname:self.goodList[a].goodsname,
storcknum:storcknum
})
}
/*if(!self.goodList[a].storcknum) {
self.MessageBox({
title: '提示',
message: '请填写盘点数量',
type: 'alert'
})
return;
}*/
}
if(self.zeroList){
if(self.zeroList.length == 0){
self.submitDetail(mark);
}else{
self.showDialog = true;
}
}
},
submitDetail:function(mark){
var self = this;
var oParam = {
bjmark: mark,
memo: self.trmedplan.memo,
list: self.goodList,
}
self.requestS = true;
if(self.noSubmit){
return;
}
self.noSubmit = true;
Ajax.post('/procurment/commitPdstockdetail', oParam)
.then(function(response) {
var res = response.data.data;
self.requestS = false;
self.noSubmit = false;
if(response.data.errorCode == 0) {
if(mark == 1) {
self.MessageBox({
title: '提示',
message: '保存成功',
type: 'alert'
})
} else {
self.MessageBox({
title: '提示',
message: '提交成功',
type: 'alert'
}, function() {
self.$router.go({
'path': '/stockTaking'
});
})
}
} else {
self.MessageBox({
title: '提示',
message: response.data.message,
type: 'alert'
})
}
})
},
closeModal:function(){
var self = this;
self.showDialog = false;
},
commitos:function(){
var self = this;
self.showDialog = false;
self.submitDetail(self.mark);
},
inputNun: function(sum, pdnum, ind) {
var self = this,test = false;
if(!isNaN(pdnum)){//是数字
var storckval = parseFloat(pdnum);
var reg = /^[0-9]\d*$/;//非负整数,入库数和拒收数
test = reg.test(storckval);
}
if(!test) {
var index = ind;
if(self.showMsg){
return;
}
self.showMsg = true;
self.MessageBox({
title: '警告',
message: "请输入大于等于0的整数!",
type: 'alert'
}, function(action) {
if(action == 'confirm') {
self.showMsg = false;
self.$set('goodList[' + index + '].storcknum',sum);
}
});
}else{
self.$set('goodList[' + ind + '].differencenum', sum - pdnum);
}
},
delect: function() {
var self = this;
self.MessageBox({
title: '提示',
message: '确认删除盘点单吗?',
showCancelButton: true,
type: 'alert'
}, function(action) {
if(action == 'confirm') {
Ajax.post('/procurment/delPdstockdetail', {
guid: self.$route.params.guid
}).then(function (response) {
var res = response.data.data;
if (response.data.errorCode == 0) {
self.MessageBox({
title: '提示',
message: '删除成功',
type: 'alert'
}, function () {
self.$router.go({
'path': '/stockTaking'
});
})
} else {
self.MessageBox({
title: '提示',
message: data.message,
type: 'alert'
})
}
})
}
})
}
},
route: {
activate: function() {
this.getPdstockdetail();
}
},
};
</script>