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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <image
  3. style="
  4. margin-top: 20rpx;
  5. width: 100%;
  6. height: 240rpx;
  7. background-color: #eeeeee;
  8. "
  9. :src="`${$imgUrl}applyCard/car-service.png`"
  10. ></image>
  11. <view class="title"> 支付宝签约代扣 </view>
  12. <view class="value">
  13. <view class="content_1">
  14. 支付宝签约代扣是支付宝支付为车主用户提供的安全便捷的智慧服务
  15. </view>
  16. <view class="content_2">
  17. 本次将为贵州黔通智联科技股份有限公司开启免密支付服务,后续相关的费用将通过支付宝签约代扣从你的支付宝账户扣除
  18. </view>
  19. <view class="content_3">
  20. 注:签约成功后请返回本页面,再次点击开通服务
  21. </view>
  22. </view>
  23. <view class="action">
  24. <button type="default" class="button" @click="savaHandle()">
  25. 开通服务
  26. </button>
  27. <!-- <button type="default" class="button" @click="addInterestsList()">
  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,StorageKeys } from "@/utils/storage";
  42. import { msg, confirm, getOrderStatusName } from "@/utils/utils";
  43. import {
  44. checkOrderStatus,
  45. orderPay,
  46. wechatAppID,
  47. wechatPayConfigId,
  48. wechatSecret,
  49. aliPayConfigIdTwo,
  50. obtainUserId,
  51. } from "@/utils/network/api";
  52. const imgURL = `${fileURL}image/`;
  53. const state = reactive({
  54. openid: "",
  55. orderId: "",
  56. id: "",
  57. clientFee: "",
  58. code:""
  59. });
  60. onLoad((option: any) => {
  61. state.orderId = option.orderId;
  62. setItem('accessToken', option.token);
  63. setItem(StorageKeys.Token, option.token);
  64. setItem('openId', option.openId);
  65. });
  66. const addInterestsList=()=>{
  67. uni.navigateTo({
  68. url:`/subpackage/orders/interestsList?orderId=${state.orderId}&&clientFee=${state.clientFee}&&id=${state.id}`
  69. });
  70. }
  71. const savaHandle = () => {
  72. my.getAuthCode({
  73. scopes: 'auth_user',
  74. success: res => {
  75. // 获取需要的用户信息
  76. state.code = res.authCode
  77. //如果获取openId成功
  78. if (state.code) {
  79. console.log("code*******", state.code);
  80. const optionsUser = {
  81. type: 2,
  82. data: {
  83. payConfigId: aliPayConfigIdTwo,
  84. code: res.authCode
  85. },
  86. method: "POST",
  87. showLoading: true,
  88. };
  89. console.log('支付宝用户编号请求:', optionsUser)
  90. request(obtainUserId, optionsUser).then((res) => {
  91. console.log('支付宝用户编号返回:', res)
  92. const bizContent = stringToJson(res.bizContent);
  93. var data = {
  94. orderId: state.orderId,
  95. subOpenId: bizContent.openId,
  96. };
  97. const options = {
  98. type: 2,
  99. data: data,
  100. method: "POST",
  101. showLoading: true,
  102. };
  103. request(etcQYAction, options).then((res) => {
  104. console.log("res*******", res);
  105. const data = stringToJson(res.bizContent);
  106. console.log("data*******", data);
  107. if (data.signStatus === "WAIT_SIGN") {
  108. //待签约
  109. my.ap.navigateToAlipayPage({
  110. path: "https://render.alipay.com/p/yuyan/180020010001250649/sign.html?orderId="+data.alipayOrderId
  111. });
  112. }else if (data.signStatus === "SIGNED") {
  113. //已签约
  114. // msg("已签约");
  115. confirm(
  116. "您已完成签约,等待业务员审核发货",
  117. () => {
  118. // uni.switchTab({
  119. // url: "/pages/order/order"
  120. // })
  121. // uni.$emit("refreshOrder");
  122. // uni.navigateBack();
  123. },
  124. "已完成签约",
  125. false
  126. );
  127. }else if (data.signStatus === "UNSIGN") {
  128. //已解约
  129. // msg("已解约");
  130. confirm(
  131. "您已解约!",
  132. () => {
  133. // uni.switchTab({
  134. // url: "/pages/order/order"
  135. // })
  136. },
  137. "您已解约",
  138. false
  139. );
  140. }
  141. });
  142. })
  143. } else {
  144. //如果获取openId失败
  145. uni.showToast({
  146. title: "网络异常,请重试!",
  147. icon: "none",
  148. duration: 1000,
  149. });
  150. return;
  151. }
  152. },
  153. fail: err => {
  154. console.log('my.getAuthCode 调用失败', err)
  155. }
  156. });
  157. }
  158. </script>
  159. <style lang="scss" scoped>
  160. .action {
  161. margin-top: 40rpx;
  162. padding-left: 20rpx;
  163. padding-right: 20rpx;
  164. padding-bottom: 30rpx;
  165. .button {
  166. height: 80rpx;
  167. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  168. border-radius: 40rpx;
  169. font-size: 32rpx;
  170. font-weight: 400;
  171. color: #ffffff;
  172. line-height: 80rpx;
  173. }
  174. }
  175. .title {
  176. text-align: center;
  177. margin-top: 15rpx;
  178. font-size: 36rpx;
  179. font-family: Microsoft YaHei;
  180. font-weight: 400;
  181. color: #333333;
  182. line-height: 36rpx;
  183. }
  184. .value {
  185. padding: 0rpx 60rpx;
  186. }
  187. .content_1 {
  188. margin-top: 60rpx;
  189. font-size: 30rpx;
  190. font-family: Microsoft YaHei;
  191. font-weight: 400;
  192. color: #666666;
  193. line-height: 58rpx;
  194. }
  195. .content_2 {
  196. margin-top: 50rpx;
  197. font-size: 30rpx;
  198. font-family: Microsoft YaHei;
  199. font-weight: 400;
  200. color: #666666;
  201. line-height: 58rpx;
  202. }
  203. .content_3 {
  204. margin-top: 50rpx;
  205. font-size: 30rpx;
  206. font-family: Microsoft YaHei;
  207. font-weight: 400;
  208. color: #ff0000;
  209. line-height: 58rpx;
  210. }
  211. </style>