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.

пре 10 месеци
пре 10 месеци
пре 10 месеци
пре 10 месеци
пре 10 месеци
пре 10 месеци
пре 10 месеци
пре 10 месеци
пре 10 месеци
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. <template>
  2. <!-- <navBar title="订单支付" :scrollTop="scrollTop" :orderId="state.orderId"></navBar> -->
  3. <navBgCar></navBgCar>
  4. <view class="content-value">
  5. <view @click="savaHandle(item)" class="ul-item" v-for="(item, index) in state.dataArray" :key="index">
  6. <image style="width: 100%; height: 170rpx; border-radius: 20rpx"
  7. :src="`${$imgUrl}applyCard/product-bg.png`"></image>
  8. <view class="item-value">
  9. <image class="icon-tip" :src="imageUrl"></image>
  10. <view class="content">
  11. <view class="title">
  12. {{ item.payName }}
  13. </view>
  14. <view style="margin-top: 15rpx" class="tip">
  15. {{ item.payStatusName }}
  16. </view>
  17. </view>
  18. <view class="money">
  19. ¥:{{ item.fee * 0.01 }}
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script setup lang="ts">
  26. import { onLoad, onPageScroll } from "@dcloudio/uni-app";
  27. import { reactive, ref } from "vue";
  28. import {
  29. PAYMENTORDERAPPLY,
  30. aliPayConfigIdTwo,
  31. obtainUserId,
  32. getOpenId,payApply,payQuery,
  33. cancelPayQuery
  34. } from "@/utils/network/api.js";
  35. import { request,requestNew } from "@/utils/network/request.js";
  36. import { stringToJson } from "@/utils/network/encryption";
  37. import { fileURL } from "@/datas/fileURL.js";
  38. // import navBgCar from "./components/nav-bg-car5";
  39. import navBar from "@/components/nav-bar/nav-bar2.vue";
  40. const imgURL = `${fileURL}image/`;
  41. import { confirm } from "@/utils/utils";
  42. let imageUrl = ""
  43. let logo
  44. const scrollTop = ref(0); //滚动距离
  45. var counter = 0;
  46. // var maxNum = 5;
  47. function myFunc() {
  48. counter++;
  49. console.log("====")
  50. if (counter == 2) {
  51. clearInterval(intervalId);
  52. state.isclick = true
  53. console.log("改为true");
  54. }
  55. }
  56. var intervalId = setInterval(myFunc, 2000);
  57. const savaHandle = (val) => {
  58. console.log("val", val)
  59. if (state.isclick) {
  60. if (val.payStatus == "SUCCESS") {
  61. return;
  62. }
  63. state.isclick = false
  64. console.log("state.isclick", state.isclick, val.payStatus)
  65. if (val.payStatus === 'UNPAY') {
  66. myFunc()
  67. // #ifdef MP-ALIPAY
  68. my.getAuthCode({
  69. scopes: 'auth_base',
  70. success: res => {
  71. const optionsUser = {
  72. type: 2,
  73. data: {
  74. payConfigId: aliPayConfigIdTwo,
  75. code: res.authCode
  76. },
  77. method: "POST",
  78. showLoading: true,
  79. };
  80. console.log('支付宝用户编号请求:', optionsUser)
  81. requestNew(obtainUserId, optionsUser).then((res) => {
  82. console.log('支付宝用户编号返回:', res)
  83. const data = res;
  84. const optionsali = {
  85. type: 2,
  86. data: {
  87. orderId: state.orderId,
  88. wxOpenid: data.openId?data.openId:data.alipayUserId,
  89. payType: val.payType
  90. },
  91. method: "POST",
  92. showLoading: true,
  93. };
  94. console.log('支付下单请求:', optionsali)
  95. requestNew(PAYMENTORDERAPPLY, optionsali).then((res) => {
  96. const data = res;
  97. console.log('支付下单返回:', data)
  98. my.tradePay({
  99. // 调用统一收单交易创建接口(alipay.trade.create),获得返回字段支付宝交易号 trade_no
  100. tradeNO: data.tranPackage,
  101. success: res => {
  102. console.log("支付成功", res);
  103. refresh();
  104. },
  105. fail: res => {
  106. console.log("支付失败", res);
  107. },
  108. });
  109. });
  110. });
  111. },
  112. fail: err => {
  113. console.log('my.getAuthCode 调用失败', err)
  114. state.isclick = true
  115. }
  116. });
  117. // #endif
  118. // #ifdef MP-WEIXIN
  119. uni.login({
  120. provider: "weixin",
  121. success: function (e) {
  122. const options1 = {
  123. type: 2,
  124. data: {
  125. "jsCode": e.code
  126. },
  127. method: "POST",
  128. showLoading: true,
  129. };
  130. requestNew(getOpenId, options1).then((res) => {
  131. const result =res;
  132. const openidData = stringToJson(result.data);
  133. console.log("获取openId", openidData)
  134. const options = {
  135. type: 2,
  136. data: {
  137. orderId: state.orderId,
  138. wxOpenId: openidData.openid,
  139. payType: val.payType
  140. },
  141. method: "POST",
  142. showLoading: true,
  143. };
  144. requestNew(payApply, options).then((res) => {
  145. const data =res;
  146. console.log("data======111", data)
  147. if (data) {
  148. console.log("进来了")
  149. uni.requestPayment({
  150. provider: "wxpay",
  151. orderInfo: "",
  152. timeStamp: data.timestamp,
  153. nonceStr: data.noncestr,
  154. package: data.wxPackage ? data.wxPackage : "",
  155. signType: data.signType,
  156. paySign: data.sign,
  157. success: function (e) {
  158. console.log("支付成功", res);
  159. refresh();
  160. },
  161. fail: function (err) {
  162. state.isclick = true
  163. confirm(err, () => { }, "支付失败", false);
  164. },
  165. });
  166. } else {
  167. state.isclick = true
  168. console.log("state.isclick", state.isclick)
  169. }
  170. });
  171. });
  172. },
  173. });
  174. // #endif
  175. }
  176. }
  177. };
  178. const refresh = () => {
  179. state.isclick = true
  180. var data = {
  181. orderId: state.orderId,
  182. orderType:2 //订单类型 1-发行订单 2-售后订单
  183. };
  184. const options = {
  185. type: 2,
  186. data: data,
  187. method: "POST",
  188. showLoading: true,
  189. };
  190. console.log("输出内容", options);
  191. if(state.orderType=="SIGNOUT"){
  192. // 卡签注销支付查询
  193. state.code=cancelPayQuery
  194. }else{
  195. // 更换设备查询
  196. state.code=payQuery
  197. }
  198. console.log("code",state.code)
  199. requestNew(state.code, options).then((res) => {
  200. console.log("res====",res)
  201. const data = res;
  202. console.log(data);
  203. if (data.paymentStatus == 'ALLSUCCESS') {
  204. gotoEditUserOrUnitInfo()
  205. }
  206. state.dataArray = data.datas;
  207. for (let i = 0; i < state.dataArray.length; i++) {
  208. if (state.dataArray[i].payType === 'HANDLE') {
  209. state.dataArray[i].payName = '权益金'
  210. } else if (state.dataArray[i].payType === 'MARGIN') {
  211. state.dataArray[i].payName = '保证金'
  212. } else if (state.dataArray[i].payType === 'PRESTORE') {
  213. state.dataArray[i].payName = '预存金'
  214. } else if (state.dataArray[i].payType === 'EQUITY') {
  215. state.dataArray[i].payName = '权益费'
  216. } else if (state.dataArray[i].payType === 'REPAIROBU') {
  217. state.dataArray[i].payName = '增补obu'
  218. } else if (state.dataArray[i].payType === 'CHANGECARD') {
  219. state.dataArray[i].payName = '更换卡'
  220. } else if (state.dataArray[i].payType === 'CHANGEOBU') {
  221. state.dataArray[i].payName = '更换签'
  222. } else if (state.dataArray[i].payType === 'CHANGEALL') {
  223. state.dataArray[i].payName = '更换卡签'
  224. } else {
  225. state.dataArray[i].payName = '未知费'
  226. }
  227. if (state.dataArray[i].payStatus === 'SUCCESS') {
  228. state.dataArray[i].payStatusName = '已支付'
  229. } else if (state.dataArray[i].payStatus === 'PAYING') {
  230. state.dataArray[i].payStatusName = '支付中'
  231. } else if (state.dataArray[i].payStatus === 'FAILED') {
  232. state.dataArray[i].payStatusName = '支付失败'
  233. } else if (state.dataArray[i].payStatus === 'UNPAY') {
  234. state.dataArray[i].payStatusName = '未支付'
  235. } else if (state.dataArray[i].payStatus === 'CLOSED') {
  236. state.dataArray[i].payStatusName = '已关闭'
  237. } else if (state.dataArray[i].payStatus === 'CANCELED') {
  238. state.dataArray[i].payStatusName = '已撤销'
  239. } else if (state.dataArray[i].payStatus === 'REFUND') {
  240. state.dataArray[i].payStatusName = '转入退费'
  241. } else {
  242. state.dataArray[i].payStatusName = '未知'
  243. }
  244. }
  245. console.log("state.dataArray", state.dataArray)
  246. });
  247. }
  248. onLoad((option : any) => {
  249. console.log("传递过来的到支付页面", option)
  250. state.orderId = option.orderId;
  251. state.orderType = option.orderType;
  252. let source = ""
  253. // #ifdef MP-ALIPAY
  254. imageUrl = imgURL + "applyCard/alibaba.png";
  255. source = "ALI"
  256. // #endif
  257. // #ifdef MP-WEIXIN
  258. imageUrl = imgURL + "applyCard/wechat.png";
  259. source = "WECHAT"
  260. // #endif
  261. // 支付查询
  262. refresh()
  263. });
  264. //监听页面滚动
  265. onPageScroll((e) => {
  266. scrollTop.value = e.scrollTop;
  267. });
  268. // isValueCard 1 储值卡 2 记账卡
  269. const gotoEditUserOrUnitInfo = () => {
  270. uni.navigateBack({
  271. delta:2
  272. })
  273. }
  274. const state = reactive({
  275. isValueCard: 1, //卡的类型
  276. radiolist1: [], //选择卡的数据列表
  277. choiceCardShow: false, //选择卡的弹出框
  278. isSign: '',
  279. id: "",
  280. orderId: "",
  281. userType: 1, //1 个人 2单位
  282. type: 0, //0 客车 1货车
  283. vehiclePlateColor: "",
  284. data: {
  285. show: false,
  286. src: imgURL + "applyCard/edit.png",
  287. },
  288. dataArray: [],
  289. list: [
  290. {
  291. bg: imgURL + "applyCard/product-bg.png",
  292. icon: imgURL + "applyCard/wechat.png",
  293. title: "【货车】微信车主服务",
  294. tip: "绑定微信支付,无需绑定银行卡",
  295. },
  296. ],
  297. openid: "",
  298. isclick: true,//防止重复点击
  299. vehicleId: "",
  300. orderType:"",//业务类型 比如卡签注销
  301. code:""
  302. });
  303. </script>
  304. <style lang="scss" scoped>
  305. ::v-deep .u-radio {
  306. display: flex !important;
  307. align-items: center !important;
  308. float: none !important;
  309. }
  310. ::v-deep .u-icon__icon {
  311. top: -4px !important;
  312. }
  313. .bottomTip {
  314. margin-top: 100rpx;
  315. text-align: center;
  316. font-size: 28rpx;
  317. font-family: Microsoft YaHei;
  318. font-weight: 400;
  319. color: #b3b3b3;
  320. }
  321. .content-value {
  322. position: relative;
  323. padding: 0rpx 30rpx;
  324. position: relative;
  325. .img-pos {
  326. position: absolute;
  327. left: 500rpx;
  328. top: -38rpx;
  329. right: 50rpx;
  330. .img-flex {
  331. display: flex;
  332. justify-content: space-between;
  333. align-items: center;
  334. .car-img {
  335. width: 86rpx;
  336. height: 42rpx;
  337. }
  338. .flag-img {
  339. width: 30rpx;
  340. height: 35rpx;
  341. }
  342. }
  343. }
  344. }
  345. .flex {
  346. display: flex;
  347. align-items: center;
  348. }
  349. .action {
  350. margin-top: 30rpx;
  351. padding-left: 20rpx;
  352. padding-right: 20rpx;
  353. padding-bottom: 30rpx;
  354. .button {
  355. height: 80rpx;
  356. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  357. border-radius: 40rpx;
  358. font-size: 32rpx;
  359. font-weight: 400;
  360. color: #ffffff;
  361. line-height: 80rpx;
  362. }
  363. }
  364. .action-btn {
  365. margin-left: 45rpx;
  366. width: 121rpx;
  367. height: 61rpx;
  368. border: 1px solid rgba(255, 255, 255, 1);
  369. border-radius: 30rpx;
  370. background: rgba(255, 255, 255, 0.2);
  371. text-align: center;
  372. font-size: 30rpx;
  373. font-family: Microsoft YaHei;
  374. font-weight: 400;
  375. color: #ffffff;
  376. line-height: 61rpx;
  377. }
  378. .tag1 {
  379. padding: 5rpx;
  380. background: rgba(0, 179, 139, 0.5);
  381. border-radius: 6rpx;
  382. font-size: 22rpx;
  383. font-family: Microsoft YaHei;
  384. font-weight: 400;
  385. color: #ffffff;
  386. }
  387. .tag3 {
  388. padding: 5rpx;
  389. background: rgba(139, 112, 228, 0.5);
  390. border-radius: 6rpx;
  391. font-size: 22rpx;
  392. font-family: Microsoft YaHei;
  393. font-weight: 400;
  394. color: #ffffff;
  395. }
  396. .tag2 {
  397. padding: 5rpx;
  398. background: rgba(249, 97, 60, 0.5);
  399. border-radius: 6rpx;
  400. font-size: 22rpx;
  401. font-family: Microsoft YaHei;
  402. font-weight: 400;
  403. color: #ffffff;
  404. }
  405. .ul-item {
  406. padding: 5px 20rpx;
  407. display: flex;
  408. align-items: center;
  409. .item-value {
  410. padding: 20rpx;
  411. position: absolute;
  412. display: flex;
  413. align-items: center;
  414. width: 80%;
  415. .content {
  416. width: 51%;
  417. .title {
  418. font-size: 32rpx;
  419. font-family: Microsoft YaHei;
  420. font-weight: 400;
  421. color: #ffffff;
  422. }
  423. .tip {
  424. font-size: 24rpx;
  425. font-family: Microsoft YaHei;
  426. font-weight: 400;
  427. color: #ffffff;
  428. }
  429. }
  430. }
  431. .icon-tip {
  432. width: 100rpx;
  433. height: 100rpx;
  434. }
  435. .content {
  436. margin-left: 40rpx;
  437. }
  438. }
  439. .money {
  440. color: white;
  441. }
  442. ::v-deep .u-mode-center-box {
  443. border-radius: 10rpx;
  444. }
  445. .squire {
  446. padding: 30rpx 30rpx 50rpx 50rpx;
  447. }
  448. .mask-close {
  449. text-align: right;
  450. }
  451. .icon-closed {
  452. width: 48rpx;
  453. height: 48rpx;
  454. }
  455. .mask-title {
  456. text-align: center;
  457. font-size: 32rpx;
  458. color: $uni-text-color-black;
  459. margin-bottom: 50rpx;
  460. }
  461. </style>