1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- var clickFlag = null;
- $().ready(function () {
- submitEvent();
- })
- function submitEvent () {
- $("#btn").click(function () {
- if(clickFlag == false){
- return;
- }
- var ddh = ($("#ddh").val()).replace(/(^\s*)|(\s*$)/g, "");
- var phone = $("#phone").val();
- if(ddh == ''){
- showMsg('请输入订单号')
- return;
- }
- var myreg=/^[0-9]{11}$/;
- if (!myreg.test(phone)){
- showMsg('请正确输入手机号')
- return;
- }
- clickFlag = false;
- $.ajax({
- type:"post",
- url:"/api/v2/user/giveRebate",
- data:{
- phone:phone,
- order_id:ddh
- },
- success: function (res) {
- clickFlag = true;//禁止重复点击
- if(res && res.errno == 0){
- showMsg(res.rst.data)
- }else{
- showMsg(res.rst.msg)
- }
- }
- });
-
- })
- }
- //提示弹框
- function showMsg(msg) {
- var msgBox = $('.alert-info');
- msgBox.children('p').text(msg);
- msgBox.show();
- setTimeout(function() {
- msgBox.hide();
- }, 1000);
- }
|