Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 1 Jahr
vor 1 Jahr
vor 1 Jahr
vor 1 Jahr
vor 1 Jahr
vor 1 Jahr
vor 1 Jahr
vor 1 Jahr
vor 1 Jahr
vor 1 Jahr
vor 1 Jahr
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <image style="
  3. margin-top: 20rpx;
  4. width: 100%;
  5. height: 240rpx;
  6. background-color: #eeeeee;
  7. " :src="`${$imgUrl}applyCard/car-service.png`"></image>
  8. <view class="title"> 支付宝支付 </view>
  9. <view class="value">
  10. </view>
  11. <view class="action">
  12. <button type="default" class="button" @click="savaHandle()">
  13. 确认支付
  14. </button>
  15. </view>
  16. </template>
  17. <script setup lang="ts">
  18. import { onLoad, onShow } from "@dcloudio/uni-app";
  19. import { reactive } from "vue";
  20. import { etcQYAction } from "@/utils/network/api.js";
  21. import { request } from "@/utils/network/request.js";
  22. import { stringToJson } from "@/utils/network/encryption";
  23. import { fileURL } from "@/datas/fileURL.js";
  24. import navBar from "@/components/nav-bar/nav-bar2.vue";
  25. import navBgCar from "./components/nav-bg-car4";
  26. import { setItem, StorageKeys } from "@/utils/storage";
  27. import { msg, confirm, getOrderStatusName } from "@/utils/utils";
  28. import {
  29. checkOrderStatus,
  30. orderPay,
  31. wechatAppID,
  32. wechatPayConfigId,
  33. wechatSecret,
  34. aliPayConfigId,
  35. obtainUserId,
  36. } from "@/utils/network/api";
  37. const imgURL = `${fileURL}image/`;
  38. const state = reactive({
  39. openid: "",
  40. orderId: "",
  41. id: "",
  42. clientFee: "",
  43. code: "",
  44. qdOrderNo: "", //渠道订单编号
  45. isPay: "",
  46. });
  47. onLoad((option : any) => {
  48. console.log("option11111", option)
  49. state.orderId = option.orderId;
  50. state.qdOrderNo = option.qdOrderNo;
  51. setItem('accessToken', option.token);
  52. setItem(StorageKeys.Token, option.token);
  53. setItem('openId', option.openId);
  54. state.isPay = option.isPay;
  55. });
  56. const savaHandle = () => {
  57. my.getAuthCode({
  58. scopes: 'auth_user',
  59. success: res => {
  60. const optionsUser = {
  61. type: 2,
  62. data: {
  63. payConfigId: aliPayConfigId,
  64. code: res.authCode
  65. },
  66. method: "POST",
  67. showLoading: true,
  68. };
  69. console.log('支付宝用户编号请求:', optionsUser)
  70. request(obtainUserId, optionsUser).then((res) => {
  71. console.log('支付宝用户编号返回:', res)
  72. const data = stringToJson(res.bizContent);
  73. const optionsali = {
  74. type: 2,
  75. data: {
  76. openid: data.openId,
  77. orderId: state.orderId,
  78. payConfigId: aliPayConfigId,
  79. },
  80. method: "POST",
  81. showLoading: true,
  82. };
  83. console.log('支付下单请求:', optionsali)
  84. request(orderPay, optionsali).then((res) => {
  85. console.log('支付下单返回:', res)
  86. const data = stringToJson(res.bizContent);
  87. my.tradePay({
  88. // 调用统一收单交易创建接口(alipay.trade.create),获得返回字段支付宝交易号 trade_no
  89. tradeNO: data.prepayId,
  90. success: res => {
  91. console.log("支付成功", res);
  92. const optionsaliquery = {
  93. type: 2,
  94. data: {
  95. orderId: state.orderId,
  96. },
  97. method: "POST",
  98. showLoading: true,
  99. };
  100. request(checkOrderStatus, optionsaliquery).then((res) => {
  101. console.log('支付结果查询:', res)
  102. if (state.isPay == "1") {
  103. my.navigateToMiniProgram({
  104. appId: '2021004102619032', // 16 位
  105. path: `/subpackage/after-sale/empty?qdOrderNo=${state.qdOrderNo}&type=3&orderId=${state.orderId}&isPay=2`,
  106. query: {
  107. a: 'foo',
  108. b: 'bar',
  109. },
  110. extraData: {
  111. x: {
  112. y: 'z',
  113. },
  114. },
  115. success: function (res) {
  116. console.log(res);
  117. },
  118. fail: function (err) {
  119. console.log(err);
  120. }
  121. });
  122. }
  123. })
  124. },
  125. fail: res => {
  126. console.log("支付失败", res);
  127. },
  128. });
  129. });
  130. });
  131. },
  132. fail: err => {
  133. console.log('my.getAuthCode 调用失败', err)
  134. }
  135. });
  136. }
  137. </script>
  138. <style lang="scss" scoped>
  139. .action {
  140. margin-top: 40rpx;
  141. padding-left: 20rpx;
  142. padding-right: 20rpx;
  143. padding-bottom: 30rpx;
  144. .button {
  145. height: 80rpx;
  146. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  147. border-radius: 40rpx;
  148. font-size: 32rpx;
  149. font-weight: 400;
  150. color: #ffffff;
  151. line-height: 80rpx;
  152. }
  153. }
  154. .title {
  155. text-align: center;
  156. margin-top: 15rpx;
  157. font-size: 36rpx;
  158. font-family: Microsoft YaHei;
  159. font-weight: 400;
  160. color: #333333;
  161. line-height: 36rpx;
  162. }
  163. .value {
  164. padding: 0rpx 60rpx;
  165. }
  166. .content_1 {
  167. margin-top: 60rpx;
  168. font-size: 30rpx;
  169. font-family: Microsoft YaHei;
  170. font-weight: 400;
  171. color: #666666;
  172. line-height: 58rpx;
  173. }
  174. .content_2 {
  175. margin-top: 50rpx;
  176. font-size: 30rpx;
  177. font-family: Microsoft YaHei;
  178. font-weight: 400;
  179. color: #666666;
  180. line-height: 58rpx;
  181. }
  182. .content_3 {
  183. margin-top: 50rpx;
  184. font-size: 30rpx;
  185. font-family: Microsoft YaHei;
  186. font-weight: 400;
  187. color: #ff0000;
  188. line-height: 58rpx;
  189. }
  190. </style>