Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <image
  3. style="
  4. margin-top: 20rpx;
  5. width: 100%;
  6. height: 240rpx;
  7. background-color: #eeeeee;
  8. "
  9. :src="`${$imgUrl}applyCard/car-service.png`"
  10. ></image>
  11. <view class="title"> 微信车主服务 </view>
  12. <view class="value">
  13. <view class="content_1">
  14. 微信车主服务是微信支付为车主用户提供的安全便捷的智慧服务
  15. </view>
  16. <view class="content_2">
  17. 本次将为贵州黔通智联科技股份有限公司开启免密支付服务,后续相关的费用将通过微信车主服务从你的微信支付账户扣除
  18. </view>
  19. </view>
  20. <view class="action">
  21. <button type="default" class="button" @click="savaHandle()">
  22. 开通服务
  23. </button>
  24. <!-- <button type="default" class="button" @click="addInterestsList()">
  25. 加购权益
  26. </button> -->
  27. </view>
  28. </template>
  29. <script setup lang="ts">
  30. import { onLoad, onShow } from "@dcloudio/uni-app";
  31. import { reactive } from "vue";
  32. import { etcQYAction } from "@/utils/network/api.js";
  33. import { request } from "@/utils/network/request.js";
  34. import { stringToJson } from "@/utils/network/encryption";
  35. import { fileURL } from "@/datas/fileURL.js";
  36. import navBar from "@/components/nav-bar/nav-bar2.vue";
  37. import navBgCar from "./components/nav-bg-car4";
  38. import { setItem } from "@/utils/storage";
  39. import { msg} from "@/utils/utils";
  40. import {
  41. checkOrderStatus,
  42. orderPay,
  43. wechatAppID,
  44. wechatPayConfigId,
  45. wechatSecret,
  46. } from "@/utils/network/api";
  47. const imgURL = `${fileURL}image/`;
  48. const state = reactive({
  49. openid: "",
  50. orderId: "",
  51. id: "",
  52. clientFee: "",
  53. });
  54. onLoad((option: any) => {
  55. getOpenID();
  56. state.orderId = option.orderId;
  57. state.clientFee = option.clientFee;
  58. state.id = option.id;
  59. });
  60. //获取微信小程序openid
  61. const getOpenID = () => {
  62. uni.login({
  63. provider: "weixin",
  64. success: function (e) {
  65. console.log(e);
  66. uni.request({
  67. url: `https://api.weixin.qq.com/sns/jscode2session?appid=${wechatAppID}&secret=${wechatSecret}&js_code=${e.code}&grant_type=authorization_code`,
  68. success: (res: any) => {
  69. state.openid = res.data.openid;
  70. setItem("QYorder", state);
  71. console.log(res);
  72. },
  73. fail: (err: any) => {
  74. uni.showToast({
  75. title: "网络异常,请重试!" + err.errcode,
  76. icon: "error",
  77. duration: 500,
  78. });
  79. return;
  80. },
  81. });
  82. },
  83. });
  84. };
  85. const addInterestsList=()=>{
  86. uni.navigateTo({
  87. url:`/subpackage/orders/interestsList?orderId=${state.orderId}&&clientFee=${state.clientFee}&&id=${state.id}`
  88. });
  89. }
  90. const savaHandle = () => {
  91. console.log("openid*******", state.openid);
  92. //如果获取openId成功
  93. if (state.openid) {
  94. var data = {
  95. orderId: state.orderId,
  96. subOpenId: state.openid,
  97. };
  98. const options = {
  99. type: 2,
  100. data: data,
  101. method: "POST",
  102. showLoading: true,
  103. };
  104. request(etcQYAction, options).then((res) => {
  105. const data = stringToJson(res.bizContent);
  106. if (data.userState === "UNAUTHORIZED") {
  107. uni.navigateToMiniProgram({
  108. appId: "wxbcad394b3d99dac9",
  109. path: "pages/route/index",
  110. extraData: {
  111. appid: "wxcb1388c809fe25a9",
  112. sub_appid: "wx008c60533388527a",
  113. mch_id: "1500877591",
  114. sub_mch_id: "1622652848",
  115. nonce_str: data.nonceStr,
  116. sign_type: "HMAC-SHA256",
  117. trade_scene: "HIGHWAY",
  118. plate_number: data.plateNumber,
  119. sub_openid: data.subOpenId,
  120. sign: data.sign,
  121. },
  122. success(res) {
  123. console.log(res);
  124. },
  125. complete(res) {
  126. console.log(res);
  127. },
  128. fail(res) {
  129. console.log(res);
  130. // 未成功跳转到车主小程序
  131. },
  132. });
  133. } else if (data.userState === "NORMAL") {
  134. msg("已开通车主服务");
  135. // uni.navigateTo({
  136. // url: `/subpackage/orders/product-detail?orderId=${state.orderId}&&clientFee=${state.clientFee}&&id=${state.id}`,
  137. // });
  138. uni.navigateTo({
  139. url:`/subpackage/orders/interestsList?orderId=${state.orderId}&&clientFee=${state.clientFee}&&id=${state.id}`
  140. });
  141. } else if (data.userState === "PAUSED") {
  142. msg("已暂停车主服务");
  143. return;
  144. } else if (data.userState === "OVERDUE") {
  145. msg("用户已开通车主服务,但欠费状态。提示用户还款,请跳转到车主服务");
  146. return;
  147. }
  148. });
  149. } else {
  150. //如果获取openId失败
  151. uni.showToast({
  152. title: "网络异常,请重试!",
  153. icon: "none",
  154. duration: 1000,
  155. });
  156. return;
  157. }
  158. };
  159. </script>
  160. <style lang="scss" scoped>
  161. .action {
  162. margin-top: 40rpx;
  163. padding-left: 20rpx;
  164. padding-right: 20rpx;
  165. padding-bottom: 30rpx;
  166. .button {
  167. height: 80rpx;
  168. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  169. border-radius: 40rpx;
  170. font-size: 32rpx;
  171. font-weight: 400;
  172. color: #ffffff;
  173. line-height: 80rpx;
  174. }
  175. }
  176. .title {
  177. text-align: center;
  178. margin-top: 15rpx;
  179. font-size: 36rpx;
  180. font-family: Microsoft YaHei;
  181. font-weight: 400;
  182. color: #333333;
  183. line-height: 36rpx;
  184. }
  185. .value {
  186. padding: 0rpx 60rpx;
  187. }
  188. .content_1 {
  189. margin-top: 60rpx;
  190. font-size: 30rpx;
  191. font-family: Microsoft YaHei;
  192. font-weight: 400;
  193. color: #666666;
  194. line-height: 58rpx;
  195. }
  196. .content_2 {
  197. margin-top: 50rpx;
  198. font-size: 30rpx;
  199. font-family: Microsoft YaHei;
  200. font-weight: 400;
  201. color: #666666;
  202. line-height: 58rpx;
  203. }
  204. </style>