|
@@ -126,6 +126,8 @@ $(document).ready(function () {
|
|
|
const min = parseInt($(this).attr('min'))
|
|
|
const max = parseInt($(this).attr('max'))
|
|
|
const type = parseInt($(this).data('type'))
|
|
|
+ let pay_ratio = null
|
|
|
+ let cur_amount = null
|
|
|
if (val < min) {
|
|
|
// 限制最小值为min
|
|
|
$(this).val(min)
|
|
@@ -144,19 +146,31 @@ $(document).ready(function () {
|
|
|
val = re_amount
|
|
|
}
|
|
|
const pay_a_input = $(`.pay-input[data-type=${reverse(type)}]`)
|
|
|
- pay_a_input.val(ZhCalc.round(ZhCalc.mul(ZhCalc.div(val, re_amount), 100), 2))
|
|
|
+ pay_ratio = ZhCalc.round(ZhCalc.mul(ZhCalc.div(val, re_amount), 100), 2)
|
|
|
+ cur_amount = val
|
|
|
+ pay_a_input.val(pay_ratio)
|
|
|
// 截止本期金额文案更新
|
|
|
$('#p_total').text(formatMoney(ZhCalc.add(val, p_amount)))
|
|
|
} else {
|
|
|
// 支付比例转化
|
|
|
const cur_m_input = $(`.pay-input[data-type=${reverse(type)}]`)
|
|
|
- const newVal = ZhCalc.mul(re_amount, ZhCalc.div(val, 100))
|
|
|
- cur_m_input.val(newVal)
|
|
|
+ cur_amount = ZhCalc.mul(re_amount, ZhCalc.div(val, 100))
|
|
|
+ pay_ratio = val
|
|
|
+ cur_m_input.val(cur_amount)
|
|
|
// 截止本期金额文案更新
|
|
|
- $('#p_total').text(formatMoney(ZhCalc.add(newVal, p_amount)))
|
|
|
+ $('#p_total').text(formatMoney(ZhCalc.add(cur_amount, p_amount)))
|
|
|
}
|
|
|
+ const data = {
|
|
|
+ pay_ratio,
|
|
|
+ cur_amount
|
|
|
+ }
|
|
|
+ update(data)
|
|
|
})
|
|
|
|
|
|
+ function update(data) {
|
|
|
+ postData(getUrlPre() + '/update', data)
|
|
|
+ }
|
|
|
+
|
|
|
function reverse(num){
|
|
|
return 1^num
|
|
|
}
|