sick.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="money-box">
  5. <view class="money_name money">{{all}}</view>
  6. <view class="money_name">推荐奖励</view>
  7. </view>
  8. <view class="flex buttom-box">
  9. <view class="buttom">
  10. <view class="money">{{total || 0}}</view>
  11. <text class="text">推荐用户</text>
  12. </view>
  13. <view class="interval"></view>
  14. <view class="buttom">
  15. <view class="money">{{totalLevel || 0}}</view>
  16. <text class="text">推荐医生</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="navbar">
  21. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  22. </view>
  23. <swiper :current="tabCurrentIndex" :style="{ height: maxheight + 'px' }" class="swiper-box" duration="300" @change="changeTab">
  24. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  25. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  26. <!-- 空白页 -->
  27. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  28. <!-- 订单列表 -->
  29. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
  30. <view class="title-box flex_item">
  31. <view class="title-avatar"><image :src="item.avatar"></image></view>
  32. <view class="list_tpl">
  33. <view class="title">
  34. <text>{{ item.nickname }}</text>
  35. </view>
  36. <view class="time">
  37. <text>{{ item.time }}</text>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  43. </scroll-view>
  44. </swiper-item>
  45. </swiper>
  46. </view>
  47. </template>
  48. <script>
  49. import { mapState, mapMutations } from 'vuex';
  50. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  51. import empty from '@/components/empty';
  52. export default {
  53. components: {
  54. empty,
  55. uniLoadMore,
  56. },
  57. onReady() {
  58. // 初始化获取页面宽度
  59. uni.createSelectorQuery()
  60. .select('.content')
  61. .fields(
  62. {
  63. size: true
  64. },
  65. data => {
  66. // console.log(data);
  67. // console.log(Math.floor((data.width / 750) * 300));
  68. // 保存头部高度
  69. this.maxheight = data.height - Math.floor((data.width / 750) * 570);
  70. // console.log(this.maxheight);
  71. }
  72. )
  73. .exec();
  74. },
  75. data() {
  76. return {
  77. // 头部图高度
  78. maxheight: '',
  79. tabCurrentIndex: 0,
  80. navList: [
  81. {
  82. state: 0,
  83. text: '用户',
  84. loadingType: 'more',
  85. orderList: [],
  86. page: 1, //当前页数
  87. limit: 10 //每次信息条数
  88. },
  89. {
  90. state: 1,
  91. text: '医生',
  92. loadingType: 'more',
  93. orderList: [],
  94. page: 1, //当前页数
  95. limit: 10 //每次信息条数
  96. }
  97. ],
  98. all: 0,
  99. list:'',
  100. total:'',
  101. totalLevel:'',
  102. };
  103. },
  104. onLoad(options) {},
  105. onShow() {
  106. // this.loadData();
  107. },
  108. methods: {
  109. // 页面跳转
  110. navto(e) {
  111. uni.navigateTo({
  112. url: e
  113. });
  114. },
  115. //swiper 切换
  116. changeTab(e) {
  117. this.tabCurrentIndex = e.target.current;
  118. // this.loadData('tabChange');
  119. },
  120. //顶部tab点击
  121. tabClick(index) {
  122. this.tabCurrentIndex = index;
  123. }
  124. }
  125. };
  126. </script>
  127. <style lang="scss">
  128. page {
  129. // background: #ffffff;
  130. height: 100%;
  131. }
  132. .content-money {
  133. padding-bottom: 30rpx;
  134. background: $page-color-base;
  135. .buttom-box {
  136. background-color: #ffffff;
  137. text-align: center;
  138. margin: 0 30rpx;
  139. padding: 30rpx 0;
  140. border-radius: $border-radius-sm;
  141. margin-top: -60rpx;
  142. .buttom {
  143. font-size: $font-lg;
  144. flex-grow: 1;
  145. .money{
  146. font-weight: bold;
  147. font-size: 32rpx;
  148. color: $font-color;
  149. }
  150. }
  151. .text {
  152. color: #666666;
  153. }
  154. .interval {
  155. width: 2rpx;
  156. height: 60rpx;
  157. background-color: #eeeeee;
  158. }
  159. .icon {
  160. height: 50rpx;
  161. width: 48rpx;
  162. margin: 0 auto;
  163. .icon-img {
  164. width: 100%;
  165. height: 100%;
  166. }
  167. }
  168. }
  169. }
  170. .money-box {
  171. background:linear-gradient(52deg,rgba(126,153,254,1),rgba(151,143,250,1));
  172. height: 320rpx;
  173. color: #ffffff;
  174. text-align: center;
  175. padding-top: 60rpx;
  176. .money_name{
  177. width: 100%;
  178. text-align: center;
  179. font-size: 36rpx;
  180. padding-bottom: 25rpx;
  181. }
  182. .money {
  183. font-size: 44rpx;
  184. }
  185. }
  186. .navbar {
  187. display: flex;
  188. height: 40px;
  189. padding: 0 5px;
  190. background: #fff;
  191. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  192. position: relative;
  193. z-index: 10;
  194. .nav-item {
  195. flex: 1;
  196. display: flex;
  197. justify-content: center;
  198. align-items: center;
  199. height: 100%;
  200. font-size: 15px;
  201. color: $font-color-dark;
  202. position: relative;
  203. &.current {
  204. color: $font-color;
  205. &:after {
  206. content: '';
  207. position: absolute;
  208. left: 50%;
  209. bottom: 0;
  210. transform: translateX(-50%);
  211. width: 44px;
  212. height: 0;
  213. border-bottom: 2px solid $font-color;
  214. }
  215. }
  216. }
  217. }
  218. // 列表
  219. .swiper-box {
  220. padding-top: 10rpx;
  221. background: #ffffff;
  222. .order-item {
  223. margin: 0 24rpx;
  224. padding: 20rpx 0;
  225. line-height: 1.5;
  226. border-bottom: 1px solid #F0F0F0;
  227. .title-box {
  228. width: 100%;
  229. .title-avatar{
  230. width:80rpx;
  231. height:80rpx;
  232. border-radius:50%;
  233. margin-right: 20rpx;
  234. image{
  235. width: 100%;
  236. height: 100%;
  237. border-radius: 100%;
  238. }
  239. }
  240. .list_tpl{
  241. width: 85%;
  242. .title {
  243. font-size: $font-base + 2rpx;
  244. color: $font-color-base;
  245. font-weight: 500;
  246. overflow:hidden; //超出的文本隐藏
  247. text-overflow:ellipsis; //溢出用省略号显示
  248. white-space:nowrap;
  249. }
  250. .time {
  251. font-size: 22rpx;
  252. color: $font-color-light;
  253. }
  254. }
  255. }
  256. }
  257. }
  258. .list-scroll-content {
  259. height: 100%;
  260. }
  261. .content {
  262. height: 100%;
  263. .empty-content {
  264. background-color: #ffffff;
  265. }
  266. }
  267. </style>