You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sign-up.vue 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 class="content_1">
  11. 微信车主服务是微信支付为车主用户提供的安全便捷的智慧服务
  12. </view>
  13. <view class="content_2">
  14. 本次将为贵州黔通智联科技股份有限公司开启免密支付服务,后续相关的费用将通过微信车主服务从你的微信支付账户扣除
  15. </view>
  16. </view>
  17. <view class="action">
  18. <button type="default" class="button" @click="savaHandle()">
  19. 开通服务
  20. </button>
  21. </view>
  22. </template>
  23. <script setup lang="ts">
  24. import {
  25. onLoad,
  26. onShow
  27. } from "@dcloudio/uni-app";
  28. import {
  29. reactive
  30. } from "vue";
  31. import {
  32. etcQYAction
  33. } from "@/utils/network/api.js";
  34. import {
  35. request
  36. } from "@/utils/network/request.js";
  37. import {
  38. stringToJson
  39. } from "@/utils/network/encryption";
  40. import {
  41. fileURL
  42. } from "@/datas/fileURL.js";
  43. import navBar from "../components/nav-bar/nav-bar2.vue";
  44. import navBgCar from "./components/nav-bg-car4";
  45. import {
  46. setItem
  47. } from "@/utils/storage";
  48. import {
  49. msg
  50. } from "@/utils/utils";
  51. import {
  52. checkOrderStatus,
  53. orderPay,
  54. wechatAppID,
  55. wechatPayConfigId,
  56. wechatSecret,
  57. } from "@/utils/network/api";
  58. const imgURL = `${fileURL}image/`;
  59. const state = reactive({
  60. openid: "",
  61. orderId: "",
  62. });
  63. onLoad((option: any) => {
  64. getOpenID();
  65. state.orderId = option.orderId;
  66. // setItem("QYorderId",option.orderId+'')
  67. });
  68. //获取微信小程序openid
  69. const getOpenID = () => {
  70. uni.login({
  71. provider: "weixin",
  72. success: function(e) {
  73. wx.request({
  74. url: `https://api.weixin.qq.com/sns/jscode2session?appid=${wechatAppID}&secret=${wechatSecret}&js_code=${e.code}&grant_type=authorization_code`,
  75. success: (res: any) => {
  76. state.openid = res.data.openid;
  77. setItem("QYorder",state)
  78. console.log(res);
  79. },
  80. });
  81. },
  82. });
  83. };
  84. const savaHandle = () => {
  85. var data = {
  86. orderId: state.orderId,
  87. subOpenId: state.openid,
  88. };
  89. const options = {
  90. type: 2,
  91. data: data,
  92. method: "POST",
  93. showLoading: true,
  94. };
  95. request(etcQYAction, options).then((res) => {
  96. const data = stringToJson(res.bizContent);
  97. console.log(data);
  98. uni.navigateToMiniProgram({
  99. appId: 'wxbcad394b3d99dac9',
  100. path: 'pages/route/index',
  101. extraData: {
  102. appid: 'wxcb1388c809fe25a9',
  103. sub_appid: 'wx008c60533388527a',
  104. mch_id: '1500877591',
  105. sub_mch_id: '1622652848',
  106. nonce_str: data.nonceStr,
  107. sign_type: 'HMAC-SHA256',
  108. trade_scene: 'HIGHWAY',
  109. plate_number: data.plateNumber,
  110. sub_openid: data.subOpenId,
  111. sign: data.sign,
  112. },
  113. success(res) {
  114. console.log(res);
  115. },
  116. complete(res) {
  117. console.log(res);
  118. },
  119. fail(res) {
  120. console.log(res);
  121. // 未成功跳转到车主小程序
  122. },
  123. });
  124. });
  125. };
  126. </script>
  127. <style lang="scss" scoped>
  128. .action {
  129. margin-top: 40rpx;
  130. padding-left: 20rpx;
  131. padding-right: 20rpx;
  132. padding-bottom: 30rpx;
  133. .button {
  134. height: 80rpx;
  135. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  136. border-radius: 40rpx;
  137. font-size: 32rpx;
  138. font-weight: 400;
  139. color: #ffffff;
  140. line-height: 80rpx;
  141. }
  142. }
  143. .title {
  144. text-align: center;
  145. margin-top: 15rpx;
  146. font-size: 36rpx;
  147. font-family: Microsoft YaHei;
  148. font-weight: 400;
  149. color: #333333;
  150. line-height: 36rpx;
  151. }
  152. .value {
  153. padding: 0rpx 60rpx;
  154. }
  155. .content_1 {
  156. margin-top: 60rpx;
  157. font-size: 30rpx;
  158. font-family: Microsoft YaHei;
  159. font-weight: 400;
  160. color: #666666;
  161. line-height: 58rpx;
  162. }
  163. .content_2 {
  164. margin-top: 50rpx;
  165. font-size: 30rpx;
  166. font-family: Microsoft YaHei;
  167. font-weight: 400;
  168. color: #666666;
  169. line-height: 58rpx;
  170. }
  171. </style>