realAttestation.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view>
  3. <navbar :config="config" backColor="#999999"></navbar>
  4. <view class="box" v-if="type==1">
  5. <view class="item">
  6. <view class="item_lab">真实姓名</view>
  7. <view class="item_inp">
  8. <u-input v-model="form.realName" type="text" placeholder="请输入真实姓名" maxlength="20" clearable />
  9. </view>
  10. </view>
  11. <view class="item">
  12. <view class="item_lab">身份证号码</view>
  13. <view class="item_inp">
  14. <u-input v-model="form.identityCard" type="text" placeholder="请输入身份证号码" maxlength="18" clearable />
  15. </view>
  16. </view>
  17. <view class="agree">
  18. <u-checkbox-group>
  19. <u-checkbox size="28rpx" active-color="#3EBCD0" shape="circle"
  20. v-model="form.checked">我已阅读并同意“宜格服务”<text
  21. @click="goAgreement('realname_auth_protocol')">实名认证协议</text></u-checkbox>
  22. </u-checkbox-group>
  23. </view>
  24. <view class="btnBox">
  25. <u-button type="primary" @click="submit">提交认证</u-button>
  26. </view>
  27. </view>
  28. <view class="box" v-if="type==2">
  29. <view class="item">
  30. <view class="item_lab">真实姓名</view>
  31. <view class="item_val">
  32. {{form.realName}}
  33. </view>
  34. </view>
  35. <view class="item">
  36. <view class="item_lab">证件号码</view>
  37. <view class="item_val">
  38. {{form.identityCard}}
  39. </view>
  40. </view>
  41. <view class="item">
  42. <view class="item_lab">认证时间</view>
  43. <view class="item_val">
  44. {{form.createTime}}
  45. </view>
  46. </view>
  47. <!-- <view class="item">
  48. <view class="item_l">真实姓名</view>
  49. <view class="item_r">
  50. <view class="item_r_text">{{form.realName}}</view>
  51. </view>
  52. </view>
  53. <view class="item">
  54. <view class="item_l">证件号码</view>
  55. <view class="item_r">
  56. <view class="item_r_text">{{form.identityCard}}</view>
  57. </view>
  58. </view>
  59. <view class="item">
  60. <view class="item_l">认证时间</view>
  61. <view class="item_r">
  62. <view class="item_r_text">{{form.createTime}}</view>
  63. </view>
  64. </view> -->
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. import {
  70. certificationAdd,
  71. certificationInfo
  72. } from "@/api/government.js"
  73. export default {
  74. data() {
  75. return {
  76. config: {
  77. back: true, //false是tolbar页面 是则不写
  78. title: '实名认证',
  79. color: '#000',
  80. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  81. // backgroundColor: [0, '#2cba28'],
  82. rightSlot: true,
  83. },
  84. form: {
  85. checked: false,
  86. identityCard: "",
  87. realName: ""
  88. },
  89. param: {},
  90. type: 1
  91. }
  92. },
  93. onLoad(options) {
  94. if (options.type == 2) {
  95. this.type = options.type;
  96. this.getDeatils()
  97. }
  98. },
  99. methods: {
  100. submit() {
  101. if (!this.form.checked) {
  102. uni.showToast({
  103. icon: "none",
  104. title: '请同意认证同意协议!',
  105. duration: 1500
  106. });
  107. return
  108. }
  109. // uni.showLoading({
  110. // title: '加载中',
  111. // mask:true
  112. // });
  113. // certificationAdd(this.form).then(res=>{
  114. // uni.hideLoading();
  115. // this.type=2;
  116. // this.getDeatils()
  117. // uni.showToast({
  118. // title: '提交成功!',
  119. // duration: 1500
  120. // });
  121. // })
  122. this.$yghttp.post('/user/certification/yige-info', this.form).then(res => {
  123. this.param = res.data
  124. this.goWX()
  125. })
  126. },
  127. goWX() {
  128. // plus.share.getServices(
  129. // res => {
  130. // let sweixin = '';
  131. // for (var i = 0; i < res.length; i++) {
  132. // let t = res[i];
  133. // if (t.id == 'weixin') {
  134. // sweixin = t;
  135. // }
  136. // }
  137. // if (sweixin) {
  138. // sweixin.launchMiniProgram({
  139. // // id: 'wx26516822b5ec1be8', // 要跳转小程序的原始ID
  140. // id: "gh_9b86ebba08b0",
  141. // type: 2, // 微信小程序版本类型可取值: 0-正式版; 1-测试版; 2-体验版。 默认值为0。
  142. // path: `pages/identify/face_indentify?name=${this.param.realName}&idCardNumber=${this.param.identityCard}&channel=app`
  143. // },
  144. // // 目标小程序点击返回App后执行的回调,在此接收微信小程序传递的参数
  145. // res2 => {
  146. // console.log(typeof res2, res2)
  147. // // res2是微信小程序传递回来的参数 类型为string 需转化为js对象使用
  148. // let result = JSON.parse(res2)
  149. // console.log(result)
  150. // this.param.verifyResult = result.data;
  151. // this.authentication()
  152. // // 拿到参数后执行你需要的逻辑
  153. // },
  154. // err2 => {
  155. // console.log(err2)
  156. // }
  157. // );
  158. // } else {
  159. // // 没有获取到微信分享服务
  160. // uni.showToast({
  161. // icon: 'none',
  162. // title: '当前环境不支持微信操作!'
  163. // })
  164. // }
  165. // },
  166. // err => {
  167. // // 获取分享服务列表失败
  168. // console.log(err)
  169. // }
  170. // )
  171. this.$openWXminiprogram(this.param , 2,true).then(res => {
  172. console.log(res)
  173. this.param.verifyResult = res.data;
  174. console.log(this.param)
  175. this.authentication()
  176. })
  177. },
  178. // 宜格实名认证
  179. authentication() {
  180. this.$yghttp.post('/user/certification/yige-real-auth', this.param).then(res => {
  181. console.log(res)
  182. this.type = 2;
  183. this.getDeatils()
  184. uni.showToast({
  185. title: '认证成功!',
  186. icon: 'success',
  187. duration: 1000
  188. })
  189. })
  190. },
  191. getDeatils() {
  192. certificationInfo().then(res => {
  193. this.form = res.data
  194. })
  195. },
  196. goAgreement(val) {
  197. uni.navigateTo({
  198. url: "/pages/user/agreement?type=" + val
  199. })
  200. }
  201. }
  202. }
  203. </script>
  204. <style>
  205. page {
  206. background-color: #F8F8F8;
  207. }
  208. </style>
  209. <style lang="scss">
  210. .box {
  211. padding: 0rpx 40rpx;
  212. background: #fff;
  213. border-radius: 20rpx;
  214. margin: 30rpx;
  215. min-height: 88vh;
  216. .item {
  217. padding: 30rpx 0rpx 10rpx 0rpx;
  218. border-bottom: 1rpx solid rgba(239, 239, 239, .6);
  219. .item_lab {
  220. font-size: 32rpx;
  221. margin-bottom: 20rpx;
  222. }
  223. .item_val {
  224. font-weight: 700;
  225. padding: 10rpx 0;
  226. }
  227. .item_inp {
  228. margin-top: 10rpx;
  229. }
  230. }
  231. .agree {
  232. // padding: 0 30rpx;
  233. margin-top: 30rpx;
  234. text {
  235. color: #3EBCD0;
  236. }
  237. /deep/ .u-checkbox__label {
  238. font-size: 24rpx;
  239. color: #3EBCD0;
  240. }
  241. }
  242. }
  243. .btnBox {
  244. width: 100%;
  245. margin-top: 100rpx;
  246. display: flex;
  247. justify-content: center;
  248. }
  249. .u-btn {
  250. width: 90%;
  251. border-radius: 10rpx;
  252. background: rgb(64, 149, 229);
  253. }
  254. .list {
  255. padding: 0rpx 30rpx;
  256. background: #fff;
  257. border-radius: 20rpx;
  258. margin: 30rpx;
  259. min-height: 85vh;
  260. .item {
  261. display: flex;
  262. justify-content: space-between;
  263. align-items: center;
  264. height: 100rpx;
  265. padding: 0 30rpx;
  266. border-bottom: 1rpx solid rgba(239, 239, 239, .6);
  267. .item_l {
  268. font-weight: 700;
  269. }
  270. .item_r {
  271. display: flex;
  272. .item_r_text {
  273. margin-right: 10rpx;
  274. image {
  275. width: 80rpx;
  276. height: 80rpx;
  277. border-radius: 50%;
  278. }
  279. }
  280. }
  281. }
  282. }
  283. .btnBox {
  284. width: 100%;
  285. // display: flex;
  286. // justify-content: center;
  287. margin-top: 150rpx;
  288. }
  289. .u-btn {
  290. width: 534rpx;
  291. border-radius: 10rpx;
  292. background: rgb(64, 149, 229);
  293. font-size: 30rpx;
  294. font-weight: 700;
  295. margin: auto;
  296. font-family: Microsoft YaHei, Microsoft YaHei-Bold;
  297. background: linear-gradient(6deg, #56d9ee 0%, #3ebcd0 100%) #3c66d9;
  298. }
  299. .hoverClass {
  300. background: linear-gradient(6deg, #56d9ee 0%, #3ebcd0 100%) #3c66d9;
  301. }
  302. </style>