index.vue 9.8 KB

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