Browse Source

退款输入框

yijia
v-Brocloni 3 years ago
parent
commit
004408c1f7
2 changed files with 44 additions and 0 deletions
  1. +8
    -0
      application/admin/controller/unishop/Order.php
  2. +36
    -0
      application/admin/view/unishop/order/refundShow.html

+ 8
- 0
application/admin/controller/unishop/Order.php View File

@@ -742,4 +742,12 @@ class Order extends Backend
); );
$this->success("确认成功", null); $this->success("确认成功", null);
} }

public function refundShow(){
$id = $this->request->get("id");
$refund_fee = $this->request->get("refund_fee");
$this->view->assign('id', $id);
$this->view->assign('refund_fee', $refund_fee);
return $this->view->fetch();
}
} }

+ 36
- 0
application/admin/view/unishop/order/refundShow.html View File

@@ -0,0 +1,36 @@
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">订单ID</label>
<div class="col-xs-12 col-sm-8">
<input id="order_id" class="form-control" readonly="readonly" name="id" type="number" value="{$id}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">退款金额</label>
<div class="col-xs-12 col-sm-8">
<input id="refund_fee" class="form-control" name="id" type="number" value="{$id}">
</div>
</div>
</form>
<script>
function checknum(obj)
{
//如果输入非数字,则替换为''
obj.value = obj.value.replace(/[^\d\.]/g, '');
//必须保证第一个为数字而不是.
obj.value = obj.value.replace(/^\./g,'');
//前两位不能是0加数字
obj.value = obj.value.replace(/^0\d[0-9]*/g,'');
//保证只有出现一个.而没有多个.
obj.value = obj.value.replace(/\.{2,}/g,'.');
//保证.只出现一次,而不能出现两次以上
obj.value = obj.value.replace('.','$#$').replace(/\./g,'').replace('$#$','.');
//只能输入两位小数
obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');
}

$('refund_fee').on('input',function () {
checknum(this);
})
</script>

Loading…
Cancel
Save