payList.vue 6.9KB

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