register-vip.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>注册会员</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
  7. <meta name="apple-mobile-web-app-capable" content="yes">
  8. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  9. <link rel="stylesheet" type="text/css" href="css/mui.min.css" />
  10. <link rel="stylesheet" type="text/css" href="css/iconfont.css" />
  11. <link rel="stylesheet" type="text/css" href="css/main.css" />
  12. <link rel="stylesheet" type="text/css" href="css/mui.picker.min.css" />
  13. <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
  14. <script>
  15. //屏蔽分享
  16. // document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
  17. // WeixinJSBridge.call('hideOptionMenu');
  18. // });
  19. </script>
  20. </head>
  21. <body>
  22. <div class="mui-content">
  23. <div style="margin: 20px 0;text-align: center;">
  24. <div style="padding: 10px 0;">
  25. <span class="iconfont icon-chenggong" style="color: #3bbf64;font-size: 40px;"></span>
  26. </div>
  27. <h4> 已成功扫描唯一码 </h4>
  28. <p id="barCodeId"></p>
  29. <p>完善信息即可成为会员</p>
  30. </div>
  31. <img width="100%" src="images/youhuiquan.jpg" />
  32. <div style="padding: 15px 10px;">
  33. 完善信息
  34. </div>
  35. <form class="mui-input-group">
  36. <div class="mui-input-row line-bottom">
  37. <label>您的姓名</label>
  38. <input type="text" class="mui-input-clear" id="ipt-name" placeholder="填写您的姓名">
  39. </div>
  40. <div class="mui-table my-table" style="padding:15px 10px;">
  41. <div class="mui-table-cell mui-col-xs-2">
  42. <label>您的性别</label>
  43. </div>
  44. <div class="mui-table-cell mui-col-xs-3">
  45. <div class="mui-input-row mui-radio mui-left">
  46. <label>男</label>
  47. <input id="maleId" class="iconfont icon-boy" name="radio0" type="radio" checked="" value="1">
  48. </div>
  49. </div>
  50. <div class="mui-table-cell mui-col-xs-5">
  51. <div class="mui-input-row mui-radio mui-left">
  52. <label>女</label>
  53. <input id="femaleId" class="iconfont icon-girl" name="radio0" type="radio" value="2">
  54. </div>
  55. </div>
  56. </div>
  57. <div class="mui-table my-table">
  58. <div class="mui-table-cell mui-col-xs-2">
  59. <label style="display: block;width: 60px;">您的年龄</label>
  60. </div>
  61. <div class="mui-table-cell mui-col-xs-3">
  62. <div class="mui-input-row mui-radio mui-left">
  63. <label class="my-label">80后</label>
  64. <input name="radio1" class="radio1" type="radio" checked="" value="1">
  65. </div>
  66. </div>
  67. <div class="mui-table-cell mui-col-xs-3">
  68. <div class="mui-input-row mui-radio mui-left">
  69. <label class="my-label">85后</label>
  70. <input name="radio1" class="radio1" type="radio" value="2">
  71. </div>
  72. </div>
  73. <div class="mui-table-cell mui-col-xs-3">
  74. <div class="mui-input-row mui-radio mui-left">
  75. <label class="my-label">90后</label>
  76. <input name="radio1" class="radio1" type="radio" value="3">
  77. </div>
  78. </div>
  79. </div>
  80. <div class="mui-table my-table" style="padding-bottom: 12px;">
  81. <div class="mui-table-cell mui-col-xs-2">
  82. <label></label>
  83. </div>
  84. <div class="mui-table-cell mui-col-xs-3">
  85. <div class="mui-input-row mui-radio mui-left">
  86. <label class="my-label">95后</label>
  87. <input name="radio1" class="radio1" type="radio" value="4">
  88. </div>
  89. </div>
  90. <div class="mui-table-cell mui-col-xs-3">
  91. <div class="mui-input-row mui-radio mui-left">
  92. <label class="my-label">00后</label>
  93. <input name="radio1" class="radio1" type="radio" value="5">
  94. </div>
  95. </div>
  96. <div class="mui-table-cell mui-col-xs-3">
  97. <div class="mui-input-row mui-radio mui-left">
  98. <label class="my-label">其他</label>
  99. <input name="radio1" class="radio1" type="radio" value="6">
  100. </div>
  101. </div>
  102. </div>
  103. <div class="mui-table my-table" style="padding-bottom: 15px;">
  104. <div class="mui-table-cell mui-col-xs-2">
  105. <label style="display: block;width: 60px;">购买渠道</label>
  106. </div>
  107. <div class="mui-table-cell mui-col-xs-3">
  108. <div class="mui-input-row mui-radio mui-left">
  109. <label class="my-label">JD</label>
  110. <input name="radio2" class="radio2" type="radio" checked="" value="1">
  111. </div>
  112. </div>
  113. <div class="mui-table-cell mui-col-xs-3">
  114. <div class="mui-input-row mui-radio mui-left">
  115. <label class="my-label">天猫</label>
  116. <input name="radio2" class="radio2" type="radio" value="2">
  117. </div>
  118. </div>
  119. <div class="mui-table-cell mui-col-xs-3">
  120. <div class="mui-input-row mui-radio mui-left">
  121. <label class="my-label">其他</label>
  122. <input name="radio2" class="radio2" type="radio" value="3">
  123. </div>
  124. </div>
  125. </div>
  126. <div class="mui-input-row line-top">
  127. <label>购买日期</label>
  128. <input type="text" id="buyDate" class="mui-input-clear" readonly="readonly" placeholder="填写您的购买日期">
  129. </div>
  130. </form>
  131. <br />
  132. <div class="mui-content-padded mui-text-center">
  133. <button type="button" class="my-btn-black" id="my-btn-submit" style="width: 50%;">提交注册</button>
  134. </div>
  135. </div>
  136. <!-- 加载ing begin-->
  137. <div class="loading covers">
  138. <div class="loading-bj"></div>
  139. <p>正在加载...</p>
  140. </div>
  141. <!-- 加载ing end -->
  142. <script type="text/javascript" src="js/mui.min.js"></script>
  143. <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
  144. <script type="text/javascript" src="js/main.js"></script>
  145. <script src="js/mui.picker.min.js"></script>
  146. <script type="text/javascript">
  147. window.addEventListener('pageshow', function(e) {
  148. // 通过persisted属性判断是否存在 BF Cache
  149. if(e.persisted) {
  150. location.reload();
  151. }
  152. });
  153. mui('body').on('tap', '#buyDate', function(event) {
  154. var picker = new mui.DtPicker({
  155. type: "date", //设置日历初始视图模式
  156. beginDate: new Date(2017, 04, 25), //设置开始日期
  157. endDate: new Date(2050, 04, 25) //设置结束日期
  158. });
  159. picker.show(function(rs) {
  160. $("#buyDate").val(rs.text);
  161. picker.dispose();
  162. picker = null;
  163. });
  164. });
  165. var qrCode = null;
  166. var isFocusOn = null;
  167. var userIdentity = null;
  168. mui.ready(function() {
  169. console.log("页面加载完毕");
  170. //获取机器条码 barcode
  171. qrCode = getParam("qrCode");
  172. if(qrCode != null){
  173. $(".loading").hide().css("opacity", "0"); //隐藏(正在加载...)
  174. $("#barCodeId").html("("+qrCode+")");
  175. $.ajax(base_path + '/wechat/getActivationAndMember?dates=' + new Date().getTime(), {
  176. data: {
  177. "qrCode":qrCode//产品类型id
  178. },
  179. dataType: 'json',
  180. xhrFields: {
  181. withCredentials: true
  182. },
  183. crossDomain: true,
  184. type: 'get',
  185. timeout: 15000,
  186. success: function(dt) {
  187. if(dt.isRedirect) {
  188. location.href = dt.redirectURL;
  189. } else {
  190. if(dt.status) {//判断接口返回状态status
  191. if(dt.data.isActivation){
  192. //已激活
  193. mui.alert('该产品已被激活!', '提醒', function() {
  194. window.location.href="http://s.iamberry.com/soodo/wechat/my-center.html";
  195. });
  196. }
  197. //填充用户数据
  198. $("#ipt-name").val(dt.data.memberInfo.userName);
  199. if(dt.data.memberInfo.userSex != null){
  200. if(dt.data.memberInfo.userSex == 1){
  201. $("#maleId").attr("checked", true);
  202. }
  203. if(dt.data.memberInfo.userSex == 2){
  204. $("#femaleId").attr("checked", true);
  205. }
  206. }
  207. var radios = $(".radio1");
  208. switch (dt.data.memberInfo.userAgeStage) {
  209. case (1):
  210. radios.eq(0).attr("checked", true);
  211. break;
  212. case (2):
  213. radios.eq(1).attr("checked", true);
  214. break;
  215. case (3):
  216. radios.eq(2).attr("checked", true);
  217. break;
  218. case (4):
  219. radios.eq(3).attr("checked", true);
  220. break;
  221. case (5):
  222. radios.eq(4).attr("checked", true);
  223. break;
  224. case (6):
  225. radios.eq(5).attr("checked", true);
  226. }
  227. isFocusOn = dt.data.memberInfo.userStatus;
  228. userIdentity = dt.data.memberInfo.userIdentity;
  229. } else {
  230. mui.alert("查询失败!");
  231. }
  232. }
  233. },
  234. error: function(xhr, type, errorThrown) {
  235. console.log(xhr);
  236. mui.alert("网络错误!");
  237. }
  238. });
  239. }
  240. });
  241. $(document).on('tap', '#my-btn-submit', function() {
  242. validate();//验证文本框
  243. var userName = $("#ipt-name").val();
  244. var userSex = $('input[name="radio0"]:checked ').val();
  245. var userAgeStage = $('input[name="radio1"]:checked ').val();
  246. var apparatusStore = $('input[name="radio2"]:checked ').val();
  247. var buyDate = $("#buyDate").val();
  248. if(validate_flag){
  249. //验证通过
  250. $.ajax(base_path + '/wechat/apparatus/add_apparatus?dates=' + new Date().getTime(), {
  251. data: {
  252. "barCode":qrCode,//条码
  253. "userName":userName,//用户姓名
  254. "userSex":userSex,//用户姓名
  255. "userAgeStage":userAgeStage,//年龄阶段1:80后 2:85后 3:90后 4:95后 5:00后 6:其他
  256. "apparatusStore":apparatusStore,//渠道id 1:天猫2:淘宝3:京东4:微信
  257. "buyDate":buyDate//购买日期
  258. },
  259. dataType: 'json',
  260. xhrFields: {
  261. withCredentials: true
  262. },
  263. crossDomain: true,
  264. type: 'get',
  265. timeout: 15000,
  266. success: function(dt) {
  267. if(dt.isRedirect) {
  268. location.href = dt.redirectURL;
  269. } else {
  270. if(dt.status) {//判断接口返回状态status
  271. mui.alert('注册成功!', '提醒', function() {
  272. if(userIdentity == 1){//会员
  273. if(isFocusOn == 1 || isFocusOn == 0){//未关注
  274. location.href="member-follow-me.html";
  275. }else{//以关注
  276. location.href="my-center.html";
  277. }
  278. }else{//非会员
  279. if(isFocusOn == 1 || isFocusOn == 0){//未关注
  280. location.href="follow-me.html";
  281. }else{//以关注
  282. location.href="my-center.html";
  283. }
  284. }
  285. });
  286. } else {
  287. mui.alert(data.message);
  288. }
  289. }
  290. },
  291. error: function(xhr, type, errorThrown) {
  292. console.log(xhr);
  293. mui.alert("网络错误");
  294. }
  295. });
  296. }else{
  297. mui.alert(dalog_msg);//弹窗提示
  298. }
  299. });
  300. //正则表达式示例
  301. var dalog_msg='',validate_flag=false;
  302. function validate() {
  303. var ch_en_num = /^[A-Za-z_\-\u4e00-\u9fa5]{2,10}$/; //简体中文英文(2-10位)
  304. var full_date = /^\d{4}(\-|\/|.)\d{1,2}\1\d{1,2}$/; //日期格式 (2016\12\12,2016-12-12,2016.12.12)
  305. var name = $("#ipt-name").val().trim();
  306. if(ch_en_num.test(name)) {
  307. //验证通过
  308. validate_flag=true;
  309. } else {
  310. //未通过验证
  311. if(name != '') {
  312. dalog_msg='名字格式不正确';
  313. } else {
  314. dalog_msg='请填写名字';
  315. }
  316. validate_flag=false;
  317. }
  318. if($("#buyDate").val() == null || $("#buyDate").val() == ""){
  319. dalog_msg='请选择购买日期';
  320. validate_flag=false;
  321. }
  322. return dalog_msg;//返回提示信息
  323. }
  324. </script>
  325. </body>
  326. </html>