陶杰
2025-01-13 f926e6141482ca1c7ea8de58c06736e7d93abf9f
pages/user/supplier-user.vue
@@ -34,12 +34,16 @@
               mode="scaleToFill"></image>
            <view class="name" v-if="currentInfo.id">
               <view class="t1">
               <view class="t1 flex" style="align-items: center; justify-content: start;">
               <!-- <view class="t1"> -->
                  <!-- {{
              (!!currentInfo.partnerDTO ? (currentInfo.partnerDTO.name) : "") ||  (!!currentInfo.supplierDTO ? (currentInfo.supplierDTO.name) : "") || (!!currentInfo.customerDTO ? (currentInfo.customerDTO.name) : "") || currentInfo.nickName || currentInfo.loginName || '-'
            }} -->
                  <span v-if="currentInfo.partnerDTO && currentInfo.partnerDTO.name">
                     {{ currentInfo.partnerDTO.name }}
                  </span>
                  <span v-else-if="currentInfo.supplierSub && currentInfo.supplierSub.name">
                     {{ currentInfo.supplierSub.name }}
                  </span>
                  <span v-else-if="currentInfo.supplierDTO && currentInfo.supplierDTO.name">
                     {{ currentInfo.supplierDTO.name }}
@@ -98,8 +102,22 @@
                  </span>
                  <!-- #endif -->
                  <view v-if="selftype === 'supplier' && currentInfo.switchFlag " style="margin-left: 10px; display: flex; justify-content: start; align-items: center;">
                     <u--image v-if="selftype === 'supplier' && currentInfo.switchFlag "
                        src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/96/96f6ea502bac4360bf35399e86e463efswitch2.png"
                        width="10px" height="10px" style="margin-left: 20px; margin-right: 20px;"
                        @click="switchSubAccount"></u--image>
                     <!-- <u--text v-if="selftype === 'supplier' && currentInfo.switchFlag " style="color: black;" text="切换账号" @click="switchSubAccount"></u--text> -->
                     <view  v-if="selftype === 'supplier' && currentInfo.switchFlag "  @click="switchSubAccount" style="font-size: 10px; ">切换账号</view>
                  </view>
               </view>
               <view class="t2">{{ currentInfo.tel || '暂无电话' }}</view>
               <view class="t2 flex " style="align-items: center; justify-content: start;" >
                  <view>{{ currentInfo.supplierSub.phone || currentInfo.tel || '暂无电话' }}</view>
                  <!-- <view v-if="selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions:sub:account') ">
                     <view v-if="currentInfo.isSubSupplier" class="account_sub  m-l-a m-r-0"  >子账号</view>
                     <view v-else class="account_sub  m-l-a m-r-0"  >主账号</view>
                  </view> -->
               </view>
            </view>
            <view class="name" v-if="!currentInfo.id" open-type="getUserInfo" @click.stop="toCustomerLogin"
               style="font-size: 48rpx;margin-top: 16rpx;">
@@ -211,26 +229,25 @@
         </view>
      </view>
      <view class="user-utils kf-container  m-20 flex" v-if="selftype === 'customer' || !selftype"
         @click="goto('/sub_pages/supplier/customer_service/customer_service', false)">
         <view class="">
      <view class="user-utils kf-container  m-20 flex" v-if="selftype === 'customer' || !selftype" >
         <view class="" @click="goto('/sub_pages/supplier/customer_service/customer_service', false)">
            <image src="/static/common/icon-kf.png" class="icon-kf m-r-15 img100 icon"></image>
         </view>
         <view class="flex1">
            <view class="icon-view" style="font-weight: 600;">
            <view class="icon-view" style="font-weight: 600;" @click="goto('/sub_pages/supplier/customer_service/customer_service', false)">
               我的客服
            </view>
            <view class="flex m-t-12">
               <view class="flex1 w-fit m-auto icon-view" @click.stop="callTel">
                  <image src="/static/common/icon-call.png" class="icon icon-call m-r-10  img100"></image>
                  {{ tel }}
                  {{ tel || '' }}
               </view>
               <view class="flex1 w-fit m-auto icon-view flex flex-wrap-normal" open-type="contact">
               <view class="flex1 w-fit m-auto icon-view flex flex-wrap-normal" @click="goto('/sub_pages/supplier/customer_service/customer_service', false)">
                  <image src="/static/common/icon-wx.png" class="icon icon-call m-t-2  m-r-10 img100"></image>
                  <button open-type="contact" class="component-button-contact" @handleContact="handleContact">
                  <view>在线客服</view>
                  <!-- <button open-type="contact" class="component-button-contact" @handleContact="handleContact">
                     在线客服
                  </button>
                  </button> -->
               </view>
@@ -624,9 +641,16 @@
      }
   },
   // #endif
   onShow() {
   async onShow() {
      if(this.selftype==='supplier'){
         await this.$store.dispatch('getAppMenuSupplier')
      }else if(this.selftype==='partner'){
         await this.$store.dispatch('getAppMenuPartner')
      }
      this.cacheUserId = ''
      this.getTj()
      this.getHotLineConfig()
   },
@@ -639,6 +663,7 @@
      }
      // #endif
   },
   created() {
@@ -647,15 +672,42 @@
   async onPullDownRefresh() {
      // 需要判断当前是否是子账号,如果是子账号则需要刷新账号切换的信息
      const currentInfo = this.$store.state.currentInfo
      if (currentInfo && currentInfo.supplierSub && currentInfo.supplierSub.id) {
         await this.$store.dispatch('getSwitchSubAccount', currentInfo.supplierSub)
      } else {
         await this.$store.dispatch('getCurrentInfo')
      }
      // const currentInfo = this.$store.state.currentInfo
      // if (currentInfo && currentInfo.supplierSub && currentInfo.supplierSub.id) {
      //    await this.$store.dispatch('getSwitchSubAccount', currentInfo.supplierSub)
      // } else {
      //    await this.$store.dispatch('getCurrentInfo')
      // }
      await this.$store.dispatch('getCurrentInfo')
      uni.stopPullDownRefresh()
   },
   methods: {
      async getHotLineConfig() {
         this.$message.showLoading()
         const {
            code,
            data
         } = await this.$http.request('get', `/v2/config-param/base/getBaseString`, {
            params: {
               paramGroup: "servicehotline",
               paramKey: "hotline_tel"
            }
         })
         this.$message.hideLoading()
         if (code === 0) {
            // 电话
            console.log(data)
            this.tel =data
         }
      },
      switchSubAccount() {
         uni.navigateTo({
            url: '/sub_pages/supplier/sub-account/sub-account-switch-list'
         })
      },
      async bindPartnerUser(userId, name) {
         // await this.$message.confirm(`确定要绑定${name}合伙人吗?`)
         //调用接口绑定
@@ -822,4 +874,17 @@
@import "./user-customer.scss";
</style>
<!-- #endif -->
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.account_sub {
    width: 80rpx;
    height: 24rpx;
    border-radius: 30rpx;
    border: 2rpx solid #23A9F2;
    font-size: 18rpx;
    color: white;
    line-height: 20rpx;
    text-align: center;
    background-color: #23A9F2;
    margin-left: 10px !important;
}
</style>