wupengfei
2025-11-17 fdc8e98b2b8b50ab037ed759489bc5e721298f7c
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
<template>
  <LoadingLayout :loading="isLoading">
    <AppContainer>
      <PageFormLayout title="账户信息">
        <ProForm :model="form" ref="formRef" label-width="140px" :is-read="isDetail">
          <ProFormCol>
            <ProFormColItem :span="12">
              <ProFormItemV2 label="账户名称:" prop="name" mode="read">
                <ProFormText v-model.trim="form.name" placeholder="请输入账户名称" />
              </ProFormItemV2>
            </ProFormColItem>
          </ProFormCol>
          <ProFormCol>
            <ProFormColItem :span="12">
              <ProFormItemV2
                label="开户总行:"
                prop="bank"
                :check-rules="[{ message: '请输入开户总行' }]"
              >
                <ProFormText v-model.trim="form.bank" placeholder="请输入开户总行" />
              </ProFormItemV2>
            </ProFormColItem>
          </ProFormCol>
          <ProFormCol>
            <ProFormColItem :span="12">
              <ProFormItemV2
                label="开户支行:"
                prop="bankBranch"
                :check-rules="[{ message: '请输入开户支行' }]"
              >
                <ProFormText v-model.trim="form.bankBranch" placeholder="请输入开户支行" />
              </ProFormItemV2>
            </ProFormColItem>
          </ProFormCol>
          <ProFormCol>
            <ProFormColItem :span="12">
              <ProFormItemV2
                label="户号:"
                prop="account"
                :check-rules="[{ message: '请输入户号', type: 'bankCard' }]"
              >
                <ProFormText v-model.trim="form.account" placeholder="请输入户号" />
              </ProFormItemV2>
            </ProFormColItem>
          </ProFormCol>
        </ProForm>
        <template #footer>
          <el-button v-if="isDetail" type="primary" @click="isDetail = false">编辑</el-button>
          <el-button v-else type="primary" @click="handleConfirm()">保存</el-button>
        </template>
      </PageFormLayout>
    </AppContainer>
  </LoadingLayout>
</template>
 
<script setup lang="ts">
import {
  LoadingLayout,
  AppContainer,
  PageFormLayout,
  ProForm,
  ProFormCol,
  ProFormColItem,
  ProFormItemV2,
  ProFormInputNumber,
  ProFormRadio,
  ProFormText,
} from '@bole-core/components';
import { useQuery } from '@tanstack/vue-query';
import * as smsServices from '@/services/api/sms';
import { FormInstance } from 'element-plus';
import { Message } from '@bole-core/core';
import * as enterpriseCooperationWalletServices from '@/services/api/enterpriseCooperationWallet';
 
defineOptions({
  name: 'AccountManage',
});
 
const { userDetail } = useUser();
 
const form = reactive({
  name: '',
  bank: '',
  bankBranch: '',
  account: '',
});
 
const isDetail = ref(true);
 
const { isLoading } = useQuery({
  queryKey: ['enterpriseCooperationWalletServices/getEnterpriseReceiveAccount'],
  queryFn: async () => {
    return await enterpriseCooperationWalletServices.getEnterpriseReceiveAccount(
      {},
      {
        showLoading: false,
      }
    );
  },
  placeholderData: () => ({} as API.GetEnterpriseReceiveAccountQueryResult),
  onSuccess(data) {
    form.name = data.name;
    form.bank = data.bank;
    form.bankBranch = data.bankBranch;
    form.account = data.account;
  },
});
 
const formRef = ref<FormInstance>();
 
function handleConfirm() {
  if (!formRef.value) return;
  formRef.value.validate((valid) => {
    if (valid) {
      submit();
    } else {
      return;
    }
  });
}
 
async function submit() {
  try {
    let params: API.SaveEnterpriseReceiveAccountCommand = {
      bank: form.bank,
      bankBranch: form.bankBranch,
      account: form.account,
    };
    let res = await enterpriseCooperationWalletServices.saveEnterpriseReceiveAccount(params);
    if (res) {
      Message.successMessage('操作成功');
      isDetail.value = true;
    }
  } catch (error) {}
}
</script>
 
<style lang="scss" scoped>
@use '@/style/common.scss' as *;
 
.access-list {
  flex: 1;
  min-width: 0;
 
  :deep() {
    .el-form-item__content {
      flex-direction: column;
      align-items: flex-start;
    }
  }
}
 
.access-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
 
  .access-item-label {
    margin-right: 20px;
    word-break: keep-all;
  }
 
  :deep() {
    .el-radio-group {
      margin-right: 20px;
    }
  }
}
</style>