promotion.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <image src="../../static/img/promation.png" mode="" class="bg"></image>
  5. <view class="money-box">
  6. <view class="money">
  7. {{ all.all || 0 }}
  8. <text>{{$t('hea.ren')}}</text>
  9. </view>
  10. <view class="text">{{$t('hea.wdtgrs')}}</view>
  11. </view>
  12. </view>
  13. <view class="navbar flex">
  14. <view class="nav-item">
  15. <view class="num">{{ all.valid }}</view>
  16. <view class="font">{{$t('foo.jhrs')}}</view>
  17. </view>
  18. <view class="xian"></view>
  19. <view class="nav-item">
  20. <view class="num">{{ all.v2 }}</view>
  21. <view class="font">{{$t('foo.hzrs')}}</view>
  22. </view>
  23. </view>
  24. <view class="swiper-box" :style="{ height: height }">
  25. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData" :style="{ height: height }">
  26. <!-- 空白页 -->
  27. <!-- <empty v-if="list.length === 0"></empty> -->
  28. <!-- 订单列表 -->
  29. <view class="order-item flex" v-for="(item, index) in list" :key="index">
  30. <view class="title-box flex_item">
  31. <view class="title-avatar"><image :src="item.avatar || '/static/error/missing-face.png'"></image></view>
  32. <view class="list_tpl">
  33. <view class="title">
  34. <text>{{ item.mobile || item.email }}</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="loadingType"></uni-load-more>
  43. </scroll-view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import { spread_children,num } from '@/api/user.js';
  49. import { mapState, mapMutations } from 'vuex';
  50. import { getMoneyStyle, getTime } from '@/utils/rocessor.js';
  51. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  52. import empty from '@/components/empty';
  53. export default {
  54. components: {
  55. empty,
  56. uniLoadMore
  57. },
  58. onReady(res) {
  59. var obj = this;
  60. uni.getSystemInfo({
  61. success: resu => {
  62. const query = uni.createSelectorQuery();
  63. query.select('.swiper-box').boundingClientRect();
  64. query.exec(function(res) {
  65. console.log(res, 'ddddddddddddd');
  66. obj.height = resu.windowHeight - res[0].top + 'px';
  67. console.log('打印页面的剩余高度', obj.height);
  68. });
  69. },
  70. fail: res => {}
  71. });
  72. },
  73. data() {
  74. return {
  75. // 头部图高度
  76. height: '',
  77. tabCurrentIndex: 0,
  78. all: '',
  79. list: [],
  80. loadingType: 'more',
  81. limit: 10,
  82. page: 1,
  83. id: ''
  84. };
  85. },
  86. onShow() {
  87. uni.setNavigationBarTitle({
  88. title:this.$t('foo.wdtg')
  89. })
  90. this.id = this.userInfo.id;
  91. num().then(({data}) =>{
  92. console.log(data)
  93. this.all = data
  94. })
  95. this.loadData();
  96. },
  97. computed: {
  98. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  99. },
  100. methods: {
  101. loadData() {
  102. const obj = this;
  103. if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  104. return;
  105. }
  106. obj.loadingType == 'loading';
  107. spread_children({ limit: obj.limit, page: obj.page }, obj.id).then(({ data }) => {
  108. data.forEach(e => {
  109. e.time = getTime(e.createtime);
  110. });
  111. console.log(data,'123456');
  112. obj.list = obj.list.concat(data);
  113. // obj.list = data
  114. obj.page++;
  115. if (data.length == obj.limit) {
  116. obj.loadingType = 'more';
  117. return
  118. } else {
  119. obj.loadingType = 'noMore';
  120. }
  121. });
  122. },
  123. navto(e) {
  124. uni.navigateTo({
  125. url: e
  126. });
  127. }
  128. }
  129. };
  130. </script>
  131. <style lang="scss">
  132. page {
  133. background: #000;
  134. height: 100%;
  135. }
  136. .content-money {
  137. height: 480rpx;
  138. padding-bottom: 30rpx;
  139. background: $page-color-base;
  140. position: relative;
  141. .bg {
  142. position: absolute;
  143. width: 100%;
  144. }
  145. .moneyTx {
  146. position: absolute;
  147. top: 150rpx;
  148. right: 0rpx;
  149. width: 150rpx;
  150. padding: 10rpx 30rpx;
  151. border: 2px solid #ffffff;
  152. border-top-left-radius: 99rpx;
  153. border-bottom-left-radius: 99rpx;
  154. color: #ffffff;
  155. line-height: 1;
  156. font-size: $font-base;
  157. }
  158. .buttom-box {
  159. background-color: #ffffff;
  160. text-align: center;
  161. margin: 0 30rpx;
  162. padding: 20rpx 0;
  163. border-radius: $border-radius-sm;
  164. margin-top: -60rpx;
  165. .buttom {
  166. font-size: $font-lg;
  167. flex-grow: 1;
  168. }
  169. .interval {
  170. width: 2px;
  171. height: 60rpx;
  172. background-color: #eeeeee;
  173. }
  174. .icon {
  175. height: 50rpx;
  176. width: 48rpx;
  177. margin: 0 auto;
  178. .icon-img {
  179. width: 100%;
  180. height: 100%;
  181. }
  182. }
  183. }
  184. }
  185. .money-box {
  186. // background-color: $base-color;
  187. padding-top: var(--status-bar-height);
  188. height: 368rpx;
  189. color: #fad6b0;
  190. text-align: center;
  191. position: relative;
  192. .text {
  193. font-size: $font-sm;
  194. }
  195. .money {
  196. padding-top: 147rpx;
  197. font-size: 47px;
  198. font-family: PingFang SC;
  199. font-weight: bold;
  200. text {
  201. font-size: 24px;
  202. }
  203. }
  204. }
  205. .navbar {
  206. width: 702rpx;
  207. height: auto;
  208. padding: 20rpx 0;
  209. background: linear-gradient(90deg, #393326, #27221d);
  210. border: 2rpx solid #f5d2ad;
  211. border-radius: 10rpx;
  212. position: relative;
  213. z-index: 10;
  214. margin: 0 auto;
  215. .xian {
  216. width: 2rpx;
  217. height: 54rpx;
  218. background: #eeeeee;
  219. }
  220. .nav-item {
  221. display: flex;
  222. flex-direction: column;
  223. justify-content: center;
  224. align-items: center;
  225. height: 100%;
  226. font-size: 15px;
  227. color: #fff;
  228. position: relative;
  229. width: 50%;
  230. .num {
  231. font-size: 32rpx;
  232. font-family: PingFang SC;
  233. font-weight: bold;
  234. color: #fad6b0;
  235. }
  236. .font {
  237. font-size: 28rpx;
  238. font-family: PingFang SC;
  239. font-weight: 500;
  240. color: #ffffff;
  241. }
  242. }
  243. }
  244. //列表
  245. .swiper-box {
  246. margin-top: 20rpx;
  247. .order-item {
  248. padding: 20rpx 30rpx;
  249. line-height: 1.5;
  250. .title-box {
  251. width: 100%;
  252. .title-avatar {
  253. width: 100rpx;
  254. height: 100rpx;
  255. margin-right: 25rpx;
  256. border-radius: 100%;
  257. image {
  258. width: 100%;
  259. height: 100%;
  260. border-radius: 100%;
  261. }
  262. }
  263. .list_tpl {
  264. width: 85%;
  265. .title {
  266. font-size: $font-lg;
  267. color: $font-color-base;
  268. overflow: hidden; //超出的文本隐藏
  269. text-overflow: ellipsis; //溢出用省略号显示
  270. white-space: nowrap;
  271. }
  272. .time {
  273. font-size: $font-base;
  274. color: $font-color-light;
  275. }
  276. }
  277. }
  278. .money {
  279. color: #db1935;
  280. font-size: $font-lg;
  281. }
  282. }
  283. }
  284. .content {
  285. height: 100%;
  286. .empty-content {
  287. background-color: #000;
  288. }
  289. }
  290. </style>