payList.vue 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <view class="from">
  3. <uni-forms ref="form" :modelValue="formData" :rules="rules">
  4. <view class="box">
  5. <uni-forms-item label="案件编号:" name="caseNum" label-width="120px" required>
  6. <uni-easyinput :inputBorder="false" :disabled='true' v-model="formData.caseNum" placeholder="" />
  7. </uni-forms-item>
  8. <uni-forms-item label="申请人:" name="applicantName" label-width="120px" required>
  9. <uni-easyinput :inputBorder="false" :disabled='true' v-model="formData.affiliate.applicationName"
  10. placeholder="" />
  11. </uni-forms-item>
  12. <uni-forms-item label="被申请人:" name="respondentName" label-width="120px" required>
  13. <uni-easyinput :inputBorder="false" :disabled='true' v-model="formData.affiliate.respondentName"
  14. placeholder="" />
  15. </uni-forms-item>
  16. <uni-forms-item label="案件标的:" name="caseSubjectAmount" label-width="120px" required>
  17. <uni-easyinput :inputBorder="false" :disabled='true' v-model="formData.caseSubjectAmount"
  18. placeholder="" />
  19. </uni-forms-item>
  20. <uni-forms-item label="应缴费用:" name="feePayable" label-width="120px" required>
  21. <uni-easyinput :inputBorder="false" :disabled='true' v-model="formData.feePayable" placeholder="" />
  22. </uni-forms-item>
  23. <uni-forms-item label="驳回原因:" name="reason" label-width="120px" required>
  24. <uni-easyinput :inputBorder="false" :disabled='true' v-model="formData.reason" placeholder="" />
  25. </uni-forms-item>
  26. </view>
  27. </uni-forms>
  28. <uni-forms-item label="缴费方式">
  29. <uni-data-checkbox v-model="payType" :localdata="payTypes" @change="changeType" />
  30. </uni-forms-item>
  31. <uni-forms-item label="缴费平台" v-if="payType == 0">
  32. <uni-data-checkbox v-model="payPlatform" :localdata="payPlatforms" @change="changePayType" />
  33. </uni-forms-item>
  34. <div class="payImg" v-if="payType == 0">
  35. <canvas canvas-id="qrcode" v-show="qrShow" style="width: 300rpx;margin: 0 auto;" />
  36. </div>
  37. <div class="payTitle" v-if="payType == 0">{{ payMain }}</div>
  38. <uni-forms-item label="上传证据" name="headImage">
  39. <uni-file-picker ref="files" :auto-upload="false" return-type='object' v-model="fileList"
  40. file-mediatype="all" @select="select" :limit='1' />
  41. </uni-forms-item>
  42. <button type="primary" @click="submitPay">确认提交</button>
  43. </view>
  44. </template>
  45. <script>
  46. import {
  47. selectById
  48. } from '../../../api/handlecase/index.js'
  49. import {
  50. casePay,
  51. confirmPayment
  52. } from '../../../api/pay/index.js'
  53. import moment from 'moment'
  54. import uQRCode from '../../common/uqrcode.js'
  55. import {
  56. getToken
  57. } from '@/utils/auth'
  58. import config from '@/config'
  59. const baseUrl = config.baseUrlTJ
  60. const app = getApp()
  61. export default {
  62. data() {
  63. return {
  64. formData: {},
  65. selectFlag: false,
  66. rules: {},
  67. payPlatforms: [{
  68. text: '微信',
  69. value: 0
  70. }, {
  71. text: '支付宝',
  72. value: 1
  73. }, ],
  74. payPlatform: null,
  75. payType: 1,
  76. payTypes: [{
  77. text: '线上缴费',
  78. value: 0
  79. }, {
  80. text: '线下缴费',
  81. value: 1
  82. }, ],
  83. payMain: '',
  84. qrShow: false,
  85. tempFilePaths: null,
  86. fileList: {},
  87. submitForm: {
  88. payType: 1,
  89. payOrderList: [],
  90. caseId: null
  91. },
  92. dataType:{},
  93. formDataVal:{}
  94. }
  95. },
  96. methods: {
  97. /**获取案件缴费信息*/
  98. getData(parms) {
  99. selectById(parms).then(res => {
  100. this.formData = res.data
  101. if(this.dataType.type==4){
  102. this.formDataVal ={
  103. annexType: 4,
  104. id: this.formData.id
  105. }
  106. }else if(this.dataType.type==9){
  107. this.formDataVal ={
  108. annexType: 9,
  109. id: this.formData.id
  110. }
  111. }
  112. })
  113. },
  114. /**生成二维码*/
  115. qrcode(url) {
  116. this.qrShow = true
  117. uQRCode.make({
  118. canvasId: 'qrcode',
  119. componentInstance: this,
  120. text: url,
  121. size: 150,
  122. margin: 0,
  123. backgroundColor: '#ffffff',
  124. foregroundColor: '#000000',
  125. fileType: 'jpg',
  126. errorCorrectLevel: uQRCode.errorCorrectLevel.H,
  127. success: res => {}
  128. })
  129. },
  130. /**选择缴费方式*/
  131. changeType(val) {
  132. this.submitForm.payType = val.detail.value;
  133. },
  134. /**文件上传*/
  135. select(e) {
  136. this.submitForm.payOrderList = [];
  137. this.tempFilePaths = e.tempFilePaths;
  138. // loading
  139. uni.showLoading({
  140. title: '上传中'
  141. });
  142. uni.uploadFile({
  143. url: baseUrl + '/common/upload',
  144. filePath: this.tempFilePaths[0],
  145. header: {
  146. Authorization: getToken() || '',
  147. },
  148. formData:this.formDataVal,
  149. name: 'file',
  150. success: (res) => {
  151. let {
  152. data
  153. } = res
  154. data = JSON.parse(data);
  155. this.submitForm.payOrderList.push({
  156. annexId: data.annexId,
  157. annexName: data.fileName
  158. });
  159. // console.log(this.submitForm, "OOOOOOOOOOOOOOOOOOOOOOOOO");
  160. uni.showToast({
  161. title: '上传成功',
  162. icon: 'none',
  163. duration: 1000
  164. })
  165. uni.hideLoading();
  166. },
  167. fail: (err) => {
  168. uni.showToast({
  169. title: '上传失败',
  170. icon: 'none',
  171. duration: 1000
  172. })
  173. uni.hideLoading()
  174. }
  175. })
  176. },
  177. /**选择缴费平台*/
  178. changePayType(val) {
  179. if (this.formData.feePayable == 0 || !this.formData.feePayable) {
  180. uni.showToast({
  181. title: '此案件无需缴费',
  182. icon: 'none',
  183. duration: 1000
  184. })
  185. return;
  186. }
  187. let payType = "";
  188. if (val.detail.value == 0) {
  189. payType = "wxpay";
  190. this.payMain = "请使用微信扫二维码支付";
  191. } else if (val.detail.value == 1) {
  192. payType = "alipay";
  193. this.payMain = "请使用支付宝扫二维码支付";
  194. }
  195. casePay({
  196. totalFee: this.formData.feePayable * 100,
  197. caseId: this.formData.id,
  198. tradeType: "native",
  199. platform: payType,
  200. }).then((res) => {
  201. this.qrcode(res.data.code_url);
  202. });
  203. },
  204. confirmPaymentFn(data) {
  205. confirmPayment(data).then(res => {
  206. uni.showToast({
  207. title: '确认成功',
  208. icon: 'none',
  209. duration: 1000
  210. });
  211. uni.navigateBack({
  212. delta: 1
  213. })
  214. })
  215. },
  216. /**确认缴费*/
  217. submitPay() {
  218. if (this.submitForm.payOrderList.length < 1) {
  219. uni.showToast({
  220. title: '请上传缴费凭证',
  221. icon: 'none',
  222. duration: 1000
  223. });
  224. return
  225. }
  226. this.submitForm.caseId = this.formData.id;
  227. this.submitForm.caseFlowId = this.formData.caseFlowId;
  228. this.confirmPaymentFn(this.submitForm);
  229. }
  230. },
  231. onLoad(data) {
  232. this.dataType = data
  233. this.getData({
  234. id: data.id
  235. });
  236. },
  237. }
  238. </script>
  239. <style>
  240. .from {
  241. padding: 20rpx;
  242. }
  243. .payImg,
  244. .payTitle {
  245. width: 100%;
  246. display: flex;
  247. justify-content: center;
  248. align-items: center;
  249. margin-bottom: 20rpx;
  250. }
  251. .select-picker {
  252. display: flex;
  253. box-sizing: border-box;
  254. flex-direction: row;
  255. align-items: center;
  256. border: 1px solid #DCDFE6;
  257. border-radius: 8rpx;
  258. width: 100%;
  259. height: 100%;
  260. padding: 0 24rpx;
  261. font-size: 28rpx;
  262. }
  263. </style>