incomeExpenseRecord.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <view class="page">
  3. <u-sticky zIndex="999" offsetTop="0">
  4. <view class="headerFilter dis ">
  5. <view class="FilterItem dis a-c j-c " @click="dateShow=true">
  6. <text>{{ info.month || (info.createTimeStart && info.createTimeEnd ? `${info.createTimeStart}-${info.createTimeEnd}` : '时间') }}</text>
  7. <view class="tag"></view>
  8. </view>
  9. <view class="FilterItem dis a-c j-c ml-4" @click="incomeExpenseShow=true">
  10. <text>{{ info.incomeAndExpense == '0' ? '收入' : info.incomeAndExpense == '1' ? '支出' : '全部' }}</text>
  11. <view class="tag"></view>
  12. </view>
  13. <view class="FilterItem dis a-c j-c ml-4" @click="statusShow=true">
  14. <text>{{ info.status == '0' ? '待审核' : info.status == '1' ? '审核通过' : info.status == '2' ? '审核驳回' : '状态' }}</text>
  15. <view class="tag"></view>
  16. </view>
  17. </view>
  18. </u-sticky>
  19. <view class="incomeExpenseView">
  20. <!-- 月份数据 -->
  21. <view class="monthlyData" v-for="(item,index) in transactionList" :key="index">
  22. <!-- 吸顶占位块 -->
  23. <u-sticky offsetTop="38">
  24. <view class="placeholderBlock"></view>
  25. </u-sticky>
  26. <u-sticky offsetTop="48">
  27. <!-- 头部汇总数据 -->
  28. <view class="header-summary dis f-c a-start">
  29. <text class=" month textSizeView">{{item.incomeAndExpense.month}}</text>
  30. <view class="dis a-c j-s mt-1">
  31. <view class="formula dis f-c ">
  32. <text class="textSizeView">{{item.incomeAndExpense.balance}}</text>
  33. <text>余额</text>
  34. </view>
  35. <text class="textSizeView">=</text>
  36. <view class="formula dis f-c">
  37. <text class="textSizeView">{{item.incomeAndExpense.income}}</text>
  38. <text>收入</text>
  39. </view>
  40. <text class="textSizeView">-</text>
  41. <view class="formula dis f-c">
  42. <text class="textSizeView">{{item.incomeAndExpense.expense}}</text>
  43. <text>支出</text>
  44. </view>
  45. </view>
  46. </view>
  47. </u-sticky>
  48. <!-- 数据明细列表 -->
  49. <view class="data-details">
  50. <view class="item" v-for="(orderItem,orderIndex) in item.incomeAndExpenseList" :key="orderIndex"
  51. @click="billDetails(orderItem)">
  52. <view class="top dis a-c j-s ">
  53. <view class=" dis a-c ">
  54. <text>{{orderItem.remark}}</text>
  55. <text v-if="orderItem.licenseNo">({{orderItem.licenseNo}})</text>
  56. </view>
  57. <text
  58. class="font-weight">{{orderItem.incomeAndExpense=='1'?'-':'+'}}{{orderItem.amount}}</text>
  59. </view>
  60. <view class="bottom dis a-c ">
  61. <image class="icon-image" src="/static/image/my/wallet-icon1.png" mode=""></image>
  62. <text class="time">{{orderItem.createTime}}</text>
  63. <view class="status" :style="gradeText(orderItem.status)" v-if="orderItem.status">
  64. {{orderItem.status==0?'待审核':orderItem.status==1?'审核通过':'审核不通过'}}
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <!-- 日期组件 -->
  72. <uni-datePicker :show="dateShow" @close="dateShow=false" @customTime="customTime"
  73. @customMonth="customMonthchange" @tabClick="tabClick"></uni-datePicker>
  74. <!-- 筛选组件 -->
  75. <uni-Popup :show="incomeExpenseShow" @close='incomeExpenseShow=false' headerTitle="收支类型"
  76. :statusList="quickOptions" contentType="status" @statusConfirm='incomeExpenseConfirm'>
  77. </uni-Popup>
  78. <uni-Popup :show="statusShow" @close='statusShow=false' headerTitle="状态" :statusList="quickOptions1"
  79. contentType="status" @statusConfirm='statusShowConfirm'>
  80. </uni-Popup>
  81. </view>
  82. </template>
  83. <script>
  84. export default {
  85. data() {
  86. return {
  87. incomeExpenseShow: false, //筛选组件
  88. statusShow: false,
  89. quickOptions: [{
  90. label: "全部",
  91. value: " ",
  92. }, {
  93. label: "收入",
  94. value: "0",
  95. },
  96. {
  97. label: "支出",
  98. value: "1",
  99. }
  100. ], //快捷选项
  101. quickOptions1: [{
  102. label: "全部",
  103. value: " ",
  104. },
  105. {
  106. label: "待审核",
  107. value: "0",
  108. },
  109. {
  110. label: "审核通过",
  111. value: "1",
  112. },
  113. {
  114. label: "审核驳回",
  115. value: "2",
  116. }
  117. ], //快捷选项
  118. dateShow: false, //日期组件
  119. gradeMap: [{
  120. status: 0,
  121. style: {
  122. background: '#FFFCDF',
  123. color: "#FFC32B",
  124. }
  125. },
  126. {
  127. status: 1,
  128. style: {
  129. background: '#E3FBE7',
  130. color: "#18B63B",
  131. }
  132. },
  133. {
  134. status: 2,
  135. style: {
  136. background: '#FFECEC',
  137. color: "#F74141",
  138. }
  139. }
  140. ],
  141. info: {
  142. month: "",
  143. status: "",
  144. createTimeStart: "",
  145. createTimeEnd: "",
  146. incomeAndExpense: "",
  147. },
  148. transactionList: [], //收支记录
  149. }
  150. },
  151. onShow() {
  152. this.transactionRecord();
  153. },
  154. onLoad() {},
  155. methods: {
  156. //收支记录
  157. async transactionRecord() {
  158. let res = await this.$http.post("/userAccount/getIncomeAndExpense", this.info)
  159. if (res.code == 200) {
  160. this.transactionList = res.data;
  161. // this.transactionList.push(...res.data);
  162. } else {
  163. uni.showToast({
  164. icon: 'none',
  165. title: res.msg,
  166. });
  167. }
  168. },
  169. //账单详情
  170. billDetails(item) {
  171. uni.navigateTo({
  172. url: `/pages/wallet/billDetails?info=${JSON.stringify(item)}`
  173. })
  174. },
  175. //类型筛选回调
  176. incomeExpenseConfirm(e) {
  177. console.log(e)
  178. this.info.incomeAndExpense = e;
  179. this.incomeExpenseShow = false;
  180. this.transactionRecord();
  181. },
  182. //状态筛选回调
  183. statusShowConfirm(e) {
  184. this.info.status = e;
  185. this.statusShow = false;
  186. this.transactionRecord();
  187. },
  188. //颜色匹配
  189. gradeText(status) {
  190. let info = this.gradeMap.find(val => val.status == status);
  191. return info?.style || {}
  192. },
  193. //日期月份回调
  194. customMonthchange(Month) {
  195. console.log(Month);
  196. this.info.month = Month;
  197. this.dateShow = false;
  198. this.transactionRecord();
  199. },
  200. //日期自定义时间回调
  201. customTime(start, end) {
  202. console.log(start, end);
  203. this.info.createTimeStart = start;
  204. this.info.createTimeEnd = end;
  205. this.dateShow = false;
  206. this.transactionRecord();
  207. },
  208. tabClick(name) {
  209. console.log(name);
  210. if (name == '选择月份') {
  211. this.info.createTimeStart = "";
  212. this.info.createTimeEnd = "";
  213. } else {
  214. this.info.month = "";
  215. }
  216. }
  217. }
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. .page {
  222. background-color: #f8f8f8;
  223. }
  224. /* 头部下拉筛选 */
  225. .headerFilter {
  226. background: #fff;
  227. border-top: 1rpx solid #eee;
  228. padding: 12rpx 30rpx;
  229. box-sizing: border-box;
  230. .FilterItem {
  231. font-size: 26rpx;
  232. color: #666;
  233. line-height: 2;
  234. /* 三角形 */
  235. .tag {
  236. width: 0;
  237. height: 0;
  238. border: 4px solid;
  239. border-color: #666666;
  240. border-bottom: 0 solid transparent;
  241. border-right: 3px solid transparent;
  242. border-left: 3px solid transparent;
  243. margin-left: 4rpx;
  244. }
  245. }
  246. }
  247. /* 月份数据 */
  248. .incomeExpenseView {
  249. padding: 0 20rpx 20rpx;
  250. box-sizing: border-box;
  251. .monthlyData {
  252. // 头部汇总
  253. .header-summary {
  254. background-image: url('../../static/image/my/wallet-bg2.png');
  255. background-size: 100% 100%;
  256. border-radius: 10rpx 10rpx 0rpx 0rpx;
  257. padding: 30rpx;
  258. box-sizing: border-box;
  259. backdrop-filter: blur(50rpx);
  260. >view {
  261. width: 100%;
  262. .formula {
  263. text:last-child {
  264. font-size: 24rpx;
  265. color: #666;
  266. }
  267. }
  268. }
  269. }
  270. .data-details {
  271. background-color: #fff;
  272. padding: 0 30rpx;
  273. box-sizing: border-box;
  274. .item {
  275. border-bottom: 1rpx solid #eee;
  276. padding: 30rpx 0;
  277. box-sizing: border-box;
  278. .top {
  279. font-size: 30rpx;
  280. color: #333;
  281. }
  282. .bottom {
  283. margin-top: 7rpx;
  284. .icon-image {
  285. width: 20rpx;
  286. height: 20rpx;
  287. }
  288. .time {
  289. margin-left: 5rpx;
  290. font-size: 20rpx;
  291. color: #999;
  292. }
  293. .status {
  294. background: #FFFCDF;
  295. color: #FFC32B;
  296. padding: 1rpx 10rpx;
  297. box-sizing: border-box;
  298. border-radius: 2rpx 2rpx 2rpx 2rpx;
  299. margin-left: auto;
  300. font-size: 20rpx;
  301. font-weight: bold;
  302. }
  303. }
  304. }
  305. .item:last-child {
  306. border-bottom: none;
  307. }
  308. }
  309. .textSizeView {
  310. font-size: 36rpx;
  311. color: #333;
  312. font-weight: bold;
  313. }
  314. }
  315. .monthlyData:first-child {
  316. margin-top: none;
  317. }
  318. }
  319. .placeholderBlock {
  320. background: #f8f8f8;
  321. width: 100%;
  322. height: 20rpx;
  323. }
  324. </style>