Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
976619b0
Commit
976619b0
authored
Jun 08, 2018
by
xishifeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
成交信息相关暂存1
parent
47efc73e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
934 additions
and
886 deletions
+934
-886
bargaininfo_detail_pc.html
application/app_broker/view/index/bargaininfo_detail_pc.html
+1
-0
bargaininfo_detail_pc.css
public/app/css/bargaininfo_detail_pc.css
+17
-1
bargaininfo_detail_pc.js
public/app/js/bargaininfo_detail_pc.js
+813
-2
reportList.js
public/resource/js/reportList.js
+103
-883
No files found.
application/app_broker/view/index/bargaininfo_detail_pc.html
View file @
976619b0
...
...
@@ -22,6 +22,7 @@
<a
href=
"javascript:;"
class=
"btn btn-default"
>
开票税费
</a>
</h4>
</div>
<div
class=
"div-seat"
></div>
<div
class=
"modal-body detail-modal-body"
>
<div>
<div
class=
"detail-modal-body-sec"
>
...
...
public/app/css/bargaininfo_detail_pc.css
View file @
976619b0
.modal-header
{
position
:
fixed
;
top
:
0
;
left
:
0
;
width
:
100%
;
background-color
:
white
;
z-index
:
1
;
}
.div-seat
{
height
:
64px
;
width
:
100%
;
}
.detail-modal-body
{
height
:
660
px
;
height
:
724
px
;
overflow-y
:
scroll
;
}
.detail-modal-body-sec
+
.detail-modal-body-sec
{
...
...
@@ -89,6 +101,10 @@
margin
:
0
auto
;
}
#bargaininfo_beizhu
{
border
:
1px
solid
#ccc
;
}
/*详情弹出框,分佣提成*/
.detail-modal-maid-top-btn-area
{
padding
:
0
10px
10px
;
...
...
public/app/js/bargaininfo_detail_pc.js
View file @
976619b0
'use strict'
;
require
([
'jquery0325'
,
'common'
,
'bootstrapJs'
,
'css!style/bargaininfo_detail_pc.css'
],
function
(){
$
(
document
.
body
).
show
();
require
([
'jquery0325'
,
'common'
,
'bootstrapJs'
,
'css!style/bargaininfo_detail_pc.css'
],
function
()
{
bargain
=
{
detailTabIndex
:
0
,
bargain_id
:
''
,
order_id
:
0
,
//订单id
panfangData
:
null
,
maidTotalCommission
:
0
,
//应收总佣金
init
:
function
()
{
$
(
document
.
body
).
show
();
var
_doc
=
$
(
document
);
var
_this
=
this
;
_this
.
bargain_id
=
getUrlParam
(
'bargain_id'
);
//点击详情按钮事件,获取报告详情
_doc
.
on
(
'click'
,
'.details-btn'
,
function
()
{
$
(
'.detail-modal-header-tab>a:nth-of-type(1)'
).
removeClass
(
'btn-default'
).
addClass
(
'btn-info'
).
siblings
().
removeClass
(
'btn-info'
).
addClass
(
'btn-default'
);
_this
.
detailTabIndex
=
0
;
$
(
'.detail-modal-body-sec:nth-of-type(1)'
).
show
().
siblings
().
hide
();
_this
.
bargaininfoShow
();
});
//详情弹出框里的tab点击事件,成交信息,分佣提成,开票税费
_doc
.
on
(
'click'
,
'.detail-modal-header-tab>a'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
var
_$this
=
$
(
this
);
_$this
.
removeClass
(
'btn-default'
).
addClass
(
'btn-info'
).
siblings
().
removeClass
(
'btn-info'
).
addClass
(
'btn-default'
);
_this
.
detailTabIndex
=
_$this
.
index
();
$
(
'.detail-modal-body-sec:nth-of-type('
+
(
_this
.
detailTabIndex
+
1
)
+
')'
).
show
().
siblings
().
hide
();
if
(
_this
.
detailTabIndex
==
0
)
{
_this
.
bargaininfoShow
();
}
else
if
(
bargain
.
detailTabIndex
==
1
)
{
_this
.
maidShow
();
}
else
{
_this
.
taxShow
();
}
});
//详情弹出框,成交信息里的实收佣金相关的事件
var
_iYJAAObj
=
$
(
'.detail-modal-bargaininfo-commission-addarea'
);
_doc
.
on
(
'click'
,
'#bargaininfo_commission_add_btn>img'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
if
(
$
(
'.detail-modal-bargaininfo-commission-addarea>div'
).
length
>=
5
)
{
alert
(
'最多添加5条'
);
return
false
;
}
else
{
_iYJAAObj
.
append
(
'<div class="form-group detail-modal-bargaininfo-commission-sec"><label class="">实收佣金:</label><div class="input-group"><input type="number"class="form-control"placeholder="请输入"><div class="input-group-addon">元</div></div><label class="">收佣日期:</label><div class="input-group"><input type="date"class="form-control"placeholder="请输入"></div><mark href="javascript:;"class="detail-modal-bargaininfo-commission-cancel-pic"><img src="/resource/image/search_gb.png"/></mark></div>'
);
};
});
//详情弹出框,成交信息里的实收佣金相关的事件,点击x删除这条
_doc
.
on
(
'click'
,
'.detail-modal-bargaininfo-commission-cancel-pic'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
$
(
this
).
parent
().
remove
();
});
//详情弹出框,点击成交信息确定
_doc
.
delegate
(
"#bargaininfo_btn_save"
,
"click"
,
function
()
{
bargain
.
bargaininfoSave
();
});
//详情弹出框,点击开票税费下的新增税费,弹出框出来
_doc
.
on
(
'click'
,
'[href=
\
"#modal_new_tax
\
"]'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
var
_$this
=
$
(
this
);
bargain
.
newAddTax
({
'type'
:
_$this
.
attr
(
'data-recordid'
)
?
'edit'
:
'new'
,
'id'
:
_$this
.
attr
(
'data-recordid'
)
});
});
//详情弹出框,新增开票税费,金额输入框输入后,自动计算税费
_doc
.
on
(
'input'
,
'#addtax_commission_input'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
var
_$this
=
$
(
this
);
var
_trObj
=
$
(
'.addtax-modal-tax-table-datatr'
);
$
.
each
(
_trObj
,
function
(
i
,
v
)
{
v
.
childNodes
[
3
].
innerHTML
=
dealJineNum
(
Number
(
v
.
childNodes
[
2
].
innerHTML
.
split
(
'%'
)[
0
])
*
0.01
*
Number
(
$
.
trim
(
_$this
.
val
()))
*
0.1
);
});
});
//详情弹出框,新增开票税费,点击确定时的提交
_doc
.
on
(
'click'
,
'#addtax_commission_addok'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
bargain
.
newAddTaxOk
();
});
//详情弹出框,分佣提成里,点击新增
_doc
.
on
(
'click'
,
'[href="#modal_new_maid"]'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
bargain
.
newAddMaid
();
});
//详情弹出框,分佣提成里,点击新增,分佣方选择时触发的事件
_doc
.
on
(
'input'
,
'#addmaid_input_servant'
,
function
(
e
)
{
var
_$this
=
$
(
this
);
$
(
'#addmaid_input_ywy'
).
val
(
''
);
//先置空
$
(
'#addmaid_input_shop'
).
val
(
''
);
//先置空
if
(
_$this
.
val
()
===
''
)
{
}
else
if
(
_$this
.
val
()
===
'5'
)
{
}
else
{
var
_rateTemp
=
bargain
.
getDefaultRadio
(
_$this
.
val
());
$
(
'#addmaid_input_ratio'
).
val
(
_rateTemp
);
$
(
'#addmaid_input_cash'
).
val
(
dealJineNum
(
_rateTemp
*
bargain
.
maidTotalCommission
/
100
));
var
_arrTemp
=
bargain
.
panfangData
.
filter
(
function
(
item
,
index
,
array
)
{
return
(
item
.
role
==
_$this
.
val
());
});
if
(
_arrTemp
.
length
===
0
)
{
return
false
;
}
else
if
(
_arrTemp
.
length
===
1
)
{
$
(
'#addmaid_input_ywy'
).
val
(
_arrTemp
[
0
].
name
+
'-'
+
_arrTemp
[
0
].
phone
).
attr
(
'data-id'
,
_arrTemp
[
0
].
id
);
bargain
.
getDepart
(
_arrTemp
[
0
].
id
,
function
(
obj
)
{
$
(
'#addmaid_input_shop'
).
val
(
obj
.
district_name
+
'-'
+
obj
.
store_name
);
});
}
else
{
$
(
'[href="#modal_new_maid_select"]'
).
click
();
var
_tempHtml
=
''
;
$
.
each
(
_arrTemp
,
function
(
i
,
v
)
{
_tempHtml
+=
'<li data-data="{data}">{0}-{1}</li>'
.
stringFormatObj
({
'data'
:
encodeURIComponent
(
JSON
.
stringify
(
v
)),
'0'
:
v
.
name
,
'1'
:
v
.
phone
});
});
$
(
'#addmaid_select_ul'
).
html
(
_tempHtml
);
}
}
});
//详情弹出框,分佣提成里,点击新增,分佣方选择,弹出选择列表触发的事件
_doc
.
on
(
'click'
,
'#addmaid_select_ul>li'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
var
_$this
=
$
(
this
);
var
_dataTemp
=
JSON
.
parse
(
decodeURIComponent
(
_$this
.
attr
(
'data-data'
)));
$
(
'#addmaid_input_ywy'
).
val
(
_dataTemp
.
name
+
'-'
+
_dataTemp
.
phone
).
attr
(
'data-id'
,
_dataTemp
.
id
);
bargain
.
getDepart
(
_dataTemp
.
id
,
function
(
obj
)
{
$
(
'#addmaid_input_shop'
).
val
(
obj
.
district_name
+
'-'
+
obj
.
store_name
);
});
_$this
.
closest
(
'.modal-content'
).
find
(
'button.close'
).
click
();
});
//详情弹出框,分佣提成里,点击新增,点击保存触发的事件
_doc
.
on
(
'click'
,
'#addmaid_ok_btn'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
bargain
.
newAddMaidOk
();
});
//详情弹出框,分佣提成里,点击确认分佣触发的事件
_doc
.
on
(
'click'
,
'#maid_ok_btn'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
if
(
bargain
.
mainTabIndex
===
2
)
{
bargain
.
maidConfirmOk
(
1
);
}
else
{
alert
(
'财务第三级审核人员才能确认分佣!'
);
}
});
//详情弹出框,分佣提成里,点击保存触发的事件
_doc
.
on
(
'click'
,
'#maid_save_btn'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
// bargain.maidSave();
bargain
.
maidConfirmOk
(
0
);
});
//详情弹出框,分佣提成里,点击增加实收按钮
_doc
.
on
(
'click'
,
'#maid_new_btn'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
var
_temp
=
$
(
'.detail-modal-maid-span-time'
);
var
_flag
=
false
;
if
(
_temp
&&
_temp
.
length
&&
_temp
.
length
>
0
)
{
$
.
each
(
_temp
,
function
(
i
,
v
)
{
if
(
v
.
innerHTML
==
''
)
{
_flag
=
true
;
return
false
;
};
});
};
if
(
_flag
)
{
alert
(
'前边一组收佣尚未确认分佣或成交信息里没有对应的实收佣金'
);
}
else
{
layer
.
open
({
content
:
'确认增加吗?'
,
btn
:
[
'确定'
,
'取消'
],
yes
:
function
(
_index
)
{
$
(
'.detail-modal-maid-mix-td'
).
append
(
document
.
getElementById
(
'reportList_maid_sub1_list_tpl'
).
innerHTML
);
layer
.
close
(
_index
);
}
});
};
});
//新增分佣提成,业务员input输入搜索,点击之后赋值
_doc
.
on
(
'click'
,
'#addmaid_input_ywy+ul>li'
,
function
()
{
var
_$this
=
$
(
this
);
var
_id
=
_$this
.
attr
(
'data-id'
);
_$this
.
parent
().
prev
().
val
(
_$this
.
html
()).
attr
(
'data-id'
,
_id
);
bargain
.
getDepart
(
_id
,
function
(
obj
)
{
$
(
'#addmaid_input_shop'
).
val
(
obj
.
district_name
+
'-'
+
obj
.
store_name
);
});
_$this
.
parent
().
html
(
''
).
hide
();
});
//新增分佣提成,业务员input输入搜索
var
_ajaxObjTel
=
null
;
var
_addmaid_input_servantObj
=
$
(
'#addmaid_input_servant'
);
_doc
.
on
(
'input'
,
'#addmaid_input_ywy'
,
function
()
{
var
_$this
=
$
(
this
);
if
(
_addmaid_input_servantObj
.
val
()
==
'5'
)
{
//当分佣方的值为5,合作方的时候,才能查询
var
_$thisVal
=
$
.
trim
(
_$this
.
val
());
_$this
.
removeAttr
(
'data-id'
);
//移除之前携带的信息
if
(
_$thisVal
!=
''
)
{
_ajaxObjTel
&&
_ajaxObjTel
.
abort
();
_ajaxObjTel
=
$
.
ajax
({
type
:
'GET'
,
url
:
'/index/getBroker_new'
,
data
:
{
'phone'
:
$
.
trim
(
_$this
.
val
())
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
data
)
{
if
(
typeof
data
===
'object'
)
{
if
(
data
.
code
==
200
)
{
if
(
data
[
'data'
].
length
>
0
)
{
var
_htmlTemp
=
''
;
$
.
each
(
data
[
'data'
],
function
(
i
,
item
)
{
_htmlTemp
+=
'<li data-id="{3}">{0}-{1}<li>'
.
stringFormatObj
({
'0'
:
item
[
'name'
],
'1'
:
item
[
'phone'
],
'3'
:
item
[
'id'
]
});
});
_$this
.
next
().
show
().
html
(
_htmlTemp
);
}
else
{
_$this
.
next
().
html
(
''
);
};
}
else
{
alert
(
data
[
'msg'
]);
};
}
else
{
alert
(
'数据错误'
);
};
},
error
:
function
()
{
//alert('error');
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
alert
(
'请求超时'
);
};
}
});
}
else
{
_$this
.
next
().
hide
();
}
}
else
{}
});
},
getDefaultRadio
:
function
(
v
)
{
switch
(
Number
(
v
))
{
case
1
:
return
25
;
case
2
:
return
30
;
case
3
:
return
35
;
case
4
:
return
10
;
default
:
return
25
;
}
},
getDepart
:
function
(
s
,
fn
)
{
$
.
ajax
({
type
:
'GET'
,
url
:
'/index/getAgentDistrictStore'
,
data
:
{
'id'
:
s
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
fn
&&
fn
(
_data
.
data
);
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
bargaininfoShow
:
function
()
{
//报告详情
$
.
ajax
({
'type'
:
'GET'
,
'url'
:
'/index/bargainInfo'
,
data
:
{
"id"
:
bargain
.
bargain_id
},
dataType
:
"json"
,
success
:
function
(
data
)
{
if
(
data
.
code
==
200
)
{
if
(
data
.
data
)
{
$
(
'#bargaininfo_shop_type'
).
html
(
data
.
data
.
shop_type
==
'1'
?
'街铺'
:
'商场'
);
$
(
'#bargaininfo_is_open'
).
val
(
data
.
data
.
is_open
);
$
(
'#bargaininfo_beizhu'
).
val
(
data
.
data
.
content
);
$
(
"#bargaininfo_user_phone"
).
html
(
hideTel
(
data
.
data
.
user_phone
));
$
(
"#bargaininfo_user_name"
).
html
(
data
.
data
.
user_name
);
$
(
"#bargaininfo_internal_address"
).
html
(
data
.
data
.
internal_address
);
$
(
"#bargaininfo_shop_num"
).
html
(
data
.
data
.
house_number
);
$
(
"#bargaininfo_type"
).
val
(
data
.
data
.
trade_type
);
$
(
"#bargaininfo_total_commission"
).
val
(
data
.
data
.
commission
);
$
(
"#bargaininfo_create_time"
).
html
(
data
.
data
.
create_time
);
bargain
.
maidTotalCommission
=
Number
(
data
.
data
.
commission
);
//总佣金
bargain
.
order_id
=
Number
(
data
.
data
.
order_id
);
//订单id
var
_inputAreaTempObj
=
$
(
'.detail-modal-bargaininfo-commission-addarea'
);
if
(
data
.
data
.
practical_fee
&&
data
.
data
.
practical_fee
.
length
>
0
)
{
_inputAreaTempObj
.
html
(
''
);
}
else
{
_inputAreaTempObj
.
html
(
'<div class="form-group detail-modal-bargaininfo-commission-sec"><label class="">实收佣金:</label><div class="input-group"><input type="number"class="form-control"placeholder="请输入"><div class="input-group-addon">元</div></div><label class="">收佣日期:</label><div class="input-group"><input type="date"class="form-control"placeholder="请输入"></div><mark href="javascript:;"class="detail-modal-bargaininfo-commission-cancel-pic"><img src="/resource/image/search_gb.png"/></mark></div>'
);
}
$
.
each
(
data
.
data
.
practical_fee
,
function
(
i
,
v
)
{
_inputAreaTempObj
.
append
(
'<div data-id="{id}" class="form-group detail-modal-bargaininfo-commission-sec"><label class="">实收佣金:</label><div class="input-group"><input type="number"class="form-control"placeholder="请输入"value="{0}"><div class="input-group-addon">元</div></div><label class="">收佣日期:</label><div class="input-group"><input type="date"class="form-control"placeholder="请输入"value="{1}"></div></div>'
.
stringFormatObj
({
'0'
:
v
.
money
,
'1'
:
v
.
income_time
,
'id'
:
v
.
fee_id
}));
});
}
}
else
{
alert
(
'获取失败!'
);
}
}
});
},
bargaininfoSave
:
function
()
{
//修改报告详情
var
_data
=
{
'id'
:
bargain
.
bargain_id
,
'commission'
:
$
.
trim
(
$
(
'#bargaininfo_total_commission'
).
val
()),
'content'
:
$
.
trim
(
$
(
'#bargaininfo_beizhu'
).
val
()),
'is_open'
:
$
(
'#bargaininfo_is_open'
).
val
(),
'trade_type'
:
$
(
'#bargaininfo_type'
).
val
()
};
$
.
each
(
$
(
'.detail-modal-bargaininfo-commission-sec'
),
function
(
i
,
v
)
{
_data
[
'practical_fee['
+
i
+
']'
]
=
{
'fee_id'
:
v
.
getAttribute
(
'data-id'
)
?
v
.
getAttribute
(
'data-id'
)
:
0
,
'fee'
:
$
.
trim
(
$
(
v
).
find
(
'input'
).
eq
(
0
).
val
()),
'operation_date'
:
$
.
trim
(
$
(
v
).
find
(
'input'
).
eq
(
1
).
val
())
};
});
$
.
ajax
({
'type'
:
'POST'
,
'url'
:
'/index/editBargainInfo'
,
data
:
_data
,
dataType
:
"json"
,
success
:
function
(
data
)
{
if
(
data
.
code
==
200
)
{
alert
(
'修改成功'
);
bargain
.
bargaininfoShow
();
bargain
.
getList
(
0
);
}
else
{
alert
(
data
.
msg
);
}
}
});
},
maidShow
:
function
()
{
$
(
'[href="#modal_new_maid"]'
).
hide
();
//默认隐藏新增按钮
$
(
"#maid_new_table_list"
).
html
(
''
);
$
.
ajax
({
type
:
'GET'
,
url
:
'/index/commissionList'
,
data
:
{
'id'
:
bargain
.
bargain_id
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
$
(
"#maid_new_table_list"
).
html
(
doT
.
template
(
$
(
'#reportList_maid_list_tpl'
).
html
())(
_data
));
var
_isShowAddBtnFlag
=
true
;
$
.
each
(
$
(
'.detail-modal-maid-span-time'
),
function
(
i
,
v
)
{
if
(
v
.
innerHTML
)
{
_isShowAddBtnFlag
=
false
;
};
});
//如果确认时间都有,都不为空,则把新增按钮显示出来
if
(
_isShowAddBtnFlag
)
{
$
(
'[href="#modal_new_maid"]'
).
show
();
};
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
// 开票税费
taxShow
:
function
()
{
$
.
ajax
({
type
:
'GET'
,
url
:
'/index/getTallAge'
,
data
:
{
'bargain_id'
:
bargain
.
bargain_id
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
$
(
"#tax_main_box"
).
html
(
doT
.
template
(
$
(
'#reportList_shuiFee_list_tpl'
).
html
())(
_data
.
data
));
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
newAddMaid
:
function
()
{
$
.
ajax
({
type
:
'GET'
,
url
:
'/index/searchOrderAgents'
,
data
:
{
'order_id'
:
bargain
.
order_id
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
bargain
.
panfangData
=
_data
.
data
;
console
.
log
(
bargain
.
panfangData
);
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
newAddMaidOk
:
function
()
{
console
.
log
(
7789
);
$
.
ajax
({
type
:
'POST'
,
url
:
'/index/addBargain'
,
data
:
{
'id'
:
bargain
.
bargain_id
,
'agent_id'
:
$
(
'#addmaid_input_ywy'
).
attr
(
'data-id'
),
'scale_fee'
:
$
(
'#addmaid_input_cash'
).
val
(),
'role'
:
$
(
'#addmaid_input_servant'
).
val
(),
'scale'
:
$
(
'#addmaid_input_ratio'
).
val
(),
'source'
:
1
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
alert
(
'新增成功!'
);
bargain
.
maidShow
();
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
maidTest
:
function
(
type
)
{
var
_stopFlag
=
false
;
var
_data
=
[];
var
_parObj
=
$
(
'#maid_new_table_list>tr'
);
var
_errorTips
=
'请填写完整'
;
var
_scaleTotal
=
0
;
if
(
_parObj
.
length
>
0
)
{
$
.
each
(
_parObj
,
function
(
i
,
v
)
{
console
.
count
(
'$v'
);
var
_$v
=
$
(
v
);
var
_agentId
=
_$v
.
attr
(
'data-agentid'
);
//经纪人id
var
_role
=
_$v
.
attr
(
'data-role'
);
//盘方等类型
var
_scaleVal
=
$
.
trim
(
_$v
.
find
(
'.detail-modal-maid-span-scale'
).
html
());
//分佣比例
var
_shouldCommissionVal
=
$
.
trim
(
_$v
.
find
(
'.detail-modal-maid-td-should-commission'
).
html
());
//应分佣金
var
_dataTemp
=
{
'bargain_id'
:
_$v
.
attr
(
'data-id'
),
//成交报告id
'last_commission_id'
:
_$v
.
attr
(
'lastid'
)
?
_$v
.
attr
(
'lastid'
)
:
0
,
//最后一个提交的记录id
'is_account_commission'
:
type
//0是保存,1是确认分佣
};
if
(
_scaleVal
==
''
||
_shouldCommissionVal
==
''
)
{
_stopFlag
=
true
;
}
else
{
var
_parObj2
=
_$v
.
find
(
'.detail-modal-maid-mix-td>div'
);
if
(
_parObj2
.
length
>
0
)
{
$
.
each
(
_parObj2
,
function
(
i2
,
v2
)
{
console
.
count
(
'$v2'
);
var
_$v2
=
$
(
v2
);
var
_cid
=
_$v2
.
attr
(
'data-id'
);
_cid
=
_cid
?
_cid
:
0
;
//如果没有这个id,则为新增,传0
var
_sfyj
=
$
.
trim
(
_$v2
.
find
(
'.detail-modal-maid-span-real-fee'
).
html
());
var
_sxf
=
$
.
trim
(
_$v2
.
find
(
'.detail-modal-maid-span-service-charge'
).
html
());
var
_csjj
=
$
.
trim
(
_$v2
.
find
(
'.detail-modal-maid-span-charity-fund'
).
html
());
var
_xjj
=
$
.
trim
(
_$v2
.
find
(
'.detail-modal-maid-span-cash'
).
html
());
var
_ssyj
=
$
.
trim
(
_$v2
.
find
(
'.detail-modal-maid-span-practical-fee'
).
html
());
if
(
_sfyj
==
''
||
_sxf
==
''
||
_csjj
==
''
||
_xjj
==
''
||
_ssyj
==
''
)
{
_stopFlag
=
true
;
}
else
{
_dataTemp
[
'commission_date['
+
i2
+
']'
]
=
{
'agent_id'
:
_agentId
,
//业务员id
'role'
:
_role
,
//盘方等角色类型
'scale'
:
Number
(
_scaleVal
),
//分佣比例
'should_commission'
:
_shouldCommissionVal
,
//应分佣金
'commission_id'
:
_cid
,
//子记录id
'real_fee'
:
_sfyj
,
//实分佣金
'service_charge'
:
_sxf
,
//手续费
'charity_fund'
:
_csjj
,
//慈善基金
'cash'
:
_xjj
,
//现金奖
'practical_fee'
:
_ssyj
//实收佣金
};
}
});
}
else
{
}
};
_data
.
push
(
_dataTemp
);
});
};
$
.
each
(
$
(
'.detail-modal-maid-span-scale'
),
function
(
i
,
v
)
{
_scaleTotal
+=
Number
(
$
.
trim
(
v
.
innerHTML
));
});
if
(
_scaleTotal
!=
100
)
{
_stopFlag
=
true
;
_errorTips
=
'分佣比例一定要是100%,否则无法提交'
;
};
return
{
'flag'
:
_stopFlag
,
'tips'
:
_errorTips
,
'list'
:
_data
}
},
maidConfirmOk
:
function
(
type
)
{
var
_back
=
bargain
.
maidTest
(
type
);
//获取处理的数据
if
(
!
_back
.
flag
)
{
var
_len
=
_back
.
list
.
length
;
!
function
funTemp
(
count
)
{
if
(
count
>=
_len
)
{
//如果递归执行完毕则执行这条
alert
(
type
===
0
?
'保存成功'
:
'确认成功'
);
bargain
.
maidShow
();
}
else
{
$
.
ajax
({
type
:
'POST'
,
url
:
'/index/addRealIncome'
,
data
:
_back
.
list
[
count
],
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
funTemp
(
++
count
);
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
}
}(
0
);
}
else
{
alert
(
_back
.
tips
);
}
},
newAddTax
:
function
(
obj
)
{
var
_tempTableObj
=
$
(
'.addtax-modal-tax-table'
);
_tempTableObj
.
attr
(
'data-type'
,
obj
[
'type'
]);
var
_url
=
''
;
var
_data
=
{};
$
(
'#addtax_commission_input'
).
val
(
''
);
//开票金额置空
$
(
'#addtax_date'
).
val
(
''
);
//开票日期置空
if
(
obj
[
'type'
]
===
'new'
)
{
$
(
'#modal_new_tax .modal-title'
).
html
(
'新增开票'
);
_url
=
'/index/searchBargainAgents'
;
_data
[
'bargain_id'
]
=
bargain
.
bargain_id
;
}
else
{
$
(
'#modal_new_tax .modal-title'
).
html
(
'编辑开票'
);
_tempTableObj
.
attr
(
'data-recordid'
,
obj
[
'id'
]);
_url
=
'/index/getTaxesById'
;
_data
[
'taxes_id'
]
=
obj
[
'id'
];
};
$
.
ajax
({
type
:
'GET'
,
url
:
_url
,
data
:
_data
,
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
if
(
_data
[
'data'
]
&&
_data
[
'data'
].
length
&&
_data
[
'data'
].
length
>
0
)
{
$
(
'#addtax_commission_input'
).
val
(
_data
[
'data'
][
0
][
'total_fee'
]);
$
(
'#addtax_date'
).
val
(
_data
[
'data'
][
0
][
'operation_date'
]);
var
_htmlTemp
=
'<tr><td>分佣方</td><td>业务员</td><td>分佣比例</td><td>税费</td></tr>'
;
$
.
each
(
_data
[
'data'
],
function
(
i
,
v
)
{
_htmlTemp
+=
'<tr class="addtax-modal-tax-table-datatr" data-feeid="{feeid}" data-agentid="{id}" data-role="{role}"><td>{0}</td><td>{1}</td><td>{2}%</td><td contenteditable>{3}</td></tr>'
.
stringFormatObj
({
'0'
:
v
.
role_name
,
'1'
:
v
.
name
+
'-'
+
v
.
phone
,
'2'
:
v
.
scale
,
'3'
:
(
obj
[
'type'
]
===
'new'
)
?
''
:
v
.
fee
,
'role'
:
v
.
role
,
'id'
:
v
.
agent_id
,
'feeid'
:
v
.
id
});
});
$
(
'.addtax-modal-tax-table'
).
html
(
_htmlTemp
);
}
else
{
layerTipsX
(
_data
[
'msg'
]);
};
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
newAddTaxOk
:
function
()
{
var
_tempTableObj
=
$
(
'.addtax-modal-tax-table'
);
var
_data
=
{
'bargain_id'
:
bargain
.
bargain_id
,
'total_fee'
:
$
.
trim
(
$
(
'#addtax_commission_input'
).
val
()),
'operation_date'
:
$
(
'#addtax_date'
).
val
()
};
if
(
_tempTableObj
.
attr
(
'data-type'
)
===
'edit'
)
{
_data
[
'id'
]
=
_tempTableObj
.
attr
(
'data-recordid'
);
};
$
.
each
(
$
(
'.addtax-modal-tax-table-datatr'
),
function
(
i
,
v
)
{
_data
[
'tax['
+
i
+
']'
]
=
{
'fee'
:
v
.
childNodes
[
3
].
innerHTML
,
'agent_id'
:
v
.
getAttribute
(
'data-agentid'
),
'role'
:
v
.
getAttribute
(
'data-role'
),
'scale'
:
v
.
childNodes
[
2
].
innerHTML
.
split
(
'%'
)[
0
]
};
if
(
_tempTableObj
.
attr
(
'data-type'
)
===
'edit'
)
{
_data
[
'tax['
+
i
+
']'
][
'fee_id'
]
=
v
.
getAttribute
(
'data-feeid'
);
};
});
$
.
ajax
({
type
:
'POST'
,
url
:
'/index/addTallAge'
,
data
:
_data
,
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
alert
(
'新增成功!'
);
bargain
.
taxShow
();
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
account
:
function
()
{
$
.
ajax
({
type
:
'POST'
,
url
:
'/index/checkOver'
,
data
:
{
'bargain_id'
:
bargain
.
bargain_id
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
alert
(
'结单成功!'
);
bargain
.
getList
(
1
);
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
}
};
bargain
.
init
();
});
\ No newline at end of file
public/resource/js/reportList.js
View file @
976619b0
define
([
'doT'
,
'text!temp/reportList_template_tpl.html'
,
'text!temp/reportList_shuiFee_template_tpl.html'
,
'text!temp/reportList_maid_template_tpl.html'
,
'text!temp/reportList_maid_sub1_template_tpl.html'
,
'css!style/home.css'
,
'css!style/report_list.css'
,
'ckfinder'
,
'ckfinderStart'
,
'pagination'
,
'bootstrapJs'
],
function
(
doT
,
template
,
template_tax
,
template_maid
,
template_maid_sub1
)
{
define
([
'doT'
,
'text!temp/reportList_template_tpl.html'
,
'text!temp/reportList_shuiFee_template_tpl.html'
,
'text!temp/reportList_maid_template_tpl.html'
,
'text!temp/reportList_maid_sub1_template_tpl.html'
,
'css!style/home.css'
,
'css!style/report_list.css'
,
'ckfinder'
,
'ckfinderStart'
,
'pagination'
,
'bootstrapJs'
],
function
(
doT
,
template
,
template_tax
,
template_maid
,
template_maid_sub1
)
{
bargain
=
{
pageNo
:
1
,
/*第几页*/
...
...
@@ -7,9 +7,9 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
mainTabIndex
:
0
,
detailTabIndex
:
0
,
bargain_id
:
''
,
order_id
:
0
,
//订单id
order_id
:
0
,
//订单id
panfangData
:
null
,
maidTotalCommission
:
0
,
//应收总佣金
maidTotalCommission
:
0
,
//应收总佣金
init
:
function
()
{
//初始化dot
$
(
document
.
body
).
append
(
template
+
template_tax
+
template_maid
+
template_maid_sub1
);
...
...
@@ -20,535 +20,91 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
var
_doc
=
$
(
document
);
//主页面一级审核,二级审核,三级审核,结单四个tab的点击事件
//专员审核 总监审核 经理审核 出纳审核
_doc
.
on
(
'click'
,
'.maintable-top-sub-tr>a'
,
function
(
e
){
_doc
.
on
(
'click'
,
'.maintable-top-sub-tr>a'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
var
_this
=
$
(
this
);
_this
.
removeClass
(
'btn-default'
).
addClass
(
'btn-info'
).
siblings
().
removeClass
(
'btn-info'
).
addClass
(
'btn-default'
);
bargain
.
mainTabIndex
=
_this
.
index
();
console
.
log
(
bargain
.
mainTabIndex
);
bargain
.
getList
(
1
);
});
//搜索按钮的事件
_doc
.
on
(
'click'
,
'#maintable_search'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
bargain
.
getList
(
1
);
//一级审核搜索
});
//搜索的重置
$
(
"#maintable_reset"
).
click
(
function
()
{
document
.
getElementById
(
"maintable_form_search"
).
reset
();
});
//时间轴按钮
_doc
.
on
(
"click"
,
".timeline"
,
function
()
{
bargain
.
Timeline
();
});
//转到一级审核
_doc
.
on
(
'click'
,
'.maintable-btn-trans-one'
,
function
(
e
){
_doc
.
on
(
'click'
,
'.maintable-btn-trans-one'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
bargain
.
bargain_id
=
$
(
this
).
closest
(
'tr'
).
attr
(
"data-id"
);
layer
.
open
({
content
:
'确定转到一级审核?'
,
btn
:
[
'确定'
,
'取消'
],
yes
:
function
(
_index
)
{
bargain
.
transFirstExamine
();
layer
.
close
(
_index
);
}
content
:
'确定转到一级审核?'
,
btn
:
[
'确定'
,
'取消'
],
yes
:
function
(
_index
)
{
bargain
.
transFirstExamine
();
layer
.
close
(
_index
);
}
});
});
//结单
_doc
.
on
(
'click'
,
'.maintable-btn-account'
,
function
(
e
){
_doc
.
on
(
'click'
,
'.maintable-btn-account'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
bargain
.
bargain_id
=
$
(
this
).
closest
(
'tr'
).
attr
(
"data-id"
);
layer
.
open
({
content
:
'确定结单?'
,
btn
:
[
'确定'
,
'取消'
],
yes
:
function
(
_index
)
{
bargain
.
account
();
layer
.
close
(
_index
);
}
content
:
'确定结单?'
,
btn
:
[
'确定'
,
'取消'
],
yes
:
function
(
_index
)
{
bargain
.
account
();
layer
.
close
(
_index
);
}
});
});
//点击通过,修改全局bargain_id,弹出框出来
_doc
.
on
(
'click'
,
'[href=
\
"#modal-pass
\
"]'
,
function
()
{
bargain
.
bargain_id
=
$
(
this
).
closest
(
'tr'
).
attr
(
"data-id"
);
});
//点击通过,确定按钮触发的事件
_doc
.
on
(
'click'
,
'#pass_ok_btn'
,
function
()
{
_doc
.
on
(
'click'
,
'#pass_ok_btn'
,
function
()
{
bargain
.
pass
();
});
//点击详情按钮事件,获取报告详情
_doc
.
on
(
'click'
,
'.details-btn'
,
function
()
{
bargain
.
bargain_id
=
$
(
this
).
closest
(
'tr'
).
attr
(
"data-id"
);
$
(
'.detail-modal-header-tab>a:nth-of-type(1)'
).
removeClass
(
'btn-default'
).
addClass
(
'btn-info'
).
siblings
().
removeClass
(
'btn-info'
).
addClass
(
'btn-default'
);
bargain
.
detailTabIndex
=
0
;
$
(
'.detail-modal-body-sec:nth-of-type(1)'
).
show
().
siblings
().
hide
();
bargain
.
bargaininfoShow
();
$
(
'#modal_detail'
).
find
(
'iframe'
).
attr
(
'src'
,
'/app_broker/bargaininfo_detail_pc'
);
});
//详情弹出框里的tab点击事件,成交信息,分佣提成,开票税费
_doc
.
on
(
'click'
,
'.detail-modal-header-tab>a'
,
function
(
e
){
e
.
preventDefault
();
e
.
stopPropagation
();
var
_this
=
$
(
this
);
_this
.
removeClass
(
'btn-default'
).
addClass
(
'btn-info'
).
siblings
().
removeClass
(
'btn-info'
).
addClass
(
'btn-default'
);
bargain
.
detailTabIndex
=
_this
.
index
();
$
(
'.detail-modal-body-sec:nth-of-type('
+
(
bargain
.
detailTabIndex
+
1
)
+
')'
).
show
().
siblings
().
hide
();
if
(
bargain
.
detailTabIndex
==
0
){
bargain
.
bargaininfoShow
();
}
else
if
(
bargain
.
detailTabIndex
==
1
){
bargain
.
maidShow
();
}
else
{
bargain
.
taxShow
();
}
});
//详情弹出框,成交信息里的实收佣金相关的事件
var
_iYJAAObj
=
$
(
'.detail-modal-bargaininfo-commission-addarea'
);
_doc
.
on
(
'click'
,
'#bargaininfo_commission_add_btn>img'
,
function
(
e
){
e
.
preventDefault
();
e
.
stopPropagation
();
if
(
$
(
'.detail-modal-bargaininfo-commission-addarea>div'
).
length
>=
5
){
alert
(
'最多添加5条'
);
return
false
;
}
else
{
_iYJAAObj
.
append
(
'<div class="form-group detail-modal-bargaininfo-commission-sec"><label class="">实收佣金:</label><div class="input-group"><input type="number"class="form-control"placeholder="请输入"><div class="input-group-addon">元</div></div><label class="">收佣日期:</label><div class="input-group"><input type="date"class="form-control"placeholder="请输入"></div><mark href="javascript:;"class="detail-modal-bargaininfo-commission-cancel-pic"><img src="/resource/image/search_gb.png"/></mark></div>'
);
};
});
//详情弹出框,成交信息里的实收佣金相关的事件,点击x删除这条
_doc
.
on
(
'click'
,
'.detail-modal-bargaininfo-commission-cancel-pic'
,
function
(
e
){
e
.
preventDefault
();
e
.
stopPropagation
();
$
(
this
).
parent
().
remove
();
});
//详情弹出框,点击成交信息确定
_doc
.
delegate
(
"#bargaininfo_btn_save"
,
"click"
,
function
()
{
bargain
.
bargaininfoSave
();
});
//详情弹出框,点击开票税费下的新增税费,弹出框出来
_doc
.
on
(
'click'
,
'[href=
\
"#modal_new_tax
\
"]'
,
function
(
e
){
e
.
preventDefault
();
e
.
stopPropagation
();
var
_this
=
$
(
this
);
bargain
.
newAddTax
({
'type'
:
_this
.
attr
(
'data-recordid'
)?
'edit'
:
'new'
,
'id'
:
_this
.
attr
(
'data-recordid'
)
});
});
//详情弹出框,新增开票税费,金额输入框输入后,自动计算税费
_doc
.
on
(
'input'
,
'#addtax_commission_input'
,
function
(
e
){
e
.
preventDefault
();
e
.
stopPropagation
();
var
_this
=
$
(
this
);
var
_trObj
=
$
(
'.addtax-modal-tax-table-datatr'
);
$
.
each
(
_trObj
,
function
(
i
,
v
)
{
v
.
childNodes
[
3
].
innerHTML
=
dealJineNum
(
Number
(
v
.
childNodes
[
2
].
innerHTML
.
split
(
'%'
)[
0
])
*
0.01
*
Number
(
$
.
trim
(
_this
.
val
()))
*
0.1
);
});
});
//详情弹出框,新增开票税费,点击确定时的提交
_doc
.
on
(
'click'
,
'#addtax_commission_addok'
,
function
(
e
){
e
.
preventDefault
();
e
.
stopPropagation
();
bargain
.
newAddTaxOk
();
});
//详情弹出框,分佣提成里,点击新增
_doc
.
on
(
'click'
,
'[href="#modal_new_maid"]'
,
function
(
e
){
e
.
preventDefault
();
e
.
stopPropagation
();
bargain
.
newAddMaid
();
});
//详情弹出框,分佣提成里,点击新增,分佣方选择时触发的事件
_doc
.
on
(
'input'
,
'#addmaid_input_servant'
,
function
(
e
){
var
_this
=
$
(
this
);
$
(
'#addmaid_input_ywy'
).
val
(
''
);
//先置空
$
(
'#addmaid_input_shop'
).
val
(
''
);
//先置空
if
(
_this
.
val
()
===
''
){
}
else
if
(
_this
.
val
()
===
'5'
){
}
else
{
var
_rateTemp
=
bargain
.
getDefaultRadio
(
_this
.
val
());
$
(
'#addmaid_input_ratio'
).
val
(
_rateTemp
);
$
(
'#addmaid_input_cash'
).
val
(
dealJineNum
(
_rateTemp
*
bargain
.
maidTotalCommission
/
100
));
var
_arrTemp
=
bargain
.
panfangData
.
filter
(
function
(
item
,
index
,
array
){
return
(
item
.
role
==
_this
.
val
());
});
if
(
_arrTemp
.
length
===
0
){
return
false
;
}
else
if
(
_arrTemp
.
length
===
1
){
$
(
'#addmaid_input_ywy'
).
val
(
_arrTemp
[
0
].
name
+
'-'
+
_arrTemp
[
0
].
phone
).
attr
(
'data-id'
,
_arrTemp
[
0
].
id
);
bargain
.
getDepart
(
_arrTemp
[
0
].
id
,
function
(
obj
){
$
(
'#addmaid_input_shop'
).
val
(
obj
.
district_name
+
'-'
+
obj
.
store_name
);
});
}
else
{
$
(
'[href="#modal_new_maid_select"]'
).
click
();
var
_tempHtml
=
''
;
$
.
each
(
_arrTemp
,
function
(
i
,
v
)
{
_tempHtml
+=
'<li data-data="{data}">{0}-{1}</li>'
.
stringFormatObj
({
'data'
:
encodeURIComponent
(
JSON
.
stringify
(
v
)),
'0'
:
v
.
name
,
'1'
:
v
.
phone
});
});
$
(
'#addmaid_select_ul'
).
html
(
_tempHtml
);
}
}
});
//详情弹出框,分佣提成里,点击新增,分佣方选择,弹出选择列表触发的事件
_doc
.
on
(
'click'
,
'#addmaid_select_ul>li'
,
function
(
e
){
e
.
preventDefault
();
e
.
stopPropagation
();
var
_this
=
$
(
this
);
var
_dataTemp
=
JSON
.
parse
(
decodeURIComponent
(
_this
.
attr
(
'data-data'
)));
$
(
'#addmaid_input_ywy'
).
val
(
_dataTemp
.
name
+
'-'
+
_dataTemp
.
phone
).
attr
(
'data-id'
,
_dataTemp
.
id
);
bargain
.
getDepart
(
_dataTemp
.
id
,
function
(
obj
){
$
(
'#addmaid_input_shop'
).
val
(
obj
.
district_name
+
'-'
+
obj
.
store_name
);
});
_this
.
closest
(
'.modal-content'
).
find
(
'button.close'
).
click
();
});
//详情弹出框,分佣提成里,点击新增,点击保存触发的事件
_doc
.
on
(
'click'
,
'#addmaid_ok_btn'
,
function
(
e
){
e
.
preventDefault
();
e
.
stopPropagation
();
bargain
.
newAddMaidOk
();
});
//详情弹出框,分佣提成里,点击确认分佣触发的事件
_doc
.
on
(
'click'
,
'#maid_ok_btn'
,
function
(
e
){
e
.
preventDefault
();
e
.
stopPropagation
();
if
(
bargain
.
mainTabIndex
===
2
){
bargain
.
maidConfirmOk
(
1
);
}
else
{
alert
(
'财务第三级审核人员才能确认分佣!'
);
}
});
//详情弹出框,分佣提成里,点击保存触发的事件
_doc
.
on
(
'click'
,
'#maid_save_btn'
,
function
(
e
){
e
.
preventDefault
();
e
.
stopPropagation
();
// bargain.maidSave();
bargain
.
maidConfirmOk
(
0
);
$
(
'#modal_detail'
).
find
(
'iframe'
).
attr
(
'src'
,
'/app_broker/bargaininfo_detail_pc?bargain_id='
+
bargain
.
bargain_id
);
});
//详情弹出框,分佣提成里,点击增加实收按钮
_doc
.
on
(
'click'
,
'#maid_new_btn'
,
function
(
e
){
e
.
preventDefault
();
e
.
stopPropagation
();
var
_temp
=
$
(
'.detail-modal-maid-span-time'
);
var
_flag
=
false
;
if
(
_temp
&&
_temp
.
length
&&
_temp
.
length
>
0
){
$
.
each
(
_temp
,
function
(
i
,
v
)
{
if
(
v
.
innerHTML
==
''
){
_flag
=
true
;
return
false
;
};
});
};
if
(
_flag
){
alert
(
'前边一组收佣尚未确认分佣或成交信息里没有对应的实收佣金'
);
}
else
{
layer
.
open
({
content
:
'确认增加吗?'
,
btn
:
[
'确定'
,
'取消'
],
yes
:
function
(
_index
){
$
(
'.detail-modal-maid-mix-td'
).
append
(
document
.
getElementById
(
'reportList_maid_sub1_list_tpl'
).
innerHTML
);
layer
.
close
(
_index
);
}
});
};
});
//新增分佣提成,业务员input输入搜索,点击之后赋值
_doc
.
on
(
'click'
,
'#addmaid_input_ywy+ul>li'
,
function
()
{
var
_this
=
$
(
this
);
var
_id
=
_this
.
attr
(
'data-id'
);
_this
.
parent
().
prev
().
val
(
_this
.
html
()).
attr
(
'data-id'
,
_id
);
bargain
.
getDepart
(
_id
,
function
(
obj
){
$
(
'#addmaid_input_shop'
).
val
(
obj
.
district_name
+
'-'
+
obj
.
store_name
);
});
_this
.
parent
().
html
(
''
).
hide
();
});
//新增分佣提成,业务员input输入搜索
var
_ajaxObjTel
=
null
;
var
_addmaid_input_servantObj
=
$
(
'#addmaid_input_servant'
);
_doc
.
on
(
'input'
,
'#addmaid_input_ywy'
,
function
()
{
var
_this
=
$
(
this
);
if
(
_addmaid_input_servantObj
.
val
()
==
'5'
){
//当分佣方的值为5,合作方的时候,才能查询
var
_thisVal
=
$
.
trim
(
_this
.
val
());
_this
.
removeAttr
(
'data-id'
);
//移除之前携带的信息
if
(
_thisVal
!=
''
)
{
_ajaxObjTel
&&
_ajaxObjTel
.
abort
();
_ajaxObjTel
=
$
.
ajax
({
type
:
'GET'
,
url
:
'/index/getBroker_new'
,
data
:
{
'phone'
:
$
.
trim
(
_this
.
val
())
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
data
)
{
if
(
typeof
data
===
'object'
)
{
if
(
data
.
code
==
200
)
{
if
(
data
[
'data'
].
length
>
0
)
{
var
_htmlTemp
=
''
;
$
.
each
(
data
[
'data'
],
function
(
i
,
item
)
{
_htmlTemp
+=
'<li data-id="{3}">{0}-{1}<li>'
.
stringFormatObj
({
'0'
:
item
[
'name'
],
'1'
:
item
[
'phone'
],
'3'
:
item
[
'id'
]
});
});
_this
.
next
().
show
().
html
(
_htmlTemp
);
}
else
{
_this
.
next
().
html
(
''
);
};
}
else
{
alert
(
data
[
'msg'
]);
};
}
else
{
alert
(
'数据错误'
);
};
},
error
:
function
()
{
//alert('error');
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
alert
(
'请求超时'
);
};
}
});
}
else
{
_this
.
next
().
hide
();
}
}
else
{}
});
//时间轴点击事件
_doc
.
on
(
'click'
,
'a[href="#modal-time"]'
,
function
(
e
){
_doc
.
on
(
'click'
,
'a[href="#modal-time"]'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
var
_this
=
$
(
this
);
var
_id
=
_this
.
closest
(
'tr'
).
data
(
'orderid'
);
console
.
log
(
_id
);
$
(
'.iframe-time-line'
).
attr
(
'src'
,
'/app_broker/timeline_pc?order_id='
+
_id
);
$
(
'.iframe-time-line'
).
attr
(
'src'
,
'/app_broker/timeline_pc?order_id='
+
_id
);
});
},
getDefaultRadio
:
function
(
v
){
switch
(
Number
(
v
)){
case
1
:
return
25
;
case
2
:
return
30
;
case
3
:
return
35
;
case
4
:
return
10
;
default
:
return
25
;
}
},
getDepart
:
function
(
s
,
fn
){
$
.
ajax
({
type
:
'GET'
,
url
:
'/index/getAgentDistrictStore'
,
data
:
{
'id'
:
s
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
fn
&&
fn
(
_data
.
data
);
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
){
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
Timeline
:
function
()
{
//获取时间轴
$
.
ajax
({
'type'
:
'GET'
,
'url'
:
'/index/selectReportAll'
,
data
:
{
"order_id"
:
bargain
.
bargain_id
},
dataType
:
"json"
,
success
:
function
(
data
)
{
if
(
data
.
code
==
200
)
{
if
(
data
.
data
)
{
console
.
log
(
data
.
data
);
}
}
else
{
alert
(
'获取失败!'
);
}
}
});
},
bargaininfoShow
:
function
()
{
//报告详情
$
.
ajax
({
'type'
:
'GET'
,
'url'
:
'/index/bargainInfo'
,
data
:
{
"id"
:
bargain
.
bargain_id
},
dataType
:
"json"
,
success
:
function
(
data
)
{
if
(
data
.
code
==
200
)
{
if
(
data
.
data
)
{
$
(
'#bargaininfo_shop_type'
).
html
(
data
.
data
.
shop_type
==
'1'
?
'街铺'
:
'商场'
);
$
(
'#bargaininfo_is_open'
).
val
(
data
.
data
.
is_open
);
$
(
'#bargaininfo_beizhu'
).
val
(
data
.
data
.
content
);
$
(
"#bargaininfo_user_phone"
).
html
(
hideTel
(
data
.
data
.
user_phone
));
$
(
"#bargaininfo_user_name"
).
html
(
data
.
data
.
user_name
);
$
(
"#bargaininfo_internal_address"
).
html
(
data
.
data
.
internal_address
);
$
(
"#bargaininfo_shop_num"
).
html
(
data
.
data
.
house_number
);
$
(
"#bargaininfo_type"
).
val
(
data
.
data
.
trade_type
);
$
(
"#bargaininfo_total_commission"
).
val
(
data
.
data
.
commission
);
$
(
"#bargaininfo_create_time"
).
html
(
data
.
data
.
create_time
);
bargain
.
maidTotalCommission
=
Number
(
data
.
data
.
commission
);
//总佣金
bargain
.
order_id
=
Number
(
data
.
data
.
order_id
);
//订单id
var
_inputAreaTempObj
=
$
(
'.detail-modal-bargaininfo-commission-addarea'
);
if
(
data
.
data
.
practical_fee
&&
data
.
data
.
practical_fee
.
length
>
0
){
_inputAreaTempObj
.
html
(
''
);
}
else
{
_inputAreaTempObj
.
html
(
'<div class="form-group detail-modal-bargaininfo-commission-sec"><label class="">实收佣金:</label><div class="input-group"><input type="number"class="form-control"placeholder="请输入"><div class="input-group-addon">元</div></div><label class="">收佣日期:</label><div class="input-group"><input type="date"class="form-control"placeholder="请输入"></div><mark href="javascript:;"class="detail-modal-bargaininfo-commission-cancel-pic"><img src="/resource/image/search_gb.png"/></mark></div>'
);
}
$
.
each
(
data
.
data
.
practical_fee
,
function
(
i
,
v
)
{
_inputAreaTempObj
.
append
(
'<div data-id="{id}" class="form-group detail-modal-bargaininfo-commission-sec"><label class="">实收佣金:</label><div class="input-group"><input type="number"class="form-control"placeholder="请输入"value="{0}"><div class="input-group-addon">元</div></div><label class="">收佣日期:</label><div class="input-group"><input type="date"class="form-control"placeholder="请输入"value="{1}"></div></div>'
.
stringFormatObj
({
'0'
:
v
.
money
,
'1'
:
v
.
income_time
,
'id'
:
v
.
fee_id
}));
});
}
}
else
{
alert
(
'获取失败!'
);
}
}
});
},
bargaininfoSave
:
function
()
{
//修改报告详情
var
_data
=
{
'id'
:
bargain
.
bargain_id
,
'commission'
:
$
.
trim
(
$
(
'#bargaininfo_total_commission'
).
val
()),
'content'
:
$
.
trim
(
$
(
'#bargaininfo_beizhu'
).
val
()),
'is_open'
:
$
(
'#bargaininfo_is_open'
).
val
(),
'trade_type'
:
$
(
'#bargaininfo_type'
).
val
()
};
$
.
each
(
$
(
'.detail-modal-bargaininfo-commission-sec'
),
function
(
i
,
v
)
{
_data
[
'practical_fee['
+
i
+
']'
]
=
{
'fee_id'
:
v
.
getAttribute
(
'data-id'
)?
v
.
getAttribute
(
'data-id'
):
0
,
'fee'
:
$
.
trim
(
$
(
v
).
find
(
'input'
).
eq
(
0
).
val
()),
'operation_date'
:
$
.
trim
(
$
(
v
).
find
(
'input'
).
eq
(
1
).
val
())
};
});
$
.
ajax
({
'type'
:
'POST'
,
'url'
:
'/index/editBargainInfo'
,
data
:
_data
,
dataType
:
"json"
,
success
:
function
(
data
)
{
if
(
data
.
code
==
200
)
{
alert
(
'修改成功'
);
bargain
.
bargaininfoShow
();
bargain
.
getList
(
0
);
}
else
{
alert
(
data
.
msg
);
}
}
});
},
maidShow
:
function
()
{
$
(
'[href="#modal_new_maid"]'
).
hide
();
//默认隐藏新增按钮
$
(
"#maid_new_table_list"
).
html
(
''
);
$
.
ajax
({
type
:
'GET'
,
url
:
'/index/commissionList'
,
data
:
{
'id'
:
bargain
.
bargain_id
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
$
(
"#maid_new_table_list"
).
html
(
doT
.
template
(
$
(
'#reportList_maid_list_tpl'
).
html
())(
_data
));
var
_isShowAddBtnFlag
=
true
;
$
.
each
(
$
(
'.detail-modal-maid-span-time'
),
function
(
i
,
v
)
{
if
(
v
.
innerHTML
){
_isShowAddBtnFlag
=
false
;
};
});
//如果确认时间都有,都不为空,则把新增按钮显示出来
if
(
_isShowAddBtnFlag
){
$
(
'[href="#modal_new_maid"]'
).
show
();
};
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
){
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
//通过
pass
:
function
()
{
//点击通过
var
a_url
=
''
;
...
...
@@ -558,14 +114,14 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
if
(
bargain
.
mainTabIndex
==
1
)
{
a_url
=
"/index/checkReportManager/1"
};
// if(bargain.mainTabIndex == 2) {
// a_url = "/index/checkReportMajordomo/2"
// };
// if(bargain.mainTabIndex == 3) {
// a_url = "/index/checkReportCashier/3"
// };
//审核来源 1.成交报告申请结单 2.待撤销(退款) 3.申请撤销成交报告
//成交报告状态 10已提交 20待撤销
// if(bargain.mainTabIndex == 2) {
// a_url = "/index/checkReportMajordomo/2"
// };
// if(bargain.mainTabIndex == 3) {
// a_url = "/index/checkReportCashier/3"
// };
//审核来源 1.成交报告申请结单 2.待撤销(退款) 3.申请撤销成交报告
//成交报告状态 10已提交 20待撤销
$
.
ajax
({
'type'
:
'POST'
,
'url'
:
a_url
,
...
...
@@ -579,7 +135,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
success
:
function
(
data
)
{
if
(
data
.
code
==
200
)
{
if
(
data
.
data
)
{
bargain
.
getList
(
1
);
}
}
else
{
...
...
@@ -588,413 +144,77 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
}
});
},
// 开票税费
taxShow
:
function
()
{
$
.
ajax
({
type
:
'GET'
,
url
:
'/index/getTallAge'
,
data
:
{
'bargain_id'
:
bargain
.
bargain_id
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
$
(
"#tax_main_box"
).
html
(
doT
.
template
(
$
(
'#reportList_shuiFee_list_tpl'
).
html
())(
_data
.
data
));
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
){
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
newAddMaid
:
function
(){
$
.
ajax
({
type
:
'GET'
,
url
:
'/index/searchOrderAgents'
,
data
:
{
'order_id'
:
bargain
.
order_id
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
bargain
.
panfangData
=
_data
.
data
;
console
.
log
(
bargain
.
panfangData
);
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
){
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
newAddMaidOk
:
function
(){
console
.
log
(
7789
);
//转到一级审核
transFirstExamine
:
function
()
{
$
.
ajax
({
type
:
'POST'
,
url
:
'/index/addBargain'
,
data
:
{
'id'
:
bargain
.
bargain_id
,
'agent_id'
:
$
(
'#addmaid_input_ywy'
).
attr
(
'data-id'
),
'scale_fee'
:
$
(
'#addmaid_input_cash'
).
val
(),
'role'
:
$
(
'#addmaid_input_servant'
).
val
(),
'scale'
:
$
(
'#addmaid_input_ratio'
).
val
(),
'source'
:
1
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
alert
(
'新增成功!'
);
bargain
.
maidShow
();
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
){
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
maidTest
:
function
(
type
){
var
_stopFlag
=
false
;
var
_data
=
[];
var
_parObj
=
$
(
'#maid_new_table_list>tr'
);
var
_errorTips
=
'请填写完整'
;
var
_scaleTotal
=
0
;
if
(
_parObj
.
length
>
0
){
$
.
each
(
_parObj
,
function
(
i
,
v
)
{
console
.
count
(
'$v'
);
var
_$v
=
$
(
v
);
var
_agentId
=
_$v
.
attr
(
'data-agentid'
);
//经纪人id
var
_role
=
_$v
.
attr
(
'data-role'
);
//盘方等类型
var
_scaleVal
=
$
.
trim
(
_$v
.
find
(
'.detail-modal-maid-span-scale'
).
html
());
//分佣比例
var
_shouldCommissionVal
=
$
.
trim
(
_$v
.
find
(
'.detail-modal-maid-td-should-commission'
).
html
());
//应分佣金
var
_dataTemp
=
{
'bargain_id'
:
_$v
.
attr
(
'data-id'
),
//成交报告id
'last_commission_id'
:
_$v
.
attr
(
'lastid'
)?
_$v
.
attr
(
'lastid'
):
0
,
//最后一个提交的记录id
'is_account_commission'
:
type
//0是保存,1是确认分佣
};
if
(
_scaleVal
==
''
||
_shouldCommissionVal
==
''
){
_stopFlag
=
true
;
}
else
{
var
_parObj2
=
_$v
.
find
(
'.detail-modal-maid-mix-td>div'
);
if
(
_parObj2
.
length
>
0
){
$
.
each
(
_parObj2
,
function
(
i2
,
v2
)
{
console
.
count
(
'$v2'
);
var
_$v2
=
$
(
v2
);
var
_cid
=
_$v2
.
attr
(
'data-id'
);
_cid
=
_cid
?
_cid
:
0
;
//如果没有这个id,则为新增,传0
var
_sfyj
=
$
.
trim
(
_$v2
.
find
(
'.detail-modal-maid-span-real-fee'
).
html
());
var
_sxf
=
$
.
trim
(
_$v2
.
find
(
'.detail-modal-maid-span-service-charge'
).
html
());
var
_csjj
=
$
.
trim
(
_$v2
.
find
(
'.detail-modal-maid-span-charity-fund'
).
html
());
var
_xjj
=
$
.
trim
(
_$v2
.
find
(
'.detail-modal-maid-span-cash'
).
html
());
var
_ssyj
=
$
.
trim
(
_$v2
.
find
(
'.detail-modal-maid-span-practical-fee'
).
html
());
if
(
_sfyj
==
''
||
_sxf
==
''
||
_csjj
==
''
||
_xjj
==
''
||
_ssyj
==
''
){
_stopFlag
=
true
;
}
else
{
_dataTemp
[
'commission_date['
+
i2
+
']'
]
=
{
'agent_id'
:
_agentId
,
//业务员id
'role'
:
_role
,
//盘方等角色类型
'scale'
:
Number
(
_scaleVal
),
//分佣比例
'should_commission'
:
_shouldCommissionVal
,
//应分佣金
'commission_id'
:
_cid
,
//子记录id
'real_fee'
:
_sfyj
,
//实分佣金
'service_charge'
:
_sxf
,
//手续费
'charity_fund'
:
_csjj
,
//慈善基金
'cash'
:
_xjj
,
//现金奖
'practical_fee'
:
_ssyj
//实收佣金
};
}
});
}
else
{
type
:
'POST'
,
url
:
'/index/toReportListOne'
,
data
:
{
'bargain_id'
:
bargain
.
bargain_id
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
alert
(
'修改成功'
);
bargain
.
getList
(
1
);
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
};
_data
.
push
(
_dataTemp
);
});
};
$
.
each
(
$
(
'.detail-modal-maid-span-scale'
),
function
(
i
,
v
)
{
_scaleTotal
+=
Number
(
$
.
trim
(
v
.
innerHTML
));
});
if
(
_scaleTotal
!=
100
){
_stopFlag
=
true
;
_errorTips
=
'分佣比例一定要是100%,否则无法提交'
;
};
return
{
'flag'
:
_stopFlag
,
'tips'
:
_errorTips
,
'list'
:
_data
}
},
maidConfirmOk
:
function
(
type
){
var
_back
=
bargain
.
maidTest
(
type
);
//获取处理的数据
if
(
!
_back
.
flag
){
var
_len
=
_back
.
list
.
length
;
!
function
funTemp
(
count
)
{
if
(
count
>=
_len
)
{
//如果递归执行完毕则执行这条
alert
(
type
===
0
?
'保存成功'
:
'确认成功'
);
bargain
.
maidShow
();
}
else
{
$
.
ajax
({
type
:
'POST'
,
url
:
'/index/addRealIncome'
,
data
:
_back
.
list
[
count
],
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
funTemp
(
++
count
);
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
){
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
}
}(
0
);
}
else
{
alert
(
_back
.
tips
);
}
},
newAddTax
:
function
(
obj
)
{
var
_tempTableObj
=
$
(
'.addtax-modal-tax-table'
);
_tempTableObj
.
attr
(
'data-type'
,
obj
[
'type'
]);
var
_url
=
''
;
var
_data
=
{};
$
(
'#addtax_commission_input'
).
val
(
''
);
//开票金额置空
$
(
'#addtax_date'
).
val
(
''
);
//开票日期置空
if
(
obj
[
'type'
]
===
'new'
){
$
(
'#modal_new_tax .modal-title'
).
html
(
'新增开票'
);
_url
=
'/index/searchBargainAgents'
;
_data
[
'bargain_id'
]
=
bargain
.
bargain_id
;
}
else
{
$
(
'#modal_new_tax .modal-title'
).
html
(
'编辑开票'
);
_tempTableObj
.
attr
(
'data-recordid'
,
obj
[
'id'
]);
_url
=
'/index/getTaxesById'
;
_data
[
'taxes_id'
]
=
obj
[
'id'
];
};
$
.
ajax
({
type
:
'GET'
,
url
:
_url
,
data
:
_data
,
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
if
(
_data
[
'data'
]
&&
_data
[
'data'
].
length
&&
_data
[
'data'
].
length
>
0
){
$
(
'#addtax_commission_input'
).
val
(
_data
[
'data'
][
0
][
'total_fee'
]);
$
(
'#addtax_date'
).
val
(
_data
[
'data'
][
0
][
'operation_date'
]);
var
_htmlTemp
=
'<tr><td>分佣方</td><td>业务员</td><td>分佣比例</td><td>税费</td></tr>'
;
$
.
each
(
_data
[
'data'
],
function
(
i
,
v
)
{
_htmlTemp
+=
'<tr class="addtax-modal-tax-table-datatr" data-feeid="{feeid}" data-agentid="{id}" data-role="{role}"><td>{0}</td><td>{1}</td><td>{2}%</td><td contenteditable>{3}</td></tr>'
.
stringFormatObj
({
'0'
:
v
.
role_name
,
'1'
:
v
.
name
+
'-'
+
v
.
phone
,
'2'
:
v
.
scale
,
'3'
:
(
obj
[
'type'
]
===
'new'
)?
''
:
v
.
fee
,
'role'
:
v
.
role
,
'id'
:
v
.
agent_id
,
'feeid'
:
v
.
id
});
});
$
(
'.addtax-modal-tax-table'
).
html
(
_htmlTemp
);
}
else
{
layerTipsX
(
_data
[
'msg'
]);
};
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
){
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
newAddTaxOk
:
function
(){
var
_tempTableObj
=
$
(
'.addtax-modal-tax-table'
);
var
_data
=
{
'bargain_id'
:
bargain
.
bargain_id
,
'total_fee'
:
$
.
trim
(
$
(
'#addtax_commission_input'
).
val
()),
'operation_date'
:
$
(
'#addtax_date'
).
val
()
};
if
(
_tempTableObj
.
attr
(
'data-type'
)
===
'edit'
){
_data
[
'id'
]
=
_tempTableObj
.
attr
(
'data-recordid'
);
};
$
.
each
(
$
(
'.addtax-modal-tax-table-datatr'
),
function
(
i
,
v
)
{
_data
[
'tax['
+
i
+
']'
]
=
{
'fee'
:
v
.
childNodes
[
3
].
innerHTML
,
'agent_id'
:
v
.
getAttribute
(
'data-agentid'
),
'role'
:
v
.
getAttribute
(
'data-role'
),
'scale'
:
v
.
childNodes
[
2
].
innerHTML
.
split
(
'%'
)[
0
]
};
if
(
_tempTableObj
.
attr
(
'data-type'
)
===
'edit'
){
_data
[
'tax['
+
i
+
']'
][
'fee_id'
]
=
v
.
getAttribute
(
'data-feeid'
);
};
});
$
.
ajax
({
type
:
'POST'
,
url
:
'/index/addTallAge'
,
data
:
_data
,
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
alert
(
'新增成功!'
);
bargain
.
taxShow
();
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
){
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
//转到一级审核
transFirstExamine
:
function
(){
$
.
ajax
({
type
:
'POST'
,
url
:
'/index/toReportListOne'
,
data
:
{
'bargain_id'
:
bargain
.
bargain_id
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
alert
(
'修改成功'
);
bargain
.
getList
(
1
);
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
){
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
account
:
function
(){
account
:
function
()
{
$
.
ajax
({
type
:
'POST'
,
url
:
'/index/checkOver'
,
data
:
{
'bargain_id'
:
bargain
.
bargain_id
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
alert
(
'结单成功!'
);
bargain
.
getList
(
1
);
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
type
:
'POST'
,
url
:
'/index/checkOver'
,
data
:
{
'bargain_id'
:
bargain
.
bargain_id
},
timeout
:
30000
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
typeof
_data
===
'object'
)
{
if
(
_data
[
'code'
]
==
'200'
)
{
alert
(
'结单成功!'
);
bargain
.
getList
(
1
);
}
else
{
layerTipsX
(
_data
[
'msg'
]);
}
}
else
{
layerTipsX
(
'数据错误'
);
};
},
error
:
function
()
{
layerTipsX
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
layerTipsX
(
'请求超时,请重试'
);
};
}
});
},
//获取一级审核,二级审核,三级审核,结单不同的ajax请求url
switchUrl
:
function
(){
switch
(
Number
(
this
.
mainTabIndex
))
{
switchUrl
:
function
()
{
switch
(
Number
(
this
.
mainTabIndex
))
{
case
0
:
return
'/index/reportListOne/1'
;
case
1
:
...
...
@@ -1008,7 +228,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
}
},
//获取一级审核,二级审核,三级审核,结单数据列表共用的方法
getList
:
function
(
pageNo
){
getList
:
function
(
pageNo
)
{
console
.
count
(
'bar'
);
var
params
=
{
'pageNo'
:
pageNo
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment