增加绑定微信功能界面,增加每日解锁支付超过最大获取抽奖次数时弹窗提醒,增加视频解锁创建订单提示未绑定微信407状态时跳转绑定微信界面

This commit is contained in:
2025-03-27 18:09:21 +08:00
parent b24bc98e1c
commit a859805009
11 changed files with 718 additions and 360 deletions

View File

@@ -4,39 +4,29 @@
<cell v-for="(item,index) in list" :key="item.courseDetailsId" :ref="setRefList(index)">
<view class="swipers-items" :style="boxStyle" @longpress="popupShow('speed')">
<list-item-vue :total="list.length" :item="item" :current="current" :isCollect="isCollect"
:isAndriod="isAndriod"
:showAndriod="showAndriod"
:isIos="isIos"
:isH5="isH5"
:isTabbar="isTabbar" @playStatusChange="playStatusChange" :height="wHeight"
:isCommand="isCommand" :showControls="control.showControls" @toDetail="toDetail(item,index)"
@itemMounted="itemMounted" @controlstoggles="controlstoggles" :index="index" :instance="instance"
:nowIndex="nowIndex" @appear="appear($event,item,index)" :playSpeeds="playSpeeds"
:isAndriod="isAndriod" :showAndriod="showAndriod" :isIos="isIos" :isH5="isH5" :isTabbar="isTabbar"
@playStatusChange="playStatusChange" :height="wHeight" :isCommand="isCommand"
:showControls="control.showControls" @toDetail="toDetail(item,index)" @itemMounted="itemMounted"
@controlstoggles="controlstoggles" :index="index" :instance="instance" :nowIndex="nowIndex"
@appear="appear($event,item,index)" :playSpeeds="playSpeeds"
@disappear="disappear($event, item,index)" @dianzanClick="dianzanClick(item,index)"
@share="share(item)" @zhuijuClick="zhuijuClick(item)"
@progressScroll="progressScroll"
@progressScrollEnd="progressScrollEnd"
@popupShow="popupShow($event,item,index)"></list-item-vue>
@share="share(item)" @zhuijuClick="zhuijuClick(item)" @progressScroll="progressScroll"
@progressScrollEnd="progressScrollEnd" @popupShow="popupShow($event,item,index)"></list-item-vue>
</view>
</cell>
</list>
<view v-if="isH5||isIos" class=" w-full box" style="width: 100vw;">
<swiper
@longpress="popupShow('speed')"
:style="{height:wHeight+'px'}" v-if="videoList.length"
<swiper @longpress="popupShow('speed')" :style="{height:wHeight+'px'}" v-if="videoList.length"
@change="swiperChange" :current="current" :circular="true" vertical class="u-flex-1"
@transition="transition" :indicator-dots="false" :autoplay="false" :interval="0" :duration="200">
<swiper-item v-for="(item,index) in videoList" :key="index">
<list-item-vue :total="list.length" :item="item" :isCommand="isCommand" :height="wHeight"
:isAndriod="isAndriod"
:showAndriod="showAndriod"
:isIos="isIos"
:isH5="isH5"
:isTabbar="isTabbar" @playStatusChange="playStatusChange"
:showControls="control.showControls" :current="current" :isCollect="isCollect"
@toDetail="toDetail(item,index)" @controlstoggles="controlstoggles" :playSpeeds="playSpeeds"
:index="index" :nowIndex="nowIndex" @dianzanClick="dianzanClick(item,index)" @share="share(item)"
@zhuijuClick="zhuijuClick(item)" @popupShow="popupShow($event,item,index)"></list-item-vue>
:isAndriod="isAndriod" :showAndriod="showAndriod" :isIos="isIos" :isH5="isH5" :isTabbar="isTabbar"
@playStatusChange="playStatusChange" :showControls="control.showControls" :current="current"
:isCollect="isCollect" @toDetail="toDetail(item,index)" @controlstoggles="controlstoggles"
:playSpeeds="playSpeeds" :index="index" :nowIndex="nowIndex"
@dianzanClick="dianzanClick(item,index)" @share="share(item)" @zhuijuClick="zhuijuClick(item)"
@popupShow="popupShow($event,item,index)"></list-item-vue>
</swiper-item>
</swiper>
</view>
@@ -157,12 +147,12 @@
</view>
<up-icon name="close" :size="16" color="#333" bold @click="popupClose('pay')"></up-icon>
</view>
<view class="u-m-t-30">
<text class=" color-999 u-font-24">{{paytips}} </text>
</view>
<view class="u-m-t-30">
<text class=" color-999 u-font-24">抽奖机会仅当日可用次日作废 </text>
</view>
<view class="u-m-t-30">
<text class=" color-999 u-font-24">{{paytips}} </text>
</view>
<view class="u-m-t-30">
<text class=" color-999 u-font-24">抽奖机会仅当日可用次日作废 </text>
</view>
<view class="colo-333 pay-list font-bold u-font-28 u-m-t-20">
<view class="pay-list-item" v-if="info&&info.price" @click="payBtnClick('money','all')">
<image class="hot" src="@/static/images/hot.png" mode=""></image>
@@ -183,7 +173,7 @@
</view>
</view>
</up-popup>
<!-- 支付确认 -->
<up-popup :show="popup.payTips" :round="10" @close="popupClose('payTips')" :customStyle="customStyle">
@@ -237,13 +227,53 @@
</view>
</view>
</up-popup>
<!-- 达到每天支付赠送抽奖次数上限时弹窗确认 -->
<up-popup :show="popup.payConfirm" mode="center" :round="22" @close="popupClose('payConfirm')"
:customStyle="payConfirmCustomStyle">
<view class="u-p-32">
<text class="u-font-32 color-333 font-bold u-text-center">付款确认</text>
<view class="u-p-l-14 u-p-r-14">
<view class="color-333 u-font-28 u-m-t-28 u-m-b-28 ">
<view class="u-flex u-flex-row">
<text class="u-font-28">今日已付款解锁{{payCount.canGetRedPackMax}}本次解锁后将</text>
<text class="no-get">不会获得</text>
</view>
<text class="u-font-28">抽奖机会请确认是否继续付款
</text>
</view>
<view class="u-flex u-flex-row u-row-between gap-20 u-p-l-28 u-p-r-28">
<text class="cancel-btn" @click="popupClose('payConfirm')">取消</text>
<text class="confirm-btn" @click="continuePay()">继续付款</text>
</view>
</view>
</view>
</up-popup>
<!-- 绑定微信 -->
<up-popup :show="popup.bindWx" mode="center" :round="22" @close="popupClose('bindWx')"
:customStyle="payConfirmCustomStyle">
<view class="u-p-32">
<text class="u-font-32 color-333 font-bold u-text-center">绑定微信</text>
<view class="u-p-l-14 u-p-r-14">
<text class="u-text-center color-333 u-font-28 u-m-t-28 u-m-b-28 ">
请先绑定微信再继续完成支付
</text>
<view class="u-flex u-flex-row u-row-between gap-20 u-p-l-28 u-p-r-28">
<text class="cancel-btn" @click="popupClose('bindWx')">取消</text>
<text class="confirm-btn" @click="bindWx()">立即绑定</text>
</view>
</view>
</view>
</up-popup>
<!-- #ifdef H5 -->
<my-poster ref="refPoster"></my-poster>
<!-- #endif -->
</template>
<script setup>
import {
toBindWx
} from '@/utils/wx.js'
import {
useCommonStore
} from '@/store/common.js'
@@ -276,16 +306,26 @@
onUnmounted
} from 'vue';
let scrollable=ref(true)
function progressScroll(){
scrollable.value=false
//绑定微信
function bindWx(){
popupClose('bindWx')
toBindWx()
}
function progressScrollEnd(){
scrollable.value=true
const payConfirmCustomStyle = {
width: '694rpx'
}
let scrollable = ref(true)
function progressScroll() {
scrollable.value = false
}
function progressScrollEnd() {
scrollable.value = true
}
let isH5 = false
// #ifdef H5
@@ -297,9 +337,9 @@
const showAndriod = !isH5 && isAndriod ? true : false
let initing = true
const refPoster = ref(null)
let paytips=ref('')
let paytips = ref('')
const props = defineProps({
list: {
type: Array,
@@ -336,8 +376,8 @@
}
}
})
const control = reactive({
showBack: true,
showControls: true
@@ -417,9 +457,11 @@
const popup = reactive({
show: false,
pay: false,
bindWx: false,
payTips: false,
speed: false,
data: null,
payConfirm: false,
payType: null
})
@@ -556,45 +598,67 @@
if (num == 1) {
data.courseDetailsId = popup.data.courseDetailsId
}
const res = num == '10' ? await Api.buyTenVideo(data) : await Api.buyVideo(data)
console.log(res);
if (!res.orders) {
return uni.showToast({
title: '创建订单失败',
icon: 'none'
})
}
if (res) {
if (type == 'gold') {
goldPay({
orderId: res.orders.ordersId
})
} else {
payOrder({
orderId: res.orders.ordersId
try {
const res = num == '10' ? await Api.buyTenVideo(data) : await Api.buyVideo(data)
if (res && res.code == 407) {
popupShow('bindWx')
return
}
if (!res || !res.orders) {
return uni.showToast({
title: '创建订单失败',
icon: 'none'
})
}
if (res) {
if (type == 'gold') {
goldPay({
orderId: res.orders.ordersId
})
} else {
payOrder({
orderId: res.orders.ordersId
})
}
} else {
} else {
}
} catch (error) {
console.log(error);
}
}
function payBtnClick(type, num) {
async function payBtnClick(type, num) {
console.log(type, num);
popup.payType = `${type}-${num}`
if (type == 'gold') {
return payConfirm()
}
try {
if (payCount.now > payCount.canGetRedPackMax) {
popupShow('payConfirm')
return
}
popupClose('show')
popupShow('payTips')
} catch (error) {}
}
function continuePay() {
popupClose('payConfirm')
popupClose('show')
popupShow('payTips')
}
function jiClick(item, index) {
initing = false
let newCurrent = (current.value + 1) % 3;
@@ -659,6 +723,18 @@
}
}
const payCount = reactive({
canGetRedPackMax: 0,
now: 1,
})
function extractNumbers(str) {
const numbers = str.match(/\d+/g);
if (numbers) {
return numbers.map(num => parseInt(num, 10));
}
return [];
}
async function popupShow(key = 'show', item, index) {
console.log(key, item, 'debug');
console.log('key' + popup[key]);
@@ -673,10 +749,16 @@
xuanjiInit()
// #endif
}
if(key=='pay'){
const res=await Api.getPayTips()
console.log(res);
paytips.value=res
if (key == 'pay') {
const res = await Api.getPayTips()
const numbers = extractNumbers(res)
console.log(numbers);
if (numbers.length >= 2) {
payCount.canGetRedPackMax = numbers[0]
payCount.now = numbers[1]
console.log(payCount);
}
paytips.value = res
}
popup[key] = true
if (item) {
@@ -802,9 +884,11 @@
}
function share(item) {
const {qdCode}= uni.getStorageSync('userInfo')||{}
const {
qdCode
} = uni.getStorageSync('userInfo') || {}
const urls = returnShareUrl() + '/me/detail/detail?id=' + item.courseId + '&courseDetailsId=' + item
.courseDetailsId + '&invitation=' + uni.getStorageSync('invitationCode') + '&qdCode=' +qdCode;
.courseDetailsId + '&invitation=' + uni.getStorageSync('invitationCode') + '&qdCode=' + qdCode;
console.log(urls);
// #ifdef H5
refPoster.value.make({
@@ -850,7 +934,8 @@
setVideoList(item)
}
const refPopup=ref(null)
const refPopup = ref(null)
function setVideoList(item) {
@@ -1114,8 +1199,8 @@
}
}
}
.ji-item:nth-of-type(3n) {
margin-right: 0;
}
@@ -1222,4 +1307,22 @@
border-radius: 10px 10px 0 0;
background-color: #fff;
}
.cancel-btn,
.confirm-btn {
width: 210rpx;
height: 70rpx;
line-height: 70rpx;
text-align: center;
font-size: 32rpx;
color: #fff;
background: #ED838A;
box-shadow: inset 0rpx -6rpx 12rpx 0rpx rgba(255, 255, 255, 0.77);
border-radius: 40rpx 40rpx 40rpx 40rpx;
}
.no-get {
color: #FF5560;
font-size: 32rpx;
}
</style>