浏览代码

修复未选择收货地址就生成订单的bug

wangxiaoming 7 年之前
父节点
当前提交
ee4ac56c13
共有 1 个文件被更改,包括 11 次插入3 次删除
  1. 11 3
      tooth/clearing.html

+ 11 - 3
tooth/clearing.html

@@ -174,6 +174,8 @@
 											wechatAddr.userName = dt.data.addressInfo.salesAddressName;
 											wechatAddr.userTel = dt.data.addressInfo.salesAddressTel;
 											wechatAddr.postalCode = dt.data.addressInfo.salesAddressPostnum;
+										}else{
+											wechatAddr.status = false;
 										}
 										$(".count_price,.pay_price").text((dt.data.payTotal / 100).toFixed(2));
 										$("#pro-count").text(proCount);
@@ -286,9 +288,10 @@
 			});
 			// 去支付
 			$(document).on('tap', '#go-pay', function() {
+				
 
 				var remark = $("#textarea").val();
-				var ch_en_num = /^[A-Za-z0-9_\[\]\【\】\{\}\{\}\(\)\(\)\《\》\<\>\,\,\.\。\、\!\!\~\·\@\#\¥\$\%\^\…\&\—\:\:\;\;\‘\’\'\'\"\"\“\”\?\?\-\=\|\*\+\-\u4e00-\u9fa5]{0,100}$/;
+				var ch_en_num = /^[A-Za-z0-9 _\[\]\【\】\{\}\{\}\(\)\(\)\《\》\<\>\,\,\.\。\、\!\!\~\·\@\#\¥\$\%\^\…\&\—\:\:\;\;\‘\’\'\'\"\"\“\”\?\?\-\=\|\*\+\-\u4e00-\u9fa5]{0,100}$/;
 				if(ch_en_num.test(remark)) {
 					console.log("备注验证通过")
 				} else {
@@ -296,10 +299,14 @@
 					return false;
 				}
 				if(wechatAddr.status) {
+					if($('#user-address-div').html() == null || $('#user-address-div').html() == '') {
+						wechatAddr.status = false;
+						mui.toast("请选择收货信息!");
+						return ;
+					} 
+					
 					if(isPay) {
-
 						isPay = false; // 锁定请求按钮
-
 						/* 组装数据 */
 						var dataArgs = {
 							"orderAddressInfo": wechatAddr.detailInfo,
@@ -314,6 +321,7 @@
 						if(remark != '') {
 							dataArgs["orderUserRemark"] = remark;
 						}
+						
 						$.ajax(base_path + '/wechat/order/pay', { // 提交订单,准备支付
 							data: dataArgs,
 							dataType: 'json',