Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div style="padding-top: 20rpx">
  3. <form-builder-vue :formData="formData" :config="config" @submit="submit" @sendText="sendText">
  4. </form-builder-vue>
  5. </div>
  6. </template>
  7. <script setup lang='ts'>
  8. import formBuilderVue from '@/components/form-builder/form-builder-vue3'
  9. import {
  10. ref,
  11. reactive
  12. } from 'vue'
  13. import {
  14. getPlateColorText
  15. } from '../../static/data/typeData.js'
  16. import {
  17. request
  18. } from '../../static/js/network/request'
  19. import {
  20. TypeData,
  21. Index
  22. } from '@/components/form-builder/tools'
  23. import {
  24. onLoad
  25. } from '@dcloudio/uni-app';
  26. import {
  27. storageKey
  28. } from '../../static/data/storageKey.js'
  29. import {
  30. BankTypeEnum
  31. } from '../../static/data/enums.js'
  32. let config = ({
  33. submitName: '快捷支付签约',
  34. titleWidth: 160
  35. })
  36. let formData = reactive([]);
  37. let szjhindex = '';
  38. let smsCodeSeq = '';
  39. let signId = ''
  40. let vehiclePlateColor = uni.getStorageSync(storageKey.vehicleColour);
  41. let signChannel = uni.getStorageSync(storageKey.signChannel);
  42. if (signChannel.channelCode == BankTypeEnum.MSB.code) {//民生
  43. var signObj = [{
  44. 'title': '车牌号',
  45. 'type': 2,
  46. 'value': 'vehiclePlate',
  47. 'required': true,
  48. 'disabled': true,
  49. 'vehiclePlate': uni.getStorageSync(storageKey.vehicle),
  50. },
  51. {
  52. 'title': '车牌颜色',
  53. 'type': 2,
  54. 'value': 'vehiclePlateColorStr',
  55. 'required': true,
  56. 'disabled': true,
  57. }];
  58. formData = formData.concat(signObj);
  59. getPlateColorText(uni.getStorageSync(storageKey.vehicleColour), (res: any) => {
  60. let vehiclePlateColorIdx = Index('车牌颜色', formData);
  61. formData[vehiclePlateColorIdx][formData[vehiclePlateColorIdx].value] = res;
  62. vehiclePlateColor = uni.getStorageSync(storageKey.vehicleColour);
  63. })
  64. } else if (signChannel.channelCode == BankTypeEnum.SZCB.code) {//交行
  65. let signObj = [{
  66. 'title': '手机号',
  67. 'type': 2,
  68. 'value': 'tel',
  69. 'required': true,
  70. 'disabled': true
  71. },
  72. {
  73. 'title': '短信验证码',
  74. 'type': 11,
  75. 'value': 'smsCode',
  76. 'required': true,
  77. 'hint': '请输入短信验证码'
  78. }
  79. ];
  80. formData = formData.concat(signObj);
  81. szjhindex = Index('手机号', formData);
  82. }
  83. onLoad((res) => {
  84. signId = res.signId
  85. if (signChannel.channelCode != BankTypeEnum.MSB.code) {//不是民生需要发送短信
  86. formData[szjhindex][formData[szjhindex].value] = res.tel;
  87. // formData[szjhindex][formData[szjhindex].value] = res.tel.replace(/(\d{3})\d*(\d{4})/, '$1****$2')
  88. }
  89. })
  90. //发送短信
  91. function sendText(e: any, item: TypeData) {
  92. if (!formData[szjhindex][formData[szjhindex].value]) {
  93. uni.showToast({
  94. title: '手机号不能为空',
  95. icon: 'none',
  96. duration: 2000
  97. });
  98. return
  99. }
  100. //发送短信
  101. request('IF01001202209060889', {
  102. data: {
  103. signId: signId,
  104. tel: formData[szjhindex][formData[szjhindex].value],
  105. }
  106. }).then((res) => {
  107. smsCodeSeq = res.rd.data.smsCodeSeq
  108. })
  109. }
  110. function submit(item: any) {
  111. console.log('提交内容', item);
  112. if(signChannel.channelCode == BankTypeEnum.SZCB.code) {//不是民生银行
  113. if (!smsCodeSeq) {
  114. uni.showToast({
  115. title: '请先获取短信验证码',
  116. })
  117. return
  118. }
  119. item.smsCodeSeq = smsCodeSeq
  120. }
  121. item.signId = signId
  122. item.vehiclePlateColor = vehiclePlateColor;
  123. //快捷支付签约
  124. request('IF01001202209060890', {
  125. data: item
  126. }).then((res) => {
  127. if(signChannel.channelCode == BankTypeEnum.SZCB.code) {//深圳交通银行
  128. //添加车辆信息
  129. uni.navigateTo({
  130. url: '/pages/drivingLicense/drivingLicense?userIdType=' + uni.getStorageSync(storageKey
  131. .userIdType) + '&userIdNum=' + uni.getStorageSync(storageKey.userIdNum),
  132. animationType: 'pop-in',
  133. animationDuration: 500
  134. })
  135. } else if (signChannel.channelCode == BankTypeEnum.MSB.code) {//民生银行
  136. //前往代扣签约界面
  137. uni.navigateTo({
  138. url: '/pages/sigManage/sigWithhold?signId=' + signId + '&tel=' + item.tel,
  139. animationType: 'pop-in',
  140. animationDuration: 500
  141. })
  142. }
  143. }).catch((err)=>{
  144. console.log(err);
  145. let errData = err;
  146. if(errData.rm && errData.rm.indexOf("已快捷支付签约,请勿重复操作") != -1) {
  147. if(signChannel.channelCode == BankTypeEnum.SZCB.code) {//深圳交通银行
  148. //添加车辆信息
  149. uni.navigateTo({
  150. url: '/pages/drivingLicense/drivingLicense?userIdType=' + uni.getStorageSync(storageKey
  151. .userIdType) + '&userIdNum=' + uni.getStorageSync(storageKey.userIdNum),
  152. animationType: 'pop-in',
  153. animationDuration: 500
  154. })
  155. } else if (signChannel.channelCode == BankTypeEnum.MSB.code) {//民生银行
  156. //前往代扣签约界面
  157. uni.navigateTo({
  158. url: '/pages/sigManage/sigWithhold?signId=' + signId + '&tel=' + item.tel,
  159. animationType: 'pop-in',
  160. animationDuration: 500
  161. })
  162. }
  163. }
  164. })
  165. }
  166. </script>
  167. <style lang='scss' scoped>
  168. </style>