123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- $('ul.nav-tabs li').click(function(){
- $(this).addClass('active').siblings().removeClass('active')
- });
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'collectstatement/index',
- table: 'orders_collect'
- },
- showToggle: false,
- showColumns: false,
- showExport: false,
- commonSearch: false,
- operate: false,
- search:false,
- onLoadSuccess: function (data) {
- $("[data-toggle='tooltip']").tooltip({trigger: 'focus hover',html : true });
- }
- });
- var table = $("#table");
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'createdate',
- columns: [Controller.api.showColumns()]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- api: {
- showColumns:function(){
- var cols = new Array();
- cols.push({field: 'createdate', title: __('日期'),formatter: Controller.api.formatter.createtime});
- cols.push({field: 'pv', title: __('PV'),formatter:Controller.api.formatter.format_pv});
- cols.push({field: 'uv', title: __('UV'),formatter:Controller.api.formatter.format_uv});
- cols.push({field: 'recharge_money', title: __('总充值')});
- cols.push({field: 'normal_recharge_money', title: __('普通充值'),formatter: Controller.api.formatter.normal_recharge_money});
- cols.push({field: 'normal_recharge_orders_count', title: __('普通充值订单数'),formatter: Controller.api.formatter.normal_recharge_orders_count });
- cols.push({field: 'vip_recharge_money', title: __('年度VIP会员'),formatter: Controller.api.formatter.vip_recharge_money});
- cols.push({field: 'vip_recharge_orders_count', title: __('年度VIP会员订单数'),formatter: Controller.api.formatter.vip_recharge_orders_count});
- return cols;
- },
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- },formatter: {
- format_pv:function(value,row,index){
- return parseInt(row.pv);
- },
- format_uv:function(value,row,index){
- return parseInt(row.uv);
- },
- normal_recharge_orders: function (value, row, index) {
- return '<span style="color:#e74c3c">¥'+((row.recharge_money-row.recharge_money_benefit)* 1.00).toFixed(2) + '</span>';
- },
- normal_recharge_money:function (value, row, index) {
- var normal_recharge_str = '<p>¥'+row.normal_recharge_money+'</p>';
- if(row.normal_recharge_orders>0){
- var normal_recharge_str_avg = Number(row.normal_recharge_money/row.normal_recharge_orders) * 1.00;
- normal_recharge_str += '<i>成功人次:'+row.normal_recharge_orders+'<br/>人均:¥'+ Number(normal_recharge_str_avg.toFixed(2))+'</i>';
- }else{
- normal_recharge_str +='<i>成功人次:0<br/>人均:¥0'+'</i>';
- }
- return normal_recharge_str;
- },
- normal_recharge_orders_count:function(value,row,index){
- var normal_recharge_order_str = '<p>已支付:'+row.normal_recharge_orders+'笔</p>';
- var wzf = row.normal_recharge_orders_count-row.normal_recharge_orders;
- if(row.normal_recharge_orders > 0){
- if (row.kandian_recharge_orders_count >0) {
- var normal_recharge_str_order_avg = (row.kandian_recharge_orders*100/row.kandian_recharge_orders_count) * 1.00;
- } else {
- var normal_recharge_str_order_avg = (row.normal_recharge_orders*100/row.normal_recharge_orders_count) * 1.00;
- }
- normal_recharge_order_str += '<p>未支付:'+wzf+'笔</p>';
- normal_recharge_order_str += '<p>完成率:'+ Math.floor(normal_recharge_str_order_avg)+'%'+'</p>';
- }else{
- normal_recharge_order_str += '<p>未支付:'+wzf+'笔</p>';
- normal_recharge_order_str += '<p>完成率:0%'+'</p>';
- }
- return normal_recharge_order_str;
- },
- vip_recharge_money:function (value, row, index) {
- var vip_recharge_str = '<p>¥'+row.vip_recharge_money+'</p>';
- if(row.vip_recharge_orders > 0){
- var vip_recharge_str_avg = Number(row.vip_recharge_money/row.vip_recharge_orders) * 1.00;
- vip_recharge_str += '<i>成功人次:'+row.vip_recharge_orders+'<br/>人均:¥'+ Number(vip_recharge_str_avg.toFixed(2))+'</i>';
- }else{
- vip_recharge_str +='<i>成功人次:0<br/>人均:¥0'+'</i>';
- }
- return vip_recharge_str;
- },
- vip_recharge_orders_count:function(value,row,index){
- var vip_recharge_order_str = '<p>已支付:'+row.vip_recharge_orders+'笔</p>';
- var vipwzf = row.vip_recharge_orders_count-row.vip_recharge_orders;
- if(row.vip_recharge_orders > 0){
- if(row.vip_recharge_orders_count){
- var vip_recharge_str_order_avg = (row.vip_recharge_orders*100/row.vip_recharge_orders_count) * 1.00;
- }else{
- var vip_recharge_str_order_avg = 0;
- }
- vip_recharge_order_str += '<p>未支付:'+vipwzf+'笔</p>';
- vip_recharge_order_str += '<p>完成率:'+ Math.floor(vip_recharge_str_order_avg)+'%'+'</p>';
- }else{
- vip_recharge_order_str += '<p>未支付:'+vipwzf+'笔</p>';
- vip_recharge_order_str += '<p>完成率:0%'+'</p>';
- }
- return vip_recharge_order_str;
- },
- total_benefit:function(value,row,index){
- return '¥'+value;
- },
- total_benefit_channel:function(value,row,index) {
- return '<span style="color:#e74c3c">¥' + Number(value).toFixed(2) + '</span>';
- },
- createtime:function(value,row,index){
- return value.substring(0,4)+'-'+ value.substring(4,6)+'-'+value.substring(6,8);
- },
- }
- }
- };
- return Controller;
- });
|