card-verify.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <ie-page bg-color="#F6F8FA">
  3. <ie-navbar title="绑定会员卡" />
  4. <view class="h-20"></view>
  5. <view class="px-46 py-50 bg-white">
  6. <ie-input v-model="form.cardNo" type="number" :maxlength="8" placeholder="请输入会员卡号" />
  7. <ie-input custom-class="mt-28" type="text" :maxlength="6" v-model="form.password" placeholder="请输入会员卡密码" />
  8. </view>
  9. <ie-safe-toolbar :height="84" :shadow="false">
  10. <view class="px-46 pt-24">
  11. <ie-button type="primary" @click="handleSubmit">开始校验</ie-button>
  12. </view>
  13. </ie-safe-toolbar>
  14. </ie-page>
  15. </template>
  16. <script lang="ts" setup>
  17. import { verifyCard } from '@/api/modules/user';
  18. import { useTransferPage } from '@/hooks/useTransferPage';
  19. const { transferTo } = useTransferPage();
  20. const form = ref({
  21. cardNo: '',
  22. password: ''
  23. });
  24. const handleSubmit = async () => {
  25. const { cardNo, password } = form.value;
  26. if (!cardNo || cardNo.trim() === '') {
  27. uni.$ie.showToast('请输入会员卡号');
  28. return;
  29. }
  30. if (!password || password.trim() === '') {
  31. uni.$ie.showToast('请输入会员卡密码');
  32. return;
  33. }
  34. uni.$ie.showLoading();
  35. verifyCard(cardNo, password).then(() => {
  36. uni.$ie.hideLoading();
  37. transferTo('/pagesSystem/pages/user-profile/user-profile', {
  38. data: {
  39. cardNo,
  40. password,
  41. type: 'card',
  42. scene: 'phone_improve'
  43. }
  44. });
  45. }).catch(() => {
  46. uni.$ie.hideLoading();
  47. });
  48. }
  49. </script>
  50. <style lang="scss" scoped></style>