Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

order_payment.vue 16KB

pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 7 mēnešiem
pirms 1 gada
pirms 1 gada
pirms 7 mēnešiem
pirms 7 mēnešiem
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 11 mēnešiem
pirms 11 mēnešiem
pirms 1 gada
pirms 11 mēnešiem
pirms 1 gada
pirms 11 mēnešiem
pirms 1 gada
pirms 11 mēnešiem
pirms 8 mēnešiem
pirms 11 mēnešiem
pirms 1 gada
pirms 11 mēnešiem
pirms 11 mēnešiem
pirms 1 gada
pirms 11 mēnešiem
pirms 11 mēnešiem
pirms 11 mēnešiem
pirms 1 gada
pirms 11 mēnešiem
pirms 1 gada
pirms 11 mēnešiem
pirms 7 mēnešiem
pirms 11 mēnešiem
pirms 11 mēnešiem
pirms 11 mēnešiem
pirms 11 mēnešiem
pirms 11 mēnešiem
pirms 11 mēnešiem
pirms 11 mēnešiem
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 7 mēnešiem
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 11 mēnešiem
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 7 mēnešiem
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 11 mēnešiem
pirms 1 gada
pirms 11 mēnešiem
pirms 11 mēnešiem
pirms 11 mēnešiem
pirms 1 gada
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  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. // PAYDETECTION,
  30. PAYMENTORDERAPPLY,
  31. aliPayConfigIdTwo,
  32. obtainUserId,
  33. getOpenidApi,
  34. etcVehiclePlateVer,payApply,payQuery
  35. } from "@/utils/network/api.js";
  36. import { request,requestNew } from "@/utils/network/request.js";
  37. import { stringToJson } from "@/utils/network/encryption";
  38. import { fileURL } from "@/datas/fileURL.js";
  39. import navBgCar from "./components/nav-bg-car5";
  40. import navBar from "@/components/nav-bar/nav-bar2.vue";
  41. const imgURL = `${fileURL}image/`;
  42. import { confirm } from "@/utils/utils";
  43. let imageUrl = ""
  44. let logo
  45. const scrollTop = ref(0); //滚动距离
  46. var counter = 0;
  47. // var maxNum = 5;
  48. function myFunc() {
  49. counter++;
  50. console.log("====")
  51. if (counter == 2) {
  52. clearInterval(intervalId);
  53. state.isclick = true
  54. console.log("改为true");
  55. }
  56. }
  57. var intervalId = setInterval(myFunc, 2000);
  58. const savaHandle = (val) => {
  59. console.log("val", val)
  60. if (state.isclick) {
  61. etcVehiclePlateVerRequest().then(() => {
  62. if (val.payStatus == "SUCCESS") {
  63. return;
  64. }
  65. state.isclick = false
  66. console.log("state.isclick", state.isclick, val.payStatus)
  67. if (val.payStatus === 'UNPAY') {
  68. myFunc()
  69. // #ifdef MP-ALIPAY
  70. my.getAuthCode({
  71. scopes: 'auth_base',
  72. success: res => {
  73. const optionsUser = {
  74. type: 2,
  75. data: {
  76. payConfigId: aliPayConfigIdTwo,
  77. code: res.authCode
  78. },
  79. method: "POST",
  80. showLoading: true,
  81. };
  82. console.log('支付宝用户编号请求:', optionsUser)
  83. request(obtainUserId, optionsUser).then((res) => {
  84. console.log('支付宝用户编号返回:', res)
  85. const data = stringToJson(res.bizContent);
  86. const optionsali = {
  87. type: 2,
  88. data: {
  89. orderId: state.orderId,
  90. wxOpenid: data.openId?data.openId:data.alipayUserId,
  91. payType: val.payType
  92. },
  93. method: "POST",
  94. showLoading: true,
  95. };
  96. console.log('支付下单请求:', optionsali)
  97. request(PAYMENTORDERAPPLY, optionsali).then((res) => {
  98. const data = stringToJson(res.bizContent);
  99. console.log('支付下单返回:', data)
  100. my.tradePay({
  101. // 调用统一收单交易创建接口(alipay.trade.create),获得返回字段支付宝交易号 trade_no
  102. tradeNO: data.tranPackage,
  103. success: res => {
  104. console.log("支付成功", res);
  105. refresh();
  106. },
  107. fail: res => {
  108. console.log("支付失败", res);
  109. },
  110. });
  111. });
  112. });
  113. },
  114. fail: err => {
  115. console.log('my.getAuthCode 调用失败', err)
  116. state.isclick = true
  117. }
  118. });
  119. // #endif
  120. // #ifdef MP-WEIXIN
  121. uni.login({
  122. provider: "weixin",
  123. success: function (e) {
  124. const options1 = {
  125. type: 2,
  126. data: {
  127. "jsCode": e.code
  128. },
  129. method: "POST",
  130. showLoading: true,
  131. };
  132. request(getOpenidApi, options1).then((res) => {
  133. const result = stringToJson(res.bizContent);
  134. const openidData = stringToJson(result.data);
  135. console.log("获取openId", openidData)
  136. const options = {
  137. type: 2,
  138. data: {
  139. orderId: state.orderId,
  140. wxOpenid: openidData.openid,
  141. payType: val.payType
  142. },
  143. method: "POST",
  144. showLoading: true,
  145. };
  146. requestNew(payApply, options).then((res) => {
  147. const data = stringToJson(res.bizContent);
  148. console.log("data======111", data)
  149. if (data) {
  150. console.log("进来了")
  151. uni.requestPayment({
  152. provider: "wxpay",
  153. orderInfo: "",
  154. timeStamp: data.timestamp,
  155. nonceStr: data.noncestr,
  156. package: data.wxPackage ? data.wxPackage : "",
  157. signType: data.signType,
  158. paySign: data.sign,
  159. success: function (e) {
  160. console.log("支付成功", res);
  161. refresh();
  162. },
  163. fail: function (err) {
  164. state.isclick = true
  165. confirm(err, () => { }, "支付失败", false);
  166. },
  167. });
  168. } else {
  169. state.isclick = true
  170. console.log("state.isclick", state.isclick)
  171. }
  172. });
  173. });
  174. },
  175. });
  176. // #endif
  177. }
  178. })
  179. }
  180. };
  181. const getOpenID = () => {
  182. uni.login({
  183. provider: "weixin",
  184. success: function (e) {
  185. getOpenid(e.code);
  186. },
  187. });
  188. };
  189. const getOpenid = (code) => {
  190. const options = {
  191. type: 2,
  192. data: {
  193. "jsCode": code
  194. },
  195. method: "POST",
  196. showLoading: true,
  197. };
  198. // #ifdef MP-WEIXIN
  199. request(getOpenidApi, options).then((res) => {
  200. const result = stringToJson(res.bizContent);
  201. console.log("获取微信小程序openid", result);
  202. const openidData = stringToJson(result.data);
  203. state.openid = openidData.openid;
  204. });
  205. // #endif
  206. }
  207. const refresh = () => {
  208. state.isclick = true
  209. let source = ""
  210. // #ifdef MP-ALIPAY
  211. source = "ALI"
  212. // #endif
  213. // #ifdef MP-WEIXIN
  214. source = "WECHAT"
  215. // #endif
  216. var data = {
  217. orderId: state.orderId,
  218. source: source //请求方来源
  219. };
  220. const options = {
  221. type: 2,
  222. data: data,
  223. method: "POST",
  224. showLoading: true,
  225. };
  226. console.log("输出内容", options);
  227. requestNew(payQuery, options).then((res) => {
  228. const data = stringToJson(res.bizContent);
  229. console.log(data);
  230. if (data.paymentStatus == 'ALLSUCCESS') {
  231. gotoEditUserOrUnitInfo()
  232. }
  233. state.dataArray = data.datas;
  234. for (let i = 0; i < state.dataArray.length; i++) {
  235. if (state.dataArray[i].payType === 'HANDLE') {
  236. state.dataArray[i].payName = '权益金'
  237. } else if (state.dataArray[i].payType === 'MARGIN') {
  238. state.dataArray[i].payName = '保证金'
  239. } else if (state.dataArray[i].payType === 'PRESTORE') {
  240. state.dataArray[i].payName = '预存金'
  241. } else if (state.dataArray[i].payType === 'EQUITY') {
  242. state.dataArray[i].payName = '权益费'
  243. } else if (state.dataArray[i].payType === 'REPAIROBU') {
  244. state.dataArray[i].payName = '增补obu'
  245. } else if (state.dataArray[i].payType === 'CHANGECARD') {
  246. state.dataArray[i].payName = '更换卡'
  247. } else if (state.dataArray[i].payType === 'CHANGEOBU') {
  248. state.dataArray[i].payName = '更换签'
  249. } else if (state.dataArray[i].payType === 'CHANGEALL') {
  250. state.dataArray[i].payName = '更换卡签'
  251. } else {
  252. state.dataArray[i].payName = '未知费'
  253. }
  254. if (state.dataArray[i].payStatus === 'SUCCESS') {
  255. state.dataArray[i].payStatusName = '已支付'
  256. } else if (state.dataArray[i].payStatus === 'PAYING') {
  257. state.dataArray[i].payStatusName = '支付中'
  258. } else if (state.dataArray[i].payStatus === 'FAILED') {
  259. state.dataArray[i].payStatusName = '支付失败'
  260. } else if (state.dataArray[i].payStatus === 'UNPAY') {
  261. state.dataArray[i].payStatusName = '未支付'
  262. } else if (state.dataArray[i].payStatus === 'CLOSED') {
  263. state.dataArray[i].payStatusName = '已关闭'
  264. } else if (state.dataArray[i].payStatus === 'CANCELED') {
  265. state.dataArray[i].payStatusName = '已撤销'
  266. } else if (state.dataArray[i].payStatus === 'REFUND') {
  267. state.dataArray[i].payStatusName = '转入退费'
  268. } else {
  269. state.dataArray[i].payStatusName = '未知'
  270. }
  271. }
  272. console.log("state.dataArray", state.dataArray)
  273. });
  274. }
  275. onLoad((option : any) => {
  276. console.log("传递过来的到支付页面", option)
  277. state.orderId = option.orderId;
  278. state.isValueCard = option.isValueCard;
  279. state.vehicleId = option.vehicleId;
  280. let source = ""
  281. // #ifdef MP-ALIPAY
  282. imageUrl = imgURL + "applyCard/alibaba.png";
  283. source = "ALI"
  284. // #endif
  285. // #ifdef MP-WEIXIN
  286. imageUrl = imgURL + "applyCard/wechat.png";
  287. source = "WECHAT"
  288. // #endif
  289. var data = {
  290. orderId: state.orderId,
  291. source: source //请求方来源
  292. };
  293. const options = {
  294. type: 2,
  295. data: data,
  296. method: "POST",
  297. showLoading: true,
  298. };
  299. console.log("输出内容", options);
  300. requestNew(payQuery, options).then((res) => {
  301. const data = stringToJson(res.bizContent);
  302. console.log(data);
  303. if (data.paymentStatus == 'ALLSUCCESS') {
  304. // isValueCard 1 储值卡 2 记账卡
  305. if (state.isValueCard == 1) {
  306. uni.switchTab({
  307. url: "/pages/order/order"
  308. })
  309. } else {
  310. uni.redirectTo({
  311. url: `/subpackage/orders/release-products?orderId=${state.orderId}`,
  312. });
  313. }
  314. }
  315. state.dataArray = data.datas;
  316. for (let i = 0; i < state.dataArray.length; i++) {
  317. if (state.dataArray[i].payType === 'HANDLE') {
  318. state.dataArray[i].payName = '权益金'
  319. } else if (state.dataArray[i].payType === 'MARGIN') {
  320. state.dataArray[i].payName = '保证金'
  321. } else if (state.dataArray[i].payType === 'PRESTORE') {
  322. state.dataArray[i].payName = '预存金'
  323. } else if (state.dataArray[i].payType === 'EQUITY') {
  324. state.dataArray[i].payName = '权益费'
  325. } else if (state.dataArray[i].payType === 'REPAIROBU') {
  326. state.dataArray[i].payName = '增补obu'
  327. } else if (state.dataArray[i].payType === 'CHANGECARD') {
  328. state.dataArray[i].payName = '更换卡'
  329. } else if (state.dataArray[i].payType === 'CHANGEOBU') {
  330. state.dataArray[i].payName = '更换签'
  331. } else if (state.dataArray[i].payType === 'CHANGEALL') {
  332. state.dataArray[i].payName = '更换卡签'
  333. } else {
  334. state.dataArray[i].payName = '未知费'
  335. }
  336. if (state.dataArray[i].payStatus === 'SUCCESS') {
  337. state.dataArray[i].payStatusName = '已支付'
  338. } else if (state.dataArray[i].payStatus === 'PAYING') {
  339. state.dataArray[i].payStatusName = '支付中'
  340. } else if (state.dataArray[i].payStatus === 'FAILED') {
  341. state.dataArray[i].payStatusName = '支付失败'
  342. } else if (state.dataArray[i].payStatus === 'UNPAY') {
  343. state.dataArray[i].payStatusName = '未支付'
  344. } else if (state.dataArray[i].payStatus === 'CLOSED') {
  345. state.dataArray[i].payStatusName = '已关闭'
  346. } else if (state.dataArray[i].payStatus === 'CANCELED') {
  347. state.dataArray[i].payStatusName = '已撤销'
  348. } else if (state.dataArray[i].payStatus === 'REFUND') {
  349. state.dataArray[i].payStatusName = '转入退费'
  350. } else {
  351. state.dataArray[i].payStatusName = '未知'
  352. }
  353. }
  354. console.log("state.dataArray", state.dataArray)
  355. });
  356. });
  357. //解析URL获取参数
  358. const getRequest = (urlStr) => {
  359. if (typeof urlStr == "undefined") {
  360. // 获取url中"?"符后的字符串
  361. var url = decodeURI(location.search);
  362. } else {
  363. var url = "?" + urlStr.split("?")[1];
  364. }
  365. var theRequest = new Object();
  366. if (url.indexOf("?") != -1) {
  367. var str = url.substr(1);
  368. var strs = str.split("&");
  369. for (var i = 0; i < strs.length; i++) {
  370. theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
  371. }
  372. }
  373. return theRequest;
  374. };
  375. //监听页面滚动
  376. onPageScroll((e) => {
  377. scrollTop.value = e.scrollTop;
  378. });
  379. // isValueCard 1 储值卡 2 记账卡
  380. const gotoEditUserOrUnitInfo = () => {
  381. if (state.isValueCard == 1) {
  382. uni.switchTab({
  383. url: "/pages/order/order"
  384. })
  385. } else {
  386. uni.redirectTo({
  387. url: `/subpackage/orders/release-products?orderId=${state.orderId}`,
  388. });
  389. }
  390. }
  391. const state = reactive({
  392. isValueCard: 1, //卡的类型
  393. radiolist1: [], //选择卡的数据列表
  394. choiceCardShow: false, //选择卡的弹出框
  395. isSign: '',
  396. id: "",
  397. orderId: "",
  398. userType: 1, //1 个人 2单位
  399. type: 0, //0 客车 1货车
  400. vehiclePlateColor: "",
  401. data: {
  402. show: false,
  403. src: imgURL + "applyCard/edit.png",
  404. },
  405. dataArray: [],
  406. list: [
  407. {
  408. bg: imgURL + "applyCard/product-bg.png",
  409. icon: imgURL + "applyCard/wechat.png",
  410. title: "【货车】微信车主服务",
  411. tip: "绑定微信支付,无需绑定银行卡",
  412. },
  413. ],
  414. openid: "",
  415. isclick: true,//防止重复点击
  416. vehicleId: ""
  417. });
  418. // 车牌校验
  419. const etcVehiclePlateVerRequest = () => {
  420. let data = {
  421. vehiclePlate: state.vehicleId.split('_')[0],
  422. vehiclePlateColor: state.vehicleId.split('_')[1],
  423. }
  424. const options = {
  425. type: 2,
  426. data: data,
  427. method: "POST",
  428. showLoading: true,
  429. };
  430. return new Promise(async (resolve, reject) => {
  431. const res = await request(etcVehiclePlateVer, options);
  432. const data = stringToJson(res.bizContent);
  433. resolve(data);
  434. }).catch((error) => {
  435. reject(error);
  436. });
  437. }
  438. </script>
  439. <style lang="scss" scoped>
  440. ::v-deep .u-radio {
  441. display: flex !important;
  442. align-items: center !important;
  443. float: none !important;
  444. }
  445. ::v-deep .u-icon__icon {
  446. top: -4px !important;
  447. }
  448. .bottomTip {
  449. margin-top: 100rpx;
  450. text-align: center;
  451. font-size: 28rpx;
  452. font-family: Microsoft YaHei;
  453. font-weight: 400;
  454. color: #b3b3b3;
  455. }
  456. .content-value {
  457. position: relative;
  458. padding: 0rpx 30rpx;
  459. position: relative;
  460. .img-pos {
  461. position: absolute;
  462. left: 500rpx;
  463. top: -38rpx;
  464. right: 50rpx;
  465. .img-flex {
  466. display: flex;
  467. justify-content: space-between;
  468. align-items: center;
  469. .car-img {
  470. width: 86rpx;
  471. height: 42rpx;
  472. }
  473. .flag-img {
  474. width: 30rpx;
  475. height: 35rpx;
  476. }
  477. }
  478. }
  479. }
  480. .flex {
  481. display: flex;
  482. align-items: center;
  483. }
  484. .action {
  485. margin-top: 30rpx;
  486. padding-left: 20rpx;
  487. padding-right: 20rpx;
  488. padding-bottom: 30rpx;
  489. .button {
  490. height: 80rpx;
  491. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  492. border-radius: 40rpx;
  493. font-size: 32rpx;
  494. font-weight: 400;
  495. color: #ffffff;
  496. line-height: 80rpx;
  497. }
  498. }
  499. .action-btn {
  500. margin-left: 45rpx;
  501. width: 121rpx;
  502. height: 61rpx;
  503. border: 1px solid rgba(255, 255, 255, 1);
  504. border-radius: 30rpx;
  505. background: rgba(255, 255, 255, 0.2);
  506. text-align: center;
  507. font-size: 30rpx;
  508. font-family: Microsoft YaHei;
  509. font-weight: 400;
  510. color: #ffffff;
  511. line-height: 61rpx;
  512. }
  513. .tag1 {
  514. padding: 5rpx;
  515. background: rgba(0, 179, 139, 0.5);
  516. border-radius: 6rpx;
  517. font-size: 22rpx;
  518. font-family: Microsoft YaHei;
  519. font-weight: 400;
  520. color: #ffffff;
  521. }
  522. .tag3 {
  523. padding: 5rpx;
  524. background: rgba(139, 112, 228, 0.5);
  525. border-radius: 6rpx;
  526. font-size: 22rpx;
  527. font-family: Microsoft YaHei;
  528. font-weight: 400;
  529. color: #ffffff;
  530. }
  531. .tag2 {
  532. padding: 5rpx;
  533. background: rgba(249, 97, 60, 0.5);
  534. border-radius: 6rpx;
  535. font-size: 22rpx;
  536. font-family: Microsoft YaHei;
  537. font-weight: 400;
  538. color: #ffffff;
  539. }
  540. .ul-item {
  541. padding: 5px 20rpx;
  542. display: flex;
  543. align-items: center;
  544. .item-value {
  545. padding: 20rpx;
  546. position: absolute;
  547. display: flex;
  548. align-items: center;
  549. width: 80%;
  550. .content {
  551. width: 51%;
  552. .title {
  553. font-size: 32rpx;
  554. font-family: Microsoft YaHei;
  555. font-weight: 400;
  556. color: #ffffff;
  557. }
  558. .tip {
  559. font-size: 24rpx;
  560. font-family: Microsoft YaHei;
  561. font-weight: 400;
  562. color: #ffffff;
  563. }
  564. }
  565. }
  566. .icon-tip {
  567. width: 100rpx;
  568. height: 100rpx;
  569. }
  570. .content {
  571. margin-left: 40rpx;
  572. }
  573. }
  574. .money {
  575. color: white;
  576. }
  577. ::v-deep .u-mode-center-box {
  578. border-radius: 10rpx;
  579. }
  580. .squire {
  581. padding: 30rpx 30rpx 50rpx 50rpx;
  582. }
  583. .mask-close {
  584. text-align: right;
  585. }
  586. .icon-closed {
  587. width: 48rpx;
  588. height: 48rpx;
  589. }
  590. .mask-title {
  591. text-align: center;
  592. font-size: 32rpx;
  593. color: $uni-text-color-black;
  594. margin-bottom: 50rpx;
  595. }
  596. </style>