Merge pull request 'anln' (#91) from anln into main
Reviewed-on: https://git.wishpal.cn/wishpal_ironfan/tiefen_space_web/pulls/91
This commit is contained in:
commit
600fa3434d
|
@ -33,3 +33,5 @@ yarn-error.log*
|
||||||
# typescript
|
# typescript
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
next-env.d.ts
|
next-env.d.ts
|
||||||
|
|
||||||
|
package-lock.json
|
|
@ -1,14 +1,25 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect, useCallback } from "react";
|
||||||
import { Toast } from "antd-mobile";
|
import { Toast } from "antd-mobile";
|
||||||
import { generateSignature } from "@/utils/crypto";
|
import { generateSignature } from "@/utils/crypto";
|
||||||
import webviewBaseRequest from "@/utils/webviewBaseRequest";
|
import webviewBaseRequest from "@/utils/webviewBaseRequest";
|
||||||
|
import { useSearchParams } from "next/navigation";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
export default function BillDetail({ params }) {
|
export default function BillDetail({ params }) {
|
||||||
const [data, setData] = useState([]);
|
const [data, setData] = useState([]);
|
||||||
const [isFetching, setIsFetching] = useState(true);
|
const [isFetching, setIsFetching] = useState(true);
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
const getBase = useCallback((webviewBase)=>{
|
||||||
|
let searchParamsObj=null;
|
||||||
|
let currentBaseCode = searchParams.get("base")
|
||||||
|
if(currentBaseCode){
|
||||||
|
let currentBase = JSON.parse(currentBaseCode);
|
||||||
|
searchParamsObj={...currentBase};
|
||||||
|
}
|
||||||
|
return searchParamsObj || webviewBase;
|
||||||
|
},[searchParams]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
let type;
|
let type;
|
||||||
|
@ -29,7 +40,8 @@ export default function BillDetail({ params }) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const base = webviewBaseRequest();
|
const webviewBase = webviewBaseRequest();
|
||||||
|
const base = getBase(webviewBase);
|
||||||
const signature = generateSignature({
|
const signature = generateSignature({
|
||||||
type: type,
|
type: type,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
|
@ -97,7 +109,10 @@ export default function BillDetail({ params }) {
|
||||||
return (
|
return (
|
||||||
<section className="flex flex-1 flex-col">
|
<section className="flex flex-1 flex-col">
|
||||||
{params.type == "income" && (
|
{params.type == "income" && (
|
||||||
<Link className="flex flex-col mt-4 btn bg-[#FF61B030] items-center text-base font-medium" href={"income/income_querry"}>
|
<Link
|
||||||
|
className="flex flex-col mt-4 btn bg-[#FF61B030] items-center text-base font-medium"
|
||||||
|
href={"income/income_querry"}
|
||||||
|
>
|
||||||
<p className="text-primary">查看近一周收益情况</p>
|
<p className="text-primary">查看近一周收益情况</p>
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect,useCallback } from "react";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
import { Toast } from "antd-mobile";
|
import { Toast } from "antd-mobile";
|
||||||
import { generateSignature } from "@/utils/crypto";
|
import { generateSignature } from "@/utils/crypto";
|
||||||
import webviewBaseRequest from "@/utils/webviewBaseRequest";
|
import webviewBaseRequest from "@/utils/webviewBaseRequest";
|
||||||
|
@ -9,9 +9,16 @@ import Link from "next/link";
|
||||||
|
|
||||||
export default function Pay() {
|
export default function Pay() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
//是否显示被隐藏的支付方式
|
const alipayBlock = () => {
|
||||||
const [isPaymentHided, setIsPaymentHided] = useState(true);
|
if (base?.b_mid === 161) {
|
||||||
|
createOrder("alipay_h5");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Toast.show({
|
||||||
|
content: "支付渠道维护升级中,请24小时后再试",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
//商品列表
|
//商品列表
|
||||||
const [productList, setProductList] = useState([]);
|
const [productList, setProductList] = useState([]);
|
||||||
|
@ -37,9 +44,19 @@ export default function Pay() {
|
||||||
|
|
||||||
//获取当前充值档位
|
//获取当前充值档位
|
||||||
const [isFetching, setIsFetching] = useState(true);
|
const [isFetching, setIsFetching] = useState(true);
|
||||||
|
const getBase = useCallback((webviewBase)=>{
|
||||||
|
let searchParamsObj=null;
|
||||||
|
let currentBaseCode = searchParams.get("base")
|
||||||
|
if(currentBaseCode){
|
||||||
|
let currentBase = JSON.parse(currentBaseCode);
|
||||||
|
searchParamsObj={...currentBase};
|
||||||
|
}
|
||||||
|
return searchParamsObj || webviewBase;
|
||||||
|
},[searchParams]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
const base = webviewBaseRequest();
|
const webviewBase = webviewBaseRequest();
|
||||||
|
const base = getBase(webviewBase);
|
||||||
const body = { ...base };
|
const body = { ...base };
|
||||||
const signature = generateSignature(body);
|
const signature = generateSignature(body);
|
||||||
try {
|
try {
|
||||||
|
@ -84,15 +101,16 @@ export default function Pay() {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const webviewBase = webviewBaseRequest();
|
||||||
const base = webviewBaseRequest();
|
const base = getBase(webviewBase);
|
||||||
|
|
||||||
const body = {
|
const body = {
|
||||||
...base,
|
...base,
|
||||||
product_id: customCoin.selected ? "h5_custom_coin" : selectedPrice.id,
|
product_id: customCoin.selected ? "h5_custom_coin" : selectedPrice.id,
|
||||||
custom_coins: customCoin.selected ? customCoin.num : 0,
|
custom_coins: customCoin.selected ? customCoin.num : 0,
|
||||||
pay_type: type,
|
pay_type: type,
|
||||||
redirect_url: type === "yeepay_wxpay_h5" ? window.location.href : "",
|
redirect_url: type === "yeepay_wxpay_h5" ? window.location.href : "",
|
||||||
from: "app",
|
from: searchParams.get("base")?"web":"app",
|
||||||
};
|
};
|
||||||
|
|
||||||
//如果是微信jsapi支付直接跳转到中间页
|
//如果是微信jsapi支付直接跳转到中间页
|
||||||
|
|
|
@ -1,25 +1,42 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect, useCallback } from "react";
|
||||||
import { generateSignature } from "@/utils/crypto";
|
import { generateSignature } from "@/utils/crypto";
|
||||||
import webviewBaseRequest from "@/utils/webviewBaseRequest";
|
import webviewBaseRequest from "@/utils/webviewBaseRequest";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { Toast } from "antd-mobile";
|
import { Toast } from "antd-mobile";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
|
|
||||||
export default function Vip() {
|
export default function Vip() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
//是否显示被隐藏的支付方式
|
const alipayBlock = () => {
|
||||||
const [isPaymentHided, setIsPaymentHided] = useState(true);
|
if (base?.b_mid === 161) {
|
||||||
|
createOrder("alipay_h5");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Toast.show({
|
||||||
|
content: "支付渠道维护升级中,请24小时后再试",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
//检查用户是否是vip
|
//检查用户是否是vip
|
||||||
const [isVip, setIsVip] = useState(false);
|
const [isVip, setIsVip] = useState(false);
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [isFetching, setIsFetching] = useState(true);
|
const [isFetching, setIsFetching] = useState(true);
|
||||||
|
|
||||||
|
const getBase = useCallback((webviewBase)=>{
|
||||||
|
let searchParamsObj=null;
|
||||||
|
let currentBaseCode = searchParams.get("base")
|
||||||
|
if(currentBaseCode){
|
||||||
|
let currentBase = JSON.parse(currentBaseCode);
|
||||||
|
searchParamsObj={...currentBase};
|
||||||
|
}
|
||||||
|
return searchParamsObj || webviewBase;
|
||||||
|
},[searchParams]);
|
||||||
const getUserData = async () => {
|
const getUserData = async () => {
|
||||||
|
const webviewBase = webviewBaseRequest();
|
||||||
|
let base = getBase(webviewBase)
|
||||||
try {
|
try {
|
||||||
const base = webviewBaseRequest();
|
|
||||||
const signature = generateSignature({
|
const signature = generateSignature({
|
||||||
...base,
|
...base,
|
||||||
mid: base.b_mid,
|
mid: base.b_mid,
|
||||||
|
@ -56,9 +73,9 @@ export default function Vip() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getUserData();
|
getUserData();
|
||||||
}, 500);
|
}, 500);
|
||||||
const intervalId = setInterval(() => {
|
// const intervalId = setInterval(() => {
|
||||||
getUserData();
|
// getUserData();
|
||||||
}, 2000);
|
// }, 2000);
|
||||||
return () => clearInterval(intervalId);
|
return () => clearInterval(intervalId);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
@ -77,7 +94,7 @@ export default function Vip() {
|
||||||
product_id: "membership",
|
product_id: "membership",
|
||||||
pay_type: type,
|
pay_type: type,
|
||||||
redirect_url: type === "yeepay_wxpay_h5" ? window.location.href : "",
|
redirect_url: type === "yeepay_wxpay_h5" ? window.location.href : "",
|
||||||
from: "app",
|
from: searchParams.get("base")?"web":"app",
|
||||||
};
|
};
|
||||||
|
|
||||||
//如果是微信jsapi支付直接跳转到中间页
|
//如果是微信jsapi支付直接跳转到中间页
|
||||||
|
|
|
@ -1,35 +1,46 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect, useCallback } from "react";
|
||||||
import Divider from "@/components/Divider";
|
import Divider from "@/components/Divider";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { Toast, Switch } from "antd-mobile";
|
import { Toast, Switch } from "antd-mobile";
|
||||||
import { generateSignature } from "@/utils/crypto";
|
import { generateSignature } from "@/utils/crypto";
|
||||||
import webviewBaseRequest from "@/utils/webviewBaseRequest";
|
import webviewBaseRequest from "@/utils/webviewBaseRequest";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
|
|
||||||
export default function Pay({ params }) {
|
export default function Pay({ params }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
//是否显示被隐藏的支付方式
|
|
||||||
const [isPaymentHided, setIsPaymentHided] = useState(true);
|
|
||||||
|
|
||||||
//当前选购的商品数据
|
//当前选购的商品数据
|
||||||
const [data, setData] = useState({});
|
const [data, setData] = useState({});
|
||||||
//超粉商品数据
|
//超粉商品数据
|
||||||
const [superfanshipData, setSuperfanshipData] = useState();
|
const [superfanshipData, setSuperfanshipData] = useState();
|
||||||
const [isFetching, setIsFetching] = useState(true);
|
const [isFetching, setIsFetching] = useState(true);
|
||||||
|
const getBase = useCallback(
|
||||||
|
(webviewBase) => {
|
||||||
|
let searchParamsObj = null;
|
||||||
|
let currentBaseCode = searchParams.get("base");
|
||||||
|
// console.log("currentBaseCode", currentBaseCode);
|
||||||
|
if (currentBaseCode) {
|
||||||
|
let currentBase = JSON.parse(currentBaseCode);
|
||||||
|
searchParamsObj = { ...currentBase };
|
||||||
|
}
|
||||||
|
return searchParamsObj || webviewBase;
|
||||||
|
},
|
||||||
|
[searchParams]
|
||||||
|
);
|
||||||
//获取当前选购的商品数据
|
//获取当前选购的商品数据
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
try {
|
try {
|
||||||
const base = webviewBaseRequest();
|
const webviewBase = webviewBaseRequest();
|
||||||
|
const base = getBase(webviewBase);
|
||||||
const body = {
|
const body = {
|
||||||
zid: parseInt(params.zid),
|
zid: parseInt(params.zid),
|
||||||
moment_id: parseInt(params.moment_id),
|
moment_id: parseInt(params.moment_id),
|
||||||
product_id: params.product_id,
|
product_id: params.product_id,
|
||||||
...base,
|
...base,
|
||||||
};
|
};
|
||||||
|
// console.log("body1", body);
|
||||||
const signature = generateSignature(body);
|
const signature = generateSignature(body);
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`/api/zone/get_cashier?signature=${signature}`,
|
`/api/zone/get_cashier?signature=${signature}`,
|
||||||
|
@ -58,12 +69,14 @@ export default function Pay({ params }) {
|
||||||
//获取超粉商品数据
|
//获取超粉商品数据
|
||||||
const getSuperfanshipData = async () => {
|
const getSuperfanshipData = async () => {
|
||||||
try {
|
try {
|
||||||
const base = webviewBaseRequest();
|
const webviewBase = webviewBaseRequest();
|
||||||
|
const base = getBase(webviewBase);
|
||||||
const body = {
|
const body = {
|
||||||
zid: parseInt(params.zid),
|
zid: parseInt(params.zid),
|
||||||
product_id: "h5_zone_superfanship",
|
product_id: "h5_zone_superfanship",
|
||||||
...base,
|
...base,
|
||||||
};
|
};
|
||||||
|
// console.log("body2", body);
|
||||||
const signature = generateSignature(body);
|
const signature = generateSignature(body);
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`/api/zone/get_cashier?signature=${signature}`,
|
`/api/zone/get_cashier?signature=${signature}`,
|
||||||
|
@ -89,11 +102,11 @@ export default function Pay({ params }) {
|
||||||
getData();
|
getData();
|
||||||
getSuperfanshipData();
|
getSuperfanshipData();
|
||||||
}, 500);
|
}, 500);
|
||||||
const intervalId = setInterval(() => {
|
// const intervalId = setInterval(() => {
|
||||||
getData();
|
// getData();
|
||||||
getSuperfanshipData();
|
// getSuperfanshipData();
|
||||||
}, 2000);
|
// }, 2000);
|
||||||
return () => clearInterval(intervalId);
|
// return () => clearInterval(intervalId);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
//是否勾选购买超粉switch组件
|
//是否勾选购买超粉switch组件
|
||||||
|
@ -104,7 +117,8 @@ export default function Pay({ params }) {
|
||||||
//创建订单
|
//创建订单
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const createOrder = async (type = "alipay_h5") => {
|
const createOrder = async (type = "alipay_h5") => {
|
||||||
const base = webviewBaseRequest();
|
const webviewBase = webviewBaseRequest();
|
||||||
|
const base = getBase(webviewBase);
|
||||||
const body = {
|
const body = {
|
||||||
...base,
|
...base,
|
||||||
zid: parseInt(params.zid),
|
zid: parseInt(params.zid),
|
||||||
|
@ -112,9 +126,9 @@ export default function Pay({ params }) {
|
||||||
product_id: checked ? "h5_zone_superfanship" : params.product_id,
|
product_id: checked ? "h5_zone_superfanship" : params.product_id,
|
||||||
pay_type: type,
|
pay_type: type,
|
||||||
redirect_url: type === "yeepay_wxpay_h5" ? window.location.href : "",
|
redirect_url: type === "yeepay_wxpay_h5" ? window.location.href : "",
|
||||||
from: "app",
|
from: searchParams.get("base") ? "web" : "app",
|
||||||
};
|
};
|
||||||
|
// console.log("body", body);
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const signature = generateSignature(body);
|
const signature = generateSignature(body);
|
||||||
|
|
Loading…
Reference in New Issue