Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

sign-up-ali.vue 7.7KB

1 år sedan
6 månader sedan
6 månader sedan
1 år sedan
6 månader sedan
1 år sedan
6 månader sedan
6 månader sedan
1 år sedan
6 månader sedan
1 år sedan
1 år sedan
7 månader sedan
7 månader sedan
6 månader sedan
6 månader sedan
6 månader sedan
1 år sedan
1 år sedan
1 år sedan
6 månader sedan
6 månader sedan
6 månader sedan
6 månader sedan
6 månader sedan
6 månader sedan
6 månader sedan
6 månader sedan
6 månader sedan
6 månader sedan
6 månader sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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">
  19. <view class="l-icon"></view>
  20. <view class="r-txt">
  21. 本次将为贵州黔通智联科技股份有限公司开启免密支付服务,后续相关的费用将通过支付宝签约代扣从你的支付宝账户扣除
  22. </view>
  23. </view>
  24. </view>
  25. <view class="as-layout-horizontal agreement">
  26. <checkbox-group @change="checkboxChange">
  27. <checkbox :checked="state.checked" style="transform: scale(0.8)" />我已阅读并同意
  28. </checkbox-group>
  29. <text style="color:#007AFF;text-decoration: underline;" @click="downAuthD()">《代扣协议》</text>
  30. </view>
  31. </view>
  32. <view class="action">
  33. <view class="btn-tip">
  34. <image :src="`${$imgUrl}issuance/note.png`" mode="aspectFit" class="tip-icon"></image>
  35. 注:签约成功后请返回本页面,再次点击开通服务
  36. </view>
  37. <button type="default" class="button" @click="savaHandle()">
  38. 开通服务
  39. </button>
  40. </view>
  41. </view>
  42. </template>
  43. <script setup lang="ts">
  44. import { onLoad, onShow } from "@dcloudio/uni-app";
  45. import { reactive } from "vue";
  46. import { request, requestNew } from "@/utils/network/request.js";
  47. import { stringToJson } from "@/utils/network/encryption";
  48. import { fileURL } from "@/datas/fileURL.js";
  49. import { msg, confirm } from "@/utils/utils";
  50. import {
  51. aliPayConfigIdTwo,
  52. obtainUserId,
  53. infoQuery,
  54. envs, userSign
  55. } from "@/utils/network/api";
  56. const imgURL = `${fileURL}image/`;
  57. const state = reactive({
  58. openid: "",
  59. orderId: "",
  60. id: "",
  61. clientFee: "",
  62. code: "",
  63. checked: false,
  64. agreeURL: "",
  65. channelSing: "0",//0 正常签约 1恢复签约
  66. });
  67. onLoad((option : any) => {
  68. state.orderId = option.orderId;
  69. if (option.channelSing) {
  70. state.channelSing = option.channelSing;
  71. }
  72. state.vehiclePlate = option.vehiclePlate;
  73. getInfo();
  74. });
  75. const checkboxChange = (e) => {
  76. state.checked = !state.checked;
  77. console.log(state.checked);
  78. };
  79. const downAuthD = () => {
  80. uni.downloadFile({
  81. url: state.agreeURL,
  82. filePath: uni.env.USER_DATA_PATH + '/' + '代扣协议.docx',
  83. success(res) {
  84. const filePath = res.filePath
  85. uni.openDocument({
  86. filePath: filePath,
  87. fileType: 'docx',
  88. showMenu: true, //关键点
  89. success: function (res) {
  90. },
  91. fail: function (err) {
  92. msg("打开文档失败");
  93. }
  94. });
  95. },
  96. fail: function (err) {
  97. msg("下载文档失败");
  98. console.log("err", err)
  99. },
  100. complete(res) {
  101. }
  102. })
  103. }
  104. const getInfo = () => {
  105. //参数说明
  106. let options = {
  107. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  108. data: {
  109. businessType: 'WITHHOLD_AGREEMENT' //代扣协议
  110. }, //请求参数
  111. method: "POST", //提交方式(默认POST)
  112. showLoading: true, //是否显示加载中(默认显示)
  113. };
  114. //调用方式
  115. requestNew(infoQuery, options)
  116. .then((res) => {
  117. let data = res
  118. if (data.textType = "URL") {
  119. state.agreeURL = envs[process.env.NODE_ENV].baseUrl + data.text
  120. }
  121. console.log("代扣协议", state.agreeURL);
  122. })
  123. .catch((err) => {
  124. console.log(err);
  125. });
  126. }
  127. const savaHandle = () => {
  128. if (!state.checked) {
  129. msg("请勾选协议!")
  130. return;
  131. }
  132. my.getAuthCode({
  133. scopes: 'auth_user',
  134. success: res => {
  135. // 获取需要的用户信息
  136. state.code = res.authCode
  137. //如果获取openId成功
  138. if (state.code) {
  139. console.log("code*******", state.code);
  140. const optionsUser = {
  141. type: 2,
  142. data: {
  143. payConfigId: aliPayConfigIdTwo,
  144. code: res.authCode
  145. },
  146. method: "POST",
  147. showLoading: true,
  148. };
  149. console.log('支付宝用户编号请求:', optionsUser)
  150. requestNew(obtainUserId, optionsUser).then((res) => {
  151. console.log('支付宝用户编号返回:', res)
  152. const bizContent = res;
  153. var data = {
  154. orderId: state.orderId,
  155. subOpenId: bizContent.openId,
  156. };
  157. const options = {
  158. type: 2,
  159. data: data,
  160. method: "POST",
  161. showLoading: true,
  162. };
  163. requestNew(userSign, options).then((res) => {
  164. console.log("res*******", res);
  165. const data = stringToJson(res.bizContent);
  166. console.log("data*******", data);
  167. if (data.signStatus === "WAIT_SIGN") {
  168. //待签约
  169. my.ap.navigateToAlipayPage({
  170. path: "https://render.alipay.com/p/yuyan/180020010001250649/sign.html?orderId=" + data.alipayOrderId
  171. });
  172. } else if (data.signStatus === "SIGNED") {
  173. //已签约
  174. // msg("已签约");
  175. confirm("您已完成签约,等待业务员审核发货", () => {
  176. uni.redirectTo({
  177. url: `/pages/order/order?index=0`
  178. })
  179. }, "已完成签约", false);
  180. } else if (data.signStatus === "UNSIGN") {
  181. //已解约
  182. // msg("已解约");
  183. confirm(
  184. "您已解约!",
  185. () => {
  186. uni.redirectTo({
  187. url: `/pages/order/order?index=0`
  188. })
  189. },
  190. "您已解约",
  191. false
  192. );
  193. }
  194. });
  195. })
  196. } else {
  197. //如果获取openId失败
  198. uni.showToast({
  199. title: "网络异常,请重试!",
  200. icon: "none",
  201. duration: 1000,
  202. });
  203. return;
  204. }
  205. },
  206. fail: err => {
  207. console.log('my.getAuthCode 调用失败', err)
  208. }
  209. });
  210. }
  211. </script>
  212. <style lang="scss" scoped>
  213. .container {
  214. background: #E9EDF0;
  215. height: 100vh;
  216. width: 100%;
  217. position: relative;
  218. overflow: hidden;
  219. .t-card {
  220. margin: 30rpx;
  221. background-color: #fff;
  222. border-radius: 12rpx;
  223. padding: 50rpx 30rpx;
  224. }
  225. }
  226. .action {
  227. position: absolute;
  228. bottom: 0rpx;
  229. left: 0;
  230. height: 188rpx;
  231. background-color: #fff;
  232. border-radius: 30rpx 30rpx 0 0;
  233. width: 100vw;
  234. display: flex;
  235. align-items: center;
  236. justify-content: center;
  237. flex-direction: column;
  238. .btn-tip {
  239. font-family: SourceHanSansSC, SourceHanSansSC;
  240. font-weight: 400;
  241. font-size: 24rpx;
  242. color: #CCB375;
  243. margin-bottom: 14rpx;
  244. display: flex;
  245. align-items: center;
  246. .tip-icon {
  247. width: 26rpx;
  248. height: 26rpx;
  249. margin-right: 10rpx;
  250. }
  251. }
  252. .button {
  253. height: 88rpx;
  254. background: radial-gradient(at 0% 0%, #C6B077 0%, #DFCC96 100%);
  255. border-radius: 40rpx;
  256. font-size: 32rpx;
  257. font-weight: 400;
  258. color: #ffffff;
  259. line-height: 88rpx;
  260. width: 660rpx;
  261. margin: 0 auto;
  262. }
  263. }
  264. .title {
  265. margin: 0 auto;
  266. width: 322rpx;
  267. height: 44rpx;
  268. position: relative;
  269. .bg {
  270. width: 322rpx;
  271. height: 44rpx;
  272. }
  273. .bg-xia {
  274. left: 50%;
  275. position: absolute;
  276. width: 200rpx;
  277. height: 8rpx;
  278. transform: translateX(-50%);
  279. bottom: 0;
  280. }
  281. .txt {
  282. font-family: SourceHanSansSC, SourceHanSansSC;
  283. font-weight: bold;
  284. font-size: 36rpx;
  285. color: #004576;
  286. position: absolute;
  287. width: 322rpx;
  288. text-align: center;
  289. bottom: 0;
  290. }
  291. }
  292. .item {
  293. display: flex;
  294. margin-top: 60rpx;
  295. font-size: 28rpx;
  296. font-family: SourceHanSansSC, SourceHanSansSC;
  297. font-weight: 400;
  298. color: #222;
  299. line-height: 48rpx;
  300. .l-icon {
  301. margin-top: 20rpx;
  302. flex-shrink: 0;
  303. border-radius: 50%;
  304. height: 10rpx;
  305. width: 10rpx;
  306. background-color: #004576;
  307. margin-right: 18rpx;
  308. }
  309. }
  310. .item2 {
  311. margin-top: 30rpx;
  312. }
  313. .agreement {
  314. font-size: 30rpx;
  315. display: flex;
  316. flex-wrap: wrap;
  317. margin-top: 20rpx;
  318. }
  319. </style>