Browse Source

控制微信快捷菜单点击社保

dujingxian 4 years ago
parent
commit
76cc98733d
2 changed files with 23 additions and 3 deletions
  1. 2 0
      .gitignore
  2. 21 3
      src/views/social/social.ts

+ 2 - 0
.gitignore

@@ -1 +1,3 @@
 node_modules
+
+dist

+ 21 - 3
src/views/social/social.ts

@@ -1,8 +1,8 @@
-import {Component, Vue} from 'vue-property-decorator';
+import {Component, Vue, Watch} from 'vue-property-decorator';
 import Utils from '@/extend/Utils';
 import Http from '@/extend/Http';
 import router from '@/router';
-import {MessageBox} from 'element-ui';
+import {MessageBox, Message} from 'element-ui';
 
 const serviceChargeData: any = [
     {
@@ -45,7 +45,9 @@ export default class Social extends Vue {
         couponSelected:'',
         sociallist:[{id: 1, name: "本地城镇"}, {id: 2, name: "本地农村"}, {id: 3, name: "外埠城镇"}, {id: 4, name: "外埠农村"}],
         // 附加费用 残保金
-        append_cost: []
+        append_cost: [],
+        // 是否是城镇户口 true-是城镇
+        is_town: true
     };
 
      private service_charge_type: string = 'monthly';
@@ -65,6 +67,7 @@ export default class Social extends Vue {
         this.data.mobile = localStorage.getItem('mobile')
         this.data.citycode = localStorage.getItem('citycode')
         this.data.cityname = localStorage.getItem('cityname')
+        this.data.is_town = localStorage.getItem('is_town')
         let res = await Http.getInstance().getProvinceList();
         this.data.sheng = res.data.prolist
         this.data.shi = res.data.citylist
@@ -84,6 +87,7 @@ export default class Social extends Vue {
             // this.data.social_type = this.data.social_type - 1;
         }
         this.data.service_charge = serviceChargeData[this.data.is_fund];
+        this.getIsFund()
     }
     async chooseShi(){
         let res = await Http.getInstance().getCityList({
@@ -221,4 +225,18 @@ export default class Social extends Vue {
             }
         });
     }
+
+    // 监听,防止用户从微信快捷菜单点击进来
+    getIsFund() {
+        let path = window.location.href
+        // console.log('path', path, this.data.is_town);
+        if (path.indexOf('/social?is_fund=0') > -1 && this.data.is_town == 'true') {
+            this.$router.push('/index')
+            Message({
+                message: '城镇户口只能交五险一金,不能交社保',
+                type: 'warning'
+            });
+        }
+        
+    }
 }