finance.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <view class="center">
  3. <view class="top">
  4. <picker mode="date" :value="now_date" @change="bindDateChange" :fields="'month'" :end="date">
  5. <view class="uni-input choose-time">{{ now_date }} ></view>
  6. </picker>
  7. <view class="top-card">
  8. <view class="card-tit">
  9. <view class="tit-point"></view>
  10. 营业额总览
  11. </view>
  12. <view class="card-icon"><image src="../../../static/icon/moneyget.png" mode=""></image></view>
  13. <view class="now-tit">本月营业额</view>
  14. <view class="now-money">{{ month_momey }}</view>
  15. <view class="card-btm flex">
  16. <view class="card-info flex">
  17. <image src="../../../static/icon/dayget.png" mode=""></image>
  18. <view class="info-wrap">
  19. <view class="info-tit">已提现</view>
  20. <view class="info-val">{{ today_momey || 0 }}</view>
  21. </view>
  22. </view>
  23. <view class="card-info flex" @click="navTo('/user/page/merchant/withdrawal')">
  24. <image src="../../../static/icon/daydd.png" mode=""></image>
  25. <view class="info-wrap">
  26. <view class="info-tit">余额</view>
  27. <view class="info-val">¥{{ today_count }}</view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="mid-tit flex">
  34. <view class="mid-left flex">
  35. <!-- <image src="../../static/icon/time.png" mode=""></image> -->
  36. <view class="left-tit">资金记录</view>
  37. </view>
  38. <view class="mid-right">{{ month_count }}笔</view>
  39. </view>
  40. <view class="btm-tab">
  41. <view class="tab-tit flex">
  42. <view class="tab-top-left tab-content">订单类型</view>
  43. <view class="tab-top-center tab-content">时间</view>
  44. <view class="tab-top-right tab-content">金额</view>
  45. </view>
  46. <scroll-view scroll-y="true" class="list-wrapper" :style="{ height: height }">
  47. <!-- 空白页 -->
  48. <empty v-if="loaded && monthList.length == 0"></empty>
  49. <view v-for="item in monthList" class="flex list" :key="item.time">
  50. <view class="tab-top-left tab-content ">
  51. <text v-if="item.pm" style="color: red;">收入</text>
  52. <txet v-else>支出</txet>
  53. </view>
  54. <view class="tab-top-center tab-content">{{getTimes(item.add_time)}}</view>
  55. <view class="tab-top-right tab-content money">¥{{ item.number || 0 }}</view>
  56. </view>
  57. <uni-load-more :status="loadingType" v-if="loadingType == 'loading'"></uni-load-more>
  58. </scroll-view>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import { shop_data } from '@/api/merchant.js';
  64. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  65. import empty from '@/components/empty';
  66. export default {
  67. components: {
  68. empty,
  69. uniLoadMore
  70. },
  71. data() {
  72. let start = new Date(new Date().toLocaleDateString()).getTime();
  73. let a = new Date();
  74. let month = a.getMonth() + 1;
  75. let year = a.getFullYear() + '';
  76. if (month < 10) {
  77. month = '0' + month;
  78. } else {
  79. month = month + '';
  80. }
  81. return {
  82. height: '',
  83. loadingType: 'more',
  84. page: 1,
  85. limit: 10,
  86. monthList: {},
  87. loaded: false,
  88. month_momey: 0, //月营业额
  89. month_count: 0,//月订单数
  90. today_momey: '', //日营业额
  91. today_count: '', //今日订单数
  92. now_date: year + '-' + month,
  93. date: year + '-' + month //选择的日期不能超过今天
  94. };
  95. },
  96. onReady(res) {
  97. var _this = this;
  98. uni.getSystemInfo({
  99. success: resu => {
  100. const query = uni.createSelectorQuery();
  101. query.select('.list-wrapper').boundingClientRect();
  102. query.exec(function(res) {
  103. console.log(res, 'ddddddddddddd');
  104. _this.height = resu.windowHeight - res[0].top + 'px';
  105. console.log('打印页面的剩余高度', _this.height);
  106. });
  107. },
  108. fail: res => {}
  109. });
  110. },
  111. onLoad() {
  112. console.log(this.tiday_start, 'start');
  113. console.log(this.now_date);
  114. this.loadData();
  115. },
  116. methods: {
  117. //跳转
  118. navTo(url) {
  119. uni.navigateTo({
  120. url
  121. });
  122. },
  123. getTimes(val) {
  124. let date = new Date(val * 1000);
  125. let Y = date.getFullYear();
  126. let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
  127. let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
  128. let h =date.getHours() < 10 ? ('0' +date.getHours()) :date.getHours();
  129. let m = date.getMinutes()< 10 ? ('0' + date.getMinutes()) : date.getMinutes(); //分钟补0
  130. return Y + '.' + M + '.' + D+'.'+h+':'+m;
  131. },
  132. // 切换月份
  133. bindDateChange(e) {
  134. console.log(e.detail, 'dddddddddddd');
  135. this.now_date = e.detail.value;
  136. this.month_momey = 0;
  137. this.month_count = 0;
  138. this.loadData()
  139. },
  140. loadData() {
  141. const obj = this;
  142. shop_data({ month: this.now_date }).then(data => {
  143. console.log(data.data,'返回数据');
  144. obj.monthList =data.data.list;
  145. obj.month_momey=data.data.moun;
  146. obj.month_count=data.data.count;
  147. if(data.data.store.used != null){
  148. obj.today_momey = data.data.store.used;
  149. }
  150. if(data.data.store.balance != null){
  151. obj.today_count = data.data.store.balance;
  152. }
  153. });
  154. }
  155. }
  156. };
  157. </script>
  158. <style lang="scss" scoped>
  159. .top {
  160. height: 585rpx;
  161. background-color: #F75022;
  162. position: relative;
  163. .sybg {
  164. position: absolute;
  165. width: 100%;
  166. height: 265rpx;
  167. }
  168. .top-card {
  169. width: 688rpx;
  170. height: 398rpx;
  171. padding: 32rpx;
  172. background: #ffffff;
  173. box-shadow: -2rpx 4rpx 18rpx 0px rgba(0, 110, 238, 0.2);
  174. border-radius: 24rpx;
  175. position: absolute;
  176. right: 0;
  177. left: 0;
  178. bottom: 40rpx;
  179. margin: 0 auto;
  180. .now-tit {
  181. text-align: right;
  182. font-size: 24rpx;
  183. font-family: PingFang SC;
  184. font-weight: 500;
  185. color: #999999;
  186. }
  187. .now-money {
  188. padding-top: 10rpx;
  189. text-align: right;
  190. font-size: 72rpx;
  191. font-family: PingFang SC;
  192. font-weight: bold;
  193. color: #F75022;
  194. &::before {
  195. content: '¥';
  196. font-size: 44rpx;
  197. position: relative;
  198. bottom: 5rpx;
  199. }
  200. }
  201. .card-icon {
  202. position: absolute;
  203. top: 100rpx;
  204. left: 48rpx;
  205. width: 224rpx;
  206. height: 122rpx;
  207. image {
  208. width: 100%;
  209. height: 100%;
  210. }
  211. }
  212. .card-tit {
  213. display: flex;
  214. align-items: center;
  215. .tit-point {
  216. display: inline-block;
  217. width: 12rpx;
  218. height: 32rpx;
  219. background: #F75022;
  220. border-radius: 3rpx;
  221. margin-right: 17rpx;
  222. }
  223. font-size: 32rpx;
  224. font-family: PingFang SC;
  225. font-weight: 500;
  226. color: #333333;
  227. }
  228. .card-btm {
  229. position: absolute;
  230. bottom: 32rpx;
  231. width: 624rpx;
  232. height: 122rpx;
  233. background: linear-gradient(180deg, rgba(220, 184, 118, 0.12) 0%, rgba(220, 184, 118, 0) 100%);
  234. border-radius: 12rpx;
  235. .card-info {
  236. width: 50%;
  237. flex-shrink: 0;
  238. padding-left: 30rpx;
  239. justify-content: flex-start;
  240. align-items: center;
  241. image {
  242. width: 48rpx;
  243. height: 48rpx;
  244. }
  245. .info-wrap {
  246. padding-left: 20rpx;
  247. .info-tit {
  248. font-size: 28rpx;
  249. font-family: PingFang SC;
  250. font-weight: 500;
  251. color: #999999;
  252. }
  253. .info-val {
  254. // padding-top: 15rpx;
  255. font-size: 36rpx;
  256. font-family: PingFang SC;
  257. font-weight: bold;
  258. color: #dcb876;
  259. text-align: center;
  260. }
  261. .dan {
  262. &::after {
  263. content: '单';
  264. font-size: 32rpx;
  265. position: relative;
  266. bottom: 3rpx;
  267. }
  268. }
  269. }
  270. }
  271. }
  272. }
  273. }
  274. .mid-tit {
  275. background-color: #fff;
  276. height: 80rpx;
  277. padding: 0 30rpx 0 33rpx;
  278. justify-content: space-between;
  279. align-items: center;
  280. margin-bottom: 12rpx;
  281. .mid-left {
  282. image {
  283. margin-right: 13rpx;
  284. width: 33rpx;
  285. height: 33rpx;
  286. }
  287. }
  288. }
  289. .btm-tab {
  290. background-color: #fff;
  291. // padding: 0 30rpx 0 35rpx;
  292. .tab-top-left {
  293. text-align: left;
  294. padding-left: 35rpx;
  295. }
  296. .tab-top-center {
  297. text-align: center;
  298. }
  299. .tab-top-right {
  300. text-align: right;
  301. padding-right: 30rpx;
  302. }
  303. .tab-tit {
  304. height: 72rpx;
  305. font-size: 24rpx;
  306. font-family: PingFang SC;
  307. font-weight: 500;
  308. color: #999999;
  309. .tab-content {
  310. width: 33%;
  311. }
  312. }
  313. }
  314. .list-wrapper {
  315. background-color: #fff;
  316. .list {
  317. height: 70rpx;
  318. view {
  319. width: 33.3%;
  320. flex-shrink: 0;
  321. font-size: 28rpx;
  322. font-family: PingFang SC;
  323. font-weight: 500;
  324. color: #333333;
  325. }
  326. .money {
  327. color: #F75022;
  328. }
  329. }
  330. }
  331. .choose-time {
  332. position: absolute;
  333. top: 90rpx;
  334. line-height: 1.5;
  335. padding-left: 32rpx;
  336. font-size: 28rpx;
  337. font-family: PingFang SC;
  338. font-weight: 500;
  339. color: #ffffff;
  340. }
  341. </style>