integralRecord.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <template>
  2. <view class="integralRecord">
  3. <!-- 分段器 -->
  4. <view class="segmented">
  5. <view class="tab_nav">
  6. <view class="navTitle" v-for="(item,index) in items" :key="index">
  7. <view :class="{'active':isActive == index}" @click="checked(index)">
  8. {{item}}
  9. </view>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="msg-null" v-if="incomeList.length == 0 && isActive == 0 ">
  14. <image src="https://t9.9026.com/imgs/dataNull.png" style="width: 394rpx;height: 396rpx;" mode=""></image>
  15. <view class="msg-null-text">
  16. <text>暂无数据</text>
  17. </view>
  18. </view>
  19. <!-- 收入 -->
  20. <view class="List" v-if="isActive == 0 && incomeList.length > 0 ">
  21. <view class="ListItem" v-for="(item,index) in incomeList" :key="index">
  22. <view style="display: flex; justify-content: space-between;">
  23. <view class="title"><text>{{item.change_integral}}积分</text> </view>
  24. <view class='data'><text>{{item.created_at}}</text></view>
  25. </view>
  26. <view class="content" v-if="item.type==1"><text>投票奖励获得</text></view>
  27. <view class="content" v-if="item.type==2"><text>抽奖奖励获得</text></view>
  28. </view>
  29. </view>
  30. <view class="msg-null" v-if="spendingList.length == 0 && isActive == 1 ">
  31. <image src="https://t9.9026.com/imgs/dataNull.png" style="width: 394rpx;height: 396rpx;" mode=""></image>
  32. <view class="msg-null-text">
  33. <text>暂无数据</text>
  34. </view>
  35. </view>
  36. <!-- 支出 -->
  37. <view class="List" :style="{'--height':ListHeight+'rpx'}" v-if="isActive == 1 && spendingList.length > 0" >
  38. <view class="ListItem" v-for="(item,index) in spendingList" :key="index" >
  39. <view style="display: flex; justify-content: space-between;">
  40. <view class="title"><text>{{item.change_integral}}积分</text> </view>
  41. <view class='data'><text>{{item.created_at}}</text></view>
  42. </view>
  43. <view class="content" v-if="item.type==3"><text>兑换商品消耗</text></view>
  44. <view class="content" v-if="item.type==4"><text>后台增加/减少</text></view>
  45. </view>
  46. </view>
  47. <!-- 已经到底啦 -->
  48. <view class="home-bottom" style="margin-top: 88rpx;padding-bottom: 60rpx;" v-if="isActive == 0 && incomeList.length > 0 ">
  49. <uni-load-more :status="status" color="#CCCCCC" :content-text="contentText"/>
  50. </view>
  51. <view class="home-bottom" style="margin-top: 88rpx;padding-bottom: 60rpx;" v-if="isActive == 1 && spendingList.length > 0 ">
  52. <uni-load-more :status="status" color="#CCCCCC" :content-text="contentText"/>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. export default{
  58. data(){
  59. return{
  60. // 分段器
  61. items: ['收入', '支出',],
  62. isActive: 0,
  63. // list高度
  64. ListHeight: 800,
  65. // 组件uni-load-more
  66. status: 'noMore',
  67. contentText: {
  68. contentdown: '查看更多',
  69. contentrefresh: '加载中',
  70. contentnomore: '—— 已经到底啦 ——'
  71. },
  72. // 收入列表
  73. incomeList:[],
  74. // 支出列表
  75. spendingList:[],
  76. }
  77. },
  78. onLoad() {
  79. // 收入
  80. this.getIntegralList(1)
  81. // 支出
  82. this.getIntegralList(2)
  83. },
  84. methods:{
  85. //菜单index切换
  86. checked(index) {
  87. this.isActive = index
  88. },
  89. // 获取积分日志
  90. getIntegralList(type){
  91. if(type==1){
  92. this.$api.integral.getIntegralLog({
  93. page:1,
  94. type:1
  95. }).then(res=>{
  96. console.log(res,'收入积分日志')
  97. if(res.code==0){
  98. this.incomeList=res.data.data
  99. }
  100. })
  101. } else if (type==2){
  102. this.$api.integral.getIntegralLog({
  103. page:1,
  104. type:2
  105. }).then(res=>{
  106. console.log(res,'支出积分日志')
  107. if(res.code==0){
  108. this.spendingList=res.data.data
  109. }
  110. })
  111. }else{
  112. uni.showToast({
  113. title:'请传入正确type值!',
  114. icon:'none'
  115. })
  116. }
  117. },
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. $pageColor:#F9F9F9;
  123. $bgColor:#FFFFFF;
  124. // flex布局居中对齐
  125. @mixin flexlayout {
  126. display: flex;
  127. align-items: center;
  128. justify-content: center;
  129. }
  130. .integralRecord{
  131. height: 100%;
  132. background: $pageColor;
  133. }
  134. .msg-null{
  135. padding-top: 60rpx;
  136. display: flex;
  137. flex-direction: column;
  138. align-items: center;
  139. justify-content: center;
  140. .msg-null-text{
  141. margin-top: 40rpx;
  142. font-size: 28rpx;
  143. color: #333;
  144. }
  145. }
  146. .segmented{
  147. height: 112rpx;
  148. width: 750rpx;
  149. background: $bgColor;
  150. box-shadow: 0px 4rpx 8rpx 0px rgba(0,0,0,0.04);
  151. border-radius: 0px 0px 16rpx 16rpx;
  152. //菜单切换
  153. .tab_nav {
  154. width: 690rpx;
  155. margin-left: 30rpx;
  156. padding:0 80rpx;
  157. display: flex;
  158. justify-content: space-between;
  159. align-items: center;
  160. font-family: PingFang-SC-Heavy, PingFang-SC;
  161. }
  162. .tab_nav .navTitle {
  163. @include flexlayout()
  164. margin-top: 20rpx;
  165. width: 128rpx;
  166. flex: none;
  167. height: 28rpx;
  168. font-size: 32rpx;
  169. color: #666;
  170. position: relative;
  171. }
  172. .active {
  173. color: #D9A94D;
  174. font-weight: bold;
  175. &::after {
  176. display: inline-block;
  177. content: '';
  178. width: 48rpx;
  179. height: 12rpx;
  180. background: linear-gradient(90deg, #F3D69F 0%, #D9A94D 100%);
  181. border-radius: 6px;
  182. position: absolute;
  183. bottom: -30rpx;
  184. left: 40rpx;
  185. }
  186. }
  187. }
  188. ::v-deep .segmented-control__text {
  189. font-size: 32rpx !important;
  190. font-family: PingFang-SC-Heavy, PingFang-SC;
  191. font-weight: 500 !important;
  192. color: #666666 !important;
  193. }
  194. ::v-deep .segmented-control__item--text {
  195. font-size: 32rpx;
  196. font-family: PingFang-SC-Heavy, PingFang-SC;
  197. font-weight: 800 !important;
  198. padding: 10rpx 0 !important;
  199. border-radius: 4rpx !important;
  200. color: #D9A94D !important;
  201. }
  202. .List {
  203. width: 750rpx;
  204. background: $bgColor;
  205. box-shadow: 0px 4rpx 24rpx -10rpx rgba(101, 95, 90, 0.3);
  206. border-radius: 12rpx;
  207. margin-top: 24rpx;
  208. padding: 0rpx 28rpx 0 32rpx;
  209. box-sizing: border-box;
  210. .ListItem {
  211. width: 690rpx;
  212. border-bottom: #F0F0F0 solid 0.5rpx;
  213. position: relative;
  214. padding-top: 40rpx;
  215. padding-bottom: 40rpx;
  216. box-sizing: border-box;
  217. &:first-child{
  218. padding-top: 48rpx;
  219. }
  220. &:last-child{
  221. border-bottom: none;
  222. }
  223. .title {
  224. margin-bottom: 10rpx;
  225. text {
  226. font-size: 32rpx;
  227. font-family: PingFang-SC-Bold, PingFang-SC;
  228. font-weight: bold;
  229. color: #333333;
  230. }
  231. }
  232. .data {
  233. text {
  234. font-size: 26rpx;
  235. font-family: PingFang-SC-Medium, PingFang-SC;
  236. font-weight: 500;
  237. color: #999999;
  238. }
  239. }
  240. .content {
  241. text {
  242. font-size: 28rpx;
  243. font-family: PingFang-SC-Medium, PingFang-SC;
  244. font-weight: 500;
  245. color: #333333;
  246. }
  247. }
  248. }
  249. // 消除最后一个下划线
  250. .ListItem:last-child {
  251. width: 690rpx;
  252. height: 160rpx;
  253. border-bottom: #F0F0F0 solid 0rpx;
  254. position: relative;
  255. padding-top: 35rpx;
  256. box-sizing: border-box;
  257. .title {
  258. margin-bottom: 10rpx;
  259. text {
  260. font-size: 32rpx;
  261. font-family: PingFang-SC-Bold, PingFang-SC;
  262. font-weight: bold;
  263. color: #333333;
  264. }
  265. }
  266. .data {
  267. text {
  268. font-size: 26rpx;
  269. font-family: PingFang-SC-Medium, PingFang-SC;
  270. font-weight: 500;
  271. color: #999999;
  272. }
  273. }
  274. .content {
  275. text {
  276. font-size: 28rpx;
  277. font-family: PingFang-SC-Medium, PingFang-SC;
  278. font-weight: 500;
  279. color: #333333;
  280. }
  281. }
  282. }
  283. }
  284. </style>