Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1 год назад
1 год назад
1 год назад
1 год назад
1 год назад
1 год назад
1 год назад
1 год назад
1 год назад
1 год назад
1 год назад
1 год назад
1 год назад
1 год назад
1 год назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. <template>
  2. <navBar title="订单支付" :scrollTop="scrollTop"></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="`${$imgUrl}applyCard/alibaba.png`"></image>
  10. <view class="content">
  11. <view class="title">
  12. {{ item.payName }}
  13. </view>
  14. <!-- 1记账卡2储值卡3记存卡 -->
  15. <!-- <view style="margin-top: 15rpx" class="tip" v-if="item.cardType=='1'">
  16. 记账卡
  17. </view> -->
  18. <view style="margin-top: 15rpx" class="tip">
  19. {{ item.payStatusName }}
  20. </view>
  21. </view>
  22. <view class="money">
  23. ¥:{{ item.fee * 0.01 }}
  24. </view>
  25. </view>
  26. </view>
  27. <!-- <view class="bottomTip"> 到底啦!敬请期待其他产品! </view> -->
  28. </view>
  29. <!-- <u-popup mode="center" v-model="state.choiceCardShow" closeable>
  30. <view class="squire">
  31. <view class="mask-title" :style="{ '--color': color }">选择办理卡类型</view>
  32. <view class="as-layout-horizontal">
  33. <view v-for="(item, index) in state.radiolist1" :key="index" :label="item.disabled" :name="item.name"
  34. @click="radioChange(item.name)"
  35. style="width: 100%;display: flex;align-items: center;margin-bottom: 30rpx;">
  36. <view class="as-layout-vertical as-gravity-center">
  37. <image style="width: 140rpx; height: 100rpx; border-radius: 20rpx;margin-right: 20rpx;"
  38. :src="`${$imgUrl}card2.png`" mode="aspectFill"></image>
  39. <view style="margin-top: 20rpx;">
  40. {{item.name}}
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </u-popup> -->
  47. </template>
  48. <script setup lang="ts">
  49. import { onLoad, onPageScroll } from "@dcloudio/uni-app";
  50. import { reactive, ref } from "vue";
  51. import { PAYDETECTION,
  52. PAYMENTORDERAPPLY,
  53. wechatAppID,
  54. wechatSecret,
  55. CardBillQuery,
  56. CardBillPlaceOrder,
  57. CardBillPayStatus,
  58. wechatPayConfigId,
  59. aliPayConfigId,
  60. obtainUserId } from "@/utils/network/api.js";
  61. import { request } from "@/utils/network/request.js";
  62. import { stringToJson } from "@/utils/network/encryption";
  63. import { fileURL } from "@/datas/fileURL.js";
  64. import navBgCar from "./components/nav-bg-car1";
  65. import navBar from "@/components/nav-bar/nav-bar2.vue";
  66. import { getItem, StorageKeys, setItem } from "@/utils/storage.ts";
  67. import { msg } from "@/utils/utils";
  68. const imgURL = `${fileURL}image/`;
  69. // import { setItem } from "@/utils/storage";
  70. let logo
  71. const scrollTop = ref(0); //滚动距离
  72. // 单选默认数据
  73. // let flag = ref(true)
  74. // 单选
  75. const radioChange = (n) => {
  76. console.log('radioChange', n);
  77. if (n == '记账卡') {
  78. state.isValueCard = 2
  79. } else if (n == '储值卡') {
  80. state.isValueCard = 1
  81. } else {
  82. state.isValueCard = 3
  83. }
  84. uni.redirectTo({
  85. url: `/subpackage/orders/essential-information?promoteId=${getItem("promoteId")}&userType=${state.userType}&type=${state.type}&isSign=${state.isSign}&isValueCard=${state.isValueCard}`,
  86. });
  87. }
  88. const savaHandle = (val) => {
  89. // console.log("vAL", val)
  90. // setItem("clientFee", val.clientFee);
  91. // setItem("promoteId", val.promoteId);
  92. // setItem("isValueCard", val.isValueCard);
  93. // state.isSign = val.isSign;
  94. // // 判断是几张卡
  95. // console.log("val.cardTypeArr.split(", ")", val.cardTypeArr.split(","))
  96. // // if (val.promoteName.indexOf('选装') != -1) {
  97. // // if (val.cardTypeArr.split(",")[0] == "记账卡") {
  98. // // state.isValueCard = 2
  99. // // } else if (val.cardTypeArr.split(",")[0] == '储值卡') {
  100. // // state.isValueCard = 1
  101. // // } else {
  102. // // state.isValueCard = 3
  103. // // }
  104. // // uni.redirectTo({
  105. // // url: `/subpackage/orders/verify/verify-phone/verify-phone?promoteId=${getItem("promoteId")}&userType=${state.userType}&type=${state.type}&isValueCard=${state.isValueCard}`,
  106. // // });
  107. // // return
  108. // // }
  109. // if (val.cardTypeArr.split(",").length == 1) {
  110. // if (val.cardTypeArr.split(",")[0] == "记账卡") {
  111. // state.isValueCard = 2
  112. // } else if (val.cardTypeArr.split(",")[0] == '储值卡') {
  113. // state.isValueCard = 1
  114. // } else {
  115. // state.isValueCard = 3
  116. // }
  117. // uni.redirectTo({
  118. // url: `/subpackage/orders/essential-information?promoteId=${getItem("promoteId")}&userType=${state.userType}&type=${state.type}&isValueCard=${state.isValueCard}`,
  119. // });
  120. // } else {
  121. // state.radiolist1 = [];
  122. // // 处理卡的数据
  123. // for (var i = 0; i < val.cardTypeArr.split(",").length; i++) {
  124. // const obj = {};
  125. // obj["name"] = val.cardTypeArr.split(",")[i];
  126. // obj["disabled"] = false;
  127. // state.radiolist1.push(obj)
  128. // }
  129. // state.choiceCardShow = true;
  130. // console.log("state.radiolist1", state.radiolist1)
  131. // }
  132. if (val.payStatus === 'UNPAY') {
  133. // #ifdef MP-ALIPAY
  134. my.getAuthCode({
  135. scopes: 'auth_base',
  136. success: res => {
  137. const optionsUser = {
  138. type: 2,
  139. data: {
  140. payConfigId: aliPayConfigId,
  141. code: res.authCode
  142. },
  143. method: "POST",
  144. showLoading: true,
  145. };
  146. console.log('支付宝用户编号请求:',optionsUser)
  147. request(obtainUserId, optionsUser).then((res) => {
  148. console.log('支付宝用户编号返回:',res)
  149. const data = stringToJson(res.bizContent);
  150. const optionsali = {
  151. type: 2,
  152. data: {
  153. orderId:state.orderId,
  154. wxOpenid: data.openId,
  155. payType:val.payType
  156. },
  157. method: "POST",
  158. showLoading: true,
  159. };
  160. console.log('支付下单请求:',optionsali)
  161. request(PAYMENTORDERAPPLY, optionsali).then((res) => {
  162. console.log('支付下单返回:',res)
  163. const data = stringToJson(res.bizContent);
  164. my.tradePay ({
  165. // 调用统一收单交易创建接口(alipay.trade.create),获得返回字段支付宝交易号 trade_no
  166. tradeNO: data.tranPackage,
  167. success: res => {
  168. console.log("支付成功", res);
  169. refresh();
  170. },
  171. fail: res => {
  172. console.log("支付失败", res);
  173. },
  174. });
  175. });
  176. });
  177. },
  178. fail: err => {
  179. console.log('my.getAuthCode 调用失败', err)
  180. }
  181. });
  182. // #endif
  183. }
  184. };
  185. const refresh = () =>{
  186. var data = {
  187. orderId: state.orderId,
  188. source: 'ALI' //请求方来源
  189. };
  190. const options = {
  191. type: 2,
  192. data: data,
  193. method: "POST",
  194. showLoading: true,
  195. };
  196. console.log("输出内容", options);
  197. request(PAYDETECTION, options).then((res) => {
  198. // console.log(res.bizContent);
  199. const data = stringToJson(res.bizContent);
  200. console.log(data);
  201. // console.log(typeof(data));
  202. if(data.paymentStatus == 'ALLSUCCESS'){
  203. gotoEditUserOrUnitInfo()
  204. // uni.redirectTo({
  205. // url: `/subpackage/orders/sign-up-ali?orderId=${state.orderId}`,
  206. // });
  207. }
  208. state.dataArray = data.datas;
  209. // HANDLE("办理费",1){},
  210. // MARGIN("保证金",2){},
  211. // PRESTORE("预存金",3){},
  212. // EQUITY("权益费",4){},
  213. for(let i = 0;i < state.dataArray.length;i++){
  214. if(state.dataArray[i].payType === 'HANDLE'){
  215. state.dataArray[i].payName = '办理费'
  216. }else if(state.dataArray[i].payType === 'MARGIN'){
  217. state.dataArray[i].payName = '保证金'
  218. }else if(state.dataArray[i].payType === 'PRESTORE'){
  219. state.dataArray[i].payName = '预存金'
  220. }else if(state.dataArray[i].payType === 'EQUITY'){
  221. state.dataArray[i].payName = '权益费'
  222. }else {
  223. state.dataArray[i].payName = '未知费'
  224. }
  225. // SUCCESS("支付成功",1){},
  226. // PAYING("支付中",2){},
  227. // FAILED("支付失败",3){},
  228. // UNPAY("未支付",4){},
  229. // CLOSED("已关闭",5){},
  230. // CANCELED("已撤销",6){},
  231. // REFUND("转入退费",7){},
  232. if(state.dataArray[i].payStatus === 'SUCCESS'){
  233. state.dataArray[i].payStatusName = '已支付'
  234. }else if(state.dataArray[i].payStatus === 'PAYING'){
  235. state.dataArray[i].payStatusName = '支付中'
  236. }else if(state.dataArray[i].payStatus === 'FAILED'){
  237. state.dataArray[i].payStatusName = '支付失败'
  238. }else if(state.dataArray[i].payStatus === 'UNPAY'){
  239. state.dataArray[i].payStatusName = '未支付'
  240. }else if(state.dataArray[i].payStatus === 'CLOSED'){
  241. state.dataArray[i].payStatusName = '已关闭'
  242. }else if(state.dataArray[i].payStatus === 'CANCELED'){
  243. state.dataArray[i].payStatusName = '已撤销'
  244. }else if(state.dataArray[i].payStatus === 'REFUND'){
  245. state.dataArray[i].payStatusName = '转入退费'
  246. }else{
  247. state.dataArray[i].payStatusName = '未知'
  248. }
  249. }
  250. console.log("state.dataArray", state.dataArray)
  251. });
  252. }
  253. onLoad((option : any) => {
  254. state.orderId = option.orderId;
  255. state.isValueCard = option.isValueCard;
  256. // state.userType = option.userType;
  257. // state.vehiclePlateColor = option.vehiclePlateColor;
  258. // state.userType = option.userType;
  259. // state.type = option.type;
  260. // option.orderId;
  261. var data = {
  262. orderId: state.orderId,
  263. source: 'ALI' //请求方来源
  264. };
  265. const options = {
  266. type: 2,
  267. data: data,
  268. method: "POST",
  269. showLoading: true,
  270. };
  271. console.log("输出内容", options);
  272. request(PAYDETECTION, options).then((res) => {
  273. // console.log(res.bizContent);
  274. const data = stringToJson(res.bizContent);
  275. console.log(data);
  276. // console.log(typeof(data));
  277. if(data.paymentStatus == 'ALLSUCCESS'){
  278. gotoEditUserOrUnitInfo(state)
  279. // uni.redirectTo({
  280. // url: `/subpackage/orders/sign-up-ali?orderId=${state.orderId}`,
  281. // });
  282. }
  283. state.dataArray = data.datas;
  284. // HANDLE("办理费",1){},
  285. // MARGIN("保证金",2){},
  286. // PRESTORE("预存金",3){},
  287. // EQUITY("权益费",4){},
  288. for(let i = 0;i < state.dataArray.length;i++){
  289. if(state.dataArray[i].payType === 'HANDLE'){
  290. state.dataArray[i].payName = '办理费'
  291. }else if(state.dataArray[i].payType === 'MARGIN'){
  292. state.dataArray[i].payName = '保证金'
  293. }else if(state.dataArray[i].payType === 'PRESTORE'){
  294. state.dataArray[i].payName = '预存金'
  295. }else if(state.dataArray[i].payType === 'EQUITY'){
  296. state.dataArray[i].payName = '权益费'
  297. }else {
  298. state.dataArray[i].payName = '未知费'
  299. }
  300. // SUCCESS("支付成功",1){},
  301. // PAYING("支付中",2){},
  302. // FAILED("支付失败",3){},
  303. // UNPAY("未支付",4){},
  304. // CLOSED("已关闭",5){},
  305. // CANCELED("已撤销",6){},
  306. // REFUND("转入退费",7){},
  307. if(state.dataArray[i].payStatus === 'SUCCESS'){
  308. state.dataArray[i].payStatusName = '已支付'
  309. }else if(state.dataArray[i].payStatus === 'PAYING'){
  310. state.dataArray[i].payStatusName = '支付中'
  311. }else if(state.dataArray[i].payStatus === 'FAILED'){
  312. state.dataArray[i].payStatusName = '支付失败'
  313. }else if(state.dataArray[i].payStatus === 'UNPAY'){
  314. state.dataArray[i].payStatusName = '未支付'
  315. }else if(state.dataArray[i].payStatus === 'CLOSED'){
  316. state.dataArray[i].payStatusName = '已关闭'
  317. }else if(state.dataArray[i].payStatus === 'CANCELED'){
  318. state.dataArray[i].payStatusName = '已撤销'
  319. }else if(state.dataArray[i].payStatus === 'REFUND'){
  320. state.dataArray[i].payStatusName = '转入退费'
  321. }else{
  322. state.dataArray[i].payStatusName = '未知'
  323. }
  324. }
  325. console.log("state.dataArray", state.dataArray)
  326. });
  327. });
  328. //监听页面滚动
  329. onPageScroll((e) => {
  330. scrollTop.value = e.scrollTop;
  331. });
  332. const productReCodeAction = (id) => {
  333. var data = {
  334. productId: id,
  335. orderId: state.orderId,
  336. };
  337. const options = {
  338. type: 2,
  339. data: data,
  340. method: "POST",
  341. showLoading: true,
  342. };
  343. return new Promise(async (resolve, reject) => {
  344. const res = await request(productReCode, options);
  345. const data = stringToJson(res.bizContent);
  346. resolve(data);
  347. }).catch((error) => {
  348. reject(error);
  349. });
  350. };
  351. const gotoEditUserOrUnitInfo = () => {
  352. let url = '';
  353. if (state.isValueCard != 1) {
  354. url = `/subpackage/orders/release-products`;
  355. } else {
  356. // #ifdef MP-ALIPAY
  357. url = `/subpackage/orders/sign-up-ali`;
  358. // #endif
  359. // #ifdef MP-WEIXIN
  360. url = `/subpackage/orders/essential-information`;
  361. // #endif
  362. }
  363. console.log("url", url)
  364. uni.redirectTo({
  365. url: `${url}?orderId=${state.orderId}`,
  366. });
  367. }
  368. const state = reactive({
  369. isValueCard: 1, //卡的类型
  370. radiolist1: [], //选择卡的数据列表
  371. choiceCardShow: false, //选择卡的弹出框
  372. isSign: '',
  373. orderId: "",
  374. userType: 1, //1 个人 2单位
  375. type: 0, //0 客车 1货车
  376. vehiclePlateColor: "",
  377. data: {
  378. show: false,
  379. src: imgURL + "applyCard/edit.png",
  380. },
  381. dataArray: [],
  382. list: [
  383. {
  384. bg: imgURL + "applyCard/product-bg.png",
  385. icon: imgURL + "applyCard/wechat.png",
  386. title: "【货车】微信车主服务",
  387. tip: "绑定微信支付,无需绑定银行卡",
  388. },
  389. ],
  390. });
  391. </script>
  392. <style lang="scss" scoped>
  393. ::v-deep .u-radio {
  394. display: flex !important;
  395. align-items: center !important;
  396. float: none !important;
  397. }
  398. ::v-deep .u-icon__icon {
  399. top: -4px !important;
  400. }
  401. .bottomTip {
  402. margin-top: 100rpx;
  403. text-align: center;
  404. font-size: 28rpx;
  405. font-family: Microsoft YaHei;
  406. font-weight: 400;
  407. color: #b3b3b3;
  408. }
  409. .content-value {
  410. position: relative;
  411. // margin-top: -50rpx;
  412. padding: 0rpx 30rpx;
  413. position: relative;
  414. .img-pos {
  415. position: absolute;
  416. left: 500rpx;
  417. top: -38rpx;
  418. right: 50rpx;
  419. .img-flex {
  420. display: flex;
  421. justify-content: space-between;
  422. align-items: center;
  423. .car-img {
  424. width: 86rpx;
  425. height: 42rpx;
  426. }
  427. .flag-img {
  428. width: 30rpx;
  429. height: 35rpx;
  430. }
  431. }
  432. }
  433. }
  434. .flex {
  435. display: flex;
  436. align-items: center;
  437. }
  438. .action {
  439. margin-top: 30rpx;
  440. padding-left: 20rpx;
  441. padding-right: 20rpx;
  442. padding-bottom: 30rpx;
  443. .button {
  444. height: 80rpx;
  445. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  446. border-radius: 40rpx;
  447. font-size: 32rpx;
  448. font-weight: 400;
  449. color: #ffffff;
  450. line-height: 80rpx;
  451. }
  452. }
  453. .action-btn {
  454. margin-left: 45rpx;
  455. width: 121rpx;
  456. height: 61rpx;
  457. border: 1px solid rgba(255, 255, 255, 1);
  458. border-radius: 30rpx;
  459. background: rgba(255, 255, 255, 0.2);
  460. text-align: center;
  461. font-size: 30rpx;
  462. font-family: Microsoft YaHei;
  463. font-weight: 400;
  464. color: #ffffff;
  465. line-height: 61rpx;
  466. }
  467. .tag1 {
  468. padding: 5rpx;
  469. background: rgba(0, 179, 139, 0.5);
  470. border-radius: 6rpx;
  471. font-size: 22rpx;
  472. font-family: Microsoft YaHei;
  473. font-weight: 400;
  474. color: #ffffff;
  475. }
  476. .tag3 {
  477. padding: 5rpx;
  478. background: rgba(139, 112, 228, 0.5);
  479. border-radius: 6rpx;
  480. font-size: 22rpx;
  481. font-family: Microsoft YaHei;
  482. font-weight: 400;
  483. color: #ffffff;
  484. }
  485. .tag2 {
  486. padding: 5rpx;
  487. background: rgba(249, 97, 60, 0.5);
  488. border-radius: 6rpx;
  489. font-size: 22rpx;
  490. font-family: Microsoft YaHei;
  491. font-weight: 400;
  492. color: #ffffff;
  493. }
  494. .ul-item {
  495. padding: 5px 20rpx;
  496. display: flex;
  497. align-items: center;
  498. .item-value {
  499. padding: 20rpx;
  500. position: absolute;
  501. display: flex;
  502. align-items: center;
  503. // justify-content: space-around;
  504. width: 80%;
  505. .content {
  506. width: 51%;
  507. .title {
  508. font-size: 32rpx;
  509. font-family: Microsoft YaHei;
  510. font-weight: 400;
  511. color: #ffffff;
  512. }
  513. .tip {
  514. font-size: 24rpx;
  515. font-family: Microsoft YaHei;
  516. font-weight: 400;
  517. color: #ffffff;
  518. }
  519. }
  520. }
  521. .icon-tip {
  522. width: 100rpx;
  523. height: 100rpx;
  524. }
  525. .content {
  526. margin-left: 40rpx;
  527. }
  528. }
  529. .money {
  530. color: white;
  531. // float: right;
  532. }
  533. ::v-deep .u-mode-center-box {
  534. border-radius: 10rpx;
  535. }
  536. .squire {
  537. padding: 30rpx 30rpx 50rpx 50rpx;
  538. }
  539. .mask-close {
  540. text-align: right;
  541. }
  542. .icon-closed {
  543. width: 48rpx;
  544. height: 48rpx;
  545. }
  546. .mask-title {
  547. text-align: center;
  548. font-size: 32rpx;
  549. color: $uni-text-color-black;
  550. margin-bottom: 50rpx;
  551. }
  552. </style>