Commit 9ae6f5e5 authored by agping's avatar agping

收款记录修改

parent 2de557c0
......@@ -308,7 +308,7 @@
<!--input上传图片-->
<div id="container_body">
<label>请选择一个图像文件:</label>
<input type="file" id="file_input" multiple/>
<input type="file" id="file_input"/>
</div>
</div>
<ul class="img-pre-ul" id="xiangqing_pic_ul">
......
define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css', 'ckfinder', 'ckfinderStart', 'pagination', 'bootstrapJs'], function(doT, template) {
follow = {
pageNo: 1,
......@@ -12,66 +11,68 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
ajaxObj: '',
stopstatus: true,
boxphoto: '',
image_file: '',
init: function() {
//初始化dot
$(document.body).append(template);
follow.getList(0);
follow.event();
},
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){
// 收款图片上传多张图片
// 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();
$(this).parent().remove();
});
_doc.on('click', 'a[href="#modal-time"]', function(e){
follow.house_id = $ (this).attr ("data-id");
_doc.on('click', 'a[href="#modal-time"]', function(e) {
follow.house_id = $(this).attr("data-id");
e.preventDefault();
e.stopPropagation();
// console.log('follow.house_id');
$('.iframe-time-line').attr('src', '/app_broker/timeline_pc?order_id='+follow.house_id);
// console.log('follow.house_id');
$('.iframe-time-line').attr('src', '/app_broker/timeline_pc?order_id=' + follow.house_id);
});
$("#search").click(function() {
follow.getList(1);
});
//点击收款图片 2.2版本
// $(".add-pic").click(function() {
// //监听图片上传
// follow.getaddPicList();
// });
_doc.on('click', '.add-pic', function(){
// $(".add-pic").click(function() {
// //监听图片上传
// follow.getaddPicList();
// });
_doc.on('click', '.add-pic', function() {
follow.getaddPicList();
});
......@@ -81,99 +82,89 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
$("#export").click(function() { //导出列表
follow.exportList();
});
$ (document).delegate (".submit_edit2", "click", function () {//提交
follow.house_id2 = $ (this).attr ("data-id");
$(document).delegate(".submit_edit2", "click", function() { //提交
follow.house_id2 = $(this).attr("data-id");
console.log(follow.house_id2);
$("#real_money").val($(this).attr ("data-money"));
$("#real_money").val($(this).attr("data-money"));
});
$ (document).delegate (".submit_edit", "click", function () {//提交
$(document).delegate(".submit_edit", "click", function() { //提交
follow.Submit_follow();
});
$ (document).on ("input","#cus_fang", function () {//手机号搜索客方2
if($("#cus_fang").val()==''){
$(document).on("input", "#cus_fang", function() { //手机号搜索客方2
if($("#cus_fang").val() == '') {
$(".user-ul2").html('');
}else{
} else {
follow.search_phone2();
}
});
$ (document).delegate (".addphone2", "click", function () {//list2消失
$(document).delegate(".addphone2", "click", function() { //list2消失
follow.addphone2(this);
});
//图片预览点击放大事件
_doc.on('click', '.img-pre-ul>li>img', function(e) {
_imgMaskObj.show().find('img').attr('src', this.src);
});
_imgMaskObj.click(function(e) {
this.style.display = 'none';
});
//保存上传的图片
_doc.on('click', '#saveBtn', function(e) {
console.log(555);
var _this = $(this);
var _data={
id:3104,
var _data = {
type: 1,
image1: follow.image_file
};
e.preventDefault();
e.stopPropagation();
var _imgUploadLunbo = $('#xiangqing_pic_ul'); //详情页轮播图ul
var _xiangqingPicObj = _imgUploadLunbo.find('li>img');
var _urlCut = location.origin + '/resource/lib/Attachments/images/';//要截取的部分url
$.each(_xiangqingPicObj, function(i, item) {
_data['slide_show[' + i + ']'] = item.src.replace(_urlCut, '');
});
var _imgId = _this.parent().attr('data-imgid');
$.ajax({
type: 'POST',
url: '/index/houseEdit',
data: _data,
// timeout: 30000,
dataType: 'json',
beforeSend: function() {},
success: function(_data) {
if(typeof _data === 'object') {
} else {
alert('数据错误');
};
},
error: function() {
alert('enter error');
},
complete: function(xhr, textStatus){
if(textStatus === 'timeout') {
//处理超时的逻辑
alert('请求超时,请重试');
};
}
});
// $.ajax({
// type: 'GET',
// url: '/index/uploadImg',
// data: _data,
//// timeout: 30000,
// dataType: 'json',
// beforeSend: function() {},
// success: function(_data) {
// if(typeof _data === 'object') {
//
// } else {
// alert('数据错误');
// };
// },
// error: function() {
// alert('enter error');
// },
// complete: function(xhr, textStatus){
// if(textStatus === 'timeout') {
// //处理超时的逻辑
// alert('请求超时,请重试');
// };
// }
// });
});
//图片上传 2.2版本
},
addphone2:function(obj){
var user_ht=$(obj).html();
addphone2: function(obj) {
var user_ht = $(obj).html();
$("#cus_fang").val(user_ht);
$(".user-ul2").html('');
follow.agent_id = $ (obj).attr ("data-id");
follow.agent_id = $(obj).attr("data-id");
},
search_phone2:function(){//手机号
$.ajax ({
search_phone2: function() { //手机号
$.ajax({
url: '/index/select_by_phone',
type: 'POST',
async: true,
data: {
"phone":$("#cus_fang").val()
"phone": $("#cus_fang").val()
},
dataType: 'json',
success: function (data) {
if (data.code == 200) {
success: function(data) {
if(data.code == 200) {
var user_ul2 = "";
$.each(data.data, function(i,item) {
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.realname+'-'+item.phone+'</li>';
$.each(data.data, function(i, item) {
user_ul2 += '<li class="addphone2" data-id="' + item.id + '">' + item.id + '-' + item.realname + '-' + item.phone + '</li>';
});
$(".user-ul2").html(user_ul2);
......@@ -197,47 +188,77 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
success: function(data) {
if(data.code == 200) {
follow.getList(0);
} else {
}
} else {}
}
});
},
//点击收款图片 调用的接口
getaddPicList: function() {
var image_file;
var input = document.getElementById("file_input");
var result,div;
if(typeof FileReader==='undefined'){
var result, div;
if(typeof FileReader === 'undefined') {
result.innerHTML = "抱歉,你的浏览器不支持 FileReader";
input.setAttribute('disabled','disabled');
}else{
input.addEventListener('change',readFile,false);
input.setAttribute('disabled', 'disabled');
} else {
input.addEventListener('change', readFile, false);
};
function readFile(){
function readFile() {
console.log(this.files);
image_file=this.files
for(var i=0;i<this.files.length;i++){
if (!input['value'].match(/.jpg|.gif|.png|.bmp/i)){  //判断上传文件格式
return alert("上传的图片格式不正确,请重新选择")
    }
// var _this=$(this);
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 class="result"><img src="'+this.result+'" alt=""/> <span class="span-del">删除</span></div>';
reader.onload = function(e) {
result = '<div class="result"><img src="' + this.result + '" alt=""/> <span class="span-del">删除</span></div>';
div = document.createElement('div');
div.innerHTML = result;
document.getElementById('container_body').appendChild(div);  
 }
document.getElementById('container_body').appendChild(div);   
}
};
console.log(image_file);
var formData = new FormData();
formData.append('type',1);
formData.append('image',this.files[0]);
console.log(this.files[0]);
console.log(formData);
$.ajax({
type: 'post',
url: '/index/uploadImg',
data: formData,
dataType: 'json',
contentType: false,
cache: false,
processData:false,
beforeSend: function() {},
success: function(_data) {
if(typeof _data === 'object') {
} else {
alert('数据错误');
};
},
error: function() {
alert('enter error');
},
complete: function(xhr, textStatus) {
if(textStatus === 'timeout') {
//处理超时的逻辑
alert('请求超时,请重试');
};
}
});
};
},
//删除图片
// 导出列表
// 导出列表
exportList: function(pageNo) {
console.log(2);
follow.pageNo = pageNo;
......@@ -253,8 +274,8 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
var store_name = $('#store_name').val();
var report_phone = $('#applicant_phone').val();
var report_name = $('#applicant_name').val();
window.open('/index/getCollection?'+
'excel='+ excel_two +'&user_name=' + user_name + '&start_time=' + start_time + '&end_time=' + end_time + '&internal_title=' + internal_title + '&user_phone=' + user_phone + '&id=' + id+ '&store_name=' + store_name+ '&report_phone=' + report_phone+ '&report_name=' + report_name);
window.open('/index/getCollection?' +
'excel=' + excel_two + '&user_name=' + user_name + '&start_time=' + start_time + '&end_time=' + end_time + '&internal_title=' + internal_title + '&user_phone=' + user_phone + '&id=' + id + '&store_name=' + store_name + '&report_phone=' + report_phone + '&report_name=' + report_name);
},
getList: function(pageNo) {
......@@ -263,15 +284,15 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
console.log($('#shop_name').val());
follow.pageNo = pageNo;
var params = {};
params.user_name =$.trim($('#customer_name').val());
params.start_time =$('#start_date').val();
params.end_time =$('#end_date').val();
params.internal_title =$('#shop_name').val();
params.user_phone =$('#customer_phone').val();
params.id =$('#shop_num').val()*1;
params.store_name =$('#store_name').val();
params.report_phone =$('#applicant_phone').val();
params.report_name =$('#applicant_name').val();
params.user_name = $.trim($('#customer_name').val());
params.start_time = $('#start_date').val();
params.end_time = $('#end_date').val();
params.internal_title = $('#shop_name').val();
params.user_phone = $('#customer_phone').val();
params.id = $('#shop_num').val() * 1;
params.store_name = $('#store_name').val();
params.report_phone = $('#applicant_phone').val();
params.report_name = $('#applicant_name').val();
params.pageNo = follow.pageNo;
params.pageSize = follow.pageSize;
......@@ -284,67 +305,66 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
beforeSend: function() {},
success: function(data) {
if(typeof data === 'object') {
if (data.code == 200) {
if(data.code == 200) {
var doTtmpl = doT.template(document.getElementById('get_collection_tpl').innerHTML);
$("#follow_list").html(doTtmpl(data.data.list));
// 支付方式 10支付宝 20 微信 30pos机器 40转账 50现金 60其他
$("#follow_list tr").each(function (e) {
$("#follow_list tr").each(function(e) {
//e代表索引 从0开始 eq(0)就是第一行
var temp = $("#follow_list").find("tr").eq(e).find("td").eq(5).html(); //获取一列的值
var temp_two = $("#follow_list").find("tr").eq(e).find("td").eq(6).html();
// null
var temp_one = $("#follow_list").find("tr").eq(e).find("td").eq(1).html();
if(temp_two*1==10){
if(temp_two * 1 == 10) {
$("#follow_list").find("tr").eq(e).find("td").eq(6).html("支付宝")
}
if(temp_two*1==20){
if(temp_two * 1 == 20) {
$("#follow_list").find("tr").eq(e).find("td").eq(6).html("微信")
}
if(temp_two*1==30){
if(temp_two * 1 == 30) {
$("#follow_list").find("tr").eq(e).find("td").eq(6).html("pos机器")
}
if(temp_two*1==40){
if(temp_two * 1 == 40) {
$("#follow_list").find("tr").eq(e).find("td").eq(6).html("转账")
}
if(temp_two*1==50){
if(temp_two * 1 == 50) {
$("#follow_list").find("tr").eq(e).find("td").eq(6).html("现金")
}
if(temp_two*1==60){
if(temp_two * 1 == 60) {
$("#follow_list").find("tr").eq(e).find("td").eq(6).html("其他")
}
// 付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他
if(temp*1==10){
if(temp * 1 == 10) {
$("#follow_list").find("tr").eq(e).find("td").eq(5).html("意向金")
}
if(temp*1==20){
if(temp * 1 == 20) {
$("#follow_list").find("tr").eq(e).find("td").eq(5).html("定金")
}
if(temp*1==30){
if(temp * 1 == 30) {
$("#follow_list").find("tr").eq(e).find("td").eq(5).html("保管金")
}
if(temp*1==40){
if(temp * 1 == 40) {
$("#follow_list").find("tr").eq(e).find("td").eq(5).html("押金")
}
if(temp*1==50){
if(temp * 1 == 50) {
$("#follow_list").find("tr").eq(e).find("td").eq(5).html("租金")
}
if(temp*1==60){
if(temp * 1 == 60) {
$("#follow_list").find("tr").eq(e).find("td").eq(5).html("进场费")
}
if(temp*1==70){
if(temp * 1 == 70) {
$("#follow_list").find("tr").eq(e).find("td").eq(5).html("转让费")
}
if(temp*1==80){
if(temp * 1 == 80) {
$("#follow_list").find("tr").eq(e).find("td").eq(5).html("其他")
}
if(temp*1==90){
if(temp * 1 == 90) {
$("#follow_list").find("tr").eq(e).find("td").eq(5).html("佣金")
}
// null 佣金
if(temp_one=='null'){
if(temp_one == 'null') {
$("#follow_list").find("tr").eq(e).find("td").eq(1).html(" ")
}
});
......@@ -352,7 +372,7 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
$("#money_total").html(data.data.money_total)
/*分页代码*/
add_page(data.data.total,pageNo,follow.pageSize,follow.getList);
add_page(data.data.total, pageNo, follow.pageSize, follow.getList);
/* $("#pagediv").pagination({
length:data.data.total,
current: pageNo,
......@@ -361,18 +381,18 @@ define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css
follow.getList(el.num.current);
}
});*/
}else {
} else {
alert(data['msg']);
};
}else{
} else {
alert('数据错误');
};
},
error: function() {
alert('error');
},
complete: function(xhr, textStatus){
if(textStatus === 'timeout'){
complete: function(xhr, textStatus) {
if(textStatus === 'timeout') {
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