upsell-qrcode.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <custom-popup
  3. v-model="showPopup"
  4. mode="center"
  5. border-radius="24"
  6. width="650rpx"
  7. :bg-color="'transparent'"
  8. >
  9. <view class="popup-container">
  10. <!-- 顶部标题 -->
  11. <view class="header">
  12. <view class="title-text">
  13. 让好友打开
  14. <!-- #ifdef MP-WEIXIN -->
  15. <text class="green">微信</text>
  16. <!-- #endif -->
  17. <!-- #ifdef MP-ALIPAY -->
  18. <text class="green">支付宝</text>
  19. <!-- #endif -->
  20. 扫一扫
  21. </view>
  22. <view class="subtitle-text">加油!你就要成功了</view>
  23. </view>
  24. <!-- 二维码区域 -->
  25. <view class="qrcode-section">
  26. <image
  27. class="qrcode-img"
  28. :src="qrcode"
  29. mode="aspectFit"
  30. ></image>
  31. </view>
  32. <!-- 关闭按钮 -->
  33. <view class="close-button" @click="closePopup">
  34. <image src="/static/img/activity/close2.png" mode="widthFix"></image>
  35. </view>
  36. </view>
  37. </custom-popup>
  38. </template>
  39. <script>
  40. import customPopup from '../../../components/custom-popup.vue';
  41. export default {
  42. components: {
  43. customPopup,
  44. },
  45. data() {
  46. return {
  47. showPopup: false,
  48. qrcode: '',
  49. // 可扩展为自定义图标
  50. wechatIcon: false,
  51. scanIcon: false,
  52. successIcon: false,
  53. };
  54. },
  55. methods: {
  56. open(data) {
  57. this.showPopup = true;
  58. this.getQrcode(data.upsellCode);
  59. },
  60. //获取二维码
  61. getQrcode(upsellCode){
  62. uni.$u.http.get(`/token/order/getUpsellQrcode?upsellCode=${upsellCode}`).then(res=>{
  63. if(res.code==200){
  64. this.qrcode = res.data;
  65. }
  66. })
  67. },
  68. closePopup() {
  69. this.showPopup = false;
  70. },
  71. },
  72. };
  73. </script>
  74. <style lang="scss" scoped>
  75. .popup-container {
  76. position: relative;
  77. padding: 30rpx 30rpx 80rpx 30rpx;
  78. box-sizing: border-box;
  79. background: url("https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/upsellbg.png") no-repeat center center;
  80. background-size: 100% 100%;
  81. height: 1020rpx;
  82. }
  83. .header {
  84. display: flex;
  85. flex-direction: column;
  86. align-items: center;
  87. padding-top: 20rpx;
  88. .title-text {
  89. font-size: 38rpx;
  90. font-weight: bold;
  91. color: #222;
  92. margin-bottom: 10rpx;
  93. .green {
  94. color: #39c248;
  95. }
  96. }
  97. .subtitle-text {
  98. font-size: 28rpx;
  99. color: #666;
  100. margin-bottom: 30rpx;
  101. }
  102. }
  103. .qrcode-section {
  104. display: flex;
  105. justify-content: center;
  106. align-items: center;
  107. height: 400rpx;
  108. width: 400rpx;
  109. background: #38c249;
  110. margin: 30rpx auto;
  111. border-radius: 24rpx;
  112. .qrcode-img {
  113. width: 300rpx;
  114. height: 300rpx;
  115. border-radius: 24rpx;
  116. background: #fff;
  117. border: 8rpx solid #fff;
  118. }
  119. }
  120. .close-button {
  121. position: absolute;
  122. bottom: -100rpx;
  123. left: 50%;
  124. transform: translateX(-50%);
  125. image {
  126. width: 70rpx;
  127. height: 70rpx;
  128. }
  129. }
  130. </style>