|
@@ -1,5 +1,6 @@
|
|
|
<template>
|
|
<template>
|
|
|
<view>
|
|
<view>
|
|
|
|
|
+ <button @click="order">下单支付啦啦</button>
|
|
|
<!-- 订阅列表 -->
|
|
<!-- 订阅列表 -->
|
|
|
<uni-list>
|
|
<uni-list>
|
|
|
<uni-list-item v-for="(item, index) in productList" :title="item.title" :note="item.description" rightText="详情"
|
|
<uni-list-item v-for="(item, index) in productList" :title="item.title" :note="item.description" rightText="详情"
|
|
@@ -30,6 +31,43 @@ const productList = ref([
|
|
|
},
|
|
},
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
|
|
+const order = async () => {
|
|
|
|
|
+ console.log("下单啦啦啦");
|
|
|
|
|
+ // 获取供应商
|
|
|
|
|
+ let providerResult = await uni.getProvider({ service: "oauth" });
|
|
|
|
|
+ uni.request({
|
|
|
|
|
+ url: "http://localhost:8080/test/t2",
|
|
|
|
|
+ method: "get",
|
|
|
|
|
+ success: ret => {
|
|
|
|
|
+ let res = ret.data;
|
|
|
|
|
+ console.log(res);
|
|
|
|
|
+ uni.requestPayment({
|
|
|
|
|
+ provider: providerResult.provider[0],
|
|
|
|
|
+ timeStamp: res.timeStamp,
|
|
|
|
|
+ nonceStr: res.nonceStr,
|
|
|
|
|
+ package: res.packageValue,
|
|
|
|
|
+ signType: res.signType,
|
|
|
|
|
+ paySign: res.paySign,
|
|
|
|
|
+ success: function (res) {
|
|
|
|
|
+ console.log('success:' + JSON.stringify(res));
|
|
|
|
|
+ },
|
|
|
|
|
+ fail: function (err) {
|
|
|
|
|
+ console.log('fail:' + JSON.stringify(err));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ fail: err => {
|
|
|
|
|
+ console.log("一场 啦啦啦", err);
|
|
|
|
|
+ // reject(err);
|
|
|
|
|
+ },
|
|
|
|
|
+ complete: () => {
|
|
|
|
|
+ // if (loading) {
|
|
|
|
|
+ // uni.hideLoading();
|
|
|
|
|
+ // }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped></style>
|
|
<style lang="scss" scoped></style>
|