contract-record.vue 11 KB
Newer Older
李晓兵's avatar
李晓兵 committed
1 2 3 4 5 6 7 8
<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>
9
    <div class="my-content" style="margin-top:-1px">
李晓兵's avatar
李晓兵 committed
10 11 12 13 14 15 16 17 18 19 20
      <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>
21 22 23
      <scroll
        ref="scroll" :updateData="[prj_lists]" :pullUp="true" class="pay-content"
        @pullingUp="getDetail">
李晓兵's avatar
李晓兵 committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
        <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">
linxin's avatar
linxin committed
39 40
                <p>{{ parseFloat(e.due_amount).toFixed(2)|currency }}</p>
                <p>{{ e.received_amount|currency }}</p>
linxin's avatar
linxin committed
41
              <CurrencyInput v-model="e.amount" placeholder="请输入还款金额"/></div>
李晓兵's avatar
李晓兵 committed
42 43 44
            </div>
          </div>
        </section>
45 46 47 48 49
      </scroll>
    </div>
    <div class="prompt has-footer">
      <div>
        <img src="@/assets/payment/prompt.png" alt >
李晓兵's avatar
李晓兵 committed
50
      </div>
51 52 53 54 55 56 57 58 59
      <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>
李晓兵's avatar
李晓兵 committed
60 61 62 63
  </h-view>
</template>

<script>
linxin's avatar
linxin committed
64
import CurrencyInput from '../../../components/currencyInput'
李晓兵's avatar
李晓兵 committed
65
export default {
linxin's avatar
linxin committed
66 67 68
  components: {
    CurrencyInput,
  },
李晓兵's avatar
李晓兵 committed
69 70 71
  data () {
    return {
      money: 0,
72
      pagenum: 1,
李晓兵's avatar
李晓兵 committed
73 74 75 76
      prj_lists: [],
    }
  },
  watch: {
linxin's avatar
linxin committed
77
    'prj_lists': {
李晓兵's avatar
李晓兵 committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
      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 => {
94 95 96 97
              if (!isNaN(parseFloat(i))) {
                a = a + parseFloat(i)
                vm.money = a
              }
李晓兵's avatar
李晓兵 committed
98 99
              vm.money = a
            })
100
          } else if (notNaN.length === 0) {
李晓兵's avatar
李晓兵 committed
101 102 103 104 105
            vm.money = 0
          }
        }
      },
      deep: true,
linxin's avatar
linxin committed
106
      immediate: true,
李晓兵's avatar
李晓兵 committed
107 108 109 110 111 112 113
    },
  },
  beforeRouteEnter (to, from, next) {
    next(vm => {
      vm.getDetail()
    })
  },
linxin's avatar
linxin committed
114 115 116
  mounted () {
    console.log(this.prj_lists)
  },
李晓兵's avatar
李晓兵 committed
117 118 119 120 121
  methods: {
    getDetail () {
      let vm = this
      let url = process.env.basePath + 'payment_prj_list_query'
      let param = {
linxin's avatar
linxin committed
122
        bp_id: window.localStorage.getItem('bp_id'),
123 124
        pagenum: vm.pagenum,
        pagesize: 10,
李晓兵's avatar
李晓兵 committed
125 126 127 128 129
      }
      hlsPopup.showLoading('请稍候')
      vm.$post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
          let returnData = []
          returnData = res.prj_lists
          if (returnData.length === 0) {
            vm.$refs.scroll.update(true)
          } else if (returnData.length > 0 && returnData.length < 10) {
            vum.forEach(returnData, function (data, index, array) {
              vm.prj_lists.push(array[index])
            })
            vm.pagenum++
            vm.$refs.scroll.update(true)
          } else if (returnData.length === 10) {
            vum.forEach(returnData, function (data, index, array) {
              vm.prj_lists.push(array[index])
            })
            vm.pagenum++
            vm.$refs.scroll.update(false)
          }
linxin's avatar
linxin committed
147 148
          vm.prj_lists.forEach(i => {
            i.cf_lists.forEach(j => {
linxin's avatar
linxin committed
149
              let num = parseFloat(j.due_amount) - parseFloat(j.received_amount)
linxin's avatar
linxin committed
150
              vm.$set(j, 'amount', num)
linxin's avatar
linxin committed
151 152
            })
          })
李晓兵's avatar
李晓兵 committed
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
        } 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
linxin's avatar
linxin committed
171
        i.bp_id = window.localStorage.getItem('bp_id')
李晓兵's avatar
李晓兵 committed
172 173 174 175 176 177 178 179
      })
      return data
    },
    createDetail () {
      let vm = this
      let url = process.env.basePath + 'create_detail_0_part'
      let data = vm.makeDetailData()
      let param = {
linxin's avatar
linxin committed
180
        order_id: window.localStorage.getItem('order_id'),
李晓兵's avatar
李晓兵 committed
181 182 183 184 185 186
        pay_lists: data,
      }
      hlsPopup.showLoading('请稍候')
      vm.$post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
linxin's avatar
linxin committed
187 188
          let e = res.order_id
          vm.toPayEntry(e)
李晓兵's avatar
李晓兵 committed
189 190 191 192 193
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
linxin's avatar
linxin committed
194
    toPayEntry (e) {
李晓兵's avatar
李晓兵 committed
195 196 197
      this.$router.push({
        name: 'PayEntry',
        params: {
linxin's avatar
linxin committed
198 199 200
          money: this.money,
          order_id: e,

李晓兵's avatar
李晓兵 committed
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
        },
      })
    },
  },
}
</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;
243 244 245 246
    left:0;
    right:0;
    margin:auto;
    width: 355px;
李晓兵's avatar
李晓兵 committed
247
    //margin-top:-60px;
248
    height:9rem;
李晓兵's avatar
李晓兵 committed
249 250 251
    overflow: scroll;
    //background-color: #FFF;
    .contract-item {
252
      width: 100%;
李晓兵's avatar
李晓兵 committed
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 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
      background-color: #fff;
      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
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442
.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
443
</style>