Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
纵之格
shopxo-uniapp
提交
62fea6fa
S
shopxo-uniapp
项目概览
纵之格
/
shopxo-uniapp
通知
103
Star
3
Fork
4
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
shopxo-uniapp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
62fea6fa
编写于
4月 12, 2024
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
支付优化,虚拟币支付
上级
dd0f396e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
61 addition
and
49 deletion
+61
-49
components/payment/payment.vue
components/payment/payment.vue
+57
-45
pages/buy/buy.vue
pages/buy/buy.vue
+4
-4
未找到文件。
components/payment/payment.vue
浏览文件 @
62fea6fa
...
...
@@ -253,56 +253,66 @@
},
// 支付方法
pay_handle
(
order_id
,
payment_id
,
payment_list
=
[])
{
pay_handle
(
order_id
,
payment_id
=
0
,
payment_list
=
[])
{
// 没有指定支付方式则使用属性传过来的值
if
((
payment_list
||
null
)
!=
null
&&
payment_list
.
length
>
0
)
{
this
.
setData
({
payment_list
:
payment_list
});
}
this
.
payment_list
.
forEach
((
item
)
=>
{
if
(
item
.
id
==
payment_id
)
{
if
(
item
.
payment
===
'
WalletPay
'
)
{
var
self
=
this
;
uni
.
showModal
({
title
:
self
.
$t
(
'
common.warm_tips
'
),
content
:
self
.
$t
(
'
payment.payment.011cj4
'
),
confirmText
:
self
.
$t
(
'
common.confirm
'
),
cancelText
:
self
.
$t
(
'
common.not_yet
'
),
success
(
res
)
{
if
(
res
.
confirm
)
{
self
.
pay_handle_event
(
order_id
,
payment_id
);
}
else
{
self
.
order_item_pay_fail_handle
(
null
,
order_id
,
self
.
$t
(
'
paytips.paytips.6mpsl7
'
));
}
},
});
}
else
{
this
.
pay_handle_event
(
order_id
,
payment_id
);
}
// 没有支付方式
if
((
payment_id
||
0
)
==
0
)
{
this
.
pay_handle_event
(
order_id
,
payment_id
);
}
else
{
// 循环匹配支付方式
this
.
payment_list
.
forEach
((
item
)
=>
{
if
(
item
.
id
==
payment_id
)
{
if
(
item
.
payment
===
'
WalletPay
'
)
{
var
self
=
this
;
uni
.
showModal
({
title
:
self
.
$t
(
'
common.warm_tips
'
),
content
:
self
.
$t
(
'
payment.payment.011cj4
'
),
confirmText
:
self
.
$t
(
'
common.confirm
'
),
cancelText
:
self
.
$t
(
'
common.not_yet
'
),
success
(
res
)
{
if
(
res
.
confirm
)
{
self
.
pay_handle_event
(
order_id
,
payment_id
);
}
else
{
self
.
order_item_pay_fail_handle
(
null
,
order_id
,
self
.
$t
(
'
paytips.paytips.6mpsl7
'
));
}
},
});
}
else
{
this
.
pay_handle_event
(
order_id
,
payment_id
);
}
}
}
}
);
}
);
}
},
// 支付处理
pay_handle_event
(
order_id
,
payment_id
)
{
// #ifdef H5
// 微信环境判断是否已有web_openid、不存在则不继续执行跳转到插件进行授权
if
(
!
app
.
globalData
.
is_user_weixin_web_openid
(
order_id
,
payment_id
||
this
.
payment_id
))
{
return
false
;
}
// #endif
// 支付方式
var
payment
=
null
;
for
(
var
i
in
this
.
payment_list
)
{
if
(
this
.
payment_list
[
i
][
'
id
'
]
==
(
payment_id
||
this
.
payment_id
))
{
payment
=
this
.
payment_list
[
i
];
pay_handle_event
(
order_id
,
payment_id
=
0
)
{
// 没有指定支付方式则不匹配支付标识
var
payment
=
null
;
if
((
payment_id
||
0
)
!=
0
)
{
// #ifdef H5
// 微信环境判断是否已有web_openid、不存在则不继续执行跳转到插件进行授权
if
(
!
app
.
globalData
.
is_user_weixin_web_openid
(
order_id
,
payment_id
||
this
.
payment_id
))
{
return
false
;
}
}
if
(
payment
==
null
)
{
app
.
globalData
.
showToast
(
this
.
$t
(
'
payment.payment.7ihx9u
'
));
return
false
;
}
// #endif
// 支付方式
for
(
var
i
in
this
.
payment_list
)
{
if
(
this
.
payment_list
[
i
][
'
id
'
]
==
(
payment_id
||
this
.
payment_id
))
{
payment
=
this
.
payment_list
[
i
];
}
}
if
(
payment
==
null
)
{
app
.
globalData
.
showToast
(
this
.
$t
(
'
payment.payment.7ihx9u
'
));
return
false
;
}
}
// 请求数据
var
post_data
=
{
[
this
.
propPayDataKey
]:
order_id
,
...
...
@@ -312,11 +322,13 @@
// #ifdef H5
var
redirect_url
=
app
.
globalData
.
page_url_protocol
(
this
.
propToAppointPage
||
app
.
globalData
.
get_page_url
(
false
));
post_data
[
'
redirect_url
'
]
=
encodeURIComponent
(
base64
.
encode
(
redirect_url
));
// 指定支付方式使用respond_url返回地址、移除重定向地址
var
respond_arr
=
[
'
PayPal
'
,
'
UniPayment
'
];
if
(
respond_arr
.
indexOf
(
payment
.
payment
)
!=
-
1
)
{
post_data
[
'
respond_url
'
]
=
post_data
[
'
redirect_url
'
];
delete
post_data
[
'
redirect_url
'
];
// 存在支付标识、指定支付方式使用respond_url返回地址、移除重定向地址
if
(
payment
!=
null
)
{
var
respond_arr
=
[
'
PayPal
'
,
'
UniPayment
'
];
if
(
respond_arr
.
indexOf
(
payment
.
payment
)
!=
-
1
)
{
post_data
[
'
respond_url
'
]
=
post_data
[
'
redirect_url
'
];
delete
post_data
[
'
redirect_url
'
];
}
}
// #endif
// 请求支付接口
...
...
pages/buy/buy.vue
浏览文件 @
62fea6fa
...
...
@@ -201,7 +201,7 @@
</view>
<!-- 支付选择 -->
<view
v-if=
"(
(total_price > 0 || plugins_coin_payment_id != 0)
&& common_order_is_booking != 1 && payment_list.length > 0) || ((plugins_coin_data || null) != null && (plugins_coin_data.accounts_list || null) != null && plugins_coin_data.accounts_list.length > 0)"
class=
"payment-list border-radius-main bg-white oh padding-main spacing-mb"
>
<view
v-if=
"(
total_price > 0
&& common_order_is_booking != 1 && payment_list.length > 0) || ((plugins_coin_data || null) != null && (plugins_coin_data.accounts_list || null) != null && plugins_coin_data.accounts_list.length > 0)"
class=
"payment-list border-radius-main bg-white oh padding-main spacing-mb"
>
<!-- 虚拟币支付 -->
<block
v-if=
"(plugins_coin_data || null) != null && (plugins_coin_data.accounts_list || null) != null && plugins_coin_data.accounts_list.length > 0"
>
<block
v-for=
"(item, index) in plugins_coin_data.accounts_list"
:key=
"index"
>
...
...
@@ -223,7 +223,7 @@
</block>
</block>
<!-- 支付方式 -->
<view
v-if=
"
(total_price > 0 || plugins_coin_payment_id != 0)
&& common_order_is_booking != 1 && payment_list.length > 0"
class=
"br-t-f9"
>
<view
v-if=
"
total_price > 0
&& common_order_is_booking != 1 && payment_list.length > 0"
class=
"br-t-f9"
>
<view
v-for=
"(item, index) in payment_list"
:key=
"index"
>
<view
class=
"item flex-row jc-sb align-c"
:data-value=
"item.id"
:data-index=
"index"
@
tap=
"payment_event"
>
<view
class=
"item-content pr flex-1 flex-width"
>
...
...
@@ -821,8 +821,8 @@
data
[
'
buy_datetime_value
'
]
=
datetime
.
value
||
''
;
}
// 是否需要选择支付方式
if
(
this
.
total_price
>
0
&&
this
.
common_order_is_booking
!=
1
)
{
// 是否需要选择支付方式
、并且未选择虚拟币支付方式
if
(
this
.
total_price
>
0
&&
this
.
common_order_is_booking
!=
1
&&
(
this
.
plugins_coin_payment_id
||
null
)
==
null
)
{
if
((
data
.
payment_id
||
null
)
==
null
)
{
app
.
globalData
.
showToast
(
this
.
$t
(
'
buy.buy.71kidy
'
));
return
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录