|
|
@ -62,16 +62,16 @@ |
|
|
<view class="iconfont icon-friendfill text-pink icon"></view> |
|
|
<view class="iconfont icon-friendfill text-pink icon"></view> |
|
|
<text class="text">绑定充值卡</text> |
|
|
<text class="text">绑定充值卡</text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="action-item" @click="handleGetCardInfo"> |
|
|
<!-- <view class="action-item" @click="handleGetCardInfo"> |
|
|
<view class="iconfont icon-community text-blue icon"></view> |
|
|
<view class="iconfont icon-community text-blue icon"></view> |
|
|
<text class="text">获取充值卡信息</text> |
|
|
<text class="text">获取充值卡信息</text> |
|
|
</view> |
|
|
</view> --> |
|
|
<view class="action-item" @click="handleGetRealNameUrl"> |
|
|
<view class="action-item" @click="handleGetRealNameUrl"> |
|
|
<view class="iconfont icon-service text-mauve icon"></view> |
|
|
<view class="iconfont icon-service text-mauve icon"></view> |
|
|
<text class="text">点击实名</text> |
|
|
<text class="text">点击实名</text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="action-item" @click="handleJump"> |
|
|
<view class="action-item" @click="handleJump"> |
|
|
<view class="iconfont icon-service text-mauve icon"></view> |
|
|
<view class="iconfont icon-community text-mauve icon"></view> |
|
|
<text class="text">一键授权</text> |
|
|
<text class="text">一键授权</text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
@ -79,7 +79,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view> |
|
|
<view> |
|
|
<uni-popup ref="popup" type="dialog"> |
|
|
<uni-popup ref="rechargePopup" type="dialog"> |
|
|
<uni-popup-dialog |
|
|
<uni-popup-dialog |
|
|
type="info" |
|
|
type="info" |
|
|
cancelText="关闭" |
|
|
cancelText="关闭" |
|
|
@ -97,6 +97,28 @@ |
|
|
/> |
|
|
/> |
|
|
</uni-popup-dialog> |
|
|
</uni-popup-dialog> |
|
|
</uni-popup> |
|
|
</uni-popup> |
|
|
|
|
|
<uni-popup ref="confirmPopup" type="center" background-color="#fff" class="confirmPopup-box"> |
|
|
|
|
|
<uni-popup-dialog |
|
|
|
|
|
type="info" |
|
|
|
|
|
cancelText="关闭" |
|
|
|
|
|
confirmText="确认" |
|
|
|
|
|
title="" |
|
|
|
|
|
content="" |
|
|
|
|
|
@confirm="confirmPurchase" |
|
|
|
|
|
@close="cancelPurchase"> |
|
|
|
|
|
<text>确认购买 {{ selectedPackage.thaliGroupName }} 吗?</text> |
|
|
|
|
|
</uni-popup-dialog> |
|
|
|
|
|
</uni-popup> |
|
|
|
|
|
|
|
|
|
|
|
<uni-popup ref="selectPopup" type="bottom" background-color="#fff" class="selectPopup-box"> |
|
|
|
|
|
<view class="popup-content"> |
|
|
|
|
|
<text>套餐名称: {{ selectedPackage.thaliGroupName }}</text> |
|
|
|
|
|
<text>价格: {{ selectedPackage.thaliPayPrice }}</text> |
|
|
|
|
|
<button @click="purchasePackage" class="buy-button">立即购买</button> |
|
|
|
|
|
</view> |
|
|
|
|
|
</uni-popup> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
@ -105,15 +127,21 @@ import { ref, reactive,onMounted } from 'vue'; |
|
|
import modal from "@/plugins/modal"; |
|
|
import modal from "@/plugins/modal"; |
|
|
import { getToken, setToken, removeToken } from "@/utils/auth"; |
|
|
import { getToken, setToken, removeToken } from "@/utils/auth"; |
|
|
import { userBindRechargeNum,getRechargeNum ,getRealNameUrl, getGroupPackage, recharge, getPackageSort} from '@/api/card' |
|
|
import { userBindRechargeNum,getRechargeNum ,getRealNameUrl, getGroupPackage, recharge, getPackageSort} from '@/api/card' |
|
|
|
|
|
import { vxPay } from '@/api/vxPay' |
|
|
|
|
|
|
|
|
import config from '@/config.js' |
|
|
import config from '@/config.js' |
|
|
import useUserStore from '@/store/modules/user' |
|
|
import useUserStore from '@/store/modules/user' |
|
|
|
|
|
import pay from "@/pages/wechat/wxpayUtils"; |
|
|
|
|
|
|
|
|
const userStore = useUserStore() |
|
|
const userStore = useUserStore() |
|
|
const name = userStore.name; |
|
|
const name = userStore.name; |
|
|
const version = config.appInfo.version; |
|
|
const version = config.appInfo.version; |
|
|
|
|
|
|
|
|
const avatar = ref(userStore.avatar); |
|
|
const avatar = ref(userStore.avatar); |
|
|
const windowHeight = ref(uni.getSystemInfoSync().windowHeight - 50); |
|
|
const windowHeight = ref(uni.getSystemInfoSync().windowHeight - 50); |
|
|
const popup = ref(null); |
|
|
const rechargePopup = ref(null); |
|
|
|
|
|
const selectPopup = ref(null); |
|
|
|
|
|
const confirmPopup = ref(null); |
|
|
const rechargeNum = ref('') |
|
|
const rechargeNum = ref('') |
|
|
const token = ref(''); |
|
|
const token = ref(''); |
|
|
const iccid = ref('') |
|
|
const iccid = ref('') |
|
|
@ -121,6 +149,8 @@ const endTime = ref('') |
|
|
const packageName = ref('') |
|
|
const packageName = ref('') |
|
|
const thaliGroupId = ref('') |
|
|
const thaliGroupId = ref('') |
|
|
const packageList = ref([]) |
|
|
const packageList = ref([]) |
|
|
|
|
|
const selectedPackage = ref(null); |
|
|
|
|
|
const orderNumber = ref('') |
|
|
|
|
|
|
|
|
const leftTab = ref({ |
|
|
const leftTab = ref({ |
|
|
name: undefined, |
|
|
name: undefined, |
|
|
@ -212,12 +242,11 @@ function handleAbout() { |
|
|
|
|
|
|
|
|
// 绑定充值卡 |
|
|
// 绑定充值卡 |
|
|
function handleBind() { |
|
|
function handleBind() { |
|
|
popup.value.open() |
|
|
rechargePopup.value.open() |
|
|
// rechargeNum.value = '' |
|
|
// rechargeNum.value = '' |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取充值卡信息 |
|
|
// 获取充值卡信息 |
|
|
function handleGetCardInfo() { |
|
|
function handleGetCardInfo() { |
|
|
// const data = rechargeNum.value |
|
|
// const data = rechargeNum.value |
|
|
@ -245,8 +274,10 @@ function handleGetRealNameUrl() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function handleJump() { |
|
|
function handleJump() { |
|
|
const URL = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx6aeb90e7fd5d434e&redirect_uri=https%3A%2F%2Fwxgzh.youpin5g.net&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect' |
|
|
const appid = 'wx6aeb90e7fd5d434e' |
|
|
location.href = URL |
|
|
const redirect_uri = encodeURIComponent("https://trade.youpin5g.com/#/") |
|
|
|
|
|
location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect` |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -283,7 +314,8 @@ function handleLeftTab() { |
|
|
packageList.value = res.data.map(item => { |
|
|
packageList.value = res.data.map(item => { |
|
|
return { |
|
|
return { |
|
|
thaliGroupName: item.thaliGroupName, |
|
|
thaliGroupName: item.thaliGroupName, |
|
|
thaliPayPrice: item.thaliPayPrice |
|
|
thaliPayPrice: item.thaliPayPrice, |
|
|
|
|
|
thaliId:item.id, |
|
|
}; |
|
|
}; |
|
|
}); |
|
|
}); |
|
|
}).catch(error => { |
|
|
}).catch(error => { |
|
|
@ -300,7 +332,8 @@ function handleRightTab() { |
|
|
packageList.value = res.data.map(item => { |
|
|
packageList.value = res.data.map(item => { |
|
|
return { |
|
|
return { |
|
|
thaliGroupName: item.thaliGroupName, |
|
|
thaliGroupName: item.thaliGroupName, |
|
|
thaliPayPrice: item.thaliPayPrice |
|
|
thaliPayPrice: item.thaliPayPrice, |
|
|
|
|
|
thaliId:item.id, |
|
|
}; |
|
|
}; |
|
|
}); |
|
|
}); |
|
|
}).catch(error => { |
|
|
}).catch(error => { |
|
|
@ -311,30 +344,57 @@ function handleRightTab() { |
|
|
|
|
|
|
|
|
function selectPackage(index) { |
|
|
function selectPackage(index) { |
|
|
console.log("选中的套餐:", packageList.value[index]); |
|
|
console.log("选中的套餐:", packageList.value[index]); |
|
|
|
|
|
selectedPackage.value = packageList.value[index]; |
|
|
|
|
|
selectPopup.value.open(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 创建订单,预支付 |
|
|
|
|
|
function purchasePackage() { |
|
|
|
|
|
|
|
|
|
|
|
const formData = new FormData(); |
|
|
|
|
|
formData.append('rechargeNum', rechargeNum.value); |
|
|
|
|
|
formData.append('thaliId', selectedPackage.value.thaliId); |
|
|
|
|
|
|
|
|
// 获取套餐种类 |
|
|
const data = { |
|
|
// function getPackageSortList() { |
|
|
rechargeNum: rechargeNum.value, |
|
|
// // const data = rechargeNum.value |
|
|
thaliId: selectedPackage.value.thaliId, |
|
|
// const data = '89861591292320027863' |
|
|
} |
|
|
// getPackageSort(data).then(res => { |
|
|
console.log(formData,901) |
|
|
// console.log(res,911) |
|
|
recharge(data).then(res =>{ |
|
|
|
|
|
orderNumber.value = res.data |
|
|
// }) |
|
|
console.log('创建订单成功:', res); |
|
|
// } |
|
|
confirmPopup.value.open(); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function confirmPurchase() { |
|
|
|
|
|
const openId = uni.getStorageSync('openid'); |
|
|
|
|
|
const paymentData = { |
|
|
|
|
|
"totalPrice": selectedPackage.value.thaliPayPrice, // 假设价格是字符串类型 |
|
|
|
|
|
"goodsName": selectedPackage.value.thaliGroupName, |
|
|
|
|
|
"openId": openId, |
|
|
|
|
|
"orderNumber": orderNumber.value, |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
vxPay(paymentData).then(res => { |
|
|
|
|
|
pay(response.data,()=>{ |
|
|
|
|
|
alert("支付成功!") |
|
|
|
|
|
}) |
|
|
|
|
|
// 处理支付成功后的逻辑,如关闭弹窗、提示支付成功等 |
|
|
|
|
|
selectPopup.value.close(); |
|
|
|
|
|
confirmPopup.value.close(); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
const userToken = getToken(); |
|
|
// const userToken = getToken(); |
|
|
if (userToken) { |
|
|
// if (userToken) { |
|
|
token.value = userToken; |
|
|
// token.value = userToken; |
|
|
} |
|
|
// } |
|
|
|
|
|
|
|
|
console.log(token,1) |
|
|
// console.log(token,1) |
|
|
|
|
|
|
|
|
handleGetCardInfo() |
|
|
handleGetCardInfo() |
|
|
getPackageSortList() |
|
|
getPackageSortList() |
|
|
@ -481,4 +541,45 @@ page { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.popup-content { |
|
|
|
|
|
padding: 20px; |
|
|
|
|
|
height: 400rpx; |
|
|
|
|
|
text-align: center; |
|
|
|
|
|
|
|
|
|
|
|
.buy-button { |
|
|
|
|
|
background-color: #e57335; |
|
|
|
|
|
color: white; |
|
|
|
|
|
padding: 10px; |
|
|
|
|
|
margin-top: 20px; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.popup-box { |
|
|
|
|
|
padding: 20px; |
|
|
|
|
|
height: 400rpx; |
|
|
|
|
|
text-align: center; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.confirm-button { |
|
|
|
|
|
background-color: #4CAF50; |
|
|
|
|
|
color: white; |
|
|
|
|
|
margin-right: 10px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.cancel-button { |
|
|
|
|
|
background-color: #f44336; |
|
|
|
|
|
color: white; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.selectPopup-box { |
|
|
|
|
|
z-index: 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.confirmPopup-box { |
|
|
|
|
|
z-index: 1000; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
</style> |
|
|
</style> |
|
|
|