shenwu před 6 měsíci
rodič
revize
5eabf64f61

+ 0 - 1
src/components/pay/IosShowPay/index.tsx

@@ -1,5 +1,4 @@
 function IosShowPay(props) {
-    console.log("IosShowPay",app?.iosShowPay)
     return <>
         {app?.iosShowPay ? props.children : null}
     </>

+ 4 - 4
src/pages/book/BookArticle/index.tsx

@@ -346,10 +346,10 @@ const BookArticle: React.FC<BookArticleProps> = ({ store }) => {
                     {showPay && <View className='pay_btns'>
                         <View className='text-with-lines' >剩余内容需付费解锁</View>
                         <IosShowPay>
-                            {/* 存在vip免费字段展示购买vip */}
-                            {showVip && <View className='vip_btn' onClick={(e) => { payBtn(e, "vip") }}>开通会员,本书免费读</View>}
-                            {/* 存在章节书币价格显示购买书币 */}
-                            {payBook?.payCoin && <View className='shubi_btn' onClick={(e) => {
+                            {/* 存在vip免费字段 并且配置了vip模板 展示购买vip */}
+                            {showVip && !!indexStore?.rechargeTemplate?.find(item => item.templateType === 2) && <View className='vip_btn' onClick={(e) => { payBtn(e, "vip") }}>开通会员,本书免费读</View>}
+                            {/* 存在章节书币价格 并且配置了充值模板 显示购买书币 */}
+                            {payBook?.payCoin && !!indexStore?.rechargeTemplate?.find(item => item.templateType === 1) && <View className='shubi_btn' onClick={(e) => {
                                 // 余额
                                 let coinNum = userInfoStore?.userInfo?.coinNum || 0
                                 // 余额大于等于所需书币

+ 8 - 8
src/pages/my/index.tsx

@@ -12,7 +12,7 @@ interface Props {
 }
 
 function My(props: Props) {
-    let { userInfoStore } = props.store
+    let { userInfoStore, indexStore } = props.store
     const [payType, setPayType] = useState<"shubi" | "vip">("shubi")
 
     //支付弹窗
@@ -25,7 +25,7 @@ function My(props: Props) {
     useDidHide(() => {
         ModalStore.hideModal()
     });
-    console.log("个人信息:",userInfoStore)
+    console.log("个人信息:", userInfoStore)
     return <View className='my'>
         <View className="userInfo">
             {/* <Image src={require('../../icon/myBack.png')} /> */}
@@ -69,8 +69,8 @@ function My(props: Props) {
                 </View>
                 {/* 付费功能 */}
                 <IosShowPay>
-                    {/* vip续费 */}
-                    <View className="bottom">
+                    {/* vip续费  模板存在才显示*/}
+                    {!!indexStore?.rechargeTemplate?.find(item => item.templateType === 2) && <View className="bottom">
                         <View>
                             <View className="left">
                                 <Image lazy-load src={require('../../icon/VIP.png')} />
@@ -86,9 +86,9 @@ function My(props: Props) {
                             }}>{userInfoStore.isVip ? '立即续费' : '立即开通'}</View>
                         </View>
                         <Image lazy-load src={require('../../icon/vipBack.png')} />
-                    </View>
-                    {/*我的账户  */}
-                    <View className='account_info'>
+                    </View>}
+                    {/*我的账户  模板存在才显示*/}
+                    {!!indexStore?.rechargeTemplate?.find(item => item.templateType === 1) && <View className='account_info'>
                         <View className='account_info_title'>我的账户</View>
                         <View className='account_info_content'>
                             <View className='account_info_content_left'>
@@ -105,7 +105,7 @@ function My(props: Props) {
                                 payBtn(e, "shubi")
                             }}>充值</View>
                         </View>
-                    </View>
+                    </View>}
                     {/* 支付弹窗 */}
                     <GlobalModal type={payType} isBook={false} />
                 </IosShowPay>

+ 1 - 1
src/server/index/index.ts

@@ -99,7 +99,7 @@ export function getShortHotBooks(workDirection) {
     })
 }
 /**
- * 获取短篇首页热门书籍列表
+ * 获取充值模板配置
  * */
 export function getRechargeTemplate() {
     return new Promise(async (resolve, reject) => {

+ 2 - 0
src/server/wx/pay.ts

@@ -1,5 +1,6 @@
 import Taro from "@tarojs/taro";
 import { getUserInfo } from "./login";
+import { getRechargeTemplate } from "../index/index";
 type PublicData = {
     bookId: number,//小说ID
     bookParagraphId: number,//章节ID
@@ -69,6 +70,7 @@ export function templateBuy(data: Data, callbackFn?: (b:boolean) => void) {
                     let r = await whcatPay(res.data?.data?.wechatMchPayInfo)
                     console.log("支付操作完成!!", r)
                     getUserInfo()//刷新个人信息
+                    getRechargeTemplate()//刷新模板
                     callbackFn?.(true)
                     resolve(r)
                 },