Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

sign-up-ali.vue 7.1KB

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