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