Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
account-book
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘文虎
account-book
Commits
1e2ada3f
Commit
1e2ada3f
authored
May 22, 2023
by
Facius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 接入支付宝
parent
91ad6dc5
Pipeline
#5699
canceled with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
26 deletions
+42
-26
index.vue
components/bottom-pay/index.vue
+26
-19
manifest.json
manifest.json
+3
-0
pay.vue
pages/mine/pay/pay.vue
+13
-7
zhifubaozhifu@3x.png
static/image/mine/zhifubaozhifu@3x.png
+0
-0
No files found.
components/bottom-pay/index.vue
View file @
1e2ada3f
...
@@ -35,18 +35,20 @@
...
@@ -35,18 +35,20 @@
data
()
{
data
()
{
return
{
return
{
show
:
false
,
show
:
false
,
list
:
[{
list
:
[
{
image
:
'/static/image/mine/
weixin
zhifu@3x.png'
,
image
:
'/static/image/mine/
zhifubao
zhifu@3x.png'
,
title
:
'
微信支付
'
,
title
:
'
支付宝
'
,
select
:
true
,
select
:
true
,
provider
:
'wxpay'
provider
:
'alipay'
,
channel
:
'ALIPAY'
},
},
// {
{
// image: '/static/images/mine/zhifubaozhifu@3x.png',
image
:
'/static/image/mine/weixinzhifu@3x.png'
,
// title: '支付宝',
title
:
'微信支付'
,
// select: false,
select
:
false
,
// provider: 'alipay',
provider
:
'wxpay'
,
// },
channel
:
'WX'
}
]
]
}
}
},
},
...
@@ -67,13 +69,13 @@
...
@@ -67,13 +69,13 @@
// });
// });
// return
// return
// }
// }
//
for (var item of this.list) {
for
(
var
item
of
this
.
list
)
{
//
if (item.provider == provider) {
if
(
item
.
provider
==
provider
)
{
//
item.select = !item.select
item
.
select
=
!
item
.
select
//
} else {
}
else
{
//
item.select = false
item
.
select
=
false
//
}
}
//
}
}
},
},
changeVisibleValue
(
val
)
{
changeVisibleValue
(
val
)
{
this
.
$emit
(
'update:visible'
,
val
)
this
.
$emit
(
'update:visible'
,
val
)
...
@@ -82,8 +84,13 @@
...
@@ -82,8 +84,13 @@
this
.
changeVisibleValue
(
false
)
this
.
changeVisibleValue
(
false
)
},
},
handleClickBuy
()
{
handleClickBuy
()
{
this
.
$emit
(
'click'
)
for
(
var
item
of
this
.
list
)
{
this
.
changeVisibleValue
(
false
)
if
(
item
.
select
)
{
this
.
$emit
(
'buy'
,
item
)
this
.
changeVisibleValue
(
false
)
break
}
}
}
}
},
},
}
}
...
...
manifest.json
View file @
1e2ada3f
...
@@ -111,6 +111,9 @@
...
@@ -111,6 +111,9 @@
"__platform__"
:
[
"ios"
,
"android"
],
"__platform__"
:
[
"ios"
,
"android"
],
"appid"
:
"wxf0a780908851623f"
,
"appid"
:
"wxf0a780908851623f"
,
"UniversalLinks"
:
"https://kaying.cc/uni-universallinks/__UNI__EDB8C7C/"
"UniversalLinks"
:
"https://kaying.cc/uni-universallinks/__UNI__EDB8C7C/"
},
"alipay"
:
{
"__platform__"
:
[
"ios"
,
"android"
]
}
}
},
},
"share"
:
{
"share"
:
{
...
...
pages/mine/pay/pay.vue
View file @
1e2ada3f
...
@@ -92,7 +92,7 @@
...
@@ -92,7 +92,7 @@
</view>
</view>
</view>
</view>
<view
v-if=
"!hidePay"
class=
"bottom-view"
><button
class=
"buy-button"
@
tap=
"$u.throttle(handleClickBuy, 500)"
>
立即购买
</button></view>
<view
v-if=
"!hidePay"
class=
"bottom-view"
><button
class=
"buy-button"
@
tap=
"$u.throttle(handleClickBuy, 500)"
>
立即购买
</button></view>
<BottomPay
:visible
.
sync=
"showPayBottom"
@
click=
"$u.throttle(getPaymentInfo, 500)
"
/>
<BottomPay
:visible
.
sync=
"showPayBottom"
@
buy=
"handleClickBottom
"
/>
</view>
</view>
</
template
>
</
template
>
...
@@ -219,10 +219,14 @@ export default {
...
@@ -219,10 +219,14 @@ export default {
this
.
showPayBottom
=
true
;
this
.
showPayBottom
=
true
;
}
}
}
else
{
}
else
{
this
.
getPaymentInfo
();
this
.
getPaymentInfo
(
{
channel
:
'WX'
,
provider
:
'wxpay'
}
);
}
}
},
},
async
getPaymentInfo
()
{
handleClickBottom
(
item
)
{
this
.
getPaymentInfo
(
item
)
},
async
getPaymentInfo
(
item
)
{
console
.
log
(
'-------getPaymentInfo--------'
,
item
)
uni
.
showLoading
({
uni
.
showLoading
({
title
:
'正在获取订单信息'
title
:
'正在获取订单信息'
});
});
...
@@ -230,17 +234,19 @@ export default {
...
@@ -230,17 +234,19 @@ export default {
goodsId
:
this
.
selected
.
id
,
goodsId
:
this
.
selected
.
id
,
loginChannel
:
this
.
loginChannel
,
loginChannel
:
this
.
loginChannel
,
authType
:
this
.
authType
,
authType
:
this
.
authType
,
payChannel
:
this
.
platform
==
'4'
&&
this
.
isIOS
?
'APPLEPAY'
:
'WX'
payChannel
:
this
.
platform
==
'4'
&&
this
.
isIOS
?
'APPLEPAY'
:
item
.
channel
};
};
console
.
log
(
'-------params-------'
,
params
)
try
{
try
{
let
{
data
}
=
await
getOrderInfo
(
params
);
let
{
data
}
=
await
getOrderInfo
(
params
);
this
.
startPay
(
data
);
console
.
log
(
'-------getOrderInfos-------'
,
data
)
this
.
startPay
(
data
,
item
.
provider
);
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
showToast
(
'获取订单信息失败'
);
this
.
showToast
(
'获取订单信息失败'
);
//TODO handle the exception
//TODO handle the exception
}
}
},
},
startPay
(
charge
)
{
startPay
(
charge
,
provider
)
{
uni
.
showLoading
({
uni
.
showLoading
({
title
:
'支付中'
title
:
'支付中'
});
});
...
@@ -263,7 +269,7 @@ export default {
...
@@ -263,7 +269,7 @@ export default {
orderInfo
:
charge
.
orderInfo
,
orderInfo
:
charge
.
orderInfo
,
// #endif
// #endif
// #ifdef APP-PLUS
// #ifdef APP-PLUS
provider
:
this
.
isIOS
?
'appleiap'
:
'wxpay'
,
provider
:
this
.
isIOS
?
'appleiap'
:
provider
,
manualFinishTransaction
:
this
.
isIOS
?
true
:
false
,
manualFinishTransaction
:
this
.
isIOS
?
true
:
false
,
orderInfo
:
charge
.
orderInfo
,
orderInfo
:
charge
.
orderInfo
,
// #endif
// #endif
...
...
static/image/mine/zhifubaozhifu@3x.png
0 → 100644
View file @
1e2ada3f
1.3 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment