finance.vue 7.5 KB

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