
" +
@@ -349,6 +349,7 @@ layui.use(['element', 'form', 'layer', 'upload'], function () {
if(hide.length > 0){
var item = hide.parent('.upload-item');
if (res.code === 200) {
+ alert(res.data[field]);
hide.val(res.data[field]);
item.addClass('succeed');
}else {
@@ -361,6 +362,63 @@ layui.use(['element', 'form', 'layer', 'upload'], function () {
}
});
+ /** 上传图片(增值税发票)操作 */
+ upload.render({
+ elem: '#vatInvoiceImg' //绑定元素
+ ,url: $('#vatInvoiceImg').attr('up-url') //上传接口
+ ,field: 'image' //文件域的字段名
+ ,acceptMime: 'image/*' //选择文件类型
+ ,exts: 'jpg|jpeg|png|gif' //支持的图片格式
+ ,multiple: false
+ ,choose: function (obj) {
+ var upload = $('#vatInvoiceImg');
+ var show = upload.parents('.layui-form-item').children('.upload-show');
+ if ($(show).children("div").length == 1) {
+ alert("只允许上传一张照片!");
+ return ;
+ }
+ obj.preview(function (index, file, result) {
+ var name = upload.attr('name');
+ var show = upload.parents('.layui-form-item').children('.upload-show');
+ show.append("

" +
+ "
" +
+ "
");
+ });
+ }
+ ,done: function(res, index, upload){
+ // 解决节点渲染和异步上传不同步问题
+ var interval = window.setInterval(function(){
+ var hide = $("#"+index);
+ if(hide.length > 0){
+ var item = hide.parent('.upload-item');
+ if (res.code === 200) {
+ $('#invoiceType').find("option[value='" + res.data['invoiceType'] + "']").attr("selected",true);
+ $('#invoiceCode').val(res.data['invoiceCode']);
+ $('#invoiceNo').val(res.data['invoiceNo']);
+ $('#checkCode').val(res.data['checkCode']);
+ var invoiceDate = res.data['invoiceDate'];
+ invoiceDate = invoiceDate.replace('年','-')
+ invoiceDate = invoiceDate.replace('月','-')
+ invoiceDate = invoiceDate.replace('日','')
+ $('#laydate').val(invoiceDate);
+ $('#remark').val(res.data['remark']);
+ $('#invoiceMoney').val(res.data['invoiceMoney']);
+ $('#taxAmount').val(res.data['taxAmount']);
+ $('#totalAmount').val(res.data['totalAmount']);
+ form.render("select");
+ hide.val(res.data['invoiceImg']);
+ item.addClass('succeed');
+
+ }else {
+ hide.remove();
+ item.addClass('error');
+ }
+ clearInterval(interval);
+ }
+ }, 100);
+ }
+ });
+
// 删除上传图片展示项
$(document).on("click", ".upload-item-close", function () {
$(this).parent('.upload-item').remove();
diff --git a/admin/src/main/resources/templates/business/vatInvoice/add.html b/admin/src/main/resources/templates/business/vatInvoice/add.html
index a975c54..a27a76e 100644
--- a/admin/src/main/resources/templates/business/vatInvoice/add.html
+++ b/admin/src/main/resources/templates/business/vatInvoice/add.html
@@ -8,7 +8,7 @@
@@ -209,5 +202,6 @@
});
+