如何判断是否正确
老师, 在手机端录入【卡号】和【激活码】等数据 到表 会员充值,
第一步 需要和 会员充值 里的【卡号】核对判断是否重复,不重复通过,重复了暂停并提示 卡号重复了
第二步 卡号再与 表 卡池 里的【卡号】 和【激活码】判断,有卡号并且核对上激活后通过,否则暂停并提示,卡号或激活码错误!
问题:随便输入 【卡号】和【激活码】都能提交 没有任何提示和判断
Dim wb As New weui
'开始生成网页
Select Case e.path
Case "jihuo.htm" '激活卡号
If e.PostValues.Count = 0 Then
wb.AddForm("", "form1", "jihuo.htm")
Dim 客户姓名 As String
客户姓名 = e.PostValues("客户姓名")
Dim dr As DataRow = DataTables("会员充值").SQLFind("客户姓名 ='" & 客户姓名 & "'")
If dr Is Nothing Then
With wb.AddInputGroup("form1", "ipg1", "客户资料") '空行时候,从客户信息里引来的数据
.AddInput("客户姓名", "客户姓名", "Text").value = dr("客户姓名") '前一个"姓名"是ID,后一个"姓名"是标题
End With
With wb.AddInputGroup("form1", "ipg2", "会员类型")
.AddSelect("会员类型", "会员类型", "199|388|999")
.AddInput("卡号", "卡号", "Text")
.AddInput("激活码", "密码", "password")
.AddInput("销售人", "销售人", "Text")
End With
If e.PostValues.ContainsKey("卡号") AndAlso e.PostValues.ContainsKey("激活码") Then '判断是否是验证失败后的重新登录
Dim Verified As Boolean '用于标记用户是否通过了身份验证
Dim 卡号 As String
Dim 激活码 As String
卡号 = e.PostValues("卡号")
激活码 = e.PostValues("激活码")
If dr("卡号") = DataTables("会员充值").SQLFind("卡号 = '" & e.PostValues("卡号") & "'") Then '("卡号 = '" & e.NewValue & "'")Then
wb.AddTopTips("", "toptip1", "卡号已经存在!").msec = 2000 '如果用户通过登录按钮访问,则给用户一个2秒的提示
ElseIf dr("卡号") = DataTables("卡池").SQLFind("激活码 ='" & e.PostValues("激活码") & "' and 卡号 ='" & e.PostValues("卡号") & "'") Then
Verified = True '验证正确'
Else
wb.AddTopTips("", "toptip2", "卡号或密码错误!").msec = 2000 '如果用户通过登录按钮访问,则给用户一个2秒的提示.
End If
End If
With wb.AddButtonGroup("form1", "btg1", True)
.Add("btn3", "提交绑卡信息", "submit")
End With
e.WriteString(wb.Build)
ElseIf dr("客户姓名")IsNot Nothing AndAlso dr("卡号")IsNot Nothing AndAlso dr("销售人")IsNot Nothing AndAlso dr("会员类型")IsNot Nothing Then
With wb.AddInputGroup("form1", "ipg1", "客户资料") '有值后,从记录信息里读取数据
With .AddInput("客户姓名", "客户姓名", "Text")
.value = dr("客户姓名")
.Readonly = True
End With
End With
With wb.AddInputGroup("form1", "ipg2", "会员详情")
With .AddInput("会员类型", "类型", "Text")
.value = dr("会员类型")
.Readonly = True
End With
With .AddInput("卡号", "卡号", "Text")
.value = dr("卡号")
.Readonly = True
End With
With .AddInput("销售人", "销售人", "Text")
.value = dr("卡号")
.Readonly = True
End With
End With
With wb.AddButtonGroup("form1", "btg1", True)
' .Add("btn1", "不可修改", "submit").Kind = 1
.Add("btn2", "返回主页", "button", "jihuo.htm")
End With
e.WriteString(wb.Build)
End If
Else
Dim nms() As String = {"客户姓名", "会员类型", "卡号", "销售人", "激活码"} '不能为空的列名数组
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) = False Then '生成错误提示页
With wb.AddMsgPage("", "msgpage", "增加失败", nm & "不能为空!")
.icon = "Warn" '改变图标
.AddButton("btn1", "返回").Attribute = ""
End With
e.WriteString(wb.Build)
Return '必须返回
End If
Next
nms = New String() { "客户姓名", "会员类型", "卡号", "销售人"} '重新定义了nms数组,增加了两列.
Dim dr3 As DataRow = DataTables("会员充值").AddNew()
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) Then
dr3(nm) = e.PostValues(nm)
End If
Next
'保存并生成增加成功提示页面
dr3.save()
With wb.AddMsgPage("", "msgpage", "增加成功", "111") '生成成功提示页
' .AddButton("btn1", "继续修改", "jihuo.htm").Kind = 1
.AddButton("btn2", "返回首页", "jihuo.htm")
End With
e.WriteString(wb.Build)
End If
End Select
e.WriteString(wb.Build) '生成网页
Case "jhyztk.htm" '验证数据判断提卡和会员卡号验证
If e.PostValues.ContainsKey("卡号") AndAlso e.PostValues.ContainsKey("激活码") Then
' Dim drcz As String
' Dim 激活码 As String
' 卡号 = e.PostValues("卡号")
' 激活码 = e.PostValues("激活码")
Dim drcz As DataRow = DataTables("会员充值").SQLFind("卡号='" & e.PostValues("卡号") & "'")
Dim drtk As DataRow = DataTables("提卡明细").SQLFind("激活码 ='" & e.PostValues("激活码") & "' and 卡号 ='" & e.PostValues("卡号") & "'")
If e.PostValues("卡号") = drcz Then
e.WriteString("次卡已激活")
ElseIf e.PostValues("激活码") = 555 Then
e.WriteString("PD01的最大允许折扣为0.1哦")
Else
e.WriteString("OK")
End If
Else
e.WriteString("请完整输入订单内容!")
End If
此主题相关图片如下:微信图片_20240520222229.png
jhyztk.js 里的代码
function validit(){
var result=submitAjaxFileds("jhyztk.htm","","卡号","激活码",false);
if(result=="OK"){
return true;
}
else{
此主题相关图片如下:微信图片_20240520222706.jpg
showTopTips("toptip1",result,2500);
return false;
}
}
[此贴子已经被作者于2024/5/20 22:30:29编辑过]