addBinding.vue 2.1 KB

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