| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- 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 common = layui.common;
- let mhttp = layui.mhttp;
- let laydate = layui.laydate;
- admin.getConfig();
- laydate.render({
- type: 'datetime',
- elem: '#start_date'
- });
- laydate.render({
- type: 'datetime',
- elem: '#end_date'
- });
- let beginTime = null;
- if (GetQueryString('start_date')){
- beginTime = GetQueryString('start_date');
- }
- let endTime = null;
- if (GetQueryString('end_date')){
- endTime = GetQueryString('end_date');
- }
- //搜索条件
- 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 beginTime = new Date(data.field.start_date);
- let endTime = new Date(data.field.end_date);
- if (beginTime > endTime) {
- layer.msg('开始时间不能大于结束时间!');
- return false;
- }
- }
- // return false;
- });
- if (beginTime) {
- beginTime = beginTime.replace('+', ' ');
- }
- if (endTime) {
- endTime = endTime.replace('+', ' ');
- }
- $('#start_date').val(beginTime);
- $('#end_date').val(endTime);
- form.render();
- let search = httpRequestPostData({
- start_date: beginTime,
- end_date: endTime,
- });
- let cols = [
- [
- {
- title: 'UID',
- field: 'uid',
- align: 'center'
- },
- {
- title: '提现时间',
- field: 'created_at',
- align: 'center'
- },
- {
- title: '提现方式',
- field: 'type_name',
- align: 'center'
- },
- {
- title: '提现金额',
- field: 'pay_amount',
- align: 'center',
- },
- {
- title: '状态',
- templet: function (d) {
- switch (d.status) {
- case 1:
- return '<span class="status-type" style="color:#d30d3d;font-weight: 900">拒绝</span>';
- case 2:
- return '<span class="status-type" style="color:#de8e17;font-weight: 900">申请中</span>';
- case 3:
- return '<span class="status-type" style="color:#3f9f05;font-weight: 900">已打款</span>';
- case 4:
- return '<span class="status-type" style="color:#0ea88c;font-weight: 900">拒接并扣除</span>';
- }
- },
- align: 'center'
- }
- ]
- ];
- table.render({
- elem: '#withdraw-table',
- method: 'POST',
- request: {
- pageName: 'page',
- limitName: 'page_size'
- },
- where: search,
- async: false,
- headers: {
- "AUTH-TOKEN": localStorage.getItem('XSRF-TOKEN')
- },
- contentType: 'application/json',
- url: getMyApiUrl('/withdraw/lists'),
- limit: 20,
- limits: [20, 30, 40, 50, 80, 100],
- parseData: function (res) {
- if (res.data.announce.length > 0) {
- html = '<p>提现公告:</p>';
- for (let i in res.data.announce) {
- let item = res.data.announce[i];
- html += '<p>(' + (parseInt(i) + 1) + ') ' + item.content + '</p>';
- }
- $('.announce').html(html);
- $('.announce').css('display','block');
- }
- $('.content-info span').text(res.data.account_info.balance);
- $('.money-info span').text(res.data.account_info.withdraw_balance);
- 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'
- });
- $('#create').click(function () {
- window.create();
- });
- window.create = function () {
- layer.open({
- id: 'withdraw_create',
- type: 2,
- title: '提现',
- shade: 0.1,
- offset: '20px',
- area: ['410px', '400px'],
- maxWidth: 500,
- maxHeight: 600,
- scrollbar: true,
- content: 'withdrawal_create.html',
- });
- }
- });
|