|
@@ -35,7 +35,10 @@
|
35
|
35
|
</el-col>
|
36
|
36
|
<el-col span="6">
|
37
|
37
|
<el-form-item label="增值税税率" prop="vatRate">
|
38
|
|
- <el-input v-model="supplier.vatRate"></el-input>
|
|
38
|
+ <el-input
|
|
39
|
+ v-model="supplier.vatRate"
|
|
40
|
+ @keyup.native="supplier.vatRate = oninput(supplier.vatRate)"
|
|
41
|
+ ></el-input>
|
39
|
42
|
</el-form-item>
|
40
|
43
|
</el-col>
|
41
|
44
|
</el-row>
|
|
@@ -311,6 +314,32 @@ export default {
|
311
|
314
|
this.dialogVisible = true;
|
312
|
315
|
}
|
313
|
316
|
},
|
|
317
|
+
|
|
318
|
+ oninput(num) {
|
|
319
|
+ var str = num;
|
|
320
|
+ var len1 = str.substr(0, 1);
|
|
321
|
+ var len2 = str.substr(1, 1);
|
|
322
|
+ //如果第一位是0,第二位不是点,就用数字把点替换掉
|
|
323
|
+ if (str.length > 1 && len1 == 0 && len2 != ".") {
|
|
324
|
+ str = str.substr(1, 1);
|
|
325
|
+ }
|
|
326
|
+ //第一位不能是.
|
|
327
|
+ if (len1 == ".") {
|
|
328
|
+ str = "";
|
|
329
|
+ }
|
|
330
|
+ //限制只能输入一个小数点
|
|
331
|
+ if (str.indexOf(".") != -1) {
|
|
332
|
+ var str_ = str.substr(str.indexOf(".") + 1);
|
|
333
|
+ if (str_.indexOf(".") != -1) {
|
|
334
|
+ str = str.substr(0, str.indexOf(".") + str_.indexOf(".") + 1);
|
|
335
|
+ }
|
|
336
|
+ }
|
|
337
|
+ //正则替换
|
|
338
|
+ str = str.replace(/[^\d^\.]+/g, ""); // 保留数字和小数点
|
|
339
|
+ str = str.replace(/\.\d\d\d\d$/, ""); // 小数点后只能输两位
|
|
340
|
+ return str;
|
|
341
|
+ },
|
|
342
|
+
|
314
|
343
|
closePop() {
|
315
|
344
|
this.dialogVisible = false;
|
316
|
345
|
this.supply_code = [];
|
|
@@ -378,7 +407,6 @@ export default {
|
378
|
407
|
this.$refs[formName].validate((valid) => {
|
379
|
408
|
if (valid) {
|
380
|
409
|
this.recordInfo.contacts.forEach((el) => {
|
381
|
|
- console.log(el, "op");
|
382
|
410
|
if (!el.phone) {
|
383
|
411
|
el.phone = "";
|
384
|
412
|
}
|
|
@@ -399,12 +427,7 @@ export default {
|
399
|
427
|
bankaccount: this.supplier.bankAccount || "",
|
400
|
428
|
contacts: [...this.recordInfo.contacts],
|
401
|
429
|
};
|
402
|
|
- console.log(
|
403
|
|
- this.recordInfo.contacts,
|
404
|
|
- "this.recordInfo.contacts"
|
405
|
|
- );
|
406
|
430
|
savesupply(params).then((res) => {
|
407
|
|
- console.log(res, "op");
|
408
|
431
|
if (res.data.state == 1) {
|
409
|
432
|
this.$message.success("修改成功");
|
410
|
433
|
this.closePop();
|
|
@@ -430,7 +453,6 @@ export default {
|
430
|
453
|
this.$refs[formName].validate((valid) => {
|
431
|
454
|
if (valid) {
|
432
|
455
|
this.recordInfo.contacts.forEach((el) => {
|
433
|
|
- console.log(el, "op");
|
434
|
456
|
if (!el.phone) {
|
435
|
457
|
el.phone = "";
|
436
|
458
|
}
|
|
@@ -444,7 +466,7 @@ export default {
|
444
|
466
|
let params = {
|
445
|
467
|
suppliercode: this.supplier.supplierCode || "",
|
446
|
468
|
suppliername: this.supplier.supplierName || "",
|
447
|
|
- id: this.supplier_ids || "",
|
|
469
|
+ id: parseInt(this.supplier_ids) || "",
|
448
|
470
|
suppliertype: this.supplier.supplierType || "",
|
449
|
471
|
vatrate: this.supplier.vatRate || 0,
|
450
|
472
|
number: this.supplier.number || "",
|
|
@@ -452,13 +474,8 @@ export default {
|
452
|
474
|
bankaccount: this.supplier.bankAccount || "",
|
453
|
475
|
contacts: [...this.recordInfo.contacts],
|
454
|
476
|
};
|
455
|
|
- console.log(
|
456
|
|
- this.recordInfo.contacts,
|
457
|
|
- "this.recordInfo.contacts"
|
458
|
|
- );
|
459
|
|
- console.log(params, "params");
|
|
477
|
+
|
460
|
478
|
updatesupply(params).then((res) => {
|
461
|
|
- console.log(res, "op");
|
462
|
479
|
if (res.data.state == 1) {
|
463
|
480
|
this.$message.success("修改成功");
|
464
|
481
|
this.closePop();
|
|
@@ -491,7 +508,6 @@ export default {
|
491
|
508
|
getsupplyandcontactone({ id: val }).then((res) => {
|
492
|
509
|
if (res.data.code == 0) {
|
493
|
510
|
this.recordInfo.contacts = res.data.data.contact;
|
494
|
|
- console.log(this.recordInfo.contacts, "supply");
|
495
|
511
|
if (this.recordInfo.contacts.length == 0) {
|
496
|
512
|
this.recordInfo.contacts = [{}];
|
497
|
513
|
this.recordInfo.contacts[0].is_first = data.value;
|