index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  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. toLogin()
  140. }
  141. },
  142. methods: {
  143. /**
  144. * 授权回调
  145. */
  146. onLoadFun: function() {
  147. this.getAgentList(0);
  148. this.getAgentInfo();
  149. this.isShowAuth = false;
  150. },
  151. // 授权关闭
  152. authColse: function(e) {
  153. this.isShowAuth = e
  154. },
  155. //#ifdef H5
  156. ShareInfo(data) {
  157. let href = location.href;
  158. if (this.$wechat.isWeixin()) {
  159. getUserInfo().then(res => {
  160. href = href.indexOf('?') === -1 ? href + '?spid=' + res.data.uid : href + '&spid=' +
  161. res.data.uid;
  162. let configAppMessage = {
  163. desc: data.name,
  164. title: data.name,
  165. link: href,
  166. imgUrl: data.image
  167. };
  168. this.$wechat
  169. .wechatEvevt(['updateAppMessageShareData', 'updateTimelineShareData',
  170. 'onMenuShareAppMessage',
  171. 'onMenuShareTimeline'
  172. ], configAppMessage)
  173. .then(res => {})
  174. .catch(err => {});
  175. });
  176. }
  177. },
  178. //#endif
  179. getList(index) {
  180. this.sel = index;
  181. this.userList = [];
  182. this.page = 1;
  183. this.getAgentList(index);
  184. },
  185. invite() {
  186. uni.navigateTo({
  187. url: '/pages/users/user_spread_code/index'
  188. })
  189. },
  190. getAgentList(type) {
  191. agentUserList(type, this.page, this.limit).then(res => {
  192. this.total = res.data.count;
  193. let len = res.data.list.length;
  194. let userListNew = [];
  195. let userListData = res.data.list;
  196. userListNew = this.userList.concat(userListData);
  197. this.$set(this, 'userList', userListNew);
  198. })
  199. },
  200. getAgentInfo() {
  201. agentInfo().then(res => {
  202. this.agentInfoData = res.data;
  203. })
  204. },
  205. showAll: function() {
  206. this.page++;
  207. this.getAgentList(this.sel);
  208. },
  209. }
  210. }
  211. </script>
  212. <style lang="scss" scoped>
  213. @import "../static/click.css";
  214. .invite {
  215. background-color: #E74435;
  216. min-height: 100vh;
  217. padding: 0 0 80rpx 0;
  218. .invite-header {
  219. width: 100%;
  220. height: 584rpx;
  221. margin: 0;
  222. background-repeat: no-repeat;
  223. background-size: 100% 100%;
  224. z-index: 1;
  225. .swipers {
  226. width: 544rpx;
  227. height: 40rpx;
  228. line-height: 40rpx;
  229. background: rgba(183, 4, 0, 1);
  230. border-radius: 24rpx;
  231. margin: auto;
  232. overflow: hidden;
  233. position: absolute;
  234. left: 50%;
  235. top: 14%;
  236. transform: translate(-50%);
  237. /* 50%为自身尺寸的一半 */
  238. .line1 {
  239. text-align: center;
  240. }
  241. swiper {
  242. height: 100%;
  243. width: 100%;
  244. overflow: hidden;
  245. font-size: 24rpx;
  246. color: #FFFFFF;
  247. }
  248. .color_ye {
  249. color: #FFE39F;
  250. }
  251. }
  252. }
  253. .notice {
  254. position: absolute;
  255. }
  256. .box {
  257. margin: -100rpx 30rpx 160rpx 30rpx;
  258. width: 690rpx;
  259. background-color: #fff;
  260. z-index: 999;
  261. border-radius: 12rpx;
  262. .agreement {
  263. padding: 0 30rpx 30rpx 30rpx;
  264. word-wrap: break-word;
  265. text-align: justify;
  266. /deep/p{
  267. margin-bottom: 8rpx;
  268. line-height: 60rpx;
  269. }
  270. }
  271. .box-title-sty {
  272. background-color: #FEF7F6;
  273. padding-bottom: 42rpx;
  274. border-radius: 12rpx 12rpx 0 0;
  275. .benefit {
  276. text-align: center;
  277. color: #333333;
  278. font-size: 24rpx;
  279. .icon-zhu {
  280. color: #E93323;
  281. padding-right: 16rpx;
  282. }
  283. .num {
  284. color: #E93323;
  285. font-size: 54rpx;
  286. padding: 0 8rpx;
  287. font-weight: bold;
  288. }
  289. }
  290. }
  291. .white {
  292. background-color: #fff;
  293. }
  294. .tab {
  295. display: flex;
  296. padding: 36rpx;
  297. color: #E93323;
  298. font-size: 32rpx;
  299. .item {
  300. width: 100%;
  301. text-align: center;
  302. .line {
  303. margin: 20rpx auto 0 auto;
  304. width: 106rpx;
  305. height: 2px;
  306. border-radius: 1px;
  307. }
  308. .line.on {
  309. background: #E93323;
  310. }
  311. .on {
  312. font-weight: bold;
  313. }
  314. }
  315. }
  316. .no-thing {
  317. display: flex;
  318. align-items: center;
  319. justify-content: center;
  320. padding: 16rpx 0 52rpx;
  321. color: #333;
  322. .no-thing-img {
  323. width: 48rpx;
  324. height: 48rpx;
  325. image {
  326. width: 100%;
  327. height: 100%;
  328. }
  329. }
  330. .pl20 {
  331. padding-left: 20rpx;
  332. }
  333. }
  334. .list {
  335. .item {
  336. display: flex;
  337. justify-content: space-between;
  338. align-items: center;
  339. padding: 14rpx 30rpx;
  340. .item-l {
  341. display: flex;
  342. align-items: center;
  343. color: #333333;
  344. font-size: 28rpx;
  345. .avatar {
  346. width: 56rpx;
  347. height: 56rpx;
  348. margin-right: 18rpx;
  349. image {
  350. width: 100%;
  351. height: 100%;
  352. border-radius: 50%;
  353. }
  354. }
  355. }
  356. .item-r {
  357. color: #999999;
  358. font-size: 22rpx;
  359. }
  360. }
  361. .more {
  362. font-size: 24rpx;
  363. color: #282828;
  364. text-align: center;
  365. height: 90rpx;
  366. line-height: 90rpx;
  367. }
  368. }
  369. .box-title {
  370. transform: translateY(-20rpx);
  371. margin: 0 auto;
  372. width: 380rpx;
  373. height: 76rpx;
  374. background-repeat: no-repeat;
  375. background-size: cover;
  376. color: #fff;
  377. display: flex;
  378. align-items: center;
  379. justify-content: center;
  380. font-size: 36rpx;
  381. font-weight: 500;
  382. }
  383. }
  384. .footer {
  385. text-align: center;
  386. z-index: 999;
  387. width: 100%;
  388. background-color: #E93323;
  389. position: fixed;
  390. padding: 36rpx 30rpx;
  391. box-sizing: border-box;
  392. bottom: 0rpx;
  393. .trip {
  394. color: #999999;
  395. font-size: 24rpx;
  396. margin: 24rpx 0;
  397. }
  398. .click {
  399. width: 66rpx;
  400. height: 74rpx;
  401. position: absolute;
  402. right: 44rpx;
  403. bottom: 8rpx;
  404. image {
  405. width: 100%;
  406. height: 100%;
  407. }
  408. }
  409. .cancellation {
  410. height: 45px;
  411. color: #E93323;
  412. font-weight: bold;
  413. font-size: 36rpx;
  414. background: linear-gradient(180deg, #FFFCF6 0%, #FFE297 100%);
  415. border-radius: 25px;
  416. }
  417. }
  418. }
  419. // .mask {
  420. // position: fixed;
  421. // top: 0;
  422. // left: 0;
  423. // right: 0;
  424. // bottom: 0;
  425. // background-color: rgba(0, 0, 0, 0.8);
  426. // z-index: 9;
  427. // }
  428. // .share-box {
  429. // z-index: 1300;
  430. // position: fixed;
  431. // left: 0;
  432. // top: 0;
  433. // width: 100%;
  434. // height: 100%;
  435. // image {
  436. // width: 100%;
  437. // height: 100%;
  438. // }
  439. // }
  440. .no-invite {
  441. display: flex;
  442. justify-content: center;
  443. flex-direction: column;
  444. align-items: center;
  445. font-size: 28rpx;
  446. color: #ccc;
  447. }
  448. [v-cloak] {
  449. display: none;
  450. }
  451. </style>