main.js 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109
  1. import * as compnt from "../../../../public/js/compnt.js";
  2. import * as unicom from "../../../../public/js/unicom.js";
  3. import "../scss/order.scss";
  4. var usermob = getQueryString("userid");
  5. // var spid = 'b0ecd218570506ac3337d1925de043bb';
  6. var spid = getQueryString("spid");
  7. var productidas = '';
  8. // var name_a = '定向流量权益包';
  9. $(function() {
  10. var isPageHide = false;
  11. window.addEventListener('pageshow', function() {
  12. if (isPageHide) {
  13. window.location.reload();
  14. }
  15. });
  16. window.addEventListener('pagehide', function() {
  17. isPageHide = true;
  18. });
  19. if (window.location.href.indexOf('draw20220313.html') >= 0) {
  20. var user = JSON.parse(localStorage.getItem('user'));
  21. if (user != null) {
  22. $('.usermob').val(user.usermob);
  23. }
  24. }
  25. })
  26. init();
  27. function init() {
  28. var message = localStorage.getItem('message');
  29. if (message != null && message != '') {
  30. compnt.showAlert(message);
  31. localStorage.removeItem('message');
  32. }
  33. compnt.showLoading();
  34. unicom.init().then(function(response) {
  35. compnt.hideLoading();
  36. unicom.product = response.product[0];
  37. unicom.fesname = response.festival;
  38. unicom.loadUserInfo();
  39. if (location.href.indexOf("15/index") >= 0) {
  40. showOrderPage();
  41. } else {
  42. openPage();
  43. }
  44. if (location.href.indexOf('/cancel') >= 0) {
  45. unicom.burypointLogId('110002'); // 退订页面pv, pv去重得到uv
  46. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'cancel_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  47. } else
  48. if (location.href.indexOf('/draw') >= 0) {
  49. unicom.burypointLogId('110003'); // 领取页面pv, pv去重得到uv
  50. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'draw_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  51. } else
  52. if (location.href.indexOf('/flow') >= 0) {
  53. unicom.burypointLogId('110004'); // 流量查询pv, pv去重得到uv
  54. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'flow_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  55. } else if (location.href.indexOf('/active') >= 0) {
  56. unicom.burypointLogId('110005'); // 激活页面pv, pv去重得到uv
  57. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'active_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  58. } else if (location.href.indexOf('/refund') >= 0) {
  59. unicom.burypointLogId('110006'); // 退款
  60. } else {
  61. unicom.burypointLogId('110001'); // 订购页面pv, pv去重得到uv
  62. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'order_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  63. }
  64. })
  65. }
  66. function openPage(pageName) {
  67. if (pageName == null) {
  68. if (location.href.indexOf("index.html") >= 0) pageName = "order";
  69. if (location.href.indexOf("cannel20220313.html") >= 0) pageName = "cancel";
  70. if (location.href.indexOf("draw20220313.html") >= 0) pageName = "draw";
  71. if (location.href.indexOf("active.html") >= 0) pageName = "active";
  72. if (location.href.indexOf("flow.html") >= 0) pageName = "flow";
  73. }
  74. switch (pageName) {
  75. case "active":
  76. showActivePage();
  77. break;
  78. case "cancel":
  79. showCancelPage();
  80. break;
  81. case "draw":
  82. unicom.queryWeiboUserInfoaks(usermob, spid).done(function(response) {
  83. console.log(response)
  84. productidas = response.productid;
  85. if (response.productid == '2020090401') {
  86. name_a = '定向流量权益包(后向)';
  87. } else
  88. if (response.productid == '2021091709') {
  89. name_a = '定向流量权益包(联通次月生效)';
  90. } else if (response.productid == '2020111201') {
  91. name_a = '定向流量权益包(次月生效)';
  92. } else if (response.productid == '2021091702') {
  93. name_a = '定向流量权益包(联通立即生效)';
  94. }
  95. })
  96. chaxun()
  97. showDrawPage();
  98. break;
  99. case "flow":
  100. showFlowPage();
  101. break;
  102. default:
  103. showOrderPage();
  104. break;
  105. }
  106. }
  107. function chaxun() {
  108. compnt.showLoading('处理中,请稍后...');
  109. unicom.queryWeiboUserInfoak(usermob).done(function(response) {
  110. compnt.hideLoading();
  111. var arr = '';
  112. response.data.forEach(function(item) {
  113. if (item.status == "3") {
  114. arr += 1
  115. $('#information').html('已订购,有' + arr + '个权益未领取');
  116. } else if (item.status == "2" && arr == '') {
  117. $('#information').html('已订购,已领取');
  118. // $(".order_a").attr("class", "order_b")
  119. $('.order_a').css('pointer-events', 'none')
  120. $('.order_a').css('-webkit-filter', 'grayscale(100%)')
  121. } else if (item.status != "2" && arr == '' && item.status != "3") {
  122. $('#information').html('未订购此产品!');
  123. $(".order_a").attr("class", "order_ca")
  124. $('.order_a').css('display', 'none')
  125. $('.ordersak').css('display', 'block')
  126. $('#btn-order').unbind('click').on('click', function(event) {
  127. //compnt.showAlert('退订成功');
  128. // return;
  129. // console.log(1)
  130. if (!compnt.lockClick()) {
  131. return;
  132. }
  133. unicom.showCapPage(null, null, false, false, true).then(function(data) {
  134. compnt.unlockClick();
  135. order(data.userid, data.token, data.usermob);
  136. }).fail(function(response) {
  137. compnt.unlockClick();
  138. })
  139. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_click_order_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  140. })
  141. }
  142. })
  143. // console.log(response)
  144. // console.log(response.productid)
  145. // if (response.productid == '2020090401') {
  146. // name_a = '定向流量权益包(后向)';
  147. // } else if (response.productid == '2021091709') {
  148. // name_a = '定向流量权益包(联通次月生效)';
  149. // } else if (response.productid == '2020111201') {
  150. // name_a = '定向流量权益包(次月生效)';
  151. // } else if (response.productid == '2021091702') {
  152. // name_a = '定向流量权益包(联通立即生效)';
  153. // }
  154. // console.log(response.productid)
  155. // if (response.productid == '2020090401') {
  156. // name_a = '定向流量权益包(后向)';
  157. // } else if (response.productid == '2021091709') {
  158. // name_a = '定向流量权益包(联通次月生效)';
  159. // } else if (response.productid == '2020111201') {
  160. // name_a = '定向流量权益包(次月生效)';
  161. // } else if (response.productid == '2021091702') {
  162. // name_a = '定向流量权益包(联通立即生效)';
  163. // }
  164. // if (response.status == "1" && response.vipstatu == '0') {
  165. // $('#information').html('已订购,未领取权益!');
  166. // } else if (response.resultCode == "1102") {
  167. // $('#information').html('权益以领取!');
  168. // $(".order_a").attr("class", "order_b")
  169. // } else if (response.status == "0" && response.vipstatu == '0') {
  170. // $('#information').html('未订购此产品!');
  171. // $(".order_a").attr("class", "order_ca")
  172. // // $('.order_a').css('display', 'none')
  173. // // $('.ordersak').css('display', 'block')
  174. // // $('#btn-order').unbind('click').on('click', function(event) {
  175. // // //compnt.showAlert('退订成功');
  176. // // // return;
  177. // // // console.log(1)
  178. // // if (!compnt.lockClick()) {
  179. // // return;
  180. // // }
  181. // // unicom.showCapPage(null, null, false, false, true).then(function(data) {
  182. // // compnt.unlockClick();
  183. // // order(data.userid, data.token, data.usermob);
  184. // // }).fail(function(response) {
  185. // // compnt.unlockClick();
  186. // // })
  187. // // WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_click_order_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  188. // // })
  189. // } else if (response.status == "1" && response.vipstatu == '1') {
  190. // $('#information').html('已订购,权益已领取!');
  191. // $(".order_a").attr("class", "order_b")
  192. // } else if (response.status == "0" && response.vipstatu == '1') {
  193. // $('#information').html('权益已领取!');
  194. // $(".order_a").attr("class", "order_b")
  195. // } else if (response.resultCode == "1067") {
  196. // $('#information').html('领取失败,已领取或领取时间结束!');
  197. // } else {
  198. // $('#information').html(response.errorInfo);
  199. // }
  200. })
  201. }
  202. $('#btn_cannel').unbind('click').on('click', function() {
  203. unicom.showCancelReasonPage().done(function(cancelReason) {
  204. var k = JSON.stringify(cancelReason)
  205. window.localStorage.setItem('kye', k)
  206. gotoUrl('douyin/15/cannel20220313')
  207. }).fail(function() {
  208. });
  209. })
  210. // $('#btn_l').unbind('click').on('click', function() {
  211. // window.location.href = 'https://account.bol.wo.cn/cuuser/unity/redirectOnekeyLogin?clientId=directflow&redirectUrl=' + 'http://100.0.4.69:3344/orderchannel/douyin/15/draw20220313.html?fes=9ur&sou=26'
  212. // gotoUrl('douyin/15/draw20220313')
  213. // })
  214. $('#btn-cancel').unbind('click').on('click', function() {
  215. showCancelPage();
  216. })
  217. $('#btn-active').unbind('click').on('click', function() {
  218. showActivePage();
  219. })
  220. $('#gotoDrawPage').unbind('click').on('click', function() {
  221. showDrawPage(window.location.href.substring(window.location.href.lastIndexOf('/') + 1, window.location.href.lastIndexOf('.')))
  222. })
  223. function showDrawPage(back) {
  224. // if (location.href.indexOf("draw202203013.html") < 0) {
  225. // window.location.href = "draw202203013.html?fes=" + unicom.query.fes + "&sou=" + unicom.query.sou + '&back=' + (back == null ? '' : back);
  226. // return;
  227. // }
  228. var $container = $('.section-login').find('.form-group');
  229. $container.find('.sendcode').unbind('click').on('click', function() {
  230. var account = $container.find('.account').val();
  231. var arr = new Array()
  232. arr = account.split(' ')
  233. if (arr.length != 1) {
  234. compnt.showAlert('抖音短视频账号不能含有空格');
  235. return
  236. }
  237. if (account == null || account == "") {
  238. compnt.showAlert('请输入抖音短视频账号');
  239. return;
  240. }
  241. unicom.sendSms($container, 'drawlogin');
  242. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_click_send_sms_code_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  243. })
  244. $container.find('.login').unbind('click').on('click', function() {
  245. var usermob = $container.find('.usermob').val();
  246. var account = $container.find('.account').val();
  247. var smscode = $container.find('.smscode').val();
  248. if (usermob == null || usermob == "") {
  249. compnt.showAlert('请输入联通手机号');
  250. return;
  251. }
  252. var arr = new Array()
  253. arr = account.split(' ')
  254. if (arr.length != 1) {
  255. compnt.showAlert('抖音短视频账号不能含有空格');
  256. return
  257. }
  258. if (account == null || account == "") {
  259. compnt.showAlert('请输入抖音短视频账号');
  260. return;
  261. }
  262. if (account == null || account == "") {
  263. compnt.showAlert('请输入抖音短视频账号');
  264. return;
  265. }
  266. if (smscode == null || smscode == "") {
  267. compnt.showAlert('请输入验证码');
  268. return;
  269. }
  270. var $comfirm = showConfirmDialog(account);
  271. $comfirm.find('.cancel').on('click', function() {
  272. compnt.hideLoading();
  273. });
  274. $comfirm.find('.okay').on('click', function() {
  275. unicom.checkCode($container, true).done(function() {
  276. /*unicom.canDrawCoin(account).then(function (response) {
  277. if (response.resultCode != "0000") {
  278. compnt.hideLoading();
  279. compnt.showAlert(response.errorInfo);
  280. return;
  281. }
  282. drawCoin(account)
  283. })*/
  284. drawCoin(account);
  285. }).fail(function(data) {
  286. compnt.hideLoading();
  287. })
  288. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_click_confirm_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  289. });
  290. })
  291. }
  292. function drawCoin(account) {
  293. // var $comfirm = showConfirmDialog(account);
  294. // $comfirm.find('.cancel').on('click', function() {
  295. // compnt.hideLoading();
  296. // });
  297. //$comfirm.find('.okay').on('click', function() {
  298. // var $container = $('.section-login').find('.form-group');
  299. // $container.find('.usermob').val('')
  300. // $container.find('.usermob').val('')
  301. // $container.find('.account').val('');
  302. compnt.showLoading();
  303. unicom.drawCoin(account, '').done(function(response) {
  304. compnt.hideLoading();
  305. switch (response.resultCode) {
  306. case "0000":
  307. var $container = $('.section-login').find('.form-group');
  308. $container.find('.usermob').val('');
  309. $container.find('.smscode').val('');
  310. $container.find('.account').val('');
  311. compnt.showAlert('抖币充值中,详情结果以短信形式告知').then(function() {
  312. if (unicom.query.back != null && unicom.query.back != '') {
  313. showOrderPage(unicom.query.back + ".html");
  314. }
  315. });
  316. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_success' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  317. break;
  318. case "7605":
  319. compnt.showAlert(response.errorInfo);
  320. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  321. break;
  322. case '6776':
  323. var prefix = '';
  324. compnt.showAlert(prefix + response.errorInfo);
  325. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  326. break;
  327. default:
  328. var prefix = '';
  329. if (response.errorInfo.indexOf('领取失败') < 0) {
  330. prefix = '领取失败,';
  331. }
  332. compnt.showAlert(prefix + response.errorInfo);
  333. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  334. break;
  335. }
  336. }).fail(function(data) {
  337. compnt.hideLoading();
  338. })
  339. }
  340. function showOrderPage(backPage) {
  341. // if (location.href.indexOf('15/index') < 0) {
  342. // if (backPage == null || backPage == '') {
  343. // backPage = 'index.html';
  344. // }
  345. // window.location.href = backPage + "?fes=" + unicom.query.fes + "&sou=" + unicom.query.sou;
  346. // return;
  347. // }
  348. $('#btn-order').unbind('click').on('click', function(event) {
  349. //compnt.showAlert('退订成功');
  350. // return;
  351. // console.log(1)
  352. if (!compnt.lockClick()) {
  353. return;
  354. }
  355. unicom.showCapPage(null, null, false, false, true).then(function(data) {
  356. compnt.unlockClick();
  357. order(data.userid, data.token, data.usermob);
  358. }).fail(function(response) {
  359. compnt.unlockClick();
  360. })
  361. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_click_order_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  362. })
  363. }
  364. function showFlowPage() {
  365. if (location.href.indexOf("flow.html") < 0) {
  366. window.location.href = "flow.html?fes=" +
  367. unicom.query.fes + "&sou=" + unicom.query.sou +
  368. "&userid=" + unicom.user.userid + "&usermob=" + unicom.user.usermob +
  369. "&usertime=" + (unicom.user.usertime || (new Date().getTime()));
  370. return;
  371. }
  372. var $container = $('.section-flow');
  373. var usermob = unicom.user.usermob;
  374. $container.find('.phone').html(usermob.substring(0, 3) + 'xxxx' + usermob.substring(7, 11));
  375. $container.find('.btn').unbind('click').on('click', function() {
  376. //if (!compnt.lockClick()) {
  377. // return;
  378. //}
  379. queryFlow().then(function(message) {
  380. compnt.unlockClick()
  381. if (message != null && message != "") {
  382. compnt.showAlert(message);
  383. }
  384. }).fail(function() {
  385. compnt.unlockClick();
  386. });
  387. })
  388. queryFlow();
  389. }
  390. function showActivePage() {
  391. if (location.href.indexOf("active.html") < 0) {
  392. window.location.href = "active.html?fes=" + unicom.query.fes + "&sou=" +
  393. unicom.query.sou;
  394. return;
  395. }
  396. var $container = $('.section-login').find('.form-group');
  397. $container.find('.sendcode').unbind('click').on('click', function() {
  398. if (!checkEquip()) return;
  399. unicom.sendSms($container, 'activelogin');
  400. })
  401. $container.find('.login').unbind('click').on('click', function(event) {
  402. if (!checkEquip()) return;
  403. if (!compnt.lockClick()) {
  404. return;
  405. }
  406. unicom.checkCode($container).then(function() {
  407. compnt.unlockClick()
  408. active()
  409. }).fail(function() {
  410. compnt.unlockClick();
  411. });
  412. })
  413. window.scrollTo(0, 0)
  414. }
  415. function showCancelPage() {
  416. if (location.href.indexOf("cannel20220313.html") < 0) {
  417. window.location.href = "cannel20220313.html?fes=" + unicom.query.fes + "&sou=" + unicom.query.sou;
  418. return;
  419. }
  420. var cancelReason = JSON.parse(window.localStorage.getItem('kye'))
  421. var $container = $('.section-login').find('.form-group');
  422. $container.find('.sendcode').unbind('click').on('click', function() {
  423. unicom.sendSms($container, 'cancellogin');
  424. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_click_send_sms_code_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  425. })
  426. $container.find('.login').unbind('click').on('click', function() {
  427. compnt.showLoading();
  428. unicom.checkCode($container).done(function() {
  429. unicom.cancel(null, null, cancelReason.canceltype, cancelReason.cancelmsg).done(function(response) {
  430. compnt.hideLoading();
  431. switch (response.resultCode) {
  432. case "0000":
  433. compnt.showAlert('退订成功'); //.then(function(message) {
  434. //showFlowPage();
  435. //});
  436. window.localStorage.removeItem("kye");
  437. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_success' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  438. break;
  439. case "7605": //应该是已经退订了吧,因此不需要在重复退订啦
  440. compnt.showAlert(response.errorInfo); //.then(function(message) {
  441. //showFlowPage();
  442. //});
  443. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  444. break;
  445. default:
  446. var prefix = '';
  447. if (response.errorInfo.indexOf('退订失败') < 0) {
  448. prefix = '退订失败,';
  449. }
  450. compnt.showAlert(prefix + response.errorInfo);
  451. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  452. break;
  453. }
  454. }).fail(function(data) {
  455. compnt.hideLoading();
  456. })
  457. }).fail(function(data) {
  458. compnt.hideLoading();
  459. })
  460. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_click_confirm_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  461. })
  462. window.scrollTo(0, 0)
  463. }
  464. function checkEquip() {
  465. /*if (!baidu.app.baidu) {
  466. compnt.showAlert('请到百度产品客户端中激活免流~')
  467. return false;
  468. }
  469. if (!baidu.checkWeiboVersion()) {
  470. compnt.showAlert('请到升级到最新版百度产品客户端后激活免流~')
  471. return false;
  472. }*/
  473. return true;
  474. }
  475. /**
  476. * 订购
  477. */
  478. function order(userid, token, usermob) {
  479. compnt.showLoading('处理中,请稍后...');
  480. unicom.order(userid, token, usermob).done(function(response) {
  481. compnt.hideLoading();
  482. switch (response.resultCode) {
  483. case "0000": //订购成功!跳转到领取会员页面
  484. unicom.saveUserInfo();
  485. showAlert('订购成功');
  486. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_success' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  487. return;
  488. case "0013":
  489. //showAlertDialog('orderFailure','该号码归属省分2/3G暂未开通此产品!');
  490. compnt.showAlert('该号码归属省分2/3G暂未开通此产品!');
  491. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  492. break;
  493. case "6611":
  494. // showAlertDialog('orderFailure','错误代码(6611),' + '订购失败,请重试!');
  495. compnt.showAlert('错误代码(6611),订购失败,请重试!');
  496. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  497. break;
  498. case "6615":
  499. //showAlertDialog('orderFailure', '订购失败,请确定用户套餐!');
  500. showAlerts('订购失败,请确定用户套餐!');
  501. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  502. break;
  503. case "6622": // 用户已订购过此产品!跳转到流量查页面
  504. // localStorage.setItem('message', '您已经订购了本产品~');
  505. compnt.showAlert('您已经订购了本产品~');
  506. unicom.saveUserInfo();
  507. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  508. // showFlowPage();
  509. break;
  510. default:
  511. //showAlertDialog('orderFailure', response.errorInfo + ',订购失败,请确定用户套餐!');
  512. showAlerts(response.errorInfo + '订购失败,请确定用户套餐!');
  513. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  514. break;
  515. }
  516. }).fail(function(error) {
  517. compnt.hideLoading();
  518. console.log(error);
  519. });
  520. }
  521. function showAlert(message, hideButton, buttonLabel, hideTitle) {
  522. var title = '';
  523. if (hideTitle == undefined || hideTitle == false) {
  524. title = message;
  525. }
  526. var $overlay = $('<div class="overlay overlay-alert"></div>');
  527. var $dialog = $(
  528. '<div class="dialog-alerts dialog-alert">' +
  529. '<h1>' + title + '</h1>' +
  530. '<div class="contents">' + '</div>' +
  531. '<div class="actionss actions">' +
  532. ' <div class="btn">' + (buttonLabel == null || buttonLabel == "" ? "确定" : buttonLabel) + '</div>' +
  533. '</div>' +
  534. '</div>');
  535. $("body").css("overflow", "hidden");
  536. $overlay.appendTo($(document.body));
  537. $dialog.appendTo($(document.body));
  538. if (hideButton == true) {
  539. $dialog.find('.btn').remove();
  540. }
  541. $dialog.close = function() {
  542. $("body").css("overflow", "auto");
  543. $overlay.remove();
  544. $dialog.remove();
  545. $dialog = null;
  546. }
  547. var def = $.Deferred();
  548. $dialog.find('.btn').on('click', function() {
  549. $dialog.close()
  550. def.resolve($dialog);
  551. })
  552. return def;
  553. }
  554. function showAlerak(message, hideButton, buttonLabel, hideTitle) {
  555. var title = '';
  556. if (hideTitle == undefined || hideTitle == false) {
  557. title = message;
  558. }
  559. var $overlay = $('<div class="overlay overlay-alert"></div>');
  560. var $dialog = $(
  561. '<div class="dialog-alerts dialog-alert">' +
  562. '<h1>' + title + '</h1>' +
  563. '<div class="contentsak">' + '</div>' +
  564. '<div class="actionss actions">' +
  565. ' <div class="btn">' + (buttonLabel == null || buttonLabel == "" ? "确定" : buttonLabel) + '</div>' +
  566. '</div>' +
  567. '</div>');
  568. $("body").css("overflow", "hidden");
  569. $overlay.appendTo($(document.body));
  570. $dialog.appendTo($(document.body));
  571. if (hideButton == true) {
  572. $dialog.find('.btn').remove();
  573. }
  574. $dialog.close = function() {
  575. $("body").css("overflow", "auto");
  576. $overlay.remove();
  577. $dialog.remove();
  578. $dialog = null;
  579. }
  580. var def = $.Deferred();
  581. $dialog.find('.btn').on('click', function() {
  582. $dialog.close()
  583. def.resolve($dialog);
  584. if (productidas != '2020010201') {
  585. console.log(productidas)
  586. var a = getQueryString("cpid");
  587. var b = getQueryString("userid");
  588. var c = getQueryString("usermob");
  589. var fes = getQueryString("fes");
  590. var sou = getQueryString("sou");
  591. var cbUrl;
  592. if (window.location.href.indexOf("https://800.wo.cn/orderchannel") >= 0) {
  593. cbUrl = "https://800.wo.cn/orderchannel/douyin/15/draw20220313.html?fes=jjd&sou=1m&cpid=" + a + '&userid=' + b + '&usermob=' + c;
  594. } else if (window.location.href.indexOf("http://100.0.4.69:3344") >= 0) {
  595. cbUrl = "http://100.0.4.69:3344/orderchannel/douyin/15/draw20220313.html?fes=" + fes + "&sou=" + sou + '&cpid=' + a + '&userid=' + b + '&usermob=' + c;
  596. }
  597. location.href = cbUrl;
  598. }
  599. })
  600. return def;
  601. }
  602. function showAlerts(message, hideButton, buttonLabel, hideTitle) {
  603. var title = '';
  604. if (hideTitle == undefined || hideTitle == false) {
  605. title = message;
  606. }
  607. var $overlay = $('<div class="overlay overlay-alert"></div>');
  608. var $dialog = $(
  609. '<div class="dialog-alerts dialog-alert">' +
  610. '<h1>' + title + '</h1>' +
  611. '<div class="contentss">' + '</div>' +
  612. '<div class="actionss actions">' +
  613. ' <div class="btn">' + (buttonLabel == null || buttonLabel == "" ? "确定" : buttonLabel) + '</div>' +
  614. '</div>' +
  615. '</div>');
  616. $("body").css("overflow", "hidden");
  617. $overlay.appendTo($(document.body));
  618. $dialog.appendTo($(document.body));
  619. if (hideButton == true) {
  620. $dialog.find('.btn').remove();
  621. }
  622. $dialog.close = function() {
  623. $("body").css("overflow", "auto");
  624. $overlay.remove();
  625. $dialog.remove();
  626. $dialog = null;
  627. }
  628. var def = $.Deferred();
  629. $dialog.find('.btn').on('click', function() {
  630. $dialog.close()
  631. def.resolve($dialog);
  632. })
  633. return def;
  634. }
  635. function showAlertDialog(action, message) {
  636. var className = '';
  637. switch (action) {
  638. case 'orderSuccess':
  639. className = 'dialog-message-order-success';
  640. break;
  641. case 'orderFailure':
  642. className = 'dialog-message-order-failure';
  643. break;
  644. case 'activeSuccess':
  645. className = 'dialog-message-active-success';
  646. break;
  647. case 'activeFailure':
  648. className = 'dialog-message-active-failure';
  649. break;
  650. case 'cancelSuccess':
  651. className = 'dialog-message-cancel-success';
  652. break;
  653. case 'cancelFailure':
  654. className = 'dialog-message-cancel-failure';
  655. break;
  656. default:
  657. break;
  658. }
  659. var $overlay = $('<div class="overlay"></div>');
  660. var $dialog = $(
  661. '<div class="dialog dialog-message ' + className + '">' +
  662. ' <div class="title"></div>' +
  663. ' <div class="content">' + message + '</div>' +
  664. ' <div class="actions">' +
  665. ' <div class="btn">确定</div>' +
  666. ' </div>' +
  667. '</div>');
  668. $overlay.appendTo($(document.body))
  669. $dialog.appendTo($(document.body))
  670. $dialog.find('.btn').unbind('click').on('click', function() {
  671. $dialog.close()
  672. })
  673. $dialog.close = function() {
  674. $overlay.remove();
  675. $dialog.remove();
  676. $dialog = null;
  677. }
  678. return $dialog;
  679. }
  680. /**
  681. * 查询用户剩余流量
  682. */
  683. function queryFlow() {
  684. var $container = $('.section-flow');
  685. //return new Promise(function(resolve, reject) {
  686. var def = $.Deferred();
  687. unicom.queryFlow().then(function(response) {
  688. // var response = JSON.parse(responseText);
  689. // console.log("流量剩余情况:" + response.data)
  690. switch (response.resultCode) {
  691. case "0000":
  692. //compnt.showAlert(JSON.stringify(response.data));
  693. //console.log(response.data)
  694. //console.log(JSON.parse(response.data).surplusFlow)
  695. var surplus = compnt.returnFloat(JSON.parse(response.data).surplusFlow / 1024 / 1024);
  696. $container.find('.surplus').html(surplus + 'GB');
  697. var usedFlowKb = parseInt(JSON.parse(response.data).usedFlow);
  698. if (usedFlowKb > 0 && usedFlowKb < 1024) {
  699. def.resolve("剩余流量更新成功,为您免流了" + usedFlowKb + "KB~");
  700. } else if (usedFlowKb > 1024) {
  701. var useedFlow = compnt.returnFloat(usedFlowKb / 1024);
  702. def.resolve("剩余流量更新成功,为您免流了" + useedFlow + "MB~");
  703. } else {
  704. def.resolve("剩余流量更新成功~");
  705. }
  706. break;
  707. case "9201": //{"resultCode":"9201","errorInfo":"查询失败,请检查是否有订购关系!"}
  708. def.resolve("您未订购百度定向流量包~")
  709. // $container.find('.phone').html('用户未订购此产品!');
  710. break;
  711. case "9203": //{"resultCode":"9203","errorInfo":"流量查询失败,没有获取到用户所使用流量信息!"}
  712. //compnt.showAlert("没有获取到用户所使用流量信息!");
  713. def.resolve("剩余流量更新成功~")
  714. $container.find('.suplus').html('本月剩余<br>8.00GB');
  715. break;
  716. default:
  717. def.resolve("剩余流量更新成功~")
  718. break;
  719. }
  720. })
  721. return def;
  722. //})
  723. }
  724. function active() {
  725. baidu.active().then(function() {
  726. //checkActiveResult();
  727. compnt.showAlert('激活成功').then(function() {
  728. unicom.saveUserInfo()
  729. // showFlowPage();
  730. });
  731. })
  732. }
  733. $('.section-agr').find('.footer').on('click', function() {
  734. if ($($('.section-agr .scope').find('li')[2]).hasClass('hidden')) {
  735. $('.section-agr .scope').find('li').each(function(i, ele) {
  736. $(ele).removeClass('hidden');
  737. })
  738. $('.section-agr').find('.footer').html('隐藏<span class="arrow">&gt;');
  739. } else {
  740. $('.section-agr .scope').find('li').each(function(i, ele) {
  741. if (i >= 1) {
  742. $(ele).addClass('hidden');
  743. }
  744. })
  745. $('.section-agr').find('.footer').html('查看更多专属流量适用范围<span class="arrow">&gt;');
  746. }
  747. });
  748. function showConfirmDialog(account) {
  749. var $overlay = $('<div class="overlay"></div>')
  750. var $dialog = $(
  751. '<div class="dialog dialog-confirm">' +
  752. ' <div class="content">请确认是否领取抖音币到' + account + '账号?</div>' +
  753. ' <div class="actions">' +
  754. ' <div class="btn cancel">取消</div>' +
  755. ' <div class="btn okay">确认</div>' +
  756. ' </div>' +
  757. '</div>');
  758. $overlay.appendTo($(document.body))
  759. $dialog.appendTo($(document.body))
  760. $dialog.find('.btn').on('click', function() {
  761. $overlay.remove();
  762. $dialog.remove();
  763. $dialog = null;
  764. })
  765. $dialog.close = function() {
  766. $overlay.remove();
  767. $dialog.remove();
  768. $dialog = null;
  769. }
  770. return $dialog;
  771. }
  772. var call = 0
  773. $(".beijing_a").click(function() {
  774. if ($(this)) {
  775. $(this).addClass("beijing_b").siblings().removeClass('beijing_b');
  776. call = $(this).index()
  777. // console.log($(this).index())
  778. }
  779. });
  780. $('.order_a').click(function() {
  781. // console.log(call)
  782. switch (call) {
  783. case 0:
  784. showAlerta('优酷视频会员周卡')
  785. break;
  786. case 1:
  787. showAlerta('爱奇艺视频会员周卡')
  788. break;
  789. case 2:
  790. showAlerta('腾讯视频会员周卡')
  791. break;
  792. case 3:
  793. showAlerta('蜻蜓FM超级会员周卡')
  794. break;
  795. case 4:
  796. showAlerta('芒果TV PC移动影视会员周卡')
  797. break;
  798. case 5:
  799. showAlerta('美团外卖5元红包')
  800. break;
  801. case 6:
  802. showAlertat('抖音币50个')
  803. break;
  804. default:
  805. // console.log(call)
  806. break;
  807. }
  808. })
  809. function showAlerta(message, hideButton, buttonLabel, hideTitle) {
  810. var title = '';
  811. var text = '';
  812. var texts = '';
  813. if (hideTitle == undefined || hideTitle == false) {
  814. title = '您选择的是:';
  815. text = message
  816. texts = unicom.name_a
  817. }
  818. var $overlay = $('<div class="overlay overlay-alert"></div>');
  819. var $dialog = $(
  820. '<div class="dialog-alerttt">' +
  821. '<h1 class="text_nn">' + '<span class="text_mm ">' + title + '</span>' + text + '</h1>' +
  822. '<h1 class="text_nn text_nns">' + '<span class="text_mm ">' + '领取产品:' + '</span>' + texts + '</h1>' +
  823. '<input class="inputot" type="tel" maxlength="11" name="phone" placeholder="请输入领取权益的手机号码"/>' +
  824. // '<button class="content">' + message + '</button>' +
  825. '<div class="actions">' +
  826. ' <div class="btns">' + (buttonLabel == null || buttonLabel == "" ? "关闭" : buttonLabel) + '</div>' +
  827. ' <div id="btn_orderss" class="btn btn_orderss">' + (buttonLabel == null || buttonLabel == "" ? "确定" : buttonLabel) + '</div>' +
  828. '</div>' +
  829. '</div>');
  830. $("body").css("overflow", "hidden");
  831. $overlay.appendTo($(document.body));
  832. $dialog.appendTo($(document.body));
  833. if (hideButton == true) {
  834. $dialog.find('.btn').remove();
  835. }
  836. $(".btns").click(function() {
  837. $("body").css("overflow", "auto");
  838. $overlay.remove();
  839. $dialog.remove();
  840. $dialog = null;
  841. })
  842. $("#btn_orderss").click(function() {
  843. var account = $dialog.find('.inputot').val();
  844. if (account == null || account == "") {
  845. compnt.showAlert('请输入手机号码');
  846. return;
  847. }
  848. // console.log(account)
  849. // console.log(usermob, account)
  850. switch (call) {
  851. case 0:
  852. var vipcode = 10001
  853. break;
  854. case 1:
  855. var vipcode = 20001
  856. break;
  857. case 2:
  858. var vipcode = 30001
  859. break;
  860. case 3:
  861. var vipcode = 60001
  862. break;
  863. case 4:
  864. var vipcode = 50001
  865. break;
  866. case 5:
  867. var vipcode = 13004
  868. break;
  869. default:
  870. // console.log(call)
  871. break;
  872. }
  873. console.log(account, vipcode, usermob, spid)
  874. deaw(account, vipcode, usermob, spid)
  875. $("body").css("overflow", "auto");
  876. $overlay.remove();
  877. $dialog.remove();
  878. $dialog = null;
  879. })
  880. }
  881. function showAlertat(message, hideButton, buttonLabel, hideTitle) {
  882. var title = '';
  883. var text = '';
  884. if (hideTitle == undefined || hideTitle == false) {
  885. title = '您选择的是:';
  886. text = message
  887. }
  888. var $overlay = $('<div class="overlay overlay-alert"></div>');
  889. var $dialog = $(
  890. '<div class="dialog-alerttt">' +
  891. '<h1 class="text_nn">' + '<span class="text_mm ">' + title + '</span>' + text + '</h1>' +
  892. '<input class="inputot" placeholder="请输入抖音号"/>' +
  893. // '<button class="content">' + message + '</button>' +
  894. '<div class="actions">' +
  895. ' <div class="btns">' + (buttonLabel == null || buttonLabel == "" ? "关闭" : buttonLabel) + '</div>' +
  896. ' <div id="btn_orderss" class="btn btn_orderss">' + (buttonLabel == null || buttonLabel == "" ? "确定" : buttonLabel) + '</div>' +
  897. '</div>' +
  898. '</div>');
  899. $("body").css("overflow", "hidden");
  900. $overlay.appendTo($(document.body));
  901. $dialog.appendTo($(document.body));
  902. $(".btns").click(function() {
  903. $("body").css("overflow", "auto");
  904. $overlay.remove();
  905. $dialog.remove();
  906. $dialog = null;
  907. })
  908. $("#btn_orderss").click(function() {
  909. var account = $dialog.find('.inputot').val();
  910. // console.log(account)
  911. var arr = new Array()
  912. arr = account.split(' ')
  913. if (arr.length != 1) {
  914. compnt.showAlert('抖音短视频账号不能含有空格');
  915. return
  916. }
  917. if (account == null || account == "") {
  918. compnt.showAlert('请输入抖音短视频账号');
  919. return;
  920. } else {
  921. var vipcodes = '20200310'
  922. console.log(account, vipcodes, usermob, spid)
  923. deaw(account, vipcodes, usermob, spid)
  924. $("body").css("overflow", "auto");
  925. $overlay.remove();
  926. $dialog.remove();
  927. $dialog = null;
  928. }
  929. })
  930. }
  931. function getQueryString(name) {
  932. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  933. var r = window.location.search.substr(1).match(reg);
  934. if (r != null) return unescape(r[2]);
  935. return null;
  936. }
  937. function deaw(userid, token, usermob, spid) {
  938. compnt.showLoading('处理中,请稍后...');
  939. unicom.deaw(userid, token, usermob, spid).done(function(response) {
  940. compnt.hideLoading();
  941. // console.log(response.resultCode)
  942. switch (response.resultCode) {
  943. case "0000": //订购成功!跳转到领取会员页面
  944. unicom.saveUserInfo();
  945. showAlerak('领取结果以短信为准!');
  946. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_success' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  947. return;
  948. case "1102":
  949. //showAlertDialog('orderFailure','该号码归属省分2/3G暂未开通此产品!');
  950. compnt.showAlert('用户已领取过权益,不能再领取!');
  951. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  952. break;
  953. case "1015":
  954. // showAlertDialog('orderFailure','错误代码(6611),' + '订购失败,请重试!');
  955. compnt.showAlert('用户未订购此产品!');
  956. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  957. break;
  958. // case "6615":
  959. // //showAlertDialog('orderFailure', '订购失败,请确定用户套餐!');
  960. // showAlerts('订购失败,请确定用户套餐!');
  961. // WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  962. // break;
  963. // case "6622": // 用户已订购过此产品!跳转到流量查页面
  964. // // localStorage.setItem('message', '您已经订购了本产品~');
  965. // compnt.showAlert('您已经订购了本产品~');
  966. // unicom.saveUserInfo();
  967. // WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  968. // // showFlowPage();
  969. // break;
  970. default:
  971. //showAlertDialog('orderFailure', response.errorInfo + ',订购失败,请确定用户套餐!');
  972. showAlerts(response.errorInfo + ',订购失败,请确定用户套餐!');
  973. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  974. break;
  975. }
  976. }).fail(function(error) {
  977. compnt.hideLoading();
  978. console.log(error);
  979. });
  980. }