zhengyiming
8 天以前 c5bf3cfc953f9865bd70f109363c2ea4e45c0c96
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: '#028CFF',
    });
    if (res.confirm) {
      await blLifeRecharge.services.deleteUserAccount({
        id: row.id,
      });
      invalidateQueries();
    }
  } catch (error) {}
}
</script>