contract-record.vue 10.1 KB
Newer Older
李晓兵's avatar
李晓兵 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
<template>
  <h-view id="contract-record" class="public-style">
    <h-header :proportion="[5,1,1]" class="bar-custom">
      <div slot="left" class="h-header-btn">
        <img src="@/assets/userBind/arrow.png" @click="$routeGo()" >
        <span>合同记录</span>
      </div>
    </h-header>
    <h-content class="my-content" style="margin-top:-1px">
      <div class="top-head">
        <div class="center">
          <div class="now-pay">
            <div class="title">当前应付</div>
            <div class="data">
              <span></span>
              {{ money |currency }}
            </div>
          </div>
        </div>
      </div>
      <section class="pay-content">
        <section v-for="(item,index) in prj_lists" :key="index" class="contract-item">
          <div class="header">
            <img src="@/assets/payment/file.png" >
            <p>&nbsp; {{ item.project_number }}</p>
            <span>{{ item.bp_name }}</span>
          </div>
          <div class="content">
            <div v-for="(e,i) in item.cf_lists" :key="i" class="list-item">
              <span class="item-left">{{ e.cf_item_name }}</span>
              <div class="item-center">
                <p>应还金额</p>
                <p>已还金额</p>
                <p>本次还款</p>
              </div>
              <div class="item-right">
                <p>{{ parseFloat(e.due_amount).toFixed(2)|currency }}</p>
                <p>{{ e.received_amount|currency }}</p>
linxin's avatar
linxin committed
39
              <CurrencyInput v-model="e.amount" placeholder="请输入还款金额"/></div>
李晓兵's avatar
李晓兵 committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
            </div>
          </div>
        </section>
      </section>
      <div class="prompt">
        <div>
          <img src="@/assets/payment/prompt.png" alt >
        </div>
        <div>
          <p>温馨提示</p>
          <p>推荐使用农行卡,农行卡支付免收手续费!</p>
          <p>由于存在款项到账时差性,“已还金额”字段可能XXX,给您造成的不便,请谅解,谢谢!</p>
        </div>
      </div>
      <bottom-tab>
        <tab-button class="footer" @click.native="createDetail">&nbsp;&nbsp;</tab-button>
      </bottom-tab>
    </h-content>
  </h-view>
</template>

