Commit 1766eb3a authored by agping's avatar agping

收款记录修改

parent ce9449d2
...@@ -168,11 +168,6 @@ ...@@ -168,11 +168,6 @@
.hide { .hide {
display: none !important; display: none !important;
} }
.result,.result2 {
width: 600px;
}
.result>img,.result2>img{ .result>img,.result2>img{
width: 200px; width: 200px;
height: 200px; height: 200px;
...@@ -196,6 +191,9 @@ ...@@ -196,6 +191,9 @@
left: 60px; left: 60px;
} }
.span-del2,.span-del{
color: red;
}
/*css样式*/ /*css样式*/
</style> </style>
<div id="page-content-wrapper"> <div id="page-content-wrapper">
......
...@@ -6,7 +6,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css ...@@ -6,7 +6,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
/*每页显示多少条*/ /*每页显示多少条*/
id: '', id: '',
house_id: '', house_id: '',
house_fatherid:'', house_fatherid: '',
type: '', type: '',
valueCurrent: '', valueCurrent: '',
ajaxObj: '', ajaxObj: '',
...@@ -23,36 +23,6 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css ...@@ -23,36 +23,6 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
}, },
event: function() { event: function() {
var _doc = $(document); 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) { _doc.on('click', '.span-del', function(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
...@@ -126,23 +96,28 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css ...@@ -126,23 +96,28 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var imgname=[]; var imgname = [];
for(var i=0;i<$('.result').length;i++){ for(var i = 0; i < $('.result').length; i++) {
imgname[i]=$('.result>img').get(i).getAttribute("class"); imgname[i] = $('.result>img').get(i).getAttribute("class");
} }
console.log(imgname.join(',')); console.log(imgname.join(','));
var id_pic; var id_pic;
if(follow.house_fatherid>0){ if(follow.house_fatherid > 0) {
id_pic=follow.house_fatherid; id_pic = follow.house_fatherid;
}else{ } else {
id_pic=follow.house_id; id_pic = follow.house_id;
} }
var _data = { var _data = {
img_id: id_pic, img_id: id_pic,
img_name: imgname.join(',')
}; };
//无新的图片上传 不调用接口
if(imgname.join(',')) {
_data['img_name'] = imgname.join(',');
}else{
return
}
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: '/index/addReceiptImg', url: '/index/addReceiptImg',
...@@ -159,7 +134,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css ...@@ -159,7 +134,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
error: function() { error: function() {
alert('enter error'); alert('enter error');
}, },
complete: function(xhr, textStatus){ complete: function(xhr, textStatus) {
if(textStatus === 'timeout') { if(textStatus === 'timeout') {
//处理超时的逻辑 //处理超时的逻辑
alert('请求超时,请重试'); alert('请求超时,请重试');
...@@ -224,7 +199,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css ...@@ -224,7 +199,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
'type': 'POST', 'type': 'POST',
'url': '/index/deleteReceiptImg', 'url': '/index/deleteReceiptImg',
data: { data: {
id:n id: n
}, },
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
...@@ -235,13 +210,13 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css ...@@ -235,13 +210,13 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
}); });
}, },
getaddPicList: function() {//获取收款图片 getaddPicList: function() { //获取收款图片
// container_body // container_body
var id_pic; var id_pic;
if(follow.house_fatherid>0){ if(follow.house_fatherid > 0) {
id_pic=follow.house_fatherid; id_pic = follow.house_fatherid;
}else{ } else {
id_pic=follow.house_id; id_pic = follow.house_id;
} }
$('.result2,.result').remove(); $('.result2,.result').remove();
...@@ -256,13 +231,12 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css ...@@ -256,13 +231,12 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
success: function(data) { success: function(data) {
if(data.code == 200) { 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>'; 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 = document.createElement('div');
div.innerHTML = result; div.innerHTML = result;
document.getElementById('container_body').appendChild(div); document.getElementById('container_body').appendChild(div);
} } 
 
} else {} } else {}
} }
...@@ -278,6 +252,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css ...@@ -278,6 +252,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
} else { } else {
input.addEventListener('change', readFile, false); input.addEventListener('change', readFile, false);
}; };
function readFile() { function readFile() {
console.log(this.files); console.log(this.files);
for(var i = 0; i < this.files.length; i++) { 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 ...@@ -322,8 +297,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
alert('请求超时,请重试'); 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