diff --git a/.env.production b/.env.production
index 9045317..70681f8 100644
--- a/.env.production
+++ b/.env.production
@@ -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'
# 邮储音视频活动(生产环境)
diff --git a/src/pages/ycnc/detail.vue b/src/pages/ycnc/detail.vue
index 94cf036..c651af9 100644
--- a/src/pages/ycnc/detail.vue
+++ b/src/pages/ycnc/detail.vue
@@ -1,185 +1,188 @@
- {
- style: {
- navigationStyle: 'custom',
- navigationBarTitleText: '商品详情',
- navigationBarBackgroundColor:'#FFF',
- },
- }
+{
+ style: {
+ navigationStyle: "custom",
+ navigationBarTitleText: "商品详情",
+ navigationBarBackgroundColor: "#FFF",
+ },
+}
-
-
-
-
-
- {{ detailObj.name }}
-
- ¥{{ detailObj.price }}
- {{ detailObj.show_price }}
-
-
-
-
-
-
-
-
-
-
- 立即支付
-
-
+
+
+
+ 立即支付
+
-
\ No newline at end of file
+.pay-container {
+ width: 100%;
+ height: 138rpx;
+ border-top: 1px solid rgba(0, 0, 0, 0.1);
+}
+.pay-btn {
+ width: 600rpx;
+ height: 88rpx;
+ 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;
+}
+
diff --git a/src/pages/ycnc/index.vue b/src/pages/ycnc/index.vue
index 845ee6f..448d3ad 100644
--- a/src/pages/ycnc/index.vue
+++ b/src/pages/ycnc/index.vue
@@ -10,7 +10,7 @@
- 我的订单
+ 我的订单(测试)
@@ -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) {
diff --git a/src/pages/ycnc/order.vue b/src/pages/ycnc/order.vue
index 8e2c96d..32d276a 100644
--- a/src/pages/ycnc/order.vue
+++ b/src/pages/ycnc/order.vue
@@ -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();
});
diff --git a/src/pages/ycnc/orderDetail.vue b/src/pages/ycnc/orderDetail.vue
index 8e39dc7..357611c 100644
--- a/src/pages/ycnc/orderDetail.vue
+++ b/src/pages/ycnc/orderDetail.vue
@@ -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) => {
diff --git a/src/utils/utils.js b/src/utils/utils.js
index b4c69a6..e8fcbe7 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -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设备