Commit af0f6fd9 by wenyang

优化H5用支付宝支付时跳转浏览器打开的Token问题

parent 4d691bd4
import request from "../util/request"; import request from "../util/request";
import {baseURL,apiURL,cffpURL} from "../environments/environment"; import {baseURL,apiURL,cffpURL} from "../environments/environment";
export default { export default {
//查看token是否已经失效 //查看token是否已经失效
checkToken(){ checkToken(){
const params = { const params = {
token:uni.getStorageSync('uni-token'), token:uni.getStorageSync('uni-token'),
ticket:'uni-app' ticket:'uni-app'
} }
return request(`${baseURL}/api/authorize/checkToken`, "POST", params) return request(`${baseURL}/api/authorize/checkToken`, "POST", params)
}, },
// 获取token // 获取token
obtainToken(){ obtainToken(){
const params = { const params = {
ticket:'uni-app' ticket:'uni-app',
} loginId:null
return request(`${baseURL}/api/authorize/obtainToken`, "POST", params) }
}, let h5userId = uni.getStorageSync('cffp_userId');
//获取验证码 if (h5userId) {
verificationCode(params){ params.loginId = h5userId;
return request(`${baseURL}/api/verificationCode`, "POST", params) }
}, return request(`${baseURL}/api/authorize/obtainToken`, "POST", params)
//登录接口 },
loginVerification(params){ //获取验证码
return request(`${cffpURL}/user/loginVerification`, "POST", params) verificationCode(params){
}, return request(`${baseURL}/api/verificationCode`, "POST", params)
//注册接口 },
register(params){ //登录接口
return request(`${cffpURL}/user/register`, "POST", params) loginVerification(params){
}, return request(`${cffpURL}/user/loginVerification`, "POST", params)
//重置密码 },
resetPassword(params){ //注册接口
return request(`${cffpURL}/user/resetPassword`, "POST", params) register(params){
}, return request(`${cffpURL}/user/register`, "POST", params)
// 课程查询列表接口 },
courseList(params){ //重置密码
return request(`${cffpURL}/course/list`,"POST",params) resetPassword(params){
}, return request(`${cffpURL}/user/resetPassword`, "POST", params)
// 讲师信息查询 },
lecturerQuery(params){ // 课程查询列表接口
return request(`${apiURL}/college/lecturerQuery`, "POST", params) courseList(params){
}, return request(`${cffpURL}/course/list`,"POST",params)
//账户信息获取 },
queryAreaCenterInfo(params){ // 讲师信息查询
return request(`${cffpURL}/areaCenter/queryAreaCenterInfo`, "POST", params) lecturerQuery(params){
}, return request(`${apiURL}/college/lecturerQuery`, "POST", params)
//公告列表 },
announcementQuery(params){ //账户信息获取
return request(`${apiURL}/market/announcementQuery`, "POST", params) queryAreaCenterInfo(params){
}, return request(`${cffpURL}/areaCenter/queryAreaCenterInfo`, "POST", params)
//消息列表 },
querySystemMessage(params){ //公告列表
return request(`${apiURL}/systemMessage/querySystemMessage`, "POST", params) announcementQuery(params){
}, return request(`${apiURL}/market/announcementQuery`, "POST", params)
//清除站内消息 },
oneKeyRead(params){ //消息列表
return request(`${apiURL}/systemMessage/oneKeyRead`, "POST", params) querySystemMessage(params){
}, return request(`${apiURL}/systemMessage/querySystemMessage`, "POST", params)
//消息详情&单个阅读 },
querySystemMessageDetail(params){ //清除站内消息
return request(`${apiURL}/systemMessage/querySystemMessageDetail`, "POST", params) oneKeyRead(params){
}, return request(`${apiURL}/systemMessage/oneKeyRead`, "POST", params)
// 学习认证列表 },
querySignupList(params){ //消息详情&单个阅读
return request(`${cffpURL}/certificate/querySignupList`, "POST", params) querySystemMessageDetail(params){
}, return request(`${apiURL}/systemMessage/querySystemMessageDetail`, "POST", params)
// 个人认证列表 },
userCertificateList(params){ // 学习认证列表
return request(`${cffpURL}/certificate/userCertificateList`, "POST", params) querySignupList(params){
}, return request(`${cffpURL}/certificate/querySignupList`, "POST", params)
// 认证详情 },
queryCertificateInfo(params){ // 个人认证列表
return request(`${cffpURL}/certificate/queryCertificateInfo`, "POST", params) userCertificateList(params){
}, return request(`${cffpURL}/certificate/userCertificateList`, "POST", params)
// 课程详情 },
courseDetail(params){ // 认证详情
return request(`${cffpURL}/course/detail`, "POST", params) queryCertificateInfo(params){
}, return request(`${cffpURL}/certificate/queryCertificateInfo`, "POST", params)
// 相关课程黎贝澳查询 },
relatedCoursesList(params){ // 课程详情
return request(`${cffpURL}/course/relatedCoursesList`, "POST", params) courseDetail(params){
}, return request(`${cffpURL}/course/detail`, "POST", params)
//邀请加盟与申请加盟保存接口 },
saveApplyInfo(params){ // 相关课程黎贝澳查询
return request(`${cffpURL}/partner/saveApplyInfo`, "POST", params) relatedCoursesList(params){
}, return request(`${cffpURL}/course/relatedCoursesList`, "POST", params)
// 查询所属组织List },
queryOrgList(params){ //邀请加盟与申请加盟保存接口
return request(`${cffpURL}/orgInfo/queryOrgList`, "POST", params) saveApplyInfo(params){
}, return request(`${cffpURL}/partner/saveApplyInfo`, "POST", params)
//学习认证列表 },
queryCertificateList(params){ // 查询所属组织List
return request(`${cffpURL}/certificate/queryCertificateList`, "POST", params) queryOrgList(params){
}, return request(`${cffpURL}/orgInfo/queryOrgList`, "POST", params)
//学习认证结果 },
userCertificateResult(params){ //学习认证列表
return request(`${cffpURL}/certificate/userCertificateList`, "POST", params) queryCertificateList(params){
}, return request(`${cffpURL}/certificate/queryCertificateList`, "POST", params)
// 我的学习,学习记录 },
userStudyList(params){ //学习认证结果
return request(`${cffpURL}/study/userStudyList`, "POST", params) userCertificateResult(params){
}, return request(`${cffpURL}/certificate/userCertificateList`, "POST", params)
// 我的分享 },
userShareQuery(params){ // 我的学习,学习记录
return request(`${cffpURL}/share/userShareQuery`, "POST", params) userStudyList(params){
}, return request(`${cffpURL}/study/userStudyList`, "POST", params)
// 订单详情 },
userCourseInfo(params){ // 我的分享
return request(`${cffpURL}/course/userCourseInfo`, "POST", params) userShareQuery(params){
}, return request(`${cffpURL}/share/userShareQuery`, "POST", params)
//我的积分查询接口 },
findByUserIdForFortuneStatistic(params){ // 订单详情
return request(`${apiURL}/fortune/findByUserIdForFortuneStatistic`, "POST", params) userCourseInfo(params){
}, return request(`${cffpURL}/course/userCourseInfo`, "POST", params)
//我的积分明细 },
findForExchangeStatisticDtl(params){ //我的积分查询接口
return request(`${apiURL}/fortune/findForExchangeStatisticDtl`, "POST", params) findByUserIdForFortuneStatistic(params){
}, return request(`${apiURL}/fortune/findByUserIdForFortuneStatistic`, "POST", params)
//分类查询 },
dropOptionsQuery(params){ //我的积分明细
return request(`${apiURL}/metadata/dropOptionsQuery`, "POST", params) findForExchangeStatisticDtl(params){
}, return request(`${apiURL}/fortune/findForExchangeStatisticDtl`, "POST", params)
// 销售课程统计 },
userCourseCount(params){ //分类查询
return request(`${cffpURL}/course/userCourseCount`, "POST", params) dropOptionsQuery(params){
}, return request(`${apiURL}/metadata/dropOptionsQuery`, "POST", params)
// 销售课程列表查询 },
userCourseList(params){ // 销售课程统计
return request(`${cffpURL}/course/userCourseList`, "POST", params) userCourseCount(params){
}, return request(`${cffpURL}/course/userCourseCount`, "POST", params)
// 分享课程列表查询 },
userShareCourseList(params){ // 销售课程列表查询
return request(`${cffpURL}/course/userShareCourseList`, "POST", params) userCourseList(params){
}, return request(`${cffpURL}/course/userCourseList`, "POST", params)
//积分兑换查询 },
queryByUserIdFortuneStatistic(params){ // 分享课程列表查询
return request(`${apiURL}/fortune/queryByUserIdFortuneStatistic`, "POST", params) userShareCourseList(params){
}, return request(`${cffpURL}/course/userShareCourseList`, "POST", params)
//积分兑换记录查询 },
findByUserIdForWithdralHis(params){ //积分兑换查询
return request(`${apiURL}/fortune/findByUserIdForWithdralHis`, "POST", params) queryByUserIdFortuneStatistic(params){
}, return request(`${apiURL}/fortune/queryByUserIdFortuneStatistic`, "POST", params)
//提现明细接口 },
findByUserIdForWithdralDtl(params){ //积分兑换记录查询
return request(`${apiURL}/fortune/findByUserIdForWithdralDtl`, "POST", params) findByUserIdForWithdralHis(params){
}, return request(`${apiURL}/fortune/findByUserIdForWithdralHis`, "POST", params)
// 我的售后 },
userAfterSales(params){ //提现明细接口
return request(`${cffpURL}/course/userAfterSales`, "POST", params) findByUserIdForWithdralDtl(params){
}, return request(`${apiURL}/fortune/findByUserIdForWithdralDtl`, "POST", params)
// 售后详情 },
userAfterSalesDtl(params){ // 我的售后
return request(`${cffpURL}/course/userAfterSalesDtl`, "POST", params) userAfterSales(params){
}, return request(`${cffpURL}/course/userAfterSales`, "POST", params)
// 个人信息查询 },
queryInfo(params){ // 售后详情
return request(`${cffpURL}/user/queryInfo`, "POST", params) userAfterSalesDtl(params){
}, return request(`${cffpURL}/course/userAfterSalesDtl`, "POST", params)
// 微信支付 },
wxAppPay(params){ // 个人信息查询
return request(`${apiURL}/pay/wxAppPay`, "POST", params) queryInfo(params){
}, return request(`${cffpURL}/user/queryInfo`, "POST", params)
// 订单保存 },
saveOrder(params){ // 微信支付
return request(`${cffpURL}/order/saveOrder`, "POST", params) wxAppPay(params){
}, return request(`${apiURL}/pay/wxAppPay`, "POST", params)
//去提现接口 },
goFortuneWithdrawal(params){ // 订单保存
return request(`${apiURL}/fortune/goFortuneWithdrawal`, "POST", params) saveOrder(params){
}, return request(`${cffpURL}/order/saveOrder`, "POST", params)
// 支付宝支付 },
aliAppPay(params){ //去提现接口
return request(`${apiURL}/aliPay/aliAppPay`, "POST", params) goFortuneWithdrawal(params){
}, return request(`${apiURL}/fortune/goFortuneWithdrawal`, "POST", params)
// 分享链接列表 },
userShareLinkList(params){ // 支付宝支付
return request(`${cffpURL}/share/userShareLinkList`, "POST", params) aliAppPay(params){
}, return request(`${apiURL}/aliPay/aliAppPay`, "POST", params)
// 分享阅读列表 },
userShareReadList(params){ // 分享链接列表
return request(`${cffpURL}/share/userShareReadList`, "POST", params) userShareLinkList(params){
}, return request(`${cffpURL}/share/userShareLinkList`, "POST", params)
// 分享购买列表 },
userShareBuyList(params){ // 分享阅读列表
return request(`${cffpURL}/share/userShareBuyList`, "POST", params) userShareReadList(params){
}, return request(`${cffpURL}/share/userShareReadList`, "POST", params)
// 我的分享统计 },
userShareCount(params){ // 分享购买列表
return request(`${cffpURL}/share/userShareCount`, "POST", params) userShareBuyList(params){
}, return request(`${cffpURL}/share/userShareBuyList`, "POST", params)
// 退课明细 },
userRefundCourseDtl(params){ // 我的分享统计
return request(`${cffpURL}/course/userRefundCourseDtl`, "POST", params) userShareCount(params){
}, return request(`${cffpURL}/share/userShareCount`, "POST", params)
//查询证件类型 },
erpInitialize(params){ // 退课明细
return request(`${apiURL}/erp/erpInitialize`, "POST", params) userRefundCourseDtl(params){
}, return request(`${cffpURL}/course/userRefundCourseDtl`, "POST", params)
//获取职业类别 },
occupationQry(params){ //查询证件类型
return request(`${apiURL}/metadata/occupationQry`, "POST", params) erpInitialize(params){
}, return request(`${apiURL}/erp/erpInitialize`, "POST", params)
// 邀请列表查询 },
queryInviteList(params){ //获取职业类别
return request(`${cffpURL}/partner/queryInviteList`, "POST", params) occupationQry(params){
}, return request(`${apiURL}/metadata/occupationQry`, "POST", params)
// 视频播放轨迹保存 },
saveVideoPlayback(params){ // 邀请列表查询
return request(`${apiURL}/videoPlay/saveVideoPlayback`, "POST", params) queryInviteList(params){
}, return request(`${cffpURL}/partner/queryInviteList`, "POST", params)
// 查询视频播放最新记录 },
findVideoPlayback(params){ // 视频播放轨迹保存
return request(`${apiURL}/videoPlay/findVideoPlayback`, "POST", params) saveVideoPlayback(params){
}, return request(`${apiURL}/videoPlay/saveVideoPlayback`, "POST", params)
// 教育等级查询 },
educationLevelQuery() { // 查询视频播放最新记录
return request(`${apiURL}/metadata/educationLevelQuery`, "GET") findVideoPlayback(params){
}, return request(`${apiURL}/videoPlay/findVideoPlayback`, "POST", params)
// 退课列表 },
queryDropCourseList(params){ // 教育等级查询
return request(`${cffpURL}/course/queryDropCourseList`, "POST", params) educationLevelQuery() {
}, return request(`${apiURL}/metadata/educationLevelQuery`, "GET")
// 我的团队 },
queryMyTeamInfo(params){ // 退课列表
return request(`${cffpURL}/orgInfo/queryMyTeamInfo`, "POST", params) queryDropCourseList(params){
}, return request(`${cffpURL}/course/queryDropCourseList`, "POST", params)
// 我的团队展开 },
queryTeamDetail(params){ // 我的团队
return request(`${cffpURL}/orgInfo/teamDetail`, "POST", params) queryMyTeamInfo(params){
}, return request(`${cffpURL}/orgInfo/queryMyTeamInfo`, "POST", params)
// 团队业绩 },
queryTeamAchievement(params){ // 我的团队展开
return request(`${cffpURL}/orgInfo/queryTeamAchievement`, "POST", params) queryTeamDetail(params){
}, return request(`${cffpURL}/orgInfo/teamDetail`, "POST", params)
// 学习统计 },
userStudyCount(params){ // 团队业绩
return request(`${cffpURL}/study/userStudyCount`, "POST", params) queryTeamAchievement(params){
}, return request(`${cffpURL}/orgInfo/queryTeamAchievement`, "POST", params)
// 我的团队展开LIST },
teamDetail(params){ // 学习统计
return request(`${cffpURL}/orgInfo/teamDetail`, "POST", params) userStudyCount(params){
}, return request(`${cffpURL}/study/userStudyCount`, "POST", params)
// 课程包学习进度明细 },
userCoursePackBar(params){ // 我的团队展开LIST
return request(`${cffpURL}/study/userCoursePackBar`, "POST", params) teamDetail(params){
}, return request(`${cffpURL}/orgInfo/teamDetail`, "POST", params)
// 学习明细 },
userStudyTime(params){ // 课程包学习进度明细
return request(`${cffpURL}/study/userStudyTime`, "POST", params) userCoursePackBar(params){
}, return request(`${cffpURL}/study/userCoursePackBar`, "POST", params)
//合同声明 },
listQuery(params){ // 学习明细
return request(`${cffpURL}/contract/listQuery`, "POST", params) userStudyTime(params){
}, return request(`${cffpURL}/study/userStudyTime`, "POST", params)
// 个人信息修改 },
updateinfo(params){ //合同声明
return request(`${cffpURL}/user/update`, "POST", params) listQuery(params){
}, return request(`${cffpURL}/contract/listQuery`, "POST", params)
// 上传接口 },
uploadFile(params){ // 个人信息修改
return request(`${cffpURL}/api/file/upload`, "POST", params) updateinfo(params){
}, return request(`${cffpURL}/user/update`, "POST", params)
// 认证--查询个人信息 },
querySignUpInfo(params){ // 上传接口
return request(`${cffpURL}/user/querySignUpInfo`, "POST", params) uploadFile(params){
}, return request(`${cffpURL}/api/file/upload`, "POST", params)
// 认证--上传就个人信息 },
uploadSignUpUserInfo(params){ // 认证--查询个人信息
return request(`${cffpURL}/user/uploadSignUpUserInfo`, "POST", params) querySignUpInfo(params){
}, return request(`${cffpURL}/user/querySignUpInfo`, "POST", params)
//查询申请加盟信息 },
queryById(params){ // 认证--上传就个人信息
return request(`${cffpURL}/partner/queryById`, "POST",params) uploadSignUpUserInfo(params){
}, return request(`${cffpURL}/user/uploadSignUpUserInfo`, "POST", params)
//支付宝去提现 },
aliWithdrawal(params){ //查询申请加盟信息
return request(`${apiURL}/aliPay/aliWithdrawal`, "POST", params) queryById(params){
}, return request(`${cffpURL}/partner/queryById`, "POST",params)
//微信去提现 },
wxWithdrawal(params){ //支付宝去提现
return request(`${apiURL}/pay/wxWithdrawal`, "POST", params) aliWithdrawal(params){
}, return request(`${apiURL}/aliPay/aliWithdrawal`, "POST", params)
//保存base64电子签名 },
saveDigitalSignatures(params){ //微信去提现
return request(`${cffpURL}/partner/saveDigitalSignatures`, "POST", params) wxWithdrawal(params){
}, return request(`${apiURL}/pay/wxWithdrawal`, "POST", params)
// 退款 },
unifiedRefund(params){ //保存base64电子签名
return request(`${apiURL}/pay/unifiedRefund`, "POST", params) saveDigitalSignatures(params){
}, return request(`${cffpURL}/partner/saveDigitalSignatures`, "POST", params)
//判断是否授权 },
isAuth(params){ // 退款
return request(`${apiURL}/aliPay/isAuth`, "POST", params) unifiedRefund(params){
}, return request(`${apiURL}/pay/unifiedRefund`, "POST", params)
// 账号注销 },
cancellation(params){ //判断是否授权
return request(`${apiURL}/cffp/user/cancellation`, "POST", params) isAuth(params){
}, return request(`${apiURL}/aliPay/isAuth`, "POST", params)
// 用户分享 },
userShare(params){ // 账号注销
return request(`${apiURL}/cffp/share/userShare`, "POST", params) cancellation(params){
}, return request(`${apiURL}/cffp/user/cancellation`, "POST", params)
// 用户阅读 },
userRead(params){ // 用户分享
return request(`${apiURL}/cffp/share/userRead`, "POST", params) userShare(params){
}, return request(`${apiURL}/cffp/share/userShare`, "POST", params)
//H5 分享 },
Wxshare(params){ // 用户阅读
return request(`${apiURL}/wxConfig`, "POST", params) userRead(params){
}, return request(`${apiURL}/cffp/share/userRead`, "POST", params)
//支付宝网页支付 },
aliWapPay(params){ //H5 分享
return request(`${apiURL}/aliPay/aliWapPay`, "POST", params) Wxshare(params){
}, return request(`${apiURL}/wxConfig`, "POST", params)
//统一支付接口 },
unifiedPay(params){ //支付宝网页支付
return request(`${apiURL}/pay/unifiedPay`, "POST", params) aliWapPay(params){
}, return request(`${apiURL}/aliPay/aliWapPay`, "POST", params)
// 保单单利复利计算 },
irrAndSimpleCalcute(params) { //统一支付接口
return request(`${baseURL}/api/sfp/calcuteUtil/irrAndSimpleCalcute`, "POST", params) unifiedPay(params){
}, return request(`${apiURL}/pay/unifiedPay`, "POST", params)
// 获取unionId },
getWxUserInfo(params){ // 保单单利复利计算
return request(`${baseURL}/api/getWxUserInfo`, "POST", params) irrAndSimpleCalcute(params) {
}, return request(`${baseURL}/api/sfp/calcuteUtil/irrAndSimpleCalcute`, "POST", params)
//增额寿和年金(单利复利)计算结果查询接口 },
queryIrrAndSimple(params){ // 获取unionId
return request(`${baseURL}/api/sfp/calcuteUtil/queryIrrAndSimple`, "POST", params) getWxUserInfo(params){
}, return request(`${baseURL}/api/getWxUserInfo`, "POST", params)
//获取城市 },
provCityQry(params){ //增额寿和年金(单利复利)计算结果查询接口
return request(`${baseURL}/api/metadata/provCityQry`, "POST", params) queryIrrAndSimple(params){
}, return request(`${baseURL}/api/sfp/calcuteUtil/queryIrrAndSimple`, "POST", params)
},
//购房能力测算 //获取城市
housePurchasePlanAnalysis(params){ provCityQry(params){
return request(`${baseURL}/api/sfp/calcuteUtil/housePurchasePlanAnalysis`, "POST", params) return request(`${baseURL}/api/metadata/provCityQry`, "POST", params)
}, },
// 各城市商品住宅销售价格查询接口 //购房能力测算
queryCommercialHousingPrice(params){ housePurchasePlanAnalysis(params){
return request(`${baseURL}/api/sfp/calcuteConfig/queryCommercialHousingPrice`, "POST", params) return request(`${baseURL}/api/sfp/calcuteUtil/housePurchasePlanAnalysis`, "POST", params)
}, },
// 子女教育测算
educationEstimate(params){ // 各城市商品住宅销售价格查询接口
return request(`${baseURL}/api/sfp/calcuteUtil/educationEstimate`, "POST", params) queryCommercialHousingPrice(params){
}, return request(`${baseURL}/api/sfp/calcuteConfig/queryCommercialHousingPrice`, "POST", params)
//微信认证 },
wxAuthorize(params){ // 子女教育测算
return request(`${baseURL}/api/pay/wxAuthorize`, "POST", params) educationEstimate(params){
}, return request(`${baseURL}/api/sfp/calcuteUtil/educationEstimate`, "POST", params)
//验证验证码是否正确 },
verification(params){ //微信认证
return request(`${cffpURL}/user/verification`, "POST", params) wxAuthorize(params){
} return request(`${baseURL}/api/pay/wxAuthorize`, "POST", params)
} },
//验证验证码是否正确
verification(params){
return request(`${cffpURL}/user/verification`, "POST", params)
}
}
<template> <template>
<view class="container"> <view class="container">
<!-- 课程详情 --> <!-- 课程详情 -->
<template v-if="courseInfoItem"> <template v-if="courseInfoItem">
<view class="courseItemBox" style="padding-top:80rpx"> <view class="courseItemBox" style="padding-top:80rpx">
<view class="iconfont icon-youjiantou zuojiantou" @click="goBack()" style="top:18rpx"> <view class="iconfont icon-youjiantou zuojiantou" @click="goBack()" style="top:18rpx">
</view> </view>
<course-item :thumbnailPath="courseInfoItem.displayImage" :title="courseInfoItem.fileTitle" <course-item :thumbnailPath="courseInfoItem.displayImage" :title="courseInfoItem.fileTitle"
:summaryBox="courseInfoItem.fileSynopsis" :summaryBox="courseInfoItem.fileSynopsis"
:dataList="{coursePrice:courseInfoItem.coursePrice,salesNumber:courseInfoItem.salesNumber}" :dataList="{coursePrice:courseInfoItem.coursePrice,salesNumber:courseInfoItem.salesNumber}"
:fileLecturerId="courseInfoItem.fileLecturerId" :fileId="fileId"></course-item> :fileLecturerId="courseInfoItem.fileLecturerId" :fileId="fileId"></course-item>
</view> </view>
</template> </template>
<!-- 价格明细 --> <!-- 价格明细 -->
<view class="priceInfoContent"> <view class="priceInfoContent">
<h4>价格明细</h4> <h4>价格明细</h4>
<view><text>现价</text><text>¥{{Number(courseInfoItem.coursePrice).toFixed(2)}}</text></view> <view><text>现价</text><text>¥{{Number(courseInfoItem.coursePrice).toFixed(2)}}</text></view>
<view> <view>
<text @click="toggle(1,'bottom')">积分抵扣<i class="iconfont icon-31tishi"></i></text> <text @click="toggle(1,'bottom')">积分抵扣<i class="iconfont icon-31tishi"></i></text>
<text class="integralBox" @click="toggle(2,'bottom')" <text class="integralBox" @click="toggle(2,'bottom')"
v-if="intergralInfo.preFortune">{{isDeduction != 'true' ? '未选' : '已选'}}积分,可抵扣{{deductionCore}}<i v-if="intergralInfo.preFortune">{{isDeduction != 'true' ? '未选' : '已选'}}积分,可抵扣{{deductionCore}}<i
class="iconfont icon-youjiantou"></i></text> class="iconfont icon-youjiantou"></i></text>
<text style="color: #666666;font-size: 30rpx;" v-else>暂无积分</text> <text style="color: #666666;font-size: 30rpx;" v-else>暂无积分</text>
</view> </view>
<view><text>合计</text> <view><text>合计</text>
<text v-if="isRedirect == 1">{{calculatedPrice}}</text> <text v-if="isRedirect == 1">{{calculatedPrice}}</text>
<text v-else>¥{{Number(totalPrice).toFixed(2)}}</text> <text v-else>¥{{Number(totalPrice).toFixed(2)}}</text>
</view> </view>
</view> </view>
<!-- 支付方式 --> <!-- 支付方式 -->
<view class="paymentMethodContent"> <view class="paymentMethodContent">
<h4>选择支付方式</h4> <h4>选择支付方式</h4>
<view class="paymentItem" @click="selectPaymentMethod(2)"> <view class="paymentItem" @click="selectPaymentMethod(2)">
<view> <view>
<i class="iconfont icon-zhifubao"></i> <i class="iconfont icon-zhifubao"></i>
<text>支付宝支付</text> <text>支付宝支付</text>
</view> </view>
<view class="selectRadio" :class="{'actived':paymentMethod===2}"> <view class="selectRadio" :class="{'actived':paymentMethod===2}">
<i class="iconfont icon-duihao"></i> <i class="iconfont icon-duihao"></i>
</view> </view>
</view> </view>
<view class="paymentItem" @click="selectPaymentMethod(1)" v-if="deviceType==3"> <view class="paymentItem" @click="selectPaymentMethod(1)" v-if="deviceType==3">
<view> <view>
<i class="iconfont icon-py_weixinzhifu"></i> <i class="iconfont icon-py_weixinzhifu"></i>
<text>微信支付</text> <text>微信支付</text>
</view> </view>
<view class="selectRadio" :class="{'actived':paymentMethod===1}"> <view class="selectRadio" :class="{'actived':paymentMethod===1}">
<i class="iconfont icon-duihao"></i> <i class="iconfont icon-duihao"></i>
</view> </view>
</view> </view>
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<!-- <view class="paymentItem" @click="selectPaymentMethod(1)"> <!-- <view class="paymentItem" @click="selectPaymentMethod(1)">
<view> <view>
<i class="iconfont icon-py_weixinzhifu"></i> <i class="iconfont icon-py_weixinzhifu"></i>
<text>微信支付</text> <text>微信支付</text>
</view> </view>
<view class="selectRadio" :class="{'actived':paymentMethod===1}"> <view class="selectRadio" :class="{'actived':paymentMethod===1}">
<i class="iconfont icon-duihao"></i> <i class="iconfont icon-duihao"></i>
</view> </view>
</view> --> </view> -->
<!-- #endif --> <!-- #endif -->
</view> </view>
<!-- 底部 --> <!-- 底部 -->
<view class="totalContent"> <view class="totalContent">
<view class="priceInfoBox"> <view class="priceInfoBox">
<view>合计: <view>合计:
<strong v-if="isRedirect == 1">{{calculatedPrice}}</strong> <strong v-if="isRedirect == 1">{{calculatedPrice}}</strong>
<strong v-else style="font-size: 36rpx;">¥{{totalPrice}}</strong> <strong v-else style="font-size: 36rpx;">¥{{totalPrice}}</strong>
</view> </view>
<view class="" v-if="isRedirect == 1"> <view class="" v-if="isRedirect == 1">
<view>共优惠:<strong style="color:#F15A1F"> <view>共优惠:<strong style="color:#F15A1F">
<text v-if="isDeduction == 'true'">{{deductionCore}}</text> <text v-if="isDeduction == 'true'">{{deductionCore}}</text>
<text style="color:#F15A1F" v-else>0</text> <text style="color:#F15A1F" v-else>0</text>
</strong> </strong>
</view> </view>
</view> </view>
<view class="" v-else> <view class="" v-else>
<view>共优惠:<strong style="color:#F15A1F" <view>共优惠:<strong style="color:#F15A1F"
v-if="isDeduction == 'true'">¥{{Number(deductionCore * intergralInfo.preFortune).toFixed(2)}}</strong> v-if="isDeduction == 'true'">¥{{Number(deductionCore * intergralInfo.preFortune).toFixed(2)}}</strong>
<text style="color:#F15A1F" v-else>0</text> <text style="color:#F15A1F" v-else>0</text>
</view> </view>
</view> </view>
</view> </view>
<view class="confirmOrder" :class="{'gray':paymentBtnDisabled}" @click="pay()">提交订单</view> <view class="confirmOrder" :class="{'gray':paymentBtnDisabled}" @click="pay()">提交订单</view>
</view> </view>
<view v-html="payForm"> <view v-html="payForm">
</view> </view>
<!-- 普通弹窗 --> <!-- 普通弹窗 -->
<uni-popup ref="popup" background-color="#fff"> <uni-popup ref="popup" background-color="#fff">
<view class="popup-content"> <view class="popup-content">
<view class="title"> <view class="title">
<text></text> <text></text>
<h3>{{popupTitle}}</h3> <h3>{{popupTitle}}</h3>
<i class="iconfont icon-guanbi" @click="closePopup(1)"></i> <i class="iconfont icon-guanbi" @click="closePopup(1)"></i>
</view> </view>
<view v-if="popupType===1"><text>1积分=1元,积分抵扣如同现金,所有课程均可使用.</text></view> <view v-if="popupType===1"><text>1积分=1元,积分抵扣如同现金,所有课程均可使用.</text></view>
<view v-if="popupType===2"> <view v-if="popupType===2">
<view class="deductionInfoItem" :class="{'actived':isDeduction == 'true'}" @click="selectDeduction(true)"> <view class="deductionInfoItem" :class="{'actived':isDeduction == 'true'}" @click="selectDeduction(true)">
<view style="display: flex;"> <view style="display: flex;">
<text>可抵扣</text> <text>可抵扣</text>
<view class="integralInfoBox"> <view class="integralInfoBox">
<text class="deductionCount">¥{{deductionCore * intergralInfo.preFortune || '0'}}</text> <text class="deductionCount">¥{{deductionCore * intergralInfo.preFortune || '0'}}</text>
<text>需{{deductionCore}}积分兑换</text> <text>需{{deductionCore}}积分兑换</text>
</view> </view>
</view> </view>
<view class="selectRadio"> <view class="selectRadio">
<i class="iconfont icon-duihao"></i> <i class="iconfont icon-duihao"></i>
</view> </view>
</view> </view>
<view class="deductionInfoItem" :class="{'actived':isDeduction == 'false'}" @click="selectDeduction(false)"> <view class="deductionInfoItem" :class="{'actived':isDeduction == 'false'}" @click="selectDeduction(false)">
<view> <view>
<text>不使用积分抵扣</text> <text>不使用积分抵扣</text>
</view> </view>
<view class="selectRadio"> <view class="selectRadio">
<i class="iconfont icon-duihao"></i> <i class="iconfont icon-duihao"></i>
</view> </view>
</view> </view>
<view class="confirmBtn" @click="closePopup(1);"> <view class="confirmBtn" @click="closePopup(1);">
确认 确认
</view> </view>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<view class="popupContainer"> <view class="popupContainer">
<uni-popup ref="popup1" background-color="#fff"> <uni-popup ref="popup1" background-color="#fff">
<view class="popup1-content"> <view class="popup1-content">
<view class="title"> <view class="title">
<text></text> <text></text>
<h3>{{popupTitle}}</h3> <h3>{{popupTitle}}</h3>
<i class="iconfont icon-guanbi" @click="closePopup(2)"></i> <i class="iconfont icon-guanbi" @click="closePopup(2)"></i>
</view> </view>
<view class="integralDeductionContent"> <view class="integralDeductionContent">
<view class="intergralItem"> <view class="intergralItem">
<text>可兑换积分:</text> <text>可兑换积分:</text>
<text>{{intergralInfo.yesExchangeFortune}}积分</text> <text>{{intergralInfo.yesExchangeFortune}}积分</text>
</view> </view>
<view class="intergralItem"> <view class="intergralItem">
<text>本次兑换消耗积分:</text> <text>本次兑换消耗积分:</text>
<text>{{deductionCore}}积分</text> <text>{{deductionCore}}积分</text>
</view> </view>
<view class="intergralItem"> <view class="intergralItem">
<text>剩余可兑换积分:</text> <text>剩余可兑换积分:</text>
<text>{{(intergralInfo.yesExchangeFortune - deductionCore).toFixed(2)}}积分</text> <text>{{(intergralInfo.yesExchangeFortune - deductionCore).toFixed(2)}}积分</text>
</view> </view>
<view class="confirmBtn" @click="closePopup(2)"> <view class="confirmBtn" @click="closePopup(2)">
确认兑换 确认兑换
</view> </view>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
</view> </view>
<view class="markBox" @click="tipsFlag=false" v-if="tipsFlag"> <view class="markBox" @click="tipsFlag=false" v-if="tipsFlag">
<view class="guideImgBox"> <view class="guideImgBox">
<image src="../../static/Group132.png" mode="widthFix"></image> <image src="../../static/Group132.png" mode="widthFix"></image>
<view class="tips"> <view class="tips">
<!-- <view class="text-center">请点击右上角菜单</view> --> <!-- <view class="text-center">请点击右上角菜单</view> -->
<view style="line-height: 60rpx;">戳这里,点击<text class="iconfont icon-liulanqi"></text> <view style="line-height: 60rpx;">戳这里,点击<text class="iconfont icon-liulanqi"></text>
按钮,使用系统浏览器打开页面完成支付,完成后请返回微信,到【销售课程】下,查看购买订单。</view> 按钮,使用系统浏览器打开页面完成支付,完成后请返回微信,到【销售课程】下,查看购买订单。</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import api from "@/api/api"; import api from "@/api/api";
import courseItem from "@/components/courseItem/courseItem.vue"; import courseItem from "@/components/courseItem/courseItem.vue";
import { import {
nextTick nextTick
} from "vue"; } from "vue";
import common from '../../common/common'; import common from '../../common/common';
export default { export default {
components: { components: {
courseItem courseItem
}, },
data() { data() {
return { return {
courseInfoItem: {}, courseInfoItem: {},
fileId: null, fileId: null,
paymentMethod: 2, paymentMethod: 2,
popupTitle: '积分抵扣规则', popupTitle: '积分抵扣规则',
popupType: 1, popupType: 1,
isDeduction: 'false', isDeduction: 'false',
userId: uni.getStorageSync('cffp_userId'), userId: uni.getStorageSync('cffp_userId'),
intergralInfo: {}, intergralInfo: {},
orderId: '', orderId: '',
paymentBtnDisabled: false, paymentBtnDisabled: false,
action: '', action: '',
params: '', params: '',
actionType: '', actionType: '',
charset: '', charset: '',
contentType: '', contentType: '',
payForm: '', payForm: '',
deviceType: '', deviceType: '',
tipsFlag: false, tipsFlag: false,
isRedirect: null, isRedirect: null,
amount: 0, amount: 0,
calculatedPrice: 0 calculatedPrice: 0
} }
}, },
computed: { computed: {
totalPrice() { totalPrice() {
if (this.isDeduction == "true") { if (this.isDeduction == "true") {
return (this.courseInfoItem.coursePrice - (this.deductionCore * this.intergralInfo.preFortune)) return (this.courseInfoItem.coursePrice - (this.deductionCore * this.intergralInfo.preFortune))
.toFixed(2) .toFixed(2)
} else { } else {
return this.courseInfoItem.coursePrice; return this.courseInfoItem.coursePrice;
} }
}, },
deductionCore() { deductionCore() {
if (this.courseInfoItem.coursePrice / this.intergralInfo.preFortune < this.intergralInfo if (this.courseInfoItem.coursePrice / this.intergralInfo.preFortune < this.intergralInfo
.yesExchangeFortune) { .yesExchangeFortune) {
return parseFloat((this.courseInfoItem.coursePrice / this.intergralInfo.preFortune)).toFixed(2) return parseFloat((this.courseInfoItem.coursePrice / this.intergralInfo.preFortune)).toFixed(2)
} else { } else {
return this.intergralInfo.yesExchangeFortune return this.intergralInfo.yesExchangeFortune
} }
} }
}, },
methods: { methods: {
goBack() { goBack() {
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}); });
}, },
// 支付 // 支付
pay() { pay() {
if (this.paymentBtnDisabled) { if (this.paymentBtnDisabled) {
return false; return false;
} }
this.paymentBtnDisabled = true; this.paymentBtnDisabled = true;
let param = { let param = {
orderId: this.orderId, orderId: this.orderId,
amount: this.isRedirect == 1 ? this.calculatedPrice : this.totalPrice, amount: this.isRedirect == 1 ? this.calculatedPrice : this.totalPrice,
paymentMethod: this.paymentMethod, paymentMethod: this.paymentMethod,
userId: this.userId, userId: this.userId,
integralExchange: this.isDeduction == "true" ? this.deductionCore : 0, integralExchange: this.isDeduction == "true" ? this.deductionCore : 0,
paymentType: '', paymentType: '',
isPayOrAuth: '', isPayOrAuth: '',
fileId: this.fileId fileId: this.fileId
} }
if (this.paymentMethod == 1) { if (this.paymentMethod == 1) {
// APP:微信app支付 // APP:微信app支付
// #ifdef APP-PLUS // #ifdef APP-PLUS
param.paymentType = 1; param.paymentType = 1;
api.unifiedPay(param).then(res => { api.unifiedPay(param).then(res => {
console.log(res) console.log(res)
this.paymentBtnDisabled = false; this.paymentBtnDisabled = false;
}) })
// #endif // #endif
// #ifdef H5 // #ifdef H5
param.paymentType = 2; param.paymentType = 2;
//deviceType:PC为1,移动端为2,微信为3 //deviceType:PC为1,移动端为2,微信为3
if (this.deviceType == 3) { if (this.deviceType == 3) {
let _this = this let _this = this
param.isPayOrAuth = 1; param.isPayOrAuth = 1;
// } else { // } else {
api.wxAuthorize(param).then((res) => { api.wxAuthorize(param).then((res) => {
_this.paymentBtnDisabled = false; _this.paymentBtnDisabled = false;
if (res['success']) { if (res['success']) {
if (param.amount == '0.00') { if (param.amount == '0.00') {
uni.navigateTo({ uni.navigateTo({
url: `/pages/orderStatus/orderStatus?orderId=${_this.orderId}&fileId=${_this.fileId}&orderStatus=2&userId=${_this.userId}` url: `/pages/orderStatus/orderStatus?orderId=${_this.orderId}&fileId=${_this.fileId}&orderStatus=2&userId=${_this.userId}`
}) })
return false return false
} else { } else {
window.location.href = res['data']['paymentForm']['action']; window.location.href = res['data']['paymentForm']['action'];
} }
} }
}) })
// } // }
} else { } else {
//微信二维码支付 //微信二维码支付
} }
// #endif // #endif
} else if (this.paymentMethod == 2) { } else if (this.paymentMethod == 2) {
// APP:支付宝app支付 // APP:支付宝app支付
// #ifdef APP-PLUS // #ifdef APP-PLUS
param.paymentType = 1; param.paymentType = 1;
api.unifiedPay(param).then(res => { api.unifiedPay(param).then(res => {
this.paymentBtnDisabled = false; this.paymentBtnDisabled = false;
if (res['success']) { if (res['success']) {
const aliOrderString = res['data']['aliOrderString']; const aliOrderString = res['data']['aliOrderString'];
let _this = this let _this = this
if (aliOrderString) { if (aliOrderString) {
uni.requestPayment({ uni.requestPayment({
provider: 'alipay', provider: 'alipay',
orderInfo: aliOrderString, orderInfo: aliOrderString,
success: function(resp) { success: function(resp) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/orderStatus/orderStatus?orderId=${_this.orderId}&fileId=${_this.fileId}&orderStatus=2&userId=${_this.userId}&isRedirect=1` url: `/pages/orderStatus/orderStatus?orderId=${_this.orderId}&fileId=${_this.fileId}&orderStatus=2&userId=${_this.userId}&isRedirect=1`
}) })
}, },
fail: function(err) { fail: function(err) {
console.log('fail:' + JSON.stringify(err)); console.log('fail:' + JSON.stringify(err));
uni.navigateTo({ uni.navigateTo({
url: `/pages/orderStatus/orderStatus?orderId=${_this.orderId}&fileId=${_this.fileId}&orderStatus=1&userId=${_this.userId}&isRedirect=1` url: `/pages/orderStatus/orderStatus?orderId=${_this.orderId}&fileId=${_this.fileId}&orderStatus=1&userId=${_this.userId}&isRedirect=1`
}) })
} }
}); });
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: `/pages/orderStatus/orderStatus?orderId=${this.orderId}&fileId=${this.fileId}&orderStatus=2&userId=${this.userId}&isRedirect=1` url: `/pages/orderStatus/orderStatus?orderId=${this.orderId}&fileId=${this.fileId}&orderStatus=2&userId=${this.userId}&isRedirect=1`
}) })
} }
} else { } else {
uni.showModal({ uni.showModal({
content: res['message'], content: res['message'],
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
console.log('用户点击确定'); console.log('用户点击确定');
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消'); console.log('用户点击取消');
} }
} }
}); });
} }
}) })
// #endif // #endif
//#ifdef H5 //#ifdef H5
//支付宝h5支付 //支付宝h5支付
param.paymentType = 2; param.paymentType = 2;
this.amount = this.totalPrice; this.amount = this.totalPrice;
if (this.deviceType == 3) { if (this.deviceType == 3) {
if (param.amount == '0.00') { if (param.amount == '0.00') {
this.getunifiedPay(param) this.getunifiedPay(param)
return false return false
} else { } else {
this.tipsFlag = true; this.tipsFlag = true;
this.amount = this.totalPrice; this.amount = this.totalPrice;
this.paymentBtnDisabled = false; this.paymentBtnDisabled = false;
let deductionCore = this.isDeduction == "true" ? parseFloat(this.deductionCore) : 0; let deductionCore = this.isDeduction == "true" ? parseFloat(this.deductionCore) : 0;
let url = window.location.href + let url = window.location.href +
`&isRedirect=1&amount=${this.amount}&isDeduction=${this.isDeduction}&deductionCore=${deductionCore}&jumptime=${new Date()}`; `&isRedirect=1&amount=${this.amount}&isDeduction=${this.isDeduction}&deductionCore=${deductionCore}&jumptime=${new Date()}`;
window.history.replaceState(null, '', url); window.history.replaceState(null, '', url);
return; return;
} }
} }
this.getunifiedPay(param) this.getunifiedPay(param)
//#endif //#endif
} }
}, },
getunifiedPay(param){ getunifiedPay(param){
api.unifiedPay(param).then((res) => { api.unifiedPay(param).then((res) => {
const data = res['data']; const data = res['data'];
this.paymentBtnDisabled = false; this.paymentBtnDisabled = false;
if (res['success']) { if (res['success']) {
if (data.orderStatus != null && data.orderStatus != '') { if (data.orderStatus != null && data.orderStatus != '') {
uni.navigateTo({ uni.navigateTo({
url: `/pages/orderStatus/orderStatus?orderId=${this.orderId}&fileId=${this.fileId}&orderStatus=2&userId=${this.userId}` url: `/pages/orderStatus/orderStatus?orderId=${this.orderId}&fileId=${this.fileId}&orderStatus=2&userId=${this.userId}`
}) })
return false return false
} }
this.payForm = res['data']['aliOrderString']; this.payForm = res['data']['aliOrderString'];
this.$nextTick(() => { this.$nextTick(() => {
console.log(document.forms) console.log(document.forms)
document.forms['punchout_form'].submit(); document.forms['punchout_form'].submit();
}) })
} else { } else {
uni.showModal({ uni.showModal({
content: res['message'], content: res['message'],
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
console.log('用户点击确定'); console.log('用户点击确定');
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消'); console.log('用户点击取消');
} }
} }
}); });
} }
}) })
}, },
// 积分查询 // 积分查询
queryByUserIdFortuneStatistic() { queryByUserIdFortuneStatistic() {
api.queryByUserIdFortuneStatistic({ api.queryByUserIdFortuneStatistic({
userId: this.userId userId: this.userId
}).then(res => { }).then(res => {
if (res['success']) { if (res['success']) {
this.intergralInfo = res['data']; this.intergralInfo = res['data'];
this.intergralInfo.preFortune = 1.0; this.intergralInfo.preFortune = 1.0;
} }
}) })
}, },
// 课程详情页面 // 课程详情页面
courseDetail() { courseDetail() {
api.courseDetail({ api.courseDetail({
fileId: this.fileId, fileId: this.fileId,
userId: this.userId userId: this.userId
}).then(res => { }).then(res => {
console.log('课程详情', res); console.log('课程详情', res);
if (res['success']) { if (res['success']) {
this.courseInfoItem = res['data']['data']; this.courseInfoItem = res['data']['data'];
} }
}) })
}, },
// 选择支付方式 // 选择支付方式
selectPaymentMethod(value) { selectPaymentMethod(value) {
this.paymentMethod = value; this.paymentMethod = value;
}, },
// 从下往上弹出 // 从下往上弹出
toggle(val, type) { toggle(val, type) {
// type 1为积分抵扣规则,2为优惠详情 // type 1为积分抵扣规则,2为优惠详情
this.popupType = val; this.popupType = val;
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性 // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
if (this.popupType === 3) { if (this.popupType === 3) {
if (this.isDeduction) { if (this.isDeduction) {
this.$refs.popup1.open(type); this.$refs.popup1.open(type);
} }
} else { } else {
this.$refs.popup.open(type); this.$refs.popup.open(type);
} }
if (this.popupType === 1) { if (this.popupType === 1) {
this.popupTitle = '积分抵扣规则' this.popupTitle = '积分抵扣规则'
} else if (this.popupType === 2) { } else if (this.popupType === 2) {
this.popupTitle = '优惠详情' this.popupTitle = '优惠详情'
} else if (this.popupType === 3) { } else if (this.popupType === 3) {
this.popupTitle = '积分兑换' this.popupTitle = '积分兑换'
} }
}, },
// 关闭弹出层 // 关闭弹出层
closePopup(val) { closePopup(val) {
if (val === 1) { if (val === 1) {
this.$refs.popup.close() this.$refs.popup.close()
if(this.isDeduction == 'true'){ if(this.isDeduction == 'true'){
this.toggle(3,'center') this.toggle(3,'center')
} }
} else { } else {
this.$refs.popup1.close() this.$refs.popup1.close()
} }
}, },
// 选择是否抵扣 // 选择是否抵扣
selectDeduction(type) { selectDeduction(type) {
this.isDeduction = String(type); this.isDeduction = String(type);
}, },
// 确认积分兑换 // 确认积分兑换
confirmIntergralDeduction() { confirmIntergralDeduction() {
}, },
}, },
onLoad(option) { onLoad(option) {
this.fileId = option.fileId; this.fileId = option.fileId;
this.orderId = option.orderId; this.orderId = option.orderId;
if (option.userId) { if (option.userId) {
this.userId = option.userId this.userId = option.userId;
} }
this.courseDetail(); this.isRedirect = option.isRedirect;
this.queryByUserIdFortuneStatistic() if (this.isRedirect == 1 && uni.getStorageSync('cffp_userId')) {
this.deviceType = common.checkDeviceType(); uni.request({
if (this.deviceType == 3) { url: '/api/authorize/obtainToken',
this.paymentMethod = 1; method: 'POST',
} data: {ticket:'uni-app', loginId:uni.getStorageSync('cffp_userId')},
this.isRedirect = option.isRedirect; success: (res) => {
if (this.isRedirect == 1) { if (res.statusCode === 200) {
this.deductionCore = option.deductionCore; uni.setStorageSync('uni-token', res.data['data']['token']);
this.amount = Number(option.amount); uni.setStorageSync('isLogin','1');
this.isDeduction = String(option.isDeduction); uni.setStorageSync('isH5', 1);
this.calculatedPrice = Number(this.amount); }
setTimeout(() => { }
this.pay(); });
}, 500) }
} this.courseDetail();
}, this.queryByUserIdFortuneStatistic()
mounted() {} this.deviceType = common.checkDeviceType();
} if (this.deviceType == 3) {
</script> this.paymentMethod = 1;
}
<style lang="scss"> if (this.isRedirect == 1) {
.container { this.deductionCore = option.deductionCore;
position: relative; this.amount = Number(option.amount);
height: 95vh; this.isDeduction = String(option.isDeduction);
this.calculatedPrice = Number(this.amount);
.courseItemBox { setTimeout(() => {
padding: 20rpx 30rpx; this.pay();
background-color: #fff; }, 500)
} }
},
.popup-content { mounted() {}
.title { }
display: flex; </script>
justify-content: space-between;
align-items: baseline; <style lang="scss">
.container {
h3 { position: relative;
text-align: center; height: 95vh;
color: #333;
font-size: 32rpx; .courseItemBox {
margin-bottom: 30rpx; padding: 20rpx 30rpx;
} background-color: #fff;
}
.iconfont {
color: #999; .popup-content {
} .title {
} display: flex;
justify-content: space-between;
text { align-items: baseline;
color: #666;
font-size: 30rpx; h3 {
} text-align: center;
color: #333;
.deductionInfoItem { font-size: 32rpx;
display: flex; margin-bottom: 30rpx;
justify-content: space-between; }
align-items: center;
color: #333; .iconfont {
font-size: 30rpx; color: #999;
padding: 10rpx 30rpx; }
background-color: #F5f5f5; }
border-radius: 20rpx;
min-height: 90rpx; text {
margin-top: 30rpx; color: #666;
font-size: 30rpx;
.integralInfoBox { }
display: flex;
flex-direction: column; .deductionInfoItem {
margin-left: 10rpx; display: flex;
justify-content: space-between;
text { align-items: center;
font-size: 30rpx; color: #333;
color: #333333; font-size: 30rpx;
} padding: 10rpx 30rpx;
background-color: #F5f5f5;
.deductionCount { border-radius: 20rpx;
font-size: 36rpx; min-height: 90rpx;
color: #F15A1F; margin-top: 30rpx;
}
} .integralInfoBox {
display: flex;
.selectRadio { flex-direction: column;
color: #D8D8D8; margin-left: 10rpx;
width: 40rpx;
height: 40rpx; text {
border: 1px solid #D8D8D8; font-size: 30rpx;
border-radius: 50%; color: #333333;
display: flex; }
justify-content: center;
align-items: center; .deductionCount {
} font-size: 36rpx;
color: #F15A1F;
&.actived { }
border: 3rpx solid #20269B; }
background-color: #fff;
.selectRadio {
.selectRadio { color: #D8D8D8;
background-color: #20269B; width: 40rpx;
color: #fff; height: 40rpx;
} border: 1px solid #D8D8D8;
} border-radius: 50%;
display: flex;
} justify-content: center;
align-items: center;
.integralDeductionContent { }
.intergralItem {
display: flex; &.actived {
justify-content: space-between; border: 3rpx solid #20269B;
margin-bottom: 10rpx; background-color: #fff;
}
} .selectRadio {
background-color: #20269B;
.confirmBtn { color: #fff;
border-radius: 80rpx; }
height: 80rpx; }
width: 60%;
background-color: #20269B; }
color: #fff;
margin: 64rpx auto 0; .integralDeductionContent {
display: flex; .intergralItem {
justify-content: center; display: flex;
align-items: center; justify-content: space-between;
} margin-bottom: 10rpx;
} }
}
.popup1-content {
padding: 30rpx 34rpx 20rpx 42rpx; .confirmBtn {
border-radius: 20rpx; border-radius: 80rpx;
height: 80rpx;
.title { width: 60%;
display: flex; background-color: #20269B;
justify-content: space-between; color: #fff;
align-items: baseline; margin: 64rpx auto 0;
display: flex;
h3 { justify-content: center;
text-align: center; align-items: center;
color: #333; }
font-size: 32rpx; }
margin-bottom: 30rpx;
} .popup1-content {
padding: 30rpx 34rpx 20rpx 42rpx;
.iconfont { border-radius: 20rpx;
color: #999;
} .title {
} display: flex;
justify-content: space-between;
.integralDeductionContent { align-items: baseline;
.intergralItem {
display: flex; h3 {
justify-content: space-between; text-align: center;
color: #333; color: #333;
font-size: 30rpx; font-size: 32rpx;
margin-bottom: 10rpx; margin-bottom: 30rpx;
} }
}
.iconfont {
.confirmBtn { color: #999;
border-radius: 80rpx; }
height: 80rpx; }
width: 60%;
background-color: #20269B; .integralDeductionContent {
color: #fff; .intergralItem {
margin: 64rpx auto 0; display: flex;
display: flex; justify-content: space-between;
justify-content: center; color: #333;
align-items: center; font-size: 30rpx;
} margin-bottom: 10rpx;
} }
}
.priceInfoContent,
.paymentMethodContent, .confirmBtn {
.totalContent { border-radius: 80rpx;
background-color: #fff; height: 80rpx;
margin: 0 10rpx; width: 60%;
padding: 20rpx; background-color: #20269B;
} color: #fff;
margin: 64rpx auto 0;
.priceInfoContent { display: flex;
view { justify-content: center;
display: flex; align-items: center;
justify-content: space-between; }
}
text {
&:last-child { .priceInfoContent,
font-weight: bold; .paymentMethodContent,
} .totalContent {
background-color: #fff;
&.integralBox { margin: 0 10rpx;
color: #FA6900; padding: 20rpx;
font-weight: normal; }
.iconfont { .priceInfoContent {
color: #999; view {
} display: flex;
} justify-content: space-between;
}
text {
.iconfont { &:last-child {
margin-left: 10rpx; font-weight: bold;
} }
} &.integralBox {
} color: #FA6900;
font-weight: normal;
.priceInfoContent,
.paymentMethodContent { .iconfont {
border-bottom: 5px solid #fbfbfb; color: #999;
color: #333; }
}
h4 { }
font-size: 32rpx;
margin-bottom: 20rpx; .iconfont {
} margin-left: 10rpx;
}
view {
margin-bottom: 10rpx; }
} }
}
.priceInfoContent,
.paymentMethodContent { .paymentMethodContent {
.paymentItem { border-bottom: 5px solid #fbfbfb;
display: flex; color: #333;
align-items: center;
justify-content: space-between; h4 {
font-size: 32rpx;
view { margin-bottom: 20rpx;
display: flex; }
align-items: center;
} view {
margin-bottom: 10rpx;
.icon-zhifubao { }
color: #5A9EF7; }
font-size: 60rpx;
margin-right: 20rpx; .paymentMethodContent {
} .paymentItem {
display: flex;
.icon-py_weixinzhifu { align-items: center;
color: #09BB07; justify-content: space-between;
font-size: 60rpx;
margin-right: 20rpx; view {
} display: flex;
align-items: center;
.selectRadio { }
width: 40rpx;
height: 40rpx; .icon-zhifubao {
display: flex; color: #5A9EF7;
justify-content: center; font-size: 60rpx;
align-items: center; margin-right: 20rpx;
border-radius: 50%; }
border: 1px solid #D8D8D8;
color: transparent; .icon-py_weixinzhifu {
color: #09BB07;
&.actived { font-size: 60rpx;
background-color: #0A2F99; margin-right: 20rpx;
color: #fff; }
}
} .selectRadio {
width: 40rpx;
} height: 40rpx;
} display: flex;
justify-content: center;
.totalContent { align-items: center;
position: absolute; border-radius: 50%;
bottom: 0; border: 1px solid #D8D8D8;
left: 0; color: transparent;
width: 100%;
padding: 40rpx 28rpx; &.actived {
display: flex; background-color: #0A2F99;
align-items: center; color: #fff;
justify-content: space-between; }
box-sizing: border-box; }
.priceInfoBox { }
font-size: 30rpx; }
color: #333;
.totalContent {
view:first-child { position: absolute;
margin-bottom: 10rpx; bottom: 0;
} left: 0;
} width: 100%;
padding: 40rpx 28rpx;
.confirmOrder { display: flex;
background-color: #20269B; align-items: center;
color: #fff; justify-content: space-between;
padding: 14rpx 38rpx; box-sizing: border-box;
border-radius: 80rpx;
} .priceInfoBox {
font-size: 30rpx;
.gray { color: #333;
background: #666;
} view:first-child {
} margin-bottom: 10rpx;
}
} }
.markBox { .confirmOrder {
position: fixed; background-color: #20269B;
left: 0; color: #fff;
top: 0; padding: 14rpx 38rpx;
bottom: 0; border-radius: 80rpx;
right: 0; }
width: 100%;
height: 100%; .gray {
color: #fff; background: #666;
display: flex; }
justify-content: flex-end; }
z-index: 100000;
background: rgba(0, 0, 0, 0.8); }
.icon-liulanqi{
margin: 0px 10rpx; .markBox {
color: #3b43d5; position: fixed;
background: #fff; left: 0;
padding: 6rpx; top: 0;
border-radius: 8rpx; bottom: 0;
font-size: 36rpx; right: 0;
} width: 100%;
.guideImgBox { height: 100%;
margin: 20px auto; color: #fff;
display: flex;
uni-image { justify-content: flex-end;
width: 25% !important; z-index: 100000;
position: absolute; background: rgba(0, 0, 0, 0.8);
right: 0; .icon-liulanqi{
top: 0; margin: 0px 10rpx;
} color: #3b43d5;
} background: #fff;
padding: 6rpx;
.tips { border-radius: 8rpx;
margin-top: 20%; font-size: 36rpx;
padding: 0 30px; }
} .guideImgBox {
} margin: 20px auto;
// .iconfont { uni-image {
// position: absolute; width: 25% !important;
// right: 8%; position: absolute;
// font-size: 40px; right: 0;
// top: 2px; top: 0;
// font-weight: bold; }
// } }
.tips p {
font-size: 18px; .tips {
margin-top: 10px; margin-top: 20%;
text-align: justify; padding: 0 30px;
letter-spacing: 1px; }
} }
</style>
// .iconfont {
// position: absolute;
// right: 8%;
// font-size: 40px;
// top: 2px;
// font-weight: bold;
// }
.tips p {
font-size: 18px;
margin-top: 10px;
text-align: justify;
letter-spacing: 1px;
}
</style>
// import {baseURL,apiURL,cffpURL} from "../environments/environment"; // import {baseURL,apiURL,cffpURL} from "../environments/environment";
// 白名单,不需要携带token就允许被访问的接口 // 白名单,不需要携带token就允许被访问的接口
const whiteApiList = [`/api/authorize/obtainToken`, `/api/authorize/checkToken`]; const whiteApiList = [`/api/authorize/obtainToken`, `/api/authorize/checkToken`];
export const interceptor = () => { export const interceptor = () => {
uni.addInterceptor('request', { uni.addInterceptor('request', {
// 请求拦截器 // 请求拦截器
invoke(args) { invoke(args) {
// console.log('请求拦截器',args); // console.log('请求拦截器',args);
// 加载loading // 加载loading
// uni.showLoading({ // uni.showLoading({
// title: '加载中...' // title: '加载中...'
// }); // });
// 当本地没有token,并且接口地址没在白名单内,需要重新获取token // 当本地没有token,并且接口地址没在白名单内,需要重新获取token
if (!uni.getStorageSync('uni-token') && !whiteApiList.includes(args.url)) { if (!uni.getStorageSync('uni-token') && !whiteApiList.includes(args.url)) {
uni.request({ const params = {
url: '/api/authorize/obtainToken', ticket:'uni-app',
method: 'POST', loginId:null
data: { ticket: 'uni-app' }, }
success: (res) => { let h5userId = uni.getStorageSync('cffp_userId');
if (res.statusCode === 200) { if (h5userId) {
uni.setStorageSync('uni-token', res.data['data']['token']); params.loginId = h5userId;
window.location.href = window.location.href + '?' + 't_reload=' + new Date().getTime(); }
} uni.request({
// console.log(res) url: '/api/authorize/obtainToken',
} method: 'POST',
}) data: params,
// uni.hideLoading(); success: (res) => {
} if (res.statusCode === 200) {
// request 触发前拼接 url uni.setStorageSync('uni-token', res.data['data']['token']);
window.location.href = window.location.href + '?' + 't_reload=' + new Date().getTime();
//设置请求头及token }
args.header = { }
'content-type': args.method === 'POST' ? 'application/json' : 'application/x-www-form-urlencoded', })
'X-Authorization': uni.getStorageSync('uni-token') ? uni.getStorageSync('uni-token') : '', }
// 'Access-Control-Allow-Headers': 'appId', // request 触发前拼接 url
// 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
// 'Access-Control-Max-Age': 86400, //设置请求头及token
} args.header = {
// console.log(args.header) 'content-type': args.method === 'POST' ? 'application/json' : 'application/x-www-form-urlencoded',
}, 'X-Authorization': uni.getStorageSync('uni-token') ? uni.getStorageSync('uni-token') : '',
// 'Access-Control-Allow-Headers': 'appId',
// 响应拦截器,可以对数据进行预处理 // 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
success() { // 'Access-Control-Max-Age': 86400,
// uni.hideLoading() }
// console.log(args); // console.log(args.header)
}, },
fail() {
// console.log('interceptor-fail', err) // 响应拦截器,可以对数据进行预处理
// console.log('请求失败') success() {
// uni.hideLoading() // uni.hideLoading()
}, // console.log(args);
complete() { },
// uni.hideLoading() fail() {
} // console.log('interceptor-fail', err)
}) // console.log('请求失败')
} // uni.hideLoading()
},
complete() {
// uni.hideLoading()
}
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment