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 7.1KB

1 anno fa
1 anno fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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. // uni.$emit("refreshOrder");
  182. // uni.navigateBack();
  183. }, "已完成签约", false);
  184. } else if (data.signStatus === "UNSIGN") {
  185. //已解约
  186. // msg("已解约");
  187. confirm(
  188. "您已解约!",
  189. () => {
  190. uni.switchTab({
  191. url: "/pages/order/order"
  192. })
  193. },
  194. "您已解约",
  195. false
  196. );
  197. }
  198. });
  199. })
  200. } else {
  201. //如果获取openId失败
  202. uni.showToast({
  203. title: "网络异常,请重试!",
  204. icon: "none",
  205. duration: 1000,
  206. });
  207. return;
  208. }
  209. },
  210. fail: err => {
  211. console.log('my.getAuthCode 调用失败', err)
  212. }
  213. });
  214. }
  215. </script>
  216. <style lang="scss" scoped>
  217. .action {
  218. margin-top: 40rpx;
  219. padding-left: 20rpx;
  220. padding-right: 20rpx;
  221. padding-bottom: 30rpx;
  222. .button {
  223. height: 80rpx;
  224. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  225. border-radius: 40rpx;
  226. font-size: 32rpx;
  227. font-weight: 400;
  228. color: #ffffff;
  229. line-height: 80rpx;
  230. }
  231. }
  232. .title {
  233. text-align: center;
  234. margin-top: 15rpx;
  235. font-size: 36rpx;
  236. font-family: Microsoft YaHei;
  237. font-weight: 400;
  238. color: #333333;
  239. line-height: 36rpx;
  240. }
  241. .value {
  242. padding: 0rpx 60rpx;
  243. }
  244. .content_1 {
  245. margin-top: 60rpx;
  246. font-size: 30rpx;
  247. font-family: Microsoft YaHei;
  248. font-weight: 400;
  249. color: #666666;
  250. line-height: 58rpx;
  251. }
  252. .content_2 {
  253. margin-top: 50rpx;
  254. font-size: 30rpx;
  255. font-family: Microsoft YaHei;
  256. font-weight: 400;
  257. color: #666666;
  258. line-height: 58rpx;
  259. }
  260. .content_3 {
  261. margin-top: 50rpx;
  262. font-size: 30rpx;
  263. font-family: Microsoft YaHei;
  264. font-weight: 400;
  265. color: #ff0000;
  266. line-height: 58rpx;
  267. }
  268. .agreement {
  269. font-size: 30rpx;
  270. display: flex;
  271. flex-wrap: wrap;
  272. margin-top: 20rpx;
  273. align-items: center;
  274. justify-content: center;
  275. }
  276. </style>