diff --git a/.env b/.env index f07324f..ee2b508 100644 --- a/.env +++ b/.env @@ -1,7 +1,7 @@ # 邮储奶茶活动 -# VITE_YCNC_APPID = '2vikrqptiia9pe9bf5ztrd' -# VITE_YCNC_SECRET = '6fpfwdkgcggyk0yf2yb6bt' +VITE_YCNC_APPID = '2vikrqptiia9pe9bf5ztrd' +VITE_YCNC_SECRET = '6fpfwdkgcggyk0yf2yb6bt' # 邮储音视频 -VITE_YCNC_APPID = '2vi3695tiia9pe9bf5yyyi' -VITE_YCNC_SECRET = '6fpf26837kmgr0yf2yf643' \ No newline at end of file +# VITE_YCNC_APPID = '2vi3695tiia9pe9bf5yyyi' +# VITE_YCNC_SECRET = '6fpf26837kmgr0yf2yf643' \ No newline at end of file diff --git a/.env.development b/.env.development index f688cec..f3b817c 100644 --- a/.env.development +++ b/.env.development @@ -5,5 +5,5 @@ NODE_ENV = 'development' # VITE_BASE_URL = 'http://milk.api.test.86698.cn' # VITE_BASE_URL = 'http://milk.test.api.cdlsxd.cn' # 邮储音视频 -VITE_BASE_URL = 'http://192.168.110.128:8000/ycav' +VITE_BASE_URL = 'https://gateway.dev.cdlsxd.cn' # VITE_BASE_URL = 'https://gateway.dev.cdlsxd.cn/ycav' diff --git a/custom.page.js b/custom.page.js index 3e4e797..02dd48f 100644 --- a/custom.page.js +++ b/custom.page.js @@ -5,7 +5,7 @@ import path from 'path' const config = { pages:'./src/pages', pagesInclude:['ycysp/home.vue','ycysp/pay.vue','ycysp/order.vue','ycysp/orderDetail.vue',] - // pagesInclude:['ycnc',] + // pagesInclude:['ycnc'] } const { pages, pagesInclude } = config diff --git a/index.html b/index.html index bac152f..b42e1dc 100644 --- a/index.html +++ b/index.html @@ -18,15 +18,15 @@ - + + diff --git a/src/pages/ycnc/order.vue b/src/pages/ycnc/order.vue index d4ccf65..87f91de 100644 --- a/src/pages/ycnc/order.vue +++ b/src/pages/ycnc/order.vue @@ -119,9 +119,12 @@ async function pay(orderData){ console.log(orderData); - const {order_no,notify_url,price,brand,sign,plain_text} = orderData; - const queryParams = {order_no} - const res = await queryOrderDetail({queryParams}) + const {order_no,notify_url,price,brand,sign,plain_text,id} = orderData; + const params = { + order_id:id, + order_no: order_no + } + const res = await queryOrderDetail({params}) if(res.third_status === '03'){ uni.showToast({ title: '当前订单已支付成功,无需再支付~', diff --git a/src/pages/ycnc/orderDetail.vue b/src/pages/ycnc/orderDetail.vue index 3803a5a..1d5e11b 100644 --- a/src/pages/ycnc/orderDetail.vue +++ b/src/pages/ycnc/orderDetail.vue @@ -158,9 +158,12 @@ const goRefund = () => { async function pay(orderData) { console.log(orderData); - const { order_no, notify_url, price,brand,sign,plain_text } = orderData; - const queryParams = {order_no} - const res = await queryOrderDetail({queryParams}) + const { order_no, notify_url, price,brand,sign,plain_text,id } = orderData; + const params = { + order_id:id, + order_no: order_no + } + const res = await queryOrderDetail({params}) if(res.third_status === '03'){ uni.showToast({ title: '当前订单已支付成功,无需再支付~', diff --git a/src/pages/ycysp/components/order-item.vue b/src/pages/ycysp/components/order-item.vue index 768dc45..02f7f33 100644 --- a/src/pages/ycysp/components/order-item.vue +++ b/src/pages/ycysp/components/order-item.vue @@ -95,14 +95,6 @@ function goDetail(e) { emits("detail-event", props.detail); } -function goPwd(e) { - if (e.stopPropagation) { - //W3C阻止冒泡方法 - e.stopPropagation(); - } - emits("pwd-event", props.detail); -} - function goDel(e) { if (e.stopPropagation) { //W3C阻止冒泡方法 diff --git a/src/pages/ycysp/config.js b/src/pages/ycysp/config.js index 469238e..ce0b469 100644 --- a/src/pages/ycysp/config.js +++ b/src/pages/ycysp/config.js @@ -35,6 +35,7 @@ export const stateConfig = { 7: "退款成功", 8: "充值成功", 9: "订单作废", + 10:'支付失败' }; export const stateColor = { @@ -42,7 +43,8 @@ export const stateColor = { 3: "#FF8400", 4: "#FF0000", 7: "#EA722D", - 8: "#FF0000 ", + 8: "#FF0000", + 10: "#FF0000" }; export const checkedColor = { diff --git a/src/pages/ycysp/home.vue b/src/pages/ycysp/home.vue index d1843d6..d1aa1fd 100644 --- a/src/pages/ycysp/home.vue +++ b/src/pages/ycysp/home.vue @@ -62,7 +62,7 @@ @@ -88,9 +88,9 @@ >如因账号信息输入错误导致充值至他人账户,仍视为充值成功,无法补券。 3、此权益中包含的优酷/腾讯黄金会员、芒果视频会员可在手机、电脑、平板上使用,不支持电视端,不支持投屏。3、此权益中包含的优酷黄金会员、芒果视频会员可在手机、电脑、平板上使用,不支持电视端,不支持投屏。腾讯视频、QQ音乐支持QQ号或手机号,QQ音乐支持QQ号或手机号,其余会员账号均为手机号。 { } if (!account.value) { uni.showToast({ - title: "请填写充值手机号或QQ号", - icon: "none", - }); - return; - } - if (!reg.test(account.value) && !_reg.test(account.value)) { - uni.showToast({ - title: "充值账号格式不正确", + title: "请填写充值手机号", icon: "none", }); return; } + // if (!reg.test(account.value)) { + // uni.showToast({ + // title: "充值账号格式不正确,应为手机号", + // icon: "none", + // }); + // return; + // } addOrder(selectProduct.id); }; diff --git a/src/pages/ycysp/hooks/useCode.js b/src/pages/ycysp/hooks/useCode.js index 614ef37..a72b558 100644 --- a/src/pages/ycysp/hooks/useCode.js +++ b/src/pages/ycysp/hooks/useCode.js @@ -1,29 +1,29 @@ -import md5 from 'js-md5'; -export default function useCode(){ - return new Promise((resolve,reject) => { - const authCallback = (params) => { - console.log('authCallback-use',params); - const {code} = params - resolve(code) - } - const getNewAuthorization = () => { - let appId = import.meta.env.VITE_YCNC_APPID; - let time = Date.now().toString(); - let secret = import.meta.env.VITE_YCNC_SECRET; - let signBefore = appId + time + secret; - let sign = md5(signBefore);//普通md5 - let param = { - appId: appId, - sign: sign, - time: time, - tran_code: "157", - fn: "authCallback", - needBind: "" - }; - console.log('auth-param157-use',param); - Fw.device.api.getNewAuthorization(param) - }; - window.authCallback = authCallback; - getNewAuthorization() - }) -} \ No newline at end of file +import md5 from "js-md5"; +export default function useCode() { + return new Promise((resolve, reject) => { + const authCallback = (params) => { + console.log("authCallback-use", params); + const { code } = params; + resolve(code); + }; + const getNewAuthorization = () => { + let appId = import.meta.env.VITE_YCNC_APPID; + let time = Date.now().toString(); + let secret = import.meta.env.VITE_YCNC_SECRET; + let signBefore = appId + time + secret; + let sign = md5(signBefore); //普通md5 + let param = { + appId: appId, + sign: sign, + time: time, + tran_code: "157", + fn: "authCallback", + needBind: "", + }; + console.log("auth-param157-use", param); + Fw.device.api.getNewAuthorization(param); + }; + window.authCallback = authCallback; + getNewAuthorization(); + }); +} diff --git a/src/pages/ycysp/hooks/usePay.js b/src/pages/ycysp/hooks/usePay.js index 2b04fe8..3a01fb8 100644 --- a/src/pages/ycysp/hooks/usePay.js +++ b/src/pages/ycysp/hooks/usePay.js @@ -1,41 +1,45 @@ import dayjs from "dayjs"; -import md5 from 'js-md5'; +import md5 from "js-md5"; -const handleParams = (obj) => Object.entries(obj).reduce((total,curr) => { - if(!total){ - total += `${curr[0]}=${curr[1]}` - }else{ - total += `|${curr[0]}=${curr[1]}` +const handleParams = (obj) => + Object.entries(obj).reduce((total, curr) => { + if (!total) { + total += `${curr[0]}=${curr[1]}`; + } else { + total += `|${curr[0]}=${curr[1]}`; } - return total -},'') + return total; + }, ""); - -export default function usePay(){ - const payFunc = (args) => { - const {order_no,notify_url,TranAmt,MerName,sign,plain_text} = args; - const MercCode = import.meta.env.VITE_YCNC_MERCH_CODE - const tranAmt = Number(TranAmt).toFixed(2) - const Plain = { - MercUrl:notify_url, - TranAmt:tranAmt, - TermSsn:order_no, - BackLink:encodeURIComponent(`${window.location.origin}${window.location.pathname || ''}/#/pages/ycysp/orderDetail?order_no=${order_no}&isPayBack=true`), - psbcmcc:'LSXD', - TxnDt:dayjs(Date.now()).format('YYYY-MM-DD'), - MercCode:MercCode, - IsIntegral:'1', - MerName:MerName, - } - const params = { - Plain:handleParams(Plain), - plainText:plain_text, - sign:sign, - Signature: '', - } - console.log('CodePay-plain',Plain); - console.log('CodePay-params',params); - Fw.device.api.handCodePay(params); - } - return {payFunc} -} \ No newline at end of file +export default function usePay() { + const payFunc = (args) => { + const { order_no, notify_url, TranAmt, MerName, sign, plain_text } = args; + const MercCode = import.meta.env.VITE_YCNC_MERCH_CODE; + const tranAmt = Number(TranAmt).toFixed(2); + const Plain = { + MercUrl: notify_url, + TranAmt: tranAmt, + TermSsn: order_no, + BackLink: encodeURIComponent( + `${window.location.origin}${ + window.location.pathname || "" + }/#/pages/ycysp/orderDetail?order_no=${order_no}&isPayBack=true` + ), + psbcmcc: "LSXD", + TxnDt: dayjs(Date.now()).format("YYYY-MM-DD"), + MercCode: MercCode, + IsIntegral: "1", + MerName: MerName, + }; + const params = { + Plain: handleParams(Plain), + plainText: plain_text, + sign: sign, + Signature: "", + }; + console.log("CodePay-plain", Plain); + console.log("CodePay-params", params); + Fw.device.api.handCodePay(params); + }; + return { payFunc }; +} diff --git a/src/pages/ycysp/order.vue b/src/pages/ycysp/order.vue index 976c2a0..cc7b9dc 100644 --- a/src/pages/ycysp/order.vue +++ b/src/pages/ycysp/order.vue @@ -25,7 +25,6 @@ :detail="ele" @pay-event="pay" @detail-event="viewDetail" - @pwd-event="viewPwd" @del-event="removeOrder" @refund-event="refund" /> @@ -123,16 +122,6 @@ function viewDetail(orderData) { }); } -function viewPwd(orderData) { - const { voucher_link } = orderData; - if (voucher_link) { - console.log("跳转外部链接--->", voucher_link); - window.location.href = voucher_link; - } else { - console.error(`${voucher_link}无有效值`); - } -} - function removeOrder(orderData) { message .confirm({ diff --git a/src/pages/ycysp/orderDetail.vue b/src/pages/ycysp/orderDetail.vue index 95d1f66..2e757b7 100644 --- a/src/pages/ycysp/orderDetail.vue +++ b/src/pages/ycysp/orderDetail.vue @@ -90,10 +90,11 @@