register-vip.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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. <p style="width: 60%;margin-left: 20%;">成功注册会员,您将获得延保服务,以及免费积分和刷头福利</p>
  31. <p style="width: 60%;margin-left: 20%;">“刷头兑换券”请移至上朵公众号【朵粉特供】→【福利社】领取</p>
  32. </div>
  33. <img width="100%" src="images/youhuiquan.jpg" />
  34. <div style="padding: 15px 10px;">
  35. 完善信息
  36. </div>
  37. <form class="mui-input-group">
  38. <div class="mui-input-row line-bottom">
  39. <label>您的姓名</label>
  40. <input type="text" class="mui-input-clear" id="ipt-name" placeholder="填写您的姓名">
  41. </div>
  42. <div class="mui-table my-table" style="padding:15px 10px;">
  43. <div class="mui-table-cell mui-col-xs-2">
  44. <label>您的性别</label>
  45. </div>
  46. <div class="mui-table-cell mui-col-xs-3">
  47. <div class="mui-input-row mui-radio mui-left">
  48. <label>男</label>
  49. <input id="maleId" class="iconfont icon-boy" name="radio0" type="radio" checked="" value="1">
  50. </div>
  51. </div>
  52. <div class="mui-table-cell mui-col-xs-5">
  53. <div class="mui-input-row mui-radio mui-left">
  54. <label>女</label>
  55. <input id="femaleId" class="iconfont icon-girl" name="radio0" type="radio" value="2">
  56. </div>
  57. </div>
  58. </div>
  59. <div class="mui-table my-table">
  60. <div class="mui-table-cell mui-col-xs-2">
  61. <label style="display: block;width: 60px;">您的年龄</label>
  62. </div>
  63. <div class="mui-table-cell mui-col-xs-3">
  64. <div class="mui-input-row mui-radio mui-left">
  65. <label class="my-label">80后</label>
  66. <input name="radio1" class="radio1" type="radio" checked="" value="1">
  67. </div>
  68. </div>
  69. <div class="mui-table-cell mui-col-xs-3">
  70. <div class="mui-input-row mui-radio mui-left">
  71. <label class="my-label">85后</label>
  72. <input name="radio1" class="radio1" type="radio" value="2">
  73. </div>
  74. </div>
  75. <div class="mui-table-cell mui-col-xs-3">
  76. <div class="mui-input-row mui-radio mui-left">
  77. <label class="my-label">90后</label>
  78. <input name="radio1" class="radio1" type="radio" value="3">
  79. </div>
  80. </div>
  81. </div>
  82. <div class="mui-table my-table" style="padding-bottom: 12px;">
  83. <div class="mui-table-cell mui-col-xs-2">
  84. <label></label>
  85. </div>
  86. <div class="mui-table-cell mui-col-xs-3">
  87. <div class="mui-input-row mui-radio mui-left">
  88. <label class="my-label">95后</label>
  89. <input name="radio1" class="radio1" type="radio" value="4">
  90. </div>
  91. </div>
  92. <div class="mui-table-cell mui-col-xs-3">
  93. <div class="mui-input-row mui-radio mui-left">
  94. <label class="my-label">00后</label>
  95. <input name="radio1" class="radio1" type="radio" value="5">
  96. </div>
  97. </div>
  98. <div class="mui-table-cell mui-col-xs-3">
  99. <div class="mui-input-row mui-radio mui-left">
  100. <label class="my-label">其他</label>
  101. <input name="radio1" class="radio1" type="radio" value="6">
  102. </div>
  103. </div>
  104. </div>
  105. <div class="mui-table my-table" style="padding-bottom: 15px;">
  106. <div class="mui-table-cell mui-col-xs-2">
  107. <label style="display: block;width: 60px;">购买渠道</label>
  108. </div>
  109. <div class="mui-table-cell mui-col-xs-3">
  110. <div class="mui-input-row mui-radio mui-left">
  111. <label class="my-label">JD</label>
  112. <input name="radio2" class="radio2" type="radio" checked="" value="1">
  113. </div>
  114. </div>
  115. <div class="mui-table-cell mui-col-xs-3">
  116. <div class="mui-input-row mui-radio mui-left">
  117. <label class="my-label">天猫</label>
  118. <input name="radio2" class="radio2" type="radio" value="2">
  119. </div>
  120. </div>
  121. <div class="mui-table-cell mui-col-xs-3">
  122. <div class="mui-input-row mui-radio mui-left">
  123. <label class="my-label">其他</label>
  124. <input name="radio2" class="radio2" type="radio" value="3">
  125. </div>
  126. </div>
  127. </div>
  128. <div class="mui-input-row line-top">
  129. <label>购买日期</label>
  130. <input type="text" id="buyDate" class="mui-input-clear" readonly="readonly" placeholder="填写您的购买日期">
  131. </div>
  132. </form>
  133. <br />
  134. <div class="mui-content-padded mui-text-center">
  135. <button type="button" class="my-btn-black" id="my-btn-submit" style="width: 50%;">提交注册</button>
  136. </div>
  137. </div>
  138. <!-- 加载ing begin-->
  139. <div class="loading covers">
  140. <div class="loading-bj"></div>
  141. <p>正在加载...</p>
  142. </div>
  143. <!-- 加载ing end -->
  144. <script type="text/javascript" src="js/mui.min.js"></script>
  145. <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
  146. <script type="text/javascript" src="js/main.js"></script>
  147. <script src="js/mui.picker.min.js"></script>
  148. <script type="text/javascript">
  149. window.addEventListener('pageshow', function(e) {
  150. // 通过persisted属性判断是否存在 BF Cache
  151. if(e.persisted) {
  152. location.reload();
  153. }
  154. });
  155. mui('body').on('tap', '#buyDate', function(event) {
  156. var date = new Date();
  157. var y = date.getFullYear();
  158. var m = date.getMonth();//获取当前月份的日期
  159. var d = date.getDate();
  160. var picker = new mui.DtPicker({
  161. type: "date", //设置日历初始视图模式
  162. beginDate: new Date(2018, 00, 08), //设置开始日期
  163. endDate: new Date(y, m, d) //设置结束日期
  164. });
  165. picker.show(function(rs) {
  166. $("#buyDate").val(rs.text);
  167. picker.dispose();
  168. picker = null;
  169. });
  170. });
  171. var qrCode = null;
  172. var isFocusOn = null;
  173. var userIdentity = null;
  174. mui.ready(function() {
  175. console.log("页面加载完毕");
  176. //获取机器条码 barcode
  177. qrCode = getParam("qrCode");
  178. if(qrCode != null){
  179. $(".loading").hide().css("opacity", "0"); //隐藏(正在加载...)
  180. $("#barCodeId").html("("+qrCode+")");
  181. $.ajax(base_path + '/wechat/getActivationAndMember?dates=' + new Date().getTime(), {
  182. data: {
  183. "qrCode":qrCode//产品类型id
  184. },
  185. dataType: 'json',
  186. xhrFields: {
  187. withCredentials: true
  188. },
  189. crossDomain: true,
  190. type: 'get',
  191. timeout: 15000,
  192. success: function(dt) {
  193. if(dt.isRedirect) {
  194. location.href = dt.redirectURL;
  195. } else {
  196. if(dt.status) {//判断接口返回状态status
  197. if(dt.data.isActivation){
  198. //已激活
  199. mui.alert('该产品已被激活!', '提醒', function() {
  200. location.href="my-center.html";
  201. });
  202. }
  203. if(dt.data.memberInfo.userStatus != 2){
  204. //未关注
  205. mui.alert('请先关注公众号再激活!', '提醒', function() {
  206. location.href="follow-me-tooth.html";
  207. });
  208. //填充用户数据
  209. $("#ipt-name").val(dt.data.memberInfo.userName);
  210. if(dt.data.memberInfo.userSex != null){
  211. if(dt.data.memberInfo.userSex == 1){
  212. $("#maleId").attr("checked", true);
  213. }
  214. if(dt.data.memberInfo.userSex == 2){
  215. $("#femaleId").attr("checked", true);
  216. }
  217. }
  218. var radios = $(".radio1");
  219. switch (dt.data.memberInfo.userAgeStage) {
  220. case (1):
  221. radios.eq(0).attr("checked", true);
  222. break;
  223. case (2):
  224. radios.eq(1).attr("checked", true);
  225. break;
  226. case (3):
  227. radios.eq(2).attr("checked", true);
  228. break;
  229. case (4):
  230. radios.eq(3).attr("checked", true);
  231. break;
  232. case (5):
  233. radios.eq(4).attr("checked", true);
  234. break;
  235. case (6):
  236. radios.eq(5).attr("checked", true);
  237. }
  238. isFocusOn = dt.data.memberInfo.userStatus;
  239. userIdentity = dt.data.memberInfo.userIdentity;
  240. } else {
  241. mui.alert("查询失败!");
  242. }
  243. }
  244. },
  245. error: function(xhr, type, errorThrown) {
  246. console.log(xhr);
  247. mui.alert("网络错误!");
  248. }
  249. });
  250. }
  251. });
  252. $(document).on('tap', '#my-btn-submit', function() {
  253. validate();//验证文本框
  254. var userName = $("#ipt-name").val();
  255. var userSex = $('input[name="radio0"]:checked ').val();
  256. var userAgeStage = $('input[name="radio1"]:checked ').val();
  257. var apparatusStore = $('input[name="radio2"]:checked ').val();
  258. var buyDate = $("#buyDate").val();
  259. var selectDate = new Date(Date.parse(buyDate));
  260. var nowDate = new Date(Date.parse(new Date().toLocaleDateString()));
  261. //if(selectDate>nowDate){
  262. //mui.alert("购买日期不能大于当前日期");
  263. //return false;
  264. //}
  265. if(validate_flag){
  266. //验证通过
  267. $.ajax(base_path + '/wechat/apparatus/add_apparatus?dates=' + new Date().getTime(), {
  268. data: {
  269. "barCode":qrCode,//条码
  270. "userName":userName,//用户姓名
  271. "userSex":userSex,//用户姓名
  272. "userAgeStage":userAgeStage,//年龄阶段1:80后 2:85后 3:90后 4:95后 5:00后 6:其他
  273. "apparatusStore":apparatusStore,//渠道id 1:天猫2:淘宝3:京东4:微信
  274. "buyDate":buyDate//购买日期
  275. },
  276. dataType: 'json',
  277. xhrFields: {
  278. withCredentials: true
  279. },
  280. crossDomain: true,
  281. type: 'get',
  282. timeout: 15000,
  283. success: function(dt) {
  284. if(dt.isRedirect) {
  285. location.href = dt.redirectURL;
  286. } else {
  287. if(dt.status) {//判断接口返回状态status
  288. mui.alert('注册成功!', '提醒', function() {
  289. if(userIdentity == 1){//会员
  290. if(isFocusOn == 1 || isFocusOn == 0){//未关注
  291. location.href="member-follow-me.html";
  292. }else{//以关注
  293. location.href="welfare-service.html";
  294. }
  295. }else{//非会员
  296. if(isFocusOn == 1 || isFocusOn == 0){//未关注
  297. location.href="follow-me.html";
  298. }else{//以关注
  299. location.href="welfare-service.html";
  300. }
  301. }
  302. });
  303. } else {
  304. mui.alert(dt.message, '提醒', function() {
  305. location.href="my-center.html";
  306. });
  307. //mui.alert(dt.message);
  308. }
  309. }
  310. },
  311. error: function(xhr, type, errorThrown) {
  312. console.log(xhr);
  313. mui.alert("网络错误");
  314. }
  315. });
  316. }else{
  317. mui.alert(dalog_msg);//弹窗提示
  318. }
  319. });
  320. //正则表达式示例
  321. var dalog_msg='',validate_flag=false;
  322. function validate() {
  323. var ch_en_num = /^[A-Za-z_\-\u4e00-\u9fa5]{2,10}$/; //简体中文英文(2-10位)
  324. var full_date = /^\d{4}(\-|\/|.)\d{1,2}\1\d{1,2}$/; //日期格式 (2016\12\12,2016-12-12,2016.12.12)
  325. var name = $("#ipt-name").val().trim();
  326. if(ch_en_num.test(name)) {
  327. //验证通过
  328. validate_flag=true;
  329. } else {
  330. //未通过验证
  331. if(name != '') {
  332. dalog_msg='名字格式不正确';
  333. } else {
  334. dalog_msg='请填写名字';
  335. }
  336. validate_flag=false;
  337. }
  338. if($("#buyDate").val() == null || $("#buyDate").val() == ""){
  339. dalog_msg='请选择购买日期';
  340. validate_flag=false;
  341. }
  342. return dalog_msg;//返回提示信息
  343. }
  344. </script>
  345. </body>
  346. </html>