fix: 修复api请求地址
This commit is contained in:
parent
923e49b855
commit
3321e862ea
19
alipay.html
19
alipay.html
|
@ -13,7 +13,8 @@
|
|||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/siteqiexchange/js/swiper.min.js"></script>
|
||||
<link href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/siteqiexchange/css/swiper.min.css" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/homepage2_0.css" />
|
||||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js"></script>
|
||||
<!-- <script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js"></script> -->
|
||||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api_test.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0 auto;
|
||||
|
@ -75,7 +76,7 @@
|
|||
<script>
|
||||
new Vue({
|
||||
el: "#alipay",
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
explain: `1.在活动期间,每名用户仅可参与一次活动并享受一次赠礼。请注意:【(a)如用户在参与活动前已经是亚朵酒店金卡及以上级别会员,该用户无法领取亚朵酒店会员权益赠礼,权益不叠加;(b)喜马拉雅会员叠加上限为10年;(c)QQ音乐会员叠加上限为120个月。】如用户合作平台会员叠加(含本次活动领取时长)达到上限时间,用户将无法(完整)领取该合作平台赠礼,因此无法领取的赠礼不做补发;购买前请您确认您在合作平台会员有效期情况。
|
||||
2.活动期间,开通/续费严选Pro会员年卡后,赠礼将发放至“联合会员领取页面”,可前往一键领取(赠礼仅支持领取到同一手机号);如遇到网络问题等原因,可能会存在延迟到账的情况,请在24小时内查看到账情况。
|
||||
|
@ -95,7 +96,7 @@
|
|||
disabledBtn: false,
|
||||
};
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
//唤起支付宝授权,打开领取
|
||||
this.openId = this.getQueryString(
|
||||
window.location.search,
|
||||
|
@ -109,7 +110,7 @@
|
|||
this.getOrderDetail(this.orderNumber);
|
||||
},
|
||||
methods: {
|
||||
getQueryString (path, name) {
|
||||
getQueryString(path, name) {
|
||||
//获取浏览器地址栏的参数
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||
var r = path.substr(1).match(reg);
|
||||
|
@ -117,7 +118,7 @@
|
|||
return null;
|
||||
},
|
||||
//获取订单详情
|
||||
getOrderDetail (id, isNext = false, message = '') {
|
||||
getOrderDetail(id, isNext = false, message = '') {
|
||||
req.axiosGet('/voucher/info', {
|
||||
order_number: id
|
||||
}).then(res => {
|
||||
|
@ -130,7 +131,7 @@
|
|||
}
|
||||
}).catch();
|
||||
},
|
||||
toReceive () {
|
||||
toReceive() {
|
||||
let self = this;
|
||||
//领取立减金
|
||||
let data = {
|
||||
|
@ -153,19 +154,19 @@
|
|||
.catch((err) => { });
|
||||
},
|
||||
//提示弹出框
|
||||
openDialog (tip) {
|
||||
openDialog(tip) {
|
||||
this.maskshow = true;
|
||||
this.tiptext = tip;
|
||||
this.popboxshow = true;
|
||||
},
|
||||
knowFn () {
|
||||
knowFn() {
|
||||
this.maskshow = false;
|
||||
this.tiptext = '';
|
||||
this.popboxshow = false;
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
statusFn (val) {
|
||||
statusFn(val) {
|
||||
switch (val) {
|
||||
case 0:
|
||||
return '立即领取';
|
||||
|
|
|
@ -0,0 +1,312 @@
|
|||
let baseurl = "";
|
||||
let global_path_host = window.location.host;
|
||||
let global_env = "dev";
|
||||
console.log("path_host =>", global_path_host);
|
||||
|
||||
// 访问域名
|
||||
let global_dev_env = ["http://192.168.6.75"];
|
||||
let global_test_env = ["http://test.22233.cn"];
|
||||
let global_pre_env = ["http://test.22233.cn"];
|
||||
let global_pro_env = [
|
||||
"https://22233.cn",
|
||||
"https://83323.cn",
|
||||
"https://86885.cn",
|
||||
];
|
||||
|
||||
// 判断环境
|
||||
function global_dev_fun(hots) {
|
||||
// 开发环境
|
||||
if (global_dev_env.includes(hots)) {
|
||||
return "dev";
|
||||
}
|
||||
|
||||
if (global_test_env.includes(hots)) {
|
||||
return "test";
|
||||
}
|
||||
|
||||
if (global_pre_env.includes(hots)) {
|
||||
return "pre";
|
||||
}
|
||||
|
||||
if (global_pro_env.includes(hots)) {
|
||||
return "pro";
|
||||
}
|
||||
}
|
||||
|
||||
switch (global_dev_fun(global_path_host)) {
|
||||
case "dev":
|
||||
baseurl = "http://192.168.6.75";
|
||||
break;
|
||||
case "test":
|
||||
baseurl = "http://test.22233.cn";
|
||||
break;
|
||||
case "pre":
|
||||
baseurl = "http://pre.marketapi.1688sup.com";
|
||||
break;
|
||||
case "pro":
|
||||
baseurl = "https://marketapi.1688sup.com";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// if (
|
||||
// pathname.includes("1688sup") ||
|
||||
// pathname.includes("83323") ||
|
||||
// pathname.includes("86885") ||
|
||||
// pathname.includes("22233")
|
||||
// ) {
|
||||
// //正式
|
||||
// baseurl = "https://marketapi.1688sup.com";
|
||||
// }
|
||||
// if (pathname.includes("test")) {
|
||||
// baseurl = "http://192.168.6.75";
|
||||
// }
|
||||
// //镜像环境
|
||||
// if (pathname.includes("pre")) {
|
||||
// baseurl = "http://pre.marketapi.1688sup.com";
|
||||
// }
|
||||
|
||||
//统一请求
|
||||
axios.interceptors.request.use((config) => {
|
||||
// config.headers.Version = 'v1.3.0';
|
||||
return config;
|
||||
});
|
||||
|
||||
const req = {
|
||||
//get请求
|
||||
axiosGet(url, params) {
|
||||
const obj = { method: "get", url: baseurl + url, params };
|
||||
var result = axios(obj)
|
||||
.then(function (res) {
|
||||
return res.data;
|
||||
})
|
||||
.catch(function (error) {
|
||||
return;
|
||||
});
|
||||
return result;
|
||||
},
|
||||
|
||||
//获取key列表
|
||||
axiosPostgetKey(url, data) {
|
||||
let result = axios({
|
||||
method: "post",
|
||||
url: baseurl + url,
|
||||
data: data,
|
||||
header: {
|
||||
"Content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((error) => {
|
||||
alert("服务器错误");
|
||||
return "exception=" + error;
|
||||
});
|
||||
return result;
|
||||
},
|
||||
//post请求
|
||||
axiosPost(url, data) {
|
||||
let result = axios({
|
||||
method: "post",
|
||||
url: baseurl + url,
|
||||
data: data,
|
||||
header: {
|
||||
"Content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
// return "exception=" + error
|
||||
});
|
||||
return result;
|
||||
},
|
||||
//put请求
|
||||
axiosPut(url, data) {
|
||||
let result = axios({
|
||||
method: "put",
|
||||
url: baseurl + url,
|
||||
data: data,
|
||||
header: {
|
||||
"Content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
alert("服务器错误");
|
||||
return "exception=" + error;
|
||||
});
|
||||
return result;
|
||||
},
|
||||
};
|
||||
|
||||
//图形验证码
|
||||
function captchaimg() {
|
||||
let parmas = {};
|
||||
let customsessionid = "";
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", baseurl + "/auth/login/verify");
|
||||
// xhr.setRequestHeader('Version', 'v1.1.0');
|
||||
xhr.responseType = "arraybuffer";
|
||||
xhr.onreadystatechange = function (response) {
|
||||
response.header = {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
|
||||
};
|
||||
var img = document.getElementById("captcha_img");
|
||||
var byteArray = new Uint8Array(response.target.response);
|
||||
var binary = "";
|
||||
for (var i = 0; i < byteArray.byteLength; i++) {
|
||||
binary += String.fromCharCode(byteArray[i]);
|
||||
}
|
||||
let str = "data:image/png;base64," + window.btoa(binary);
|
||||
img.src = str;
|
||||
customsessionid = xhr.getResponseHeader("Unique-Str");
|
||||
sessionStorage.setItem("unique_str", customsessionid);
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
/*公共方法提取 */
|
||||
//商品的各种异常状态。1是可以兑换,不作提示
|
||||
const product_status = (status, row) => {
|
||||
let obj = {
|
||||
2: "还没开始哟,兑换时间为" + row.begin_time + "至" + row.end_time, //未开始
|
||||
3: "当前商品兑换已结束", //作废key批次
|
||||
4: "亲,仅可兑换一次哦!", //仅兑换一次
|
||||
5: "当前商品兑换次数达到上限", //累计次数达到上限
|
||||
6: "暂无库存,看看其他商品吧~", //无库存
|
||||
7: "当前商品不可兑换", //其他商品处于兑换中
|
||||
8: "当前商品正在兑换中", //已兑换次数
|
||||
10: "该商品暂无法兑换", //商品暂停
|
||||
11: "兑换已过期,兑换时间为" + row.begin_time + "至" + row.end_time, //正常过期
|
||||
22: "您有未支付的订单",
|
||||
};
|
||||
if (row.type == 2) {
|
||||
//type:1 兑换码 2:立减金
|
||||
obj["20"] =
|
||||
"该立减金商品不在生效时间范围内,生效时间为" +
|
||||
row.entity.time_limit.effect_time.start_time +
|
||||
"至" +
|
||||
row.entity.time_limit.effect_time.end_time; //不在生效时间范围内
|
||||
obj["21"] =
|
||||
"该立减金商品不在领取时间段内,领取时间段为" +
|
||||
row.entity.time_limit.receive_time.start_time +
|
||||
"至" +
|
||||
row.entity.time_limit.receive_time.end_time; //不在领取时间范围内
|
||||
}
|
||||
return obj[status];
|
||||
};
|
||||
|
||||
/* 周天排序 */
|
||||
function sortWeeks(weeks) {
|
||||
var _weeks = []; //创建临时排序的数组
|
||||
for (var i = 0; i < weeks.length; i++) {
|
||||
if (weeks[i] == "周一") {
|
||||
var _week = {};
|
||||
_week["id"] = 1;
|
||||
_week["name"] = "周一";
|
||||
_weeks.push(_week);
|
||||
}
|
||||
if (weeks[i] == "周二") {
|
||||
var _week = {};
|
||||
_week["id"] = 2;
|
||||
_week["name"] = "周二";
|
||||
_weeks.push(_week);
|
||||
}
|
||||
if (weeks[i] == "周三") {
|
||||
var _week = {};
|
||||
_week["id"] = 3;
|
||||
_week["name"] = "周三";
|
||||
_weeks.push(_week);
|
||||
}
|
||||
if (weeks[i] == "周四") {
|
||||
var _week = {};
|
||||
_week["id"] = 4;
|
||||
_week["name"] = "周四";
|
||||
_weeks.push(_week);
|
||||
}
|
||||
if (weeks[i] == "周五") {
|
||||
var _week = {};
|
||||
_week["id"] = 5;
|
||||
_week["name"] = "周五";
|
||||
_weeks.push(_week);
|
||||
}
|
||||
if (weeks[i] == "周六") {
|
||||
var _week = {};
|
||||
_week["id"] = 6;
|
||||
_week["name"] = "周六";
|
||||
_weeks.push(_week);
|
||||
}
|
||||
if (weeks[i] == "周日") {
|
||||
var _week = {};
|
||||
_week["id"] = 7;
|
||||
_week["name"] = "周日";
|
||||
_weeks.push(_week);
|
||||
}
|
||||
}
|
||||
_weeks.sort(function (a, b) {
|
||||
return a.id - b.id;
|
||||
});
|
||||
//将weeks清空并将排序好的值赋给weeks
|
||||
const weeksData = [];
|
||||
if (isContinuityNum(_weeks.map((item) => item.id)) && _weeks.length > 1) {
|
||||
weeksData.push(`${_weeks[0].name} 至 ${_weeks[_weeks.length - 1].name}`);
|
||||
} else {
|
||||
for (var i = 0; i < _weeks.length; i++) {
|
||||
weeksData.push(_weeks[i].name);
|
||||
}
|
||||
}
|
||||
return weeksData;
|
||||
}
|
||||
|
||||
//判断一串数字是否是连续的
|
||||
function isContinuityNum(num) {
|
||||
let array = [];
|
||||
if (num instanceof Array) {
|
||||
array = [...num];
|
||||
} else {
|
||||
array = Array.from(num.toString()); //转换为数组
|
||||
}
|
||||
|
||||
var i = array[0];
|
||||
var isContinuation = true;
|
||||
for (var e in array) {
|
||||
if (array[e] != i) {
|
||||
isContinuation = false;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return isContinuation;
|
||||
}
|
||||
|
||||
//判断是不是微信
|
||||
function isWx() {
|
||||
var ua = window.navigator.userAgent.toLowerCase();
|
||||
//判断是不是微信
|
||||
if (ua.match(/MicroMessenger/i) == "micromessenger") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//判断是不是微信小程序环境打开
|
||||
function isWxminiprogram() {
|
||||
const ua = navigator.userAgent.toLowerCase();
|
||||
const isWeixin = ua.indexOf("micromessenger") != -1;
|
||||
if (isWeixin) {
|
||||
if (window.__wxjs_environment == "miniprogram") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue