From 07d73df3d817d01ce47f6c7b7a8d8514cd389295 Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期四, 13 三月 2025 10:19:44 +0800 Subject: [PATCH] release: @life-payment/core v0.0.3 --- packages/components/src/views/userAccount/UserAccountListView.vue | 98 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 98 insertions(+), 0 deletions(-) diff --git a/packages/components/src/views/userAccount/UserAccountListView.vue b/packages/components/src/views/userAccount/UserAccountListView.vue new file mode 100644 index 0000000..ed2b857 --- /dev/null +++ b/packages/components/src/views/userAccount/UserAccountListView.vue @@ -0,0 +1,98 @@ +<template> + <InfiniteLoading + scrollViewClassName="life-page-infinite-scroll-list" + v-bind="infiniteLoadingProps" + > + <template #renderItem="{ item }"> + <AccountCard + :title="TitleMap[item.lifePayType]" + :content=" + item.lifePayType === LifeRechargeConstants.LifePayOrderTypeEnum.璇濊垂璁㈠崟 + ? item.content + : `${item.city}-${item.content}` + " + :remark="item.remark" + :style="{ + marginBottom: Taro.pxTransform(20), + backgroundColor: '#ffffff', + }" + > + <template #action> + <div class="account-card-action" @click="handleEditUserAccount(item)">缂栬緫</div> + <div class="account-card-action" @click="handleDeleteUserAccount(item)">鍒犻櫎</div> + </template> + </AccountCard> + </template> + </InfiniteLoading> +</template> + +<script setup lang="ts"> +import InfiniteLoading from '../../components/InfiniteLoading/InfiniteLoading.vue'; +import { + BlLifeRecharge, + useLifeRechargeContext, + QueryUserAccountListInput, + LifeRechargeConstants, + UserAccountListOutput, +} from '@life-payment/core-vue'; +import { useInfiniteLoading } from '../../hooks/infiniteLoading'; +import { OrderInputType } from '../../constants'; +import AccountCard from '../../components/Card/AccountCard.vue'; +import Taro from '@tarojs/taro'; + +defineOptions({ + name: 'UserAccountListView', +}); + +const emit = defineEmits<{ + (e: 'goEdit', row: UserAccountListOutput): void; +}>(); + +const { blLifeRecharge } = useLifeRechargeContext(); + +const TitleMap = { + [LifeRechargeConstants.LifePayOrderTypeEnum.璇濊垂璁㈠崟]: '鎵嬫満鍙�', + [LifeRechargeConstants.LifePayOrderTypeEnum.鐢佃垂璁㈠崟]: '鐢佃垂鎴峰彿', + [LifeRechargeConstants.LifePayOrderTypeEnum.鐕冩皵璁㈠崟]: '鐕冩皵鎴峰彿', +}; + +const { infiniteLoadingProps, invalidateQueries } = useInfiniteLoading( + ({ pageParam }) => { + let params: QueryUserAccountListInput = { + pageModel: { + rows: 20, + page: pageParam, + orderInput: [{ property: 'creationTime', order: OrderInputType.Desc }], + }, + userId: blLifeRecharge.accountModel.userId, + }; + + return blLifeRecharge.services.getUserAccountList(params, { + showLoading: false, + }); + }, + { + queryKey: ['blLifeRecharge/getUserAccountList', blLifeRecharge.accountModel.userId], + } +); + +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