index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <template>
  2. <view class="">
  3. <view class="invite" v-if="inviteShow && loading">
  4. <view class="invite-header" :style="{backgroundImage:'url('+imgHost+'/statics/images/extension.jpg'+')'}">
  5. <view class='swipers'>
  6. <swiper :indicator-dots="false" autoplay="true" interval="2500" duration="500" vertical="true"
  7. circular="true">
  8. <block v-for="(item,index) in agentInfoData.list" :key='index'>
  9. <swiper-item @touchmove.stop="stopTouchMove">
  10. <view class='line1'>恭喜{{item.nickname}} <text class="color_ye">
  11. 成功赚取{{item.price}}</text> </view>
  12. </swiper-item>
  13. </block>
  14. </swiper>
  15. </view>
  16. </view>
  17. <view class="box">
  18. <view class="box-title-sty">
  19. <view class="box-title" :style="{backgroundImage:'url('+imgHost+'/statics/images/title-bag.png'+')'}">
  20. 我的收益
  21. </view>
  22. <view class="benefit">
  23. <text class="iconfont icon-zhu"></text>
  24. <text>获得收益</text>
  25. <text class="num">{{agentInfoData.price || 0}}</text>
  26. <text>元</text>
  27. </view>
  28. </view>
  29. <view class="tab">
  30. <view class="item" @click="getList(0)">
  31. <view class="text" :class="sel == 0?'on':''">已邀请好友</view>
  32. <view class="line" :class="sel == 0?'on':''"></view>
  33. </view>
  34. <view class="item" @click="getList(1)">
  35. <view class=" text" :class="sel == 1 ?'on':''">已下单好友</view>
  36. <view class="line" :class="sel == 1 ?'on':''"></view>
  37. </view>
  38. </view>
  39. <view class="list" v-if="userList.length">
  40. <view class="item" v-for="(item,index) in userList" :key="index">
  41. <view class="item-l">
  42. <view class="avatar">
  43. <image :src="item.avatar" mode=""></image>
  44. </view>
  45. <view class="">{{item.nickname}}</view>
  46. </view>
  47. <view class="item-r">{{item.spread_time}}</view>
  48. </view>
  49. <template v-if="userList.length">
  50. <view class='more' @tap='showAll' v-if="userList.length < total">查看更多
  51. <text class='iconfont icon-xiangxia'></text>
  52. </view>
  53. </template>
  54. </view>
  55. <view class="no-thing" v-if="(!userList.length && sel == 0) || (!userList.length && sel == 1)">
  56. <view class="no-thing-img">
  57. <image :src="imgHost + '/statics/images/no-thing.png'" mode="aspectFit"></image>
  58. </view>
  59. <view class="pl20">
  60. {{sel == 0?'暂无已邀请好友,快去邀请吧':'暂无下单好友,快去邀请下单吧'}}
  61. </view>
  62. </view>
  63. </view>
  64. <view class="box">
  65. <view class="box-title-sty white">
  66. <view class="box-title" :style="{backgroundImage:'url('+imgHost+'/statics/images/title-bag.png'+')'}">活动规则</view>
  67. </view>
  68. <view class="agreement" v-html="agentInfoData.agreement"></view>
  69. </view>
  70. <view class="footer">
  71. <view class="click">
  72. <image src="../static/click.png" mode=""></image>
  73. </view>
  74. <view class="cancellation flex-aj-center" @click="invite">
  75. 立即邀请
  76. </view>
  77. </view>
  78. </view>
  79. <view class="no-invite" v-else-if="!inviteShow && loading">
  80. <image :src="imgHost + '/statics/images/no-thing.png'" mode="aspectFit"></image>
  81. <text>商家暂未上架活动哦~</text>
  82. </view>
  83. <home v-if="navigation"></home>
  84. <!-- #ifdef MP -->
  85. <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize>
  86. <!-- #endif -->
  87. </view>
  88. </template>
  89. <script>
  90. import {
  91. getUserInfo,
  92. agentUserList,
  93. agentInfo
  94. } from '@/api/user.js';
  95. import colors from '@/mixins/color.js'
  96. import home from '@/components/home';
  97. import {toLogin} from '@/libs/login.js';
  98. import {mapGetters} from "vuex";
  99. import {HTTP_REQUEST_URL} from '@/config/app';
  100. const app = getApp();
  101. export default {
  102. components: {
  103. home
  104. },
  105. mixins: [colors],
  106. data() {
  107. return {
  108. inviteShow: true,
  109. loading: true,
  110. sel: 0,
  111. userList: [],
  112. agentInfoData: {},
  113. page: 1,
  114. limit: 5,
  115. total: 0,
  116. imgHost:HTTP_REQUEST_URL,
  117. isShowAuth: false
  118. }
  119. },
  120. computed: mapGetters(['isLogin']),
  121. watch: {
  122. isLogin: {
  123. handler: function(newV, oldV) {
  124. if (newV) {}
  125. },
  126. deep: true
  127. }
  128. },
  129. onLoad(option) {
  130. this.type = option.type;
  131. if (this.isLogin) {
  132. this.getAgentList(0);
  133. this.getAgentInfo();
  134. }
  135. },
  136. onShow(){
  137. uni.removeStorageSync('form_type_cart');
  138. if(!this.isLogin){
  139. // #ifndef MP
  140. toLogin()
  141. // #endif
  142. // #ifdef MP
  143. this.isShowAuth = true;
  144. // #endif
  145. }
  146. },
  147. methods: {
  148. /**
  149. * 授权回调
  150. */
  151. onLoadFun: function() {
  152. this.getAgentList(0);
  153. this.getAgentInfo();
  154. this.isShowAuth = false;
  155. },
  156. // 授权关闭
  157. authColse: function(e) {
  158. this.isShowAuth = e
  159. },
  160. //#ifdef H5
  161. ShareInfo(data) {
  162. let href = location.href;
  163. if (this.$wechat.isWeixin()) {
  164. getUserInfo().then(res => {
  165. href = href.indexOf('?') === -1 ? href + '?spread=' + res.data.uid : href + '&spread=' +
  166. res.data.uid;
  167. let configAppMessage = {
  168. desc: data.name,
  169. title: data.name,
  170. link: href,
  171. imgUrl: data.image
  172. };
  173. this.$wechat
  174. .wechatEvevt(['updateAppMessageShareData', 'updateTimelineShareData',
  175. 'onMenuShareAppMessage',
  176. 'onMenuShareTimeline'
  177. ], configAppMessage)
  178. .then(res => {})
  179. .catch(err => {});
  180. });
  181. }
  182. },
  183. //#endif
  184. getList(index) {
  185. this.sel = index;
  186. this.userList = [];
  187. this.page = 1;
  188. this.getAgentList(index);
  189. },
  190. invite() {
  191. uni.navigateTo({
  192. url: '/pages/users/user_spread_code/index'
  193. })
  194. },
  195. getAgentList(type) {
  196. agentUserList(type, this.page, this.limit).then(res => {
  197. this.total = res.data.count;
  198. let len = res.data.list.length;
  199. let userListNew = [];
  200. let userListData = res.data.list;
  201. userListNew = this.userList.concat(userListData);
  202. this.$set(this, 'userList', userListNew);
  203. })
  204. },
  205. getAgentInfo() {
  206. agentInfo().then(res => {
  207. this.agentInfoData = res.data;
  208. })
  209. },
  210. showAll: function() {
  211. this.page++;
  212. this.getAgentList(this.sel);
  213. },
  214. }
  215. }
  216. </script>
  217. <style lang="scss" scoped>
  218. @import "../static/click.css";
  219. .invite {
  220. background-color: #E74435;
  221. min-height: 100vh;
  222. padding: 0 0 80rpx 0;
  223. .invite-header {
  224. width: 100%;
  225. height: 584rpx;
  226. margin: 0;
  227. background-repeat: no-repeat;
  228. background-size: 100% 100%;
  229. z-index: 1;
  230. .swipers {
  231. width: 544rpx;
  232. height: 40rpx;
  233. line-height: 40rpx;
  234. background: rgba(183, 4, 0, 1);
  235. border-radius: 24rpx;
  236. margin: auto;
  237. overflow: hidden;
  238. position: absolute;
  239. left: 50%;
  240. top: 14%;
  241. transform: translate(-50%);
  242. /* 50%为自身尺寸的一半 */
  243. .line1 {
  244. text-align: center;
  245. }
  246. swiper {
  247. height: 100%;
  248. width: 100%;
  249. overflow: hidden;
  250. font-size: 24rpx;
  251. color: #FFFFFF;
  252. }
  253. .color_ye {
  254. color: #FFE39F;
  255. }
  256. }
  257. }
  258. .notice {
  259. position: absolute;
  260. }
  261. .box {
  262. margin: -100rpx 30rpx 160rpx 30rpx;
  263. width: 690rpx;
  264. background-color: #fff;
  265. z-index: 999;
  266. border-radius: 12rpx;
  267. .agreement {
  268. padding: 0 30rpx 30rpx 30rpx;
  269. word-wrap: break-word;
  270. text-align: justify;
  271. /deep/p{
  272. margin-bottom: 8rpx;
  273. line-height: 60rpx;
  274. }
  275. }
  276. .box-title-sty {
  277. background-color: #FEF7F6;
  278. padding-bottom: 42rpx;
  279. border-radius: 12rpx 12rpx 0 0;
  280. .benefit {
  281. text-align: center;
  282. color: #333333;
  283. font-size: 24rpx;
  284. .icon-zhu {
  285. color: #E93323;
  286. padding-right: 16rpx;
  287. }
  288. .num {
  289. color: #E93323;
  290. font-size: 54rpx;
  291. padding: 0 8rpx;
  292. font-weight: bold;
  293. }
  294. }
  295. }
  296. .white {
  297. background-color: #fff;
  298. }
  299. .tab {
  300. display: flex;
  301. padding: 36rpx;
  302. color: #E93323;
  303. font-size: 32rpx;
  304. .item {
  305. width: 100%;
  306. text-align: center;
  307. .line {
  308. margin: 20rpx auto 0 auto;
  309. width: 106rpx;
  310. height: 2px;
  311. border-radius: 1px;
  312. }
  313. .line.on {
  314. background: #E93323;
  315. }
  316. .on {
  317. font-weight: bold;
  318. }
  319. }
  320. }
  321. .no-thing {
  322. display: flex;
  323. align-items: center;
  324. justify-content: center;
  325. padding: 16rpx 0 52rpx;
  326. color: #333;
  327. .no-thing-img {
  328. width: 48rpx;
  329. height: 48rpx;
  330. image {
  331. width: 100%;
  332. height: 100%;
  333. }
  334. }
  335. .pl20 {
  336. padding-left: 20rpx;
  337. }
  338. }
  339. .list {
  340. .item {
  341. display: flex;
  342. justify-content: space-between;
  343. align-items: center;
  344. padding: 14rpx 30rpx;
  345. .item-l {
  346. display: flex;
  347. align-items: center;
  348. color: #333333;
  349. font-size: 28rpx;
  350. .avatar {
  351. width: 56rpx;
  352. height: 56rpx;
  353. margin-right: 18rpx;
  354. image {
  355. width: 100%;
  356. height: 100%;
  357. border-radius: 50%;
  358. }
  359. }
  360. }
  361. .item-r {
  362. color: #999999;
  363. font-size: 22rpx;
  364. }
  365. }
  366. .more {
  367. font-size: 24rpx;
  368. color: #282828;
  369. text-align: center;
  370. height: 90rpx;
  371. line-height: 90rpx;
  372. }
  373. }
  374. .box-title {
  375. transform: translateY(-20rpx);
  376. margin: 0 auto;
  377. width: 380rpx;
  378. height: 76rpx;
  379. background-repeat: no-repeat;
  380. background-size: cover;
  381. color: #fff;
  382. display: flex;
  383. align-items: center;
  384. justify-content: center;
  385. font-size: 36rpx;
  386. font-weight: 500;
  387. }
  388. }
  389. .footer {
  390. text-align: center;
  391. z-index: 999;
  392. width: 100%;
  393. background-color: #E93323;
  394. position: fixed;
  395. padding: 36rpx 30rpx;
  396. box-sizing: border-box;
  397. bottom: 0rpx;
  398. .trip {
  399. color: #999999;
  400. font-size: 24rpx;
  401. margin: 24rpx 0;
  402. }
  403. .click {
  404. width: 66rpx;
  405. height: 74rpx;
  406. position: absolute;
  407. right: 44rpx;
  408. bottom: 8rpx;
  409. image {
  410. width: 100%;
  411. height: 100%;
  412. }
  413. }
  414. .cancellation {
  415. height: 45px;
  416. color: #E93323;
  417. font-weight: bold;
  418. font-size: 36rpx;
  419. background: linear-gradient(180deg, #FFFCF6 0%, #FFE297 100%);
  420. border-radius: 25px;
  421. }
  422. }
  423. }
  424. // .mask {
  425. // position: fixed;
  426. // top: 0;
  427. // left: 0;
  428. // right: 0;
  429. // bottom: 0;
  430. // background-color: rgba(0, 0, 0, 0.8);
  431. // z-index: 9;
  432. // }
  433. // .share-box {
  434. // z-index: 1300;
  435. // position: fixed;
  436. // left: 0;
  437. // top: 0;
  438. // width: 100%;
  439. // height: 100%;
  440. // image {
  441. // width: 100%;
  442. // height: 100%;
  443. // }
  444. // }
  445. .no-invite {
  446. display: flex;
  447. justify-content: center;
  448. flex-direction: column;
  449. align-items: center;
  450. font-size: 28rpx;
  451. color: #ccc;
  452. }
  453. [v-cloak] {
  454. display: none;
  455. }
  456. </style>