settlement.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <Overlay :show="true">
  3. <div class="wrapper" @click.stop>
  4. <div class="block">
  5. <Form @submit="settlementIntegral">
  6. <CellGroup inset>
  7. <div class="user-img">
  8. <Image round width="50px" height="50px" :src="props.headImage" />
  9. <span style="margin-left: 5px">{{ props.nickName }}</span>
  10. </div>
  11. <Field label="未结算积分" :model-value="props.achievement" disabled />
  12. <Field label="已结算积分" :model-value="props.achievementSettled" disabled />
  13. <Field v-model="settlePoints" label="结算积分" type="number" placeholder="请输入结算积分" />
  14. </CellGroup>
  15. <div class="submit-box">
  16. <Button :loading="loading" type="primary" hairline native-type="submit" loading-text="结算中..."> 提交 </Button>
  17. <Button type="default" hairline @click="unmountComponent"> 取消 </Button>
  18. </div>
  19. </Form>
  20. </div>
  21. </div>
  22. </Overlay>
  23. </template>
  24. <script lang="ts" setup>
  25. import { Overlay, Field, CellGroup, Form, Button, Image } from "vant";
  26. import { ref } from "vue";
  27. import { useUnmountComponent } from "@/utils/mount-component";
  28. import { useSettlementIntegral } from "./settlement";
  29. const { unmountComponent } = useUnmountComponent();
  30. const props = defineProps<{
  31. openid: string;
  32. nickName: string;
  33. headImage: string;
  34. achievement: number;
  35. achievementSettled: number;
  36. }>();
  37. const settlePoints = ref<number>(props.achievement);
  38. const { loading, settlementIntegral } = useSettlementIntegral({ openid: props.openid, settlePoints: settlePoints.value });
  39. </script>
  40. <style scoped lang="scss">
  41. .wrapper {
  42. display: flex;
  43. align-items: center;
  44. justify-content: center;
  45. height: 100%;
  46. }
  47. .block {
  48. width: 300px;
  49. background-color: #fff;
  50. padding: 20px;
  51. border-radius: 10px;
  52. }
  53. .user-img {
  54. display: flex;
  55. justify-content: center;
  56. align-items: center;
  57. font-size: 20px;
  58. margin-bottom: 10px;
  59. }
  60. .submit-box {
  61. display: flex;
  62. justify-content: space-around;
  63. align-items: center;
  64. margin-top: 10px;
  65. }
  66. </style>