Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

payment.vue 11KB

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