819527061@qq.com
2024-07-30 e52e720168541aa02e0326a505d251f42828aedf
pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue
@@ -10,7 +10,9 @@
            </u-form-item>-->
         </u--form>
      </view>
      <view class="addBtn"><u-button text="邀请" type="primary" @click="addToHuoDaiOrDriver"></u-button></view>
      <view class="addBtn">
      <u-button text="邀请" :loading="yaoqingLoading" type="primary" @click="addToHuoDaiOrDriver"></u-button>
    </view>
   </view>
</template>
@@ -31,7 +33,8 @@
         name: '',
         phone: '',
         carNo: '',
         customerId
         customerId,
      yaoqingLoading: false,  //邀请loading
      };
   },
   methods: {
@@ -66,9 +69,11 @@
      },
      // 邀请货代
      bindHuoDai() {
      this.yaoqingLoading = true
         // this.$reqPost('bindHuoDai', { customerId: this.customerId, name: this.name, phone: this.phone }, 'params').then(res => {
         this.$reqPost('bindHuoDai', { name: this.name, phone: this.phone }, 'params').then(res => {
            if (res.code == 0) {
          this.yaoqingLoading = false
               this.$u.toast('添加成功');
               setTimeout(() => {
                  uni.navigateBack({
@@ -78,13 +83,19 @@
            } else {
               this.$u.toast(res.msg ? res.msg : '未成功添加');
            }
         });
         }).catch(() => {
        this.yaoqingLoading = false
      }).finally(() => {
        this.yaoqingLoading = false
      });
      },
      // 邀请司机
      bindUserFleet() {
      this.yaoqingLoading = true
         this.$reqPost('bindUserFleet', { fleetId: this.fleetId, name: this.name, phone: this.phone, carNo: this.carNo }, 'params').then(res => {
            console.log('邀请司机', res);
            if (res.code == 0) {
          this.yaoqingLoading = false
               this.$u.toast(res.msg ? res.msg : '操作成功');
               this.$reqGet('GetUserFleet', { fleetId: this.fleetId }).then(response => {
                  this.lengthchange(response.data.length);
@@ -99,7 +110,11 @@
                  duration: 2000
               });
            }
         });
         }).catch(() => {
        this.yaoqingLoading = false
      }).finally(() => {
        this.yaoqingLoading = false
      });
      }
   }
};