add_machine.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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="//s.iamberry.com/wateroPF/css/mui.min.css?v=2017092601" />
  10. <link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/css/mui.picker.min.css?v=2017092601" />
  11. <link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/new/css/iconfont.css?v=2017092601" />
  12. <link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/css/style.css?v=2017092601" />
  13. <link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/new/css/personal_information.css?v=2017092601" />
  14. <style>
  15. h4{margin-top:5px;margin-bottom: 5px;font-size: 20px;}
  16. .btn-pull-code{position: absolute;right: 10px;top:7px;height:34px;padding:0 6px;border-radius: 5px; line-height: 34px;font-size: 12px; color: #fff; background: #24cae9;}
  17. .btn-pull-code .active{background: #c8c8c8;}
  18. .icon-fuxuankuang a{color: #24cae9;}
  19. .icon-yanse,.icon-youhui,.icon-fuxuankuang,.icon-jiage,.icon-songhuo{font-size: 15px;padding-left: 22px;}
  20. .icon-yanse:before,.icon-fuxuankuang:before,.icon-youhui:before,.icon-jiage:before,.icon-songhuo:before{font-size: 18px;color: #24cae9;position: absolute;left: 0;width: 20px;height: 18px;}
  21. .try_price{color: #f1436c;}
  22. .ul_radio{width: 100%;}
  23. .ul_radio li{width:21%;height: 55px;margin: 0 1%;border: 1px solid rgba(0,0,0,.1);border-radius: 5px; display: inline-block;position: relative;font-family:"iconfont" !important;font-style:normal;-webkit-font-smoothing: antialiased;}
  24. .ul_radio .active:after{position: absolute;right: 0;bottom: 0;content: "\e66f";color: #f1436c;line-height: 1;font-size: 20px;}
  25. .head-img {position: absolute;bottom: 15px;right: 13px;width: 60px;height: 60px;border-radius: 30px;border: 3px solid #E5E5E5;}
  26. .mui-table-view .mui-media .mui-media-body{height: 41px;line-height: 41px;color: #333;}
  27. .mui-table-view .mui-media .mui-media-body>span{color: #f1436c;}
  28. .my-table-view-try{border-top: .6em solid #f0f0f0;border-bottom: .6em solid #f0f0f0;padding-bottom: 10px;}
  29. .my-table-view-try .mui-table-view-cell{padding:10px 13px 10px 30px !important;font-size: 12px;}
  30. .mui-table-view-cell:after,.mui-table-view:before,.mui-table-view:after,.mui-input-group .mui-input-row:after,.mui-input-group:before,.mui-input-group:after{display: none;}
  31. .mui-table-view-cell>a:not(.mui-btn){color: #666;margin: -15px -15px;}
  32. .mui-table-view-cell>a .mui-pull-right{color: #999;font-size: 14px;}
  33. #btn_submit{color: #fff;padding: 10px 0;font-size: 18px;background: #24cae9;width: 70%;margin:40px auto 0 auto;}
  34. .mui-btn-block.mui-active,.btn-pull-code.mui-active{background-color: #c8c8c8 !important;}
  35. .icon-fuxuankuang.mui-active:before{color: #c8c8c8;}
  36. .mui-content-padded{margin: 10px 13px;}
  37. .tips{padding: 25px 10px;background: #36a4c6;text-align: center;color: #fff;}
  38. .mui-input-group .mui-input-row {height: 50px;padding: 5px 0;border: 1px solid rgba(0,0,0,.1); margin:10px 0;}
  39. .mui-input-row label{color: #666;width:27%;font-size: 15px;}
  40. .mui-input-row label~input{width:73%;}
  41. .mui-input-row label~input::-webkit-input-placeholder{font-size: 15px;}
  42. .triangle-down {width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;border-top:7px solid #ccc;}
  43. .my-arrowright{position: absolute;right: 18px;top: 28px;color: #666;pointer-events:none;}
  44. .mui-btn-red{background-color: #e9004c;}
  45. .icon-saoma{position: absolute;right: 0;top:0;padding: 12px;color: #55c0dc;}
  46. .mui-icon-arrowdown{position: absolute;right: 0;top:0;padding: 12px;color: #999;pointer-events: none;}
  47. </style>
  48. </head>
  49. <body style="background: #fff;">
  50. <div class="loading-bg">
  51. <div class="mui-loading">
  52. <div class="mui-spinner">
  53. </div>
  54. &nbsp;&nbsp;加载中...
  55. </div>
  56. </div>
  57. <div class="mui-content" style="background: #fff;">
  58. <div class="tips more">
  59. <h4>现在完善机器信息!</h4>
  60. <span>尊享WaterO全面服务保障</span>
  61. <div></div>
  62. </div>
  63. <div class="mui-content-padded">
  64. <div><span class="iconfont icon-dingwei" style="color: #f00;"></span>地址:<span id="wx-ads"></span></div>
  65. <form class="mui-input-group">
  66. <div class="mui-input-row">
  67. <label>您的姓名</label>
  68. <input type="text" maxlength="12" class="mui-input-clear" placeholder="请填写您的姓名" id="ipt-name">
  69. </div>
  70. <div class="mui-input-row">
  71. <label>您的邮箱</label>
  72. <input type="text" maxlength="32" class="mui-input-clear" placeholder="请填写您的邮箱" id="ipt-email">
  73. </div>
  74. <div class="mui-input-row">
  75. <label>水质范围</label>
  76. <input type="text" placeholder="请选择您的水质范围" id="ipt-water" txtvalue="" readonly="readonly">
  77. </div>
  78. <div class="mui-input-row">
  79. <label>手机号码</label>
  80. <input type="tel" maxlength="11" class="mui-input-clear" placeholder="请填写物流发货时预留的手机号" id="ipt-phone">
  81. </div>
  82. <div class="mui-input-row">
  83. <label>验&nbsp;&nbsp;证&nbsp;&nbsp;码</label>
  84. <input type="text" maxlength="4" placeholder="请输入验证码" id="ipt-code">
  85. <span class="btn-pull-code" id="pull-code">获取验证码</span>
  86. </div>
  87. <div class="">
  88. <label style="color: red;"><b>*注意:</b><label id="txt_message">请填写与您物流信息相符的联系电话,否则将会无法识别您的产品信息</label></label>
  89. </div>
  90. </form>
  91. </div>
  92. <div class="mui-content-padded">
  93. <button type="button" data-loading-icon="mui-spinner mui-spinner-custom" data-loading-text="提交中" class="mui-btn mui-btn-block mui-btn-outlined mui-active" id="btn_submit" disabled="disabled" >提交</button>
  94. </div>
  95. </div>
  96. <script src="//s.iamberry.com/wateroPF/js/mui.min.js?v=2016101701"></script>
  97. <script src="//s.iamberry.com/wateroPF/js/mui.picker.min.js"></script>
  98. <script src="//s.iamberry.com/wateroPF/js/jquery-2.1.1.min.js"></script>
  99. <script src="//s.iamberry.com/wateroPF/js/shop/main.js?v=2016101701"></script>
  100. <script src="//s.iamberry.com/wateroPF/js/shop/wechat-utils-1.0.js"></script>
  101. <script type="text/javascript">
  102. var check = false,alert_msg='';
  103. var mobile=/^(13|14|15|18)[0-9]{9}$/; //手机号码
  104. var uname = /^[\u4e00-\u9fa5a-zA-Z]{1,12}$/; //中文英文
  105. var email=/^\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,18}$/;
  106. var code = /^[0-9]{4}$/; //数字
  107. var numberProvince = null;
  108. var numberCity = null;
  109. var numberDistrict = null;
  110. mui.ready(function(){
  111. //选择示例
  112. var userPicker = new mui.PopPicker();
  113. userPicker.setData([{
  114. value: '1',
  115. text: '0-100 TDS'
  116. }, {
  117. value: '2',
  118. text: '101-250 TDS'
  119. }, {
  120. value: '3',
  121. text: '251-500 TDS'
  122. }, {
  123. value: '4',
  124. text: '501 TDS 以上 '
  125. }]);
  126. var showUserPickerButton = document.getElementById('ipt-water');
  127. showUserPickerButton.addEventListener('tap', function(event) {
  128. userPicker.show(function(items) {
  129. document.getElementById('ipt-water').value = items[0].text;
  130. $('#ipt-water').attr('txtvalue',items[0].value);
  131. var txt_message = '';
  132. switch (items[0].value) {
  133. case '1':
  134. txt_message = '您家水质良好。';
  135. break;
  136. case '2':
  137. txt_message = '您家水质偏差,WaterO可彻底净化,请使用柠檬酸每3个月清洗。';
  138. break;
  139. case '3':
  140. txt_message = '您家水质较差,WaterO可彻底净化,请使用柠檬酸每2个月清洗。';
  141. break;
  142. case '4':
  143. txt_message = '您家水质很差,WaterO可彻底净化,请使用柠檬酸每1个月清洗。';
  144. break;
  145. }
  146. $('#txt_message').html(txt_message);
  147. });
  148. }, false);
  149. jWeixin.getLocation({
  150. type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
  151. success: function (res) {
  152. console.log(res);
  153. var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
  154. var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
  155. var speed = res.speed; // 速度,以米/每秒计
  156. var accuracy = res.accuracy; // 位置精度
  157. //getLocation(latitude,longitude);
  158. },
  159. cancel: function (res) {
  160. mui.alert('用户拒绝授权获取地理位置');
  161. }
  162. });
  163. document.querySelector('.loading-bg').style.display='none';
  164. });
  165. window.onload=function(){
  166. };
  167. function getLocation(latitude,longitude){
  168. $.ajax({
  169. type: 'get',
  170. url: 'http://apis.map.qq.com/ws/geocoder/v1/?location='+latitude+','+longitude+'&key=P2WBZ-LH73F-QZYJ2-JOVWI-J7G5J-ZFFEY&get_poi=0',
  171. dataType: 'json',
  172. timeout: 15000,
  173. success: function(dt) {
  174. console.log(dt);
  175. if(dt.status==0){
  176. $("#wx-ads").text(dt.result.ad_info.province+"-"+dt.result.ad_info.city+"-"+dt.result.ad_info.district);
  177. numberProvince = dt.result.ad_info.province;
  178. numberCity = dt.result.ad_info.city;
  179. numberDistrict = dt.result.ad_info.district;
  180. }
  181. },
  182. error: function(xhr, type, errorThrown) {
  183. console.log("请检查网络或刷新页面重试!");
  184. }
  185. });
  186. }
  187. mui('body').on('tap', '#btn_submit', function() {
  188. change_input();
  189. if(check){
  190. console.log("提交");
  191. mui(this).button('loading');
  192. setTimeout(function() {
  193. mui(this).button('reset');
  194. }.bind(this), 2000);
  195. //mui.alert("本批watero试用机为新机,请您在试用过程中足够爱惜,切勿刮划机身及损坏包装,感谢您的配合!");
  196. var data_array = {
  197. "userTel":$('#ipt-phone').val()
  198. };
  199. $.ajax({
  200. type: 'post',
  201. url: base_path + '/qrcode/select_efast_order_num',
  202. data:data_array,
  203. dataType: 'json',
  204. timeout: 15000,
  205. success: function(dt) {
  206. if (dt.status) {
  207. var num = dt.data.num;
  208. var txtTime = dt.data.txtTime;
  209. var text = '';
  210. if (dt.data.num > 0) {
  211. text = '您有'+ dt.data.num + '个订单,是否确认领取质保卡?';
  212. } else {
  213. mui.alert('未搜索到订单,请确认后提交,如有疑问,请联系公众号客服!');
  214. return;
  215. }
  216. var btnArray = ['否', '是'];
  217. mui.confirm(text, '提示', btnArray, function(e) {
  218. if (e.index == 1) {
  219. var data_all = {
  220. "phoneCode":$('#ipt-code').val(),
  221. "userName":$('#ipt-name').val(),
  222. "userTel":$('#ipt-phone').val(),
  223. "userEmail":$('#ipt-email').val(),
  224. "numberWatero":$('#ipt-water').attr('txtvalue'),
  225. "numberProvince":numberProvince,
  226. "numberCity":numberCity,
  227. "numberDistrict":numberDistrict,
  228. "txtTime":txtTime
  229. };
  230. $.ajax({
  231. type: 'post',
  232. url: base_path + '/qrcode/add_warranty_card',
  233. data:data_all,
  234. dataType: 'json',
  235. timeout: 15000,
  236. success: function(dt) {
  237. if (dt.status) {
  238. mui.openWindow({
  239. url: '/wateroPF/view/warranty_card.html'
  240. })
  241. } else {
  242. mui.alert(dt.message);
  243. }
  244. },
  245. error: function(xhr, type, errorThrown) {
  246. mui.alert("请检查网络或刷新页面重试!");
  247. }
  248. });
  249. }
  250. });
  251. } else {
  252. mui.alert(dt.message);
  253. }
  254. },
  255. error: function(xhr, type, errorThrown) {
  256. mui.alert("请检查网络或刷新页面重试!");
  257. }
  258. });
  259. }else{
  260. console.log("未通过");
  261. mui.alert(alert_msg);
  262. }
  263. });
  264. mui('body').on('tap', '#xieyi-dalog', function() {
  265. mui.openWindow({
  266. url: 'try_xieyi.html'
  267. });
  268. });
  269. $(".ul_radio li").each(function() {
  270. $(this).on("click", function() {
  271. $(this).addClass("active");
  272. $(this).siblings().removeClass("active");
  273. });
  274. });
  275. $(document).on('tap', '#btn-tongyi', function() {
  276. var btn_submit=$("#btn_submit");
  277. console.log($(this).hasClass("mui-active"));
  278. if($(this).hasClass("mui-active")){
  279. $(this).removeClass("mui-active");
  280. btn_submit.removeClass("mui-active");
  281. }else{
  282. $(this).addClass("mui-active");
  283. btn_submit.addClass("mui-active");
  284. }
  285. });
  286. $(document).on('tap', '#pull-code', function() {
  287. if($("#ipt-phone").val().trim()=="" &&(!$("#pull-code").hasClass("mui-active"))){
  288. mui.alert("请填写手机号码");
  289. return;
  290. }else{
  291. if(!mobile.test($("#ipt-phone").val().trim())){
  292. mui.alert("手机号码不正确,请重新填写");
  293. return;
  294. }else{
  295. if($(this).hasClass("mui-active")){
  296. mui.alert();
  297. return;
  298. }else{
  299. $(this).addClass("mui-active");
  300. $('#btn_submit').removeClass("mui-active");
  301. $('#btn_submit').removeAttr("disabled");
  302. settime("pull-code");
  303. $.ajax({
  304. type: 'post',
  305. url: base_path + '/qrcode/send_phone_code',
  306. data:{
  307. "phone" : $("#ipt-phone").val()
  308. },
  309. dataType: 'json',
  310. timeout: 15000,
  311. success: function(dt) {
  312. },
  313. error: function(xhr, type, errorThrown) {
  314. mui.alert("请检查网络或刷新页面重试!");
  315. }
  316. });
  317. }
  318. }
  319. }
  320. });
  321. var countdown=60;
  322. function settime(val) {
  323. pullid=dc(val);
  324. if (countdown == 0) {
  325. pullid.removeAttribute("disabled");
  326. pullid.className='btn-pull-code';
  327. pullid.innerText="获取验证码";
  328. countdown = 60;
  329. return false;
  330. } else {
  331. pullid.setAttribute("disabled", true);
  332. pullid.className='btn-pull-code mui-active';
  333. pullid.innerText="重新发送(" + countdown + ")";
  334. countdown--;
  335. }
  336. setTimeout(function() {
  337. settime(val)
  338. },1000)
  339. }
  340. function change_input() {
  341. //活动暂时结束 下次开启时注释这段代码就好了
  342. /*alert_msg="活动已暂停,开始时间请联系客服";
  343. check=false;
  344. return false;*/
  345. $(".mui-input-group input").each(function(index) {
  346. switch ($(this).attr("id")){
  347. case "ipt-name":
  348. if($(this).val().trim()==""){
  349. alert_msg="请填写姓名";
  350. check=false;
  351. return false;
  352. }else{
  353. if(uname.test($(this).val())) {
  354. check=true;
  355. }else{
  356. alert_msg="姓名格式不正确,请重新填写";
  357. check=false;
  358. return false;
  359. }
  360. }
  361. break;
  362. case "ipt-email":
  363. if($(this).val().trim()==""){
  364. alert_msg="请填写您的邮箱";
  365. check=false;
  366. return false;
  367. }else{
  368. if(email.test($(this).val())) {
  369. check=true;
  370. }else{
  371. alert_msg="邮箱格式不正确,请重新填写";
  372. check=false;
  373. return false;
  374. }
  375. }
  376. break;
  377. case "ipt-phone":
  378. if($(this).val().trim()==""){
  379. alert_msg="请填写手机号";
  380. check=false;
  381. return false;
  382. }else{
  383. if(mobile.test($(this).val().trim())) {
  384. check=true;
  385. }else{
  386. alert_msg="手机号码不正确,请重新填写";
  387. check=false;
  388. return false;
  389. }
  390. }
  391. break;
  392. case "ipt-code":
  393. if($(this).val().trim()==""){
  394. alert_msg="请填写验证码";
  395. check=false;
  396. return false;
  397. }else{
  398. if(code.test($(this).val().trim())) {
  399. check=true;
  400. }else{
  401. alert_msg="验证码格式不正确,请重新填写";
  402. check=false;
  403. return false;
  404. }
  405. }
  406. break;
  407. default:
  408. break;
  409. }
  410. });
  411. var btn_submit = dc('btn_submit');
  412. if(check) {
  413. console.log("通过")
  414. } else {
  415. console.log(alert_msg);
  416. }
  417. }
  418. var flag = false;
  419. var mask = mui.createMask(function() {
  420. return flag;
  421. }); //callback为用户点击蒙版时自动执行的回调;
  422. mui('body').on('tap', '#ipt-date', function() {
  423. var th = this;
  424. var picker = new mui.DtPicker({
  425. type: "date", //设置日历初始视图模式
  426. beginDate: new Date(2016, 7, 1), //设置开始日期
  427. endDate: new Date() //设置结束日期
  428. });
  429. console.log(picker)
  430. picker.show(function(rs) {
  431. th.value = rs.text;
  432. picker.dispose();
  433. });
  434. });
  435. </script>
  436. </body>
  437. </html>