add_machine.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  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 id="div_message" style="display: none;">
  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="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
  101. <script src="//s.iamberry.com/wateroPF/js/shop/wechat-utils-1.0.js"></script>
  102. <script type="text/javascript">
  103. var check = false,alert_msg='';
  104. var mobile=/^(13|14|15|18)[0-9]{9}$/; //手机号码
  105. var uname = /^[\u4e00-\u9fa5a-zA-Z]{1,12}$/; //中文英文
  106. var email=/^\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,18}$/;
  107. var code = /^[0-9]{4}$/; //数字
  108. var numberProvince = null;
  109. var numberCity = null;
  110. var numberDistrict = null;
  111. mui.ready(function(){
  112. //选择示例
  113. var userPicker = new mui.PopPicker();
  114. userPicker.setData([{
  115. value: '1',
  116. text: '0-100 TDS'
  117. }, {
  118. value: '2',
  119. text: '101-250 TDS'
  120. }, {
  121. value: '3',
  122. text: '251-500 TDS'
  123. }, {
  124. value: '4',
  125. text: '501 TDS 以上 '
  126. }]);
  127. var showUserPickerButton = document.getElementById('ipt-water');
  128. showUserPickerButton.addEventListener('tap', function(event) {
  129. userPicker.show(function(items) {
  130. document.getElementById('ipt-water').value = items[0].text;
  131. $('#ipt-water').attr('txtvalue',items[0].value);
  132. var txt_message = '';
  133. switch (items[0].value) {
  134. case '1':
  135. txt_message = '您家水质良好。';
  136. break;
  137. case '2':
  138. txt_message = '您家水质偏差,WaterO可彻底净化,请使用柠檬酸每3个月清洗。';
  139. break;
  140. case '3':
  141. txt_message = '您家水质较差,WaterO可彻底净化,请使用柠檬酸每2个月清洗。';
  142. break;
  143. case '4':
  144. txt_message = '您家水质很差,WaterO可彻底净化,请使用柠檬酸每1个月清洗。';
  145. break;
  146. }
  147. $('#txt_message').html(txt_message);
  148. $('#div_message').show();
  149. });
  150. }, false);
  151. document.querySelector('.loading-bg').style.display='none';
  152. });
  153. wx.ready(function () {
  154. // 7.2 获取当前地理位置
  155. wx.getLocation({
  156. success: function (res) {
  157. var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
  158. var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
  159. var speed = res.speed; // 速度,以米/每秒计
  160. var accuracy = res.accuracy; // 位置精度
  161. getlocation(latitude,longitude);
  162. },
  163. cancel: function (res) {
  164. $("#wx-ads").text('定位失败');
  165. }
  166. });
  167. });
  168. function getlocation(latitude,longitude){
  169. var data_array = {
  170. "latitude":latitude,
  171. "longitude":longitude
  172. };
  173. $.ajax({
  174. type: 'get',
  175. url: base_path + '/qrcode/get_location_by_qq',
  176. data:data_array,
  177. dataType: 'json',
  178. timeout: 15000,
  179. success: function(dt) {
  180. if(dt.status){
  181. numberProvince = dt.data.numberProvince;
  182. numberCity = dt.data.numberCity;
  183. numberDistrict = dt.data.numberDistrict;
  184. $("#wx-ads").text(numberProvince+"-"+numberCity+"-"+numberDistrict);
  185. }
  186. },
  187. error: function(xhr, type, errorThrown) {
  188. console.log("请检查网络或刷新页面重试!");
  189. }
  190. });
  191. }
  192. mui('body').on('tap', '#btn_submit', function() {
  193. change_input();
  194. if(check){
  195. console.log("提交");
  196. mui(this).button('loading');
  197. setTimeout(function() {
  198. mui(this).button('reset');
  199. }.bind(this), 2000);
  200. //mui.alert("本批watero试用机为新机,请您在试用过程中足够爱惜,切勿刮划机身及损坏包装,感谢您的配合!");
  201. var data_array = {
  202. "userTel":$('#ipt-phone').val()
  203. };
  204. $.ajax({
  205. type: 'post',
  206. url: base_path + '/qrcode/select_efast_order_num',
  207. data:data_array,
  208. dataType: 'json',
  209. timeout: 15000,
  210. success: function(dt) {
  211. if (dt.status) {
  212. var num = dt.data.num;
  213. var txtTime = dt.data.txtTime;
  214. var text = '';
  215. if (dt.data.num > 0) {
  216. text = '您有'+ dt.data.num + '个订单,是否确认领取质保卡?';
  217. } else {
  218. mui.alert('未搜索到订单,请确认后提交,如有疑问,请联系公众号客服!');
  219. return;
  220. }
  221. var btnArray = ['否', '是'];
  222. mui.confirm(text, '提示', btnArray, function(e) {
  223. if (e.index == 1) {
  224. var data_all = {
  225. "phoneCode":$('#ipt-code').val(),
  226. "userName":$('#ipt-name').val(),
  227. "userTel":$('#ipt-phone').val(),
  228. "userEmail":$('#ipt-email').val(),
  229. "numberWatero":$('#ipt-water').attr('txtvalue'),
  230. "numberProvince":numberProvince,
  231. "numberCity":numberCity,
  232. "numberDistrict":numberDistrict,
  233. "txtTime":txtTime
  234. };
  235. $.ajax({
  236. type: 'post',
  237. url: base_path + '/qrcode/add_warranty_card',
  238. data:data_all,
  239. dataType: 'json',
  240. timeout: 15000,
  241. success: function(dt) {
  242. if (dt.status) {
  243. mui.openWindow({
  244. url: '/wateroPF/view/warranty_card.html'
  245. })
  246. } else {
  247. mui.alert(dt.message);
  248. }
  249. },
  250. error: function(xhr, type, errorThrown) {
  251. mui.alert("请检查网络或刷新页面重试!");
  252. }
  253. });
  254. }
  255. });
  256. } else {
  257. mui.alert(dt.message);
  258. }
  259. },
  260. error: function(xhr, type, errorThrown) {
  261. mui.alert("请检查网络或刷新页面重试!");
  262. }
  263. });
  264. }else{
  265. console.log("未通过");
  266. mui.alert(alert_msg);
  267. }
  268. });
  269. mui('body').on('tap', '#xieyi-dalog', function() {
  270. mui.openWindow({
  271. url: 'try_xieyi.html'
  272. });
  273. });
  274. $(".ul_radio li").each(function() {
  275. $(this).on("click", function() {
  276. $(this).addClass("active");
  277. $(this).siblings().removeClass("active");
  278. });
  279. });
  280. $(document).on('tap', '#btn-tongyi', function() {
  281. var btn_submit=$("#btn_submit");
  282. console.log($(this).hasClass("mui-active"));
  283. if($(this).hasClass("mui-active")){
  284. $(this).removeClass("mui-active");
  285. btn_submit.removeClass("mui-active");
  286. }else{
  287. $(this).addClass("mui-active");
  288. btn_submit.addClass("mui-active");
  289. }
  290. });
  291. $(document).on('tap', '#pull-code', function() {
  292. if($("#ipt-phone").val().trim()=="" &&(!$("#pull-code").hasClass("mui-active"))){
  293. mui.alert("请填写手机号码");
  294. return;
  295. }else{
  296. if(!mobile.test($("#ipt-phone").val().trim())){
  297. mui.alert("手机号码不正确,请重新填写");
  298. return;
  299. }else{
  300. if($(this).hasClass("mui-active")){
  301. mui.alert();
  302. return;
  303. }else{
  304. $(this).addClass("mui-active");
  305. $('#btn_submit').removeClass("mui-active");
  306. $('#btn_submit').removeAttr("disabled");
  307. settime("pull-code");
  308. $.ajax({
  309. type: 'post',
  310. url: base_path + '/qrcode/send_phone_code',
  311. data:{
  312. "phone" : $("#ipt-phone").val()
  313. },
  314. dataType: 'json',
  315. timeout: 15000,
  316. success: function(dt) {
  317. },
  318. error: function(xhr, type, errorThrown) {
  319. mui.alert("请检查网络或刷新页面重试!");
  320. }
  321. });
  322. }
  323. }
  324. }
  325. });
  326. var countdown=60;
  327. function settime(val) {
  328. pullid=dc(val);
  329. if (countdown == 0) {
  330. pullid.removeAttribute("disabled");
  331. pullid.className='btn-pull-code';
  332. pullid.innerText="获取验证码";
  333. countdown = 60;
  334. return false;
  335. } else {
  336. pullid.setAttribute("disabled", true);
  337. pullid.className='btn-pull-code mui-active';
  338. pullid.innerText="重新发送(" + countdown + ")";
  339. countdown--;
  340. }
  341. setTimeout(function() {
  342. settime(val)
  343. },1000)
  344. }
  345. function change_input() {
  346. //活动暂时结束 下次开启时注释这段代码就好了
  347. /*alert_msg="活动已暂停,开始时间请联系客服";
  348. check=false;
  349. return false;*/
  350. $(".mui-input-group input").each(function(index) {
  351. switch ($(this).attr("id")){
  352. case "ipt-name":
  353. if($(this).val().trim()==""){
  354. alert_msg="请填写姓名";
  355. check=false;
  356. return false;
  357. }else{
  358. if(uname.test($(this).val())) {
  359. check=true;
  360. }else{
  361. alert_msg="姓名格式不正确,请重新填写";
  362. check=false;
  363. return false;
  364. }
  365. }
  366. break;
  367. case "ipt-email":
  368. if($(this).val().trim()==""){
  369. alert_msg="请填写您的邮箱";
  370. check=false;
  371. return false;
  372. }else{
  373. if(email.test($(this).val())) {
  374. check=true;
  375. }else{
  376. alert_msg="邮箱格式不正确,请重新填写";
  377. check=false;
  378. return false;
  379. }
  380. }
  381. break;
  382. case "ipt-phone":
  383. if($(this).val().trim()==""){
  384. alert_msg="请填写手机号";
  385. check=false;
  386. return false;
  387. }else{
  388. if(mobile.test($(this).val().trim())) {
  389. check=true;
  390. }else{
  391. alert_msg="手机号码不正确,请重新填写";
  392. check=false;
  393. return false;
  394. }
  395. }
  396. break;
  397. case "ipt-code":
  398. if($(this).val().trim()==""){
  399. alert_msg="请填写验证码";
  400. check=false;
  401. return false;
  402. }else{
  403. if(code.test($(this).val().trim())) {
  404. check=true;
  405. }else{
  406. alert_msg="验证码格式不正确,请重新填写";
  407. check=false;
  408. return false;
  409. }
  410. }
  411. break;
  412. default:
  413. break;
  414. }
  415. });
  416. var btn_submit = dc('btn_submit');
  417. if(check) {
  418. console.log("通过")
  419. } else {
  420. console.log(alert_msg);
  421. }
  422. }
  423. var flag = false;
  424. var mask = mui.createMask(function() {
  425. return flag;
  426. }); //callback为用户点击蒙版时自动执行的回调;
  427. mui('body').on('tap', '#ipt-date', function() {
  428. var th = this;
  429. var picker = new mui.DtPicker({
  430. type: "date", //设置日历初始视图模式
  431. beginDate: new Date(2016, 7, 1), //设置开始日期
  432. endDate: new Date() //设置结束日期
  433. });
  434. console.log(picker)
  435. picker.show(function(rs) {
  436. th.value = rs.text;
  437. picker.dispose();
  438. });
  439. });
  440. </script>
  441. </body>
  442. </html>