From 4d0d1af253eaeaa76d836a63f07e9d050f80b04a Mon Sep 17 00:00:00 2001 From: xiaogang <825201136@qq.com> Date: Tue, 9 Jul 2024 17:43:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=9B=9E=E8=B0=83=E9=93=BE?= =?UTF-8?q?=E6=8E=A5encodeURIComponent=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/ycnc/components/order-item.vue | 5 +++- src/pages/ycnc/components/product-item.vue | 4 +-- src/pages/ycnc/hooks/useCode.js | 3 ++- src/pages/ycnc/hooks/usePay.js | 3 ++- src/pages/ycnc/index.vue | 29 +--------------------- src/pages/ycnc/order.vue | 1 + src/pages/ycnc/orderDetail.vue | 2 ++ vite.config.js | 12 ++++----- 8 files changed, 20 insertions(+), 39 deletions(-) diff --git a/src/pages/ycnc/components/order-item.vue b/src/pages/ycnc/components/order-item.vue index ce2081e..fe0b107 100644 --- a/src/pages/ycnc/components/order-item.vue +++ b/src/pages/ycnc/components/order-item.vue @@ -47,6 +47,8 @@ } emits('pay-event', props.detail); } + + function goDetail(e){ emits('detail-event', props.detail); } @@ -106,10 +108,11 @@ } .amount{ color: #333333; - font-weight: 400; + font-weight: bold; font-size:24rpx; text:nth-child(1){ font-size:20rpx; + font-weight: 400; } text:nth-child(2){ font-size:22rpx; diff --git a/src/pages/ycnc/components/product-item.vue b/src/pages/ycnc/components/product-item.vue index c926d93..0cd0cef 100644 --- a/src/pages/ycnc/components/product-item.vue +++ b/src/pages/ycnc/components/product-item.vue @@ -11,9 +11,9 @@ {{ config[detail.brandFlag].name}} {{ detail.voucherTitle }} - {{ detail.voucherOriginalPrice }} + {{ detail.voucherAmount }} - {{ detail.voucherAmount }} + {{ detail.voucherOriginalPrice }} 点击购买 diff --git a/src/pages/ycnc/hooks/useCode.js b/src/pages/ycnc/hooks/useCode.js index 6273599..614ef37 100644 --- a/src/pages/ycnc/hooks/useCode.js +++ b/src/pages/ycnc/hooks/useCode.js @@ -1,7 +1,7 @@ import md5 from 'js-md5'; export default function useCode(){ return new Promise((resolve,reject) => { - window.authCallback = (params) => { + const authCallback = (params) => { console.log('authCallback-use',params); const {code} = params resolve(code) @@ -23,6 +23,7 @@ export default function useCode(){ console.log('auth-param157-use',param); Fw.device.api.getNewAuthorization(param) }; + window.authCallback = authCallback; getNewAuthorization() }) } \ No newline at end of file diff --git a/src/pages/ycnc/hooks/usePay.js b/src/pages/ycnc/hooks/usePay.js index e191a16..7303e40 100644 --- a/src/pages/ycnc/hooks/usePay.js +++ b/src/pages/ycnc/hooks/usePay.js @@ -17,7 +17,8 @@ export default function usePay(){ MercUrl:notify_url, TranAmt:Number(voucherAmount).toFixed(2), TermSsn:order_no, - BackLink:`${window.location.origin}/#/pages/ycnc/orderDetail?order_no=${order_no}`, + // BackLink:`${window.location.origin}/#/pages/ycnc/orderDetail?order_no=${order_no}`, + BackLink:encodeURIComponent(`${window.location.origin}/#/pages/ycnc/orderDetail?order_no=${order_no}`), psbcmcc:'LSXD', TxnDt:dayjs(Date.now()).format('YYYY-MM-DD'), MercCode:'100610100019029' diff --git a/src/pages/ycnc/index.vue b/src/pages/ycnc/index.vue index d713251..4ae08af 100644 --- a/src/pages/ycnc/index.vue +++ b/src/pages/ycnc/index.vue @@ -66,44 +66,17 @@ }) }; - // window.authCallback = (params) => { - // console.log('authCallback-index',params); - // const {code} = params - // login({params:{code:code}}).then(res=>{ - // uni.setStorageSync('token',res.token) - // }) - // } - - // 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-index',param); - // Fw.device.api.getNewAuthorization(param) - // }; - onMounted(async ()=>{ queryProducts(); // let testToken = import.meta.env.VITE_TEST_TOKEN // uni.setStorageSync('token',testToken) const token = uni.getStorageSync('token') || ''; - console.log('是否有token',!!token); if(!token){ + console.log('进入登录过程'); const code = await useCode(); authCode.value = code const {token} = await login({params:{code:unref(authCode)}}); uni.setStorageSync('token',token); - // getNewAuthorization() } }); diff --git a/src/pages/ycnc/order.vue b/src/pages/ycnc/order.vue index f1f7a16..a209454 100644 --- a/src/pages/ycnc/order.vue +++ b/src/pages/ycnc/order.vue @@ -92,6 +92,7 @@ } function pay(orderData){ + console.log(orderData); const {order_no,notify_url,price} = orderData; const {payFunc} = usePay(); payFunc({order_no,notify_url,price}) diff --git a/src/pages/ycnc/orderDetail.vue b/src/pages/ycnc/orderDetail.vue index e590315..0254ea3 100644 --- a/src/pages/ycnc/orderDetail.vue +++ b/src/pages/ycnc/orderDetail.vue @@ -53,6 +53,8 @@ const orderDetail = reactive({}); onLoad((options) => { + console.log('href',window.location.href); + console.log('options',options); const {order_id,order_no} = options; id.value = order_id orderNo.value = order_no diff --git a/vite.config.js b/vite.config.js index c81dffd..270cc38 100644 --- a/vite.config.js +++ b/vite.config.js @@ -47,12 +47,12 @@ export default defineConfig(({ command, mode }) => { uni(), UnoCSS(), // copyFile(), - // zipPack({ - // inDir: `dist/build/${UNI_PLATFORM}`, // 输入的文件夹,就是要打包的文件夹 - // outDir: `dist/build`, // 打包好的 zip 文件放到哪个文件夹下 - // outFileName: `${UNI_PLATFORM}-${timeStringNow}.zip`, //文件名不能包含\/:*?"<>| - // pathPrefix: '' - // }), + zipPack({ + inDir: `dist/build/${UNI_PLATFORM}`, // 输入的文件夹,就是要打包的文件夹 + outDir: `dist/build`, // 打包好的 zip 文件放到哪个文件夹下 + outFileName: `${UNI_PLATFORM}-${timeStringNow}.zip`, //文件名不能包含\/:*?"<>| + pathPrefix: '' + }), ] } }) \ No newline at end of file