金诚优选前端代码
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.

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