my-info.vue 12 KB
Newer Older
李晓兵's avatar
李晓兵 committed
1
<template>
linxin's avatar
linxin committed
2 3 4 5 6 7 8 9
  <h-view id="my-info">
    <div class="top">
      <h-header class="header">
        <div slot="center" class="top-word">个人中心</div>
      </h-header>
      <div class="card">
        <div class="card-info">
          <div class="card-top">
linxin's avatar
linxin committed
10 11
            <img src="@/assets/myInfo/1.jpg" @click="changePageHead" >
            <span>{{ user_phone }}</span>
linxin's avatar
linxin committed
12 13 14 15 16 17
          </div>
          <div class="card-bottom">
            <div>
              <img src="@/assets/myInfo/car.png" >
              <p>发车申请</p>
            </div>
linxin's avatar
linxin committed
18
            <div @click="changePay">
linxin's avatar
linxin committed
19 20 21
              <img src="@/assets/myInfo/pay.png" >
              <p>首付还款</p>
            </div>
linxin's avatar
linxin committed
22
            <div @click="changeRent">
linxin's avatar
linxin committed
23 24 25 26 27
              <img src="@/assets/myInfo/refund.png" >
              <p>租金还款</p>
            </div>
          </div>
        </div>
李晓兵's avatar
李晓兵 committed
28
      </div>
linxin's avatar
linxin committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
    </div>
    <h-content class="my-content">
      <div class="userInfo">我的合同</div>
      <div class="my-contract">
        <div>
          <img src="@/assets/myInfo/unSign.png" >
          <p>待签约</p>
        </div>
        <div>
          <img src="@/assets/myInfo/unConfirm.png" >
          <p>待确认</p>
        </div>
        <div>
          <img src="@/assets/myInfo/unFace.png" >
          <p>待面签</p>
        </div>
        <div>
          <img src="@/assets/myInfo/carConfirm.png" >
          <p>发车确认</p>
        </div>
      </div>
      <list-item :item-height="44" class="list">
        <item>
          <img slot="left-icon" src="@/assets/myInfo/myRefund.png" class="left-icon" >
          <div slot="name">我的还款</div>
linxin's avatar
linxin committed
54
        </item>
linxin's avatar
linxin committed
55 56 57
        <item>
          <img slot="left-icon" src="@/assets/myInfo/repay.png" class="left-icon" >
          <div slot="name">业务退款</div>
李晓兵's avatar
李晓兵 committed
58
        </item>
linxin's avatar
linxin committed
59 60 61
        <item>
          <img slot="left-icon" src="@/assets/myInfo/collect.png" class="left-icon" >
          <div slot="name">我的收藏</div>
李晓兵's avatar
李晓兵 committed
62
        </item>
linxin's avatar
linxin committed
63 64 65 66 67 68 69 70
        <item>
          <img slot="left-icon" src="@/assets/myInfo/help.png" class="left-icon" >
          <div slot="name">帮助与反馈</div>
        </item>
        <item>
          <img slot="left-icon" src="@/assets/myInfo/about.png" class="left-icon" >
          <div slot="name">关于徐工</div>
        </item>
linxin's avatar
linxin committed
71
        <item @click.native="updateVersion">
linxin's avatar
linxin committed
72
          <img slot="left-icon" src="@/assets/myInfo/refresh.png" class="left-icon" >
linxin's avatar
linxin committed
73 74 75
          <div slot="name">检查更新</div>
        </item>
        <item @click.native="logOut">
linxin's avatar
linxin committed
76
          <img slot="left-icon" src="@/assets/myInfo/exit.png" class="left-icon" >
linxin's avatar
linxin committed
77 78
          <div slot="name">退出登录</div>
        </item>
linxin's avatar
linxin committed
79 80
        <button v-if="flag" @click="changePageHead">用户绑定</button>
        <button v-if="!flag" @click="unBind">解除绑定</button>
李晓兵's avatar
李晓兵 committed
81 82
      </list-item>
    </h-content>
linxin's avatar
linxin committed
83
  </h-view>
