| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- <template>
- <view class="app">
- <view class="bg">
- </view>
- <view class="moneyBox">
- <view class="price-box">
- <text>提前还款金额</text>
- </view>
- <view class="moneyNumBox flex">
- <text class="fh">¥</text>
- <input class="moneyValue" type="text" v-model="money" />
- </view>
- <view class="day">
- 服务天数剩余{{day}}天
- </view>
- </view>
- <view class="moneyBox margin-t-30 padding-t-30">
- <view class="yt-list">
- <view class="yt-list-cell" @click="payType='yue'">
- <view class="cell-tit flex">
- <image class="orderIcon" src="../../../static/icon/ye.png" mode="widthFix"></image>
- <text class="margin-l-10">余额({{now_money}})</text>
- </view>
- <image class="checked" v-if="payType=='yue'" src="../../../static/icon/addressIconXz.png"
- mode="widthFix">
- </image>
- <view v-else class="noChecked"></view>
- </view>
- </view>
- </view>
- <view class="base-buttom" :class="{ clickbg: payLoding }" @click="!payLoding ? confirm() : ''">确认支付</view>
- </view>
- </template>
- <script>
- import {
- balance
- } from '@/api/wallet.js';
- import {
- getCarInfo,
- prepayment
- } from '@/api/user.js';
- export default {
- data() {
- return {
- payType: 'yue',
- money: 0, //订单金额
- allMoney: 0, //总的还款金额
- now_money: 0.0, //余额
- car_number: '', //保存订单id
- payLoding: false, //判断是否支付中
- minMoney: 0, //最低还款金额
- };
- },
- onLoad(options) {
- this.car_number = options.id;
- // 载入余额
- balance({}).then(({
- data
- }) => {
- // 获取余额
- this.now_money = data.now_money;
- });
- getCarInfo({
- car_number: this.car_number
- }).then((e) => {
- this.money = e.data.surplus;
- this.allMoney = e.data.surplus;
- this.minMoney = +e.data.day_deducted
- this.day = e.data.day
- })
- },
- methods: {
- // 支付成功跳转
- paySuccessTo() {
- uni.hideLoading();
- uni.redirectTo({
- url: '/pages/user/money/paySuccess?type=1'
- });
- },
- //确认支付
- confirm: async function() {
- let obj = this;
- // 判断是否余额不足
- if (obj.payType == 'yue' && +obj.now_money < obj.money) {
- uni.showModal({
- title: '提示',
- content: '账户余额不足!',
- showCancel: false,
- });
- return;
- }
- // 判断是否为未支付订单中跳转进入
- if (this.money < this.minMoney) {
- uni.showModal({
- title: '提示',
- content: '还款金额不可低于' + this.minMoney + '元',
- showCancel: false,
- });
- return
- }
- if (this.money % this.minMoney != 0 && this.money < this.allMoney) {
- uni.showModal({
- title: '提示',
- content: '还款金额必须为' + this.minMoney + '的倍数',
- showCancel: false,
- });
- return
- }
- // 支付中
- uni.showLoading({
- title: '支付中',
- mask: true
- })
- obj.payLoding = true;
- prepayment({
- 'car_number': this.car_number,
- money: this.money
- }).then((e) => {
- uni.hideLoading()
- uni.showToast({
- title: e.msg
- });
- obj.payLoding = false;
- uni.showModal({
- title: '提示',
- content: e.msg,
- showCancel: false,
- cancelText: '取消',
- confirmText: '返回',
- success: res => {
- if(res.confirm){
- uni.navigateBack()
- }
- },
- fail: () => {},
- complete: () => {}
- });
- }).catch((e) => {
- obj.payLoding = false;
- uni.hideLoading()
- console.log(e);
- })
- }
- }
- };
- </script>
- <style lang="scss">
- .app {
- width: 100%;
- padding-top: 30rpx;
- }
- .moneyBox {
- position: relative;
- margin: 0 $page-row-spacing;
- border-radius: 20rpx;
- overflow: hidden;
- background-color: #FFFFFF;
- padding: 50rpx 30rpx 30rpx;
- .moneyNumBox {
- color: $font-color-base;
- border-bottom: 1px solid $page-color-light;
- .fh {
- font-size: $font-base + 2rpx;
- }
- .moneyValue {
- font-size: $font-lg + 16rpx;
- }
- }
- .day {
- padding-top: 30RPX;
- font-size: $font-sm - 2rpx;
- color: $font-color-light;
- }
- }
- .bg {
- background-color: $color-green;
- width: 950rpx;
- position: absolute;
- left: -100rpx;
- border-bottom-left-radius: 1000rpx;
- border-bottom-right-radius: 1000rpx;
- top: 0rpx;
- height: 300rpx;
- }
- .price-box {
- background-color: #fff;
- padding-bottom: 60rpx;
- font-size: $font-base;
- color: $font-color-base;
- font-weight: bold;
- .price {
- font-size: 50upx;
- color: #303133;
- margin-top: 12upx;
- &:before {
- content: '¥';
- font-size: 40upx;
- }
- }
- }
- .pay-type-list {
- margin-top: 20upx;
- background-color: #fff;
- padding-left: 60upx;
- .type-item {
- height: 120upx;
- padding: 20upx 0;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding-right: 60upx;
- font-size: 30upx;
- position: relative;
- }
- .icon {
- width: 100upx;
- font-size: 52upx;
- }
- .iconyue {
- color: #fe8e2e;
- }
- .iconweixin {
- color: #36cb59;
- }
- .iconzhifubao {
- color: #01aaef;
- }
- .tit {
- font-size: $font-lg;
- color: $font-color-dark;
- margin-bottom: 4upx;
- }
- .con {
- flex: 1;
- display: flex;
- flex-direction: column;
- font-size: $font-sm;
- color: $font-color-light;
- }
- }
- .clickbg {
- background-color: $color-gray !important;
- }
- .yt-list {
- background: #fff;
- border-radius: 20rpx;
- width: 100%;
- }
- .yt-list-cell {
- display: flex;
- align-items: center;
- justify-content: space-between;
- line-height: 70rpx;
- position: relative;
- .checked,
- .noChecked {
- width: 36rpx;
- height: 36rpx;
- }
- .noChecked {
- border: 1px solid $font-color-light;
- border-radius: 100rpx;
- }
- &.cell-hover {
- background: #fafafa;
- }
- &.b-b:after {
- left: 30rpx;
- }
- .cell-icon {
- height: 32rpx;
- width: 32rpx;
- font-size: 22rpx;
- color: #fff;
- text-align: center;
- line-height: 32rpx;
- background: #f85e52;
- border-radius: 4rpx;
- margin-right: 12rpx;
- &.hb {
- background: #ffaa0e;
- }
- &.lpk {
- background: #3ab54a;
- }
- }
- .cell-more {
- align-self: center;
- font-size: 24rpx;
- color: $font-color-light;
- margin-left: 8rpx;
- margin-right: -10rpx;
- }
- .cell-tit {
- font-size: 26rpx;
- color: $font-color-light;
- margin-right: 10rpx;
- .orderIcon {
- width: 48rpx;
- }
- }
- .cell-tip {
- font-size: 26rpx;
- color: $font-color-dark;
- &.disabled {
- color: $font-color-light;
- }
- &.active {
- color: $base-color;
- }
- &.red {
- color: $base-color;
- }
- }
- &.desc-cell {
- .cell-tit {
- max-width: 90rpx;
- }
- }
- .desc {
- text-align: right;
- font-size: $font-base;
- color: $font-color-light;
- }
- }
- </style>
|