Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

sign-up.vue 5.1KB

před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. });
  71. //获取微信小程序openid
  72. const getOpenID = () => {
  73. uni.login({
  74. provider: "weixin",
  75. success: function(e) {
  76. console.log(e);
  77. uni.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. fail:(err :any)=>{
  85. uni.showToast({
  86. title: "网络异常,请重试!"+err.errcode,
  87. icon:"error",
  88. duration: 500
  89. })
  90. return;
  91. }
  92. });
  93. },
  94. });
  95. };
  96. const savaHandle = () => {
  97. console.log("openid*******",state.openid);
  98. //如果获取openId成功
  99. if (state.openid) {
  100. var data = {
  101. orderId: state.orderId,
  102. subOpenId: state.openid,
  103. };
  104. const options = {
  105. type: 2,
  106. data: data,
  107. method: "POST",
  108. showLoading: true,
  109. };
  110. request(etcQYAction, options).then((res) => {
  111. const data = stringToJson(res.bizContent);
  112. console.log(data);
  113. if (data.userState === 'UNAUTHORIZED') {
  114. uni.navigateToMiniProgram({
  115. appId: 'wxbcad394b3d99dac9',
  116. path: 'pages/route/index',
  117. extraData: {
  118. appid: 'wxcb1388c809fe25a9',
  119. sub_appid: 'wx008c60533388527a',
  120. mch_id: '1500877591',
  121. sub_mch_id: '1622652848',
  122. nonce_str: data.nonceStr,
  123. sign_type: 'HMAC-SHA256',
  124. trade_scene: 'HIGHWAY',
  125. plate_number: data.plateNumber,
  126. sub_openid: data.subOpenId,
  127. sign: data.sign,
  128. },
  129. success(res) {
  130. console.log(res);
  131. },
  132. complete(res) {
  133. console.log(res);
  134. },
  135. fail(res) {
  136. console.log(res);
  137. // 未成功跳转到车主小程序
  138. },
  139. });
  140. } else if (data.userState === 'NORMAL') {
  141. msg('已开通车主服务')
  142. uni.navigateTo({
  143. url: `/applyCard/product-detail?orderId=${state.orderId}&&clientFee=${state.clientFee}&&id=${state.id}`,
  144. });
  145. } else if (data.userState === 'PAUSED') {
  146. msg('已暂停车主服务')
  147. return;
  148. } else if (data.userState === 'OVERDUE') {
  149. msg('用户已开通车主服务,但欠费状态。提示用户还款,请跳转到车主服务')
  150. return;
  151. }
  152. });
  153. } else {
  154. //如果获取openId失败
  155. uni.showToast({
  156. title: "网络异常,请重试!",
  157. icon:"none",
  158. duration: 1000
  159. })
  160. return;
  161. }
  162. };
  163. </script>
  164. <style lang="scss" scoped>
  165. .action {
  166. margin-top: 40rpx;
  167. padding-left: 20rpx;
  168. padding-right: 20rpx;
  169. padding-bottom: 30rpx;
  170. .button {
  171. height: 80rpx;
  172. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  173. border-radius: 40rpx;
  174. font-size: 32rpx;
  175. font-weight: 400;
  176. color: #ffffff;
  177. line-height: 80rpx;
  178. }
  179. }
  180. .title {
  181. text-align: center;
  182. margin-top: 15rpx;
  183. font-size: 36rpx;
  184. font-family: Microsoft YaHei;
  185. font-weight: 400;
  186. color: #333333;
  187. line-height: 36rpx;
  188. }
  189. .value {
  190. padding: 0rpx 60rpx;
  191. }
  192. .content_1 {
  193. margin-top: 60rpx;
  194. font-size: 30rpx;
  195. font-family: Microsoft YaHei;
  196. font-weight: 400;
  197. color: #666666;
  198. line-height: 58rpx;
  199. }
  200. .content_2 {
  201. margin-top: 50rpx;
  202. font-size: 30rpx;
  203. font-family: Microsoft YaHei;
  204. font-weight: 400;
  205. color: #666666;
  206. line-height: 58rpx;
  207. }
  208. </style>