invite.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <view class="invite-wrap" v-if="!loadding">
  3. <view class="rule">
  4. <button class="rule_btn" @click="ReLaunch()">返回首页</button>
  5. <button class="rule_btn" @click="isPopup=true">活动规则</button>
  6. </view>
  7. <view class="banner">
  8. <image :src="detail.file_path" mode="widthFix"></image>
  9. </view>
  10. <view class="invite-content">
  11. <view class="tab d-c-c">
  12. <view class="item flex-1 d-c-c d-c" :class="tab_active==0?'active':''" @click="tab_active=0">
  13. <text class="headtext fb">领取大礼包</text>
  14. <text>火热进行中</text>
  15. </view>
  16. <view class="item flex-1 d-c-c d-c" :class="tab_active==1?'active':''" @click="tab_active=1">
  17. <text class="headtext fb">我的奖励</text>
  18. <text>多邀多得</text>
  19. </view>
  20. </view>
  21. <view class="invite-inner">
  22. <!--type 1-->
  23. <view class="invite-type" v-if="tab_active==0">
  24. <view class="title" v-if="detail.inv_condition==0">
  25. 注:邀请好友注册即邀请成功
  26. </view>
  27. <view class="title" v-if="detail.inv_condition==1">
  28. 注:邀请好友注册且好友消费即邀请成功
  29. </view>
  30. <view class="content">
  31. <scroll-view scroll-x="true">
  32. <view class="list d-s-c">
  33. <view class="item d-c-c d-c" :class="detail.count>=item.invitation_num?'select-item':''" v-for="(item,index) in detail.Reward" :key="index">
  34. <!-- <view class="item d-c-c d-c" v-for="(item,index) in detaillist.Reward" :key="index"> -->
  35. <image src="/static/gift.png" mode="widthFix"></image>
  36. <view class="progress"><view class="progress_dot"></view></view>
  37. <text>{{item.invitation_num}}人</text>
  38. </view>
  39. </view>
  40. </scroll-view>
  41. </view>
  42. <view clas></view>
  43. <view class="state-explan p20 d-c-c f30" v-if="!detail.is_over">
  44. 已邀请{{detail.count}}人,还差<text class="p-0-10 red">{{detail.dif}}</text>人就可以领取礼包啦
  45. </view>
  46. <view class="state-explan p20 d-c-c f30" v-if="detail.is_over">
  47. 共邀请{{detail.count}}人,奖品已全部领取,感谢您的参与
  48. </view>
  49. <view class="btns-box">
  50. <!-- #ifdef MP-WEIXIN -->
  51. <button open-type="share">邀请好友得礼包</button>
  52. <!-- #endif -->
  53. <!-- #ifndef MP-WEIXIN -->
  54. <button @click="showShare">邀请好友得礼包</button>
  55. <!-- #endif -->
  56. </view>
  57. </view>
  58. <!--type 2-->
  59. <view class="invite-type2" v-if="tab_active==1">
  60. <view class="list" v-for="(item,index) in detail.prize" :key="index">
  61. <view class="item p-20-0 d-b-c" v-if="item.coupon_name!=''">
  62. <view class="d-s-s d-c">
  63. <text class="num">{{item.coupon_name}}</text>
  64. <text class="gray9 f22">{{item.create_time}}</text>
  65. </view>
  66. <text>优惠券</text>
  67. </view>
  68. <view class="item p-20-0 d-b-c" v-if="item.point!=0">
  69. <view class="d-s-s d-c">
  70. <text class="num">+{{item.point}}</text>
  71. <text class="gray9 f22">{{item.create_time}}</text>
  72. </view>
  73. <text>积分</text>
  74. </view>
  75. </view>
  76. <view class="d-c-c p30" v-if="detail.prize.length==0 && !loading">
  77. <text class="iconfont icon-wushuju"></text>
  78. <text class="cont">亲,暂无相关记录哦</text>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <!--底部弹窗-->
  84. <MpShare :isMpShare="isMpShare" @close="closeShare"></MpShare>
  85. <!--app分享-->
  86. <!-- #ifdef APP-PLUS -->
  87. <AppShare :isAppShare="isAppShare" :appParams="appParams" @close="closeShare"></AppShare>
  88. <!-- #endif -->
  89. <Popup :show="isPopup" @hidePopup="hidePopupFunc" msg="活动规则">
  90. <view>
  91. <view>活动时间:</view>
  92. <view class="p-0-20 mb30">{{detail.start_time.text+"——"+detail.end_time.text}}</view>
  93. <view class="reward_time">活动奖励:</view>
  94. <view v-for="(item,index) in detail.Reward" :key="index">
  95. <view class="d-b-c reward_item">
  96. <view>邀请<text class="orange">{{item.invitation_num}}</text>人后奖励</view>
  97. <view>
  98. <view class="reward_coupon" v-if="item.coupon_name!=''" >
  99. <view>{{item.coupon_name}}</view>
  100. <view>优惠券</view>
  101. </view>
  102. <view v-if="item.point!=0"><text>{{item.point}}</text>积分</view>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. </Popup>
  108. </view>
  109. </template>
  110. <script>
  111. import Popup from '@/components/uni-popup.vue';
  112. import AppShare from '@/components/app-share.vue';
  113. import MpShare from '@/components/mp-share.vue';
  114. export default {
  115. components: {
  116. Popup,
  117. AppShare,
  118. MpShare
  119. },
  120. data() {
  121. return {
  122. /*是否加载完成*/
  123. loadding:false,
  124. invitation_gift_id:0,
  125. /*弹窗是否打开*/
  126. isPopup: false,
  127. indicatorDots: true,
  128. autoplay: true,
  129. interval: 2000,
  130. duration: 500,
  131. tab_active: 0,
  132. /*活动详情*/
  133. detail: {
  134. start_time: {
  135. text: 0
  136. },
  137. end_time: {
  138. text: 0
  139. },
  140. dif: 0,
  141. count:0
  142. },
  143. url: '',
  144. /*app分享*/
  145. isAppShare: false,
  146. appParams:{
  147. title: '',
  148. summary: '',
  149. path: ''
  150. },
  151. /*公众号分享*/
  152. isMpShare: false
  153. }
  154. },
  155. onLoad(e) {
  156. uni.showLoading({
  157. title: '加载中'
  158. });
  159. this.invitation_gift_id=e.invitation_gift_id;
  160. //#ifdef H5
  161. this.url = window.location.href;
  162. //#endif
  163. },
  164. onShow() {
  165. /*获取数据*/
  166. this.getData();
  167. },
  168. methods: {
  169. /*获取数据*/
  170. getData() {
  171. let self = this;
  172. self._get('plus.invitationgift.invitation/getDatas', {
  173. invitation_gift_id:self.invitation_gift_id || 0,
  174. url: self.url
  175. }, function(res) {
  176. self.detail = res.data.data;
  177. // 配置微信分享参数
  178. //#ifdef H5
  179. if (self.url != '') {
  180. let params = {
  181. invitation_id: self.invitation_gift_id,
  182. referee_id:self.getUserId()
  183. };
  184. self.configWx(res.data.share.signPackage, res.data.share.shareParams, params);
  185. }
  186. //#endif
  187. self.loadding=false;
  188. uni.hideLoading();
  189. },(err)=>{
  190. self.showError(err.msg,()=>{
  191. uni.navigateBack()
  192. })
  193. });
  194. },
  195. /*分享*/
  196. onShareAppMessage() {
  197. let self = this;
  198. // 构建页面参数
  199. let params = self.getShareUrlParams({
  200. invitation_id: self.invitation_gift_id,
  201. referee_id:self.getUserId()
  202. });
  203. return {
  204. title: self.detail.share_title,
  205. path: '/pages/index/index?' + params,
  206. imageUrl:self.detail.share.file_path
  207. };
  208. },
  209. /* 返回首页 */
  210. ReLaunch(){
  211. this.gotoPage('/pages/index/index', 'reLaunch');
  212. },
  213. //关闭活动规则
  214. hidePopupFunc() {
  215. this.isPopup = false;
  216. },
  217. /*领奖*/
  218. getPrize(e) {
  219. let self = this;
  220. self._post('user.invitation/getPrize', {
  221. invitation_reward_id: e,
  222. invitation_gift_id: self.detail.invitation_gift_id,
  223. }, function(res) {
  224. uni.hideLoading();
  225. uni.showToast({
  226. title: '领取成功',
  227. duration: 2000,
  228. icon: 'success'
  229. });
  230. self.getData();
  231. });
  232. },
  233. showShare(){
  234. let self = this;
  235. //#ifndef APP-PLUS
  236. self.isMpShare = true;
  237. //#endif
  238. //#ifdef APP-PLUS
  239. self.appParams.title = self.detail.share_title;
  240. self.appParams.summary = self.detail.share_desc;
  241. // 构建页面参数
  242. let params = self.getShareUrlParams({
  243. invitation_id: self.invitation_gift_id,
  244. referee_id:self.getUserId()
  245. });
  246. self.appParams.path = '/pages/index/index?' + params;
  247. self.appParams.image = self.detail.share.file_path;
  248. self.isAppShare = true;
  249. //#endif
  250. },
  251. //关闭分享
  252. closeShare(data) {
  253. this.isAppShare = false;
  254. this.isMpShare = false;
  255. },
  256. }
  257. }
  258. </script>
  259. <style>
  260. .invite-wrap {
  261. height: 100vh;
  262. background: #9b67cf;
  263. position: relative;
  264. padding-top: 480rpx;
  265. }
  266. .banner{
  267. position: absolute;
  268. top: 0;
  269. }
  270. .invite-wrap .banner image{
  271. width: 750rpx;
  272. }
  273. .invite-wrap .activity-date {
  274. width: 500rpx;
  275. height: 40rpx;
  276. margin: 0 auto;
  277. border-radius: 20rpx;
  278. background: #ff5b90;
  279. color: #FFFFFF;
  280. }
  281. .invite-content {
  282. margin: 50rpx;
  283. margin-top: 0;
  284. border-radius: 20rpx;
  285. background: #FFFFFF;
  286. position: relative;
  287. }
  288. .invite-content .tab {
  289. /* border-bottom: 1px solid #CCCCCC; */
  290. border-top-left-radius: 15rpx;
  291. border-top-right-radius: 15rpx;
  292. overflow: hidden;
  293. }
  294. .invite-content .tab .item {
  295. padding: 20rpx 0;
  296. font-size: 20rpx;
  297. background-color:#ff5b90 ;
  298. color: #FFFFFF;
  299. box-shadow: rgba(255,255,255,0.25) 0px 1px 0px, inset rgba(255,255,255,0.25) 0px 1px 0px, inset rgba(0,0,0,0.25) 0px 0px 0px, inset rgba(255,255,255,0.03) 0px 20px 0px, inset rgba(0,0,0,0.15) 0px -20px 20px, inset rgba(255,255,255,0.05) 0px 20px 20px;
  300. }
  301. .invite-content .tab .item.active {
  302. /* border-bottom: 3px solid #ff5b90; */
  303. /* margin-bottom: -3px; */
  304. /* color: #ff5b90; */
  305. color: #000000;
  306. box-shadow:none;
  307. background-color: #ffffff;
  308. }
  309. .invite-content .tab .item .headtext {
  310. font-size: 32rpx;
  311. }
  312. .invite-content .invite-inner {
  313. margin-top: 30rpx;
  314. padding: 20rpx;
  315. }
  316. .invite-content .invite-type .title {
  317. text-align: center;
  318. color: red;
  319. font-size: 28rpx;
  320. }
  321. .invite-content .invite-type .content {
  322. margin-top: 30rpx;
  323. margin-bottom: 30rpx;
  324. }
  325. .invite-content .invite-type .content image {
  326. width: 120rpx;
  327. }
  328. .select-item image {
  329. filter: grayscale(100%);
  330. filter: gray;
  331. }
  332. .invite-content .invite-type .item {
  333. width: 240rpx;
  334. }
  335. .invite-content .invite-type2 .item {
  336. border-bottom: 1px dashed #CCCCCC;
  337. }
  338. .invite-content .invite-type2 .item .num {
  339. color: #f62c6d;
  340. }
  341. .invite-content .btns-box {
  342. margin-top: 40rpx;
  343. }
  344. .invite-content .btns-box button {
  345. margin: 0 auto;
  346. width: 457rpx;
  347. height: 88rpx;
  348. text-align: center;
  349. line-height: 88rpx;
  350. border-radius: 44rpx;
  351. background: linear-gradient(to right, #ff5b90 0%,#f62c6d 100%);
  352. color: #FFFFFF;
  353. }
  354. .progress{
  355. height: 15rpx;
  356. width: 100%;
  357. background-color: #f7d887;
  358. margin-top: 32rpx;
  359. margin-bottom: 27rpx;
  360. }
  361. .progress .progress_dot{
  362. width: 15rpx;
  363. height: 15rpx;
  364. background-color: #f88035;
  365. border-radius: 50%;
  366. margin: 0 auto;
  367. }
  368. .invite_rule{
  369. }
  370. .invite_rule .title{
  371. color: #ffffff;
  372. text-align: center;
  373. font-size: 31rpx;
  374. line-height: 50rpx;
  375. margin-bottom: 50rpx;
  376. }
  377. .rule_list{
  378. display: flex;
  379. justify-content: space-around;
  380. align-items: center;
  381. padding: 0 50rpx;
  382. }
  383. .rule_item{
  384. width: 128rpx;
  385. height: 128rpx;
  386. border-radius: 8rpx;
  387. background-color: #FFFFFF20;
  388. text-align: center;
  389. line-height: 128rpx;
  390. }
  391. .rule_list .rule_item .icon{
  392. font-size: 88rpx;
  393. color: #FFFFFF;
  394. }
  395. .oblique{
  396. color: #f3de8d;
  397. font-weight: 900;
  398. margin: 0 30rpx;
  399. }
  400. .rule{
  401. overflow: hidden;
  402. position: fixed;
  403. right: 0;
  404. top: 505rpx;
  405. z-index: 100;
  406. }
  407. .rule_btn{
  408. margin-top: 27rpx;
  409. width: 183rpx;
  410. height: 62rpx;
  411. line-height: 62rpx;
  412. text-align: center;
  413. background: linear-gradient(to right, #ff6d9c 0%,#f53b77 100%);
  414. border-right: none;
  415. border-top-left-radius: 32rpx;
  416. border-bottom-left-radius: 32rpx;
  417. color: #ffffff;
  418. font-size: 26rpx;
  419. }
  420. .reward_item{
  421. text-align: end;
  422. padding: 10rpx;
  423. border-bottom: 1px dashed #CCCCCC;
  424. }
  425. .reward_coupon{
  426. margin-bottom: 10rpx;
  427. }
  428. .reward_time{
  429. border-bottom: 1px dashed #CCCCCC;
  430. padding-bottom: 20rpx;
  431. }
  432. </style>