bills.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="" style="height: 100vh;">
  3. <view class="head_box u-flex u-row-center u-col-center">
  4. <view class="card-box">
  5. <view class="card-head u-flex u-col-center">
  6. <view class="card-title u-m-r-10">总资产(元)</view>
  7. <view class="u-iconfont uicon-eye" style="color: #fff;font-size: 50rpx;"></view>
  8. </view>
  9. <view class="money-num u-p-t-50">{{dataInfo.totalAssets}}</view>
  10. <view class="padding-top-40 text-white text-df">
  11. <text>总收益:¥ {{dataInfo.totalRevenue}}</text>
  12. <text class="margin-left-30">今日收益:¥ {{dataInfo.todayRevenue}}</text>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="flex justify-between" style="font-size: 24rpx;color: #666666;background-color: #f6f6f6;">
  17. <view class="flex" @click.stop="showTime = true">
  18. <view class="bg-white cu-btn round margin-30 sm">
  19. <text>{{defaultTime}}</text>
  20. <text class="cuIcon-triangledownfill text-gray" style="font-size: 50rpx;"></text>
  21. </view>
  22. <view class="total-box">收入¥0.00 支出¥0.00</view>
  23. </view>
  24. <view @click="$jump('/pages/statistics/statistics')" class="center margin-right-30">
  25. 统计
  26. <text class="cuIcon-right"></text>
  27. </view>
  28. </view>
  29. <view v-if="stateCurrent==0">
  30. <view class="flex bg-white u-border-top " style="padding: 30rpx">
  31. <view style="width: 51%;margin-left: 60rpx;">
  32. 来源
  33. </view>
  34. <view class="text-center" style="width: 25%;">
  35. 折扣
  36. </view>
  37. <view class="text-right" style="width: 24%;margin-right: 20rpx;">
  38. 金额
  39. </view>
  40. </view>
  41. </view>
  42. <view class="bg-white safe-area-inset-bottom tabsClass" style="height: 100%;">
  43. <mescroll :down="downOption" :up="upOption" @up="upCallback" :fixed="false" @down="downCallback"
  44. @init="mescrollInit">
  45. <navigator :url="'/pages/my-bills/bills-detail?id='+item.id+'&type=all'" class="u-border-bottom flex" v-for="(item,index) in list" :key="index">
  46. <view class="area1">
  47. <image :src="item.avatar?item.avatar:'/static/icon/avatar.png'" mode=""></image>
  48. <view>
  49. <text>{{item.nickName || '用户支付'}}</text>
  50. <text>{{item.createTime}}</text>
  51. </view>
  52. </view>
  53. <view class="area2">
  54. <text>{{item.discount==-1 || item.discount==0?'无折扣':item.discount +'折'}}</text>
  55. </view>
  56. <view class="area3">
  57. <text class="text-base">{{item.receiveNumTotal || 0}}</text>
  58. </view>
  59. </navigator>
  60. </mescroll>
  61. </view>
  62. <u-picker v-model="showTime" mode="time" :params="params" @confirm="confirmTime">
  63. </u-picker>
  64. </view>
  65. </template>
  66. <script>
  67. import mescroll from '@/components/mescroll-body/mescroll-uni.vue'
  68. export default {
  69. components: {
  70. mescroll
  71. },
  72. props: {
  73. type: Number,
  74. dataInfo:Object
  75. },
  76. data() {
  77. return {
  78. stateCurrent: 0, //默认
  79. statusList: [{
  80. name: '收入',
  81. value: 0
  82. },
  83. {
  84. name: '支出',
  85. value: 1
  86. }
  87. ],
  88. //时间
  89. showTime: false,
  90. params: {
  91. year: true,
  92. month: true,
  93. },
  94. defaultTime: '',
  95. //数据
  96. list: [],
  97. mescroll: null,
  98. upOption: {
  99. noMoreSize: 5,
  100. auto: false,
  101. },
  102. // 下拉配置参数
  103. downOption: {
  104. use: false,
  105. auto: false
  106. },
  107. };
  108. },
  109. watch: {
  110. type() {
  111. if (!this.isInit && this.type === 0) {
  112. this.mescroll.resetUpScroll()
  113. }
  114. }
  115. },
  116. mounted() {
  117. if (!this.isInit && this.type === 0) {
  118. this.mescroll.resetUpScroll()
  119. }
  120. },
  121. created() {
  122. this.defaultTime = this.$dateTime.format(new Date(), 'YYYY-mm')
  123. },
  124. methods: {
  125. mescrollInit(mescroll) {
  126. this.mescroll = mescroll
  127. },
  128. onTab(index) {
  129. this.stateCurrent = index
  130. this.mescroll.resetUpScroll();
  131. },
  132. confirmTime(e) {
  133. this.defaultTime = e.year + '-' + e.month
  134. this.mescroll.resetUpScroll();
  135. },
  136. upCallback(mescroll) {
  137. console.log("balance");
  138. let params = {
  139. receiveId: this.vuex_shopId,
  140. current: mescroll.num,
  141. size: mescroll.size,
  142. payStatus: this.$global.PAY_STATUS.SUCCESS,
  143. }
  144. if (this.defaultTime) {
  145. params.createTime = this.$dateTime.format(new Date(this.defaultTime))
  146. } else {
  147. params.createTime = this.$dateTime.format(new Date())
  148. }
  149. try {
  150. this.$api.bills.list(params).then(res => {
  151. let data = res.data.records
  152. let total = res.data.total
  153. mescroll.endBySize(data.length, total);
  154. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  155. this.list = this.list.concat(data); //追加新数据
  156. })
  157. } catch (e) {
  158. this.mescroll.endErr()
  159. }
  160. },
  161. downCallback() {
  162. setTimeout(() => {
  163. this.mescroll.resetUpScroll();
  164. }, 500)
  165. },
  166. }
  167. };
  168. </script>
  169. <style>
  170. page {
  171. background-color: #FFFFFF;
  172. }
  173. </style>
  174. <style lang="scss" scoped>
  175. .area1 {
  176. $img-width: 70rpx;
  177. width: 54%;
  178. display: flex;
  179. height: 120rpx;
  180. justify-content: center;
  181. align-items: center;
  182. image {
  183. display: flex;
  184. align-items: center;
  185. justify-content: center;
  186. width: $img-width;
  187. height: $img-width;
  188. border-radius: 50%;
  189. }
  190. view {
  191. width: calc(100% - $img-width);
  192. display: flex;
  193. flex-direction: column;
  194. justify-content: space-between;
  195. margin-left: 10rpx;
  196. }
  197. text:first-child {
  198. margin-bottom: 8rpx;
  199. }
  200. text:last-child {
  201. margin-top: 8rpx;
  202. color: #999;
  203. }
  204. }
  205. .area2 {
  206. display: flex;
  207. justify-content: center;
  208. align-items: center;
  209. text-align: center;
  210. width: 22%;
  211. margin-top: 10rpx;
  212. font-weight: 300;
  213. color: #666;
  214. }
  215. .area3 {
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. width: 24%;
  220. font-size: 32rpx;
  221. margin-top: 10rpx;
  222. }
  223. .head_box {
  224. font-weight: 300;
  225. background-color: #fff;
  226. padding: 30rpx 0;
  227. .card-box {
  228. width: 700rpx;
  229. min-height: 300rpx;
  230. padding: 40rpx 40rpx 0rpx;
  231. background-color: #ff9201;
  232. box-shadow: 1rpx 5rpx 16rpx 0 rgba(255, 148, 71, .6);
  233. border-radius: 30rpx;
  234. overflow: hidden;
  235. position: relative;
  236. .card-head {
  237. color: #fff;
  238. font-size: 30rpx;
  239. }
  240. .money-num {
  241. font-size: 70rpx;
  242. line-height: 70rpx;
  243. font-weight: 500;
  244. color: #ffffff;
  245. }
  246. .reduce-num {
  247. font-size: 26rpx;
  248. font-weight: 400;
  249. color: #ffffff;
  250. }
  251. .withdraw-btn {
  252. width: 120rpx;
  253. height: 60rpx;
  254. line-height: 60rpx;
  255. background: #ffffff;
  256. border-radius: 30px;
  257. font-size: 24rpx;
  258. font-weight: 500;
  259. color: #ff9201;
  260. position: absolute;
  261. right: 30rpx;
  262. top: 40rpx;
  263. }
  264. }
  265. }
  266. .total-box {
  267. display: flex;
  268. justify-content: center;
  269. align-items: center;
  270. margin-right: 40rpx;
  271. font-size: 24rpx;
  272. font-weight: 500;
  273. color: #999999;
  274. }
  275. </style>