您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

sign-up.vue 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. id: '',
  63. clientFee: ''
  64. });
  65. onLoad((option: any) => {
  66. getOpenID();
  67. state.orderId = option.orderId;
  68. state.clientFee = option.clientFee;
  69. state.id = option.id;
  70. // setItem("QYorderId",option.orderId+'')
  71. });
  72. //获取微信小程序openid
  73. const getOpenID = () => {
  74. uni.login({
  75. provider: "weixin",
  76. success: function(e) {
  77. wx.request({
  78. url: `https://api.weixin.qq.com/sns/jscode2session?appid=${wechatAppID}&secret=${wechatSecret}&js_code=${e.code}&grant_type=authorization_code`,
  79. success: (res: any) => {
  80. state.openid = res.data.openid;
  81. setItem("QYorder", state)
  82. console.log(res);
  83. },
  84. });
  85. },
  86. });
  87. };
  88. const savaHandle = () => {
  89. var data = {
  90. orderId: state.orderId,
  91. subOpenId: state.openid,
  92. };
  93. const options = {
  94. type: 2,
  95. data: data,
  96. method: "POST",
  97. showLoading: true,
  98. };
  99. request(etcQYAction, options).then((res) => {
  100. const data = stringToJson(res.bizContent);
  101. console.log(data);
  102. if (data.userState === 'UNAUTHORIZED') {
  103. uni.navigateToMiniProgram({
  104. appId: 'wxbcad394b3d99dac9',
  105. path: 'pages/route/index',
  106. extraData: {
  107. appid: 'wxcb1388c809fe25a9',
  108. sub_appid: 'wx008c60533388527a',
  109. mch_id: '1500877591',
  110. sub_mch_id: '1622652848',
  111. nonce_str: data.nonceStr,
  112. sign_type: 'HMAC-SHA256',
  113. trade_scene: 'HIGHWAY',
  114. plate_number: data.plateNumber,
  115. sub_openid: data.subOpenId,
  116. sign: data.sign,
  117. },
  118. success(res) {
  119. console.log(res);
  120. },
  121. complete(res) {
  122. console.log(res);
  123. },
  124. fail(res) {
  125. console.log(res);
  126. // 未成功跳转到车主小程序
  127. },
  128. });
  129. } else if (data.userState === 'NORMAL') {
  130. uni.navigateTo({
  131. url: `/applyCard/product-detail?orderId=${state.orderId}&&clientFee=${state.clientFee}&&id=${state.id}`,
  132. });
  133. } else if (data.userState === 'PAUSED') {
  134. msg('已暂停车主服务')
  135. return;
  136. } else if (data.userState === 'OVERDUE') {
  137. msg('用户已开通车主服务,但欠费状态。提示用户还款,请跳转到车主服务')
  138. return;
  139. }
  140. });
  141. };
  142. </script>
  143. <style lang="scss" scoped>
  144. .action {
  145. margin-top: 40rpx;
  146. padding-left: 20rpx;
  147. padding-right: 20rpx;
  148. padding-bottom: 30rpx;
  149. .button {
  150. height: 80rpx;
  151. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  152. border-radius: 40rpx;
  153. font-size: 32rpx;
  154. font-weight: 400;
  155. color: #ffffff;
  156. line-height: 80rpx;
  157. }
  158. }
  159. .title {
  160. text-align: center;
  161. margin-top: 15rpx;
  162. font-size: 36rpx;
  163. font-family: Microsoft YaHei;
  164. font-weight: 400;
  165. color: #333333;
  166. line-height: 36rpx;
  167. }
  168. .value {
  169. padding: 0rpx 60rpx;
  170. }
  171. .content_1 {
  172. margin-top: 60rpx;
  173. font-size: 30rpx;
  174. font-family: Microsoft YaHei;
  175. font-weight: 400;
  176. color: #666666;
  177. line-height: 58rpx;
  178. }
  179. .content_2 {
  180. margin-top: 50rpx;
  181. font-size: 30rpx;
  182. font-family: Microsoft YaHei;
  183. font-weight: 400;
  184. color: #666666;
  185. line-height: 58rpx;
  186. }
  187. </style>