Commit 1766eb3a authored by agping's avatar agping

收款记录修改

parent ce9449d2
......@@ -168,11 +168,6 @@
.hide {
display: none !important;
}
.result,.result2 {
width: 600px;
}
.result>img,.result2>img{
width: 200px;
height: 200px;
......@@ -196,6 +191,9 @@
left: 60px;
}
.span-del2,.span-del{
color: red;
}
/*css样式*/
</style>
<div id="page-content-wrapper">
......
......@@ -6,7 +6,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
/*每页显示多少条*/
id: '',
house_id: '',
house_fatherid:'',
house_fatherid: '',
type: '',
valueCurrent: '',
ajaxObj: '',
......@@ -23,36 +23,6 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
},
event: function() {
var _doc = $(document);
// 收款图片上传多张图片
// window.onload = function(){
// var input = document.getElementById("file_input");
// var result,div;
//
// if(typeof FileReader==='undefined'){
// result.innerHTML = "抱歉,你的浏览器不支持 FileReader";
// input.setAttribute('disabled','disabled');
// }else{
// input.addEventListener('change',readFile,false);
// }
// function readFile(){
// for(var i=0;i<this.files.length;i++){
// if (!input['value'].match(/.jpg|.gif|.png|.bmp/i)){  //判断上传文件格式
// return alert("上传的图片格式不正确,请重新选择")
//     }
// var reader = new FileReader();
// reader.readAsDataURL(this.files[i]);
// reader.onload = function(e){
// result = '<div id="result"><img src="'+this.result+'" alt=""/></div>';
// div = document.createElement('div');
// div.innerHTML = result;
// document.getElementById('body').appendChild(div);   //插入dom树 <br>          }
// }
// }
// };
// $('.span-del').click(function(){
// console.log(55);
// $(this).parent().remove();
// });
_doc.on('click', '.span-del', function(e) {
e.preventDefault();
e.stopPropagation();
......@@ -64,7 +34,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
$(this).parent().remove();
$(this).prev().attr('class');
console.log($(this).prev().attr('class'));
follow.spandelList($(this).prev().attr('class'));
});
_doc.on('click', 'a[href="#modal-time"]', function(e) {
......@@ -86,9 +56,9 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
_doc.on('click', '.add-pic', function() {
follow.house_id = $(this).attr("data-id");
follow.house_fatherid = $(this).attr("father-id");
follow.getaddPicList();
});
$("#reset").click(function() { //重置
......@@ -123,48 +93,53 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
_doc.on('click', '#saveBtn', function(e) {
console.log(555);
var _this = $(this);
e.preventDefault();
e.stopPropagation();
var imgname=[];
for(var i=0;i<$('.result').length;i++){
imgname[i]=$('.result>img').get(i).getAttribute("class");
var imgname = [];
for(var i = 0; i < $('.result').length; i++) {
imgname[i] = $('.result>img').get(i).getAttribute("class");
}
console.log(imgname.join(','));
var id_pic;
if(follow.house_fatherid>0){
id_pic=follow.house_fatherid;
}else{
id_pic=follow.house_id;
}
if(follow.house_fatherid > 0) {
id_pic = follow.house_fatherid;
} else {
id_pic = follow.house_id;
}
var _data = {
img_id: id_pic,
img_name: imgname.join(',')
};
//无新的图片上传 不调用接口
if(imgname.join(',')) {
_data['img_name'] = imgname.join(',');
}else{
return
}
$.ajax({
type: 'GET',
url: '/index/addReceiptImg',
data: _data,
dataType: 'json',
beforeSend: function() {},
success: function(_data) {
if(typeof _data === 'object') {
follow.getList(0);
} else {
alert('数据错误');
};
},
error: function() {
alert('enter error');
},
complete: function(xhr, textStatus){
if(textStatus === 'timeout') {
//处理超时的逻辑
alert('请求超时,请重试');
};
}
type: 'GET',
url: '/index/addReceiptImg',
data: _data,
dataType: 'json',
beforeSend: function() {},
success: function(_data) {
if(typeof _data === 'object') {
follow.getList(0);
} else {
alert('数据错误');
};
},
error: function() {
alert('enter error');
},
complete: function(xhr, textStatus) {
if(textStatus === 'timeout') {
//处理超时的逻辑
alert('请求超时,请重试');
};
}
});
});
......@@ -224,28 +199,28 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
'type': 'POST',
'url': '/index/deleteReceiptImg',
data: {
id:n
id: n
},
dataType: "json",
success: function(data) {
if(data.code == 200) {
} else {}
}
});
},
getaddPicList: function() {//获取收款图片
// container_body
var id_pic;
if(follow.house_fatherid>0){
id_pic=follow.house_fatherid;
}else{
id_pic=follow.house_id;
getaddPicList: function() { //获取收款图片
// container_body
var id_pic;
if(follow.house_fatherid > 0) {
id_pic = follow.house_fatherid;
} else {
id_pic = follow.house_id;
}
$('.result2,.result').remove();
$.ajax({
'type': 'GET',
'url': '/index/receiptImgList',
......@@ -256,14 +231,13 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
success: function(data) {
if(data.code == 200) {
//渲染已经有的列表
for(i=0;i<data.data.length;i++){
for(i = 0; i < data.data.length; i++) {
var result = '<div class="result2"><img class="' + data.data[i].id + '" src="' + data.data[i].img_name + '" alt=""/> <span class="span-del2">删除</span></div>';
div = document.createElement('div');
div.innerHTML = result;
document.getElementById('container_body').appendChild(div);
}
 
div = document.createElement('div');
div.innerHTML = result;
document.getElementById('container_body').appendChild(div);
} 
} else {}
}
});
......@@ -278,6 +252,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
} else {
input.addEventListener('change', readFile, false);
};
function readFile() {
console.log(this.files);
for(var i = 0; i < this.files.length; i++) {
......@@ -322,8 +297,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
alert('请求超时,请重试');
};
}
});
 
}); 
}
};
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment