|
@@ -10,12 +10,13 @@
|
|
|
@clickItem="onChangeTab" class="ezy-tab-box" />
|
|
|
<view>
|
|
|
<view v-if="dingdanData.current === 0">
|
|
|
- <scroll-view scroll-y="true" refresher-enabled="true"
|
|
|
+ <scroll-view scroll-y="true" refresher-enabled="true" @scrolltolower="onScrolltolower"
|
|
|
:refresher-triggered="dingdanData.quanbu.loading" :refresher-threshold="50"
|
|
|
refresher-background="transparent" @refresherrefresh="onRefresh" class="order-scroll-view">
|
|
|
<!--数学-->
|
|
|
<uni-list>
|
|
|
- <uni-list-item v-for="item in dingdanData.quanbu.list" class="order-list-item">
|
|
|
+ <uni-list-item v-for="(item,index) in dingdanData.quanbu.list" :key="index"
|
|
|
+ class="order-list-item">
|
|
|
<template v-slot:body>
|
|
|
<view class="order-item-head">
|
|
|
<view class="order-name-box">
|
|
@@ -28,35 +29,52 @@
|
|
|
<text v-if="item.status ==1" class="pay-status">待付款</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="order-content-box">
|
|
|
+ <view class="order-content-box" v-for="(item2,index2) in item.cardList"
|
|
|
+ :key="index2">
|
|
|
<!-- 需要改成从接口获取的 wgy-->
|
|
|
- <img class="content-img" src="https://ezy-app.oss-cn-beijing.aliyuncs.com/test/resource/uploadFile02dcefaa15894a99afa5cb95a1f02e89.png">
|
|
|
+ <img class="content-img" :src="item2.cover">
|
|
|
<view class="content-body-box">
|
|
|
- <view class="content-name">数学暑假进阶L1</view>
|
|
|
- <view class="content-text">适用于L1和学前,介绍介绍,适用于L1和学前,介绍介绍适用于L1和学前,介绍介绍</view>
|
|
|
+ <view class="content-name">{{item2.cardName}}</view>
|
|
|
+ <view class="content-text">{{item2.intro}}</view>
|
|
|
<!-- 未付款数据对一下 是否有课程包明细 wgy-->
|
|
|
- <view class="content-money-box" v-if="item.status ==1">
|
|
|
- <view class="order-kcb-btn" @click="detailBtn">课程包明细<icon></icon></view>
|
|
|
- <text class="content-yuanjia">¥{{item.money}}</text>
|
|
|
- </view>
|
|
|
- <!-- 已付款数据对一下 是否有课程包明细 wgy-->
|
|
|
- <view class="content-money-box" v-if="item.status ==2">
|
|
|
- <view class="order-kcb-btn" @click="detailBtn">课程包明细<icon></icon></view>
|
|
|
- <text class="content-yuanjia">¥{{item.money}}</text>
|
|
|
+ <view class="content-money-box">
|
|
|
+ <view class="order-kcb-btn" v-if="item.cardList.length>0"
|
|
|
+ @click="detailBtn">课程包明细<icon></icon>
|
|
|
+ </view>
|
|
|
+ <text class="content-yuanjia">¥{{item2.xianjia}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="content-heji">合计:¥0.03</view>
|
|
|
- <!-- 未付款显示付款按钮 wgy-->
|
|
|
- <view class="order-bottom-box">
|
|
|
- <!-- 微信 -->
|
|
|
- <view class="pay-status-box" v-if="showPayWay" @click="switchPayWay"><icon class="wx-icon"></icon>微信</view>
|
|
|
- <!-- 支付宝 -->
|
|
|
- <view class="pay-status-box" v-if="!showPayWay" @click="switchPayWay"><icon class="zfb-icon"></icon>支付宝</view>
|
|
|
- <!-- 苹果 -->
|
|
|
- <view class="pay-status-box apple-status-box" v-if="false"><icon class="apple-icon"></icon>apple</view>
|
|
|
- <view class="pay-btn" @click="handlePay(item)">立即支付</view>
|
|
|
+ <view class="content-heji">合计:¥{{item.money}}</view>
|
|
|
+ <view v-if="item.status !=2" class="footer-mall-pay-box">
|
|
|
+ <view class="pay-status-box"
|
|
|
+ v-if="payType =='weixin'&¤tPlatform =='android'"
|
|
|
+ @click="switchPayWay">
|
|
|
+ <icon class="wx-icon"></icon>微信
|
|
|
+ </view>
|
|
|
+ <view class="pay-status-box"
|
|
|
+ v-if="payType =='zhifubao'&¤tPlatform =='android'"
|
|
|
+ @click="switchPayWay">
|
|
|
+ <icon class="zfb-icon"></icon>支付宝
|
|
|
+ </view>
|
|
|
+ <view class="pay-status-box apple-status-box" v-if="currentPlatform =='ios'">
|
|
|
+ <icon class="apple-icon"></icon>apple
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view v-if="currentPlatform =='android'" class="open-svip-btn"
|
|
|
+ @touchstart="creatOrder(item.cardList,index)">立即支付
|
|
|
+ </view>
|
|
|
+ <view v-if="currentPlatform =='ios'" style="margin-top: 20rpx;"
|
|
|
+ class="open-svip-btn" @touchstart="creatOrderIos(item.cardList,index)">立即支付
|
|
|
+ </view>
|
|
|
</view>
|
|
|
+ <!-- 未付款显示付款按钮 wgy-->
|
|
|
+ <!-- <payComponents ref="payComponentsRef">
|
|
|
+ <view v-if="currentPlatform =='android'" class="open-svip-btn" @touchstart="creatOrder(item,index)">立即支付
|
|
|
+ </view>
|
|
|
+ <view v-if="currentPlatform =='ios'" style="margin-top: 20rpx;" class="open-svip-btn"
|
|
|
+ @touchstart="creatOrderIos(item,index)">立即支付</view>
|
|
|
+ </payComponents> -->
|
|
|
</template>
|
|
|
</uni-list-item>
|
|
|
<uni-load-more :status="dingdanData.quanbu.state" @click="getMore(0)"
|
|
@@ -66,94 +84,156 @@
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
<view v-if="dingdanData.current === 1">
|
|
|
- <scroll-view scroll-y="true" refresher-enabled="true"
|
|
|
- :refresher-triggered="dingdanData.daiFukuan.loading" :refresher-threshold="50" class="order-scroll-view"
|
|
|
- refresher-background="transparent" @refresherrefresh="onRefresh">
|
|
|
- <uni-list>
|
|
|
- <uni-list-item v-for="item in dingdanData.daiFukuan.list" class="order-list-item">
|
|
|
- <template v-slot:body>
|
|
|
- <view class="order-item-head">
|
|
|
- <view class="order-name-box">
|
|
|
- <icon></icon><text>鹅状元自营</text>
|
|
|
- </view>
|
|
|
- <view>
|
|
|
- <text>不支持退订</text>
|
|
|
+ <scroll-view scroll-y="true" refresher-enabled="true" @scrolltolower="onScrolltolower"
|
|
|
+ :refresher-triggered="dingdanData.daiFukuan.loading" :refresher-threshold="50"
|
|
|
+ refresher-background="transparent" @refresherrefresh="onRefresh" class="order-scroll-view">
|
|
|
+ <!--数学-->
|
|
|
+ <uni-list>
|
|
|
+ <uni-list-item v-for="(item,index) in dingdanData.daiFukuan.list" :key="index"
|
|
|
+ class="order-list-item">
|
|
|
+ <template v-slot:body>
|
|
|
+ <view class="order-item-head">
|
|
|
+ <view class="order-name-box">
|
|
|
+ <icon></icon><text>鹅状元自营</text>
|
|
|
+ </view>
|
|
|
+ <view>
|
|
|
+ <text>不支持退订</text>
|
|
|
<text v-if="item.status ==2" class="pay-status">已付款</text>
|
|
|
<text v-if="item.status ==3" class="pay-status">已关闭</text>
|
|
|
<text v-if="item.status ==1" class="pay-status">待付款</text>
|
|
|
- </view>
|
|
|
</view>
|
|
|
- <view class="order-content-box">
|
|
|
- <!-- 需要改成从接口获取的 -->
|
|
|
- <img class="content-img" src="https://ezy-app.oss-cn-beijing.aliyuncs.com/test/resource/uploadFile02dcefaa15894a99afa5cb95a1f02e89.png">
|
|
|
- <view class="content-body-box">
|
|
|
- <view class="content-name">数学暑假进阶L1</view>
|
|
|
- <view class="content-text">适用于L1和学前,介绍介绍,适用于L1和学前,介绍介绍适用于L1和学前,介绍介绍</view>
|
|
|
- <view class="content-money-box">
|
|
|
- <view class="order-kcb-btn">课程包明细<icon></icon></view>
|
|
|
- <text class="content-yuanjia">¥{{item.money}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="order-content-box" v-for="(item2,index2) in item.cardList"
|
|
|
+ :key="index2">
|
|
|
+ <!-- 需要改成从接口获取的 wgy-->
|
|
|
+ <img class="content-img" :src="item2.cover">
|
|
|
+ <view class="content-body-box">
|
|
|
+ <view class="content-name">{{item2.cardName}}</view>
|
|
|
+ <view class="content-text">{{item2.intro}}</view>
|
|
|
+ <!-- 未付款数据对一下 是否有课程包明细 wgy-->
|
|
|
+ <view class="content-money-box">
|
|
|
+ <view class="order-kcb-btn" v-if="item.cardList.length>0"
|
|
|
+ @click="detailBtn">课程包明细<icon></icon>
|
|
|
</view>
|
|
|
+ <text class="content-yuanjia">¥{{item2.xianjia}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="order-bottom-box" v-if="item.status ==1">
|
|
|
- <!-- 微信 -->
|
|
|
- <view class="pay-status-box" v-if="showPayWay" @click="switchPayWay"><icon class="wx-icon"></icon>微信</view>
|
|
|
- <!-- 支付宝 -->
|
|
|
- <view class="pay-status-box" v-if="!showPayWay" @click="switchPayWay"><icon class="zfb-icon"></icon>支付宝</view>
|
|
|
- <!-- 苹果 -->
|
|
|
- <view class="pay-status-box apple-status-box" v-if="false"><icon class="apple-icon"></icon>apple</view>
|
|
|
- <view class="pay-btn" @click="handlePay(item)">立即支付</view>
|
|
|
+ </view>
|
|
|
+ <view class="content-heji">合计:¥{{item.money}}</view>
|
|
|
+ <view v-if="item.status !=2" class="footer-mall-pay-box">
|
|
|
+ <view class="pay-status-box"
|
|
|
+ v-if="payType =='weixin'&¤tPlatform =='android'"
|
|
|
+ @click="switchPayWay">
|
|
|
+ <icon class="wx-icon"></icon>微信
|
|
|
+ </view>
|
|
|
+ <view class="pay-status-box"
|
|
|
+ v-if="payType =='zhifubao'&¤tPlatform =='android'"
|
|
|
+ @click="switchPayWay">
|
|
|
+ <icon class="zfb-icon"></icon>支付宝
|
|
|
+ </view>
|
|
|
+ <view class="pay-status-box apple-status-box" v-if="currentPlatform =='ios'">
|
|
|
+ <icon class="apple-icon"></icon>apple
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view v-if="currentPlatform =='android'" class="open-svip-btn"
|
|
|
+ @touchstart="creatOrder(item.cardList,index)">立即支付
|
|
|
+ </view>
|
|
|
+ <view v-if="currentPlatform =='ios'" style="margin-top: 20rpx;"
|
|
|
+ class="open-svip-btn" @touchstart="creatOrderIos(item.cardList,index)">立即支付
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <!-- 未付款显示付款按钮 wgy-->
|
|
|
+ <!-- <payComponents ref="payComponentsRef">
|
|
|
+ <view v-if="currentPlatform =='android'" class="open-svip-btn" @touchstart="creatOrder(item,index)">立即支付
|
|
|
</view>
|
|
|
- </template>
|
|
|
- </uni-list-item>
|
|
|
- <uni-load-more :status="dingdanData.daiFukuan.state" @click="getMore(1)"
|
|
|
- :contentText="dingdanData.daiFukuan.contentText">
|
|
|
- </uni-load-more>
|
|
|
- </uni-list>
|
|
|
+ <view v-if="currentPlatform =='ios'" style="margin-top: 20rpx;" class="open-svip-btn"
|
|
|
+ @touchstart="creatOrderIos(item,index)">立即支付</view>
|
|
|
+ </payComponents> -->
|
|
|
+ </template>
|
|
|
+ </uni-list-item>
|
|
|
+ <uni-load-more :status="dingdanData.daiFukuan.state" @click="getMore(0)"
|
|
|
+ :contentText="dingdanData.daiFukuan.contentText">
|
|
|
+ </uni-load-more>
|
|
|
+ </uni-list>
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
<view v-if="dingdanData.current === 2">
|
|
|
- <scroll-view scroll-y="true" refresher-enabled="true"
|
|
|
- :refresher-triggered="dingdanData.yiFukuan.loading" :refresher-threshold="50" class="order-scroll-view"
|
|
|
- refresher-background="transparent" @refresherrefresh="onRefresh">
|
|
|
- <uni-list>
|
|
|
- <uni-list-item v-for="item in dingdanData.yiFukuan.list" class="order-list-item">
|
|
|
- <template v-slot:body>
|
|
|
- <view class="order-item-head">
|
|
|
- <view class="order-name-box">
|
|
|
- <icon></icon><text>鹅状元自营</text>
|
|
|
- </view>
|
|
|
- <view>
|
|
|
- <text>不支持退订</text>
|
|
|
- <text v-if="item.status ==2" class="pay-status">已付款</text>
|
|
|
- <text v-if="item.status ==3" class="pay-status">已关闭</text>
|
|
|
- <text v-if="item.status ==1" class="pay-status">待付款</text>
|
|
|
- </view>
|
|
|
+ <scroll-view scroll-y="true" refresher-enabled="true" @scrolltolower="onScrolltolower"
|
|
|
+ :refresher-triggered="dingdanData.yiFukuan.loading" :refresher-threshold="50"
|
|
|
+ refresher-background="transparent" @refresherrefresh="onRefresh" class="order-scroll-view">
|
|
|
+ <!--数学-->
|
|
|
+ <uni-list>
|
|
|
+ <uni-list-item v-for="(item,index) in dingdanData.yiFukuan.list" :key="index"
|
|
|
+ class="order-list-item">
|
|
|
+ <template v-slot:body>
|
|
|
+ <view class="order-item-head">
|
|
|
+ <view class="order-name-box">
|
|
|
+ <icon></icon><text>鹅状元自营</text>
|
|
|
+ </view>
|
|
|
+ <view>
|
|
|
+ <text>不支持退订</text>
|
|
|
+ <text v-if="item.status ==2" class="pay-status">已付款</text>
|
|
|
+ <text v-if="item.status ==3" class="pay-status">已关闭</text>
|
|
|
+ <text v-if="item.status ==1" class="pay-status">待付款</text>
|
|
|
</view>
|
|
|
- <view class="order-content-box">
|
|
|
- <!-- 需要改成从接口获取的 -->
|
|
|
- <img class="content-img" src="https://ezy-app.oss-cn-beijing.aliyuncs.com/test/resource/uploadFile02dcefaa15894a99afa5cb95a1f02e89.png">
|
|
|
- <view class="content-body-box">
|
|
|
- <view class="content-name">数学暑假进阶L1</view>
|
|
|
- <view class="content-text">适用于L1和学前,介绍介绍,适用于L1和学前,介绍介绍适用于L1和学前,介绍介绍</view>
|
|
|
- <view class="content-money-box">
|
|
|
- <text class="content-yuanjia">¥{{item.money}}</text>
|
|
|
- <view class="order-kcb-btn">课程包明细<icon></icon></view>
|
|
|
+ </view>
|
|
|
+ <view class="order-content-box" v-for="(item2,index2) in item.cardList"
|
|
|
+ :key="index2">
|
|
|
+ <!-- 需要改成从接口获取的 wgy-->
|
|
|
+ <img class="content-img" :src="item2.cover">
|
|
|
+ <view class="content-body-box">
|
|
|
+ <view class="content-name">{{item2.cardName}}</view>
|
|
|
+ <view class="content-text">{{item2.intro}}</view>
|
|
|
+ <!-- 未付款数据对一下 是否有课程包明细 wgy-->
|
|
|
+ <view class="content-money-box">
|
|
|
+ <view class="order-kcb-btn" v-if="item.cardList.length>0"
|
|
|
+ @click="detailBtn">课程包明细<icon></icon>
|
|
|
</view>
|
|
|
+ <text class="content-yuanjia">¥{{item2.xianjia}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- </template>
|
|
|
- </uni-list-item>
|
|
|
- <uni-load-more :status="dingdanData.yiFukuan.state" @click="getMore(2)"
|
|
|
- :contentText="dingdanData.yiFukuan.contentText">
|
|
|
- </uni-load-more>
|
|
|
- </uni-list>
|
|
|
+ </view>
|
|
|
+ <view class="content-heji">合计:¥{{item.money}}</view>
|
|
|
+ <view v-if="item.status !=2" class="footer-mall-pay-box">
|
|
|
+ <view class="pay-status-box"
|
|
|
+ v-if="payType =='weixin'&¤tPlatform =='android'"
|
|
|
+ @click="switchPayWay">
|
|
|
+ <icon class="wx-icon"></icon>微信
|
|
|
+ </view>
|
|
|
+ <view class="pay-status-box"
|
|
|
+ v-if="payType =='zhifubao'&¤tPlatform =='android'"
|
|
|
+ @click="switchPayWay">
|
|
|
+ <icon class="zfb-icon"></icon>支付宝
|
|
|
+ </view>
|
|
|
+ <view class="pay-status-box apple-status-box" v-if="currentPlatform =='ios'">
|
|
|
+ <icon class="apple-icon"></icon>apple
|
|
|
+ </view>
|
|
|
|
|
|
+ <view v-if="currentPlatform =='android'" class="open-svip-btn"
|
|
|
+ @touchstart="creatOrder(item.cardList,index)">立即支付
|
|
|
+ </view>
|
|
|
+ <view v-if="currentPlatform =='ios'" style="margin-top: 20rpx;"
|
|
|
+ class="open-svip-btn" @touchstart="creatOrderIos(item.cardList,index)">立即支付
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <!-- 未付款显示付款按钮 wgy-->
|
|
|
+ <!-- <payComponents ref="payComponentsRef">
|
|
|
+ <view v-if="currentPlatform =='android'" class="open-svip-btn" @touchstart="creatOrder(item,index)">立即支付
|
|
|
+ </view>
|
|
|
+ <view v-if="currentPlatform =='ios'" style="margin-top: 20rpx;" class="open-svip-btn"
|
|
|
+ @touchstart="creatOrderIos(item,index)">立即支付</view>
|
|
|
+ </payComponents> -->
|
|
|
+ </template>
|
|
|
+ </uni-list-item>
|
|
|
+ <uni-load-more :status="dingdanData.yiFukuan.state" @click="getMore(0)"
|
|
|
+ :contentText="dingdanData.yiFukuan.contentText">
|
|
|
+ </uni-load-more>
|
|
|
+ </uni-list>
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <product-dialog ref="mallProductPopup" @payBtn="payBtn"></product-dialog>
|
|
|
+ <!-- <product-dialog ref="mallProductPopup" @payBtn="payBtn"></product-dialog> -->
|
|
|
<CustomTabBar></CustomTabBar>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -172,17 +252,30 @@
|
|
|
} from "@dcloudio/uni-app";
|
|
|
import {
|
|
|
toast,
|
|
|
+ debounce,
|
|
|
getUserIdentity
|
|
|
} from "@/utils/common";
|
|
|
import cacheManager from '@/utils/cacheManager.js';
|
|
|
import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
|
|
|
+ import payComponents from '@/components/payComponents/index.vue';
|
|
|
import productDialog from '../mall/productDialog.vue'
|
|
|
const mallProductPopup = ref(null);
|
|
|
+ const payComponentsRef = ref(null);
|
|
|
const showPayWay = ref(true)
|
|
|
- function switchPayWay(){
|
|
|
- showPayWay.value = !showPayWay.value
|
|
|
+ let currentPlatform = ref('android')
|
|
|
+ const payType = ref('weixin');
|
|
|
+ let orderId = ref('');
|
|
|
+ let productId = ref(null)
|
|
|
+ let iapChannel = ref(null)
|
|
|
+ let quantity = ref(1)
|
|
|
+ let channel = ref('')
|
|
|
+ let appleFlag = ref('')
|
|
|
+
|
|
|
+ function switchPayWay() {
|
|
|
+ payType.value = payType.value == 'weixin' ? 'zhifubao' : 'weixin'
|
|
|
}
|
|
|
- function detailBtn(){
|
|
|
+
|
|
|
+ function detailBtn() {
|
|
|
mallProductPopup.value.detailShow();
|
|
|
}
|
|
|
const dingdanData = reactive({
|
|
@@ -225,15 +318,301 @@
|
|
|
})
|
|
|
|
|
|
|
|
|
- function handlePay(item) {
|
|
|
- uni.redirectTo({
|
|
|
- url: `/pages/pay/svip?cardId=${item.cardId}&formPage=my&orderId=${item.id}`
|
|
|
+ function genggaiVip(data) {
|
|
|
+ uni.hideLoading();
|
|
|
+ const localList = cacheManager.get('auth').levelIdList || []
|
|
|
+ const mergeList = [...new Set([...localList, ...data.levelIdList])]
|
|
|
+ cacheManager.updateObject('auth', {
|
|
|
+ levelIdList: mergeList
|
|
|
})
|
|
|
- // uni.redirectTo({
|
|
|
- // url: `/pages/pay/orderPay?id=${item.id}`
|
|
|
- // })
|
|
|
+ toast("支付成功")
|
|
|
+
|
|
|
+ // if (formPage.value == 'my') {
|
|
|
+ // uni.redirectTo({
|
|
|
+ // url: '/pages/my/index'
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // uni.redirectTo({
|
|
|
+ // url: '/pages/study/index'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
+ const creatOrderIos = debounce((data, index) => {
|
|
|
+
|
|
|
+ uni.showLoading({
|
|
|
+ title: '',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ if (appleFlag.value.toString() == 'true') {
|
|
|
+ productId.value = 'llisoftEzhuangyuanceshi'
|
|
|
+ } else {
|
|
|
+ if (cardId.value == 1) {
|
|
|
+ productId.value = 'llisoftEzhuangyuan'
|
|
|
+ } else {
|
|
|
+ productId.value = 'llisoftEzhuangyuanYingyu'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ uni.hideLoading();
|
|
|
+ orderId.value = data.id
|
|
|
+ // 测试ios 1元
|
|
|
+ applePay()
|
|
|
+
|
|
|
+
|
|
|
+ }, 500)
|
|
|
+
|
|
|
+ function applePaySuccess(data) {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '开通中',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ let req = {
|
|
|
+ "id": orderId.value,
|
|
|
+ "paynum": data.transactionIdentifier,
|
|
|
+ "receipt": data.transactionReceipt
|
|
|
+ }
|
|
|
+ console.log('reqreq', req);
|
|
|
+ orderPayApple(req).then(res => {
|
|
|
+ if (res.code == 0 && res.data) {
|
|
|
+ iapChannel.finishTransaction(data.transactionIdentifier)
|
|
|
+ console.log('resiapChanneliapChanneliapChannel', res);
|
|
|
+ genggaiVip()
|
|
|
+ } else {
|
|
|
+
|
|
|
+ iapChannel.finishTransaction(data.transactionIdentifier)
|
|
|
+ uni.hideLoading();
|
|
|
+ toast("苹果内购失败")
|
|
|
+ console.log('orderPayApple失败');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function applePay() {
|
|
|
+ console.log('123123');
|
|
|
+ if (!productId.value) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '苹果内购ID缺失,请选择其它支付方式或联系客服',
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ uni.showLoading({
|
|
|
+ title: '正在支付中...'
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ plus.payment.getChannels(function(channels) { //判读项目支付通道开通情况
|
|
|
+ for (var i in channels) {
|
|
|
+ iapChannel = channels[i];
|
|
|
+ // 获取 id 为 'appleiap' 的 channel
|
|
|
+ console.info("支付通道", iapChannel)
|
|
|
+ if (iapChannel.id === 'appleiap') { //开通了app应用内支付,在manifest.josn中设置,开通后需打自定议基座
|
|
|
+ console.info("苹果支付通道", iapChannel)
|
|
|
+ // ids 数组中的项为 App Store Connect 配置的内购买项目产品ID(productId)
|
|
|
+ var ids = [productId.value];
|
|
|
+ // iap 为应用内支付对象
|
|
|
+ iapChannel.requestOrder(ids, function(e) {
|
|
|
+ // 获取订单信息成功回调方法
|
|
|
+ console.log('requestOrder success: ' + JSON.stringify(e));
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: 'appleiap',
|
|
|
+ orderInfo: {
|
|
|
+ productid: productId.value, //产品id,来自于苹果
|
|
|
+ quantity: quantity.value, //产品数量
|
|
|
+ manualFinishTransaction: true
|
|
|
+ },
|
|
|
+ success: (e) => {
|
|
|
+ uni.hideLoading();
|
|
|
+
|
|
|
+ // toast("苹果内购成功")
|
|
|
+ console.info("苹果内购成功", e)
|
|
|
+ applePaySuccess(e)
|
|
|
+ //e.payment.orderNo = that.orderNo
|
|
|
+ //支付成功回调,前端调用后台接口
|
|
|
+ },
|
|
|
+ fail: (e) => {
|
|
|
+ uni.hideLoading();
|
|
|
+ toast("苹果内购失败")
|
|
|
+ console.info("苹果内购失败", e)
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ function(e) {
|
|
|
+ // 获取订单信息失败回调方法
|
|
|
+ console.log('requestOrder failed: ' + JSON.stringify(e));
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ console.log('不支持苹果支付')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ function(e) {
|
|
|
+ console.log("获取iap支付通道失败:" + e.message);
|
|
|
+ });
|
|
|
+
|
|
|
+ } catch (e) {
|
|
|
+ uni.showModal({
|
|
|
+ title: "init",
|
|
|
+ content: e.message,
|
|
|
+ showCancel: false
|
|
|
+ });
|
|
|
+ } finally {
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ function wxPay() {
|
|
|
+ orderPayWx({
|
|
|
+ id: orderId.value
|
|
|
+ }).then(res2 => {
|
|
|
+ uni.hideLoading();
|
|
|
+ console.log('res2', res2);
|
|
|
+ uni.requestPayment({
|
|
|
+ "provider": "wxpay",
|
|
|
+ "orderInfo": {
|
|
|
+ "appid": res2.data.appid, // 应用ID(AppID)
|
|
|
+ "partnerid": res2.data.partnerId, // 商户号(PartnerID)
|
|
|
+ "prepayid": res2.data.prepayId, // 预支付交易会话ID
|
|
|
+ "package": res2.data.packageVal, // 固定值
|
|
|
+ "noncestr": res2.data.nonceStr, // 随机字符串
|
|
|
+ "timestamp": res2.data.timestamp, // 时间戳(单位:秒)
|
|
|
+ "sign": res2.data.sign // 签名,这里用的 MD5 签名
|
|
|
+ }, //此处为服务器返回的订单信息字符串
|
|
|
+ success: function(res) {
|
|
|
+
|
|
|
+ //var rawdata = JSON.parse(res.rawdata);
|
|
|
+ // console.log('res',res);
|
|
|
+ // console.log('支付成功');
|
|
|
+ // console.log('rawdata', rawdata);
|
|
|
+ uni.showLoading({
|
|
|
+ title: '开通中,请稍后...'
|
|
|
+ });
|
|
|
+ orderCheck({
|
|
|
+ id: orderId.value
|
|
|
+ }).then(res3 => {
|
|
|
+ console.log('res3', res3);
|
|
|
+ if (res3.code == 0) {
|
|
|
+
|
|
|
+ genggaiVip(res3.data)
|
|
|
+ } else {
|
|
|
+ setTimeout(() => {
|
|
|
+ orderCheck({
|
|
|
+ id: orderId.value
|
|
|
+ }).then(res4 => {
|
|
|
+ if (res4.code == 0) {
|
|
|
+ genggaiVip(res4.data)
|
|
|
+ } else {
|
|
|
+ toast(
|
|
|
+ "开通失败,请联系管理员!"
|
|
|
+ )
|
|
|
+ uni
|
|
|
+ .hideLoading();
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading();
|
|
|
+ toast("check接口报错")
|
|
|
+ return false
|
|
|
+ })
|
|
|
+ }, 5000)
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading();
|
|
|
+ toast("check接口报错")
|
|
|
+ return false
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ fail: function(err) {
|
|
|
+ uni.hideLoading();
|
|
|
+ // toast('支付失败:' + JSON.stringify(err));
|
|
|
+ console.log('支付失败:' + JSON.stringify(err));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }).catch((error) => {
|
|
|
+ uni.hideLoading();
|
|
|
+
|
|
|
+ console.log(error);
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function aliApy() {
|
|
|
+ orderPayAli({
|
|
|
+ id: orderId.value
|
|
|
+ }).then(res2 => {
|
|
|
+ console.log('res2', res2);
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.requestPayment({
|
|
|
+ "provider": "alipay",
|
|
|
+ "orderInfo": res2.data.text, //此处为服务器返回的订单信息字符串
|
|
|
+ success: function(res) {
|
|
|
+ // var rawdata = JSON.parse(res.rawdata);
|
|
|
+ // console.log('支付成功');
|
|
|
+ // console.log('rawdata', rawdata);
|
|
|
+
|
|
|
+ uni.showLoading({
|
|
|
+ title: '开通中,请稍后...'
|
|
|
+ });
|
|
|
+ orderCheck({
|
|
|
+ id: orderId.value
|
|
|
+ }).then(res3 => {
|
|
|
+ if (res3.code == 0) {
|
|
|
+ genggaiVip(res3.data)
|
|
|
+ } else {
|
|
|
+ setTimeout(() => {
|
|
|
+ orderCheck({
|
|
|
+ id: orderId.value
|
|
|
+ }).then(res4 => {
|
|
|
+ if (res4.code ==
|
|
|
+ 0) {
|
|
|
+ genggaiVip(res4.data)
|
|
|
+ } else {
|
|
|
+ toast(
|
|
|
+ "开通失败,请联系管理员!"
|
|
|
+ )
|
|
|
+ uni
|
|
|
+ .hideLoading();
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading();
|
|
|
+ toast("check接口报错")
|
|
|
+ return false
|
|
|
+ })
|
|
|
+ }, 5000)
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading();
|
|
|
+ toast("check接口报错")
|
|
|
+ return false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail: function(err) {
|
|
|
+ console.log('支付失败:' + JSON.stringify(err));
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ const creatOrder = debounce((data, index) => {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ if (payType.value == 'weixin') {
|
|
|
+ orderId.value = data.id
|
|
|
+ wxPay()
|
|
|
+ } else {
|
|
|
+ orderId.value = data.id
|
|
|
+ aliApy()
|
|
|
+ }
|
|
|
+ }, 500)
|
|
|
+
|
|
|
function onChangeTab(e) {
|
|
|
if (dingdanData.current !== e.currentIndex) {
|
|
|
dingdanData.current = e.currentIndex;
|
|
@@ -248,6 +627,10 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ function onScrolltolower() {
|
|
|
+ getMore(dingdanData.current)
|
|
|
+ }
|
|
|
+
|
|
|
function refreshData(code) {
|
|
|
const opt = {
|
|
|
page: 1,
|
|
@@ -401,7 +784,7 @@
|
|
|
// 数学
|
|
|
dingdanData.quanbu.state = 'no-more';
|
|
|
dingdanData.quanbu.state_text = '没有更多啦';
|
|
|
-
|
|
|
+
|
|
|
dingdanData.quanbu.loading = false;
|
|
|
}
|
|
|
} else if (code == 1) {
|
|
@@ -409,7 +792,7 @@
|
|
|
// 英语
|
|
|
dingdanData.daiFukuan.state = 'more';
|
|
|
dingdanData.daiFukuan.state_text = '加载更多';
|
|
|
-
|
|
|
+
|
|
|
dingdanData.daiFukuan.loading = false;
|
|
|
} else {
|
|
|
// 英语
|
|
@@ -427,7 +810,7 @@
|
|
|
// 英语
|
|
|
dingdanData.yiFukuan.state = 'no-more';
|
|
|
dingdanData.yiFukuan.state_text = '没有更多啦';
|
|
|
-
|
|
|
+
|
|
|
dingdanData.yiFukuan.loading = false;
|
|
|
}
|
|
|
}
|
|
@@ -456,9 +839,23 @@
|
|
|
url: '/pages/my/index'
|
|
|
})
|
|
|
}
|
|
|
+ const isIOSorAndroid = () => {
|
|
|
+ const systemInfo = uni.getSystemInfoSync();
|
|
|
+
|
|
|
+ console.log('systemInfo', systemInfo);
|
|
|
+
|
|
|
+ if (systemInfo.platform == 'ios') {
|
|
|
|
|
|
- onLoad(() => {
|
|
|
+ return currentPlatform.value = 'ios'
|
|
|
+ } else {
|
|
|
+ return currentPlatform.value = 'android'
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ onLoad((options) => {
|
|
|
+ dingdanData.current = options.status || dingdanData.current
|
|
|
getMore(dingdanData.current);
|
|
|
+ // isIOSorAndroid()
|
|
|
})
|
|
|
</script>
|
|
|
|