addBinding.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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='#F5BA3C' @confirm="$u.throttle(confirmClick, 1000)" @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. if (res.code == 200) {
  61. uni.hideLoading()
  62. this.$refs.uToast.show({
  63. type: 'success',
  64. message: "绑定成功,等待队长接受!",
  65. complete() {
  66. uni.navigateBack({
  67. delta: 1
  68. });
  69. }
  70. })
  71. } else {
  72. uni.hideLoading()
  73. uni.$u.toast(res.message);
  74. }
  75. })
  76. .catch(res => {
  77. uni.hideLoading()
  78. uni.$u.toast(res.message);
  79. });
  80. }
  81. },
  82. cancelClick() {
  83. this.tipsShow = false
  84. }
  85. }
  86. </script>
  87. <style lang="scss" scoped>
  88. .center {
  89. padding: 20rpx 30rpx;
  90. }
  91. .form_data {
  92. .row {
  93. border-bottom: 1px solid #EEEEEE;
  94. padding-bottom: 28rpx;
  95. margin-top: 26rpx;
  96. .ch-style {}
  97. }
  98. }
  99. .btn_css {
  100. margin-top: 30rpx;
  101. }
  102. </style>