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

orderPayment - 副本 (2).vue 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <div class="content">
  3. <custom-header title="订单支付" :back="config.hasReturn === 'true'"></custom-header>
  4. <view style="padding: 20rpx 0 30rpx" class="order-content">
  5. <!-- 获取产品展示 -->
  6. <view class="order-car" v-for='(item,index) in orderList' @click="handlePayment(item)" :key='index'
  7. :style="{'background-image':`url(${fileURL}image/applyCard/product-bg.png)`}">
  8. <!-- <image style="width: 100%; height: 170rpx; border-radius: 20rpx" :src="`${fileURL}image/applyCard/product-bg.png`">
  9. </image> -->
  10. <view class="l-info">
  11. <image class="icon-tip" :src="`${fileURL}image/applyCard/wechat.png`"></image>
  12. <view class="info-desc">
  13. <view class="goods-name">
  14. {{ item.name }}
  15. </view>
  16. <view class="goods-des">
  17. {{ item.status }}
  18. </view>
  19. </view>
  20. </view>
  21. <view class="r-amount">
  22. ¥: {{ item.fee * 0.01 }}
  23. </view>
  24. </view>
  25. </view>
  26. </div>
  27. </template>
  28. <script setup lang='ts'>
  29. import {
  30. fileURL
  31. } from '@/utils/network/api.js';
  32. import {
  33. unifyTemplate
  34. } from '@/hooks/unifyTemplate'
  35. import {
  36. reactive,
  37. ref
  38. } from 'vue'
  39. import {
  40. onLoad
  41. } from '@dcloudio/uni-app'
  42. import {
  43. request,
  44. myJsonp,
  45. toWeixin
  46. } from '@/utils/network/request'
  47. import {
  48. setToken,
  49. getToken
  50. } from '@/utils/storage'
  51. const {
  52. CustomHeader, //头部组件
  53. initData, //初始化数据
  54. isShow, //是否展示formBuilderVue组件
  55. qdOrderVal //qdOrder中数据 ref
  56. } = unifyTemplate() //初始化数据
  57. // import {
  58. // request
  59. // } from '../../static/js/network/request'
  60. const orderList = ref < any > ([])
  61. // 实付款
  62. const amount = ref < any > ('')
  63. let config = ref < any > ({
  64. submitName: '提交',
  65. titleWidth: 160
  66. })
  67. onLoad((opin) => {
  68. detectAliPay()
  69. })
  70. // 订单已支付
  71. function detectAliPay() {
  72. orderList.value = [{
  73. name: '办理费',
  74. fee: 100,
  75. status: '已支付'
  76. }, {
  77. name: '预存金',
  78. fee: 100,
  79. status: '未支付'
  80. }, {
  81. name: '保证金',
  82. fee: 100,
  83. status: '未支付'
  84. }, ]
  85. return
  86. request('56', {
  87. data: {
  88. orderId: qdOrderVal.value.qdOrderNo
  89. }
  90. }).then((res) => {
  91. if (res.statusCode === 0) {
  92. let data = JSON.parse(res.bizContent)
  93. if (data.tradeState === 'SUCCESS') {
  94. let {
  95. jumpPage
  96. } = config.value
  97. contractTesting(qdOrderVal.value.qdOrderNo, jumpPage)
  98. }
  99. }
  100. // contractTesting(qdOrderVal.value.qdOrderNo, jumpPage)
  101. })
  102. }
  103. //提交
  104. function handlePayment(orderData) {
  105. console.log(orderData);
  106. }
  107. // 签约检测
  108. function contractTesting(qdOrderNo, jumpPage) {
  109. const data = {
  110. qdOrderNo,
  111. }
  112. request('fdfbdddba6ec49f8b451cf2e299b4feb', {
  113. data,
  114. }).then((res) => {
  115. if (res.statusCode === 0) {
  116. const data = JSON.parse(res.bizContent)
  117. if (data.signStatus === 1 && data.accountStatus === 1 && data.bindStatus === 1) {
  118. // 上面三值都为1才进行下一步,否则进行签约初始化
  119. if (!jumpPage) return
  120. uni.navigateTo({
  121. url: '/' + jumpPage,
  122. animationType: 'pop-in',
  123. animationDuration: 500
  124. })
  125. /* 自定义返回 */
  126. } else {
  127. // 进行签约初始化
  128. signingInitialization(qdOrderNo)
  129. }
  130. // qdOrderStore.orderInfo.value.orderId = JSON.parse(res.bizContent).orderId
  131. // 通过检测
  132. }
  133. })
  134. }
  135. // 签约初始化
  136. function signingInitialization(qdOrderNo) {
  137. const data = {
  138. qdOrderNo
  139. }
  140. request('94569071cf814517908cd35693f1f2e1', {
  141. data,
  142. }).then((res) => {
  143. if (res.statusCode === 0) {
  144. const data = JSON.parse(res.bizContent)
  145. if (data.returnType === 0) {
  146. // 0-无需跳转,关闭H5即可 1-需跳转至返回url
  147. // const opened = window.open('about:blank', '_self');
  148. // opened.opener = null;
  149. // opened.close();
  150. closeWin()
  151. } else {
  152. window.open(data.signUrl, '_self')
  153. }
  154. }
  155. })
  156. }
  157. // 关闭当前页面方法
  158. function closeWin() {
  159. // @ts-ignore
  160. var jWeixin = import('jweixin-module')
  161. // @ts-ignore
  162. jWeixin.miniProgram.getEnv(function(res) {
  163. if (res.miniprogram) {
  164. // @ts-ignore
  165. jWeixin.miniProgram.navigateTo({
  166. url: '/path/to/page'
  167. })
  168. } else {
  169. const opened = window.open('about:blank', '_self');
  170. opened.opener = null;
  171. opened.close()
  172. }
  173. })
  174. }
  175. </script>
  176. <style lang='scss' scoped>
  177. .content {
  178. /* background-color: #f5f5f5; */
  179. /* height: 100%; */
  180. }
  181. .order-car {
  182. margin: 30rpx 30rpx 0;
  183. width: calc(100% - 60rpx);
  184. height: 170rpx;
  185. border-radius: 20rpx;
  186. /* background-color: #73acf9; */
  187. display: flex;
  188. justify-content: space-between;
  189. align-items: center;
  190. padding: 0 40rpx;
  191. /* 背景图不平铺 */
  192. background-repeat: no-repeat;
  193. /* 让背景图基于容器大小伸缩 */
  194. background-size: cover;
  195. .l-info {
  196. color: #fff;
  197. display: flex;
  198. .icon-tip {
  199. width: 100rpx;
  200. height: 100rpx;
  201. margin-right: 30rpx;
  202. }
  203. .goods-name {
  204. margin-bottom: 16rpx;
  205. font-size: 32rpx;
  206. font-weight: bold;
  207. }
  208. .goods-des {
  209. font-size: 26rpx;
  210. }
  211. }
  212. .r-amount {
  213. font-size: 38rpx;
  214. color: #fff;
  215. padding-left: 20rpx;
  216. font-weight: bold;
  217. }
  218. }
  219. </style>