金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

270 lines
6.1 KiB

  1. <template>
  2. <view>
  3. <lf-nav title="余额" :showIcon="true" :spreadOut="false" bgColor="transparent" titleColor="#fff"></lf-nav>
  4. <view class="head">
  5. <view class="bg-left"></view>
  6. <view class="bg-right"></view>
  7. <view class="head-content">
  8. <view>
  9. <text class="lf-iconfont icon-yuebao lf-font-50"></text>
  10. </view>
  11. <view class="point">
  12. <text>{{ balance }}</text>
  13. <text class="label">()</text>
  14. </view>
  15. </view>
  16. <view class="withdrawal" @click="$url('/pages/business/withdrawal/withdrawal')">提现</view>
  17. </view>
  18. <view class="tabs">
  19. <view class="lf-flex lf-h-100">
  20. <view class="tab"
  21. v-for="(item, index) in tab_list" :key="index"
  22. :class="{'active-tab': current == index}"
  23. @click="switchTab(index)">{{ item.name }}
  24. </view>
  25. </view>
  26. <picker mode='date' :value="date" @change="dateChange">
  27. <view style="width: 340rpx; text-align: right;">
  28. <text>{{ date || getDay }}</text>
  29. <text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10"></text>
  30. </view>
  31. </picker>
  32. </view>
  33. <view class="main" v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex"
  34. v-if="current == tabIndex">
  35. <view class="item" v-for="(item, index) in tabItem.list" :key="index">
  36. <view class="lf-row-between">
  37. <text class="lf-font-36 lf-color-black lf-font-bold" style="width: 70%;" v-if="item.type == 'charge'">+{{ item.balance }}</text>
  38. <text class="lf-font-36 lf-font-bold" style="color: #F63434; width: 70%;" v-else>{{ item.balance }}</text>
  39. <text class="lf-font-24 lf-color-555">{{ item.note }}</text>
  40. </view>
  41. <view class="lf-row-between lf-m-t-20">
  42. <text class="lf-font-24 lf-color-555">¥{{ item.current }}</text>
  43. <text class="lf-font-24 lf-color-777">{{ item.created_at }}</text>
  44. </view>
  45. </view>
  46. <lf-nocontent src="/static/images/empty.png" v-if="tabItem.list.length <= 0"></lf-nocontent>
  47. </view>
  48. <u-back-top :scrollTop="pageScrollTop"></u-back-top>
  49. </view>
  50. </template>
  51. <script>
  52. export default {
  53. data(){
  54. return {
  55. date: '',
  56. current: 0,
  57. tab_list: [{
  58. name: '余额明细',
  59. page: 1,
  60. isPage: true,
  61. list: []
  62. },{
  63. name: '提现明细',
  64. page: 1,
  65. isPage: true,
  66. list: []
  67. }],
  68. balance: 0
  69. }
  70. },
  71. computed: {
  72. getDay(){
  73. return this.$shared.recordTime(new Date(), '-', 'date');
  74. }
  75. },
  76. onLoad(){
  77. this.getBalance();
  78. },
  79. methods: {
  80. // 时间筛选
  81. dateChange(event){
  82. this.date = event.detail.value;
  83. let tabItem = this.tab_list[this.current];
  84. tabItem.page = 1;
  85. tabItem.isPage = true;
  86. this.getBalance();
  87. },
  88. // 切换tab
  89. switchTab(index){
  90. this.current = index;
  91. if(this.tab_list[index].list.length <= 0){
  92. this.getBalance();
  93. }
  94. },
  95. getBalance(){
  96. uni.showLoading({
  97. title: '正在查询中'
  98. })
  99. let token = this.$cookieStorage.get('store_token');
  100. let tabItem = this.tab_list[this.current];
  101. let par = {
  102. cash: this.current,
  103. page: tabItem.page
  104. }
  105. if(this.date){
  106. par.date = this.date;
  107. }
  108. this.$http.get({
  109. api: 'api/supplier/balance',
  110. data: par,
  111. header: {
  112. token: token
  113. }
  114. }).then(res => {
  115. if(res.data.code == 200){
  116. let balance = res.data.data.balance;
  117. let list = res.data.data.list;
  118. this.balance = balance;
  119. tabItem.isPage = this.$shared.isRight(list.next_page_url);
  120. if(tabItem.page == 1){
  121. tabItem.list = list.data;
  122. }else{
  123. tabItem.list.push(...list.data);
  124. }
  125. }
  126. uni.hideLoading();
  127. }).catch(err => uni.hideLoading());
  128. }
  129. },
  130. onReachBottom(){
  131. let tabItem = this.tab_list[this.current];
  132. if(tabItem.isPage){
  133. tabItem.page = tabItem.page+1;
  134. this.getBalance();
  135. }else{
  136. this.$msg('没有更多啦~')
  137. }
  138. }
  139. }
  140. </script>
  141. <style>
  142. page{
  143. overflow-x: hidden;
  144. }
  145. </style>
  146. <style lang="scss" scoped>
  147. .head{
  148. width: 750rpx;
  149. height: 429rpx;
  150. background: linear-gradient(90deg, #1338B7 0%, #092788 100%);
  151. position: relative;
  152. overflow: hidden;
  153. display: flex;
  154. align-items: flex-end;
  155. box-sizing: border-box;
  156. padding: 60rpx 32rpx;
  157. color: #FFFFFF;
  158. .bg-left{
  159. position: absolute;
  160. width: 196rpx;
  161. height: 196rpx;
  162. border-radius: 50%;
  163. background-color: rgba(255,255,255,0.04);
  164. left: -92rpx;
  165. bottom: 60rpx;
  166. }
  167. .bg-right{
  168. position: absolute;
  169. width: 520rpx;
  170. height: 520rpx;
  171. border-radius: 50%;
  172. background-color: rgba(255,255,255,0.04);
  173. right: -168rpx;
  174. top: -122rpx;
  175. }
  176. .head-content{
  177. width: 100%;
  178. display: flex;
  179. flex-direction: column;
  180. justify-content: center;
  181. align-items: center;
  182. &>view{
  183. width: 100%;
  184. text-align: center;
  185. }
  186. .point{
  187. font-size: 72rpx;
  188. letter-spacing: 2rpx;
  189. font-weight: bold;
  190. word-break: break-all;
  191. line-height: 1;
  192. margin-top: 10rpx;
  193. .label{
  194. font-size: 36rpx;
  195. font-weight: initial;
  196. }
  197. }
  198. }
  199. .withdrawal{
  200. position: absolute;
  201. right: 32rpx;
  202. bottom: 164rpx;
  203. width: 102rpx;
  204. height: 47rpx;
  205. border-radius: 24rpx;
  206. border: 1rpx solid #FFFFFF;
  207. font-size: 24rpx;
  208. color: #FFFFFF;
  209. display: flex;
  210. justify-content: center;
  211. align-items: center;
  212. z-index: 9;
  213. }
  214. }
  215. .tabs{
  216. height: 100rpx;
  217. width: 750rpx;
  218. border: 1rpx solid #e5e5e5;
  219. display: flex;
  220. justify-content: space-between;
  221. align-items: center;
  222. padding: 0 32rpx;
  223. .tab{
  224. width: 128rpx;
  225. height: 100%;
  226. display: flex;
  227. justify-content: center;
  228. align-items: center;
  229. font-size: 28rpx;
  230. color: #555555;
  231. &:nth-child(n+2){
  232. margin-left: 50rpx;
  233. }
  234. }
  235. .active-tab{
  236. font-size: 32rpx;
  237. color: #0D2E9A;
  238. position: relative;
  239. font-weight: bold;
  240. &::after{
  241. content: '';
  242. position: absolute;
  243. bottom: 0;
  244. left: calc(50% - 40rpx);
  245. width: 80rpx;
  246. height: 10rpx;
  247. background: #0D2E9A;
  248. border-radius: 8rpx 8rpx 0rpx 0rpx;
  249. }
  250. }
  251. }
  252. .main{
  253. padding: 30rpx 32rpx;
  254. width: 750rpx;
  255. height: max-content;
  256. box-sizing: border-box;
  257. .item{
  258. width: 686rpx;
  259. height: max-content;
  260. background: #F4F8F8;
  261. border-radius: 10rpx;
  262. margin-bottom: 26rpx;
  263. padding: 30rpx;
  264. box-sizing: border-box;
  265. line-height: 1;
  266. }
  267. }
  268. </style>