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

110 lines
3.0 KiB

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