李晓兵's avatar
李晓兵 committed
84 85 86 87
</template>
<script>
export default {
  data () {
linxin's avatar
linxin committed
88
    return {
linxin's avatar
linxin committed
89
      flag: true,
linxin's avatar
linxin committed
90
      isAGENT: false,
linxin's avatar
linxin committed
91 92 93
      user_bp_status: '',
      user_bp_class: '',
      bp_id: '',
linxin's avatar
linxin committed
94
      user_phone: '',
linxin's avatar
linxin committed
95
      user_bp_name: '',
linxin's avatar
linxin committed
96
      user_bp_type: '',
linxin's avatar
linxin committed
97 98
    }
  },
linxin's avatar
linxin committed
99
  watch: {
linxin's avatar
linxin committed
100
    'user_bp_status' (newVal, oldVal) {
linxin's avatar
linxin committed
101 102 103 104 105 106
      if (newVal === 'APPROVED') {
        this.flag = false
      } else {
        this.flag = true
      }
    },
linxin's avatar
linxin committed
107 108 109 110 111 112 113
    'user_bp_type' (newVal, oldVal) {
      if (newVal === 'AGENT') {
        this.isAGENT = true
      } else {
        this.isAGENT = false
      }
    },
linxin's avatar
linxin committed
114
  },
linxin's avatar
linxin committed
115
  created () {
linxin's avatar
linxin committed
116 117
    if (this.user_bp_status === 'APPROVED') {
      this.flag = false
linxin's avatar
linxin committed
118
    } else {
linxin's avatar
linxin committed
119
      this.flag = true
linxin's avatar
linxin committed
120
    }
linxin's avatar
linxin committed
121 122 123 124 125
    if (this.user_bp_type === 'AGENT') {
      this.isAGENT = true
    } else {
      this.isAGENT = false
    }
linxin's avatar
linxin committed
126 127 128 129 130
  },
  beforeRouteEnter (to, from, next) {
    next(vm => {
      vm.userQuery()
    })
linxin's avatar
linxin committed
131
    next()
李晓兵's avatar
李晓兵 committed
132
  },
linxin's avatar
linxin committed
133
  activated () {},
李晓兵's avatar
李晓兵 committed
134
  methods: {
linxin's avatar
linxin committed
135 136 137
    changePay () {
      this.$router.push({
        name: 'FirstPay',
linxin's avatar
linxin committed
138 139 140
        params: {
          bp_id: this.bp_id,
        },
linxin's avatar
linxin committed
141 142 143 144 145
      })
    },
    changeRent () {
      this.$router.push({
        name: 'PaymentFirstPay',
linxin's avatar
linxin committed
146 147 148
        params: {
          bp_id: this.bp_id,
        },
linxin's avatar
linxin committed
149 150
      })
    },
李晓兵's avatar
李晓兵 committed
151 152
    updateVersion () {
      if (vum.Platform.isAndroid()) {
linxin's avatar
linxin committed
153 154 155 156
        this.hote_update_version(
          '发现新版本是否更新',
          'http://hlsapp.hand-china.com/file/XCMG/www/android/www.zip'
        )
李晓兵's avatar
李晓兵 committed
157
      } else {
linxin's avatar
linxin committed
158 159 160 161
        this.hote_update_version(
          '发现新版本是否更新',
          'http://hlsapp.hand-china.com/file/XCMG/www/ios/www.zip'
        )
李晓兵's avatar
李晓兵 committed
162 163 164 165 166 167 168 169 170 171 172 173 174
      }
    },
    hote_update_version (content, url) {
      hlsPopup.showConfirm({
        title: '版本更新',
        content: content,
        onConfirm: function (index) {
          if (index === 1) {
            hotpatch.updateNewVersion(url)
          }
        },
      })
    },
李晓兵's avatar
李晓兵 committed
175 176 177 178 179 180 181 182 183 184 185 186 187
    logOut () {
      let vm = this
      hlsPopup.showConfirm({
        title: '提示',
        content: '确定退出',
        onConfirm: function (index) {
          if (index === 1) {
            window.localStorage.clear()
            vm.$router.push('/login')
          }
        },
      })
    },
linxin's avatar
linxin committed
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
    unBind () {
      let vm = this
      hlsPopup.showConfirm({
        title: '提示',
        content: '确定解除绑定?',
        onConfirm: function (index) {
          if (index === 1) {
            // window.localStorage.clear()
            // vm.$router.push('/login')
            let myPhone = window.localStorage.getItem('user_phone')
            let myPassword = window.localStorage.getItem('password')
            let url = process.env.basePath + 'bp_unbind'
            let param = {
              master: {
                phone: myPhone,
                password: myPassword,
              },
            }
            vm.hlsPopup.showLoading('请稍候')
            vm.hlsHttp
              .post(url, param)
              .then(function (res) {
                vm.hlsPopup.hideLoading()
                if (res.result === 'S') {
linxin's avatar
linxin committed
212 213 214 215 216
                  vm.hlsPopup.showLongCenter('解绑成功')
                  vm.userQuery()
                  vm.flag = true
                } else {
                  vm.hlsPopup.showLongCenter(res.message)
linxin's avatar
linxin committed
217 218 219
                }
              })
              .catch(() => {
linxin's avatar
linxin committed
220
                vm.hlsPopup.showLongCenter('传入参数异常')
linxin's avatar
linxin committed
221 222 223 224 225
              })
          }
        },
      })
    },
linxin's avatar
linxin committed
226 227 228 229
    changePageHead () {
      let vm = this
      if (vm.bp_id) {
        if (vm.user_bp_status === 'NEW' || vm.user_bp_status === 'REJECT') {
linxin's avatar
linxin committed
230
          vm.flag = true
linxin's avatar
linxin committed
231 232 233 234
          if (vm.user_bp_class === 'NP') {
            vm.$router.push({
              name: 'NaturePerson',
              params: {
linxin's avatar
linxin committed
235
                bp_id: this.bp_id,
linxin's avatar
linxin committed
236
                user_bp_name: this.user_bp_name,
linxin's avatar
linxin committed
237 238 239 240
              },
            })
          } else {
            this.$router.push({
linxin's avatar
linxin committed
241
              name: 'Enterprise',
linxin's avatar
linxin committed
242
              params: {
linxin's avatar
linxin committed
243
                bp_id: this.bp_id,
linxin's avatar
linxin committed
244
                user_bp_name: this.user_bp_name,
linxin's avatar
linxin committed
245 246 247 248
              },
            })
          }
        } else if (vm.user_bp_status === 'APPROVED') {
linxin's avatar
linxin committed
249
          vm.flag = false
linxin's avatar
linxin committed
250 251
          if (vm.user_bp_class === 'NP') {
            vm.$router.push({
linxin's avatar
linxin committed
252
              name: 'NaturePerson',
linxin's avatar
linxin committed
253
              params: {
linxin's avatar
linxin committed
254
                bp_id: this.bp_id,
linxin's avatar
linxin committed
255
                user_bp_name: this.user_bp_name,
linxin's avatar
linxin committed
256
                isAGENT: this.isAGENT,
linxin's avatar
linxin committed
257
                status: 'APPROVED',
linxin's avatar
linxin committed
258 259 260 261
              },
            })
          } else {
            this.$router.push({
linxin's avatar
linxin committed
262
              name: 'Enterprise',
linxin's avatar
linxin committed
263
              params: {
linxin's avatar
linxin committed
264
                bp_id: this.bp_id,
linxin's avatar
linxin committed
265
                user_bp_name: this.user_bp_name,
linxin's avatar
linxin committed
266
                isAGENT: this.isAGENT,
linxin's avatar
linxin committed
267
                status: 'APPROVED',
linxin's avatar
linxin committed
268 269 270 271
              },
            })
          }
        } else if (vm.user_bp_status === 'APPROVING') {
linxin's avatar
linxin committed
272
          vm.flag = true
linxin's avatar
linxin committed
273 274 275
          this.hlsPopup.showLongCenter('您的绑定申请还在流程中')
        }
      } else {
linxin's avatar
linxin committed
276
        vm.flag = true
linxin's avatar
linxin committed
277 278 279 280
        this.$router.push({
          name: 'UserBind',
        })
        // this.hlsPopup.showLongCenter('请先进行用户绑定')
linxin's avatar
linxin committed
281 282 283 284 285 286
      }
    },
    userQuery () {
      let vm = this
      let url = $config.basePath + 'user_query'
      let param = {
linxin's avatar
linxin committed
287
        phone: window.localStorage.getItem('user_phone'),
linxin's avatar
linxin committed
288 289 290
      }
      vm.$post(url, param).then(function (res) {
        if (res.result === 'S') {
linxin's avatar
linxin committed
291 292 293
          if (res.info.user_bp_status === 'APPROVED') {
            vm.flag = false
          }
linxin's avatar
linxin committed
294 295 296
          vm.user_bp_status = res.info.user_bp_status
          vm.user_bp_class = res.info.user_bp_class
          vm.bp_id = res.info.user_bp_id
linxin's avatar
linxin committed
297
          vm.user_bp_name = res.info.user_bp_name
linxin's avatar
linxin committed
298
          vm.user_bp_type = res.info.user_bp_type
linxin's avatar
linxin committed
299
          vm.user_phone = res.info.user_phone
linxin's avatar
linxin committed
300 301
        } else {
          this.hlsPopup.showLongCenter(res.message)
linxin's avatar
linxin committed
302 303 304
        }
      })
    },
李晓兵's avatar
李晓兵 committed
305 306 307 308
  },
}
</script>