<script>
linxin's avatar
linxin committed
62
import CurrencyInput from '../../../components/currencyInput'
李晓兵's avatar
李晓兵 committed
63
export default {
linxin's avatar
linxin committed
64 65 66
  components: {
    CurrencyInput,
  },
李晓兵's avatar
李晓兵 committed
67 68 69 70 71 72 73
  data () {
    return {
      money: 0,
      prj_lists: [],
    }
  },
  watch: {
linxin's avatar
linxin committed
74
    'prj_lists': {
李晓兵's avatar
李晓兵 committed
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
      handler (newName, oldName) {
        let vm = this
        let sumL = []
        for (let i of this.prj_lists) {
          i.cf_lists.forEach(j => {
            sumL.push(j.amount)
          })
          let a = 0
          let newSum = sumL.filter(item => {
            return item !== ''
          })
          let notNaN = newSum.filter(item => {
            return !isNaN(item)
          })
          if (notNaN.length !== 0) {
            notNaN.forEach(i => {
              a = a + parseFloat(i)
              vm.money = a
            })
          } else {
            vm.money = 0
          }
        }
      },
      deep: true,
linxin's avatar
linxin committed
100
      immediate: true,
李晓兵's avatar
李晓兵 committed
101 102 103 104 105 106 107
    },
  },
  beforeRouteEnter (to, from, next) {
    next(vm => {
      vm.getDetail()
    })
  },
linxin's avatar
linxin committed
108 109 110
  mounted () {
    console.log(this.prj_lists)
  },
李晓兵's avatar
李晓兵 committed
111 112 113 114 115 116 117 118 119 120 121 122
  methods: {
    getDetail () {
      let vm = this
      let url = process.env.basePath + 'payment_prj_list_query'
      let param = {
        bp_id: window.sessionStorage.getItem('bp_id'),
      }
      hlsPopup.showLoading('请稍候')
      vm.$post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.prj_lists = res.prj_lists
linxin's avatar
linxin committed
123 124
          vm.prj_lists.forEach(i => {
            i.cf_lists.forEach(j => {
linxin's avatar
linxin committed
125
              let num = (parseFloat(j.due_amount) - parseFloat(j.received_amount)).toFixed(2)
linxin's avatar
linxin committed
126
              vm.$set(j, 'amount', num)
linxin's avatar
linxin committed
127 128
            })
          })
李晓兵's avatar
李晓兵 committed
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
    makeDetailData () {
      let data = []
      this.prj_lists.forEach(i => {
        i.cf_lists.forEach(j => {
          j.project_id = i.project_id
          data.push(j)
        })
      })
      data.forEach(i => {
        delete i.cf_item_name
        delete i.due_amount
        delete i.received_amount
        delete i.project_number
        i.bp_id = window.sessionStorage.getItem('bp_id')
      })
      return data
    },
    createDetail () {
      let vm = this
      let url = process.env.basePath + 'create_detail_0_part'
      let data = vm.makeDetailData()
      let param = {
        order_id: window.sessionStorage.getItem('order_id'),
        pay_lists: data,
      }
      hlsPopup.showLoading('请稍候')
      vm.$post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.toPayEntry(vm.money)
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
    toPayEntry (money) {
      this.$router.push({
        name: 'PayEntry',
        params: {
          money,
        },
      })
    },
  },
}
</script>
<style lang='less' >
#contract-record {
  .top-head {
    position: relative;
    width: 100%;
    height: 142px;
    background: url("../../../assets/payment/back1.png");
    background-size: 100% 142px;
  }
  .center {
    .now-pay {
      width: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      flex-flow: column wrap;
    }
    .title {
      font-family: PingFangSC-Regular;
      font-size: 14px;
      color: #ffffff;
      margin-top: 1.8%;
    }
    .data {
      font-family: Verdana-Bold;
      font-size: 24px;
      color: #ffffff;
      letter-spacing: 0;
      line-height: 18px;
      margin-top: 16px;
    }
  }

  .pay-content {
    position: absolute;
    bottom: 150px;
    width: 100%;
    //margin-top:-60px;
linxin's avatar
linxin committed
218 219
    // height: 370px;
    height:7.4rem;
李晓兵's avatar
李晓兵 committed
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 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 387
    overflow: scroll;
    //background-color: #FFF;
    .contract-item {
      width: 95%;
      background-color: #fff;
      margin: 0 auto;
      box-shadow: 0 1px 3px 2px rgba(168, 168, 168, 0.14);

      .header {
        height: 44px;
        background: #fff;
        display: flex;
        font-family: PingFangSC-Semibold;
        font-size: 15px;
        color: #383f45;
        letter-spacing: 0;
        line-height: 44px;
        padding: 0 16px;

        img {
          height: 30px;
          margin-top: 10px;
          margin-right: 6px;
        }

        p {
          flex: 2;
          border-bottom: 1px solid #f3f3f7;
          font-weight: 700;
        }

        span {
          border-bottom: 1px solid #f3f3f7;
          font-weight: 700;
        }
      }

      .title {
        padding: 0 16px;
        font-family: PingFangSC-Regular;
        font-size: 13px;
        color: #383f45;

        div {
          border-bottom: 1px solid #eee;
          display: flex;
          text-align: center;
          padding: 0 14px;
          height: 37px;
          line-height: 37px;
          justify-content: space-between;
        }
      }

      .content {
        margin-bottom: 8px;
        background-color: #fff;
        .list-item:not(:last-of-type) {
          background: url("../../../assets/payment/border.png") 0px 90px
            no-repeat;
        }
        .list-item {
          display: flex;
          justify-content: space-around;
          align-items: center;
          height: 99px;
          padding-bottom: 12px;
          .item-left {
            font-family: PingFangSC-Semibold;
            font-size: 13px;
            color: #383f45;
            letter-spacing: 0;
            // flex: 3;
            margin-top: -63px;
          }
          .item-center {
            font-family: PingFangSC-Regular;
            font-size: 13px;
            color: rgba(56, 63, 69, 0.6);
            letter-spacing: 0;
            line-height: 30px;
            // flex: 5;
          }
          .item-right {
            // flex: 4;
            line-height: 30px;

            p:nth-of-type(1) {
              font-family: Verdana-Bold;
              font-size: 12px;
              color: #1d3fff;
              letter-spacing: 0;
              text-align: right;
            }
            p:nth-of-type(2) {
              font-family: Verdana-Bold;
              font-size: 12px;
              color: #383f45;
              letter-spacing: 0;
              text-align: right;
            }
            input {
              width: 90px;
              border: none;
              border-bottom: 1px solid #1d3fff;
              font-size: 13px;
              text-align: right;
              float: right;
            }
            input::placeholder {
              font-family: PingFangSC-Regular;
              font-size: 13px;
              color: rgba(56, 63, 69, 0.4);
              letter-spacing: 0;
            }
          }
        }
      }
    }
  }

  .prompt {
    position: absolute;
    width: 100%;
    bottom: 40px;
    background: rgba(142, 195, 30, 0.1);
    height: 111px;
    display: flex;
    div:first-child {
      flex: 1;
      padding: 16px 0 0 16px;

      img {
        width: 16px;
        height: 16px;
      }
    }

    div:last-child {
      flex: 12;

      p:first-child {
        padding-top: 16px;
        font-family: PingFangSC-Semibold;
        font-size: 14px;
        color: #8ec31e;
        letter-spacing: 0.5px;
        margin-bottom: 7px;
      }

      p:nth-child(n + 2) {
        text-indent: 2em;
        line-height: 20px;
        padding-right: 16px;
        font-family: PingFangSC-Regular;
        font-size: 12px;
        color: rgba(101, 100, 100, 0.8);
        letter-spacing: 0.37px;
        margin-left: -22px;
      }
    }
  }

  .footer {
    background-color: @headerColor;
    color: #fff;
  }
}
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
.platform-ios {
  #contract-record  {
    .pay-content {
      height: 370px;
    }
  }
}
@media (device-width: 375px) and (device-height: 812px) and (-webkit-min-device-pixel-ratio: 3) {
  .platform-ios {
    #contract-record {
      .pay-content {
        height: 9.4rem;
      }
    }
  }
}
// iPhoneXR适配
@media (device-width: 414px) and (device-height: 896px) {
  .platform-ios {
    #contract-record {
      .pay-content {
        height: 9.4rem;
      }
    }
  }
}

李晓兵's avatar
李晓兵 committed
415
</style>