extension.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <view class="content">
  3. <view class="status_bar"><!-- 这里是状态栏 --></view>
  4. <view class="content-money">
  5. <view class="money-box">
  6. <view class="goback-box" @click="toBack"><image class="goback" src="../../static/img/fanhui.png" mode=""></image></view>
  7. <view class="header">我的推广</view>
  8. <image class="tuiguang_bg" src="../../static/img/share-bg.png"></image>
  9. <!-- <view class="money_img"><image :src="list.avatar || img"></image></view> -->
  10. <view class="money-frame">
  11. <!-- <view class="money_name">我的推广</view> -->
  12. <view class="money_num">
  13. {{ all || '0' }}
  14. <text class="money_ren">人</text>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  20. <!-- 空白页 -->
  21. <view class="empty-box"><empty v-if="orderList.length === 0"></empty></view>
  22. <!-- 订单列表 -->
  23. <view v-for="(item, index) in orderList" :key="index" class="order-item flex">
  24. <view class="title-box flex_item">
  25. <view class="title-avatar"><image :src="item.avatar"></image></view>
  26. <view class="list_tpl">
  27. <view class="title">
  28. <text>{{ item.nickname }}</text>
  29. </view>
  30. <view class="time">
  31. <text>{{ item.time }}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <uni-load-more :status="loadingType"></uni-load-more>
  37. </scroll-view>
  38. </view>
  39. </template>
  40. <script>
  41. import { spread } from '@/api/finance.js';
  42. import { mapState, mapMutations } from 'vuex';
  43. import uniLoadMore from '@/uview-ui/components/u-loading-page/u-loading-page.vue';
  44. import empty from '@/uview-ui/components/u-empty/u-empty.vue';
  45. export default {
  46. components: {
  47. empty,
  48. uniLoadMore
  49. },
  50. onReady() {
  51. // 初始化获取页面宽度
  52. uni.createSelectorQuery()
  53. .select('.content')
  54. .fields(
  55. {
  56. size: true
  57. },
  58. data => {
  59. // console.log(data);
  60. // console.log(Math.floor((data.width / 750) * 300));
  61. // 保存头部高度
  62. this.maxheight = data.height - Math.floor((data.width / 750) * 470) - 44;
  63. // console.log(this.maxheight);
  64. }
  65. )
  66. .exec();
  67. },
  68. data() {
  69. return {
  70. // 头部图高度
  71. maxheight: '',
  72. orderList: [{}],
  73. all: '', //推广人数
  74. loadingType: 'more', //页面加载即时刷新
  75. page: 1, //默认展示一行
  76. limit: 10, //一行展示10条数据
  77. loadingType: 'more'
  78. };
  79. },
  80. onLoad(options) {
  81. this.loadData(); //onload只是在第一次进入页面会刷新数据,从二级页面回来不会重新加载数据
  82. },
  83. onShow() {
  84. //onShow没有参数
  85. this.loadData(); //onshow在每次打开页面都会加载数据,可以用于数据在需要刷新的环境下
  86. },
  87. methods: {
  88. async loadData() {
  89. if (this.loadingType == 'nomore') {
  90. return;
  91. }
  92. spread({
  93. limit: 10,
  94. page: 1
  95. }).then(({ data }) => {
  96. this.all = data.total;
  97. this.orderList = data.list;
  98. if (data.length != this.limit) {
  99. this.loadingType = 'nomore';
  100. } else {
  101. this.page++;
  102. }
  103. });
  104. },
  105. // 页面跳转
  106. navto(e) {
  107. uni.navigateTo({
  108. url: e
  109. });
  110. },
  111. // 点击返回 我的页面
  112. toBack() {
  113. uni.switchTab({
  114. url: '/pages/user/user'
  115. });
  116. }
  117. }
  118. };
  119. </script>
  120. <style lang="scss">
  121. .status_bar {
  122. height: var(--status-bar-height);
  123. width: 100%;
  124. background: linear-gradient(90deg, #60bab0, #45969b);
  125. }
  126. page {
  127. background: #ffffff;
  128. height: 100%;
  129. }
  130. .content-money {
  131. padding-bottom: 30rpx;
  132. background: $page-color-base;
  133. .buttom-box {
  134. position: relative;
  135. background-color: #ffffff;
  136. text-align: center;
  137. margin: 0 30rpx;
  138. padding: 30rpx 0;
  139. border-radius: $border-radius-sm;
  140. margin-top: -80rpx;
  141. .buttom {
  142. font-size: $font-lg;
  143. flex-grow: 1;
  144. .money {
  145. font-weight: bold;
  146. font-size: 32rpx;
  147. color: #ff0000;
  148. }
  149. }
  150. .text {
  151. color: #666666;
  152. }
  153. .interval {
  154. width: 2rpx;
  155. height: 60rpx;
  156. background-color: #eeeeee;
  157. }
  158. .icon {
  159. height: 50rpx;
  160. width: 48rpx;
  161. margin: 0 auto;
  162. .icon-img {
  163. width: 100%;
  164. height: 100%;
  165. }
  166. }
  167. }
  168. }
  169. .money-box {
  170. // background: $base-color;
  171. height: 424rpx;
  172. color: #ffffff;
  173. text-align: center;
  174. font-size: 35rpx;
  175. position: relative;
  176. // padding-top: 60rpx;
  177. .header {
  178. position: absolute;
  179. left: 0;
  180. top: 0;
  181. width: 100%;
  182. height: 80rpx;
  183. font-size: 32rpx;
  184. font-weight: 700;
  185. z-index: 99;
  186. display: flex;
  187. justify-content: center;
  188. align-items: center;
  189. }
  190. .goback-box {
  191. position: absolute;
  192. left: 18rpx;
  193. top: 0;
  194. height: 80rpx;
  195. display: flex;
  196. align-items: center;
  197. }
  198. .goback {
  199. z-index: 100;
  200. width: 34rpx;
  201. height: 34rpx;
  202. }
  203. .tuiguang_bg {
  204. width: 100%;
  205. height: 424rpx;
  206. position: relative;
  207. }
  208. .money_img {
  209. width: 100%;
  210. height: 120rpx;
  211. text-align: center;
  212. padding-top: 50rpx;
  213. padding-bottom: 135rpx;
  214. image {
  215. width: 120rpx;
  216. height: 120rpx;
  217. border: 4rpx solid #fd5f6f;
  218. border-radius: 50%;
  219. }
  220. }
  221. .money-frame {
  222. position: absolute;
  223. top: 0;
  224. width: 100%;
  225. padding-top: 120rpx;
  226. // left: 30rpx;
  227. // height: 460rpx;
  228. // display: flex;
  229. // align-items: flex-start;
  230. // flex-direction: column;
  231. // justify-content: center;
  232. }
  233. .money_name {
  234. width: 100%;
  235. text-align: center;
  236. font-size: 32rpx;
  237. font-family: PingFang SC;
  238. font-weight: bold;
  239. color: #ffffff;
  240. }
  241. .money_num {
  242. font-size: 72rpx;
  243. font-family: PingFang SC;
  244. font-weight: bold;
  245. color: #ffffff;
  246. .money_ren {
  247. font-size: 36rpx;
  248. }
  249. }
  250. }
  251. .navbar {
  252. display: flex;
  253. height: 40px;
  254. padding: 0 5px;
  255. background: #fff;
  256. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  257. position: relative;
  258. z-index: 10;
  259. .nav-item {
  260. flex: 1;
  261. display: flex;
  262. justify-content: center;
  263. align-items: center;
  264. height: 100%;
  265. font-size: 15px;
  266. color: $font-color-dark;
  267. position: relative;
  268. &.current {
  269. color: #ff0000;
  270. &:after {
  271. content: '';
  272. position: absolute;
  273. left: 50%;
  274. bottom: 0;
  275. transform: translateX(-50%);
  276. width: 44px;
  277. height: 0;
  278. border-bottom: 2px solid #ff0000;
  279. }
  280. }
  281. }
  282. }
  283. // 列表
  284. .order-item {
  285. padding: 20rpx 30rpx;
  286. line-height: 1.5;
  287. .title-box {
  288. width: 100%;
  289. .title-avatar {
  290. width: 100rpx;
  291. height: 100rpx;
  292. margin-right: 25rpx;
  293. border-radius: 100%;
  294. image {
  295. width: 100%;
  296. height: 100%;
  297. border-radius: 100%;
  298. }
  299. }
  300. .list_tpl {
  301. width: 85%;
  302. .title {
  303. font-size: $font-lg;
  304. color: $font-color-base;
  305. overflow: hidden; //超出的文本隐藏
  306. text-overflow: ellipsis; //溢出用省略号显示
  307. white-space: nowrap;
  308. }
  309. .time {
  310. font-size: $font-base;
  311. color: $font-color-light;
  312. }
  313. }
  314. }
  315. .money {
  316. color: #db1935;
  317. font-size: $font-lg;
  318. }
  319. }
  320. .list-scroll-content {
  321. height: auto;
  322. }
  323. .content {
  324. height: 100%;
  325. .empty-content {
  326. background-color: #ffffff;
  327. }
  328. }
  329. </style>