surePay.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="item">
  5. <view class="l">订单号:</view>
  6. <view class="r">
  7. {{ form.no }}
  8. </view>
  9. </view>
  10. <view class="item">
  11. <view class="l">业务费用:</view>
  12. <view class="r">
  13. {{ form.itemPrice }}元
  14. </view>
  15. </view>
  16. <view class="item">
  17. <view class="l">停车费用:</view>
  18. <view class="r">
  19. <text>{{ form.partMoney + form.chinaPartMoney }}元</text>
  20. </view>
  21. </view>
  22. <view class="item">
  23. <view class="l">合计费用:</view>
  24. <view class="r">
  25. {{ form.totalMoney }}元
  26. </view>
  27. </view>
  28. <view class="item">
  29. <u-radio-group v-model="form.payType" placement="column" @change="groupChange">
  30. <u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in payTypeList" :key="index"
  31. :label="item.name" :name="item.value" @change="radioChange">
  32. </u-radio>
  33. </u-radio-group>
  34. </view>
  35. <!-- <view class="item">
  36. <view class="l">支付凭据:</view>
  37. <view class="r">
  38. <view class="img">
  39. <uni-file-picker v-model="imageValue" fileMediatype="image" mode="grid" limit="1"
  40. @select="select" @progress="progress" @success="success" @fail="fail"
  41. @delete="form.payTicket=''" :image-styles="imageStyles" />
  42. </view>
  43. </view>
  44. </view> -->
  45. </view>
  46. <u-button type="primary" @click="confirmFn">确认支付</u-button>
  47. </view>
  48. </template>
  49. <script>
  50. import request from '../../utils/request.js'
  51. export default {
  52. data() {
  53. return {
  54. id: '',
  55. imageValue: [],
  56. imageStyles: {
  57. width: 150,
  58. height: 100,
  59. border: {
  60. color: "#eee",
  61. width: 1,
  62. style: 'dashed',
  63. radius: '5px'
  64. }
  65. },
  66. payTypeList: [{
  67. name: '微信支付',
  68. value: 3
  69. }],
  70. form: {
  71. partMoney: 0,
  72. payType: 3
  73. },
  74. imgList: [],
  75. uploadImageUrl: request.server + '/upload/image',
  76. }
  77. },
  78. onLoad(options) {
  79. this.id = options.id;
  80. },
  81. onShow() {
  82. this.getBusinessById();
  83. },
  84. methods: {
  85. // 获取上传状态
  86. select(e) {
  87. let that = this;
  88. uni.uploadFile({
  89. url: that.uploadImageUrl,
  90. filePath: e.tempFilePaths[0],
  91. name: 'file',
  92. success: (resp => {
  93. that.form.payTicket = JSON.parse(resp.data).data;
  94. })
  95. })
  96. },
  97. deleteFn(v) {
  98. console.log(v)
  99. },
  100. // 获取上传进度
  101. progress(e) {
  102. console.log('上传进度:', e)
  103. },
  104. // 上传成功
  105. success(e) {
  106. console.log('上传成功')
  107. },
  108. // 上传失败
  109. fail(e) {
  110. console.log('上传失败:', e)
  111. },
  112. getBusinessById() {
  113. this.$api.getBusinessById({
  114. id: this.id
  115. }).then(resp => {
  116. this.form = resp.data;
  117. this.form.payType = 3
  118. if (this.form.payTicket) {
  119. this.imageValue = [{
  120. 'name': 'payTicket.png',
  121. 'extname': '.png',
  122. 'url': this.form.payTicket
  123. }]
  124. }
  125. })
  126. },
  127. confirmFn() {
  128. this.$api.getPrePay({
  129. no: this.form.no
  130. }).then(resp => {
  131. if (resp.code != 200) {
  132. this.$common.toast('支付异常');
  133. }
  134. window.location.href = resp.data.payUrl;
  135. })
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="scss">
  141. page {
  142. background-color: #fff;
  143. }
  144. @import '@/common/common.scss'
  145. </style>