supplier-new-product-adoption.vue
15 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
<template>
<div class="container resource close-left-menu contaNEW">
<div class="pop-banner clearfix">
<div class="operate-btns">
<a @click="acceptSupGoods()" class="fbtn fb-to-examine" >采纳商品</a>
<a @click="acceptContent()" class="fbtn fb-to-examine" >采纳供应关系</a>
<a @click="acceptLose()" class="fbtn fb-reject">忽略</a>
</div>
<h3 class="current-module">供应商新品采纳</h3>
</div>
<!--supply-supplylist start-->
<div class="supplylist clearfix supply-select">
<div class="supplylist-root pt0 w245">
<form class="search-bar" style="min-width: 215px;" active="###">
<div class="search-btn fr cur-poin" @click='getMedList'>
</div>
<input type="text" class="w163" maxlength="20" v-rule placeholder="输入供应商搜索" v-model="chinesename">
</form>
<div class="root-node-news">
<b class="fl w30 t-center">序号</b>
<b class="fl w180 t-center">供应商</b>
</div>
<div class="root-node-list" id="sortable" style='height: 480px;'>
<template v-for="(indexI,suplist) in getSupLists">
<div class="list-node" style='min-height:80px;line-height:25px;' :class="{ 'active': activeI == indexI }" @click="getMed(indexI,suplist.guid)">
<div class="fl w30 t-center">{{$index + 1}}</div><div class="fl w180 t-left"><a style="cursor: pointer;" title="{{ suplist.chinesename }}"><p class="fl f-size12 text-color-blue f-size14">{{ suplist.chinesename }}</p><br>
<span class="fl f-size12">{{ suplist.contacts }}</span><span class="fr f-size12">{{ suplist.contacttel }}</span></a></div>
</div>
</template>
</div>
</div>
<div class="supplylist-table ml-265">
<div class="fheader no-bottom pd0">
<h4 class="fh-good">商品列表</h4>
</div>
<table class="itable itable-thead-13px">
<thead>
<tr>
<th class="w30">
<div class="checkbox-control">
<input type="checkbox" :id="1" @click="selectAllsum(selectAllList)" v-model="selectAllList" :value="1">
<label class="checkbox" style="line-height: 19px;" :for="1">序号</label>
</div>
</th>
<th class="w150">商品信息</th>
<th class="w50">价格</th>
<th class="w50">单位</th>
<th class="w30"></th>
<th class="w150">单位转换系数</th>
<th class="w70">业务员</th>
</tr>
</thead>
<tbody>
<tr v-for="mFMedGoods in getMedcontentList">
<td
<div class="checkbox-control">
<input type="checkbox" :id="mFMedGoods.guid" v-model="checkArr" :value="mFMedGoods.guid">
<label class="checkbox" :for="mFMedGoods.guid">{{ $index + 1 }}</label>
</div>
</td>
<td><div class="t-left pr10">{{ mFMedGoods.goodscode }}<br>{{mFMedGoods.goodsname}}<br/>{{mFMedGoods.goodsspec}}<br/>{{mFMedGoods.producer}}<br/>{{mFMedGoods.registkey}}</div></td>
<td>
<input type="text" v-model='mFMedGoods.price | numDigit 2 | numFmt' class="t-right" @change="medCheckPrice(mFMedGoods.price, $index, 7)">
</td>
<td>{{ mFMedGoods.unitstyle}}</td>
<td>
<span class="ct-col w30">
<span class="table-detail-icon icon-green">医</span>
<span class="table-detail-icon icon-green mt-20">供</span>
</span>
</td>
<td>
<div style="width: 102px; height: 72px; border:1px solid #999999; border-radius:8px; margin-left: 53px;">
<div class="w50 fl">
<input type="text" v-model='mFMedGoods.purconverratio' class=""
style="border: 0px; height: 34px; border-radius: 8px 0px 0px 0px; box-shadow:none;"
@change="medCheckInfo(mFMedGoods.purconverratio, $index, 7)">
<p style="background: #999999; width: 40px;height: 34px; height: 1px; margin-left: 10px;"></p>
<input type="text" v-model='mFMedGoods.supconverratio'
style="border: 0px; border-radius: 0px 0px 0px 8px; box-shadow:none;"
@change="supCheckInfo(mFMedGoods.supconverratio, $index, 7)">
</div>
<div class="w50 fl">
<input type="text" v-model='mFMedGoods.purchaseunit' class="t-center"
style="border: 0px; height: 34px; border-radius: 0px 8px 0px 0px; box-shadow:none;"
>
<p style="background: #999999; width: 40px; height: 1px; margin-right: 10px; "></p>
<p class=" lh-34 h-34" style="background-color: #ffffff;border-radius:0px 0px 8px 0px;">{{mFMedGoods.supplyunit}}</p>
</div>
</div>
</td>
<td>{{ mFMedGoods.staffname}}</td>
</tr>
</tbody>
</table>
<div class="pagination m-20-0">
<em class="page">明细条目数【{{ search.total }}】</em>
<pagination
@page-change="getMedListClick"
:class="['m-20-0']"
:page-no.sync="search.page"
:total-pages.sync="search.totalPages">
</pagination>
</div>
</div>
</div>
<!--supply-supplylist end-->
</div>
</template>
<script>
module.exports={
data: function(){
return {
getSupLists: [], //左侧列表
chinesename:'',
goodsinfo:'',
getMedcontentList:[],
search: {
pageSize: 5,
page: 1,
total: 0,
totalPages: 0
},
activeI :[],
selectAllList: false,
checkArr:[],
noAudit:false,//防止重复点击审核
goodsLists:[],
};
},
methods: {
selectAllsum: function(flag) {
var self = this;
self.checkArr = [];
if(!flag) {
self.getMedcontentList.forEach(function(item, i) {
var data = item.guid;
self.checkArr.push(data);
});
console.log(self.checkArr);
} else {
self.$set('checkArr', []);
self.getMedcontentList.forEach(function(item, i) {
});
}
},
//左侧列表 加载数据
getMedList:function(){
var self = this;
Ajax.post('/procurment/getAcceptSupplier',{'chinesename':self.chinesename})
.then(function(response){
var data=response.data.data;
if (response.data.errorCode == 0) {
self.$set("getSupLists",data);
for (var i = 0; i < data.length; i++) {
self.supplierguid =data[0].guid;
}
self.getMedListClick();
}else{
layer.msg(response.data.message);
}
})
},
getMed:function(indexI,supplierguid){
var self =this;
self.activeI = indexI;
self.supplierguid = supplierguid;
self.search.page = 1;
self.getMedListClick();
},
//加载右侧商品数据
getMedListClick:function(){
var self = this;
self.selectAllList = false;
self.checkArr = [];
self.getMedcontentList = [];
Ajax.post('/procurment/getAcceptSupGoods',{'page':self.search.page,'pageSize':self.search.pageSize,'totalPages':self.search.totalPages,'supplierguid':self.supplierguid})
.then(function(response){
var data=response.data.data;
self.$set("getMedcontentList",data.list);
self.search.totalPages=data.totalPages;
self.search.total=data.total;
})
},
// 验证价格
medCheckPrice: function(price, index, code) {
var self = this;
if (price <= 0 || isNaN(price)) {
self.MessageBox({title:'警告', message:"请输入大于0的数!", type: 'alert'},function(action){
if (action == 'confirm') {
if (code == 1) {
self.$set('getMedcontentList['+index+'].price', '');
} else {
self.$set('getMedcontentList['+index+'].price', '');
}
}
});
}
},
// 验证医院单位系数
medCheckInfo: function (po, index, code) {
var self = this;
if (po <= 0 || po > 99 || isNaN(po)) {
self.MessageBox({title: '警告', message: "请输入大于0小于99的正整数!", type: 'alert'}, function (action) {
if (action == 'confirm') {
if (code == 1) {
self.$set('getMedcontentList[' + index + '].purconverratio', 1);
} else {
self.$set('getMedcontentList[' + index + '].purconverratio', 1);
}
}
});
}
},
//验证供应商单位系数
supCheckInfo: function (po, index, code) {
var self = this;
if (po <= 0 || po > 99 || isNaN(po)) {
self.MessageBox({title: '警告', message: "请输入大于0小于99的正整数!", type: 'alert'}, function (action) {
if (action == 'confirm') {
if (code == 1) {
self.$set('getMedcontentList[' + index + '].supconverratio', 1);
} else {
self.$set('getMedcontentList[' + index + '].supconverratio', 1);
}
}
});
}
},
//全部采纳商品
acceptSupGoods:function(){
var self = this;
self.goodsLists = [];
for (var i = 0; i < self.checkArr.length; i++) {
for (var j = 0; j < self.getMedcontentList.length; j++) {
if(self.getMedcontentList[j].guid == self.checkArr[i]){
self.goodsLists.push(self.getMedcontentList[j]);
}
}
}
for (var l = 0; l < self.goodsLists.length; l++) {
if(self.goodsLists[l].price == 0 || self.goodsLists[l].price == ''){
self.MessageBox({title:'提示', message:'商品名【' + self.goodsLists[l].goodsname +'】的价格不能为0!', type: 'alert'},function(action){
});
}
}
if(self.checkArr.length == 0){
layer.msg('请选择商品!');
return;
}
if(self.noAudit){
return;
}
self.noAudit = true;
Ajax.post('/procurment/acceptSupGoods',{'list':self.goodsLists})
.then(function(response){
self.noAudit = false;
var data=response.data.data;
self.getMedList();
if (response.data.errorCode == 0) {
if(response.data.data == 0){
self.MessageBox({title:'提示', message:'采纳成功!', type: 'alert'},function(action){
});
}else{
layer.msg('采纳成功!');
return;
}
}else{
self.MessageBox({title:'提示', message:response.data.message, type: 'alert'},function(action){
});
}
})
},
//全部采纳供应关系
acceptContent:function(){
var self = this;
self.goodsLists = [];
for (var i = 0; i < self.checkArr.length; i++) {
for (var j = 0; j < self.getMedcontentList.length; j++) {
if(self.getMedcontentList[j].guid == self.checkArr[i]){
self.goodsLists.push(self.getMedcontentList[j]);
}
}
}
if(self.checkArr.length == 0){
layer.msg('请选择商品!');
return;
}
for (var l = 0; l < self.goodsLists.length; l++) {
if(self.goodsLists[l].price == 0 || self.goodsLists[l].price == ''){
self.MessageBox({title:'提示', message:'商品名【' + self.goodsLists[l].goodsname +'】的价格不能为0!', type: 'alert'},function(action){
});
}
}
if(self.noAudit){
return;
}
self.noAudit = true;
Ajax.post('/procurment/acceptContent',{'list':self.goodsLists})
.then(function(response){
self.noAudit = false;
var data=response.data.data;
self.getMedList();
if (response.data.errorCode == 0) {
if(response.data.data == 0){
self.MessageBox({title:'提示', message:'采纳供应关系成功!', type: 'alert'},function(action){
});
}else{
layer.msg('采纳供应关系成功!');
return;
}
}else{
self.MessageBox({title:'提示', message:response.data.message, type: 'alert'},function(action){
});
}
})
},
//全部忽略
acceptLose:function(){
var self = this;
self.goodsLists = [];
for (var i = 0; i < self.checkArr.length; i++) {
for (var j = 0; j < self.getMedcontentList.length; j++) {
if(self.getMedcontentList[j].guid == self.checkArr[i]){
self.goodsLists.push(self.getMedcontentList[j]);
}
}
}
if(self.checkArr.length == 0){
layer.msg('请选择商品!');
return;
}
if(self.noAudit){
return;
}
self.noAudit = true;
Ajax.post('/procurment/acceptLose',{'list':self.goodsLists})
.then(function(response){
self.noAudit = false;
var data=response.data.data;
self.getMedList();
if (response.data.errorCode == 0) {
if(response.data.data == 0){
self.MessageBox({title:'提示', message:'忽略成功!', type: 'alert'},function(action){
});
}else{
layer.msg('忽略成功!');
return;
}
}else{
self.MessageBox({title:'提示', message:response.data.message, type: 'alert'},function(action){
});
}
})
},
closeUp:function(flag) {
var self = this;
self.$set('showPopupUp',flag);
},
close:function(flag) {
var self = this;
self.$set('showPopupUp',flag);
},
},
route:{
activate : function(){
this.getMedList();
}
},
watch: {
'checkArr': function(val) {
var self = this;
if(self.checkArr.length == 0){
self.selectAllList = false;
}
},
},
};
</script>