main.js 43 KB

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