From 8525b5c780d8855eca89c46790627c00b3d83c79 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期三, 12 三月 2025 17:36:21 +0800
Subject: [PATCH] fix: 二期需求

---
 packages/components/src/views/userAccount/UserAccountListView.vue |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/packages/components/src/views/userAccount/UserAccountListView.vue b/packages/components/src/views/userAccount/UserAccountListView.vue
index 68ee021..ed2b857 100644
--- a/packages/components/src/views/userAccount/UserAccountListView.vue
+++ b/packages/components/src/views/userAccount/UserAccountListView.vue
@@ -18,8 +18,8 @@
         }"
       >
         <template #action>
-          <div class="account-card-action" @click="handleEditUserAccount">缂栬緫</div>
-          <div class="account-card-action" @click="handleEditUserAccount">鍒犻櫎</div>
+          <div class="account-card-action" @click="handleEditUserAccount(item)">缂栬緫</div>
+          <div class="account-card-action" @click="handleDeleteUserAccount(item)">鍒犻櫎</div>
         </template>
       </AccountCard>
     </template>
@@ -33,6 +33,7 @@
   useLifeRechargeContext,
   QueryUserAccountListInput,
   LifeRechargeConstants,
+  UserAccountListOutput,
 } from '@life-payment/core-vue';
 import { useInfiniteLoading } from '../../hooks/infiniteLoading';
 import { OrderInputType } from '../../constants';
@@ -43,6 +44,10 @@
   name: 'UserAccountListView',
 });
 
+const emit = defineEmits<{
+  (e: 'goEdit', row: UserAccountListOutput): void;
+}>();
+
 const { blLifeRecharge } = useLifeRechargeContext();
 
 const TitleMap = {
@@ -51,13 +56,13 @@
   [LifeRechargeConstants.LifePayOrderTypeEnum.鐕冩皵璁㈠崟]: '鐕冩皵鎴峰彿',
 };
 
-const { infiniteLoadingProps } = useInfiniteLoading(
+const { infiniteLoadingProps, invalidateQueries } = useInfiniteLoading(
   ({ pageParam }) => {
     let params: QueryUserAccountListInput = {
       pageModel: {
         rows: 20,
         page: pageParam,
-        orderInput: [{ property: 'id', order: OrderInputType.Desc }],
+        orderInput: [{ property: 'creationTime', order: OrderInputType.Desc }],
       },
       userId: blLifeRecharge.accountModel.userId,
     };
@@ -71,5 +76,23 @@
   }
 );
 
-function handleEditUserAccount() {}
+function handleEditUserAccount(row: UserAccountListOutput) {
+  emit('goEdit', row);
+}
+
+async function handleDeleteUserAccount(row: UserAccountListOutput) {
+  try {
+    const res = await Taro.showModal({
+      title: '鎻愮ず',
+      content: '纭畾瑕佸垹闄よ鏁版嵁鍚�?',
+      confirmColor: '#3a71ff',
+    });
+    if (res.confirm) {
+      await blLifeRecharge.services.deleteUserAccount({
+        id: row.id,
+      });
+      invalidateQueries();
+    }
+  } catch (error) {}
+}
 </script>

--
Gitblit v1.9.1