mx-buy-vip.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <uv-popup ref="popup" mode="center" bg-color="transparent" @close="close" :close-on-click-overlay="false">
  3. <view class="fx-col items-center">
  4. <view class="relative">
  5. <uv-image width="280px" height="406px" mode="widthFix" :src="buyVipPopup"/>
  6. <uv-button shape="circle" size="large" :text="`¥${price} 立即开通`" :style="btnBuyStyle"
  7. @click="gotoPay"/>
  8. </view>
  9. <uv-icon size="32" color="white" name="close-circle" @click="close" class="mt-80"/>
  10. </view>
  11. </uv-popup>
  12. </template>
  13. <script setup>
  14. import {ref} from 'vue'
  15. import {usePayment} from "@/hooks/usePayment";
  16. import {useTransfer} from "@/hooks/useTransfer";
  17. import buyVipPopup from '@/static/personal/buy_vip_popup.png'
  18. const popup = ref(null)
  19. const {price, payment} = usePayment()
  20. const btnBuyStyle = {
  21. position: 'absolute',
  22. backgroundColor: 'transparent',
  23. border: 'none',
  24. width: '180px',
  25. bottom: '-2px',
  26. left: '50px'
  27. }
  28. const open = function () {
  29. popup.value.open()
  30. }
  31. const close = function () {
  32. popup.value.close()
  33. // NOTE: 只调用了popup的显示与隐藏
  34. // usePayment会持续监听订单信息,直到获取到一个终止态,否则不能进行下一次payment响应
  35. // TODO:待后续观察是否合适,看是否需要在这里释放支付的一些状态
  36. }
  37. function gotoPay() {
  38. close();
  39. const {transferTo} = useTransfer();
  40. transferTo("/pages/personal-center/pay/pay");
  41. }
  42. defineExpose({open, close})
  43. </script>
  44. <style scoped></style>