裂变星小程序-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.

118 lines
2.6 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. uni.showToast({
  76. title: '激活成功',
  77. icon: 'none'
  78. })
  79. this.close()
  80. } catch (err) {
  81. }
  82. }
  83. },
  84. }
  85. </script>
  86. <style scoped lang="scss">
  87. .content {
  88. position: relative;
  89. flex-direction: column;
  90. width: 570rpx;
  91. }
  92. .popup {
  93. &-bg {
  94. width: 514rpx; height: 355rpx;
  95. }
  96. &-btns {
  97. justify-content: space-between;
  98. margin-top: 56rpx;
  99. width: 100%;
  100. }
  101. &-btn {
  102. width: 265rpx;
  103. height: 84rpx;
  104. }
  105. }
  106. </style>