incomeTpl.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <view class="container" style="padding-top: 100rpx;">
  3. <topView :backg="'#1A1A17'"></topView>
  4. <view class="infoBox">
  5. <view class="navBack" @click="navTo">
  6. <u-icon name="arrow-left" size="25" color="#fff" style="position: absolute;left: 0;top: 0;font-weight: bold;"></u-icon>
  7. <view class="title">{{$t("incomeTpl.收支明细")}}</view>
  8. </view>
  9. <view class="navBox">
  10. <view class="navList flex_item">
  11. <view class="navItem" v-for="item,index in navList" :key="index" @click="clickTab(index)">
  12. <view class="navName" :class="{ active: currTab == index }">{{item}}</view>
  13. <image v-if="currTab == index" src="/static/img/img28.png" class="navTip"></image>
  14. </view>
  15. </view>
  16. <!-- <view class="moneyDay flex_item" @click="clcikDate">
  17. <view class="dayValue"><text>{{monthValue}}</text>月</view>
  18. <u-icon v-if="up" name="arrow-up-fill" color="#fff" size="14" style="position: relative;top: 10rpx;"></u-icon>
  19. <u-icon v-if="!up" name="arrow-down-fill" color="#fff" size="14" style="position: relative;top: 10rpx;"></u-icon>
  20. </view> -->
  21. </view>
  22. <view class="listBox">
  23. <view class="flex tipBox">
  24. <view class="tipText"><!-- 2024年05月 --></view>
  25. <view class="tipText">{{currTab==0?$t("incomeTpl.流水"):currTab==1?$t("incomeTpl.收入"):$t("incomeTpl.支出")}}:{{info.sum}}NICE<!-- <text style="padding-left: 15rpx;">支出:2000</text> --></view>
  26. </view>
  27. <view class="listTpl flex" v-for="item,index in list" :key="index">
  28. <view class="tpl">
  29. <view class="name">{{typeList[item.type]}}</view>
  30. <view class="time">{{item.createtime }}</view>
  31. </view>
  32. <view class="nomBox">
  33. <view class="num add" v-if="item.pm == 1">+{{item.money * 1}}</view>
  34. <view class="num" v-else>-{{item.money * 1}}</view>
  35. <view class="numText">{{$t("incomeTpl.余额")}}:{{item.after * 1}}</view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <u-datetime-picker :show="dateShow" v-model="dayValue" mode="year-month" @confirm="confirm"></u-datetime-picker>
  41. </view>
  42. </template>
  43. <script>
  44. import topView from '../components/topView.vue';
  45. import { getUserInfo } from '@/api/login.js';
  46. import {getTokenLog} from "@/api/index.js";
  47. import{ getTime } from '@/utils/rocessor.js';
  48. export default {
  49. components: {
  50. topView
  51. },
  52. data () {
  53. return {
  54. list:[],
  55. navList:[this.$t("incomeTpl.全部"),this.$t("incomeTpl.收入"),this.$t("incomeTpl.支出")],
  56. currTab:0,
  57. up:false,
  58. dateShow:false,
  59. monthValue:'',
  60. yearValue:'',
  61. dayValue:Number(new Date()),
  62. info:''
  63. }
  64. },
  65. onShow () {
  66. const date = new Date();
  67. this.yearValue = date.getFullYear();
  68. this.monthValue = date.getMonth() + 1;
  69. this.loadData();
  70. },
  71. methods: {
  72. clcikDate(){
  73. this.up = !this.up
  74. if(this.up){
  75. this.dateShow = true
  76. }
  77. },
  78. confirm(e){
  79. let data = e.value
  80. let dateValue = new Date(data); // 将时间戳转换为Date对象
  81. this.yearValue = dateValue.getFullYear(); // 获取年份
  82. this.monthValue = dateValue.getMonth() + 1; // 获取月份,需要加1因为从0开始计数
  83. //return year + '-' + month.toString().padStart(2, '0'); // 返回格式化的年-月字符串
  84. console.log(this.yearValue,this.monthValue,'888')
  85. this.dateShow = false
  86. this.up = false
  87. },
  88. clickTab(index){
  89. this.currTab = index
  90. this.loadData()
  91. },
  92. loadData () {
  93. let obj = this;
  94. let pm = ''
  95. if(obj.currTab == 0){
  96. pm = ''
  97. }else if(obj.currTab == 1){
  98. pm = 1
  99. }else{
  100. pm = 0
  101. }
  102. getTokenLog({
  103. page:1,
  104. limit:100000,
  105. token:'NICE',
  106. pm:pm
  107. }).then(function(res){
  108. obj.info = res.data
  109. res.data.list.forEach(item => {
  110. item.createtime = getTime(item.createtime)
  111. })
  112. obj.list = res.data.list
  113. obj.typeList = res.data.type
  114. });
  115. },
  116. // change(currentPage,type) {
  117. // this.page.currentPage = currentPage;
  118. // this.loadData()
  119. // },
  120. navTo(){
  121. uni.navigateTo({
  122. url:'/pages/index/income'
  123. })
  124. },
  125. },
  126. }
  127. </script>
  128. <style lang="scss">
  129. page {
  130. width: 100%;
  131. min-height: 100vh;
  132. .container {
  133. width: 100%;
  134. min-height: 100vh;
  135. padding-bottom: 25rpx;
  136. }
  137. }
  138. .infoBox{
  139. padding: 0rpx 25rpx;
  140. color: #fff;
  141. }
  142. .listBox{
  143. margin-top: 25rpx;
  144. background: #1A1A17;
  145. padding: 0rpx 25rpx;
  146. border-radius: 30rpx;
  147. .tipBox{
  148. .tipText{
  149. font-weight: 500;
  150. font-size: 22rpx;
  151. padding-top: 36rpx;
  152. padding-bottom: 20rpx;
  153. color: #999999;
  154. }
  155. }
  156. .listTpl{
  157. padding: 30rpx 0rpx;
  158. // border-bottom: 1rpx solid rgba(240, 240, 240, 0.3);
  159. .tpl{
  160. .addr{
  161. }
  162. .time{
  163. font-weight: 500;
  164. font-size: 22rpx;
  165. padding-top: 15rpx;
  166. color: #999999;
  167. }
  168. }
  169. .nomBox{
  170. text-align: right;
  171. .num{
  172. font-weight: 400;
  173. font-size: 36rpx;
  174. color: #fff;
  175. }
  176. .add{
  177. color: #4C5D97;
  178. background: linear-gradient(258deg, #FFF0CF 0%, #CBA16B 30.0048828125%, #FCE9CF 67.67578125%, #C29963 100%);
  179. -webkit-background-clip: text;
  180. -webkit-text-fill-color: transparent;
  181. }
  182. .numText{
  183. font-weight: 500;
  184. font-size: 22rpx;
  185. padding-top: 15rpx;
  186. color: #999999;
  187. }
  188. }
  189. }
  190. .listTpl:last-child{
  191. border-bottom: none !important;
  192. }
  193. }
  194. .navList{
  195. padding: 15rpx 0rpx 40rpx 25rpx;
  196. .navItem{
  197. width: 150rpx;
  198. position: relative;
  199. text-align: center;
  200. .navName{
  201. font-weight: bold;
  202. font-size: 32rpx;
  203. color: #FFFFFF;
  204. }
  205. .active{
  206. background: linear-gradient(258deg, #FFF0CF 0%, #CBA16B 30.0048828125%, #FCE9CF 67.67578125%, #C29963 100%);
  207. -webkit-background-clip: text;
  208. -webkit-text-fill-color: transparent;
  209. }
  210. .navTip{
  211. position: absolute;
  212. top: 45rpx;
  213. left: 50rpx;
  214. width: 45rpx;
  215. height: 11rpx;
  216. }
  217. }
  218. }
  219. .dayValue{
  220. font-family: PingFang SC;
  221. font-weight: bold;
  222. font-size: 31rpx;
  223. color: #fff;
  224. margin-right: 15rpx;
  225. text{
  226. font-size: 54rpx;
  227. }
  228. }
  229. .navBack{
  230. position: relative;
  231. color: #fff;
  232. text-align: center;
  233. margin: 30rpx 0rpx 40rpx 0rpx;
  234. .title{
  235. font-weight: bold;
  236. font-size: 34rpx;
  237. }
  238. }
  239. </style>