diff --git a/view/peko/modules/payPc/js/index.js b/view/peko/modules/payPc/js/index.js index 67172ac..a6da234 100644 --- a/view/peko/modules/payPc/js/index.js +++ b/view/peko/modules/payPc/js/index.js @@ -19,9 +19,8 @@ let modeOfPayment = false;//判断是否有选择支付方式 let paymentAmount = false;//判断是否有选择付款金额 var deviceId;//型号ID - $(function () { - + if (EnvCheck() == 'test') {//degBug new VConsole(); } @@ -30,13 +29,13 @@ $(function () { listChargeAreaInfo(); if (browser.app) { erbanNo == null; - $('body .pay_method, html .pay_method').css('margin','-4.5rem auto 0'); + $('body .pay_method, html .pay_method').css('margin', '-4.5rem auto 0'); $('body .header .user, html .header .user').hide(); $('.but1').hide(); $('.but2').show(); } }, 100) - function get_param (param) { + function get_param(param) { var query = location.search.substring(1).split('&'); for (var i = 0; i < query.length; i++) { var kv = query[i].split('='); @@ -68,7 +67,7 @@ $(function () { } else { $('.wx_skip').hide(); } - function getChargePageInfoForH5 (countryCode) { + function getChargePageInfoForH5(countryCode) { deviceId = get_param('deviceId') channelType = get_param('channelType'); let is_CN = countryCode == "CN" ? true : false; @@ -151,7 +150,7 @@ $(function () { } }); } - function listChargeAreaInfo () { + function listChargeAreaInfo() { networkRequest({ type: 'GET', url: urlPrefix + '/charge/listChargeAreaInfo', @@ -163,12 +162,26 @@ $(function () {
${res.areaName}
` }) - $('.area b').text(res.data[0].areaName); - $('.pop_up_in').append(str) - getChargePageInfoForH5(res.data[0].areaCode); + let localCode = JSON.parse(localStorage.getItem('localCode')); + if (localCode) { + console.log(localCode, 'localCode'); + $('.area b').text(localCode.areaName); + $('.pop_up_in').append(str) + getChargePageInfoForH5(localCode.countryCode); + } else { + countryCode = res.data[0].areaCode; + areaName = res.data[0].areaName; + localStorage.setItem('localCode', JSON.stringify({countryCode,areaName})) + $('.area b').text(res.data[0].areaName); + $('.pop_up_in').append(str) + getChargePageInfoForH5(res.data[0].areaCode); + } + $('.pop_up_in p').click(function () { $('.area b').text($(this).text()); countryCode = $(this).attr("countryCode"); + areaName = $(this).text(); + localStorage.setItem('localCode', JSON.stringify({countryCode,areaName})) $('.pop_up').hide(); // if (countryCode == "CN") { // if (EnvCheck() == 'test') { @@ -194,11 +207,11 @@ $(function () { $('.area').click(function () { $('.pop_up').show(); }); - $('.pop_up').click(function(){ + $('.pop_up').click(function () { $('.pop_up').hide(); }) - function coloursFun (index, type) { + function coloursFun(index, type) { $('.pay_number .number span').remove(); var str = ''; console.log(arr[type]); @@ -240,7 +253,7 @@ $(function () { } } }) - function isNumber (string) { + function isNumber(string) { var r = string.match(/^[0-9]*$/); if (r == null) { return true @@ -248,14 +261,14 @@ $(function () { return false } } - function logingFun (res) { + function logingFun(res) { $('.logingActive').text(res.message == undefined ? res : res.message); $('.logingActive').show(); setTimeout(function () { $('.logingActive').hide(); }, 1500) } - function ifCNFun () { + function ifCNFun() { var envChecks; const url = window.location.href; console.log(url) @@ -266,12 +279,12 @@ $(function () { } }) -$(function(){ +$(function () { $(document).ready(function () { var deviceWidth = document.documentElement.clientWidth; document.documentElement.style.fontSize = deviceWidth / 19.20 + 'px'; }); - window.onresize = function() { + window.onresize = function () { var deviceWidth = document.documentElement.clientWidth; // var deviceWidth = document.body.clientWidth; document.documentElement.style.fontSize = deviceWidth / 19.20 + 'px'; @@ -328,6 +341,6 @@ function dragMoveX(container) { if (event.pageX < 0 || event.pageX > document.body.offsetWidth) { console.log('在元素上移出') flag = false; - } + } }); } \ No newline at end of file