receiveCard.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <view class="container receive-bg">
  3. <view class="recevie">
  4. <image class="arvator" :src="avatarUrl"></image>
  5. <view class="content">
  6. <text class="name">「{{ userName }}」赠送</text>
  7. <!-- <text class="gift">送你价值199元超级鲸会员年卡</text> -->
  8. <image style="width: 650rpx; height: 460rpx" src="https://jzmall.lifejingzhi.com/file/jzmall/weixin/memberCard-1229/member-benefit.png"></image>
  9. <button class="btn" open-type="getPhoneNumber" v-if="rId > 0 && rId != 12345" @getphonenumber="getPhoneNumber">立即领取</button>
  10. <!-- <view class="des">关注鲸致生活LifePlus公众号,更多精彩</view> -->
  11. </view>
  12. </view>
  13. <!-- <view style="margin-top: 30rpx;padding: 20rpx;" class="recevie">
  14. <view class="title">成为超级鲸会员</view>
  15. <view class="txt">享受超值购买鲸致生活商城家政产品</view>
  16. <view class="txt">专属管家1对1服务</view>
  17. <view class="txt">各项会员福利</view>
  18. <image style="height: 30rpx;width:450rpx" src="https://6a7a-jzmall-3gi3t6y452ddb0ff-1306484940.tcb.qcloud.la/member/salgon.png"></image>
  19. </view>
  20. <view class="bottom">
  21. <text>在线点 · 鲸致到家 | 好服务送好友</text>
  22. </view> -->
  23. <!-- <image style="height: 370rpx;width:706rpx" src="https://jzmall.lifejingzhi.com/file/jzmall/weixin/memberCard-1229/add-steward.png" mode="aspectFit" show-menu-by-longpress="{{true}}"></image> -->
  24. </view>
  25. </template>
  26. <script>
  27. var util = require('../../../../utils/util.js');
  28. var api = require('../../../../config/api');
  29. var user = require('../../../../utils/user.js');
  30. var app = getApp();
  31. export default {
  32. data() {
  33. return {
  34. rId: 0,
  35. userName: '',
  36. avatarUrl: '/static/images/member/get.png',
  37. loginCode: ''
  38. };
  39. }
  40. /**
  41. * 生命周期函数--监听页面加载
  42. */,
  43. onLoad: function (options) {
  44. if (options.scene || options.rId) {
  45. var rid = 0;
  46. if (options.scene) {
  47. var referee = decodeURIComponent(options.scene);
  48. rid = referee.replace('rId=', '');
  49. } else {
  50. rid = options.rId;
  51. }
  52. this.setData({
  53. rId: rid
  54. });
  55. this.getReferee();
  56. } else {
  57. util.showErrorToast('无效分享');
  58. }
  59. },
  60. /**
  61. * 生命周期函数--监听页面初次渲染完成
  62. */
  63. onReady: function () {},
  64. /**
  65. * 生命周期函数--监听页面显示
  66. */
  67. onShow: function () {
  68. this.getLoginCode();
  69. },
  70. /**
  71. * 生命周期函数--监听页面隐藏
  72. */
  73. onHide: function () {},
  74. /**
  75. * 生命周期函数--监听页面卸载
  76. */
  77. onUnload: function () {},
  78. /**
  79. * 页面相关事件处理函数--监听用户下拉动作
  80. */
  81. onPullDownRefresh: function () {},
  82. /**
  83. * 页面上拉触底事件的处理函数
  84. */
  85. onReachBottom: function () {},
  86. /**
  87. * 用户点击右上角分享
  88. */
  89. onShareAppMessage: function () {},
  90. methods: {
  91. getPhoneNumber(e) {
  92. let that = this;
  93. util.request(
  94. api.RefereeMemberCardReceive,
  95. {
  96. code: this.loginCode,
  97. encryptedData: e.detail.encryptedData,
  98. iv: e.detail.iv,
  99. rId: that.rId
  100. },
  101. 'POST'
  102. ).then((res) => {
  103. if (res.errno == 0) {
  104. app.globalData.hasLogin = true;
  105. app.globalData.userInfo = res.data.userInfo;
  106. uni.setStorageSync('userInfo', res.data.userInfo);
  107. uni.setStorageSync('token', res.data.token);
  108. uni.navigateTo({
  109. url: '/pages/member/card/received/receivedCard?rId=' + that.rId
  110. });
  111. } else {
  112. util.showErrorToast(res.errmsg);
  113. that.getLoginCode();
  114. }
  115. });
  116. },
  117. getLoginCode() {
  118. let that = this;
  119. user.login().then((res) => {
  120. that.setData({
  121. loginCode: res.code
  122. });
  123. });
  124. },
  125. getReferee() {
  126. util.request(
  127. api.ReferrerRidInfo,
  128. {
  129. rId: this.rId
  130. },
  131. 'GET'
  132. ).then((res) => {
  133. if (res.errno == 0) {
  134. this.setData({
  135. userName: res.data.applyName,
  136. avatarUrl: res.data.avatar
  137. });
  138. app.globalData.recommend = {
  139. userName: res.data.applyName,
  140. avatarUrl: res.data.avatar
  141. };
  142. } else {
  143. util.showErrorToast(res.errmsg);
  144. }
  145. });
  146. }
  147. }
  148. };
  149. </script>
  150. <style>
  151. page {
  152. height: 100%;
  153. width: 100%;
  154. /* background: rgb(207, 63, 37); */
  155. }
  156. .container {
  157. text-align: center;
  158. /* margin: 20rpx; */
  159. padding: 0 0 52rpx;
  160. }
  161. .receive-bg {
  162. background: url('https://jzmall.lifejingzhi.com/file/jzmall/weixin/memberCard-1229/member-give-bg.png') no-repeat center top;
  163. background-size: 100% 100%;
  164. min-height: 100vh;
  165. padding-top: 224rpx;
  166. }
  167. .arvator {
  168. width: 140rpx;
  169. height: 140rpx;
  170. border-radius: 50%;
  171. margin-top: -70rpx;
  172. }
  173. .recevie {
  174. margin: 0 50rpx;
  175. /* margin-top: 120rpx; */
  176. width: 650rpx;
  177. height: 714rpx;
  178. background: linear-gradient(198deg, #f8e5ca 0%, #fed3a8 69%);
  179. box-shadow: 3rpx 9rpx 35rpx 0rpx rgba(30, 4, 4, 0.25);
  180. border-radius: 40rpx;
  181. }
  182. .content {
  183. display: flex;
  184. flex-direction: column;
  185. }
  186. .name {
  187. font-size: 34rpx;
  188. height: 50rpx;
  189. font-weight: bold;
  190. color: #2e2e2e;
  191. margin: 20rpx 0 6rpx;
  192. }
  193. .gift {
  194. height: 39px;
  195. font-size: 22px;
  196. font-weight: 400;
  197. color: #333;
  198. margin: 10rpx;
  199. }
  200. .content image {
  201. width: 360rpx;
  202. margin: 0 auto;
  203. }
  204. .btn {
  205. font-size: 36rpx;
  206. font-weight: bold;
  207. color: #fff;
  208. width: 478rpx;
  209. height: 90rpx;
  210. line-height: 90rpx;
  211. background: linear-gradient(178deg, #ed692f, #f7b361);
  212. box-shadow: 2rpx 6rpx 16rpx 0rpx rgba(71, 36, 16, 0.12);
  213. border-radius: 45rpx;
  214. margin-top: 56rpx;
  215. }
  216. .des {
  217. margin-bottom: 30rpx;
  218. color: rgba(171, 171, 171, 1);
  219. }
  220. .title {
  221. font-size: 30px;
  222. line-height: 39rpx;
  223. font-weight: 400;
  224. color: #b67556;
  225. margin: 20rpx 0rpx;
  226. }
  227. .txt {
  228. font-size: 15px;
  229. font-weight: 400;
  230. color: rgba(46, 46, 46, 1);
  231. margin: 30rpx;
  232. }
  233. .bottom {
  234. /* z-index: -1; */
  235. /* bottom: 0rpx; */
  236. width: 100%;
  237. height: 180rpx;
  238. /* background: #EECFB1; */
  239. text-align: center;
  240. padding-top: 20rpx;
  241. }
  242. .bottom text {
  243. height: 80rpx;
  244. line-height: 80rpx;
  245. color: rgba(182, 117, 86, 1);
  246. }
  247. </style>