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.

payment.vue 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <div class="content">
  3. <custom-header title="订单详情" :back="hasReturn === 'true'"></custom-header>
  4. <div style="padding: 20rpx">
  5. <view class="title">
  6. 订单详情
  7. </view>
  8. <view class="container">
  9. <view class="detail-item" v-for='(item,index) in formData' :key='index'>
  10. <text>{{item.label}}</text>
  11. <text class="amount">{{item.key === 'amount'? '¥'+ item.value:item.value}}</text>
  12. </view>
  13. </view>
  14. <view class="payment-total">
  15. <text>实付款</text>
  16. <text class="amount">¥{{amount}}</text>
  17. </view>
  18. <button type="success" class="btn-txt btn" @click="submit">确认办理</button>
  19. </div>
  20. </div>
  21. </template>
  22. <script setup lang='ts'>
  23. import CustomHeader from '@/components/CustomHeader.vue';
  24. import {
  25. reactive,
  26. ref
  27. } from 'vue'
  28. import {
  29. onLoad
  30. } from '@dcloudio/uni-app'
  31. import {
  32. request,
  33. OrdinaryRequest,
  34. myJsonp
  35. } from '@/utils/network/request'
  36. import {
  37. useQdOrderStore
  38. } from '@/stores/qdOrder.js'
  39. const qdOrderStore = useQdOrderStore()
  40. // import {
  41. // request
  42. // } from '../../static/js/network/request'
  43. let formData = reactive < any > ([{
  44. label: '产品名',
  45. value: '测试产品',
  46. key: "product",
  47. key1: 'promoteName',
  48. }, {
  49. label: '车牌号',
  50. key: "vehiclePlate",
  51. value: '贵zzzzzzz'
  52. }, {
  53. label: '车主姓名',
  54. key: "ownerName",
  55. value: '张三'
  56. }, {
  57. label: '邮寄地址',
  58. key: "orderInfoExt",
  59. key1: 'region,address',
  60. default: "不邮寄",
  61. value: ''
  62. }, {
  63. label: '产品金额',
  64. key: "amount",
  65. format: (val) => {
  66. return val * 0.01
  67. },
  68. value: '¥0.01'
  69. }, ])
  70. const amount = ref < any > ('')
  71. let jumpPage = 'pages/payment/paymentSucess'
  72. let hasReturn = ref('false')
  73. onLoad((opin) => {
  74. let qdOrderNo: any
  75. if (opin && opin.qdOrderNo) {
  76. qdOrderNo = opin.qdOrderNo
  77. uni.setStorageSync('qdOrderNo', opin.qdOrderNo)
  78. }else{
  79. qdOrderNo = uni.getStorageSync('qdOrderNo')
  80. }
  81. request('ac8756cc31eb4816b8eaeb71907ff9c1', {
  82. data: {
  83. qdOrderNo,
  84. pageStep: 4
  85. }
  86. }).then((res) => {
  87. let data = JSON.parse(res.bizContent)
  88. console.log(data.qdOrder);
  89. qdOrderStore.setQdOrder(data.qdOrder)
  90. getOrderInfo(data.qdOrder.qtOrderNo)
  91. jumpPage = data.config.jumpPage
  92. hasReturn.value = data.config.hasReturn
  93. })
  94. })
  95. function getOrderInfo(orderId) {
  96. request('8', {
  97. data: {
  98. orderId
  99. }
  100. }).then((res) => {
  101. let data = JSON.parse(res.bizContent)
  102. amount.value = data.amount * 0.01
  103. formData.forEach(item => {
  104. let itemData = data[item.key]
  105. if (typeof itemData === 'object') {
  106. if (item.key1.includes(',')) {
  107. let str = ''
  108. item.key1.split(',').forEach(listItem => {
  109. str += itemData[listItem] || ''
  110. })
  111. itemData = str
  112. } else {
  113. itemData = itemData[item.key1]
  114. }
  115. }
  116. if (item.format) {
  117. itemData = item.format(itemData)
  118. }
  119. item.value = itemData || item.default
  120. })
  121. })
  122. }
  123. //提交
  124. function submit() {
  125. // console.log('提交内容', item)
  126. uni.showLoading({
  127. title: '正在支付...',
  128. mask: true
  129. })
  130. setTimeout(() => {
  131. uni.hideLoading()
  132. uni.navigateTo({
  133. url: '/' + jumpPage,
  134. animationType: 'pop-in',
  135. animationDuration: 500
  136. })
  137. }, 1000)
  138. // myJsonp({
  139. // url: 'https://www.taobao.com/help/getip.php',
  140. // success(res) {
  141. // console.log(res)
  142. // const data = {
  143. // fee: 1,
  144. // spbillCreateIp: res.ip,
  145. // }
  146. // OrdinaryRequest({
  147. // data,
  148. // })
  149. // }
  150. // })
  151. // const data = {
  152. // fee: 1,
  153. // spbillCreateIp: '',
  154. // }
  155. // OrdinaryRequest({
  156. // data,
  157. // })
  158. }
  159. </script>
  160. <style lang='scss' scoped>
  161. .title {
  162. font-size: 30rpx;
  163. margin-left: 30rpx;
  164. }
  165. .container {
  166. padding: 10px;
  167. font-size: 14px;
  168. .detail-item {
  169. display: flex;
  170. align-items: center;
  171. justify-content: space-between;
  172. padding: 5px;
  173. margin-bottom: 8px;
  174. border-bottom: 1px solid #ccc;
  175. }
  176. }
  177. .payment-total {
  178. text-align: right;
  179. padding: 0 10px 20px;
  180. }
  181. text {
  182. margin-left: 10px;
  183. }
  184. .amount {
  185. color: #1AAC1B;
  186. max-width: 450rpx;
  187. }
  188. .btn {
  189. height: 80rpx;
  190. opacity: 1;
  191. border-radius: 100rpx;
  192. margin: 20rpx 20rpx 20rpx 20rpx;
  193. }
  194. .btn-txt {
  195. background: #1AAC1B;
  196. margin: 10px;
  197. color: #FFFFFF;
  198. font-size: 28rpx;
  199. }
  200. </style>