手机银行版本试运行环境更新前提交一次代码

This commit is contained in:
xiaogang 2025-06-25 10:33:58 +08:00
parent 2d92c6594c
commit 7ff654ab22
6 changed files with 218 additions and 173 deletions

View File

@ -1,7 +1,7 @@
NODE_ENV = 'production'
# 邮储奶茶活动(正式环境)
VITE_BASE_URL = 'https://milk.api.cdlsxd.cn'
VITE_BASE_URL = 'https://tea.cdlsxd.cn'
VITE_YCNC_MERCH_CODE = '100510102303326'
# 邮储音视频活动(生产环境)

View File

@ -1,11 +1,11 @@
<route lang="json5" type="page">
{
{
style: {
navigationStyle: 'custom',
navigationBarTitleText: '商品详情',
navigationBarBackgroundColor:'#FFF',
navigationStyle: "custom",
navigationBarTitleText: "商品详情",
navigationBarBackgroundColor: "#FFF",
},
}
}
</route>
<template>
@ -20,9 +20,7 @@
<text class="ori">{{ detailObj.show_price }}</text>
</view>
</view>
<view class="desc" v-html="detailObj.description">
</view>
<view class="desc" v-html="detailObj.description"> </view>
<!-- <view class="desc">
<div class="big">购买须知</div>
<div class="small">有效期</div>
@ -33,153 +31,158 @@
</view>
</scroll-view>
<view class="pay-container">
<view class="pay-btn" @click="toPay">
立即支付
</view>
<view class="pay-btn" @click="toPay"> 立即支付 </view>
</view>
</view>
</template>
<script setup>
import { onMounted, reactive, ref, unref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { queryDetail, goPay, login } from '../../api/ycnc';
import { getQueryString } from '../../utils/utils'
import { onMounted, reactive, ref, unref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { queryDetail, goPay, login } from "../../api/ycnc";
import { getQueryString } from "../../utils/utils";
const id = ref('')
const id = ref("");
const detailObj = reactive({})
const detailObj = reactive({});
onLoad((options) => {
const {product_id} = options;
id.value = product_id
})
onLoad((options) => {
const { product_id } = options;
id.value = product_id;
});
onMounted(() => {
getDetail()
})
onMounted(() => {
const token = getQueryString("token") || uni.getStorageSync("token");
uni.setStorageSync("token", token);
getDetail();
});
const getDetail = () => {
const getDetail = () => {
const params = {
product_id:unref(id)
}
queryDetail({params}).then(res => {
Object.assign(detailObj,res)
})
}
product_id: unref(id),
};
queryDetail({ params }).then((res) => {
Object.assign(detailObj, res);
});
};
const toPay = async () => {
const token = getQueryString('token') || uni.getStorageSync('token');
uni.setStorageSync('token',token)
const toPay = async () => {
const tempBackUrl = getQueryString("backUrl");
const backUrl = tempBackUrl
? encodeURIComponent(tempBackUrl)
: uni.getStorageSync("backUrl");
const params = {
product_id:unref(id)
}
goPay({params}).then(res => {
const {order_no,notify_url,sign,plain_text,pay_url} = res;
window.location.replace(pay_url)
}).catch(err => {
product_id: unref(id),
backUrl: backUrl,
};
goPay({ params })
.then((res) => {
const { order_no, notify_url, sign, plain_text, pay_url } = res;
window.location.replace(pay_url);
})
.catch((err) => {
console.log(err);
})
}
});
};
</script>
<style lang='scss' scoped>
.banner{
<style lang="scss" scoped>
.banner {
width: 100%;
height:600rpx;
height: 600rpx;
display: block;
box-sizing: border-box;
}
.detail{
.detail {
width: 694rpx;
// height: 138rpx;
border-bottom: 2rpx solid rgba(0,0,0,0.04);
border-bottom: 2rpx solid rgba(0, 0, 0, 0.04);
margin: 0 auto;
box-sizing: border-box;
padding:25rpx 0;
.proname{
padding: 25rpx 0;
.proname {
font-weight: bold;
font-size: 30rpx;
color: #333333;
margin-bottom:16rpx;
margin-bottom: 16rpx;
}
.price{
.price {
font-weight: 700;
font-size: 28rpx;
color: #EA0000;
margin-right:18rpx;
color: #ea0000;
margin-right: 18rpx;
}
.ori{
.ori {
font-weight: 400;
font-size: 28rpx;
color: #A5A5A5;
color: #a5a5a5;
text-decoration: line-through;
}
}
.desc{
.desc {
width: 694rpx;
margin:0 auto;
padding-top:44rpx;
padding-bottom:24rpx;
margin: 0 auto;
padding-top: 44rpx;
padding-bottom: 24rpx;
//
&:deep(.big-title) {
font-weight: bold;
font-size: 40rpx;
color: #3D3D3D;
margin-bottom:16rpx;
color: #3d3d3d;
margin-bottom: 16rpx;
}
&:deep(.small-area) {
margin-bottom:16rpx;
margin-bottom: 16rpx;
}
&:deep(.small-title){
&:deep(.small-title) {
font-weight: 400;
font-size: 32rpx;
color: #333333;
margin-bottom:16rpx;
margin-bottom: 16rpx;
}
&:deep(.small-content){
&:deep(.small-content) {
font-weight: 400;
font-size: 28rpx;
color: #4D4D4D;
color: #4d4d4d;
line-height: 1.6;
}
//
&:deep(.big){
&:deep(.big) {
font-weight: bold;
font-size: 40rpx;
color: #3D3D3D;
margin-bottom:16rpx;
color: #3d3d3d;
margin-bottom: 16rpx;
}
&:deep(.small){
&:deep(.small) {
font-weight: 400;
font-size: 32rpx;
color: #333333;
margin-bottom:16rpx;
margin-bottom: 16rpx;
}
&:deep(.prog){
&:deep(.prog) {
font-weight: 400;
font-size: 28rpx;
color: #4D4D4D;
margin-bottom:16rpx;
color: #4d4d4d;
margin-bottom: 16rpx;
line-height: 1.6;
}
}
.pay-container{
width:100%;
height:138rpx;
border-top:1px solid rgba(0,0,0,0.1);
.pay-container {
width: 100%;
height: 138rpx;
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.pay-btn{
.pay-btn {
width: 600rpx;
height: 88rpx;
background: #EA0000;
background: #ea0000;
border-radius: 54rpx 54rpx 54rpx 54rpx;
display: flex;
align-items: center;
justify-content: center;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
margin:25rpx auto;
color: #ffffff;
margin: 25rpx auto;
}
</style>

View File

@ -10,7 +10,7 @@
<template>
<scroll-view scroll-y class="page-wrapper">
<view class="nav-btn" @click="toOrder">我的订单</view>
<view class="nav-btn" @click="toOrder">我的订单(测试)</view>
<view class="wrapper flex flex-col flex-items-center box-border">
<view v-for="(item, key) in productList" :key="key">
<brand :products="item" :brandName="key" />
@ -40,8 +40,10 @@ const goDetail = (productData) => {
const pay = (productData) => {
const { ProductId, voucherAmount, brandFlag } = productData;
const backUrl = encodeURIComponent(getQueryString("backUrl"));
const params = {
product_id: ProductId,
backUrl: backUrl,
};
goPay({ params })
.then((res) => {
@ -64,6 +66,12 @@ const toOrder = () => {
});
};
// function utf8ToBase64(str) {
// return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => {
// return String.fromCharCode('0x' + p1);
// }));
// }
onMounted(async () => {
queryProducts();
console.log(
@ -71,7 +79,9 @@ onMounted(async () => {
getQueryParams(window.location.href)
);
const token = getQueryString("token");
const backUrl = getQueryString("backUrl");
uni.setStorageSync("token", token);
uni.setStorageSync("backUrl", encodeURIComponent(backUrl));
});
function handleData(arg, args) {

View File

@ -59,7 +59,7 @@ import {
} from "../../api/ycnc";
import { onMounted, ref, unref, reactive, computed } from "vue";
import { tabs } from "./config";
import { deepClone } from "../../utils/utils";
import { deepClone, getQueryString } from "../../utils/utils";
const message = useMessage();
const pageSize = 10;
const activeName = ref(0);
@ -71,9 +71,14 @@ const replace = ref(false);
//
const queryOrderList = () => {
const activeTab = unref(activeName);
const tempBackUrl = getQueryString("backUrl");
const backUrl = tempBackUrl
? encodeURIComponent(tempBackUrl)
: uni.getStorageSync("backUrl");
const params = {
page: unref(page),
pageSize: pageSize,
backUrl: backUrl,
...(activeTab !== 0 && { state: activeTab }),
};
getOrderList({ params })
@ -176,6 +181,12 @@ function refund(orderData) {
}
onMounted(() => {
const token = getQueryString("token") || uni.getStorageSync("token");
const _tempBackUrl = getQueryString("backUrl");
uni.setStorageSync("token", token);
if (_tempBackUrl) {
uni.setStorageSync("backUrl", encodeURIComponent(_tempBackUrl));
}
queryOrderList();
});

View File

@ -191,14 +191,13 @@ async function pay(orderData) {
window.location.replace(pay_url);
}
onMounted(() => {
// getDetail()
});
const getDetail = () => {
const tempBackUrl = getQueryString('backUrl')
const backUrl = tempBackUrl ? encodeURIComponent(tempBackUrl) : uni.getStorageSync('backUrl')
const params = {
order_id: unref(id),
order_no: unref(orderNo),
backUrl:backUrl,
};
pageType.value = 1;
queryOrderDetail({ params }).then((res) => {

View File

@ -1,9 +1,31 @@
//获取url后面拼接的参数
export const getQueryString = (name) => {
let urlStr = window.location.href.split('?')[1]
const urlSearchParams = new URLSearchParams(urlStr)
const result = Object.fromEntries(urlSearchParams.entries())
return name ? result[name] : result
export const getQueryString = (paramName) => {
// let urlStr = window.location.href.split('?')[1]
// const urlSearchParams = new URLSearchParams(urlStr)
// const result = Object.fromEntries(urlSearchParams.entries())
// return paramName ? result[paramName] : result
// 如果未传入 URL则使用当前页面的 URL
const targetUrl = window.location.href;
// 解析 URL 中的查询字符串部分
const queryString = targetUrl.split('?')[1];
// 如果没有查询字符串,直接返回空对象或 null
if (!queryString) return paramName ? null : {};
// 处理查询字符串中的每个参数
const params = queryString.split('&').reduce((acc, pair) => {
const [key, value] = pair.split('=').map(decodeURIComponent);
if (acc[key] !== undefined) {
acc[key] = Array.isArray(acc[key]) ? [...acc[key], value] : [acc[key], value];
} else {
acc[key] = value;
}
return acc;
}, {});
// 如果指定了参数名,则返回对应值,否则返回整个参数对象
return paramName ? params[paramName] || null : params;
}
//是否iOS设备