qingyiay
2023-04-14 0becab45282781f281ad5aa04202b83039ab275e
pages/customer-page/customer-my/customer-my.vue
@@ -9,8 +9,8 @@
         <view class="huodai-list">
            <u-swipe-action>
               <u-cell-group :border="false">
                  <u-swipe-action-item :options="options1" v-for="(item, index) in huoDaiData" :index="index" :name="item.id" :key="index" @click="deleteHuoDaiClick">
                     <u-cell :title="item.name" value="详情" @click="toFreightForwarderDetails(item.id)"></u-cell>
                  <u-swipe-action-item :options="options1" v-for="(item, index) in huoDaiData" :index="index" :name="item.userId" :key="index" @click="deleteHuoDaiClick">
                     <u-cell :title="item.name" value="详情" @click="toFreightForwarderDetails(item.userId)"></u-cell>
                  </u-swipe-action-item>
               </u-cell-group>
            </u-swipe-action>
@@ -26,13 +26,14 @@
            <u-swipe-action>
               <u-cell-group :border="false">
                  <u-swipe-action-item :options="options1" v-for="(item, index) in fleetData" :index="index" :name="item.id" :key="index" @click="deleteFleetClick">
                     <u-cell :title="item.name" value="25辆" @click="tofleetDetails(item.id)"></u-cell>
                     <u-cell :title="item.name" :value="item.userSijisum + '辆'" @click="tofleetDetails(item.id)"></u-cell>
                  </u-swipe-action-item>
               </u-cell-group>
            </u-swipe-action>
         </view>
      </view>
      <view class="statistics"><u-button text="发运统计" type="primary" @click="statistics"></u-button></view>
      <view class="logout"><u-button text="退出登录" type="primary" @click="logout()"></u-button></view>
      <!-- 新建车队弹出框 -->
@@ -90,7 +91,7 @@
<script>
import combinedTitle from '@/components/combined-title/combined-title.vue';
import { customerId ,redirectLogin} from '@/utils/status';
import { customerId, redirectLogin } from '@/utils/status';
export default {
   components: {
      combinedTitle
@@ -131,25 +132,27 @@
   },
   methods: {
      init() {
         uni.showLoading({
            title: '加载中...'
         });
         this.getAllHuoDaiByCustomerId();
         this.getFleet();
         uni.hideLoading();
      },
      // 获取货代列表
      getAllHuoDaiByCustomerId() {
         this.$reqGet('getAllHuoDaiByCustomerId', { customerId }).then(res => {
         uni.showLoading({
            title: '加载中...'
         });
         this.$reqGet('getAllHuoDaiByCustomerId').then(res => {
            uni.hideLoading();
            this.huoDaiData = res.data;
            console.log('货代列表', res);
         });
      },
      // 获取车队列表
      getFleet() {
         this.$reqGet('getFleet', { customerId }).then(res => {
         uni.showLoading({
            title: '加载中...'
         });
         this.$reqGet('getFleet').then(res => {
            uni.hideLoading();
            this.fleetData = res.data;
            console.log('车队列表', res);
         });
      },
      // 添加货代
@@ -160,7 +163,6 @@
      },
      // 添加车队
      addFleet() {
         console.log('添加车队');
         this.updateGroupShow = true;
      },
      addNewFleetPopupClose() {
@@ -177,19 +179,23 @@
         // 新建车队
         this.$reqPost('saveFleet', this.addGroupForm, 'params').then(res => {
            uni.hideLoading();
            console.log('新建车队', res);
            this.getFleet();
            if (res.code == 0) {
               this.$u.toast('添加成功');
               this.getFleet();
            } else {
               this.$u.toast(res.msg ? res.msg : '添加失败');
            }
         });
         this.updateGroupShow = false;
      },
      // 删除货代
      deleteHuoDaiClick(args) {
         console.log(args.name, '货代id');
         console.log(args, '货代id');
         this.deleteHuoDaiId = args.name;
         this.deleteHuoDaiShow = true;
         this.huoDaiData.forEach(item => {
            if (item.id == this.deleteHuoDaiId) {
               this.deleteHuoDaiContent = '确认删除货代' + item.huoDaiName;
            if (item.userId == this.deleteHuoDaiId) {
               this.deleteHuoDaiContent = '确认删除货代' + item.name + '吗?';
            }
         });
      },
@@ -207,9 +213,13 @@
         this.$reqPost('deleteHuoDai', { id: this.deleteHuoDaiId }, 'params').then(res => {
            uni.hideLoading();
            if (res.code == 0) {
               this.$u.toast('删除成功');
               if (res.data) {
                  this.$u.toast('删除成功');
                  this.getAllHuoDaiByCustomerId();
               } else {
                  this.$u.toast('删除失败');
               }
            }
            this.getAllHuoDaiByCustomerId();
         });
      },
      // 删除车队
@@ -238,15 +248,17 @@
            console.log('删除车队', res);
            if (res.code == 0) {
               this.$u.toast('删除成功');
            } else {
               this.$u.toast(res.msg ? res.msg : '删除失败');
            }
            uni.hideLoading();
            this.getFleet();
         });
      },
      // 货代详情
      toFreightForwarderDetails(id) {
      toFreightForwarderDetails(userId) {
         uni.navigateTo({
            url: `/pages/customer-page/freight-forwarder-details/freight-forwarder-details?huoDaiId=${id}`
            url: `/pages/customer-page/freight-forwarder-details/freight-forwarder-details?userId=${userId}`
         });
      },
      // 车队详情
@@ -259,16 +271,26 @@
         this.logoutShow = true;
      },
      logoutConfirm() {
         redirectLogin()
         redirectLogin();
      },
      logoutCancel() {
         this.logoutShow = false;
      },
      // 跳转发运统计页面
      statistics() {
         uni.navigateTo({
            url: '/pages/customer-page/customer-my/faYunstatistics/faYunstatistics'
         });
      }
   }
};
</script>
<style lang="scss" scoped>
.statistics {
   margin-top: vww(10);
   margin-bottom: vww(10);
}
::v-deep.customer-my {
   width: 94%;
   margin: 0 auto;