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

sign-up.vue 12KB

9ヶ月前
1年前
9ヶ月前
9ヶ月前
7ヶ月前
1週間前
7ヶ月前
7ヶ月前
7ヶ月前
10ヶ月前
10ヶ月前
10ヶ月前
2ヶ月前
1年前
2ヶ月前
10ヶ月前
1年前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
1年前
9ヶ月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  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. <FixedFooter>
  36. <view class="footer-action">
  37. <view class="btn-tip">
  38. <image :src="`${$imgUrl}issuance/note.png`" mode="aspectFit" class="tip-icon"></image>
  39. 注:签约成功后请返回本页面,再次点击{{state.channelSing=="0"?'开通服务':'恢复签约'}}
  40. </view>
  41. <button type="default" class="button" @click="savaHandle()">
  42. {{state.channelSing=="0"?'开通服务':'恢复签约'}}
  43. </button>
  44. </view>
  45. </FixedFooter>
  46. </view>
  47. </template>
  48. <script setup lang="ts">
  49. import { onLoad, onShow } from "@dcloudio/uni-app";
  50. import { reactive } from "vue";
  51. import { request, requestNew } from "@/utils/network/request.js";
  52. import { stringToJson } from "@/utils/network/encryption";
  53. import { fileURL } from "@/datas/fileURL.js";
  54. import { getItem, setItem } from "@/utils/storage";
  55. import { msg } from "@/utils/utils";
  56. import FixedFooter from '@/components/common/FixedFooter.vue'
  57. import {
  58. infoQuery,
  59. envs, channelSingQueryApi, userSign, getOpenId, reSign, getSignParams
  60. } from "@/utils/network/api";
  61. const imgURL = `${fileURL}image/`;
  62. import useOrderSkip from "@/composables/order/useOrderSkip";
  63. const { gotoActiveOrder} = useOrderSkip();
  64. const state = reactive({
  65. openid: "",
  66. orderId: "",
  67. id: "",
  68. clientFee: "",
  69. checked: false,
  70. agreeURL: "",
  71. channelSing: "0",//0 正常签约 1恢复签约
  72. vehiclePlate: "",
  73. code: "",
  74. orderQuery:"0",
  75. from: "",
  76. vehicleId: "",
  77. isTestSign: 0 // 是否开始检测已经签约,大于等于1的时候再去检测
  78. });
  79. onLoad((option : any) => {
  80. getOpenID();
  81. state.orderId = option.orderId;
  82. if (option.from == '37') {
  83. state.from = option.from;
  84. state.vehicleId = option.vehicleId;
  85. }
  86. if (option.channelSing) {
  87. state.channelSing = option.channelSing;
  88. }
  89. state.vehiclePlate = option.vehiclePlate;
  90. state.orderQuery = option.orderQuery;
  91. getInfo();
  92. });
  93. onShow(() => {
  94. if (state.isTestSign >= 1) {
  95. isUserSign()
  96. } else {
  97. state.isTestSign += 1
  98. }
  99. })
  100. const checkboxChange = (e) => {
  101. state.checked = !state.checked;
  102. console.log(state.checked);
  103. };
  104. // 签约检测
  105. const isUserSign = () => {
  106. let options = {
  107. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  108. data: {
  109. orderNo: state.orderId,
  110. subOpenId: state.openid,
  111. signChannelType: 1,
  112. }, //请求参数
  113. method: "POST", //提交方式(默认POST)
  114. showLoading: true, //是否显示加载中(默认显示)
  115. };
  116. requestNew(userSign, options).then(res => {
  117. console.log(res)
  118. let { userState, step } = res
  119. if (userState === "NORMAL") {
  120. msg("已开通车主服务");
  121. // 如果是等待激活
  122. if(step === 'WAITING_ACTIVE'){
  123. gotoActiveOrder(getItem('orderQueryActivate'))
  124. }else{
  125. // 正常订单
  126. setTimeout(() => {
  127. uni.redirectTo({
  128. url: `/pages/order/order?index=0`
  129. })
  130. }, 1500)
  131. }
  132. } else if (userState === "PAUSED") {
  133. msg("已暂停车主服务");
  134. return;
  135. } else if (userState === "OVERDUE") {
  136. msg("用户已开通车主服务,但欠费状态。提示用户还款,请跳转到车主服务");
  137. return;
  138. }
  139. })
  140. }
  141. const getInfo = () => {
  142. //参数说明
  143. let options = {
  144. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  145. data: {
  146. businessType: 'WITHHOLD_AGREEMENT' //代扣协议
  147. }, //请求参数
  148. method: "POST", //提交方式(默认POST)
  149. showLoading: true, //是否显示加载中(默认显示)
  150. };
  151. //调用方式
  152. requestNew(infoQuery, options)
  153. .then((res) => {
  154. let data = res
  155. if (data.textType = "URL") {
  156. state.agreeURL = envs[process.env.NODE_ENV].baseUrl + data.text
  157. }
  158. console.log("代扣协议", state.agreeURL);
  159. })
  160. .catch((err) => {
  161. console.log(err);
  162. });
  163. }
  164. //获取微信小程序openid
  165. const getOpenID = () => {
  166. // #ifdef MP-WEIXIN
  167. uni.login({
  168. provider: "weixin",
  169. success: function (e) {
  170. console.log(e);
  171. state.code = e.code
  172. getOpenid(e.code);
  173. },
  174. });
  175. // #endif
  176. };
  177. const downAuthD = () => {
  178. uni.downloadFile({
  179. url: state.agreeURL,
  180. filePath: wx.env.USER_DATA_PATH + '/' + '代扣协议.docx',
  181. success(res) {
  182. const filePath = res.filePath
  183. uni.openDocument({
  184. filePath: filePath,
  185. fileType: 'docx',
  186. showMenu: true, //关键点
  187. success: function (res) {
  188. msg("打开文档成功");
  189. },
  190. fail: function (err) {
  191. msg("打开文档失败");
  192. }
  193. });
  194. },
  195. fail: function (err) {
  196. msg("下载文档失败");
  197. console.log("err", err)
  198. },
  199. complete(res) {
  200. }
  201. })
  202. }
  203. const getOpenid = (code) => {
  204. const options = {
  205. type: 2,
  206. data: {
  207. "jsCode": code
  208. },
  209. method: "POST",
  210. showLoading: true,
  211. };
  212. // #ifdef MP-WEIXIN
  213. uni.showLoading({
  214. mask: true
  215. })
  216. requestNew(getOpenId, options).then((res) => {
  217. const result = res;
  218. state.openid = result.openid;
  219. console.log("获取微信小程序openid", state.openid);
  220. setItem("wxOpenid", result.openid);
  221. uni.hideLoading()
  222. }).catch(() => {
  223. uni.hideLoading()
  224. });
  225. // #endif
  226. }
  227. const savaHandle = () => {
  228. console.log("openid*******", state.openid);
  229. //如果获取openId成功
  230. if (state.openid) {
  231. // 从恢复签约列表进入进行恢复签约
  232. if (state.from == '37') {
  233. const options = {
  234. data: {
  235. signChannelType: 1,
  236. subOpenId: state.openid,
  237. vehicleId: state.vehicleId,
  238. },
  239. method: "POST",
  240. showLoading: true
  241. };
  242. requestNew(reSign, options).then((res) => {
  243. console.log(res, 3222);
  244. const data = res;
  245. if (data.userState === "UNAUTHORIZED") {
  246. uni.navigateToMiniProgram({
  247. appId: "wxbcad394b3d99dac9",
  248. path: "pages/route/index",
  249. extraData: {
  250. appid: data.appId,
  251. sub_appid: data.subAppId,
  252. mch_id: data.mchId,
  253. sub_mch_id: data.subMchId,
  254. nonce_str: data.nonceStr,
  255. sign_type: data.signType,
  256. trade_scene: data.tradeScene,
  257. plate_number: data.plateNumber,
  258. sub_openid: data.subOpenId,
  259. sign: data.sign,
  260. channel_type: data.channelType
  261. },
  262. success(res) {
  263. console.log(res);
  264. },
  265. complete(res) {
  266. console.log(res);
  267. },
  268. fail(res) {
  269. console.log(res);
  270. // 未成功跳转到车主小程序
  271. },
  272. });
  273. } else {
  274. msg("用户已签约");
  275. setTimeout(() => {
  276. uni.navigateBack();
  277. }, 1000);
  278. }
  279. });
  280. return;
  281. }
  282. var data = {
  283. orderNo: state.orderId,
  284. subOpenId: state.openid,
  285. signChannelType: 1,
  286. };
  287. const options = {
  288. type: 2,
  289. data: data,
  290. method: "POST",
  291. showLoading: true,
  292. };
  293. requestNew(getSignParams, options).then((res) => {
  294. const data = res;
  295. console.log("data", data)
  296. uni.navigateToMiniProgram({
  297. appId: "wxbcad394b3d99dac9",
  298. path: "pages/route/index",
  299. extraData: {
  300. appid: data.appId,
  301. sub_appid: data.subAppId,
  302. mch_id: data.mchId,
  303. sub_mch_id: data.subMchId,
  304. nonce_str: data.nonceStr,
  305. sign_type: data.signType,
  306. trade_scene: data.tradeScene,
  307. plate_number: data.plateNumber,
  308. sub_openid: data.subOpenId,
  309. sign: data.sign,
  310. channel_type: data.channelType
  311. },
  312. success(res) {
  313. console.log("签约返回信息返回信息",res);
  314. },
  315. complete(res) {
  316. console.log(res);
  317. },
  318. fail(res) {
  319. console.log(res);
  320. // 未成功跳转到车主小程序
  321. },
  322. });
  323. // if (data.userState === "UNAUTHORIZED") {
  324. // console.log("state.channelSing",state.channelSing,state.channelSing=="0")
  325. // if (state.channelSing == "0") {
  326. // uni.navigateToMiniProgram({
  327. // appId: "wxbcad394b3d99dac9",
  328. // path: "pages/route/index",
  329. // extraData: {
  330. // appid: data.appId,
  331. // sub_appid: data.subAppId,
  332. // mch_id: data.mchId,
  333. // sub_mch_id: data.subMchId,
  334. // nonce_str: data.nonceStr,
  335. // sign_type: data.signType,
  336. // trade_scene: data.tradeScene,
  337. // plate_number: data.plateNumber,
  338. // sub_openid: data.subOpenId,
  339. // sign: data.sign,
  340. // channel_type: data.channelType
  341. // },
  342. // success(res) {
  343. // console.log("签约返回信息返回信息",res);
  344. // },
  345. // complete(res) {
  346. // console.log(res);
  347. // },
  348. // fail(res) {
  349. // console.log(res);
  350. // // 未成功跳转到车主小程序
  351. // },
  352. // });
  353. // }
  354. // } else if (data.userState === "NORMAL") {
  355. // msg("已开通车主服务");
  356. // console.log("开通车主服务",data)
  357. // if(data.step === 'WAITING_ACTIVE'){
  358. // // 查询订单直接去激活
  359. // // 待激活
  360. // gotoActiveOrder(getItem('orderQueryActivate'))
  361. // }else{
  362. // // 正常订单
  363. // setTimeout(() => {
  364. // uni.redirectTo({
  365. // url: `/pages/order/order?index=0`
  366. // })
  367. // }, 1500)
  368. // }
  369. // } else if (data.userState === "PAUSED") {
  370. // msg("已暂停车主服务");
  371. // return;
  372. // } else if (data.userState === "OVERDUE") {
  373. // msg("用户已开通车主服务,但欠费状态。提示用户还款,请跳转到车主服务");
  374. // return;
  375. // }
  376. });
  377. } else {
  378. //如果获取openId失败
  379. uni.showToast({
  380. title: "网络异常,请重试!",
  381. icon: "none",
  382. duration: 1000,
  383. });
  384. return;
  385. }
  386. };
  387. </script>
  388. <style lang="scss" scoped>
  389. .container {
  390. background: #E9EDF0;
  391. height: 100vh;
  392. width: 100%;
  393. position: relative;
  394. overflow: hidden;
  395. .t-card {
  396. margin: 30rpx;
  397. background-color: #fff;
  398. border-radius: 12rpx;
  399. padding: 50rpx 30rpx;
  400. }
  401. }
  402. .footer-action {
  403. display: flex;
  404. align-items: center;
  405. justify-content: center;
  406. flex-direction: column;
  407. .btn-tip {
  408. font-family: SourceHanSansSC, SourceHanSansSC;
  409. font-weight: 400;
  410. font-size: 24rpx;
  411. color: #CCB375;
  412. margin-bottom: 14rpx;
  413. display: flex;
  414. align-items: center;
  415. .tip-icon{
  416. width: 26rpx;
  417. height: 26rpx;
  418. margin-right: 10rpx;
  419. }
  420. }
  421. .button {
  422. height: 88rpx;
  423. background: radial-gradient(at 0% 0%, #C6B077 0%, #DFCC96 100%);
  424. border-radius: 40rpx;
  425. font-size: 32rpx;
  426. font-weight: 400;
  427. color: #ffffff;
  428. line-height: 88rpx;
  429. width: 660rpx;
  430. margin: 0 auto;
  431. }
  432. }
  433. .title {
  434. margin: 0 auto;
  435. width: 322rpx;
  436. height: 44rpx;
  437. position: relative;
  438. .bg {
  439. width: 322rpx;
  440. height: 44rpx;
  441. }
  442. .bg-xia {
  443. left: 50%;
  444. position: absolute;
  445. width: 200rpx;
  446. height: 8rpx;
  447. transform: translateX(-50%);
  448. bottom: 0;
  449. }
  450. .txt {
  451. font-family: SourceHanSansSC, SourceHanSansSC;
  452. font-weight: bold;
  453. font-size: 36rpx;
  454. color: #004576;
  455. position: absolute;
  456. width: 322rpx;
  457. text-align: center;
  458. bottom: 0;
  459. }
  460. }
  461. .value {}
  462. .item {
  463. display: flex;
  464. margin-top: 60rpx;
  465. font-size: 28rpx;
  466. font-family: SourceHanSansSC, SourceHanSansSC;
  467. font-weight: 400;
  468. color: #222;
  469. line-height: 48rpx;
  470. .l-icon {
  471. margin-top: 20rpx;
  472. flex-shrink: 0;
  473. border-radius: 50%;
  474. height: 10rpx;
  475. width: 10rpx;
  476. background-color: #004576;
  477. margin-right: 18rpx;
  478. }
  479. }
  480. .item2 {
  481. margin-top: 30rpx;
  482. }
  483. </style>