2024-02-23 14:22:16 +08:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<meta name="viewport"
|
|
|
|
|
content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,viewport-fit=cover">
|
|
|
|
|
<title>权益兑换页</title>
|
|
|
|
|
<style>
|
|
|
|
|
* {
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
padding: 0;
|
|
|
|
|
font-family: HYQiHei;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html {
|
|
|
|
|
font-size: 26.66666667vw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
body {
|
|
|
|
|
-webkit-text-size-adjust: 100%;
|
|
|
|
|
-ms-text-size-adjust: 100%;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/vue.min.js?v=1367936144322" type="text/javascript"
|
|
|
|
|
charset="utf-8"></script>
|
|
|
|
|
<script type="text/javascript" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/axios.js?v=1367936144322">
|
|
|
|
|
</script>
|
|
|
|
|
<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?v=2">
|
|
|
|
|
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js"></script>
|
2024-03-25 21:53:04 +08:00
|
|
|
|
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/libs.js?v=sdfhksdfklwrwer"></script>
|
2024-02-23 14:22:16 +08:00
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
<div id="exchangePage">
|
|
|
|
|
<div v-if="!suspension">
|
|
|
|
|
<div class="about-good">
|
|
|
|
|
<span>
|
|
|
|
|
<img @click="backgoodsFn" v-if="backAble"
|
|
|
|
|
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png" alt="">
|
|
|
|
|
</span>
|
|
|
|
|
<img :src="goodsShow[0]" alt="" v-if="goodsShow.length<=1">
|
|
|
|
|
<div class="swiper-container" v-else>
|
|
|
|
|
<div class="swiper-wrapper">
|
|
|
|
|
<div class="swiper-slide" v-for="(item,i) in goodsShow" :key="i">
|
|
|
|
|
<img :src="item" alt="">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="swiper-pagination"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-02-29 15:23:34 +08:00
|
|
|
|
|
2024-03-07 11:59:00 +08:00
|
|
|
|
<!-- 只是用来展示-无任何用处 -->
|
2024-02-29 15:23:34 +08:00
|
|
|
|
<div v-if="goodsDetail.available!=1" @click="bindAvailable" class="ipt-acc"
|
|
|
|
|
style="position: relative;z-index: 99;">
|
2024-03-03 16:07:44 +08:00
|
|
|
|
<h4 class="title">{{goodInfo.product_name}}</h4>
|
2024-02-29 15:23:34 +08:00
|
|
|
|
<p>
|
|
|
|
|
<span>账号:</span>
|
|
|
|
|
<span class="j-input"
|
2024-03-07 11:59:00 +08:00
|
|
|
|
style="color: #b1bbc3;height:0.32rem;padding-right: 0.1rem;line-height: 0.32rem;display: inline-block;width: 80%;">{{placeholder}}</span>
|
2024-02-29 15:23:34 +08:00
|
|
|
|
</p>
|
2024-03-07 11:59:00 +08:00
|
|
|
|
|
|
|
|
|
<p v-if="goodInfo.is_e_card">
|
|
|
|
|
<span style="display: inline-block;width: 0.72rem;">验证码:</span>
|
|
|
|
|
<input class="queryCode" :type="acctype" :disabled="goodsDetail.available!=1" placeholder="请输入验证码">
|
|
|
|
|
<button :disabled="!computedAccount" class="query-code">
|
|
|
|
|
获取验证码
|
|
|
|
|
</button>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p v-else>
|
2024-02-29 15:23:34 +08:00
|
|
|
|
<span>再次输入:</span>
|
|
|
|
|
<span class="j-input"
|
2024-03-07 11:59:43 +08:00
|
|
|
|
style="color: #b1bbc3;height:0.32rem;padding-right: 0.1rem;line-height: 0.32rem;display: inline-block;width: 80%;">{{placeholder}}</span>
|
2024-02-29 15:23:34 +08:00
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2024-02-29 15:18:29 +08:00
|
|
|
|
|
2024-02-29 15:23:34 +08:00
|
|
|
|
<div v-else class="ipt-acc" style="position: relative;z-index: 99;">
|
2024-03-03 16:07:44 +08:00
|
|
|
|
<h4 class="title">{{goodInfo.product_name}}</h4>
|
2024-02-29 15:23:34 +08:00
|
|
|
|
<template v-if="goodInfo.product_type===1||goodInfo.product_type===2&&goodInfo.card_show==1">
|
2024-03-01 15:30:58 +08:00
|
|
|
|
<!-- 京东E卡 -->
|
|
|
|
|
<template v-if="goodInfo.is_e_card">
|
|
|
|
|
<p>
|
|
|
|
|
<span>账号:</span>
|
|
|
|
|
<input :type="acctype" onkeyup="this.value=this.value.replace(/\D/g,'')"
|
|
|
|
|
:disabled="goodsDetail.available!=1"
|
|
|
|
|
onKeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))" :maxlength="11" v-model="account"
|
|
|
|
|
placeholder="请输入手机号" @focus="(e)=>focusFn(e)">
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
<span>验证码:</span>
|
|
|
|
|
<input class="queryCode" :type="acctype" onkeyup="this.value=this.value.replace(/\D/g,'')"
|
|
|
|
|
:disabled="goodsDetail.available!=1"
|
|
|
|
|
onKeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))" :maxlength="6" v-model="jd_code"
|
|
|
|
|
placeholder="请输入验证码" @focus="(e)=>focusFn(e)">
|
|
|
|
|
<button :disabled="!computedAccount" class="query-code" @click="sendJDSms">
|
|
|
|
|
{{cunt!==60?cunt+'s':'获取验证码'}}
|
|
|
|
|
</button>
|
|
|
|
|
</p>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<!-- 非E卡 -->
|
|
|
|
|
<template v-else>
|
|
|
|
|
<p v-if="acctype=='tel'"><span>账号:</span><input :type="acctype"
|
|
|
|
|
onkeyup="this.value=this.value.replace(/\D/g,'')" :disabled="goodsDetail.available!=1"
|
|
|
|
|
onKeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))" :maxlength="maxlen"
|
|
|
|
|
v-model="account" :placeholder="placeholder" @focus="(e)=>focusFn(e)"></p>
|
|
|
|
|
<p v-if="acctype=='tel'"><span>再次输入:</span> <input :type="acctype"
|
|
|
|
|
onkeyup="this.value=this.value.replace(/\D/g,'')" :disabled="goodsDetail.available!=1"
|
|
|
|
|
onKeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))" :maxlength="maxlen"
|
|
|
|
|
v-model="reaccount" placeholder="请再次输入" @focus="(e)=>focusFn(e)"></p>
|
|
|
|
|
<p v-if="acctype!='tel'"><span>账号:</span> <input :type="acctype" :maxlength="maxlen" v-model="account"
|
|
|
|
|
:disabled="goodsDetail.available!=1" :placeholder="placeholder" @focus="(e)=>focusFn(e)"></p>
|
|
|
|
|
<p v-if="acctype!='tel'"><span>再次输入:</span><input :type="acctype" :maxlength="maxlen" v-model="reaccount"
|
|
|
|
|
:disabled="goodsDetail.available!=1" placeholder="请再次输入" @focus="(e)=>focusFn(e)"></p>
|
|
|
|
|
</template>
|
2024-02-29 15:21:02 +08:00
|
|
|
|
</template>
|
2024-02-23 14:22:16 +08:00
|
|
|
|
</div>
|
2024-02-29 15:18:29 +08:00
|
|
|
|
|
2024-02-23 14:22:16 +08:00
|
|
|
|
<div class="bottom" id="bottom" v-show="describe.type||detailUrl">
|
|
|
|
|
<img :src="detailUrl" v-show="detailUrl">
|
|
|
|
|
<img :src="describe.bg_image" v-show="describe.type==1&&describe.bg_image">
|
|
|
|
|
<div v-html="describe.content" class="goodsTip" v-show="describe.type==3&&describe.content"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="e-btn-box">
|
|
|
|
|
<div class="order-box" v-if="!backAble">
|
|
|
|
|
<img src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/toOrder.png" alt=""
|
2024-02-25 13:51:00 +08:00
|
|
|
|
@click="()=>{location.href='./order.html'}">
|
2024-02-23 14:22:16 +08:00
|
|
|
|
<p>订单</p>
|
|
|
|
|
</div>
|
|
|
|
|
<button class="exchange-btn"
|
2024-03-01 15:30:58 +08:00
|
|
|
|
:style="{'background': computedExChange?bgcolor:'#D7D7D7','color':computedExChange?ftcolor:'#333'}"
|
2024-02-23 14:22:16 +08:00
|
|
|
|
@click="exchangeGoodsFn">立即兑换</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 单条弹出框 -->
|
|
|
|
|
<div class="prompt" :class="promtshow?'proactive':''">
|
|
|
|
|
{{this.promttip}}
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 弹出框 -->
|
|
|
|
|
<div class="mask" v-if="maskshow">
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 悬浮提示 -->
|
|
|
|
|
<div v-if="suspension" class="suspensionDom">
|
|
|
|
|
<img @click="closeTip" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png"
|
|
|
|
|
alt="">
|
|
|
|
|
<h4>活动规则</h4>
|
|
|
|
|
<div v-html="describe.content">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<img class="susTip" @click="susTipFn" v-if="describe.type==2&&describe.content&&!suspension"
|
|
|
|
|
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/acticeTextTip.png" alt="">
|
|
|
|
|
<!-- 弹出框 -->
|
|
|
|
|
<!-- 询问 -->
|
|
|
|
|
<div class="popboxshow" v-if="popboxshow&&popboxtype=='兑换'" :class="popboxshow?'active':''">
|
|
|
|
|
<div>
|
|
|
|
|
<p v-if="acctype=='tel'">{{goodInfo.product_type===1?`是否为账号${this.account}兑换${this.proname}权益?`:'是否确认兑换?'}}</p>
|
|
|
|
|
<p v-if="acctype=='text'">是否兑换{{this.proname}}权益?</p>
|
|
|
|
|
<span @click="surexchangeBtn">确认兑换</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 弹出提示 -->
|
|
|
|
|
<div class="popboxshow" v-if="popboxshow&&popboxtype=='提示'" :class="popboxshow?'active':''">
|
|
|
|
|
<div class="tip">
|
|
|
|
|
<p>{{tiptext}}</p>
|
|
|
|
|
<span @click="successchangeBtn">知道了</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 成功 -->
|
|
|
|
|
<div class="popboxshow successbox" v-if="popboxshow&&popboxtype=='成功'" :class="popboxshow?'active':''">
|
|
|
|
|
<div>
|
|
|
|
|
<p :style="{fontSize:goodInfo.card_show===2?'0.13rem':''}">{{this.successTip}}</p>
|
|
|
|
|
<span @click="successchangeBtnFn">我知道啦</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<img v-if="popboxshow&&popboxtype!='成功'" class="closed"
|
|
|
|
|
src="https://lsxd-customcard-h5.oss-cn-hangzhou.aliyuncs.com/cardpwd/img/commimgs/close.png" alt=""
|
|
|
|
|
@click="closeBtn()">
|
|
|
|
|
</div>
|
|
|
|
|
</body>
|
|
|
|
|
<script>
|
2024-02-25 14:14:58 +08:00
|
|
|
|
const bm_obj_data = sessionStorage.getItem("bm_auth") ? JSON.parse(sessionStorage.getItem("bm_auth")) : null;
|
2024-02-23 14:22:16 +08:00
|
|
|
|
let goodsCount = null, goodsDetail = null;
|
|
|
|
|
new Vue({
|
|
|
|
|
el: '#exchangePage',
|
2024-02-25 14:01:55 +08:00
|
|
|
|
data() {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
return {
|
|
|
|
|
account: '',
|
|
|
|
|
reaccount: '',
|
|
|
|
|
maxlen: 11,
|
|
|
|
|
acctype: 'tel',
|
|
|
|
|
promttip: '',
|
|
|
|
|
promtshow: false,
|
|
|
|
|
productType: 0,
|
|
|
|
|
proname: '',
|
|
|
|
|
placeholder: '',
|
|
|
|
|
maskshow: false,
|
|
|
|
|
popboxshow: false,
|
|
|
|
|
exchangeOpen: false,
|
|
|
|
|
suspension: false,
|
2024-03-01 15:30:58 +08:00
|
|
|
|
cunt: 60,
|
|
|
|
|
jd_code: '',
|
2024-02-23 14:22:16 +08:00
|
|
|
|
popboxtype: '',
|
|
|
|
|
describe: {},
|
|
|
|
|
detailUrl: '',
|
|
|
|
|
successTip: '',
|
|
|
|
|
goodInfo: '',
|
|
|
|
|
bgcolor: '',
|
|
|
|
|
ftcolor: '',
|
|
|
|
|
goodsDetail: {},//商品详情
|
|
|
|
|
backAble: true,
|
|
|
|
|
bindClick: false,//控制遮罩显示
|
|
|
|
|
order_number: 0,
|
|
|
|
|
goodsShow: [
|
|
|
|
|
'https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20220120/9bedd7af6a8a570be8f2858564f9ec6d.png'
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
},
|
2024-02-25 14:01:55 +08:00
|
|
|
|
created() {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
document.title = localStorage.getItem('title');
|
|
|
|
|
let detailsConfig = JSON.parse(localStorage.getItem('product_detail'));
|
|
|
|
|
goodsCount = sessionStorage.getItem('goodsCount');
|
|
|
|
|
this.backAble = goodsCount > 1;//多个商品才有返回
|
|
|
|
|
this.bgcolor = detailsConfig.button_color;
|
|
|
|
|
this.ftcolor = detailsConfig.font_color;
|
|
|
|
|
this.describe = detailsConfig.describe;
|
|
|
|
|
goodsDetail = JSON.parse(sessionStorage.getItem('goodsInfo'));//商品详情
|
|
|
|
|
this.goodsDetail = goodsDetail;//商品详情
|
|
|
|
|
let goodsInform = goodsDetail.entity; //商品信息
|
|
|
|
|
this.goodInfo = goodsInform;
|
|
|
|
|
let goods_desc = goodsInform.describe_url;
|
|
|
|
|
this.goodsShow = goods_desc.length > 0 ? goods_desc : [goodsInform.show_url];
|
|
|
|
|
this.detailUrl = goodsInform.detail_url ? goodsInform.detail_url : '';
|
|
|
|
|
this.productType = goodsDetail.entity.account_type;
|
|
|
|
|
|
|
|
|
|
/* 区分卡密短信 */
|
|
|
|
|
if (goodsInform.product_type === 2 && goodsInform.card_show == 1) {
|
|
|
|
|
this.productType = 1;
|
|
|
|
|
} else {
|
|
|
|
|
this.productType = goodsInform.account_type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 微博 */
|
|
|
|
|
if (goodsDetail.entity.account_type == 0 && goodsInform.product_name.indexOf('微博') !== -1) {
|
|
|
|
|
this.productType = 99;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.$nextTick(function () {
|
|
|
|
|
var swiper = new Swiper('.swiper-container', {
|
|
|
|
|
loop: true, // 循环模式选项
|
|
|
|
|
autoplay: 3000, //可选选项,自动滑动
|
|
|
|
|
pagination: '.swiper-pagination',
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
2024-02-25 14:14:58 +08:00
|
|
|
|
mounted() {
|
2024-02-28 17:52:36 +08:00
|
|
|
|
// 领取成功结算 5
|
2024-03-19 10:50:52 +08:00
|
|
|
|
// 不是卡密
|
2024-02-28 17:52:36 +08:00
|
|
|
|
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 5 && this.goodInfo.product_type !== 2) {
|
2024-02-25 14:14:58 +08:00
|
|
|
|
settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
|
|
|
|
|
}
|
2024-03-01 11:54:35 +08:00
|
|
|
|
|
|
|
|
|
// 领取成功结算 5
|
2024-03-19 10:50:52 +08:00
|
|
|
|
// 是卡密 并且是 短信下发(账号领取)
|
|
|
|
|
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 5 && this.goodInfo.product_type === 2 && this.goodInfo.card_show === 1) {
|
|
|
|
|
settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 打开成功结算 3
|
|
|
|
|
// 卡密product_type2 平台查看card_show2
|
|
|
|
|
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 3 && this.goodInfo.product_type === 2 && this.goodInfo.card_show === 2) {
|
|
|
|
|
settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
|
2024-03-01 11:54:35 +08:00
|
|
|
|
}
|
2024-02-25 14:14:58 +08:00
|
|
|
|
},
|
2024-02-23 14:22:16 +08:00
|
|
|
|
methods: {
|
2024-02-25 14:01:55 +08:00
|
|
|
|
bindAvailable() {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
if (goodsDetail.available != 1) {
|
|
|
|
|
this.openErrorDialog(product_status(goodsDetail.available, goodsDetail));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-03-01 15:30:58 +08:00
|
|
|
|
|
|
|
|
|
/* 获取京东E卡短信 */
|
2024-03-03 16:07:44 +08:00
|
|
|
|
sendJDSms() {
|
2024-03-01 15:30:58 +08:00
|
|
|
|
if (this.cunt === 60) {
|
|
|
|
|
req.axiosPost('/key/order/jdSendSms', { code_batch_id: this.goodsDetail.code_batch_id, mobile: this.account })
|
|
|
|
|
.then((res) => {
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
this.openDialog('短信下发成功!');
|
|
|
|
|
const clr = setInterval(() => {
|
|
|
|
|
if (this.cunt <= 1) {
|
|
|
|
|
this.cunt = 60;
|
|
|
|
|
return clearInterval(clr);
|
|
|
|
|
}
|
|
|
|
|
this.cunt--;
|
|
|
|
|
}, 1000);
|
|
|
|
|
} else {
|
|
|
|
|
this.openErrorDialog(res.message);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2024-03-03 16:07:44 +08:00
|
|
|
|
openErrorDialog(tip) {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
this.maskshow = true;
|
|
|
|
|
this.popboxtype = '提示';
|
|
|
|
|
this.tiptext = tip;
|
|
|
|
|
this.popboxshow = true;
|
|
|
|
|
},
|
2024-02-25 14:01:55 +08:00
|
|
|
|
backgoodsFn() {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
if (goodsCount > 1) {
|
2024-02-28 09:44:55 +08:00
|
|
|
|
locationReplace('./homepage.html');
|
2024-02-23 14:22:16 +08:00
|
|
|
|
} else {
|
|
|
|
|
history.go(-2);
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-02-25 14:01:55 +08:00
|
|
|
|
closeTip() {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
this.suspension = false;
|
|
|
|
|
},
|
2024-02-25 14:01:55 +08:00
|
|
|
|
susTipFn() {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
this.suspension = true;
|
|
|
|
|
},
|
|
|
|
|
// 单条弹框
|
2024-02-25 14:01:55 +08:00
|
|
|
|
openDialog(tip) {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
this.promtshow = true;
|
|
|
|
|
this.promttip = tip;
|
|
|
|
|
const clr = setTimeout(() => {
|
|
|
|
|
this.promtshow = false;
|
|
|
|
|
this.promttip = '';
|
|
|
|
|
clearTimeout(clr);
|
|
|
|
|
}, 3000);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//刷新页面
|
2024-02-25 14:01:55 +08:00
|
|
|
|
successchangeBtnFn() {
|
2024-02-28 09:58:21 +08:00
|
|
|
|
window.location.replace(document.referrer);
|
2024-02-23 14:22:16 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//兑换商品
|
2024-02-25 14:01:55 +08:00
|
|
|
|
exchangeGoodsFn() {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
if (goodsDetail.available != 1) {
|
|
|
|
|
return this.openErrorDialog(product_status(goodsDetail.available, goodsDetail));
|
|
|
|
|
}
|
|
|
|
|
/* 卡密商品直接兑换 */
|
|
|
|
|
if (this.goodInfo.product_type === 2 && this.goodInfo.card_show == 2 && this.backAble) {
|
|
|
|
|
this.maskshow = true;
|
|
|
|
|
this.popboxshow = true;
|
|
|
|
|
this.popboxtype = '兑换';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 当只有一个卡密商品、为线上查看卡密且只能兑换一次时执行 */
|
|
|
|
|
if (this.goodInfo.product_type === 2 && this.goodInfo.card_show == 2 && !this.backAble && this.goodsDetail.restrict == 1) {
|
|
|
|
|
return this.surexchangeBtn();
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-01 15:30:58 +08:00
|
|
|
|
/* 京东E卡 */
|
|
|
|
|
if (this.goodInfo.is_e_card && this.goodInfo.product_type === 1) {
|
|
|
|
|
if (this.computedExChange) {
|
|
|
|
|
this.maskshow = true;
|
|
|
|
|
this.popboxshow = true;
|
|
|
|
|
this.popboxtype = '兑换';
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-23 14:22:16 +08:00
|
|
|
|
if (!this.account) {
|
|
|
|
|
this.openDialog('请输入兑换账号!');
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
let namereg = /\w{4}/.test(this.account);
|
|
|
|
|
let phonereg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(this.account);
|
|
|
|
|
let qqreg = /^[1-9][0-9]{4,9}$/.test(this.account);
|
|
|
|
|
let emailsreg = /^[A-Za-z0-9\u4e00-\u9fa5\.]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(this.account);
|
|
|
|
|
let weixinreg = /^[a-zA-Z][a-zA-Z\d_-]{5,19}$/.test(this.account);
|
|
|
|
|
let regflag = true;
|
|
|
|
|
if ([0, 99].includes(this.productType)) {
|
|
|
|
|
/* 不做校验 */
|
|
|
|
|
} else if (this.productType == 1) {
|
|
|
|
|
regflag = phonereg;
|
|
|
|
|
} else if (this.productType == 2) {
|
|
|
|
|
regflag = emailsreg;
|
|
|
|
|
} else if (this.productType == 3) {
|
|
|
|
|
regflag = phonereg || emailsreg;
|
|
|
|
|
} else if (this.productType == 4) {
|
|
|
|
|
regflag = qqreg;
|
|
|
|
|
} else if (this.productType == 5) {
|
|
|
|
|
regflag = phonereg || qqreg;
|
|
|
|
|
} else if (this.productType == 6) {
|
|
|
|
|
regflag = emailsreg || qqreg;
|
|
|
|
|
} else if (this.productType == 7) {
|
|
|
|
|
regflag = phonereg || emailsreg || qqreg;
|
|
|
|
|
} else if (this.productType == 8) {
|
|
|
|
|
regflag = weixinreg;
|
|
|
|
|
} else if (this.productType == 9) {
|
|
|
|
|
regflag = phonereg || weixinreg;
|
|
|
|
|
} else if (this.productType == 10) {
|
|
|
|
|
regflag = emailsreg || weixinreg;
|
|
|
|
|
} else if (this.productType == 11) {
|
|
|
|
|
regflag = phonereg || emailsreg || weixinreg;
|
|
|
|
|
} else if (this.productType == 12) {
|
|
|
|
|
regflag = qqreg || weixinreg;;
|
|
|
|
|
} else if (this.productType == 13) {
|
|
|
|
|
regflag = phonereg || qqreg || weixinreg;
|
|
|
|
|
} else if (this.productType == 14) {
|
|
|
|
|
regflag = emailsreg || qqreg || weixinreg;
|
|
|
|
|
} else {
|
|
|
|
|
regflag = phonereg || emailsreg || qqreg || weixinreg;
|
|
|
|
|
}
|
|
|
|
|
if (!regflag) {
|
|
|
|
|
this.openDialog("充值账号格式不正确!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this.reaccount == "") {
|
|
|
|
|
this.openDialog("请再次输入账号!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (this.account != this.reaccount) {
|
|
|
|
|
this.reaccount == "";
|
|
|
|
|
this.openDialog("两次输入的账号必须一致!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
this.maskshow = true;
|
|
|
|
|
this.popboxshow = true;
|
|
|
|
|
this.popboxtype = '兑换';
|
|
|
|
|
},
|
|
|
|
|
//确定兑换
|
2024-02-25 14:01:55 +08:00
|
|
|
|
surexchangeBtn() {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
this.maskshow = false;
|
|
|
|
|
let self = this;
|
|
|
|
|
let data = {
|
|
|
|
|
"key": localStorage.getItem('key'),
|
|
|
|
|
"goods_id": this.goodInfo.goods_id,
|
|
|
|
|
"account": this.account,
|
|
|
|
|
"code_batch_id": this.goodInfo.code_batch_id,
|
2024-03-01 15:30:58 +08:00
|
|
|
|
"token": localStorage.getItem('token'),
|
|
|
|
|
'jd_code': this.jd_code
|
2024-02-23 14:22:16 +08:00
|
|
|
|
};
|
|
|
|
|
self.popboxshow = false;
|
|
|
|
|
req.axiosPost('/key/usage', data).then(res => {
|
2024-03-20 16:43:37 +08:00
|
|
|
|
if (res.code == 200) {
|
2024-03-05 15:07:54 +08:00
|
|
|
|
|
2024-03-20 16:43:37 +08:00
|
|
|
|
// 领取结算 4 卡密,并且是平台查看
|
|
|
|
|
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 4 && self.goodInfo.product_type === 2 && self.goodInfo.card_show === 2) {
|
|
|
|
|
settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
|
|
|
|
|
}
|
2024-02-25 14:14:58 +08:00
|
|
|
|
|
2024-03-05 15:07:54 +08:00
|
|
|
|
// 使用结算 6
|
|
|
|
|
// 卡密做特殊处理,复制才会触发
|
|
|
|
|
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 6 && self.goodInfo.product_type !== 2) {
|
2024-02-25 14:14:58 +08:00
|
|
|
|
settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
|
|
|
|
|
}
|
2024-03-20 16:43:37 +08:00
|
|
|
|
|
|
|
|
|
// 使用结算 6
|
|
|
|
|
// 是卡密,并且是短信下发(账号领取)
|
|
|
|
|
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 6 && self.goodInfo.product_type === 2 && self.goodInfo.card_show === 1) {
|
|
|
|
|
settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-23 14:22:16 +08:00
|
|
|
|
this.popboxtype = '成功';
|
|
|
|
|
sessionStorage.setItem('lastid', self.goodInfo.product_id);
|
|
|
|
|
sessionStorage.setItem('orderNumber', res.data.order_number);
|
|
|
|
|
/* product_type:2 兑换码
|
|
|
|
|
* card_show:2 线上查看卡密信息
|
|
|
|
|
* backAble:是否多个商品
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
this.openDialog("兑换成功");
|
|
|
|
|
const clr = setTimeout(() => {
|
2024-02-28 13:49:00 +08:00
|
|
|
|
if (self.goodInfo.product_type === 2) {
|
2024-02-25 14:01:55 +08:00
|
|
|
|
window.location.href = '/orderDetails/cardOrder.html';
|
2024-02-23 14:22:16 +08:00
|
|
|
|
} else {
|
2024-02-25 14:01:55 +08:00
|
|
|
|
window.location.href = '/orderDetails/chargerOrder.html';
|
2024-02-23 14:22:16 +08:00
|
|
|
|
}
|
|
|
|
|
clearTimeout(clr);
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
this.openErrorDialog(res.message);
|
|
|
|
|
if (res.code == 403) {
|
|
|
|
|
if (goodsCount > 1) {
|
|
|
|
|
setTimeout(() => {
|
2024-02-28 09:31:23 +08:00
|
|
|
|
locationReplace('./homepage.html');
|
2024-02-23 14:22:16 +08:00
|
|
|
|
}, 3000);
|
|
|
|
|
} else {
|
|
|
|
|
/*跳转起始页面*/
|
|
|
|
|
let entryLink = localStorage.getItem('entryLink');
|
|
|
|
|
setTimeout(() => {
|
2024-02-28 09:58:21 +08:00
|
|
|
|
window.location.replace(entryLink);
|
2024-02-23 14:22:16 +08:00
|
|
|
|
}, 3000);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
//关闭弹出框,仅关闭弹框
|
2024-02-25 14:01:55 +08:00
|
|
|
|
successchangeBtn() {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
this.maskshow = false;
|
|
|
|
|
this.popboxshow = false;
|
|
|
|
|
this.account = "";
|
|
|
|
|
this.reaccount = "";
|
2024-03-07 11:24:14 +08:00
|
|
|
|
this.jd_code = '';
|
2024-02-23 14:22:16 +08:00
|
|
|
|
},
|
2024-02-25 14:01:55 +08:00
|
|
|
|
focusFn(a) {
|
2024-02-29 10:57:06 +08:00
|
|
|
|
if (goodsDetail.available != 1) {
|
|
|
|
|
this.bindAvailable();
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-23 14:22:16 +08:00
|
|
|
|
let ele = document.querySelector('.ipt-acc');
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
ele.scrollIntoView(false);
|
|
|
|
|
document.body.scrollTop = ele.scrollHeight;
|
|
|
|
|
document.documentElement.scrollTop = ele.scrollHeight;
|
|
|
|
|
}, 400);
|
|
|
|
|
},
|
|
|
|
|
//关闭,关闭弹框
|
2024-02-25 14:01:55 +08:00
|
|
|
|
closeBtn() {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
this.popboxshow = false;
|
|
|
|
|
this.maskshow = false;
|
|
|
|
|
this.account = "";
|
|
|
|
|
this.reaccount = "";
|
2024-03-07 11:24:14 +08:00
|
|
|
|
this.jd_code = "";
|
2024-02-23 14:22:16 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
2024-03-01 15:30:58 +08:00
|
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
|
/* 手机号验证 */
|
2024-03-03 16:07:44 +08:00
|
|
|
|
computedAccount() {
|
2024-03-01 15:30:58 +08:00
|
|
|
|
return /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(this.account);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/* 兑换按钮验证 */
|
2024-03-03 16:07:44 +08:00
|
|
|
|
computedExChange() {
|
2024-03-01 15:30:58 +08:00
|
|
|
|
return this.exchangeOpen || (this.goodInfo.product_type === 2 && this.goodInfo.card_show == 2) || this.goodInfo.is_e_card && this.computedAccount && this.jd_code.length === 6;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2024-02-23 14:22:16 +08:00
|
|
|
|
watch: {
|
2024-02-25 14:01:55 +08:00
|
|
|
|
account() {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
if ((this.account == this.reaccount) && this.account) {
|
|
|
|
|
this.exchangeOpen = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.exchangeOpen = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-02-25 14:01:55 +08:00
|
|
|
|
reaccount() {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
if ((this.account == this.reaccount) && this.account) {
|
|
|
|
|
this.exchangeOpen = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.exchangeOpen = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
productType: {
|
|
|
|
|
immediate: true,
|
2024-02-25 14:01:55 +08:00
|
|
|
|
handler(newVal) {
|
2024-02-23 14:22:16 +08:00
|
|
|
|
this.maxlen = 50;
|
|
|
|
|
this.acctype = "text";
|
|
|
|
|
if (newVal == 0) {
|
|
|
|
|
this.placeholder = "请输入账号";
|
|
|
|
|
} else if (newVal == 1) {
|
|
|
|
|
this.acctype = "tel";
|
|
|
|
|
this.placeholder = "请输入手机号";
|
|
|
|
|
this.maxlen = 11;
|
|
|
|
|
} else if (newVal == 2) {
|
|
|
|
|
this.placeholder = "请输入邮箱";
|
|
|
|
|
} else if (newVal == 3) {
|
|
|
|
|
this.placeholder = "请输入手机号或邮箱";
|
|
|
|
|
} else if (newVal == 4) {
|
|
|
|
|
this.placeholder = "请输入QQ号";
|
|
|
|
|
this.acctype = "tel";
|
|
|
|
|
this.maxlen = 10;
|
|
|
|
|
} else if (newVal == 5) {
|
|
|
|
|
this.placeholder = "请输入手机号或QQ号";
|
|
|
|
|
this.maxlen = 11;
|
|
|
|
|
this.acctype = "tel";
|
|
|
|
|
} else if (newVal == 6) {
|
|
|
|
|
this.placeholder = "请输入邮箱或QQ号";
|
|
|
|
|
} else if (newVal == 7) {
|
|
|
|
|
this.placeholder = "请输入手机号/邮箱/QQ号";
|
|
|
|
|
} else if (newVal == 8) {
|
|
|
|
|
this.placeholder = "请输入微信号";
|
|
|
|
|
this.maxlen = 20;
|
|
|
|
|
} else if (newVal == 9) {
|
|
|
|
|
this.placeholder = "请输入手机号或微信";
|
|
|
|
|
this.maxlen = 20;
|
|
|
|
|
} else if (newVal == 10) {
|
|
|
|
|
this.placeholder = "请输入邮箱或微信号";
|
|
|
|
|
} else if (newVal == 11) {
|
|
|
|
|
this.placeholder = "请输入手机号/邮箱/微信号";
|
|
|
|
|
} else if (newVal == 12) {
|
|
|
|
|
this.placeholder = "请输入QQ号或微信号";
|
|
|
|
|
this.maxlen = 20;
|
|
|
|
|
} else if (newVal == 13) {
|
|
|
|
|
this.placeholder = "请输入手机号/QQ号/微信号";
|
|
|
|
|
this.maxlen = 20;
|
|
|
|
|
} else if (newVal == 14) {
|
|
|
|
|
this.placeholder = "请输入邮箱/QQ号/微信号";
|
|
|
|
|
} else if (newVal == 99) {
|
|
|
|
|
this.placeholder = "请输入昵称";
|
|
|
|
|
} else {
|
|
|
|
|
this.placeholder = "请输入手机号/邮箱/QQ号/微信号";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
</html>
|