gaoluyang
2026-06-24 712aa51536236d43e87273e4ce45ac5691dffad8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallBrokerageWithdrawApi } from '#/api/mall/trade/brokerage/withdraw';
 
import { h } from 'vue';
 
import { confirm, Page, prompt } from '..\..\..\..\..\packages\effects\common-ui\src';
import {
  BrokerageWithdrawStatusEnum,
  BrokerageWithdrawTypeEnum,
  DICT_TYPE,
} from '..\..\..\..\..\packages\constants\src';
import { formatDateTime } from '..\..\..\..\..\packages\utils\src';
 
import { Input, message } from 'ant-design-vue';
 
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
  approveBrokerageWithdraw,
  getBrokerageWithdrawPage,
  rejectBrokerageWithdraw,
} from '#/api/mall/trade/brokerage/withdraw';
import { DictTag } from '#/components/dict-tag';
import { $t } from '#/locales';
 
import { useGridColumns, useGridFormSchema } from './data';
 
/** 分销佣金提现 */
defineOptions({ name: 'BrokerageWithdraw' });
 
/** 刷新表格 */
function handleRefresh() {
  gridApi.query();
}
 
/** 审核通过 */
async function handleApprove(row: MallBrokerageWithdrawApi.BrokerageWithdraw) {
  await confirm('确定要审核通过吗?');
  const hideLoading = message.loading({
    content: '审核通过中 ...',
    duration: 0,
  });
  try {
    await approveBrokerageWithdraw(row.id);
    message.success($t('ui.actionMessage.operationSuccess'));
    handleRefresh();
  } finally {
    hideLoading();
  }
}
 
/** 审核驳回 */
function handleReject(row: MallBrokerageWithdrawApi.BrokerageWithdraw) {
  prompt({
    component: () => {
      return h(Input, {
        placeholder: '请输入驳回原因',
        allowClear: true,
        rules: [{ required: true, message: '请输入驳回原因' }],
      });
    },
    content: '请输入驳回原因',
    title: '驳回',
    modelPropName: 'value',
  }).then(async (val) => {
    if (val) {
      await rejectBrokerageWithdraw({
        id: row.id!,
        auditReason: val,
      });
      handleRefresh();
    }
  });
}
 
/** 重新转账 */
async function handleRetryTransfer(
  row: MallBrokerageWithdrawApi.BrokerageWithdraw,
) {
  await confirm('确定要重新转账吗?');
  const hideLoading = message.loading({
    content: '审核通过中 ...',
    duration: 0,
  });
  try {
    await approveBrokerageWithdraw(row.id);
    message.success($t('ui.actionMessage.operationSuccess'));
    handleRefresh();
  } finally {
    hideLoading();
  }
}
 
const [Grid, gridApi] = useVbenVxeGrid({
  formOptions: {
    schema: useGridFormSchema(),
  },
  gridOptions: {
    columns: useGridColumns(),
    height: 'auto',
    keepSource: true,
    cellConfig: {
      height: 90,
    },
    proxyConfig: {
      ajax: {
        query: async ({ page }, formValues) => {
          return await getBrokerageWithdrawPage({
            pageNo: page.currentPage,
            pageSize: page.pageSize,
            ...formValues,
          });
        },
      },
    },
    rowConfig: {
      keyField: 'id',
      isHover: true,
    },
    toolbarConfig: {
      refresh: true,
      search: true,
    },
  } as VxeTableGridOptions<MallBrokerageWithdrawApi.BrokerageWithdraw>,
});
</script>
 
<template>
  <Page auto-content-height>
    <Grid table-title="佣金提现列表">
      <template #withdraw-info="{ row }">
        <div
          v-if="row.type === BrokerageWithdrawTypeEnum.WALLET.type"
          class="text-left"
        >
          -
        </div>
        <div v-else class="text-left">
          <div v-if="row.userAccount" class="text-left">
            账号:{{ row.userAccount }}
          </div>
          <div v-if="row.userName" class="text-left">
            真实姓名:{{ row.userName }}
          </div>
          <template v-if="row.type === BrokerageWithdrawTypeEnum.BANK.type">
            <div v-if="row.bankName" class="text-left">
              银行名称:{{ row.bankName }}
            </div>
            <div v-if="row.bankAddress" class="text-left">
              开户地址:{{ row.bankAddress }}
            </div>
          </template>
          <div v-if="row.qrCodeUrl" class="mt-2 text-left">
            <div class="flex items-start gap-2">
              <span class="flex-shrink-0">收款码:</span>
              <img :src="row.qrCodeUrl" class="h-10 w-10 flex-shrink-0" />
            </div>
          </div>
        </div>
      </template>
      <template #status-info="{ row }">
        <div class="text-left">
          <DictTag
            :value="row.status"
            :type="DICT_TYPE.BROKERAGE_WITHDRAW_STATUS"
          />
          <div
            v-if="row.auditTime"
            class="mt-1 text-left text-xs text-gray-500"
          >
            时间:{{ formatDateTime(row.auditTime) }}
          </div>
          <div
            v-if="row.auditReason"
            class="mt-1 text-left text-xs text-gray-500"
          >
            审核原因:{{ row.auditReason }}
          </div>
          <div
            v-if="row.transferErrorMsg"
            class="mt-1 text-left text-xs text-red-500"
          >
            转账失败原因:{{ row.transferErrorMsg }}
          </div>
        </div>
      </template>
      <template #actions="{ row }">
        <TableAction
          :actions="[
            {
              label: '通过',
              type: 'link',
              icon: ACTION_ICON.EDIT,
              auth: ['trade:brokerage-withdraw:audit'],
              ifShow:
                row.status === BrokerageWithdrawStatusEnum.AUDITING.status &&
                !row.payTransferId,
              onClick: () => handleApprove(row),
            },
            {
              label: '驳回',
              type: 'link',
              danger: true,
              icon: ACTION_ICON.DELETE,
              auth: ['trade:brokerage-withdraw:audit'],
              ifShow:
                row.status === BrokerageWithdrawStatusEnum.AUDITING.status &&
                !row.payTransferId,
              onClick: () => handleReject(row),
            },
            {
              label: '重新转账',
              type: 'link',
              icon: ACTION_ICON.REFRESH,
              auth: ['trade:brokerage-withdraw:audit'],
              ifShow:
                row.status === BrokerageWithdrawStatusEnum.WITHDRAW_FAIL.status,
              onClick: () => handleRetryTransfer(row),
            },
          ]"
        />
      </template>
    </Grid>
  </Page>
</template>