bindingCarCaptain.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. //绑定车队长
  2. <template>
  3. <view class="center">
  4. <view class="fleetInfo">
  5. <view class="fleetInfo_name" v-if="fleetInfo.carCaptainName">{{fleetInfo.carCaptainName}}({{fleetInfo.carCaptainAccountNumber}})</view>
  6. <view class="fleetInfo_name" v-else>队长名称</view>
  7. <view class="fleetInfo_phone">{{fleetInfo.status?fleetInfo.status:"未绑定"}}</view>
  8. </view>
  9. <view class="btn_css" v-if="fleetInfo.status != '待确认'">
  10. <view class="btn_item" v-if="!fleetInfo.status||fleetInfo.status=='已拒绝'|| fleetInfo.status=='未绑定'">
  11. <u-button type="primary" text="去绑定" @click="operation"></u-button>
  12. </view>
  13. <view class="btn_item" v-else>
  14. <u-button type="primary" text="解绑" @click="leave"></u-button>
  15. </view>
  16. </view>
  17. <view class="red_char">
  18. 注:绑定车队长后,运费将自动结算到车队长账户,不再对司机结算,如需对司机本人结算请先解绑车队长。
  19. </view>
  20. <u-toast ref="uToast"></u-toast>
  21. <u-modal :show="tipsShow" :title="alertTitle" :closeOnClickOverlay='true' :showCancelButton='true'
  22. confirmColor='#2772FB' @confirm="$u.throttle(confirmClick, 1000)" @close="cancelClick" @cancel="cancelClick"></u-modal>
  23. </view>
  24. </template>
  25. <script>
  26. import {
  27. mapState
  28. } from 'vuex';
  29. export default {
  30. data() {
  31. return {
  32. fleetInfo:{},
  33. tipsShow:false,
  34. alertTitle:"确定解绑车队长?"
  35. }
  36. },
  37. onLoad() {
  38. this.getInfo()
  39. },
  40. onShow() {
  41. },
  42. computed: {
  43. ...mapState(['hasLogin', 'userInfo']),
  44. },
  45. methods: {
  46. operation(){
  47. uni.$u.route('/pages/mine/fleet/addBinding');
  48. // uni.$u.route('/pages/mine/fleet/addBinding', {
  49. // data: JSON.stringify(this.dataDetails),
  50. // });
  51. },
  52. leave(){
  53. this.tipsShow = true
  54. },
  55. cancelClick(){
  56. this.tipsShow = false
  57. },
  58. confirmClick(){
  59. let that = this
  60. uni.showLoading({
  61. mask: true,
  62. title: '加载中'
  63. })
  64. this.tipsShow = false
  65. this.$request.baseRequest('post', '/hyBindCarCaptainInfo/api/unbinding', {id:this.fleetInfo.id}).then(res => {
  66. if (res.code == 200) {
  67. uni.hideLoading()
  68. that.getInfo()
  69. this.$refs.uToast.show({
  70. type: 'success',
  71. message: "解绑成功!",
  72. complete() {}
  73. })
  74. } else {
  75. uni.hideLoading()
  76. uni.$u.toast(res.message);
  77. }
  78. })
  79. .catch(res => {
  80. uni.hideLoading()
  81. uni.$u.toast(res.message);
  82. });
  83. },
  84. getInfo(){
  85. this.$request.baseRequest('get', '/hyBindCarCaptainInfo/getBindCarCaptain', {
  86. commonId:this.userInfo.id
  87. }).then(res => {
  88. if (res.code == 200) {
  89. if(res.data){
  90. this.fleetInfo = res.data
  91. }
  92. } else {
  93. uni.$u.toast(res.message);
  94. }
  95. })
  96. .catch(res => {
  97. uni.hideLoading()
  98. uni.$u.toast(res.message);
  99. });
  100. },
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .center{
  106. padding: 20rpx 30rpx;
  107. }
  108. .fleetInfo{
  109. display: flex;
  110. width: 100%;
  111. margin-top: 30rpx;
  112. .fleetInfo_name{
  113. width: 50%;
  114. }
  115. .fleetInfo_phone{
  116. width: 50%;
  117. text-align: right;
  118. }
  119. }
  120. .btn_css{
  121. display: flex;
  122. margin-top: 30rpx;
  123. .btn_item{
  124. width: 120rpx;
  125. margin-right: 20rpx;
  126. }
  127. }
  128. .red_char{
  129. color: #f05458;
  130. font-size: 28rpx;
  131. margin-top: 30rpx;
  132. }
  133. </style>