Commit e6068b85 authored by linxin's avatar linxin

fix:支付

parent 4b0679cd
...@@ -9,62 +9,62 @@ ...@@ -9,62 +9,62 @@
</template> </template>
<script> <script>
export default { export default {
name: 'CurrencyInput', name: 'CurrencyInput',
props: { props: {
value: { value: {
type: Number, type: Number,
default: 0, default: 0,
},
disable: {
type: Boolean,
default: false,
},
}, },
disable: {
type: Boolean,
default: false,
},
},
data () { data () {
return { return {
focused: false, focused: false,
}
},
filter: {
uncurrency (val) {
if (!val) return null
return (Number((val).replace(/,/gi, ''))) === 0 ? null : Number((val).replace(/,/gi, ''))
},
},
computed: {
formatValue () {
let currency = this.$options.filters['currency']
if (!this.focused) {
return currency(this.value)
} else {
return this.value
} }
}, },
filter: { },
uncurrency (val) { methods: {
if (!val) return null onInput: function (value) {
return (Number((val).replace(/,/gi, ''))) === 0 ? null : Number((val).replace(/,/gi, '')) if (this.disable) return
}, let uncurrency = this.$options.filter['uncurrency']
this.currencyValue = uncurrency(value)
this.$emit('input', this.currencyValue)
}, },
computed: { onFocus (event) {
formatValue () { if (this.disable) return
let currency = this.$options.filters['currency'] this.focused = true
if (!this.focused) { setTimeout(function () {
return currency(this.value) event.target.type = 'number'
} else { event.target.focus()
return this.value }, 0)
}
},
}, },
methods: { onBlur (event) {
onInput: function (value) { if (this.disable) return
if (this.disable) return event.target.type = 'text'
let uncurrency = this.$options.filter['uncurrency'] this.focused = false
this.currencyValue = uncurrency(value)
this.$emit('input', this.currencyValue)
},
onFocus (event) {
if (this.disable) return
this.focused = true
setTimeout(function () {
event.target.type = 'number'
event.target.focus()
}, 0)
},
onBlur (event) {
if (this.disable) return
event.target.type = 'text'
this.focused = false
},
}, },
} },
}
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
......
...@@ -36,8 +36,7 @@ ...@@ -36,8 +36,7 @@
<div class="item-right"> <div class="item-right">
<p>{{ parseFloat(e.due_amount).toFixed(2)|currency }}</p> <p>{{ parseFloat(e.due_amount).toFixed(2)|currency }}</p>
<p>{{ e.received_amount|currency }}</p> <p>{{ e.received_amount|currency }}</p>
<input v-model="e.amount" type="number" placeholder="请输入还款金额"> <CurrencyInput v-model="e.amount" placeholder="请输入还款金额"/></div>
</div>
</div> </div>
</div> </div>
</section> </section>
...@@ -60,8 +59,11 @@ ...@@ -60,8 +59,11 @@
</template> </template>
<script> <script>
import CurrencyInput from '../../../components/currencyInput'
export default { export default {
components: {}, components: {
CurrencyInput,
},
data () { data () {
return { return {
money: 0, money: 0,
...@@ -120,7 +122,7 @@ export default { ...@@ -120,7 +122,7 @@ export default {
vm.prj_lists = res.prj_lists vm.prj_lists = res.prj_lists
vm.prj_lists.forEach(i => { vm.prj_lists.forEach(i => {
i.cf_lists.forEach(j => { i.cf_lists.forEach(j => {
let num = parseFloat(j.due_amount) - parseFloat(j.received_amount) let num = (parseFloat(j.due_amount) - parseFloat(j.received_amount)).toFixed(2)
vm.$set(j, 'amount', num) vm.$set(j, 'amount', num)
}) })
}) })
...@@ -213,7 +215,8 @@ export default { ...@@ -213,7 +215,8 @@ export default {
bottom: 150px; bottom: 150px;
width: 100%; width: 100%;
//margin-top:-60px; //margin-top:-60px;
height: 370px; // height: 370px;
height:7.4rem;
overflow: scroll; overflow: scroll;
//background-color: #FFF; //background-color: #FFF;
.contract-item { .contract-item {
...@@ -382,4 +385,31 @@ export default { ...@@ -382,4 +385,31 @@ export default {
color: #fff; color: #fff;
} }
} }
.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;
}
}
}
}
</style> </style>
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<div> <div>
<span>本次还款</span> <span>本次还款</span>
<section> <section>
<input v-model="detail.amount" type="number" placeholder="请输入还款金额" > <CurrencyInput v-model="detail.amount" placeholder="请输入还款金额" />
</section> </section>
</div> </div>
</div> </div>
...@@ -102,9 +102,12 @@ ...@@ -102,9 +102,12 @@
</h-view> </h-view>
</template> </template>
<script> <script>
import CurrencyInput from '../../../components/currencyInput'
export default { export default {
name: 'PaymentContractRecord', name: 'PaymentContractRecord',
components: {}, components: {
CurrencyInput,
},
beforeRouteEnter (to, from, next) { beforeRouteEnter (to, from, next) {
next(vm => { next(vm => {
vm.getRentInfo() vm.getRentInfo()
...@@ -478,4 +481,23 @@ export default { ...@@ -478,4 +481,23 @@ export default {
color: white; color: white;
} }
} }
@media (device-width: 375px) and (device-height: 812px) and (-webkit-min-device-pixel-ratio: 3) {
.platform-ios {
#payment-contract-record {
.pay-content {
height: 63%;
}
}
}
}
// iPhoneXR适配
@media (device-width: 414px) and (device-height: 896px) {
.platform-ios {
#payment-contract-record {
.pay-content {
height: 63%;
}
}
}
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment