bills.vue 7.3 KB

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