選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

sign-up.vue 9.5KB

6ヶ月前
1年前
6ヶ月前
6ヶ月前
4ヶ月前
6ヶ月前
4ヶ月前
4ヶ月前
4ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
1年前
7ヶ月前
7ヶ月前
4ヶ月前
1年前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
1年前
6ヶ月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. <template>
  2. <view class="container">
  3. <view class="t-card">
  4. <view class="title">
  5. <image :src="`${$imgUrl}issuance/title-bg.png`" mode="aspectFit" class='bg'></image>
  6. <image :src="`${$imgUrl}issuance/bg-xia.png`" mode="aspectFit" class='bg-xia'></image>
  7. <view class="txt">
  8. 微信车主服务
  9. </view>
  10. </view>
  11. <view class="value">
  12. <view class="item">
  13. <view class="l-icon"></view>
  14. <view class="r-txt">
  15. 微信车主服务是微信支付为车主用户提供的安全便捷的智慧服务
  16. </view>
  17. </view>
  18. <view class="item item2">
  19. <view class="l-icon"></view>
  20. <view class="r-txt">
  21. 本次将为贵州黔通智联科技股份有限公司开启免密支付服务,后续相关的费用将通过微信车主服务从你的微信支付账户扣除
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="action">
  27. <view class="btn-tip">
  28. <image :src="`${$imgUrl}issuance/note.png`" mode="aspectFit" class="tip-icon"></image>
  29. 注:签约成功后请返回本页面,再次点击{{state.channelSing=="0"?'开通服务':'恢复签约'}}
  30. </view>
  31. <button type="default" class="button" @click="savaHandle()">
  32. {{state.channelSing=="0"?'开通服务':'恢复签约'}}
  33. </button>
  34. </view>
  35. </view>
  36. </template>
  37. <script setup lang="ts">
  38. import { onLoad, onShow } from "@dcloudio/uni-app";
  39. import { reactive } from "vue";
  40. import { request, requestNew } from "@/utils/network/request.js";
  41. import { stringToJson } from "@/utils/network/encryption";
  42. import { fileURL } from "@/datas/fileURL.js";
  43. import { getItem, setItem } from "@/utils/storage";
  44. import { msg } from "@/utils/utils";
  45. import {
  46. infoQuery,
  47. envs, channelSingQueryApi, userSign, getOpenId
  48. } from "@/utils/network/api";
  49. const imgURL = `${fileURL}image/`;
  50. import useOrderSkip from "@/composables/order/useOrderSkip";
  51. const { gotoActiveOrder} = useOrderSkip();
  52. const state = reactive({
  53. openid: "",
  54. orderId: "",
  55. id: "",
  56. clientFee: "",
  57. checked: false,
  58. agreeURL: "",
  59. channelSing: "0",//0 正常签约 1恢复签约
  60. vehiclePlate: "",
  61. code: "",
  62. orderQuery:"0"
  63. });
  64. onLoad((option : any) => {
  65. getOpenID();
  66. state.orderId = option.orderId;
  67. if (option.channelSing) {
  68. state.channelSing = option.channelSing;
  69. }
  70. console.log("state.channelSing",option.channelSing,option)
  71. state.vehiclePlate = option.vehiclePlate;
  72. state.orderQuery = option.orderQuery;
  73. getInfo();
  74. });
  75. const checkboxChange = (e) => {
  76. state.checked = !state.checked;
  77. console.log(state.checked);
  78. };
  79. const getInfo = () => {
  80. //参数说明
  81. let options = {
  82. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  83. data: {
  84. businessType: 'WITHHOLD_AGREEMENT' //代扣协议
  85. }, //请求参数
  86. method: "POST", //提交方式(默认POST)
  87. showLoading: true, //是否显示加载中(默认显示)
  88. };
  89. //调用方式
  90. requestNew(infoQuery, options)
  91. .then((res) => {
  92. let data = res
  93. if (data.textType = "URL") {
  94. state.agreeURL = envs[process.env.NODE_ENV].baseUrl + data.text
  95. }
  96. console.log("代扣协议", state.agreeURL);
  97. })
  98. .catch((err) => {
  99. console.log(err);
  100. });
  101. }
  102. //获取微信小程序openid
  103. const getOpenID = () => {
  104. // #ifdef MP-WEIXIN
  105. uni.login({
  106. provider: "weixin",
  107. success: function (e) {
  108. console.log(e);
  109. state.code = e.code
  110. getOpenid(e.code);
  111. },
  112. });
  113. // #endif
  114. };
  115. const downAuthD = () => {
  116. uni.downloadFile({
  117. url: state.agreeURL,
  118. filePath: wx.env.USER_DATA_PATH + '/' + '代扣协议.docx',
  119. success(res) {
  120. const filePath = res.filePath
  121. uni.openDocument({
  122. filePath: filePath,
  123. fileType: 'docx',
  124. showMenu: true, //关键点
  125. success: function (res) {
  126. msg("打开文档成功");
  127. },
  128. fail: function (err) {
  129. msg("打开文档失败");
  130. }
  131. });
  132. },
  133. fail: function (err) {
  134. msg("下载文档失败");
  135. console.log("err", err)
  136. },
  137. complete(res) {
  138. }
  139. })
  140. }
  141. const getOpenid = (code) => {
  142. const options = {
  143. type: 2,
  144. data: {
  145. "jsCode": code
  146. },
  147. method: "POST",
  148. showLoading: true,
  149. };
  150. // #ifdef MP-WEIXIN
  151. requestNew(getOpenId, options).then((res) => {
  152. const result = res;
  153. const openidData = stringToJson(result.data);
  154. state.openid = openidData.openid;
  155. console.log("获取微信小程序openid", state.openid);
  156. setItem("QYorder", openidData);
  157. });
  158. // #endif
  159. }
  160. const savaHandle = () => {
  161. console.log("openid*******", state.openid);
  162. //如果获取openId成功
  163. if (state.openid) {
  164. var data = {
  165. orderId: state.orderId,
  166. subOpenId: state.openid,
  167. };
  168. const options = {
  169. type: 2,
  170. data: data,
  171. method: "POST",
  172. showLoading: true,
  173. };
  174. requestNew(userSign, options).then((res) => {
  175. const data = res;
  176. console.log("data", data)
  177. if (data.userState === "UNAUTHORIZED") {
  178. console.log("state.channelSing",state.channelSing,state.channelSing=="0")
  179. if (state.channelSing == "0") {
  180. uni.navigateToMiniProgram({
  181. appId: "wxbcad394b3d99dac9",
  182. path: "pages/route/index",
  183. extraData: {
  184. appid: data.appid,
  185. sub_appid: data.subAppid,
  186. mch_id: data.mchId,
  187. sub_mch_id: data.subMchId,
  188. nonce_str: data.nonceStr,
  189. sign_type: data.signType,
  190. trade_scene: data.tradeScene,
  191. plate_number: data.plateNumber,
  192. sub_openid: data.subOpenId,
  193. sign: data.sign,
  194. channel_type: data.channelType
  195. },
  196. success(res) {
  197. console.log(res);
  198. },
  199. complete(res) {
  200. console.log(res);
  201. },
  202. fail(res) {
  203. console.log(res);
  204. // 未成功跳转到车主小程序
  205. },
  206. });
  207. } else {
  208. // 恢复签约
  209. const optionss = {
  210. type: 2,
  211. data: {
  212. plateNumber: state.vehiclePlate,
  213. openid: state.openid,
  214. channelId: '52010188925',
  215. tradeScene: 'HIGHWAY',
  216. code: state.code
  217. },
  218. method: "POST",
  219. showLoading: true,
  220. };
  221. requestNew(channelSingQueryApi, optionss)
  222. .then((res) => {
  223. let data = res
  224. uni.navigateToMiniProgram({
  225. appId: "wxbcad394b3d99dac9",
  226. path: "pages/route/index",
  227. extraData: {
  228. appid: data.appid,
  229. sub_appid: data.subAppid,
  230. mch_id: data.mchId,
  231. sub_mch_id: data.subMchId,
  232. nonce_str: data.nonceStr,
  233. sign_type: data.signType,
  234. trade_scene: data.tradeScene,
  235. plate_number: data.plateNumber,
  236. sub_openid: data.subOpenid,
  237. sign: data.sign,
  238. channel_type: data.channelType
  239. },
  240. success(res) {
  241. },
  242. complete(res) {
  243. console.log(res);
  244. },
  245. fail(res) {
  246. console.log(res);
  247. // 未成功跳转到车主小程序
  248. },
  249. });
  250. })
  251. .catch((err) => {
  252. console.log(err);
  253. });
  254. }
  255. } else if (data.userState === "NORMAL") {
  256. msg("已开通车主服务");
  257. if(state.orderQuery=='1'){
  258. // 查询订单直接去激活
  259. // 待激活
  260. gotoActiveOrder(getItem('orderQueryActivate'))
  261. }else{
  262. // 正常订单
  263. setTimeout(() => {
  264. uni.redirectTo({
  265. url: `/pages/order/order?index=0`
  266. })
  267. }, 1500)
  268. }
  269. } else if (data.userState === "PAUSED") {
  270. msg("已暂停车主服务");
  271. return;
  272. } else if (data.userState === "OVERDUE") {
  273. msg("用户已开通车主服务,但欠费状态。提示用户还款,请跳转到车主服务");
  274. return;
  275. }
  276. });
  277. } else {
  278. //如果获取openId失败
  279. uni.showToast({
  280. title: "网络异常,请重试!",
  281. icon: "none",
  282. duration: 1000,
  283. });
  284. return;
  285. }
  286. };
  287. </script>
  288. <style lang="scss" scoped>
  289. .container {
  290. background: #E9EDF0;
  291. height: 100vh;
  292. width: 100%;
  293. position: relative;
  294. overflow: hidden;
  295. .t-card {
  296. margin: 30rpx;
  297. background-color: #fff;
  298. border-radius: 12rpx;
  299. padding: 50rpx 30rpx;
  300. }
  301. }
  302. .action {
  303. position: absolute;
  304. bottom: 0rpx;
  305. left: 0;
  306. height: 188rpx;
  307. background-color: #fff;
  308. border-radius: 30rpx 30rpx 0 0;
  309. width: 100vw;
  310. display: flex;
  311. align-items: center;
  312. justify-content: center;
  313. flex-direction: column;
  314. .btn-tip {
  315. font-family: SourceHanSansSC, SourceHanSansSC;
  316. font-weight: 400;
  317. font-size: 24rpx;
  318. color: #CCB375;
  319. margin-bottom: 14rpx;
  320. display: flex;
  321. align-items: center;
  322. .tip-icon{
  323. width: 26rpx;
  324. height: 26rpx;
  325. margin-right: 10rpx;
  326. }
  327. }
  328. .button {
  329. height: 88rpx;
  330. background: radial-gradient(at 0% 0%, #C6B077 0%, #DFCC96 100%);
  331. border-radius: 40rpx;
  332. font-size: 32rpx;
  333. font-weight: 400;
  334. color: #ffffff;
  335. line-height: 88rpx;
  336. width: 660rpx;
  337. margin: 0 auto;
  338. }
  339. }
  340. .title {
  341. margin: 0 auto;
  342. width: 322rpx;
  343. height: 44rpx;
  344. position: relative;
  345. .bg {
  346. width: 322rpx;
  347. height: 44rpx;
  348. }
  349. .bg-xia {
  350. left: 50%;
  351. position: absolute;
  352. width: 200rpx;
  353. height: 8rpx;
  354. transform: translateX(-50%);
  355. bottom: 0;
  356. }
  357. .txt {
  358. font-family: SourceHanSansSC, SourceHanSansSC;
  359. font-weight: bold;
  360. font-size: 36rpx;
  361. color: #004576;
  362. position: absolute;
  363. width: 322rpx;
  364. text-align: center;
  365. bottom: 0;
  366. }
  367. }
  368. .value {}
  369. .item {
  370. display: flex;
  371. margin-top: 60rpx;
  372. font-size: 28rpx;
  373. font-family: SourceHanSansSC, SourceHanSansSC;
  374. font-weight: 400;
  375. color: #222;
  376. line-height: 48rpx;
  377. .l-icon {
  378. margin-top: 20rpx;
  379. flex-shrink: 0;
  380. border-radius: 50%;
  381. height: 10rpx;
  382. width: 10rpx;
  383. background-color: #004576;
  384. margin-right: 18rpx;
  385. }
  386. }
  387. .item2 {
  388. margin-top: 30rpx;
  389. }
  390. </style>