payList.vue 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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="affiliate"
  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="affiliateRes"
  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 v-if="formData.reason">
  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. affiliate:"",
  66. affiliateRes:"",
  67. selectFlag: false,
  68. rules: {},
  69. payPlatforms: [{
  70. text: '微信',
  71. value: 0
  72. }, {
  73. text: '支付宝',
  74. value: 1
  75. }, ],
  76. payPlatform: null,
  77. payType: 1,
  78. payTypes: [{
  79. text: '线上缴费',
  80. value: 0
  81. }, {
  82. text: '线下缴费',
  83. value: 1
  84. }, ],
  85. payMain: '',
  86. qrShow: false,
  87. tempFilePaths: null,
  88. fileList: {},
  89. submitForm: {
  90. payType: 1,
  91. payOrderList: [],
  92. caseId: null
  93. },
  94. dataType:{},
  95. formDataVal:{}
  96. }
  97. },
  98. methods: {
  99. /**获取案件缴费信息*/
  100. getData(parms) {
  101. selectById(parms).then(res => {
  102. this.formData = res.data
  103. this.affiliate = res.data.affiliate.applicant.map(item =>item.applicant.name).join(',')
  104. this.affiliateRes = res.data.affiliate.res.map(item =>item.res.name).join(',')
  105. res.data.affiliate.applicant.forEach((item,index) =>{
  106. if(item.res!=null){
  107. this.affiliateRes = {name:item.res.name}
  108. }
  109. })
  110. if(this.dataType.type==4){
  111. this.formDataVal ={
  112. annexType: 4,
  113. id: this.formData.id
  114. }
  115. }else if(this.dataType.type==9){
  116. this.formDataVal ={
  117. annexType: 9,
  118. id: this.formData.id
  119. }
  120. }
  121. })
  122. },
  123. /**生成二维码*/
  124. qrcode(url) {
  125. this.qrShow = true
  126. uQRCode.make({
  127. canvasId: 'qrcode',
  128. componentInstance: this,
  129. text: url,
  130. size: 150,
  131. margin: 0,
  132. backgroundColor: '#ffffff',
  133. foregroundColor: '#000000',
  134. fileType: 'jpg',
  135. errorCorrectLevel: uQRCode.errorCorrectLevel.H,
  136. success: res => {}
  137. })
  138. },
  139. /**选择缴费方式*/
  140. changeType(val) {
  141. this.submitForm.payType = val.detail.value;
  142. },
  143. /**文件上传*/
  144. select(e) {
  145. this.submitForm.payOrderList = [];
  146. this.tempFilePaths = e.tempFilePaths;
  147. // loading
  148. uni.showLoading({
  149. title: '上传中'
  150. });
  151. uni.uploadFile({
  152. url: baseUrl + '/common/upload',
  153. filePath: this.tempFilePaths[0],
  154. header: {
  155. Authorization: getToken() || '',
  156. },
  157. formData:this.formDataVal,
  158. name: 'file',
  159. success: (res) => {
  160. let {
  161. data
  162. } = res
  163. data = JSON.parse(data);
  164. this.submitForm.payOrderList.push({
  165. annexId: data.annexId,
  166. annexName: data.fileName
  167. });
  168. uni.showToast({
  169. title: '上传成功',
  170. icon: 'none',
  171. duration: 1000
  172. })
  173. uni.hideLoading();
  174. },
  175. fail: (err) => {
  176. uni.showToast({
  177. title: '上传失败',
  178. icon: 'none',
  179. duration: 1000
  180. })
  181. uni.hideLoading()
  182. }
  183. })
  184. },
  185. /**选择缴费平台*/
  186. changePayType(val) {
  187. if (this.formData.feePayable == 0 || !this.formData.feePayable) {
  188. uni.showToast({
  189. title: '此案件无需缴费',
  190. icon: 'none',
  191. duration: 1000
  192. })
  193. return;
  194. }
  195. let payType = "";
  196. if (val.detail.value == 0) {
  197. payType = "wxpay";
  198. this.payMain = "请使用微信扫二维码支付";
  199. } else if (val.detail.value == 1) {
  200. payType = "alipay";
  201. this.payMain = "请使用支付宝扫二维码支付";
  202. }
  203. casePay({
  204. totalFee: this.formData.feePayable * 100,
  205. caseId: this.formData.id,
  206. tradeType: "native",
  207. platform: payType,
  208. }).then((res) => {
  209. this.qrcode(res.data.code_url);
  210. });
  211. },
  212. confirmPaymentFn(data) {
  213. confirmPayment(data).then(res => {
  214. uni.showToast({
  215. title: '确认成功',
  216. icon: 'none',
  217. duration: 1000
  218. });
  219. uni.navigateBack({
  220. delta: 1
  221. })
  222. })
  223. },
  224. /**确认缴费*/
  225. submitPay() {
  226. if (this.submitForm.payOrderList.length < 1) {
  227. uni.showToast({
  228. title: '请上传缴费凭证',
  229. icon: 'none',
  230. duration: 1000
  231. });
  232. return
  233. }
  234. this.submitForm.caseId = this.formData.id;
  235. this.submitForm.caseFlowId = this.formData.caseFlowId;
  236. this.confirmPaymentFn(this.submitForm);
  237. }
  238. },
  239. onLoad(data) {
  240. this.dataType = data
  241. this.getData({
  242. id: data.id
  243. });
  244. },
  245. }
  246. </script>
  247. <style>
  248. .from {
  249. padding: 20rpx;
  250. }
  251. .payImg,
  252. .payTitle {
  253. width: 100%;
  254. display: flex;
  255. justify-content: center;
  256. align-items: center;
  257. margin-bottom: 20rpx;
  258. }
  259. .select-picker {
  260. display: flex;
  261. box-sizing: border-box;
  262. flex-direction: row;
  263. align-items: center;
  264. border: 1px solid #DCDFE6;
  265. border-radius: 8rpx;
  266. width: 100%;
  267. height: 100%;
  268. padding: 0 24rpx;
  269. font-size: 28rpx;
  270. }
  271. </style>