linxin's avatar
linxin committed
309
<style lang="less" scoped>
linxin's avatar
linxin committed
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386
#my-info {
  .top {
    width: 100%;
    height: 206px;
    background: url("../../assets/myInfo/back.png") no-repeat;
    background-size: 100% 206px;
    .header {
      background-color: rgba(0, 0, 0, 0);
      .top-word {
        font-family: PingFangSC-Semibold;
        font-size: 17px;
        letter-spacing: 0.61px;
        color: #fff;
      }
    }
    .card {
      width: 343px;
      height: 217px;
      margin: 0 auto;
      z-index: 10;
      position: relative;
      top: 0px;
      left: 0px;
      background-color: #fff;
      box-shadow: 0 2px 17px -1px rgba(0, 0, 0, 0.1);
      border-radius: 4px;
      .card-info {
        width: 295px;
        margin: 0 auto;
        .card-top {
          height: 110px;
          display: flex;
          align-items: center;
          border-bottom: 1px solid #d9dbdf;
          img {
            width: 59px;
            height: 59px;
            border-radius: 50%;
            border: 1px solid #00469c;
          }
          span {
            font-family: PingFangSC-Semibold;
            font-size: 18px;
            color: #383f45;
            margin-left: 24px;
          }
        }
        .card-bottom {
          height: 100px;
          width: 285px;
          margin: 0 auto;
          display: flex;
          justify-content: space-between;
          align-items: center;
          text-align: center;
          p {
            font-family: PingFangSC-Regular;
            font-size: 13px;
            color: #3c3d48;
            margin-top: 5px;
          }
          img {
            width: 48px;
            height: 48px;
          }
        }
      }
    }
  }
  .my-content {
    .userInfo {
      height: 45px;
      line-height: 45px;
      color: #00469c;
      font-size: 15px;
      margin-left: 16px;
      position: relative;
linxin's avatar
linxin committed
387
      margin-top: 70px;
linxin's avatar
linxin committed
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432
    }
    .userInfo::before {
      content: "";
      display: block;
      width: 4px;
      height: 20px;
      background-color: #00469c;
      position: absolute;
      left: -15px;
      top: 12px;
    }
    .my-contract {
      width: 295px;
      margin: 0 auto;
      display: flex;
      justify-content: space-between;
      align-items: center;
      text-align: center;
      img {
        width: 38px;
        height: 38px;
      }
      p {
        font-family: PingFangSC-Regular;
        font-size: 12px;
        color: #383f45;
        margin-top: 5px;
      }
    }
    .list {
      font-family: PingFangSC-Regular;
      font-size: 14px;
      color: #656464;
      letter-spacing: 0;
      line-height: 18px;
      border-top: 1px solid rgba(0, 0, 0, 0.1);
      margin-top: 20px;
    }
  }
  button {
    width: 359px;
    height: 40px;
    background: #00469c;
    border-radius: 4px;
    color: #fff;
李晓兵's avatar
李晓兵 committed
433
    margin-bottom: 68px;
linxin's avatar
linxin committed
434
    margin-left:2%;
李晓兵's avatar
李晓兵 committed
435
    margin-top: 20px;
linxin's avatar
linxin committed
436 437 438 439
  }
}
.content {
  background-color: #fff;
linxin's avatar
linxin committed
440
}
李晓兵's avatar
李晓兵 committed
441
</style>
linxin's avatar
linxin committed
442 443 444 445 446 447 448 449 450 451 452 453 454
  <!-- <list-item :item-height="45">
        <item :show-arrow="true" @click.native="changePageHead">
          <div slot="name">头像</div>
        </item>
        <item :show-arrow="true" @click.native="updateVersion">
          <div slot="name">检查更新</div>
        </item>
        <item :show-arrow="true" @click.native="logOut">
          <div slot="name">退出登录</div>
        </item>
      </list-item>
      <button v-if="flag" @click="changePageHead">用户绑定</button>
      <button v-if="!flag" @click="unBind">解除绑定</button> -->