register-vip.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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. //填充用户数据
  204. $("#ipt-name").val(dt.data.memberInfo.userName);
  205. if(dt.data.memberInfo.userSex != null){
  206. if(dt.data.memberInfo.userSex == 1){
  207. $("#maleId").attr("checked", true);
  208. }
  209. if(dt.data.memberInfo.userSex == 2){
  210. $("#femaleId").attr("checked", true);
  211. }
  212. }
  213. var radios = $(".radio1");
  214. switch (dt.data.memberInfo.userAgeStage) {
  215. case (1):
  216. radios.eq(0).attr("checked", true);
  217. break;
  218. case (2):
  219. radios.eq(1).attr("checked", true);
  220. break;
  221. case (3):
  222. radios.eq(2).attr("checked", true);
  223. break;
  224. case (4):
  225. radios.eq(3).attr("checked", true);
  226. break;
  227. case (5):
  228. radios.eq(4).attr("checked", true);
  229. break;
  230. case (6):
  231. radios.eq(5).attr("checked", true);
  232. }
  233. isFocusOn = dt.data.memberInfo.userStatus;
  234. userIdentity = dt.data.memberInfo.userIdentity;
  235. } else {
  236. mui.alert("查询失败!");
  237. }
  238. }
  239. },
  240. error: function(xhr, type, errorThrown) {
  241. console.log(xhr);
  242. mui.alert("网络错误!");
  243. }
  244. });
  245. }
  246. });
  247. $(document).on('tap', '#my-btn-submit', function() {
  248. validate();//验证文本框
  249. var userName = $("#ipt-name").val();
  250. var userSex = $('input[name="radio0"]:checked ').val();
  251. var userAgeStage = $('input[name="radio1"]:checked ').val();
  252. var apparatusStore = $('input[name="radio2"]:checked ').val();
  253. var buyDate = $("#buyDate").val();
  254. var selectDate = new Date(Date.parse(buyDate));
  255. var nowDate = new Date(Date.parse(new Date().toLocaleDateString()));
  256. //if(selectDate>nowDate){
  257. //mui.alert("购买日期不能大于当前日期");
  258. //return false;
  259. //}
  260. if(validate_flag){
  261. //验证通过
  262. $.ajax(base_path + '/wechat/apparatus/add_apparatus?dates=' + new Date().getTime(), {
  263. data: {
  264. "barCode":qrCode,//条码
  265. "userName":userName,//用户姓名
  266. "userSex":userSex,//用户姓名
  267. "userAgeStage":userAgeStage,//年龄阶段1:80后 2:85后 3:90后 4:95后 5:00后 6:其他
  268. "apparatusStore":apparatusStore,//渠道id 1:天猫2:淘宝3:京东4:微信
  269. "buyDate":buyDate//购买日期
  270. },
  271. dataType: 'json',
  272. xhrFields: {
  273. withCredentials: true
  274. },
  275. crossDomain: true,
  276. type: 'get',
  277. timeout: 15000,
  278. success: function(dt) {
  279. if(dt.isRedirect) {
  280. location.href = dt.redirectURL;
  281. } else {
  282. if(dt.status) {//判断接口返回状态status
  283. mui.alert('注册成功!', '提醒', function() {
  284. if(userIdentity == 1){//会员
  285. if(isFocusOn == 1 || isFocusOn == 0){//未关注
  286. location.href="member-follow-me.html";
  287. }else{//以关注
  288. location.href="my-center.html";
  289. }
  290. }else{//非会员
  291. if(isFocusOn == 1 || isFocusOn == 0){//未关注
  292. location.href="follow-me.html";
  293. }else{//以关注
  294. location.href="my-center.html";
  295. }
  296. }
  297. });
  298. } else {
  299. mui.alert(dt.message, '提醒', function() {
  300. location.href="my-center.html";
  301. });
  302. //mui.alert(dt.message);
  303. }
  304. }
  305. },
  306. error: function(xhr, type, errorThrown) {
  307. console.log(xhr);
  308. mui.alert("网络错误");
  309. }
  310. });
  311. }else{
  312. mui.alert(dalog_msg);//弹窗提示
  313. }
  314. });
  315. //正则表达式示例
  316. var dalog_msg='',validate_flag=false;
  317. function validate() {
  318. var ch_en_num = /^[A-Za-z_\-\u4e00-\u9fa5]{2,10}$/; //简体中文英文(2-10位)
  319. var full_date = /^\d{4}(\-|\/|.)\d{1,2}\1\d{1,2}$/; //日期格式 (2016\12\12,2016-12-12,2016.12.12)
  320. var name = $("#ipt-name").val().trim();
  321. if(ch_en_num.test(name)) {
  322. //验证通过
  323. validate_flag=true;
  324. } else {
  325. //未通过验证
  326. if(name != '') {
  327. dalog_msg='名字格式不正确';
  328. } else {
  329. dalog_msg='请填写名字';
  330. }
  331. validate_flag=false;
  332. }
  333. if($("#buyDate").val() == null || $("#buyDate").val() == ""){
  334. dalog_msg='请选择购买日期';
  335. validate_flag=false;
  336. }
  337. return dalog_msg;//返回提示信息
  338. }
  339. </script>
  340. </body>
  341. </html>