take_cash.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: async function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'take_cash/index' + location.search,
  8. add_url: 'take_cash/add',
  9. edit_url: 'take_cash/edit',
  10. del_url: 'take_cash/del',
  11. multi_url: 'take_cash/multi',
  12. import_url: 'take_cash/import',
  13. table: 'take_cash',
  14. }
  15. });
  16. var table = $("#table");
  17. let status = await $.getJSON('take_cash/status')
  18. // 初始化表格
  19. table.bootstrapTable({
  20. url: $.fn.bootstrapTable.defaults.extend.index_url,
  21. pk: 'id',
  22. sortName: 'id',
  23. columns: [
  24. [
  25. //{checkbox: true},
  26. {field: 'id', title: __('Id')},
  27. {field: 'user.nickname', title: __('用户昵称'),operate: "LIKE",},
  28. {field: 'amount', title: __('Amount'), operate: 'BETWEEN'},
  29. {field: 'created_at', title: __('提交时间'),operate: "RANGE",addclass:'datetimerange',formatter: Table.api.formatter.datetime},
  30. {field: 'status', title: __('Status'),searchList:status,formatter:Table.api.formatter.normal},
  31. {field: 'check_status', title: __('打款状态'),searchList:{0:'打款中',1:'成功',2:'失败'},formatter:Table.api.formatter.label},
  32. {field: 'check_data', title: __('打款失败原因'),formatter(a){
  33. let reason={
  34. ACCOUNT_FROZEN:'账户冻结,该用户账户被冻结',
  35. REAL_NAME_CHECK_FAIL:'用户未实名,收款人未实名认证,需要用户完成微信实名认证',
  36. NAME_NOT_CORRECT: '用户姓名校验失败,收款人姓名校验不通过,请核实信息',
  37. OPENID_INVALID: 'Openid校验失败,Openid格式错误或者不属于商家公众账号',
  38. TRANSFER_QUOTA_EXCEED: '超过用户单笔收款额度,超过用户单笔收款额度,核实产品设置是否准确',
  39. DAY_RECEIVED_QUOTA_EXCEED: '超过用户单日收款额度,超过用户单日收款额度,核实产品设置是否准确',
  40. MONTH_RECEIVED_QUOTA_EXCEED: '超过用户单月收款额度,超过用户单月收款额度,核实产品设置是否准确',
  41. DAY_RECEIVED_COUNT_EXCEED: '超过用户单日收款次数,超过用户单日收款次数,核实产品设置是否准确',
  42. PRODUCT_AUTH_CHECK_FAIL: '产品权限校验失败,未开通该权限或权限被冻结,请核实产品权限状态',
  43. OVERDUE_CLOSE: '转账关闭,超过系统重试期,系统自动关闭',
  44. ID_CARD_NOT_CORRECT: '用户身份证校验失败,收款人身份证校验不通过,请核实信息',
  45. ACCOUNT_NOT_EXIST: '用户账户不存在,该用户账户不存在',
  46. TRANSFER_RISK: '转账存在风险,该笔转账可能存在风险,已被微信拦截',
  47. OTHER_FAIL_REASON_TYPE: '其它失败,其它失败原因',
  48. REALNAME_ACCOUNT_RECEIVED_QUOTA_EXCEED: '用户账户收款受限,请引导用户在微信支付查看详情',
  49. RECEIVE_ACCOUNT_NOT_PERMMIT: '未配置该用户为转账收款人,请在产品设置中调整,添加该用户为收款人',
  50. PAYEE_ACCOUNT_ABNORMAL: '用户账户收款异常,请联系用户完善其在微信支付的身份信息以继续收款',
  51. PAYER_ACCOUNT_ABNORMAL: '商户账户付款受限,可前往商户平台获取解除功能限制指引',
  52. TRANSFER_SCENE_UNAVAILABLE: '该转账场景暂不可用,该转账场景暂不可用,请确认转账场景ID是否正确',
  53. TRANSFER_SCENE_INVALID: '你尚未获取该转账场景,你尚未获取该转账场景,请确认转账场景ID是否正确',
  54. TRANSFER_REMARK_SET_FAIL: '转账备注设置失败,转账备注设置失败, 请调整后重新再试',
  55. RECEIVE_ACCOUNT_NOT_CONFIGURE: '未配置该用户在收款用户列表,请前往商户平台-商家转账到零钱-前往功能-转账场景中添加',
  56. BLOCK_B2C_USERLIMITAMOUNT_BSRULE_MONTH: '超出用户单月转账收款20w限额,本月不支持继续向该用户付款',
  57. BLOCK_B2C_USERLIMITAMOUNT_MONTH: '用户账户存在风险收款受限,本月不支持继续向该用户付款',
  58. }
  59. return reason[a]||a
  60. }},
  61. {
  62. field: 'operate',
  63. title: __('Operate'),
  64. table: table,
  65. events: Table.api.events.operate,
  66. formatter: Table.api.formatter.buttons,
  67. buttons:[
  68. {
  69. name: 'edit',
  70. text: __('审核'),
  71. title: __('审核'),
  72. classname: 'btn btn-xs btn-info btn-dialog',
  73. icon: 'fa',
  74. url: 'take_cash/edit',
  75. callback: function (data) {
  76. //Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  77. $('.btn-refresh').trigger('click')
  78. },
  79. visible: function (row) {
  80. //返回true时按钮显示,返回false隐藏
  81. return row.status===0;
  82. }
  83. },
  84. ]
  85. }
  86. ]
  87. ]
  88. });
  89. // 为表格绑定事件
  90. Table.api.bindevent(table);
  91. },
  92. add: function () {
  93. Controller.api.bindevent();
  94. },
  95. edit: function () {
  96. Controller.api.bindevent();
  97. },
  98. api: {
  99. bindevent: function () {
  100. Form.api.bindevent($("form[role=form]"));
  101. }
  102. }
  103. };
  104. return Controller;
  105. });