選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

payment.vue 11KB

7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
6ヶ月前
6ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
7ヶ月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <template>
  2. <view class="content">
  3. <image class='bg-image' mode="widthFix"
  4. src="https://qtzl.etcjz.cn/default-bucket/20240324/3eba2095f5204798a1f8101b_beijing.jpg"></image>
  5. <view class="content-re">
  6. <custom-header title="订单详情" :back="config.hasReturn === 'true'"></custom-header>
  7. <view style="padding: 20rpx" v-if='isShow'>
  8. <view class="title">
  9. 订单详情
  10. </view>
  11. <view class="container">
  12. <template v-for='(item,index) in formData'>
  13. <view class="detail-item" :key='index' v-if='item.value !== "" && item.value !== undefined && !item.isHide'>
  14. <text>{{item.label}}</text>
  15. <text class="amount">{{item.key === 'amount'? '¥'+ item.value:item.value}}</text>
  16. </view>
  17. </template>
  18. <template v-for='(item,index) in amountList'>
  19. <view class="detail-item" :key='index'
  20. v-if='item.value !== "" && item.value !== undefined && parseFloat(item.value) !== 0'>
  21. <text>{{item.label}}</text>
  22. <view>
  23. <text class="amount">{{'¥'+ item.value}} </text>
  24. <text class="status" :class="{amount:item.status==='SUCCESS'}">({{item.statusName}}) </text>
  25. </view>
  26. </view>
  27. </template>
  28. <view class="detail-item" v-if='amountData.totalFee && parseFloat(amountData.totalFee) !== 0'>
  29. <text>合计金额</text>
  30. <text class="amount">¥{{amountData.totalFee}} </text>
  31. </view>
  32. </view>
  33. <view class="payment-total" v-if='amountData.actualPayment && parseFloat(amountData.actualPayment) !== 0'>
  34. <text>待付款</text>
  35. <text class="amount">¥{{handleAmount(amountData.actualPayment)}}</text>
  36. </view>
  37. <view class="over-txt">
  38. <button type="success" class="btn-txt btn" :class='{disabledBtn:!qdOrderVal.h5ReturnQdUrl}'
  39. :disabled="!qdOrderVal.h5ReturnQdUrl" @click="toNav">用户车辆信息上传完成</button>
  40. </view>
  41. <!-- <Hetong v-model="checked" :link='linkObj.url' v-if='linkObj.url' :name='linkObj.name' /> -->
  42. <!-- <button type="success" class="btn-txt btn" @click="submit">确认办理</button> -->
  43. </view>
  44. <u-toast ref="uToastRef" />
  45. </view>
  46. </view>
  47. </template>
  48. <script setup lang='ts'>
  49. import {
  50. unifyTemplate
  51. } from '@/hooks/unifyTemplate'
  52. import {
  53. reactive,
  54. ref
  55. } from 'vue'
  56. import {
  57. onLoad
  58. } from '@dcloudio/uni-app'
  59. import Hetong from '@/components/Hetong/Hetong.vue'
  60. import {
  61. request,
  62. requestNew,
  63. myJsonp,
  64. toWeixin
  65. } from '@/utils/network/request'
  66. import {
  67. payType,
  68. payMentStatus
  69. } from './common.js'
  70. import {
  71. setToken,
  72. getToken,
  73. setItem,
  74. StorageKeys
  75. } from '@/utils/storage'
  76. import handleAmount from '@/utils/handleAmount.js';
  77. import {
  78. handleToTypes,
  79. isWeb,
  80. handleToZhifubao,
  81. handleTonei,isWxDuan
  82. } from '@/utils/utils';
  83. const {
  84. CustomHeader, //头部组件
  85. initData, //初始化数据
  86. isShow, //是否展示formBuilderVue组件
  87. qdOrderVal //qdOrder中数据 ref
  88. } = unifyTemplate() //初始化数据
  89. // import {
  90. // request
  91. // } from '../../static/js/network/request'
  92. let orderObj = {}
  93. let formData = reactive < any > ([{
  94. label: '产品名',
  95. value: '',
  96. key: "product",
  97. key1: 'promoteName',
  98. }, {
  99. label: '订单步骤',
  100. value: '',
  101. key: "orderStepName",
  102. }, {
  103. label: '车牌号',
  104. key: "vehiclePlate",
  105. value: '贵'
  106. }, {
  107. label: '车主姓名',
  108. key: "ownerName",
  109. value: ''
  110. }, {
  111. label: '邮寄地址',
  112. key: "orderInfoExt",
  113. key1: 'region,address',
  114. default: "不邮寄",
  115. isHide: false,
  116. value: ''
  117. }])
  118. const amountList = ref < any > ([])
  119. const checked = ref(false)
  120. // 实付款
  121. const amountData = ref({
  122. totalFee: '',
  123. actualPayment: 0
  124. })
  125. let config = ref < any > ({
  126. submitName: '提交',
  127. titleWidth: 160
  128. })
  129. onLoad((opin) => {
  130. // 初始化数据
  131. initData(opin, 4).then(async data => {
  132. console.log(data, 'data');
  133. orderObj = data.order
  134. amountData.value.totalFee = handleAmount(data.order.amount)
  135. await login(data)
  136. // getLink(data.order.orderNo)
  137. getOrderInfo(data.order.orderNo)
  138. delete data.config.tableConfig
  139. config.value = Object.assign(data.config, config.value)
  140. })
  141. })
  142. const linkObj = reactive({
  143. url: "",
  144. name: ""
  145. })
  146. // 获取协议链接
  147. async function getLink(orderId) {
  148. await requestNew('/iaw/issue/order/agreementInSertOrder', {
  149. data: {
  150. orderId
  151. }
  152. }).then((res) => {
  153. if (res.code === 0) {
  154. let data = res.data.data[0]
  155. console.log(data, '协议');
  156. linkObj.url = data.address[0].url
  157. linkObj.name = data.name
  158. }
  159. // contractTesting(qdOrderVal.value.qdOrderNo, jumpPage)
  160. })
  161. }
  162. // 无感登录,如果没有登录调用登录
  163. async function login(orderData) {
  164. let data = {
  165. userType: '',
  166. accountNumber: '',
  167. loginSource: '431bfdc8b9c645e0b293b85d6ce1948n',
  168. }
  169. if (orderData.order.userType === "PERSONAL_USER") {
  170. // 个人办理
  171. data.userType = 'PERSONAL'
  172. data.accountNumber = orderData.order.customerTel
  173. } else {
  174. // 单位办理
  175. console.log('单位办理');
  176. data.userType = 'ENTERPRISE'
  177. data.accountNumber = orderData.order.customerIdNum
  178. }
  179. console.log('login请求参数', data);
  180. await requestNew('/iaw/portal/loginByNoPassword', {
  181. data,
  182. }).then((res) => {
  183. if (res.code === 0) {
  184. let data = res.data
  185. // 保存token
  186. setToken(data.accessToken)
  187. setItem(StorageKeys.OpenId, data.openId)
  188. console.log(data, '登录获取的数据')
  189. }
  190. // contractTesting(qdOrderVal.value.qdOrderNo, jumpPage)
  191. })
  192. }
  193. const stepOptions = [{
  194. value: 1,
  195. label: "完成填写基本信息"
  196. },
  197. {
  198. value: 2,
  199. label: "完成个人/单位信息上传"
  200. },
  201. {
  202. value: 3,
  203. label: "已支付,待签约"
  204. },
  205. {
  206. value: 4,
  207. label: "完成车辆信息上传,待支付"
  208. },
  209. {
  210. value: 5,
  211. label: "完成签约"
  212. },
  213. {
  214. value: 6,
  215. label: "待审核"
  216. },
  217. {
  218. value: 7,
  219. label: "审核不通过"
  220. },
  221. {
  222. value: 8,
  223. label: "待发货"
  224. },
  225. {
  226. value: 9,
  227. label: "待收货"
  228. },
  229. {
  230. value: 10,
  231. label: "待激活"
  232. },
  233. {
  234. value: 11,
  235. label: "已完成"
  236. },
  237. {
  238. value: 12,
  239. label: "已申请-换货"
  240. },
  241. {
  242. value: 13,
  243. label: "已申请-退货"
  244. },
  245. {
  246. value: 14,
  247. label: "已结束"
  248. },
  249. {
  250. value: 15,
  251. label: "退款中"
  252. },
  253. {
  254. value: 16,
  255. label: "退款成功"
  256. },
  257. {
  258. value: 17,
  259. label: "退货成功"
  260. },
  261. ]
  262. function getOrderInfo(orderId) {
  263. let options = {
  264. type: 2,
  265. data: {
  266. orderId
  267. },
  268. method: 'POST',
  269. showLoading: true
  270. }
  271. requestNew('/iaw/issue/order/orderDetailQuery', options).then((res) => {
  272. if (res.code === 0) {
  273. let data = res.data.data
  274. console.log(data, '订单数据');
  275. data.orderStepName = stepOptions.find(item => item.value === data.orderStep)?.label || data.orderStep
  276. formData.forEach(item => {
  277. let itemData = data[item.key]
  278. if (typeof itemData === 'object' && itemData) {
  279. console.log(itemData, item.key1);
  280. if (item.key1 && item.key1.includes(',')) {
  281. let str = ''
  282. item.key1.split(',').forEach(listItem => {
  283. str += itemData[listItem] || ''
  284. })
  285. itemData = str
  286. } else {
  287. console.log(itemData, 'item.key1');
  288. itemData = itemData[item.key1]
  289. }
  290. }
  291. if (item.format) {
  292. itemData = item.format(itemData)
  293. }
  294. if (!itemData && itemData !== 0 && item.isHide === false) {
  295. item.isHide = true
  296. }
  297. item.value = itemData || item.default
  298. })
  299. amountData.value.actualPayment = 0
  300. amountList.value = data.feeList?.map(item => {
  301. if (item.payStatus === 'UNPAY') {
  302. amountData.value.actualPayment += parseInt(item.fee)
  303. }
  304. return {
  305. status: item.payStatus,
  306. statusName: payMentStatus[item.payStatus],
  307. label: payType[item.payType],
  308. value: handleAmount(item.fee)
  309. }
  310. }) || []
  311. console.log(amountList.value, 'amountList.value');
  312. isShow.value = true;
  313. }
  314. console.log(res, '请求订单获取的数据');
  315. })
  316. }
  317. // 数据处理
  318. // function getOrderInfo(orderId) {
  319. // request('8', {
  320. // data: {
  321. // orderId
  322. // }
  323. // }).then((res) => {
  324. // let data = JSON.parse(res.bizContent)
  325. // console.log(data, '订单数据');
  326. // formData.forEach(item => {
  327. // let itemData = data[item.key]
  328. // if (typeof itemData === 'object') {
  329. // if (item.key1.includes(',')) {
  330. // let str = ''
  331. // item.key1.split(',').forEach(listItem => {
  332. // str += itemData[listItem] || ''
  333. // })
  334. // itemData = str
  335. // } else {
  336. // itemData = itemData[item.key1]
  337. // }
  338. // }
  339. // if (item.format) {
  340. // itemData = item.format(itemData)
  341. // }
  342. // if (!itemData && itemData !== 0 && item.isHide === false) {
  343. // item.isHide = true
  344. // }
  345. // item.value = itemData || item.default
  346. // })
  347. // amountData.value.totalFee = handleAmount(data.sumFee)
  348. // amountData.value.actualPayment = 0
  349. // amountList.value = [] || data.datas.map(item => {
  350. // if (item.payStatus === 'UNPAY') {
  351. // amountData.value.actualPayment += parseInt(item.fee)
  352. // }
  353. // return {
  354. // status: item.payStatus,
  355. // statusName: payMentStatus[item.payStatus],
  356. // label: payType[item.payType],
  357. // value: handleAmount(item.fee)
  358. // }
  359. // })
  360. // isShow.value = true;
  361. // })
  362. // }
  363. const uToastRef = ref(null)
  364. //确认办理
  365. function submit() {
  366. if (checked.value || !linkObj.url) {
  367. uni.navigateTo({
  368. url: '/pages/payment/orderPayment',
  369. animationType: 'pop-in',
  370. animationDuration: 500
  371. })
  372. } else {
  373. uToastRef.value.show({
  374. title: '请先勾选协议',
  375. type: 'warning',
  376. })
  377. }
  378. }
  379. const toNav = () => {
  380. handleFinish()
  381. }
  382. const handleOther = (returnUrl) => {
  383. const type = handleToTypes();
  384. if (type === 'alipaymini') {
  385. handleToZhifubao(returnUrl);
  386. } else if (type === 'wechatmini') {
  387. let returnUrls = returnUrl.split('?')
  388. if (returnUrls.length === 1) {
  389. returnUrls = returnUrl +
  390. `?orderId=${orderObj.orderNo}&ownerName=${orderObj.ownerName}&productName=${orderObj.productName}&tel=${orderObj.customerTel || orderObj.agentTel}&vehicleId=${orderObj.vehicleId}&qdOrderNo=${orderObj.orderNo}`
  391. } else {
  392. returnUrls = returnUrl
  393. }
  394. console.log('returnUrls', returnUrls);
  395. handleTonei(returnUrls);
  396. }
  397. };
  398. const handleFinish = () => {
  399. console.log(qdOrderVal.value, '获取的qdorder');
  400. const h5ReturnQdUrl = qdOrderVal.value.h5ReturnQdUrl || '';
  401. if (!h5ReturnQdUrl) {
  402. return;
  403. }
  404. if (isWeb(h5ReturnQdUrl) ||isWxDuan(h5ReturnQdUrl)) {
  405. window.open(h5ReturnQdUrl, '_self');
  406. } else {
  407. handleOther(h5ReturnQdUrl);
  408. }
  409. };
  410. </script>
  411. <style lang='scss' scoped>
  412. .title {
  413. font-size: 30rpx;
  414. margin-left: 30rpx;
  415. }
  416. .container {
  417. padding: 10px;
  418. font-size: 14px;
  419. .detail-item {
  420. display: flex;
  421. align-items: center;
  422. justify-content: space-between;
  423. padding: 5px;
  424. margin-bottom: 8px;
  425. border-bottom: 1px solid #ccc;
  426. }
  427. }
  428. .payment-total {
  429. text-align: right;
  430. padding: 0 10px 20px;
  431. }
  432. text {
  433. margin-left: 10px;
  434. }
  435. .status {
  436. margin: 0;
  437. }
  438. .amount {
  439. color: #1AAC1B;
  440. max-width: 450rpx;
  441. }
  442. .over-txt {
  443. text-align: center;
  444. font-size: 32rpx;
  445. padding-top: 30rpx;
  446. }
  447. .over-txt .disabledBtn {
  448. background-color: #ccc !important;
  449. color: #666;
  450. }
  451. </style>