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.

product-detail.vue 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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 { onLoad, onShow } from "@dcloudio/uni-app";
  25. import { reactive } from "vue";
  26. import { etcQYAction, getOpenidApi } from "@/utils/network/api.js";
  27. import { request } from "@/utils/network/request.js";
  28. import { stringToJson } from "@/utils/network/encryption";
  29. import { fileURL } from "@/datas/fileURL.js";
  30. import navBar from "../../components/nav-bar/nav-bar2.vue";
  31. import navBgCar from "./components/nav-bg-car4";
  32. import { getItem, StorageKeys } from "@/utils/storage.ts";
  33. import { msg } from "@/utils/utils";
  34. import {
  35. checkOrderStatus,
  36. orderPay,
  37. wechatAppID,
  38. wechatPayConfigId,
  39. wechatSecret,
  40. } from "@/utils/network/api";
  41. const imgURL = `${fileURL}image/`;
  42. const savaHandle = () => {
  43. // var data = {
  44. // orderId: state.orderId,
  45. // subOpenId: state.openid
  46. // }
  47. // const options = {
  48. // type: 2,
  49. // data: data,
  50. // method: 'POST',
  51. // showLoading: true,
  52. // }
  53. // request(etcQYAction, options).then((res) => {
  54. // const data = stringToJson(res.bizContent);
  55. // uni.navigateToMiniProgram({
  56. // appId: data.appId,
  57. // path: data.path,
  58. // extraData: {
  59. // appid: data.appid,
  60. // sub_appid: data.subAppid,
  61. // mch_id: data.mchId,
  62. // sub_mch_id: data.subMchId,
  63. // nonce_str: data.nonceStr,
  64. // sign_type: "HMAC-SHA256",
  65. // sign: data.sign,
  66. // trade_scene: data.tradeScene,
  67. // plate_number: data.plateNum,
  68. // sub_openid: data.subOpenId,
  69. // channel_type: data.channelType,
  70. // },
  71. // success(res) {
  72. // console.log(res);
  73. // },
  74. // complete(res) {
  75. // },
  76. // fail(res) {
  77. // // 未成功跳转到车主小程序
  78. // },
  79. // });
  80. // })
  81. };
  82. const state = reactive({
  83. openid: "",
  84. orderId: "",
  85. });
  86. onLoad((option : any) => {
  87. getOpenID();
  88. state.orderId = option.orderId;
  89. });
  90. //获取微信小程序openid
  91. const getOpenID = () => {
  92. uni.login({
  93. provider: "weixin",
  94. success: function (e) {
  95. getOpenid(e.code)
  96. // uni.request({
  97. // url: `https://api.weixin.qq.com/sns/jscode2session?appid=${wechatAppID}&secret=${wechatSecret}&js_code=${e.code}&grant_type=authorization_code`,
  98. // success: (res: any) => {
  99. // state.openid = res.data.openid;
  100. // },
  101. // });
  102. },
  103. });
  104. };
  105. const getOpenid = (code) => {
  106. const options = {
  107. type: 2,
  108. data: {
  109. "jsCode": code
  110. },
  111. method: "POST",
  112. showLoading: true,
  113. };
  114. // #ifdef MP-WEIXIN
  115. request(getOpenidApi, options).then((res) => {
  116. const result = stringToJson(res.bizContent);
  117. console.log("获取微信小程序openid", result);
  118. const openidData = stringToJson(result.data);
  119. // setItem("QYorder", result.data);
  120. state.openid = openidData.openid
  121. });
  122. // #endif
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .action {
  127. margin-top: 40rpx;
  128. padding-left: 20rpx;
  129. padding-right: 20rpx;
  130. padding-bottom: 30rpx;
  131. .button {
  132. height: 80rpx;
  133. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  134. border-radius: 40rpx;
  135. font-size: 32rpx;
  136. font-weight: 400;
  137. color: #ffffff;
  138. line-height: 80rpx;
  139. }
  140. }
  141. .title {
  142. text-align: center;
  143. margin-top: 15rpx;
  144. font-size: 36rpx;
  145. font-family: Microsoft YaHei;
  146. font-weight: 400;
  147. color: #333333;
  148. line-height: 36rpx;
  149. }
  150. .value {
  151. padding: 0rpx 60rpx;
  152. }
  153. .content_1 {
  154. margin-top: 60rpx;
  155. font-size: 30rpx;
  156. font-family: Microsoft YaHei;
  157. font-weight: 400;
  158. color: #666666;
  159. line-height: 58rpx;
  160. }
  161. .content_2 {
  162. margin-top: 50rpx;
  163. font-size: 30rpx;
  164. font-family: Microsoft YaHei;
  165. font-weight: 400;
  166. color: #666666;
  167. line-height: 58rpx;
  168. }
  169. </style>