You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sign-up-ali.vue 6.8KB

1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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 class="content_3">
  17. 注:签约成功后请返回本页面,再次点击开通服务
  18. </view>
  19. </view>
  20. <view class="as-layout-horizontal agreement">
  21. <checkbox-group @change="checkboxChange">
  22. <checkbox :checked="state.checked" style="transform: scale(0.8)" />我已阅读并同意
  23. </checkbox-group>
  24. <text style="color:#007AFF;text-decoration: underline;" @click="downAuthD()">《代扣协议》</text>
  25. </view>
  26. <view class="action">
  27. <button type="default" class="button" @click="savaHandle()">
  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, confirm } from "@/utils/utils";
  43. import {
  44. aliPayConfigIdTwo,
  45. obtainUserId,
  46. infoQuery,
  47. envs
  48. } from "@/utils/network/api";
  49. const imgURL = `${fileURL}image/`;
  50. const state = reactive({
  51. openid: "",
  52. orderId: "",
  53. id: "",
  54. clientFee: "",
  55. code: "",
  56. checked: false,
  57. agreeURL: "",
  58. });
  59. onLoad((option : any) => {
  60. state.orderId = option.orderId;
  61. getInfo();
  62. });
  63. const checkboxChange = (e) => {
  64. state.checked = !state.checked;
  65. console.log(state.checked);
  66. };
  67. const downAuthD = () => {
  68. uni.downloadFile({
  69. url: state.agreeURL,
  70. filePath: uni.env.USER_DATA_PATH + '/' + '代扣协议.docx',
  71. success(res) {
  72. const filePath = res.filePath
  73. uni.openDocument({
  74. filePath: filePath,
  75. fileType: 'docx',
  76. showMenu: true, //关键点
  77. success: function (res) {
  78. },
  79. fail: function (err) {
  80. msg("打开文档失败");
  81. }
  82. });
  83. },
  84. fail: function (err) {
  85. msg("下载文档失败");
  86. console.log("err", err)
  87. },
  88. complete(res) {
  89. }
  90. })
  91. }
  92. const getInfo = () => {
  93. //参数说明
  94. let options = {
  95. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  96. data: {
  97. businessType: 'WITHHOLD_AGREEMENT' //代扣协议
  98. }, //请求参数
  99. method: "POST", //提交方式(默认POST)
  100. showLoading: true, //是否显示加载中(默认显示)
  101. };
  102. //调用方式
  103. request(infoQuery, options)
  104. .then((res) => {
  105. let data = stringToJson(res.bizContent)
  106. if (data.textType = "URL") {
  107. state.agreeURL = envs[process.env.NODE_ENV].baseUrl + data.text
  108. }
  109. console.log("代扣协议", state.agreeURL);
  110. })
  111. .catch((err) => {
  112. console.log(err);
  113. });
  114. }
  115. const addInterestsList = () => {
  116. uni.navigateTo({
  117. url: `/subpackage/orders/interestsList?orderId=${state.orderId}&&clientFee=${state.clientFee}&&id=${state.id}`
  118. });
  119. }
  120. const savaHandle = () => {
  121. if (!state.checked) {
  122. msg("请勾选协议!")
  123. return;
  124. }
  125. my.getAuthCode({
  126. scopes: 'auth_user',
  127. success: res => {
  128. // 获取需要的用户信息
  129. state.code = res.authCode
  130. //如果获取openId成功
  131. if (state.code) {
  132. console.log("code*******", state.code);
  133. const optionsUser = {
  134. type: 2,
  135. data: {
  136. payConfigId: aliPayConfigIdTwo,
  137. code: res.authCode
  138. },
  139. method: "POST",
  140. showLoading: true,
  141. };
  142. console.log('支付宝用户编号请求:', optionsUser)
  143. request(obtainUserId, optionsUser).then((res) => {
  144. console.log('支付宝用户编号返回:', res)
  145. const bizContent = stringToJson(res.bizContent);
  146. var data = {
  147. orderId: state.orderId,
  148. subOpenId: bizContent.openId,
  149. };
  150. const options = {
  151. type: 2,
  152. data: data,
  153. method: "POST",
  154. showLoading: true,
  155. };
  156. request(etcQYAction, options).then((res) => {
  157. console.log("res*******", res);
  158. const data = stringToJson(res.bizContent);
  159. console.log("data*******", data);
  160. if (data.signStatus === "WAIT_SIGN") {
  161. //待签约
  162. my.ap.navigateToAlipayPage({
  163. path: "https://render.alipay.com/p/yuyan/180020010001250649/sign.html?orderId=" + data.alipayOrderId
  164. });
  165. } else if (data.signStatus === "SIGNED") {
  166. //已签约
  167. // msg("已签约");
  168. confirm("您已完成签约,等待业务员审核发货", () => {
  169. uni.switchTab({
  170. url: "/pages/order/order"
  171. })
  172. }, "已完成签约", false);
  173. } else if (data.signStatus === "UNSIGN") {
  174. //已解约
  175. // msg("已解约");
  176. confirm(
  177. "您已解约!",
  178. () => {
  179. uni.switchTab({
  180. url: "/pages/order/order"
  181. })
  182. },
  183. "您已解约",
  184. false
  185. );
  186. }
  187. });
  188. })
  189. } else {
  190. //如果获取openId失败
  191. uni.showToast({
  192. title: "网络异常,请重试!",
  193. icon: "none",
  194. duration: 1000,
  195. });
  196. return;
  197. }
  198. },
  199. fail: err => {
  200. console.log('my.getAuthCode 调用失败', err)
  201. }
  202. });
  203. }
  204. </script>
  205. <style lang="scss" scoped>
  206. .action {
  207. margin-top: 40rpx;
  208. padding-left: 20rpx;
  209. padding-right: 20rpx;
  210. padding-bottom: 30rpx;
  211. .button {
  212. height: 80rpx;
  213. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  214. border-radius: 40rpx;
  215. font-size: 32rpx;
  216. font-weight: 400;
  217. color: #ffffff;
  218. line-height: 80rpx;
  219. }
  220. }
  221. .title {
  222. text-align: center;
  223. margin-top: 15rpx;
  224. font-size: 36rpx;
  225. font-family: Microsoft YaHei;
  226. font-weight: 400;
  227. color: #333333;
  228. line-height: 36rpx;
  229. }
  230. .value {
  231. padding: 0rpx 60rpx;
  232. }
  233. .content_1 {
  234. margin-top: 60rpx;
  235. font-size: 30rpx;
  236. font-family: Microsoft YaHei;
  237. font-weight: 400;
  238. color: #666666;
  239. line-height: 58rpx;
  240. }
  241. .content_2 {
  242. margin-top: 50rpx;
  243. font-size: 30rpx;
  244. font-family: Microsoft YaHei;
  245. font-weight: 400;
  246. color: #666666;
  247. line-height: 58rpx;
  248. }
  249. .content_3 {
  250. margin-top: 50rpx;
  251. font-size: 30rpx;
  252. font-family: Microsoft YaHei;
  253. font-weight: 400;
  254. color: #ff0000;
  255. line-height: 58rpx;
  256. }
  257. .agreement {
  258. font-size: 30rpx;
  259. display: flex;
  260. flex-wrap: wrap;
  261. margin-top: 20rpx;
  262. align-items: center;
  263. justify-content: center;
  264. }
  265. </style>