AddSupplierReceiptScript.blade.php
3.05 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
{!! Autograph() !!}
<script>
layui.use(['form', 'upload', 'admin'], function () {
const form = layui.form
const upload = layui.upload;
const admin = layui.admin;
//提交数据
form.on('submit(addSupplierReceipt)', function (data) {
// layer.confirm('确定要保存银行信息吗?一旦保存,该供应商就会再次进入审核阶段', function (index) {
layer.confirm('确定要保存银行信息吗?', function (index) {
let res = ajax('/api/supplier_receipt/AddSupplierReceipt', data.field);
if (!res) {
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
admin.putTempData("needFreshList", 1);
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
parent.layer.msg(res.err_msg, {icon: 5});
}
}
return false;
});
return false;
})
form.on('radio(receipt_type)', function (data) {
if (data.value == 1) {
$('#swift_code_div').hide();
} else {
$('#swift_code_div').show();
}
});
//图片上传
upload.render({
elem: '.upload-img'
, url: UploadImgUrl
, field: 'upload'
, data: {
k1: k1,
k2: k2,
source: 1,
cancel_time_verify: 1,
}
, accept: 'file'
, exts: 'jpg|png|bmp|jpeg|zip|pdf'
, size: 20000
, before: function (obj) {
layer.msg('加载中', {
icon: 16
, shade: 0.01
});
let item = this.item;
//预读本地文件示例,不支持ie8
obj.preview(function (index, file, result) {
// if (file.type.indexOf('image') !== -1){
// $('#' + item.attr('preview')).attr('src', result); //图片链接(base64)
// }else{
// $('#' + item.attr('preview')).attr('src', '/images/file.png');
// }
});
}
, done: function (res) {
if (res.code === 200) {
layer.msg('上传成功', {icon: 6});
let item = this.item;
$('#' + item.attr('data-obj')).val(res.data[0]);
$('#certificate_url').text(res.data[0]);
return false;
} else {
layer.msg('上传失败,' + res.message, {icon: 5});
return false;
}
}
, error: function (res) {
layer.msg('上传失败:' + res.message, {icon: 5});
return false;
}
});
});
</script>