You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <div style="padding-top: 20rpx">
  3. <form-builder-vue :formData="formData" :config="config" @uploadImg="uploadImg" @submit="submit"
  4. @sendText="sendText" @bindPickerChange = "bindPickerChange" @handleGetRegion = "handleGetRegion">
  5. </form-builder-vue>
  6. </div>
  7. </template>
  8. <script setup lang='ts'>
  9. import formBuilderVue from '@/components/form-builder/form-builder-vue3'
  10. import {
  11. TypeData,
  12. Index
  13. } from '@/components/form-builder/tools'
  14. import {
  15. ref,
  16. reactive
  17. } from 'vue'
  18. import {
  19. request
  20. } from '../../static/js/network/request'
  21. import {
  22. getOccupationNumber
  23. } from '../../static/data/typeData.js'
  24. // 引入
  25. import {
  26. onLoad
  27. } from '@dcloudio/uni-app';
  28. import {
  29. storageKey
  30. } from '../../static/data/storageKey.js'
  31. import {
  32. BankTypeEnum
  33. } from '../../static/data/enums.js'
  34. /**
  35. * 简单签约流程
  36. * 1.查询用户信息
  37. * 2.上传影响资料(用户信息带入过来)
  38. * 3.人脸识别
  39. * 4.开户
  40. * 5.快捷支付签约
  41. * 6.代扣签约
  42. */
  43. let signId = ''
  44. let uploadImageTradeNo = '' //影像件流水号
  45. let uploadLivingTradeNo = '' //活体识别流水号
  46. let smsCodeSeq = '' //短信序列号民生时必填
  47. let provinceCode = '' //"省编码" 民生时必填
  48. let cityCode = '' //市编码 民生时必填
  49. let countyCode = '' //区县编码 民生时必填
  50. let config = ({
  51. submitName: '开户',
  52. titleWidth: 160
  53. })
  54. let paramArr = [{
  55. 'title': '居住地址',
  56. 'type': 10,
  57. 'vertical': 1,
  58. 'value': 'areaName,cityName,district',
  59. 'required': true,
  60. }, {
  61. 'title': '职业编码',
  62. 'type': 4,
  63. 'value': 'workCode',
  64. 'required': true,
  65. 'name': 'professionCode',
  66. 'itemKey': 'professionName',
  67. 'itemData': []
  68. }, {
  69. 'title': '网点号',
  70. 'type': 2,
  71. 'value': 'signNet'
  72. }, {
  73. 'title': '一类银行卡号',
  74. 'type': 2,
  75. 'value': 'bankCardNo',
  76. 'required': true
  77. },
  78. {
  79. 'title': '开户手机号',
  80. 'type': 2,
  81. 'value': 'tel',
  82. 'required': true
  83. },
  84. {
  85. 'title': '短信验证码',
  86. 'type': 11,
  87. 'value': 'mobileCode',
  88. 'required': true,
  89. 'hint': '请输入短信验证码',
  90. 'maxlength': 6,
  91. }
  92. ];
  93. let formData = reactive(paramArr);
  94. let signChannel = uni.getStorageSync(storageKey.signChannel);
  95. if (signChannel.channelCode == BankTypeEnum.MSB.code) {
  96. let company = {
  97. 'title': '公司名称',
  98. 'type': 2,
  99. 'inputType': 'text',
  100. 'value': 'company',
  101. 'hint': '请输入公司名称',
  102. 'required': true,
  103. 'maxlength': 50
  104. };
  105. formData.splice(2,0,company);
  106. } else if (signChannel.channelCode == BankTypeEnum.SZCB.code) {
  107. let userImageUrl = {
  108. 'title': '人脸识别照片',
  109. 'type': 8,
  110. 'vertical': 2,
  111. 'required': true,
  112. 'placeholderImg1': '../../static/image/renlianzhao.png',
  113. 'placeholderImg2': null,
  114. 'inputType': 999, //(ocr识别)
  115. 'value': 'userImageUrl',
  116. 'style': 'width: 45%;',
  117. 'hint1': '人脸照',
  118. 'hint': '注意事项:且上传有效证件照且图片大小不超过2M'
  119. };
  120. formData.splice(0,0,userImageUrl);
  121. }
  122. let index = Index('开户手机号', formData);
  123. formData[index][formData[index].value] = uni.getStorageSync('operatorId');
  124. onLoad((res) => {
  125. console.log('输出内容123', uni.getStorageSync(storageKey.userInfo), res)
  126. let userInfo = JSON.parse(uni.getStorageSync(storageKey.userInfo));
  127. signId = res.signId
  128. //查询账户
  129. request('IF01001202209060888', {
  130. data: {
  131. signId: signId
  132. },
  133. showTitle: '查询账户信息'
  134. }).then((res) => {
  135. console.log('页面回调内容', res.rd.data)
  136. let item = res.rd.data
  137. userInfo.validDate = userInfo.validEndDate.replaceAll('-', '')
  138. userInfo.gender = getSex(userInfo.userIdNum)
  139. userInfo.signId = signId
  140. if (item.uploadImageTradeNo) {
  141. uploadImageTradeNo = item.uploadImageTradeNo
  142. if(item.bankSignStatus < 6) {
  143. // 未开户_0,开户成功_1,开户失败_2,开户中_3
  144. if(item.bankSignStatus == 5 && item.openAccountStatus == 3) {
  145. //开户中,请稍后重试
  146. uni.showModal({
  147. title: '提示',
  148. content: "正在开户中,请稍后重试",
  149. showCancel:false,
  150. });
  151. return;
  152. } else if (item.bankSignStatus == 5) {
  153. //开户失败,请重新开户
  154. uni.showModal({
  155. title: '提示',
  156. content: "开户失败,请重新开户",
  157. showCancel:false,
  158. });
  159. return;
  160. }
  161. } else {
  162. //去快支付签约
  163. uni.showModal({
  164. title: '提示',
  165. content: "已开户成功,请前往快支付签约",
  166. showCancel:false,
  167. success: function(res) {
  168. if (res.confirm) {
  169. let idx = Index('开户手机号', formData);
  170. let tel = formData[idx][formData[idx].value];
  171. uni.navigateTo({
  172. url: '/pages/sigManage/sigFastPayment?signId=' + signId + '&tel=' + tel,
  173. })
  174. }
  175. }
  176. });
  177. }
  178. } else {
  179. //上传影像资料(银行侧的需要的用户信息)
  180. request('IF01001202209060884', {
  181. data: userInfo,
  182. showTitle: '影像资料上传..'
  183. }).then((res) => {
  184. //获取影响上传流水号
  185. uploadImageTradeNo = res.rd.data.uploadImageTradeNo
  186. })
  187. }
  188. })
  189. })
  190. // 选择省市区
  191. function handleGetRegion (values,item) {
  192. console.log(values);
  193. console.log(item);
  194. provinceCode = values[0].code;
  195. cityCode = values[1].code;
  196. countyCode = values[2].code;
  197. }
  198. // 选择职业
  199. function bindPickerChange (values,item) {
  200. console.log(values);
  201. console.log(item);
  202. if (item.workCode.professionCode == '82') {
  203. // 其他为82,需要手动输入
  204. let occupationRemark = {
  205. 'title': '职业',
  206. 'type': 2,
  207. 'inputType': 'text',
  208. 'value': 'occupationRemark',
  209. 'hint': '请输入职业',
  210. 'required': true,
  211. 'maxlength': 10
  212. };
  213. let index = Index('职业编码', formData) + 1;
  214. formData.splice(index,0,occupationRemark);
  215. } else {
  216. let index = Index('职业', formData);
  217. console.log(index);
  218. if (index > -1) { // 移除找到的指定元素
  219. formData.splice(index, 1); // 移除元素
  220. }
  221. }
  222. }
  223. getOccupationNumber((res: any) => {
  224. formData[Index('职业编码', formData)].itemData = res
  225. })
  226. /**
  227. * @param idCard
  228. */
  229. function getSex(idCard) {
  230. var sexStr = 1; //1男 2女
  231. if (parseInt(idCard.slice(-2, -1)) % 2 == 1) {
  232. sexStr = 1;
  233. } else {
  234. sexStr = 2;
  235. }
  236. return sexStr;
  237. }
  238. //发送短信
  239. function sendText(e: any, item: TypeData) {
  240. //telNo: uni.getStorageSync('operatorId') //手机号
  241. let idx = Index('开户手机号', formData);
  242. request('IF01001202209060886', {
  243. data: {
  244. signId: signId,
  245. tel: formData[idx][formData[idx].value],
  246. }
  247. }).then((res) => {
  248. smsCodeSeq = res.rd.data.smsCodeSeq;//民生银行专有
  249. })
  250. }
  251. //图像文件上传
  252. function uploadImg(data: any, item: TypeData, index: Number) {
  253. console.log('图片文件', data, item, index, '结果长度', Index('姓名', formData))
  254. //人脸识别
  255. if (item.title === '人脸识别照片') {
  256. request('IF01001202209060885', {
  257. data: {
  258. signId: signId,
  259. userImageUrl: item.placeholderImg1
  260. },
  261. showTitle: '人脸识别校验中...'
  262. }).then((res) => {
  263. uploadLivingTradeNo = res.rd.data.uploadLivingTradeNo
  264. })
  265. }
  266. }
  267. function submit(item: any) {
  268. item.signId = signId
  269. item.liveAddress = item.areaName + item.cityName + item.district
  270. item.uploadImageTradeNo = uploadImageTradeNo
  271. item.uploadLivingTradeNo = uploadLivingTradeNo
  272. item.smsCodeSeq = smsCodeSeq;
  273. item.provinceCode = provinceCode;
  274. item.cityCode = cityCode;
  275. item.countyCode = countyCode;
  276. console.log('提交内容', item);
  277. //开户
  278. request('IF01001202209060887', {
  279. data: item
  280. }).then((res) => {
  281. uni.navigateTo({
  282. url: '/pages/sigManage/sigFastPayment?signId=' + signId + '&tel=' + item.tel,
  283. animationType: 'pop-in',
  284. animationDuration: 500
  285. })
  286. })
  287. }
  288. </script>
  289. <style lang='scss' scoped>
  290. </style>