index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <view class="center">
  3. <view class="" v-if="accountType == '2'">
  4. {{dataInfo.companyName}}
  5. </view>
  6. <view class="flex account">
  7. <view class="account_info">
  8. 可用余额
  9. <view class="money">
  10. {{dataInfo.accountBalance?dataInfo.accountBalance:0}}元
  11. </view>
  12. </view>
  13. <view class="account_info">
  14. 已冻结
  15. <view class="money">
  16. {{dataInfo.frozenAmount?dataInfo.frozenAmount:0}}元
  17. </view>
  18. </view>
  19. </view>
  20. <u-button type="primary" text="提现" @click="withdrawal"></u-button>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. dataInfo: {},
  28. accountType: '', //accountType 1个人 2企业
  29. id:"",//如果是企业 公司id
  30. }
  31. },
  32. onLoad(options) {
  33. if (options.id) { //我的企业进来的
  34. this.accountType = '2'
  35. this.id = options.id
  36. console.log(this.dataInfo)
  37. } else { //个人账户
  38. this.accountType = '1'
  39. }
  40. },
  41. onShow() {
  42. this.getList()
  43. },
  44. onNavigationBarButtonTap(e) {
  45. uni.$u.route('/pages/mine/myAccount/bill?type=' + this.accountType)
  46. },
  47. methods: {
  48. getList() {
  49. if(this.accountType == '1'){
  50. this.$request.baseRequest('get', '/cargoOwnerInfo/selectAccount', {
  51. commonId: uni.getStorageSync("userInfo").id
  52. }).then(res => {
  53. this.dataInfo = res.data
  54. })
  55. }else if(this.accountType == '2'){
  56. this.$request.baseRequest('get', '/cargoOwnerInfo/selectAccountBalance', {
  57. id:this.id,
  58. flag:this.accountType
  59. }).then(res => {
  60. this.dataInfo = res.data
  61. })
  62. }
  63. },
  64. withdrawal() {
  65. if(this.accountType == '1'){
  66. uni.$u.route("/pages/mine/myAccount/withdrawal?id=" + this.dataInfo.id +"&flag=" + this.accountType)
  67. }else if(this.accountType == '2'){
  68. uni.$u.route("/pages/mine/myAccount/withdrawal?id=" + this.id +"&flag=" + this.accountType)
  69. }
  70. },
  71. }
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .center {
  76. padding: 20rpx;
  77. .account {
  78. margin-top: 30rpx;
  79. .account_info {
  80. width: 50%;
  81. text-align: center;
  82. }
  83. .money {
  84. margin: 40rpx;
  85. }
  86. }
  87. }
  88. </style>