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

119 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. <!-- todo: 缺切图 "你还不是代理商" -->
  39. <image class="popup-bg" src=""></image>
  40. <view class="flex popup-btns">
  41. <button plain class="btn-simple" @click="close">
  42. <image class="popup-btn" src="@/pages_order/static/center/cancel.png"></image>
  43. </button>
  44. <button plain class="btn-simple" @click="mode = 'activate'" >
  45. <image class="popup-btn" src="@/pages_order/static/center/activate.png"></image>
  46. </button>
  47. </view>
  48. </template>
  49. </view>
  50. </uv-popup>
  51. </template>
  52. <script>
  53. export default {
  54. props: {
  55. role: {
  56. default: null
  57. }
  58. },
  59. data() {
  60. return {
  61. mode: '',
  62. code: '',
  63. }
  64. },
  65. methods: {
  66. open(role) {
  67. this.mode = role ? 'activate' : ''
  68. this.$refs.popup.open();
  69. },
  70. close() {
  71. this.$refs.popup.close();
  72. },
  73. async onConfirm() {
  74. try {
  75. await this.$fetch('openVip', { code: this.code })
  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>