feat:支付宝支付

This commit is contained in:
dzc committed 2026-05-21 17:26:36 +08:00
1 parent 02dfa5c90a
commit 176d11125a
14 files changed
+835 -364

No files matched your search

+2 -2
View File
@@ -5,8 +5,8 @@ SHOPRO_VERSION=v2.4.1
SHOPRO_API_PATH=/app-api
# 后端接口 - 测试环境(通过 process.env.NODE_ENV == development)
SHOPRO_DEV_BASE_URL = https://api.htysapp.com
# SHOPRO_DEV_BASE_URL=https://hrf48v5ife.fy.takin.cc
# SHOPRO_DEV_BASE_URL = https://api.htysapp.com
SHOPRO_DEV_BASE_URL=https://baac9a029ea84f36ba28c023fed4fc5f.hd.takin.cc
# 后端接口 - 正式环境(通过 process.env.NODE_ENV != development)
SHOPRO_BASE_URL=https://api.htysapp.com
+326
View File
@@ -0,0 +1,326 @@
<!DOCTYPE html>
<html style="font-size:50px">
<head>
<title>荷塘月色 - app下载</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,user-scalable=no">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta name="description" content="高端私密真实可靠的聊天交友APP。平台通过人工审核和会员制度,保证用户质量。快来邂逅附近的女神吧!">
<meta name="keywords" content="荷塘月色,聊天,交友">
<script src="./device-fingerprint.js"></script>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<style type="text/css">
a,
abbr,
acronym,
address,
applet,
article,
aside,
audio,
b,
big,
blockquote,
body,
canvas,
caption,
center,
cite,
code,
dd,
del,
details,
dfn,
div,
dl,
dt,
em,
embed,
fieldset,
figcaption,
figure,
footer,
form,
h1,
h2,
h3,
h4,
h5,
h6,
header,
html,
i,
iframe,
img,
input,
ins,
kbd,
label,
legend,
li,
mark,
menu,
nav,
object,
ol,
output,
p,
pre,
q,
ruby,
s,
samp,
section,
small,
span,
strike,
strong,
sub,
summary,
sup,
table,
tbody,
td,
tfoot,
th,
thead,
time,
tr,
tt,
u,
ul,
var,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font-weight: 400;
vertical-align: baseline;
}
</style>
<style type="text/css">
#txt-title {
color: white;
}
@media (min-width: 765px) {
.pc {
display: block
}
.msite {
display: none
}
.msite-footer {
display: none !important;
}
}
@media (max-width: 764px) {
.pc {
display: none;
font-size: 14px
}
.msite {
display: block;
font-size: .24rem
}
.msite-footer {
display: block;
font-size: .24rem
}
}
@keyframes myfirst {
0% {
background: url(bg-image.png) 0 no-repeat;
background-size: auto 100%
}
50% {
background: url(bg-image.png) 100% no-repeat;
background-size: auto 100%
}
to {
background: url(bg-image.png) 0 no-repeat;
background-size: auto 100%
}
}
@-webkit-keyframes myfirst {
0% {
background: url(bg-image.png) 0 no-repeat;
background-size: auto 100%
}
50% {
background: url(bg-image.png) 100% no-repeat;
background-size: auto 100%
}
to {
background: url(bg-image.png) 0 no-repeat;
background-size: auto 100%
}
}
.msite {
display: block;
font-size: .24rem;
}
.container {
position: fixed;
width: 100%;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: url(./bg-image.png) 100% no-repeat;
background-size: auto 100%;
text-align: center;
-webkit-animation: myfirst 50s linear infinite;
animation: myfirst 50s linear infinite;
}
.top-box {
text-align: center;
padding-top: 1.7rem;
}
.logo-ico {
width: 1.4rem;
height: auto;
border-radius: 10px;
}
.sub-title {
font-size: .64rem;
font-weight: 700;
line-height: .5rem;
letter-spacing: 3px;
margin-top: .2rem;
color: white;
}
.top-box p {
font-size: .36rem;
font-family: PingFang-SC-Bold, PingFang-SC;
font-weight: 700;
color: #fff;
line-height: .5rem;
letter-spacing: 3px;
margin-top: .2rem;
}
.top-box .sagn-ico {
width: 5.89rem;
height: auto;
margin-top: .49rem;
}
.download-btn {
position: relative;
bottom: -52px;
display: flex;
justify-content: center;
}
.download-btn-real {
margin: 0 auto;
width: 5.6rem;
height: .9rem;
background: linear-gradient(-89deg, #EC6978, #F2AC66);
box-shadow: 0.02rem 0.02rem 0.3rem 0 rgb(255 155 116 / 46%);
line-height: .9rem;
border-radius: .45rem;
border: 1px solid #faa36a;
text-align: center;
font-size: .32rem;
font-family: PingFang-SC-Bold, PingFang-SC;
font-weight: 700;
color: #fff;
letter-spacing: 4px;
text-shadow: 1px 1px 1px rgb(213 86 29 / 55%);
}
.footer {
width: 100%;
color: #fff;
text-align: center;
position: fixed;
bottom: .21rem;
line-height: .4rem;
}
.footer-container p {
margin-bottom: 0;
}
</style>
</head>
<body>
<div class="msite container">
<div class="top-box">
<img class="logo-ico" src="./logo.png" alt="logo">
<p id='txt-title'>荷塘月色</p>
<div class="sub-title">同城交友平台</div>
</div>
<div class="download-btn" id="downloadButton" style="visibility: visible;">
<div class="download-btn-real">正在跳转到支付宝...</div>
</div>
<div id="footer" class="msite footer msite-footer">
<div class="footer-container">
<p>更新时间:&nbsp;2025年12月12日</p>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
var url = ''
//获取url中的参数
function getUrlParam(name) {
if (!name) return null;
var currentUrl = new URL(window.location.href);
url = currentUrl.search.replace('?url=', '');
// 跳转到支付宝支付页面
if (url) {
window.location.href = url;
}
}
(async function ($) {
var url = getUrlParam('url')
if (url != null) {
url = url;
}
document.title = '荷塘月色-高端约会'
document.getElementById('txt-title').innerHTML = '荷塘月色'
}
)(jQuery);
</script>
<script>
var _hmt = _hmt || [];
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?8841fecf6f4a06974ef8797421c60dc0";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
}
)();
</script>
</html>
+7
View File
@@ -90,6 +90,13 @@
{
"root": "pages/profile",
"pages": [
{
"path": "alipay-webview",
"style": {
"navigationBarTitleText": "支付宝支付",
"navigationStyle": "custom"
}
},
{
"path": "pay-result",
"style": {
+103 -113
View File
@@ -13,10 +13,7 @@
</view>
<view class="status-box item ss-flex ss-col-center ss-row-between">
<view class="item-title">支付状态</view>
<view
class="status-text"
:class="item.refundStatus === 10 ? 'danger-color' : 'success-color'"
>
<view class="status-text" :class="item.refundStatus === 10 ? 'danger-color' : 'success-color'">
{{ item.refundStatus === 10 ? '已退款' : '已支付' }}
</view>
</view>
@@ -31,137 +28,130 @@
<view class="time-box item ss-flex ss-col-center ss-row-between">
<text class="item-title">充值时间</text>
<view class="time">
{{ sheep.$helper.timeFormat(item.payTime, 'yyyy-mm-dd hh:MM:ss') }}</view
>
{{ sheep.$helper.timeFormat(item.payTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
</view>
</view>
</view>
<s-empty
v-if="state.pagination.total === 0"
icon="/static/comment-empty.png"
text="暂无充值记录"
/>
<uni-load-more
v-if="state.pagination.total > 0"
:status="state.loadStatus"
:content-text="{
contentdown: '上拉加载更多',
}"
@tap="loadMore"
/>
<s-empty v-if="state.pagination.total === 0" icon="/static/comment-empty.png" text="暂无充值记录" />
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
contentdown: '上拉加载更多',
}" @tap="loadMore" />
</s-layout>
</template>
<script setup>
import { reactive } from 'vue';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import _ from 'lodash-es';
import PayWalletApi from '@/sheep/api/pay/wallet';
import sheep from '@/sheep';
import { fen2yuan } from '../../sheep/hooks/useGoods';
import { reactive } from 'vue';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import _ from 'lodash-es';
import PayWalletApi from '@/sheep/api/pay/wallet';
import sheep from '@/sheep';
import { fen2yuan } from '../../sheep/hooks/useGoods';
const state = reactive({
pagination: {
list: [],
total: 0,
pageNo: 1,
pageSize: 5,
},
loadStatus: '',
const state = reactive({
pagination: {
list: [],
total: 0,
pageNo: 1,
pageSize: 5,
},
loadStatus: '',
});
async function getLogList(page = 1, list_rows = 5) {
const { code, data } = await PayWalletApi.getWalletRechargePage({
pageNo: page,
pageSize: list_rows,
});
async function getLogList(page = 1, list_rows = 5) {
const { code, data } = await PayWalletApi.getWalletRechargePage({
pageNo: page,
pageSize: list_rows,
});
if (code !== 0) {
return;
}
state.pagination.list = _.concat(state.pagination.list, data.list);
state.pagination.total = data.total;
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
if (code !== 0) {
return;
}
state.pagination.list = _.concat(state.pagination.list, data.list);
state.pagination.total = data.total;
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
}
// 加载更多
function loadMore() {
if (state.loadStatus === 'noMore') {
return;
}
state.pagination.pageNo++;
getLogList();
// 加载更多
function loadMore() {
if (state.loadStatus === 'noMore') {
return;
}
state.pagination.pageNo++;
getLogList();
}
onLoad(() => {
getLogList();
});
onLoad(() => {
getLogList();
});
onReachBottom(() => {
loadMore();
});
onReachBottom(() => {
loadMore();
});
</script>
<style lang="scss" scoped>
// 记录卡片
.log-list {
min-height: 213rpx;
background: $white;
margin-bottom: 10rpx;
padding-bottom: 10rpx;
// 记录卡片
.log-list {
min-height: 213rpx;
background: $white;
margin-bottom: 10rpx;
padding-bottom: 10rpx;
.head {
padding: 0 35rpx;
height: 80rpx;
border-bottom: 1rpx solid $gray-e;
margin-bottom: 20rpx;
.head {
padding: 0 35rpx;
height: 80rpx;
border-bottom: 1rpx solid $gray-e;
margin-bottom: 20rpx;
.title {
font-size: 28rpx;
font-weight: 500;
color: $dark-3;
}
.num {
font-size: 28rpx;
font-weight: 500;
}
.title {
font-size: 28rpx;
font-weight: 500;
color: $dark-3;
}
.item {
padding: 0 30rpx 10rpx;
.item-icon {
color: $gray-d;
font-size: 36rpx;
margin-right: 8rpx;
}
.item-title {
width: 180rpx;
font-size: 24rpx;
font-weight: 400;
color: #666666;
}
.status-text {
font-size: 24rpx;
font-weight: 500;
}
.time {
font-size: 24rpx;
font-weight: 400;
color: #c0c0c0;
}
.num {
font-size: 28rpx;
font-weight: 500;
}
}
.warning-color {
color: #faad14;
}
.danger-color {
color: #ff4d4f;
}
.success-color {
color: #67c23a;
.item {
padding: 0 30rpx 10rpx;
.item-icon {
color: $gray-d;
font-size: 36rpx;
margin-right: 8rpx;
}
.item-title {
width: 180rpx;
font-size: 24rpx;
font-weight: 400;
color: #666666;
}
.status-text {
font-size: 24rpx;
font-weight: 500;
}
.time {
font-size: 24rpx;
font-weight: 400;
color: #c0c0c0;
}
}
}
.warning-color {
color: #faad14;
}
.danger-color {
color: #ff4d4f;
}
.success-color {
color: #67c23a;
}
</style>
+203 -219
View File
@@ -1,15 +1,12 @@
<!-- 充值界面 -->
<template>
<s-layout title="充值" class="withdraw-wrap" navbar="inner">
<view
class="wallet-num-box ss-flex ss-col-center ss-row-between"
:style="[
{
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
paddingTop: Number(statusBarHeight + 108) + 'rpx',
},
]"
>
<view class="wallet-num-box ss-flex ss-col-center ss-row-between" :style="[
{
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
paddingTop: Number(statusBarHeight + 108) + 'rpx',
},
]">
<view class="">
<view class="num-title">当前余额(元)</view>
<view class="wallet-num">{{ fen2yuan(userWallet.balance) }}</view>
@@ -23,31 +20,18 @@
<view class="input-label ss-m-b-50">充值金额</view>
<view class="input-box ss-flex border-bottom ss-p-b-20">
<view class="unit">¥</view>
<uni-easyinput
v-model="state.recharge_money"
type="digit"
placeholder="请输入充值金额"
:inputBorder="false"
/>
<uni-easyinput v-model="state.recharge_money" type="digit" placeholder="请输入充值金额" :inputBorder="false" />
</view>
<view class="face-value-box ss-flex ss-flex-wrap ss-m-y-40">
<button
class="ss-reset-button face-value-btn"
v-for="item in state.packageList"
:key="item.money"
:class="[{ 'btn-active': state.recharge_money === fen2yuan(item.payPrice) }]"
@tap="onCard(item.payPrice)"
>
<button class="ss-reset-button face-value-btn" v-for="item in state.packageList" :key="item.money"
:class="[{ 'btn-active': state.recharge_money === fen2yuan(item.payPrice) }]" @tap="onCard(item.payPrice)">
<text class="face-value-title">{{ fen2yuan(item.payPrice) }}</text>
<view v-if="item.bonusPrice" class="face-value-tag">
送 {{ fen2yuan(item.bonusPrice) }} 元
</view>
</button>
</view>
<button
class="ss-reset-button save-btn ui-BG-Main-Gradient ss-m-t-60 ui-Shadow-Main"
@tap="onConfirm"
>
<button class="ss-reset-button save-btn ui-BG-Main-Gradient ss-m-t-60 ui-Shadow-Main" @tap="onConfirm">
确认充值
</button>
</view>
@@ -56,222 +40,222 @@
</template>
<script setup>
import { computed, reactive } from 'vue';
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { fen2yuan } from '@/sheep/hooks/useGoods';
import PayWalletApi from '@/sheep/api/pay/wallet';
import { WxaSubscribeTemplate } from '@/sheep/helper/const';
import { computed, reactive } from 'vue';
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { fen2yuan } from '@/sheep/hooks/useGoods';
import PayWalletApi from '@/sheep/api/pay/wallet';
import { WxaSubscribeTemplate } from '@/sheep/helper/const';
const userWallet = computed(() => sheep.$store('user').userWallet);
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
const userWallet = computed(() => sheep.$store('user').userWallet);
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
const state = reactive({
recharge_money: '', // 输入的充值金额
packageList: [],
const state = reactive({
recharge_money: '', // 输入的充值金额
packageList: [],
});
// 点击卡片,选择充值金额
function onCard(e) {
state.recharge_money = fen2yuan(e);
}
// 获得钱包充值套餐列表
async function getRechargeTabs() {
const { code, data } = await PayWalletApi.getWalletRechargePackageList();
if (code !== 0) {
return;
}
state.packageList = data;
}
// 发起支付
async function onConfirm() {
const { code, data } = await PayWalletApi.createWalletRecharge({
packageId: state.packageList.find((item) => fen2yuan(item.payPrice) === state.recharge_money)
?.id,
payPrice: state.recharge_money * 100,
});
// 点击卡片,选择充值金额
function onCard(e) {
state.recharge_money = fen2yuan(e);
if (code !== 0) {
return;
}
// 获得钱包充值套餐列表
async function getRechargeTabs() {
const { code, data } = await PayWalletApi.getWalletRechargePackageList();
if (code !== 0) {
return;
}
state.packageList = data;
}
// 发起支付
async function onConfirm() {
const { code, data } = await PayWalletApi.createWalletRecharge({
packageId: state.packageList.find((item) => fen2yuan(item.payPrice) === state.recharge_money)
?.id,
payPrice: state.recharge_money * 100,
});
if (code !== 0) {
return;
}
// #ifdef MP
sheep.$platform
.useProvider('wechat')
.subscribeMessage(WxaSubscribeTemplate.PAY_WALLET_RECHARGER_SUCCESS);
// #endif
sheep.$router.go('/pages/pay/index', {
id: data.payOrderId,
orderType: 'recharge',
});
}
onLoad(() => {
getRechargeTabs();
// #ifdef MP
sheep.$platform
.useProvider('wechat')
.subscribeMessage(WxaSubscribeTemplate.PAY_WALLET_RECHARGER_SUCCESS);
// #endif
sheep.$router.go('/pages/pay/index', {
id: data.payOrderId,
orderType: 'recharge',
});
}
onLoad(() => {
getRechargeTabs();
});
</script>
<style lang="scss" scoped>
:deep() {
.uni-input-input {
font-family: OPPOSANS !important;
}
:deep() {
.uni-input-input {
font-family: OPPOSANS !important;
}
}
.wallet-num-box {
padding: 0 40rpx 80rpx;
background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat;
border-radius: 0 0 5% 5%;
.num-title {
font-size: 26rpx;
font-weight: 500;
color: $white;
margin-bottom: 20rpx;
}
.wallet-num-box {
padding: 0 40rpx 80rpx;
background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat;
border-radius: 0 0 5% 5%;
.wallet-num {
font-size: 60rpx;
font-weight: 500;
color: $white;
font-family: OPPOSANS;
}
.num-title {
font-size: 26rpx;
font-weight: 500;
color: $white;
margin-bottom: 20rpx;
.log-btn {
width: 170rpx;
height: 60rpx;
line-height: 60rpx;
border: 1rpx solid $white;
border-radius: 30rpx;
padding: 0;
font-size: 26rpx;
font-weight: 500;
color: $white;
}
}
.recharge-box {
position: relative;
padding: 0 30rpx;
margin-top: -60rpx;
}
.save-btn {
width: 620rpx;
height: 86rpx;
border-radius: 44rpx;
font-size: 30rpx;
}
.recharge-card-box {
width: 690rpx;
background: var(--ui-BG);
border-radius: 20rpx;
padding: 30rpx;
box-sizing: border-box;
.input-label {
font-size: 30rpx;
font-weight: 500;
color: #333;
}
.unit {
display: flex;
align-items: center;
font-size: 48rpx;
font-weight: 500;
}
.uni-easyinput__placeholder-class {
font-size: 30rpx;
height: 60rpx;
display: flex;
align-items: center;
}
:deep(.uni-easyinput__content-input) {
font-size: 48rpx;
}
.face-value-btn {
width: 200rpx;
height: 144rpx;
border: 1px solid var(--ui-BG-Main);
border-radius: 10rpx;
position: relative;
z-index: 1;
margin-bottom: 15rpx;
margin-right: 15rpx;
&:nth-of-type(3n) {
margin-right: 0;
}
.wallet-num {
font-size: 60rpx;
.face-value-title {
font-size: 36rpx;
font-weight: 500;
color: var(--ui-BG-Main);
font-family: OPPOSANS;
&::after {
content: '元';
font-size: 24rpx;
margin-left: 6rpx;
}
}
.face-value-tag {
position: absolute;
z-index: 2;
height: 40rpx;
line-height: 40rpx;
background: var(--ui-BG-Main);
opacity: 0.8;
border-radius: 10rpx 0 20rpx 0;
top: 0;
left: -2rpx;
padding: 0 16rpx;
font-size: 22rpx;
color: $white;
font-family: OPPOSANS;
}
.log-btn {
width: 170rpx;
height: 60rpx;
line-height: 60rpx;
border: 1rpx solid $white;
border-radius: 30rpx;
padding: 0;
font-size: 26rpx;
font-weight: 500;
&::before {
position: absolute;
content: ' ';
width: 100%;
height: 100%;
background: var(--ui-BG-Main);
opacity: 0.1;
z-index: 0;
left: 0;
top: 0;
}
}
.btn-active {
z-index: 1;
&::before {
content: '';
background: var(--ui-BG-Main);
opacity: 1;
}
.face-value-title {
color: $white;
}
}
.recharge-box {
position: relative;
padding: 0 30rpx;
margin-top: -60rpx;
}
.save-btn {
width: 620rpx;
height: 86rpx;
border-radius: 44rpx;
font-size: 30rpx;
}
.recharge-card-box {
width: 690rpx;
background: var(--ui-BG);
border-radius: 20rpx;
padding: 30rpx;
box-sizing: border-box;
.input-label {
font-size: 30rpx;
font-weight: 500;
color: #333;
}
.unit {
display: flex;
align-items: center;
font-size: 48rpx;
font-weight: 500;
}
.uni-easyinput__placeholder-class {
font-size: 30rpx;
height: 60rpx;
display: flex;
align-items: center;
}
:deep(.uni-easyinput__content-input) {
font-size: 48rpx;
}
.face-value-btn {
width: 200rpx;
height: 144rpx;
border: 1px solid var(--ui-BG-Main);
border-radius: 10rpx;
position: relative;
z-index: 1;
margin-bottom: 15rpx;
margin-right: 15rpx;
&:nth-of-type(3n) {
margin-right: 0;
}
.face-value-title {
font-size: 36rpx;
font-weight: 500;
color: var(--ui-BG-Main);
font-family: OPPOSANS;
&::after {
content: '元';
font-size: 24rpx;
margin-left: 6rpx;
}
}
.face-value-tag {
position: absolute;
z-index: 2;
height: 40rpx;
line-height: 40rpx;
background: var(--ui-BG-Main);
opacity: 0.8;
border-radius: 10rpx 0 20rpx 0;
top: 0;
left: -2rpx;
padding: 0 16rpx;
font-size: 22rpx;
color: $white;
font-family: OPPOSANS;
}
&::before {
position: absolute;
content: ' ';
width: 100%;
height: 100%;
background: var(--ui-BG-Main);
opacity: 0.1;
z-index: 0;
left: 0;
top: 0;
}
font-family: OPPOSANS;
}
.btn-active {
z-index: 1;
&::before {
content: '';
background: var(--ui-BG-Main);
opacity: 1;
}
.face-value-title {
color: $white;
position: relative;
z-index: 1;
font-family: OPPOSANS;
}
.face-value-tag {
background: $white;
color: var(--ui-BG-Main);
font-family: OPPOSANS;
}
.face-value-tag {
background: $white;
color: var(--ui-BG-Main);
font-family: OPPOSANS;
}
}
}
</style>
+30
View File
@@ -0,0 +1,30 @@
<!-- 充值记录 -->
<template>
<wd-config-provider theme="dark">
<view class="w-full h-100vh">
<web-view class="w-full h-full" v-if="state.url && fullPayUrl" :src="fullPayUrl" />
</view>
</wd-config-provider>
</template>
<script setup>
import { reactive, computed } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
const state = reactive({
url: '',
});
const fullPayUrl = computed(() => {
if (!state.url) return ""
const url = `http://jump-alipay.htysapp.com?url=${state.url}`
console.log("url:", url);
return url;
});
onLoad((otions) => {
console.log("otions:", otions);
state.url = decodeURIComponent(otions.url);
});
</script>
+70 -12
View File
@@ -3,9 +3,7 @@
<wd-navbar title="开通VIP" safeAreaInsetTop :bordered="false">
<template #left>
<view class="flex items-center">
<navigator open-type="navigateBack" hover-class="navigator-hover">
<uni-icons type="back" size="30" color="#D29E52"></uni-icons>
</navigator>
<uni-icons type="back" size="30" color="#D29E52" @tap="wechatNavBack" />
<!-- #ifdef MP-WEIXIN -->
<navigator url="/pages/profile/apply-vip-record" open-type="navigate" hover-class="navigator-hover">
<view class="flex items-center rounded-full h-44rpx bg-color-theme py-1 px-2 text-black text-sm">
@@ -80,6 +78,19 @@
<text>微信支付</text>
</view>
</view>
<!-- #ifdef MP-WEIXIN -->
<view v-if="payMethod === 'alipay'" class="mt-3 p-3 rounded-2 bg-#222/60 text-xs text-gray leading-relaxed">
<view class="text-color-theme-dark mb-2 font-600">支付宝支付步骤</view>
<view class="flex">
<text class="text-color-theme-dark mr-1">1.</text>
<text>点击下方“立即开通VIP”</text>
</view>
<view class="flex mt-1">
<text class="text-color-theme-dark mr-1">2.</text>
<text>在弹窗中点击“复制链接”,粘贴到手机浏览器打开完成支付</text>
</view>
</view>
<!-- #endif -->
</view>
<!-- 协议 -->
@@ -128,7 +139,7 @@ import $store from '@/sheep/store';
import PayOrderApi from '@/sheep/api/pay/order';
// @ts-ignore
import sheep from '@/sheep';
import { jumpToWechatMiniProgram } from '@/sheep/util/wechat-tool';
import { jumpToWechatMiniProgram, wechatNavBack } from '@/sheep/util/wechat-tool';
const messageBox = useMessage();
const vipProtocolMessageBox = useMessage('vip-protocol-message-box');
@@ -168,13 +179,18 @@ const payMethodMap = [
const nodes = ref(''); // 会员协议文本
const payMethod = ref<'alipay' | 'wechat'>('alipay'); // 支付方式:alipay / wechat
const openTypeList = ref<OpenTypeItem[]>([]); // 会员类型列表
const curOpenTypeId = ref<number>(); // 当前选择的会员类型id
const curOpenTypeId = ref<number>();
// 当前选择的会员类型
const currentOpenType = computed<OpenTypeItem | undefined>(() =>
openTypeList.value?.find((item) => item.id == curOpenTypeId.value),
); // 当前选择的会员类型
);
const isLogin = computed(() => sheep.$store('user').isLogin);
onLoad(async (params) => {
console.log('onLoad:', params);
if (!isLogin.value) {
return
}
const { data = null } = await RecentApi.getMemberOpenTypeList();
openTypeList.value = data ?? [];
if (openTypeList.value && openTypeList.value[0]) {
@@ -190,7 +206,11 @@ onLoad(async (params) => {
});
onShow(async () => {
getChatConfig();
if (!isLogin.value) {
authDialog()
} else {
getChatConfig();
}
});
// 查看会员协议
@@ -203,6 +223,23 @@ async function alert(type: string | number, title: string) {
});
}
const authDialog = () => {
messageBox
.confirm({
msg: '',
title: '开通会员需要登录,请先登录',
confirmButtonText: '请先登录',
cancelButtonText: '取消',
})
.then(() => {
sheep.$store('user').logout();
uni.reLaunch({ url: '/pages/login/login' });
})
.catch(() => {
});
}
// 查询小程序配置
const getChatConfig = async () => {
try {
@@ -234,10 +271,6 @@ const handleOpenVip = () => {
uni.showToast({ title: '请选择支付方式', icon: 'none' });
return;
}
if (!payMethodItem.payment) {
uni.showToast({ title: `不支持${payMethodItem.title}支付`, icon: 'none' });
return;
}
messageBox
.confirm({
title: '确认开通?',
@@ -245,7 +278,11 @@ const handleOpenVip = () => {
})
.then(async () => {
// #ifdef MP-WEIXIN
disposeWechatPay(curOpenTypeId.value);
if (payMethod.value === 'wechat') {
disposeWechatPay(curOpenTypeId.value);
} else {
disposeAlipayPay(curOpenTypeId.value);
}
// #endif
// #ifndef MP-WEIXIN
jumpToWechatPage();
@@ -254,6 +291,27 @@ const handleOpenVip = () => {
.catch(() => { });
};
// 处理支付宝支付
const disposeAlipayPay = async (openTypeId: any) => {
uni.showLoading({ title: '支付中...', mask: true });
try {
const { code, data } = await RecentApi.memberOpenTypePay({
openTypeId: openTypeId,
});
console.log('开通vipId:', data);
if (code !== 0) {
uni.showToast({ title: '创建订单失败', icon: 'none' });
throw new Error('创建订单失败');
}
await sheep.$platform.pay(payMethod.value, 'recharge', data);
// 更新用户信息
$store('user').getInfo();
uni.showToast({ title: '创建订单成功', icon: 'success' });
} catch (error) {
console.error('|处理支付宝支付|,意外的错误error:', error);
}
}
// 处理微信支付
const disposeWechatPay = async (openTypeId: any) => {
uni.showLoading({ title: '支付中...', mask: true });
+70 -12
View File
@@ -3,9 +3,7 @@
<wd-navbar title="充值" safeAreaInsetTop :bordered="false">
<template #left>
<view class="flex items-center">
<navigator open-type="navigateBack" hover-class="navigator-hover">
<uni-icons type="back" size="30" color="#D29E52"></uni-icons>
</navigator>
<uni-icons type="back" size="30" color="#D29E52" @tap="wechatNavBack" />
<!-- #ifdef MP-WEIXIN -->
<navigator url="/pages/profile/recharge-record" open-type="navigate" hover-class="navigator-hover">
<view
@@ -56,7 +54,6 @@
<image class="size-40rpx mr-2" src="@/static/alipay.png" mode="aspectFill" />
<text>支付宝</text>
</view>
<view
class="flex-1 rounded-full flex-row-center px-4 py-2 b-3 b-solid b-#222 bg-#333 transition-all duration-200"
:style="{ borderColor: payMethod === 'wechat' ? '#D29E52' : '' }" @click="payMethod = 'wechat'">
@@ -64,6 +61,20 @@
<text>微信支付</text>
</view>
</view>
<!-- #ifdef MP-WEIXIN -->
<view v-if="payMethod === 'alipay'"
class="mt-3 p-3 rounded-2 bg-#222/60 text-xs text-gray leading-relaxed">
<view class="text-color-theme-dark mb-2 font-600">支付宝支付步骤</view>
<view class="flex">
<text class="text-color-theme-dark mr-1">1.</text>
<text>点击下方“钻石充值数额”</text>
</view>
<view class="flex mt-1">
<text class="text-color-theme-dark mr-1">2.</text>
<text>在弹窗中点击“复制链接”,粘贴到手机浏览器打开完成支付</text>
</view>
</view>
<!-- #endif -->
</view>
<view v-if="rechargePackag.length" v-for="item in rechargePackag" :key="item.id" class="mx-4 text-base">
@@ -96,7 +107,7 @@ import { onLoad, onShow } from '@dcloudio/uni-app';
import sheep from '@/sheep';
// @ts-ignore
import PayOrderApi from '@/sheep/api/pay/order';
import { jumpToWechatMiniProgram } from '@/sheep/util/wechat-tool';
import { jumpToWechatMiniProgram, wechatNavBack } from '@/sheep/util/wechat-tool';
const messageBox = useMessage();
@@ -118,10 +129,15 @@ const payMethod = ref<'alipay' | 'wechat'>('alipay'); // 支付方式:alipay /
const rechargePackag = ref<{ id: number; name: string; payPrice: number; bonusPrice: number }[]>(
[],
);
const userWallet = computed(() => sheep.$store('user').userWallet);
const isLogin = computed(() => sheep.$store('user').isLogin);
onLoad(async (params) => {
console.log('onLoad:', params);
if (!isLogin.value) {
return
}
const { data } = await RecentApi.getWalletRechargePackage();
rechargePackag.value = data ?? [];
if (params) {
@@ -138,14 +154,35 @@ onLoad(async (params) => {
});
onShow(async () => {
// 查询钱包余额
getWallet();
if (!isLogin.value) {
authDialog()
} else {
// 查询钱包余额
getWallet();
}
});
const getWallet = () => {
sheep.$store('user').getWallet();
};
const authDialog = () => {
messageBox
.confirm({
msg: '',
title: '充值钻石需要登录,请先登录',
confirmButtonText: '请先登录',
cancelButtonText: '取消',
})
.then(() => {
sheep.$store('user').logout();
uni.reLaunch({ url: '/pages/login/login' });
})
.catch(() => {
});
}
const handleRecharge = (item: any) => {
if (!item.id) {
uni.showToast({ title: '请选择会员类型', icon: 'none' });
@@ -156,10 +193,6 @@ const handleRecharge = (item: any) => {
uni.showToast({ title: '请选择支付方式', icon: 'none' });
return;
}
if (!payMethodItem.payment) {
uni.showToast({ title: `不支持${payMethodItem.title}支付`, icon: 'none' });
return;
}
messageBox
.confirm({
title: '提示',
@@ -167,7 +200,11 @@ const handleRecharge = (item: any) => {
})
.then(async () => {
// #ifdef MP-WEIXIN
disposeWechatPay(item.id);
if (payMethod.value === 'wechat') {
disposeWechatPay(item.id);
} else {
disposeAlipayPay(item.id);
}
// #endif
// #ifndef MP-WEIXIN
jumpToWechatPage(item.id);
@@ -176,6 +213,27 @@ const handleRecharge = (item: any) => {
.catch(() => { });
};
// 处理支付宝支付
const disposeAlipayPay = async (packageId: any) => {
uni.showLoading({ title: '支付中...', mask: true });
try {
const { code, data } = await RecentApi.walletRecharge({ packageId: packageId });
console.log('发起订单id,data:', data);
if (code !== 0) {
uni.showToast({ title: '创建订单失败', icon: 'none' });
throw new Error();
}
await sheep.$platform.pay(payMethod.value, 'recharge', data.payOrderId);
// 更新用户钱包
getWallet();
uni.showToast({ title: '创建订单成功', icon: 'success' });
} catch (error) {
console.error('|处理支付宝支付|,意外的错误error:', error);
} finally {
uni.hideLoading();
}
}
// 处理微信支付
const disposeWechatPay = async (packageId: any) => {
uni.showLoading({ title: '支付中...', mask: true });
+2
View File
@@ -3,9 +3,11 @@
<wd-config-provider theme="dark">
<wd-navbar title="福利中心" safeAreaInsetTop :bordered="false">
<template #left>
<!-- #ifndef MP-WEIXIN -->
<navigator open-type="navigateBack" hover-class="navigator-hover">
<uni-icons type="back" size="30" color="#D29E52"></uni-icons>
</navigator>
<!-- #endif -->
</template>
</wd-navbar>
<!-- 用户信息 -->
+2 -3
View File
@@ -3,9 +3,7 @@
<wd-navbar title="邀请福利" safeAreaInsetTop :bordered="false">
<template #left>
<view class="flex items-center">
<navigator open-type="navigateBack" hover-class="navigator-hover">
<uni-icons type="back" size="30" color="#D29E52"></uni-icons>
</navigator>
<uni-icons type="back" size="30" color="#D29E52" @tap="wechatNavBack" />
<navigator url="/pages/wechat/pages/gift/gift-record" open-type="navigate"
hover-class="navigator-hover">
<view
@@ -68,6 +66,7 @@ import ScrollList from '@/sheep/components/scroll-list/scroll-list.vue';
import useScroll from '@/sheep/hooks/use-scroll';
import useBindWechat from "@/sheep/hooks/use-bind-wechat"
import { formatDate } from '@/sheep/helper/utils';
import { wechatNavBack } from "@/sheep/util/wechat-tool"
import PayWalletApi from "@/sheep/api/pay/wallet.js"
import RecentApi from "@/sheep/api/member/recent"
+2 -3
View File
@@ -3,9 +3,7 @@
<wd-config-provider theme="dark">
<wd-navbar title="我的团队" safeAreaInsetTop :bordered="false">
<template #left>
<navigator open-type="navigateBack" hover-class="navigator-hover">
<uni-icons type="back" size="30" color="#D29E52"></uni-icons>
</navigator>
<uni-icons type="back" size="30" color="#D29E52" @tap="wechatNavBack" />
</template>
</wd-navbar>
<wd-search v-model="state.queryParams.nickname" @search="refreshList" @change="refreshList" />
@@ -49,6 +47,7 @@ import ScrollList from '@/sheep/components/scroll-list/scroll-list.vue';
import useScroll from '@/sheep/hooks/use-scroll';
import { onPageScroll } from '@dcloudio/uni-app';
import BrokerageApi from '@/sheep/api/trade/brokerage';
import { wechatNavBack } from '@/sheep/util/wechat-tool';
const userInfo = computed(() => sheep.$store('user').userInfo);
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
+1
View File
@@ -222,6 +222,7 @@ export default class SheepPay {
success: (res) => {
if (res.confirm) {
sheep.$helper.copyText(data.displayContent);
// uni.navigateTo({ url: '/pages/profile/alipay-webview?url=' + encodeURIComponent(data.displayContent) })
}
},
});
+17
View File
@@ -4,6 +4,23 @@ import SocialApi from '@/sheep/api/member/social';
const targetAppId = 'wx2b4e4d3feff8267f';
export const wechatNavBack = () => {
// 非小程序直接返回
// #ifndef MP-WEIXIN
uni.navigateBack()
// #endif
// 在小程序里要判断一下
// #ifdef MP-WEIXIN
// 判断能否返回
let pages = getCurrentPages();
if (pages.length == 1) {
uni.switchTab({ url: `/pages/wechat-tabbar/index` })
} else {
uni.navigateBack()
}
// #endif
}
const paramsToQuery = (params) => {
if (isEmpty(params)) {
return '';