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

1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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="action">
  21. <button type="default" class="button" @click="savaHandle()">
  22. 开通服务
  23. </button>
  24. </view>
  25. </template>
  26. <script setup lang="ts">
  27. import { onLoad, onShow } from "@dcloudio/uni-app";
  28. import { reactive } from "vue";
  29. import { etcQYAction } from "@/utils/network/api.js";
  30. import { request } from "@/utils/network/request.js";
  31. import { stringToJson } from "@/utils/network/encryption";
  32. import { fileURL } from "@/datas/fileURL.js";
  33. import navBar from "@/components/nav-bar/nav-bar2.vue";
  34. import navBgCar from "./components/nav-bg-car4";
  35. import { setItem, StorageKeys } from "@/utils/storage";
  36. import { msg, confirm, getOrderStatusName } from "@/utils/utils";
  37. import {
  38. checkOrderStatus,
  39. wechatAppID,
  40. wechatPayConfigId,
  41. wechatSecret,
  42. aliPayConfigIdTwo,
  43. obtainUserId,
  44. } from "@/utils/network/api";
  45. const imgURL = `${fileURL}image/`;
  46. const state = reactive({
  47. openid: "",
  48. orderId: "",
  49. id: "",
  50. clientFee: "",
  51. code: "",
  52. qdOrderNo: "", //渠道订单编号
  53. });
  54. onLoad((option : any) => {
  55. console.log("option22222", option)
  56. state.orderId = option.orderId;
  57. state.qdOrderNo = option.qdOrderNo;
  58. setItem('accessToken', option.token);
  59. setItem(StorageKeys.Token, option.token);
  60. setItem('openId', option.openId);
  61. });
  62. const addInterestsList = () => {
  63. uni.navigateTo({
  64. url: `/subpackage/orders/interestsList?orderId=${state.orderId}&&clientFee=${state.clientFee}&&id=${state.id}`
  65. });
  66. }
  67. const savaHandle = () => {
  68. my.getAuthCode({
  69. scopes: 'auth_user',
  70. success: res => {
  71. // 获取需要的用户信息
  72. state.code = res.authCode
  73. //如果获取openId成功
  74. if (state.code) {
  75. console.log("code*******", state.code);
  76. const optionsUser = {
  77. type: 2,
  78. data: {
  79. payConfigId: aliPayConfigIdTwo,
  80. code: res.authCode
  81. },
  82. method: "POST",
  83. showLoading: true,
  84. };
  85. console.log('支付宝用户编号请求:', optionsUser)
  86. request(obtainUserId, optionsUser).then((res) => {
  87. console.log('支付宝用户编号返回:', res)
  88. const bizContent = stringToJson(res.bizContent);
  89. var data = {
  90. orderId: state.orderId,
  91. subOpenId: bizContent.openId,
  92. };
  93. const options = {
  94. type: 2,
  95. data: data,
  96. method: "POST",
  97. showLoading: true,
  98. };
  99. request(etcQYAction, options).then((res) => {
  100. console.log("res*******", res);
  101. const data = stringToJson(res.bizContent);
  102. console.log("data*******", data);
  103. if (data.signStatus === "WAIT_SIGN") {
  104. //待签约
  105. my.ap.navigateToAlipayPage({
  106. path: "https://render.alipay.com/p/yuyan/180020010001250649/sign.html?orderId=" + data.alipayOrderId
  107. });
  108. } else if (data.signStatus === "SIGNED") {
  109. //已签约
  110. // msg("已签约");
  111. confirm(
  112. "您已完成签约,等待业务员审核发货",
  113. () => {
  114. const param = `https://qtzl.etcjz.cn/order/#/pages/sigManage/signContract?qdOrderNo=${state.qdOrderNo}&type=3`
  115. const params = encodeURIComponent(JSON.stringify(param))
  116. console.log('支付结果查询params', params)
  117. uni.navigateTo({
  118. url: `/subpackage/personal-center/webview?url=` + params
  119. })
  120. },
  121. "已完成签约",
  122. false
  123. );
  124. } else if (data.signStatus === "UNSIGN") {
  125. //已解约
  126. // msg("已解约");
  127. confirm(
  128. "您已解约!",
  129. () => {
  130. // uni.switchTab({
  131. // url: "/pages/order/order"
  132. // })
  133. },
  134. "您已解约",
  135. false
  136. );
  137. }
  138. });
  139. })
  140. } else {
  141. //如果获取openId失败
  142. uni.showToast({
  143. title: "网络异常,请重试!",
  144. icon: "none",
  145. duration: 1000,
  146. });
  147. return;
  148. }
  149. },
  150. fail: err => {
  151. console.log('my.getAuthCode 调用失败', err)
  152. }
  153. });
  154. }
  155. </script>
  156. <style lang="scss" scoped>
  157. .action {
  158. margin-top: 40rpx;
  159. padding-left: 20rpx;
  160. padding-right: 20rpx;
  161. padding-bottom: 30rpx;
  162. .button {
  163. height: 80rpx;
  164. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  165. border-radius: 40rpx;
  166. font-size: 32rpx;
  167. font-weight: 400;
  168. color: #ffffff;
  169. line-height: 80rpx;
  170. }
  171. }
  172. .title {
  173. text-align: center;
  174. margin-top: 15rpx;
  175. font-size: 36rpx;
  176. font-family: Microsoft YaHei;
  177. font-weight: 400;
  178. color: #333333;
  179. line-height: 36rpx;
  180. }
  181. .value {
  182. padding: 0rpx 60rpx;
  183. }
  184. .content_1 {
  185. margin-top: 60rpx;
  186. font-size: 30rpx;
  187. font-family: Microsoft YaHei;
  188. font-weight: 400;
  189. color: #666666;
  190. line-height: 58rpx;
  191. }
  192. .content_2 {
  193. margin-top: 50rpx;
  194. font-size: 30rpx;
  195. font-family: Microsoft YaHei;
  196. font-weight: 400;
  197. color: #666666;
  198. line-height: 58rpx;
  199. }
  200. .content_3 {
  201. margin-top: 50rpx;
  202. font-size: 30rpx;
  203. font-family: Microsoft YaHei;
  204. font-weight: 400;
  205. color: #ff0000;
  206. line-height: 58rpx;
  207. }
  208. </style>