Selaa lähdekoodia

fix:超级订阅经销商画像

tsz 3 vuotta sitten
vanhempi
commit
95e7aefd01

+ 24 - 19
src/views/medical-field/MedicalPortrait.vue

@@ -17,7 +17,7 @@
           </div>
         </div>
         <div class="me-head-right">
-          <div class="u-follow" @click="setFollow">
+          <div class="u-follow" @click="setClickClaim">
             <span :class="{ icon_claim_yes: follow.followed, icon_claim_no: !follow.followed }"></span>
             <span class="follow_text">{{ follow.followed ? '取消认领' : '认领' }}</span>
           </div>
@@ -92,7 +92,7 @@ export default {
   },
   created () {
     this.mid = this.$route.params.mid
-    this.setFollow('init')
+    this.setFollow()
     this.getMedicalInst()
   },
   computed: {
@@ -101,14 +101,14 @@ export default {
     }),
     setBusstype () {
       switch (this.info.business_type) {
-        case 0:
-          return '公立'
         case 1:
-          return '民营'
+          return '公立'
         case 2:
-          return '其他'
+          return '民营'
+        case 3:
+          return '其它'
         default:
-          return '其他'
+          return '其'
       }
     },
     getCompany () {
@@ -136,7 +136,7 @@ export default {
         this.infoloading = false
       })
     },
-    setFollow (str) {
+    setFollow () {
       this.follow.loading = true
       const param = {
         company_id: this.mid,
@@ -145,19 +145,18 @@ export default {
       // 查询是否认领
       isClaimed(param).then(res => {
         if (res.error_code === 0) {
-          if (str === 'init') {
-            this.follow.followed = res.data.status
-          } else {
-            if (res.data.status) {
-              this.setCancelClaim()
-            } else {
-              this.setOptionClaim()
-            }
-          }
+          this.follow.followed = res.data.status
           this.follow.loading = false
         }
       })
     },
+    setClickClaim () {
+      if (this.follow.followed) {
+        this.setCancelClaim()
+      } else {
+        this.setOptionClaim()
+      }
+    },
     // 认领
     setOptionClaim () {
       const param = {
@@ -165,7 +164,10 @@ export default {
         ent_id: this.mid
       }
       setClaim(param).then(res => {
-        if (res.error_code === 0) {
+        if (!(res && res.error_code === 0 && res.error_msg === '')) {
+          this.follow.followed = false
+          this.$toast(res.error_msg)
+        } else if (res.error_code === 0) {
           this.follow.followed = true
           this.$toast('认领成功')
         } else if (res.error_code === 1013) {
@@ -183,7 +185,10 @@ export default {
         ent_id: this.mid
       }
       institutionUnclaimed(param).then(res => {
-        if (res.error_code === 0) {
+        if (!(res && res.error_code === 0 && res.error_msg === '')) {
+          this.follow.followed = true
+          this.$toast(res.error_msg)
+        } else if (res.error_code === 0) {
           this.follow.followed = false
           this.$toast('取消认领成功')
         } else {

+ 10 - 5
src/views/portrayal/EntPortrayal.vue

@@ -84,7 +84,7 @@ import EntFollowStar from './components/EntFollowStar.vue'
 import { mapState } from 'vuex'
 import { Dialog, Input, TabPane, Tabs } from 'element-ui'
 import { dateFormatter, moneyUnit } from '@/utils'
-import { getEntWinnerSelect, distributorClaimed, distributorUnclaimed, isClaimed } from '@/api/modules'
+import { getEntWinnerSelect, distributorClaim, distributorUnclaimed, isClaimed } from '@/api/modules'
 
 function getImgForVipUpgrade (name, bg = false, suffix = '.png') {
   return require('@/assets/images/vip/' + (bg ? 'bg/mask/' : '') + name + suffix)
@@ -370,8 +370,11 @@ export default {
         ent_name: this.entName,
         ent_id: this.eId
       }
-      distributorClaimed(param).then(res => {
-        if (res.error_code === 0) {
+      distributorClaim(param).then(res => {
+        if (!(res && res.error_code === 0 && res.error_msg === '')) {
+          this.claim.claimed = false
+          this.$toast(res.error_msg)
+        } else if (res.error_code === 0) {
           this.claim.claimed = true
           this.$toast('认领成功')
         } else if (res.error_code === 1013) {
@@ -389,9 +392,11 @@ export default {
         ent_id: this.eId
       }
       distributorUnclaimed(param).then(res => {
-        if (res.error_code === 0) {
+        if (!(res && res.error_code === 0 && res.error_msg === '')) {
+          this.$toast(res.error_msg)
+        } else if (res.error_code === 0) {
           this.claim.claimed = false
-          this.$toast('取消认领')
+          this.$toast('取消认领成功')
         } else {
           this.$toast(res.error_msg)
         }

+ 23 - 9
src/views/portrayal/EntSearchPortrayal.vue

@@ -2,11 +2,13 @@
   <Layout class="ent-portrayal">
     <div class="ent-header">
       <div class="name">{{ entName }}</div>
-      <EntFollowStar :id="eId" />
-      <div style="margin-left:10px;" @click="setClickClaim">
-        <div class="u-follow">
-          <span :class="{ icon_claim_yes: claim.claimed, icon_claim_no: !claim.claimed }"></span>
-          <span class="follow-text">{{ claim.claimed ? '取消认领' : '认领' }}</span>
+      <div class="ent_option">
+        <EntFollowStar :id="eId" />
+        <div style="margin-left:10px;" @click="setClickClaim">
+          <div class="u-follow">
+            <span :class="{ icon_claim_yes: claim.claimed, icon_claim_no: !claim.claimed }"></span>
+            <span class="follow-text">{{ claim.claimed ? '取消认领' : '认领' }}</span>
+          </div>
         </div>
       </div>
     </div>
@@ -145,6 +147,10 @@ export default {
         start: 0,
         end: 0
       },
+      claim: {
+        claimed: false,
+        loading: false
+      },
       eId: this.$route.params.eId,
       entName: '',
       pagePowerInfo: {
@@ -549,7 +555,10 @@ export default {
         ent_id: this.eId
       }
       distributorClaimed(param).then(res => {
-        if (res.error_code === 0) {
+        if (!(res && res.error_code === 0 && res.error_msg === '')) {
+          this.claim.claimed = false
+          this.$toast(res.error_msg)
+        } else if (res.error_code === 0) {
           this.claim.claimed = true
           this.$toast('认领成功')
         } else if (res.error_code === 1013) {
@@ -567,9 +576,11 @@ export default {
         ent_id: this.eId
       }
       distributorUnclaimed(param).then(res => {
-        if (res.error_code === 0) {
+        if (!(res && res.error_code === 0 && res.error_msg === '')) {
+          this.$toast(res.error_msg)
+        } else if (res.error_code === 0) {
           this.claim.claimed = false
-          this.$toast('取消认领')
+          this.$toast('取消认领成功')
         } else {
           this.$toast(res.error_msg)
         }
@@ -656,7 +667,10 @@ export default {
     align-items: center;
     padding: 32px 40px;
     background: #fff;
-
+    .ent_option{
+      display: flex;
+      align-items: center;
+    }
     .name {
       font-size: 24px;
       color: #171826;