diff --git a/public/static/wechatUrls.txt b/public/static/uproWechatUrl.txt similarity index 100% rename from public/static/wechatUrls.txt rename to public/static/uproWechatUrl.txt diff --git a/src/api/urls.js b/src/api/urls.js index 1522c15..e8f38df 100644 --- a/src/api/urls.js +++ b/src/api/urls.js @@ -2,7 +2,7 @@ * @Author: wwxin 2463926940@qq.com * @Date: 2024-06-20 15:11:40 * @LastEditors: wwxin 2463926940@qq.com - * @LastEditTime: 2024-08-21 10:44:41 + * @LastEditTime: 2024-09-05 15:12:55 * @FilePath: /vip-server-new/src/api/urls.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -80,10 +80,21 @@ export function getCodeCheck(data) { } //发送验证吗 -export function sendCode(params) { +export function sendCode(data) { return request({ - url: `/api/mobile/code/${params.mobile}`, + url: `/api/mobile/code/${data.mobile}`, method: 'post', - params, + data, }); } + +//支付宝模式-传递下游参数 +export function saveQueryData(data) { + return request({ + url: `/api/mo/saveQueryData`, + method: 'post', + data + }); +} + + diff --git a/src/utils/tools.js b/src/utils/tools.js index 6ba0498..17200ba 100644 --- a/src/utils/tools.js +++ b/src/utils/tools.js @@ -2,20 +2,15 @@ * @Author: wwxin 2463926940@qq.com * @Date: 2023-08-29 14:22:42 * @LastEditors: wwxin 2463926940@qq.com - * @LastEditTime: 2024-07-25 10:09:39 + * @LastEditTime: 2024-09-05 15:35:29 * @FilePath: /vip-server-new/src/utils/tools.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ - - export function isMobile(value) { return /^1[3|4|5|6|7|8|9][0-9]\d{8}$/.test(value); } - - export function isIOS() { return /iPhone|iPad|iPod/i.test(navigator.userAgent); - } export const showTel = () => { const telArr = getRandomTel(); @@ -28,7 +23,6 @@ export const showTel = () => { "已领取饿了么月卡会员", "已领取QQ绿钻月卡会员" ]; - return telArr.map((tel, index) => `${tel} ${membershipTypes[index % 7]}`); }; //联合的 diff --git a/src/views/promotion/agree.vue b/src/views/promotion/agree.vue index 50767de..4634530 100644 --- a/src/views/promotion/agree.vue +++ b/src/views/promotion/agree.vue @@ -2,7 +2,7 @@ * @Author: wwxin 2463926940@qq.com * @Date: 2024-07-03 13:47:13 * @LastEditors: wwxin 2463926940@qq.com - * @LastEditTime: 2024-07-24 14:01:42 + * @LastEditTime: 2024-09-05 13:58:16 * @FilePath: /a-vue3 2/src/views/promotion/agree.vue * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE --> @@ -13,7 +13,7 @@
返回
-
+
@@ -86,5 +86,8 @@ cursor: pointer; font-size: 16px; } } +.content-box{ + padding: 10px 20px; +} \ No newline at end of file diff --git a/src/views/promotion/upromotion.vue b/src/views/promotion/upromotion.vue index 943c2a1..d2f6145 100644 --- a/src/views/promotion/upromotion.vue +++ b/src/views/promotion/upromotion.vue @@ -13,7 +13,7 @@
-
+
我已阅读并同意 + + + {{ + unionType == 2 ? "《优酷系列会员服务协议》" : "《会员服务协议》" + }} + 《隐私政策》 - 《会员服务协议》 - 《自动续费协议》,并同意购买自动续费商品。 - {{ accTxt }}业务资费:{{ price }}元/{{ priceTxt }}。 +
+ 及其 + 《自动续费协议》,并同意购买自动续费商品。 + {{ accTxt }}业务资费:{{ price }}元/{{ priceTxt }}。 +
首月19.9元(次月29.9元)。
@@ -66,7 +73,7 @@
- +
@@ -103,7 +110,7 @@ id="hd" @click="toAgreePages('zdxfService')" >《自动续费协议》,并同意购买自动续费商品。 + >
@@ -147,8 +154,10 @@ import { resourceAreaDj, resourceAreaAv, creatUnion, - getCodeCheck, - sendCode + getCodeCheck, + sendCode, + resourceAgree, + saveQueryData, } from "@/api/urls"; import md5 from "js-md5"; import { useRouter, useRoute } from "vue-router"; @@ -184,16 +193,19 @@ let coverBtnImgUrl = ref(""); let traceId = $ref(""); let unionType = ref(""); let promotionId = ref(""); +//支付宝小程序 +let isJumpMini = ref(false); +let isJumpH5 = ref(""); +let miniAplaiayId = ref(""); //是否免费模式 let isFreeGiftMode = ref("false"); +//协议是否url +let agreementIsUrl = ref("false"); + const route = useRoute(); onMounted(() => { promotionCode.value = getQueryParam("promotionCode"); - if (promotionCode.value != "RZpJsF") { - ntext.value = showlhTel(); - } else { - showNoticeBar.value = false; - } + ntext.value = showlhTel(); maidian(); }); const phoneBlur = () => { @@ -230,6 +242,9 @@ const handleAgree = (type) => { }; //跳转看agree等 const toAgreePages = (types) => { + if (agreementIsUrl.value && types === "hyService") { + return getYoukuAgreement(promotionId.value); + } let typesparmes = types === "hdRule" ? 1 @@ -240,6 +255,18 @@ const toAgreePages = (types) => { : 4; $router.push(`/agree?promotionId=${promotionId.value}&type=${typesparmes}`); }; +//优酷-单独协议 +const getYoukuAgreement = (id) => { + let typesparmes = 3; + let promotionId = id; + resourceAgree({ promotionId, typesparmes }).then((resp) => { + if (resp.data.code == "S00000") { + if (resp.data.result) { + window.location.href = resp.data.result; + } + } + }); +}; //验证ip地址 const handleSubmitCode = () => { getCodeCheck({ mobile: mobile.value, code: smsCode.value }).then((resp) => { @@ -252,7 +279,44 @@ const handleSubmitCode = () => { } }); }; - +//跳转支付宝小程序 +const toApliayMini = (appid) => { + let ua = navigator.userAgent.toLowerCase(); + let pageParams = `pages/prompp/index?promotionType=2&promotionCode=${promotionCode.value}&miniAplaiayId=${miniAplaiayId.value}`; + let urls = + `https://ulink.alipay.com/?scheme=` + + encodeURIComponent( + `alipays://platformapi/startapp?appId=${appid}&page=${encodeURIComponent( + pageParams + )}&query=${encodeURIComponent( + `promotionType=2&promotionCode=${promotionCode.value}&miniAplaiayId=${miniAplaiayId.value}` + )}` + ); + if (ua.match(/MicroMessenger/i) == "micromessenger") { + if (!isIOS()) { + var link = document.createElement("a"); + link.href = `${ + location.protocol + "//" + location.host + }/static/uproWechatUrl.txt?promotionCode=${promotionCode.value}&isApliayMini=true&appId=${appid}&miniAplaiayId=${miniAplaiayId.value}`; + link.textContent = ""; + link.download = "11"; + document.body.appendChild(link); + link.click(); + return; + } else { + window.location.href = urls; + return; + } + } else { + let scheme = `alipays://platformapi/startapp?appId=${appid}&page=${encodeURIComponent( + pageParams + )}&query=${encodeURIComponent( + `promotionType=2&promotionCode=${promotionCode.value}&miniAplaiayId=${miniAplaiayId.value}` + )}`; + window.location.href = scheme; + return; + } +}; const shouye = () => { resourceInfo({ promotionCode: promotionCode.value }).then((resp) => { if (resp.data.code == "S00000") { @@ -265,7 +329,6 @@ const shouye = () => { img3.value = result.imgTwo ? cdnBaseUrl + result.imgTwo : ""; img4.value = cdnBaseUrl + result.imgThree; coverBtnImgUrl.value = cdnBaseUrl + result.imgXxBtn; - // 其他属性 payMethod.value = result.payMethod || "0"; price.value = result.price; @@ -278,22 +341,32 @@ const shouye = () => { agreementThree.value = result.agreementThree; agreementFour.value = result.agreementFour; promotionId.value = result.promotionId; - - //免费模式 - isFreeGiftMode.value = result.isFreeGiftMode + //callbackUrl 是否等于 tammy 需要引入 + if (result.callbackUrl.toLowerCase() === "tammy") { + const script = document.createElement("script"); + script.src = "https://openapp.yytese.com/tongji.js"; + document.head.appendChild(script); + } + //协议是否在线链接 + agreementIsUrl.value = result.agreementIsUrl; + //免费模式 + isFreeGiftMode.value = result.isFreeGiftMode; //联合推广位-类型 unionType.value = result.unionType; if (result.periodPayDays) { priceTxt.value = `${result.periodPayDays}天`; } - accTxt.value = result.agreementTxt; - if ( - promotionCode.value == "afSKPj" || - promotionCode.value == "MadlRh" || - promotionCode.value == "oVkHuA" - ) { - accTxt.value = "VIP"; + //支付宝小程序 + isJumpMini.value = result.isJumpMini; + isJumpH5.value = result.isJumpH5; + if (result.isJumpMini) { + let xiayous = { queryData: window.location.search.substring(1) }; + saveQueryData({ data: xiayous }).then((res) => { + miniAplaiayId.value = res.data.result; + toApliayMini(result.isJumpH5); + }); } + accTxt.value = result.agreementTxt; if (route.query.phnumber) { const mobile1 = getQueryParam("phnumber"); if (isMobile(mobile1) && autoSelect.value == "1") { @@ -321,9 +394,19 @@ const maidian = () => { }; //获取地址栏对应参数 const getQueryParam = (variable = "") => { + if (variable === "allParmes") { + // 返回整个查询字符串部分(去掉 `?`) + return window.location.search.substring(1); + } return route.query[variable] || ""; }; const submitOrder = () => { + //跳转支付宝小程序模式 + if (isJumpMini.value) { + toApliayMini(isJumpH5.value); + return; + } + if (isCheck.value) { submitData(); } else { @@ -351,9 +434,8 @@ const submitData = async () => { return; } let ua = navigator.userAgent.toLowerCase(); - - let xiayou = getQueryParam("param"); - + //地址栏?后所有参数广告商带的参数 + let xiayou = getQueryParam("allParmes"); let text = `mobile=${mobiles}promotionCode=${promotionCode.value}`; overlayShow.value = true; let param = { @@ -361,7 +443,7 @@ const submitData = async () => { promotionCode: promotionCode.value, sign: md5(text), extra: xiayou, - isFreeGiftMode: isFreeGiftMode.value + isFreeGiftMode: isFreeGiftMode.value, }; resourceAreaDj({ union: 1, promotionCode: promotionCode.value }).then( (resp) => {} @@ -372,15 +454,15 @@ const submitData = async () => { let jumpp = resp.data.result.payUrl; let youkuurl = resp.data.result.jumpUrl; if (ua.match(/MicroMessenger/i) == "micromessenger") { - // 单独优酷类型跳转; + // 单独优酷类型跳转; if (unionType.value == 2) { window.location.href = youkuurl; return; } - //免费模式类型下跳转 - if (this.isFreeGiftMode) { - return window.location.href = `${youkuurl}&phnumber=${mobiles}` - } + //免费模式类型下跳转 + if (isFreeGiftMode.value) { + return (window.location.href = `${youkuurl}&phnumber=${mobiles}`); + } if (payMethod.value == "0") { jumpp = jumpp.replaceAll( "https://openapi.alipay.com/gateway.do?", @@ -410,24 +492,23 @@ const submitData = async () => { window.location.href = youkuurl; return; } - if ( isFreeGiftMode.value) { - window.location.href = `${youkuurl}&phnumber=${mobile}` - return - } + if (isFreeGiftMode.value) { + window.location.href = `${youkuurl}&phnumber=${mobile}`; + return; + } window.location.href = jumpp; } getBurialPoint(1100); } else if (resp.data.code == "103") { - smsCodeShow.value = true - sendCode({mobile:mobile.value}).then(res=>{ - if (res.data.code == "S00000") { - showToast("验证码已发送,请注意查收"); - } else { - showToast(res.data.message); - - } - }) - }else { + smsCodeShow.value = true; + sendCode({ mobile: mobile.value }).then((res) => { + if (res.data.code == "S00000") { + showToast("验证码已发送,请注意查收"); + } else { + showToast(res.data.message); + } + }); + } else { showToast(resp.data.message); } }) @@ -461,11 +542,11 @@ const hrefurl = (p, payMethod, ios) => { var link = document.createElement("a"); link.href = `${ location.protocol + "//" + location.host - }/static/wechatUrls.txt?payMethod=${payMethod}&url=${encodeURIComponent( + }/static/uproWechatUrl.txt?payMethod=${payMethod}&url=${encodeURIComponent( p )}&promotionCode=${promotionCode.value}`; link.textContent = "点击这里下载PDF文件"; - link.download = "wechatUrls.txt"; + link.download = "uproWechatUrl.txt"; document.body.appendChild(link); link.click(); document.body.removeChild(link);