Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

2 роки тому
1 рік тому
2 роки тому
1 рік тому
1 рік тому
1 рік тому
2 роки тому
1 рік тому
1 рік тому
2 роки тому
1 рік тому
2 роки тому
1 рік тому
1 рік тому
1 рік тому
2 роки тому
1 рік тому
1 рік тому
2 роки тому
1 рік тому
1 рік тому
1 рік тому
1 рік тому
1 рік тому
1 рік тому
1 рік тому
1 рік тому
1 рік тому
1 рік тому
1 рік тому
1 рік тому
1 рік тому
2 роки тому
1 рік тому
2 роки тому
1 рік тому
2 роки тому
1 рік тому
2 роки тому
1 рік тому
2 роки тому
1 рік тому
2 роки тому
1 рік тому
1 рік тому
1 рік тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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="as-layout-horizontal agreement">
  18. <checkbox-group @change="checkboxChange">
  19. <checkbox :checked="state.checked" style="transform: scale(0.8)" />我已阅读并同意
  20. </checkbox-group>
  21. <text style="color:#007AFF;text-decoration: underline;" @click="downAuthD()">《代扣协议》</text>
  22. </view>
  23. <view class="action">
  24. <button type="default" class="button" @click="savaHandle()">
  25. 开通服务
  26. </button>
  27. <!-- <button type="default" class="button" @click="addInterestsList()">
  28. 加购权益
  29. </button> -->
  30. </view>
  31. </template>
  32. <script setup lang="ts">
  33. import { onLoad, onShow } from "@dcloudio/uni-app";
  34. import { reactive } from "vue";
  35. import { etcQYAction } from "@/utils/network/api.js";
  36. import { request } from "@/utils/network/request.js";
  37. import { stringToJson } from "@/utils/network/encryption";
  38. import { fileURL } from "@/datas/fileURL.js";
  39. import navBar from "@/components/nav-bar/nav-bar2.vue";
  40. import navBgCar from "./components/nav-bg-car4";
  41. import { setItem } from "@/utils/storage";
  42. import { msg } from "@/utils/utils";
  43. import {
  44. checkOrderStatus,
  45. orderPay,
  46. wechatAppID,
  47. wechatPayConfigId,
  48. wechatSecret,
  49. getOpenidApi,
  50. infoQuery,
  51. envs
  52. } from "@/utils/network/api";
  53. const imgURL = `${fileURL}image/`;
  54. const state = reactive({
  55. openid: "",
  56. orderId: "",
  57. id: "",
  58. clientFee: "",
  59. checked: false,
  60. agreeURL: "",
  61. });
  62. onLoad((option : any) => {
  63. getOpenID();
  64. state.orderId = option.orderId;
  65. state.clientFee = option.clientFee;
  66. state.id = option.id;
  67. getInfo();
  68. });
  69. const checkboxChange = (e) => {
  70. state.checked = !state.checked;
  71. console.log(state.checked);
  72. };
  73. const getInfo = () => {
  74. //参数说明
  75. let options = {
  76. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  77. data: {
  78. businessType: 'WITHHOLD_AGREEMENT' //代扣协议
  79. }, //请求参数
  80. method: "POST", //提交方式(默认POST)
  81. showLoading: true, //是否显示加载中(默认显示)
  82. };
  83. //调用方式
  84. request(infoQuery, options)
  85. .then((res) => {
  86. let data = stringToJson(res.bizContent)
  87. if (data.textType = "URL") {
  88. state.agreeURL = envs[process.env.NODE_ENV].baseUrl + data.text
  89. }
  90. console.log("代扣协议", state.agreeURL);
  91. })
  92. .catch((err) => {
  93. console.log(err);
  94. });
  95. }
  96. //获取微信小程序openid
  97. const getOpenID = () => {
  98. // #ifdef MP-WEIXIN
  99. uni.login({
  100. provider: "weixin",
  101. success: function (e) {
  102. console.log(e);
  103. getOpenid(e.code);
  104. // uni.request({
  105. // url: `https://api.weixin.qq.com/sns/jscode2session?appid=${wechatAppID}&secret=${wechatSecret}&js_code=${e.code}&grant_type=authorization_code`,
  106. // success: (res: any) => {
  107. // state.openid = res.data.openid;
  108. // setItem("QYorder", state);
  109. // console.log(res);
  110. // },
  111. // fail: (err: any) => {
  112. // uni.showToast({
  113. // title: "网络异常,请重试!" + err.errcode,
  114. // icon: "error",
  115. // duration: 500,
  116. // });
  117. // return;
  118. // },
  119. // });
  120. },
  121. });
  122. // #endif
  123. };
  124. const downAuthD = () => {
  125. // tools.showLoadingAlert("加载中");
  126. uni.downloadFile({
  127. url: state.agreeURL,
  128. filePath: wx.env.USER_DATA_PATH + '/' + '代扣协议.docx',
  129. success(res) {
  130. const filePath = res.filePath
  131. uni.openDocument({
  132. filePath: filePath,
  133. fileType: 'docx',
  134. showMenu: true, //关键点
  135. success: function (res) {
  136. msg("打开文档成功");
  137. },
  138. fail: function (err) {
  139. msg("打开文档失败");
  140. }
  141. });
  142. },
  143. fail: function (err) {
  144. msg("下载文档失败");
  145. console.log("err", err)
  146. },
  147. complete(res) {
  148. }
  149. })
  150. }
  151. const getOpenid = (code) => {
  152. const options = {
  153. type: 2,
  154. data: {
  155. "jsCode": code
  156. },
  157. method: "POST",
  158. showLoading: true,
  159. };
  160. // #ifdef MP-WEIXIN
  161. request(getOpenidApi, options).then((res) => {
  162. const result = stringToJson(res.bizContent);
  163. console.log("获取微信小程序openid", result);
  164. const openidData = stringToJson(result.data);
  165. state.openid = openidData.openid;
  166. setItem("QYorder", state);
  167. });
  168. // #endif
  169. }
  170. const addInterestsList = () => {
  171. uni.navigateTo({
  172. url: `/subpackage/orders/interestsList?orderId=${state.orderId}&&clientFee=${state.clientFee}&&id=${state.id}`
  173. });
  174. }
  175. const savaHandle = () => {
  176. if (!state.checked) {
  177. msg("请勾选协议!")
  178. return;
  179. }
  180. console.log("openid*******", state.openid);
  181. //如果获取openId成功
  182. if (state.openid) {
  183. var data = {
  184. orderId: state.orderId,
  185. subOpenId: state.openid,
  186. };
  187. const options = {
  188. type: 2,
  189. data: data,
  190. method: "POST",
  191. showLoading: true,
  192. };
  193. request(etcQYAction, options).then((res) => {
  194. const data = stringToJson(res.bizContent);
  195. if (data.userState === "UNAUTHORIZED") {
  196. uni.navigateToMiniProgram({
  197. appId: "wxbcad394b3d99dac9",
  198. path: "pages/route/index",
  199. extraData: {
  200. appid: "wxcb1388c809fe25a9",
  201. sub_appid: "wx008c60533388527a",
  202. mch_id: "1500877591",
  203. sub_mch_id: "1622652848",
  204. nonce_str: data.nonceStr,
  205. sign_type: "HMAC-SHA256",
  206. trade_scene: "HIGHWAY",
  207. plate_number: data.plateNumber,
  208. sub_openid: data.subOpenId,
  209. sign: data.sign,
  210. },
  211. success(res) {
  212. console.log(res);
  213. },
  214. complete(res) {
  215. console.log(res);
  216. },
  217. fail(res) {
  218. console.log(res);
  219. // 未成功跳转到车主小程序
  220. },
  221. });
  222. } else if (data.userState === "NORMAL") {
  223. msg("已开通车主服务");
  224. // uni.navigateTo({
  225. // url: `/subpackage/orders/product-detail?orderId=${state.orderId}&&clientFee=${state.clientFee}&&id=${state.id}`,
  226. // });
  227. uni.switchTab({
  228. url: "/pages/order/order"
  229. })
  230. } else if (data.userState === "PAUSED") {
  231. msg("已暂停车主服务");
  232. return;
  233. } else if (data.userState === "OVERDUE") {
  234. msg("用户已开通车主服务,但欠费状态。提示用户还款,请跳转到车主服务");
  235. return;
  236. }
  237. });
  238. } else {
  239. //如果获取openId失败
  240. uni.showToast({
  241. title: "网络异常,请重试!",
  242. icon: "none",
  243. duration: 1000,
  244. });
  245. return;
  246. }
  247. };
  248. </script>
  249. <style lang="scss" scoped>
  250. .action {
  251. margin-top: 40rpx;
  252. padding-left: 20rpx;
  253. padding-right: 20rpx;
  254. padding-bottom: 30rpx;
  255. .button {
  256. height: 80rpx;
  257. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  258. border-radius: 40rpx;
  259. font-size: 32rpx;
  260. font-weight: 400;
  261. color: #ffffff;
  262. line-height: 80rpx;
  263. }
  264. }
  265. .title {
  266. text-align: center;
  267. margin-top: 15rpx;
  268. font-size: 36rpx;
  269. font-family: Microsoft YaHei;
  270. font-weight: 400;
  271. color: #333333;
  272. line-height: 36rpx;
  273. }
  274. .value {
  275. padding: 0rpx 60rpx;
  276. }
  277. .content_1 {
  278. margin-top: 60rpx;
  279. font-size: 30rpx;
  280. font-family: Microsoft YaHei;
  281. font-weight: 400;
  282. color: #666666;
  283. line-height: 58rpx;
  284. }
  285. .content_2 {
  286. margin-top: 50rpx;
  287. font-size: 30rpx;
  288. font-family: Microsoft YaHei;
  289. font-weight: 400;
  290. color: #666666;
  291. line-height: 58rpx;
  292. }
  293. .agreement {
  294. font-size: 30rpx;
  295. display: flex;
  296. flex-wrap: wrap;
  297. margin-top: 20rpx;
  298. align-items: center;
  299. justify-content: center;
  300. }
  301. </style>