Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

sign-up-ali.vue 7.0KB

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