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.

299 lines
7.4 KiB

4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
3 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
3 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
  1. <template>
  2. <view class="content ">
  3. <view class="stepTop">
  4. <view class="steps flex-b">
  5. <view class="proress" :style="{width: proressWith}"></view>
  6. <view class="step">
  7. <view class="num active" >01<view class="text">房屋信息1</view></view>
  8. </view>
  9. <view class="step">
  10. <view class="num" :class="{active: currentStep}">02<view class="text">个人资料</view></view>
  11. </view>
  12. <view class="step">
  13. <view class="num" :class="{active: currentStep==2}">03<view class="text">认证成功</view></view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="line"></view>
  18. <view class="padding" >
  19. <view class="step1" v-if="currentStep==0">
  20. <view class="h1">请选择您的房屋地址</view>
  21. <view class="lab">房屋信息</view>
  22. <view class="row flex-b">
  23. <view class="lable">详细地址</view>
  24. <view class="flex" @click="$goPage('/pages/subPage/authentication/comp/select1')">
  25. <view class="adrs" v-if="counterStore.chooseHouse.houseId">{{ houseStr }}</view>
  26. <view class="adrs" v-else>请选择</view>
  27. <u-icon name="arrow-right" color="#CCCCCC"></u-icon>
  28. </view>
  29. </view>
  30. <view class="ownership" @click="chooseImages">
  31. <view class="photo">
  32. <image :src="counterStore.chooseHouse.roomCertificateImg" mode="widthFix" v-if="counterStore.chooseHouse.roomCertificateImg"></image>
  33. <image src="@/static/images/phoneH.png" mode="widthFix" v-else></image>
  34. </view>
  35. <view class="txt">房屋所有权证照片</view>
  36. </view>
  37. <view class="btnBox">
  38. <oneBtn text="下一步" :disabled="!counterStore.chooseHouse.houseId" @oneBtnClick="nextStep(1)"></oneBtn>
  39. </view>
  40. </view>
  41. <view class="step2" v-if="currentStep==1">
  42. <view class="btnBox">
  43. <oneBtn text="点击开始实名认证" @oneBtnClick="nextStep(2)"></oneBtn>
  44. </view>
  45. </view>
  46. <view class="step3" v-if="currentStep==2">
  47. <view class="okIcon">
  48. <image src="@/static/images/okIcon.png" mode=""></image>
  49. </view>
  50. <view class="oktext">认证成功</view>
  51. <view class="btnBox">
  52. <oneBtn text="返回首页" @oneBtnClick="nextStep(3)"></oneBtn>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script setup>
  59. import { uploadImgApi } from '@/utils/utils.js'
  60. import { startEid } from '@/mp_ecard_sdk/main';
  61. import { getFacetoken, getFaceResult, houseRoomBind } from '@/config/api.js'
  62. import {userStore} from '@/store/index.js';
  63. const counterStore = userStore();
  64. import { ref, computed } from 'vue'
  65. const currentStep = ref(0)
  66. const proressWith = computed(() => {
  67. if(currentStep.value==1) return '290rpx'
  68. if(currentStep.value==2) return '100%'
  69. return 0
  70. })
  71. const houseStr = computed(() => {
  72. let item = counterStore.chooseHouse
  73. if(!item.houseId) return ''
  74. let str = item.communityName +' - '+ item.houseTypeName +' - '+ item.roomNum
  75. return str
  76. })
  77. function nextStep(num) {
  78. // 第一步如果没有选择房子是不能走第二步的
  79. if(num==0&&!counterStore.chooseHouse.houseId) return
  80. if(num==1) currentStep.value = num
  81. if(num==2) {
  82. getpersonfaceFn()
  83. }
  84. if(num==3) {
  85. counterStore.chooseHouse = {
  86. "roomNum": "",
  87. "houseType": '',
  88. "houseTypeName": '',
  89. "communityId": '',
  90. "communityName": '',
  91. "userName": 0,
  92. "idNo": "",
  93. "houseId": '',
  94. }
  95. uni.switchTab({
  96. url: '/pages/tabbar/index/index'
  97. })
  98. }
  99. }
  100. async function getpersonfaceFn() {
  101. // {MerchantId: '0NSJ2407181630565100'}
  102. // let obj = {
  103. // }
  104. const {data: res} = await getFacetoken()
  105. console.log('获取到token了,很好')
  106. console.log(res)
  107. console.log(res.eidToken)
  108. goSDK(res.eidToken)
  109. }
  110. async function GetDetectInfoEnhancedFn(EidToken) {
  111. // userId: counterStore.loginInfo.userId, InfoType: 1
  112. const {data: res} = await getFaceResult({token: EidToken, })
  113. console.log('返回的结果信息')
  114. console.log(res)
  115. counterStore.upDateHouse('idNo', res.idCard)
  116. counterStore.upDateHouse('userName', res.name)
  117. counterStore.upDateUseInfo('idCard', res.idCard)
  118. counterStore.upDateUseInfo('name', res.name)
  119. houseRoomBindFn()
  120. }
  121. // 绑定房子
  122. async function houseRoomBindFn() {
  123. const {data: res} = await houseRoomBind(counterStore.chooseHouse)
  124. console.log(res)
  125. currentStep.value = 2
  126. uni.hideLoading()
  127. }
  128. // 示例方法
  129. function goSDK(token) {
  130. startEid({
  131. data: {
  132. token,
  133. },
  134. verifyDoneCallback(res) {
  135. const { token, verifyDone } = res;
  136. console.log('收到核身完成的res:', res);
  137. console.log('核身的token是:', token);
  138. uni.showLoading({
  139. title: '正在加载,请稍后……'
  140. })
  141. GetDetectInfoEnhancedFn(token)
  142. console.log('是否完成核身:', verifyDone);
  143. },
  144. });
  145. }
  146. //选择图片
  147. function chooseImages() {
  148. uni.chooseImage({
  149. count: 1, //允许选择的数量
  150. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  151. sourceType: ['album', 'camera'], //从相册选择
  152. success: async (res) => {
  153. uni.showLoading({
  154. title: '图片上传中...'
  155. });
  156. console.log(res)
  157. console.log('图片信息')
  158. const imgLink = await uploadImgApi(res.tempFilePaths[0], 'roomCertificateImg')
  159. console.log(imgLink)
  160. counterStore.upDateHouse('roomCertificateImg', imgLink)
  161. }
  162. })
  163. }
  164. </script>
  165. <style lang="scss" scoped>
  166. image {
  167. display: block;
  168. width: 100%;
  169. height: 100%;
  170. }
  171. .content {
  172. .btnBox {
  173. margin-top: 60rpx;
  174. }
  175. .line {
  176. width: 100%;
  177. height: 20rpx;
  178. background: #EFEFEF;
  179. }
  180. .step1 {
  181. padding: 20rpx 0;
  182. font-size: 28rpx;
  183. color: #343434;
  184. .lab {
  185. padding: 30rpx 0 10rpx 0;
  186. }
  187. .row {
  188. height: 96rpx;
  189. border-bottom: 1px solid #EFEFEF;
  190. .adrs {
  191. color: $themC;
  192. margin-right: 6rpx;
  193. }
  194. }
  195. .ownership {
  196. padding: 30rpx 0 10rpx 0;
  197. .photo {
  198. width: 392rpx;
  199. // height: 252rpx;
  200. margin: 0 auto;
  201. }
  202. .txt {
  203. font-size: 28rpx;
  204. color: #999;
  205. text-align: center;
  206. margin-top: 20rpx;
  207. }
  208. }
  209. }
  210. .step3 {
  211. padding: 40rpx 0;
  212. display: flex;
  213. flex-direction: column;
  214. justify-content: center;
  215. align-items: center;
  216. .okIcon {
  217. width: 303rpx;
  218. height: 164rpx;
  219. }
  220. .oktext {
  221. font-size: 36rpx;
  222. color: #343434;
  223. margin-top: 20rpx;
  224. }
  225. .btnBox {
  226. width: 100%;
  227. }
  228. }
  229. .stepTop {
  230. padding: 20rpx 20rpx 50rpx 20rpx;
  231. }
  232. .steps {
  233. width: 528rpx;
  234. height: 50rpx;
  235. background: #EFEFEF;
  236. border-radius: 25rpx;
  237. position: relative;
  238. margin: 20rpx auto 40rpx auto;
  239. .proress {
  240. position: absolute;
  241. left: 0;
  242. top: 0;
  243. height: 100%;
  244. width: 290rpx;
  245. background: linear-gradient(90deg, rgba(222,58,38,0.1) 0%, #DE3A26 100%);
  246. border-radius: 25rpx;
  247. }
  248. .step {
  249. .num {
  250. width: 44rpx;
  251. height: 44rpx;
  252. background: #FFFFFF;
  253. border-radius: 50%;
  254. font-size: 24rpx;
  255. color: #9C9C9C;
  256. line-height: 44rpx;
  257. text-align: center;
  258. position: relative;
  259. &.active {
  260. border: 1px solid $themC;
  261. color: $themC;
  262. .text {
  263. color: #333;
  264. }
  265. }
  266. .text {
  267. position: absolute;
  268. bottom: -60rpx;
  269. left: -26rpx;
  270. font-size: 24rpx;
  271. white-space: nowrap;
  272. }
  273. }
  274. }
  275. }
  276. }
  277. </style>