payList.vue 7.1KB

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