------废弃页面------add_machine.html 21 KB

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