裂变星小程序-25.03.04
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
2.7 KiB

  1. <template>
  2. <uv-popup
  3. ref="popup"
  4. :overlayOpacity="0.8"
  5. :customStyle="{
  6. backgroundColor: 'transparent',
  7. }"
  8. >
  9. <view class="flex content">
  10. <template v-if="mode === 'activate'">
  11. <image class="popup-bg" src="@/pages_order/static/center/activate-code.png"></image>
  12. <view class="flex popup-btns">
  13. <button plain class="btn-simple" @click="close">
  14. <image class="popup-btn" src="@/pages_order/static/center/cancel.png"></image>
  15. </button>
  16. <button plain class="btn-simple" @click="onConfirm">
  17. <image class="popup-btn" src="@/pages_order/static/center/confirm.png"></image>
  18. </button>
  19. </view>
  20. <uv-input
  21. v-model="code"
  22. :focus="true"
  23. inputAlign="center"
  24. color="#3DFEE0"
  25. fontSize="45rpx"
  26. border="none"
  27. :customStyle="{
  28. backgroundColor: 'transparent',
  29. width: '250rpx',
  30. height: '63rpx',
  31. position: 'absolute',
  32. top: '216rpx',
  33. left: '160rpx',
  34. }"
  35. ></uv-input>
  36. </template>
  37. <template v-else>
  38. <image class="popup-bg" src="@/pages_order/static/center/not-agent.png"></image>
  39. <view class="flex popup-btns">
  40. <button plain class="btn-simple" @click="close">
  41. <image class="popup-btn" src="@/pages_order/static/center/cancel.png"></image>
  42. </button>
  43. <button plain class="btn-simple" @click="mode = 'activate'" >
  44. <image class="popup-btn" src="@/pages_order/static/center/activate.png"></image>
  45. </button>
  46. </view>
  47. </template>
  48. </view>
  49. </uv-popup>
  50. </template>
  51. <script>
  52. export default {
  53. props: {
  54. role: {
  55. default: null
  56. }
  57. },
  58. data() {
  59. return {
  60. mode: '',
  61. code: '',
  62. }
  63. },
  64. methods: {
  65. open(role) {
  66. this.mode = role ? 'activate' : ''
  67. this.$refs.popup.open();
  68. },
  69. close() {
  70. this.$refs.popup.close();
  71. },
  72. async onConfirm() {
  73. try {
  74. await this.$fetch('openVip', { code: this.code })
  75. this.$store.commit('getUserInfo')
  76. uni.showToast({
  77. title: '激活成功',
  78. icon: 'none'
  79. })
  80. this.close()
  81. } catch (err) {
  82. }
  83. }
  84. },
  85. }
  86. </script>
  87. <style scoped lang="scss">
  88. .content {
  89. position: relative;
  90. flex-direction: column;
  91. width: 570rpx;
  92. }
  93. .popup {
  94. &-bg {
  95. width: 514rpx; height: 355rpx;
  96. }
  97. &-btns {
  98. justify-content: space-between;
  99. margin-top: 56rpx;
  100. width: 100%;
  101. }
  102. &-btn {
  103. width: 265rpx;
  104. height: 84rpx;
  105. }
  106. }
  107. </style>