addBinding.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //添加绑定
  2. <template>
  3. <view class="center">
  4. <view class="form_data">
  5. <view class="flex row">
  6. <view class="left-text">车队长名字</view>
  7. <u--input placeholder="请输入车队长姓名" inputAlign='right' border="none" v-model="fleet.carCaptainName"
  8. maxlength="6">
  9. </u--input>
  10. </view>
  11. <view class="flex row">
  12. <view class="left-text">车队长账号</view>
  13. <u--input placeholder="请输入车队长账号" inputAlign='right' border="none"
  14. v-model="fleet.carCaptainAccountNumber" maxlength="11">
  15. </u--input>
  16. </view>
  17. </view>
  18. <view class="btn_css">
  19. <u-button type="primary" text="绑定" @click="submit"></u-button>
  20. </view>
  21. <u-toast ref="uToast"></u-toast>
  22. <u-modal :show="tipsShow" :title="alertTitle" :closeOnClickOverlay='true' :showCancelButton='true'
  23. confirmColor='#2772FB' @confirm="$u.throttle(confirmClick, 5000)" @close="cancelClick"
  24. @cancel="cancelClick"></u-modal>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. mapState
  30. } from 'vuex';
  31. export default {
  32. data() {
  33. return {
  34. fleet: {},
  35. tipsShow: false,
  36. alertTitle: "确定绑定后请及时联系车队长接受绑定,避免造成您的财产损失"
  37. }
  38. },
  39. onLoad() {
  40. },
  41. onShow() {
  42. },
  43. computed: {
  44. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication']),
  45. },
  46. methods: {
  47. submit() {
  48. this.tipsShow = true
  49. },
  50. confirmClick() {
  51. this.tipsShow = false
  52. uni.showLoading({
  53. mask: true,
  54. title: '加载中'
  55. })
  56. this.fleet.commonId = this.userInfo.id
  57. this.fleet.driverName = this.firstAuthentication.driverName
  58. this.fleet.accountNumber = this.userInfo.phone
  59. this.$request.baseRequest('post', '/hyBindCarCaptainInfo/api/binding;', this.fleet).then(res => {
  60. debugger
  61. if (res.code == 200) {
  62. uni.hideLoading()
  63. this.$refs.uToast.show({
  64. type: 'success',
  65. message: "绑定成功!",
  66. complete() {
  67. uni.navigateBack({
  68. delta: 1
  69. });
  70. }
  71. })
  72. } else {
  73. uni.hideLoading()
  74. uni.$u.toast(res.message);
  75. }
  76. })
  77. .catch(res => {
  78. uni.hideLoading()
  79. uni.$u.toast(res.message);
  80. });
  81. }
  82. },
  83. cancelClick() {
  84. this.tipsShow = false
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .center {
  90. padding: 20rpx 30rpx;
  91. }
  92. .form_data {
  93. .row {
  94. border-bottom: 1px solid #EEEEEE;
  95. padding-bottom: 28rpx;
  96. margin-top: 26rpx;
  97. .ch-style {}
  98. }
  99. }
  100. .btn_css {
  101. margin-top: 30rpx;
  102. }
  103. </style>