| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406 |
- layui.use(['table', 'jquery', 'madmin', 'mhttp', 'layer', 'form', 'common', 'laydate'], function () {
- let table = layui.table;
- let $ = layui.jquery;
- let admin = layui.madmin;
- let layer = layui.layer;
- let form = layui.form;
- let mhttp = layui.mhttp;
- var laydate = layui.laydate;
- admin.getConfig();
- laydate.render({
- elem: '#start_date',
- type: 'date',
- format: "yyyy-MM-dd"
- });
- laydate.render({
- elem: '#end_date',
- type: 'date',
- format: "yyyy-MM-dd"
- });
- let beginTime = GetQueryString('start_date') ?? null;
- let endTime = GetQueryString('end_date') ?? null;
- let username = GetQueryString('username') ?? null;
- let nick = GetQueryString('nick') ?? null;
- let uid = GetQueryString('uid') ?? null;
- let agent_uid = GetQueryString('agent_uid') ?? null;
- let deduction_switch_num = GetQueryString('deduction_switch_num') ?? null;
- let mom_app_uid = GetQueryString('mom_app_uid') ?? null;
- let appArray = {};
- let appArrayInfo = {};
- if (deduction_switch_num){
- deduction_switch = deduction_switch_num;
- }
- $('.mom_app_uid').val(mom_app_uid);
- let ret = mhttp.ajax({
- url: '/app/all'
- });
- ret.then((data) => {
- if (data.code === 200) {
- let html = '<option value=""></option>';
- for (var i in data.data) {
- appArray[data.data[i].uid] = data.data[i].name;
- appArrayInfo[data.data[i].uid] = data.data[i];
- html += '<option class="se_' + data.data[i].uid + '" value="' + data.data[i].uid + '">' + data.data[i].name + '</option>';
- }
- $('.mom_app_uid').append(html);
- $('.mom_app_uid .se_' + mom_app_uid).attr('selected', 'selected');
- form.render();
- let cols = [
- [
- {
- title: 'UID',
- field: 'uid',
- align: 'center'
- },
- {
- title: '昵称',
- field: 'nick',
- align: 'center'
- },
- {
- title: '账号',
- field: 'username',
- align: 'center'
- },
- {
- title: '今日充值',
- field: 'td_order_success_money',
- align: 'center'
- },
- {
- title: '今日注册',
- field: 'td_users_total',
- align: 'center'
- },
- {
- title: '今日注册扣量',
- field: 'td_users_deduction',
- align: 'center'
- },
- {
- title: '总充值',
- field: 'order_success_money',
- align: 'center'
- },
- {
- title: '总注册扣量',
- field: 'users_deduction',
- align: 'center'
- },
- {
- title: 'cpa支出金额',
- field: 'cps_money',
- align: 'center'
- },
- {
- title: '总注册',
- field: 'users_total',
- align: 'center'
- },
- {
- title: '上级代理',
- field: 'parent_uid',
- align: 'center'
- },
- {
- title: '所属应用',
- field: 'app_name',
- align: 'center'
- },
- {
- title: '分成比例(%)',
- field: 'commission_ratio',
- align: 'center'
- },
- {
- title: '最低提现金额',
- field: 'withdraw_amount',
- align: 'center',
- templet: function (d) {
- return d.withdraw_amount === 0 ? '-' : d.withdraw_amount;
- }
- },
- {
- title: '最低提现USDT',
- field: 'withdraw_usdt',
- align: 'center',
- templet: function (d) {
- return d.withdraw_usdt === 0 ? '-' : d.withdraw_usdt;
- }
- },
- {
- title: '时间筛选总充值',
- field: 'all_success_money',
- align: 'center'
- },
- {
- title: '筛选总充值扣量',
- field: 'add_deduction_success_money',
- align: 'center'
- },
- {
- title: '今日充值扣量',
- field: 'td_deduction_money',
- align: 'center'
- },
- {
- title: '时间筛选总注册',
- field: 'all_users_total',
- align: 'center'
- },
- {
- title: '筛选总注册扣量',
- field: 'add_users_deduction',
- align: 'center'
- },
- {
- title: '今日提现',
- field: 'td_withdraw',
- align: 'center'
- },
- {
- title: '总充值扣量',
- field: 'deduction_success_money',
- align: 'center'
- },
- {
- title: '累计提现',
- field: 'withdraw_money',
- align: 'center'
- },
- {
- title: '余额',
- field: 'balance',
- align: 'center'
- },
- {
- title: '冻结资金',
- field: 'frozen',
- align: 'center'
- },
- {
- title: '扣量类型',
- field: 'jdata',
- templet: function (d) {
- var a;
- switch (d.deduction_switch) {
- case 0:
- a = "全局"
- break;
- case 1:
- a = "cps"
- break;
- case 2:
- a = '<span style=\'color: red\'>cpa</span>';
- break;
- case 3:
- a = 'cpa全局扣量';
- break;
- }
- return a;
- },
- align: 'center'
- },
- {
- title: '扣量单价',
- field: 'cpa_price',
- align: 'center'
- },
- {
- title: '状态',
- field: 'status',
- toolbar: '#agent-status',
- align: 'center'
- },
- {
- title: '上次登陆时间',
- field: 'last_login_at',
- align: 'center'
- },
- {
- title: '上次登陆IP',
- field: 'last_login_ip',
- align: 'center'
- },
- {
- title: '更新时间',
- field: 'updated_at',
- align: 'center'
- },
- {
- title: '操作',
- toolbar: '#agent-bar',
- width: '30',
- fixed: 'right',
- align: 'center'
- }
- ]
- ]
- let search = httpRequestPostData({
- username: username,
- mom_app_uid: mom_app_uid,
- nick: nick,
- uid: uid,
- parent_uid: agent_uid,
- deduction_switch: deduction_switch,
- manage: 1,
- start_date: beginTime,
- end_date: endTime
- });
- table.render({
- elem: '#agent-table',
- method: 'POST',
- request: {
- pageName: 'page',
- limitName: 'page_size'
- },
- async: false,
- headers: {
- "AUTH-TOKEN": localStorage.getItem('XSRF-TOKEN') ?? ''
- },
- contentType: 'application/json',
- where: search,
- url: getMyApiUrl('/agent/lists'),
- limit: 20,
- limits: [20, 30, 40, 50, 80, 100],
- parseData: function (res) {
- return httpRequestPagesParseData(res);
- },
- response: {
- "statusCode": 200,
- },
- done: function (data, page, total) {
- var intCode = parseInt(data.code);
- if (intCode === 403) {
- cbRespnseRedirectLogin(data);
- } else if (intCode === 401) {
- // 仅仅是过期了,这里可以有其他逻辑补偿.
- // 暂时跳到登陆页面
- cbRespnse401(data);
- }
- onloadRender();
- },
- error: function (obj, message) {
- cbRespnseReloadPage(obj, message);
- },
- page: true,
- cols: cols,
- skin: 'line',
- toolbar: '#agent-toolbar',
- defaultToolbar: [{
- title: '刷新',
- layEvent: 'refresh',
- icon: 'layui-icon-refresh',
- }, 'filter', 'print', 'exports']
- });
- } else {
- layer.msg(data.message, {icon: 2, time: 1000});
- }
- });
- form.on('submit(search)', function (data) {
- // 查询数据
- if (data.field.start_date !== '' || data.field.end_date !== '') {
- if (!data.field.start_date || !data.field.end_date) {
- layer.msg('请核对开始时间与结束时间!');
- return false;
- }
- let beginTimeC = new Date(data.field.start_date);
- let endTimeC = new Date(data.field.end_date);
- if (beginTimeC > endTimeC) {
- layer.msg('开始时间不能大于结束时间!');
- return false;
- }
- }
- });
- $('#start_date').val(beginTime);
- $('#end_date').val(endTime);
- $('.username').val(username);
- $('.nick').val(nick);
- $('.uid').val(uid);
- $('.agent_uid').val(agent_uid);
- $('.deduction_switch_num_'+deduction_switch_num).attr('selected','selected');
- form.render();
- table.on('toolbar(agent-table)', function (obj) {
- if (obj.event === 'add') {
- window.add();
- } else if (obj.event === 'refresh') {
- window.refresh();
- } else if (obj.event === 'batchRemove') {
- window.batchRemove(obj);
- }
- });
- window.add = function () {
- layer.open({
- id: 'agent_create',
- type: 2,
- title: '添加',
- shade: 0.1,
- offset: '0px',
- area: ['450px', '600px'],
- maxWidth: 500,
- maxHeight: 600,
- scrollbar: true,
- content: 'agent_create.html',
- });
- }
- // 表单内
- table.on('tool(agent-table)', function (obj) {
- if (obj.event === 'remove') {
- window.remove(obj);
- } else if (obj.event === 'edit') {
- window.edit(obj);
- }
- });
- window.edit = function (obj) {
- layer.open({
- id: 'agent-edit',
- type: 2,
- title: '修改',
- shade: 0.1,
- offset: '0px',
- area: ['450px', '600px'],
- maxWidth: 500,
- maxHeight: 600,
- scrollbar: true,
- content: 'agent_edit.html?agent_uid=' + obj.data.uid,
- });
- }
- // 状态修改
- form.on('switch(agent-status-edit)', function (obj) {
- let status = layer.load();
- let postData = {
- uid: this.value
- };
- let ret = mhttp.ajax({
- url: '/agent/edit/status',
- data: postData,
- });
- ret.then((data) => {
- layer.close(status);
- if (data.code === 200) {
- layer.msg(data.message, {icon: 1, time: 1000});
- } else {
- layer.msg(data.message, {icon: 2, time: 1000});
- }
- });
- });
- window.refresh = function (param) {
- table.reload('agent-table');
- }
- $('#reset').click(function (){
- $('.deduction_switch_num option').removeAttr('selected');
- form.render()
- });
- })
|