From a8651ec657fd2ef85cacc6660916dc847a932e1f Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期一, 10 十一月 2025 16:36:05 +0800
Subject: [PATCH] fix: bug

---
 src/views/FinanceManage/components/CustomerRechargeDialog.vue |  170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 170 insertions(+), 0 deletions(-)

diff --git a/src/views/FinanceManage/components/CustomerRechargeDialog.vue b/src/views/FinanceManage/components/CustomerRechargeDialog.vue
new file mode 100644
index 0000000..d1d2839
--- /dev/null
+++ b/src/views/FinanceManage/components/CustomerRechargeDialog.vue
@@ -0,0 +1,170 @@
+<template>
+  <ProDialog :title="title" v-model="visible" @close="onDialogClose" destroy-on-close draggable>
+    <PortraitTableWithAttachment v-bind="portraitTableWithAttachmentProps" />
+    <ProForm
+      :model="form"
+      ref="dialogForm"
+      label-width="90px"
+      style="margin-top: 20px"
+      :is-read="form.isDetail"
+    >
+      <ProFormItemV2
+        label="鍏呭�肩姸鎬�:"
+        prop="transactionStatus"
+        :check-rules="[{ message: '璇烽�夋嫨鍏呭�肩姸鎬�' }]"
+      >
+        <ProFormRadio v-model="form.transactionStatus" :value-enum="transactionStatusText" />
+      </ProFormItemV2>
+      <ProFormItemV2 label="澶囨敞:" prop="remark">
+        <ProFormTextArea
+          v-model="form.remark"
+          placeholder="璇疯緭鍏ュ娉�"
+          :rows="4"
+          :maxlength="150"
+          show-word-limit
+        />
+      </ProFormItemV2>
+    </ProForm>
+    <template #footer>
+      <span class="dialog-footer">
+        <el-button @click="emit('onCancel')">鍙� 娑�</el-button>
+        <el-button type="primary" @click="handleConfirm">纭� 瀹�</el-button>
+      </span>
+    </template>
+  </ProDialog>
+</template>
+
+<script setup lang="ts">
+import { FormInstance } from 'element-plus';
+import {
+  ProDialog,
+  ProForm,
+  ProFormItemV2,
+  ProFormRadio,
+  ProFormTextArea,
+} from '@bole-core/components';
+import { usePortraitTableWithAttachment } from '@/hooks';
+import { convertApi2FormUrl } from '@/utils';
+import { useQuery } from '@tanstack/vue-query';
+import * as enterpriseCooperationWalletServices from '@/services/api/enterpriseCooperationWallet';
+import { EnumEnterpriseCooperationWalletTransactionStatusTextForConfirm } from '@/constants';
+import _ from 'lodash';
+
+defineOptions({
+  name: 'CustomerRechargeDialog',
+});
+
+const visible = defineModel({ type: Boolean });
+
+type Form = {
+  title?: string;
+  id: string;
+  cooperationId: string;
+  transactionStatus: EnumEnterpriseCooperationWalletTransactionStatus;
+  remark: string;
+  isDetail: boolean;
+};
+
+const form = defineModel<Form>('form');
+
+const title = computed(() => (form.value.isDetail ? '鍏呭�艰褰�' : '纭鍏呭��'));
+
+const transactionStatusText = computed(() =>
+  form.value.isDetail
+    ? EnumEnterpriseCooperationWalletTransactionStatusText
+    : EnumEnterpriseCooperationWalletTransactionStatusTextForConfirm
+);
+
+const emit = defineEmits<{
+  (e: 'onConfirm'): void;
+  (e: 'onCancel'): void;
+}>();
+
+watch(
+  () => visible.value,
+  (val) => {
+    if (val) {
+      refetch();
+    }
+  }
+);
+
+const { data: detail, refetch } = useQuery({
+  queryKey: [
+    'enterpriseCooperationWalletServices/getCooperationWalletRechargeTransaction',
+    form.value.id,
+  ],
+  queryFn: async () => {
+    return await enterpriseCooperationWalletServices.getCooperationWalletRechargeTransaction({
+      id: form.value.id,
+    });
+  },
+  placeholderData: () => ({} as API.GetCooperationWalletRechargeTransactionQueryResult),
+  onSuccess(data) {
+    form.value.cooperationId = data.cooperationId ?? '';
+    if (form.value.isDetail) {
+      form.value.transactionStatus = data.transactionStatus;
+      form.value.remark = data.remark ?? '';
+    }
+  },
+  enabled: computed(() => !!form.value.id),
+});
+
+const { portraitTableWithAttachmentProps } = usePortraitTableWithAttachment({
+  data: detail,
+  annexList: computed(() =>
+    detail.value?.files ? detail.value?.files.map((item) => convertApi2FormUrl(item)) : []
+  ),
+  columns: [
+    {
+      label: '鍏呭�煎崟浣�',
+      key: 'receiveUnit',
+    },
+    {
+      label: '寮�鎴疯处鍙�',
+      key: 'receiveAccount',
+    },
+    {
+      label: '鍏呭�奸噾棰�',
+      key: 'amount',
+      type: 'money',
+    },
+    {
+      label: '鍏呭�兼椂闂�',
+      key: 'createdTime',
+      type: 'date',
+    },
+  ],
+});
+const dialogForm = ref<FormInstance>();
+
+function onDialogClose() {
+  if (!dialogForm.value) return;
+  dialogForm.value.resetFields();
+}
+
+const handleConfirm = _.debounce(
+  () => {
+    if (form.value.isDetail) {
+      emit('onCancel');
+    } else {
+      if (!dialogForm.value) return;
+      dialogForm.value.validate((valid) => {
+        if (valid) {
+          emit('onConfirm');
+        } else {
+          return;
+        }
+      });
+    }
+  },
+  1000,
+  {
+    leading: true,
+    trailing: false,
+  }
+);
+</script>
+<style lang="scss" scoped>
+@use '@/style/common.scss' as *;
+</style>

--
Gitblit v1.9.1