index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="income-main">
  3. <view class="income-header card-box">
  4. <text class="income-title" @click="onShows">
  5. {{ dataYMD }}
  6. </text>
  7. <view class="income-header-right">
  8. <text>收入: ¥{{ data.totalEarning }}</text>
  9. <text class="income-header-right-right">支出: ¥{{ data.totalExpend }}</text>
  10. </view>
  11. </view>
  12. <view v-if="data.clientAccountChangeVOlist && data.clientAccountChangeVOlist.length > 0">
  13. <view class="card-box icome-item" v-for="item in data.clientAccountChangeVOlist" :key="item.code" @click="onClick(item)">
  14. <view class="card-left">
  15. <!-- <img :src="baseUrl" alt="" class="income-img"> -->
  16. <view class="card-left-text">
  17. <view class="card-left-name">
  18. <dict-tag :options="jlzj_client_source_type" :value="item.sourceType" />
  19. ({{ item.businessTierName }})
  20. </view>
  21. <view class="card-left-date">{{ item.createTime }}</view>
  22. </view>
  23. </view>
  24. <view class="card-rigth"
  25. :style="{ color: item.changeType === '1' ? 'rgba(76, 175, 80, 1)' : 'rgba(244, 67, 54, 1)' }">
  26. {{ item.changeType === '1' ? '+' : '-' }}{{ item.changeMoney }}
  27. </view>
  28. </view>
  29. </view>
  30. <view v-else>
  31. <NoneView value="您还没有相关账单" />
  32. </view>
  33. <up-datetime-picker :show="show" v-model="datetime" mode="date" ref="uPickerRef" @confirm="confirm"
  34. @cancel="cancel"></up-datetime-picker>
  35. </view>
  36. </template>
  37. <script setup>
  38. import { ref, computed } from 'vue'
  39. import { getAccountChangeList } from "@/api/mine";
  40. import {
  41. onShow
  42. } from '@dcloudio/uni-app';
  43. import config from '@/config'
  44. import DictTag from '@/components/DictTag/index.vue'
  45. import {
  46. useDict
  47. } from '@/utils/dict.js';
  48. import dayjs from 'dayjs/esm/index'
  49. import NoneView from '@/components/NoneView/index.vue'
  50. const {
  51. jlzj_money_change_type,
  52. jlzj_client_source_type
  53. } = useDict('jlzj_money_change_type', 'jlzj_client_source_type');
  54. const baseUrl = config.baseUrl
  55. const userType = uni.getStorageSync('userType') //读取本地存储
  56. const data = ref({
  57. totalEarning: 0,
  58. totalExpend: 0,
  59. clientAccountChangeVOlist: []
  60. })
  61. const show = ref(false);
  62. const datetime = ref(Date.now());
  63. const dataYMD = computed(() => {
  64. return dayjs(datetime.value).format("YYYY年MM月DD日")
  65. })
  66. const uPickerRef = ref(null)
  67. const onShows = () => {
  68. show.value = true;
  69. };
  70. const confirm = () => {
  71. console.log('confirm', datetime.value);
  72. show.value = false;
  73. init();
  74. };
  75. const cancel = () => {
  76. show.value = false;
  77. };
  78. const onClick = (record) =>{
  79. record.mainOrderId && uni.navigateTo({
  80. url: `/pages_classify/pages/orderItem/orderdetails?mainOrderId=${record.mainOrderId}`
  81. });
  82. }
  83. const init = async () => {
  84. try {
  85. uni.showLoading({
  86. title: '数据加载中...'
  87. });
  88. if (userType === 2) {
  89. // const res = await getVolunteerAccountInfo();
  90. // data.value =res.data;
  91. }
  92. if (userType === 1) {
  93. const res = await getAccountChangeList({
  94. createTime: dayjs(datetime.value).format('YYYY-MM-DD')
  95. });
  96. console.log(1, res);
  97. res.data && (data.value = res.data);
  98. }
  99. } catch (error) {
  100. console.log('error', error);
  101. uni.showToast({
  102. title: error.msg,
  103. icon: 'error',
  104. });
  105. } finally {
  106. uni.hideLoading();
  107. }
  108. }
  109. onShow(() => {
  110. init();
  111. })
  112. </script>
  113. <style lang="scss" scoped>
  114. .card-box {
  115. border-radius: 8px;
  116. background: rgba(255, 255, 255, 1);
  117. padding: 12px;
  118. margin-bottom: 12px;
  119. }
  120. .income-main {
  121. position: fixed;
  122. top: 0px;
  123. left: 0px;
  124. right: 0px;
  125. bottom: 0px;
  126. background: rgba(245, 245, 245, 1);
  127. padding: 12px;
  128. overflow: auto;
  129. .income-title {
  130. font-size: 16px;
  131. font-weight: 500;
  132. line-height: 23.17px;
  133. color: rgba(0, 0, 0, 1);
  134. }
  135. .income-header {
  136. display: flex;
  137. align-items: center;
  138. justify-content: space-between;
  139. .income-header-right {
  140. font-size: 14px;
  141. font-weight: 500;
  142. line-height: 20.27px;
  143. color: rgba(0, 0, 0, 1);
  144. display: flex;
  145. align-items: flex-start;
  146. justify-content: center;
  147. .income-header-right-right {
  148. margin-left: 8rpx;
  149. }
  150. }
  151. }
  152. }
  153. .icome-item {
  154. display: flex;
  155. align-items: center;
  156. justify-content: space-between;
  157. .card-left {
  158. display: flex;
  159. align-items: center;
  160. .income-img {
  161. width: 40px;
  162. height: 40px;
  163. }
  164. .card-left-text {
  165. margin-left: 12px;
  166. .card-left-name {
  167. font-size: 16px;
  168. font-weight: 700;
  169. line-height: 23.17px;
  170. color: rgba(0, 0, 0, 1);
  171. margin-bottom: 6px;
  172. display: flex;
  173. align-items: center;
  174. }
  175. .card-left-date {
  176. font-size: 14px;
  177. font-weight: 500;
  178. line-height: 16.41px;
  179. color: rgba(153, 153, 153, 1);
  180. }
  181. }
  182. .card-rigth {
  183. font-size: 20px;
  184. font-weight: 700;
  185. line-height: 23.44px;
  186. color: rgba(51, 51, 51, 1);
  187. }
  188. }
  189. }
  190. </style>