authentication_merchant.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <!-- 商家实名认证 -->
  2. <!-- 说明
  3. 商家分为个人认证和企业认证
  4. 商家个人认证:需要上传双面身份证人像面照片或手输姓名/身份账号,状态变为认证中,需要后台审核,变成已认证-个人认证。
  5. 商家企业认证:需要上传双面身份证照片和营业执照,状态为认证中,需要后台审核,变成已认证-企业认证。
  6. 商家个人认证通过后,可以申请升级为企业认证,状态为认证中且不允许申请升级,申请升级为企业认证,需要补传营业执照,状态为认证中,后台审核。
  7. -->
  8. <template>
  9. <view class="loading_text" v-if="loading">加载中...</view>
  10. <view v-else style="padding-bottom: 100upx;" class="main_width">
  11. <view style="">
  12. <view class="mem_text">
  13. *认证通过后不可修改,请谨慎操作
  14. </view>
  15. <view>
  16. <!-- 只在允许编辑状态显示 -->
  17. <view v-if="allow_edit==1&&!is_upgrade" class="form_item">
  18. <view class="rht">选择类型</view>
  19. <radio-group style="margin-right: 30upx;" @change="radio_change">
  20. <label>
  21. <radio color="#2bcfb4" value="0" :checked="type==0" />
  22. <text>个人认证</text>
  23. </label>
  24. <label style="margin-left: 50upx;">
  25. <radio color="#2bcfb4" value="1" :checked="type==1" />
  26. <text>企业认证</text>
  27. </label>
  28. </radio-group>
  29. </view>
  30. <view v-if="!is_upgrade&&sub_data.catalog==0&&sub_data.certif_confirmed==1&&!sub_data.bizlicense_pic"
  31. @click="upgrade" class="confirm" style="width: 300upx;margin: 30upx auto 0;">升级为企业认证
  32. </view>
  33. </view>
  34. <!-- 都显示 -->
  35. <view class="img_box">
  36. <!-- 营业执照照片 -->
  37. <view v-if="type==1" style="padding: 30upx 0;" class="img_box_in">
  38. <image @click="upload_img_cards('license')" style="width: 100upx;height: 100upx;"
  39. :src="serverUrlImg5">
  40. </image>
  41. <view style="color: #000000;font-size: 30upx;margin-top: 10upx;">请上传营业执照</view>
  42. <view v-if="sub_data.company_name" style="margin-top: 20upx;">公司名称:{{sub_data.company_name}}</view>
  43. <view v-if="sub_data.company_idcard">识别码:{{sub_data.company_idcard}}</view>
  44. </view>
  45. <!-- 身份证照片 -->
  46. <view v-if="!is_upgrade" style="padding: 30upx 0;margin-top: 30upx;" class="img_box_in">
  47. <view style="margin-bottom: 30upx;" v-if="allow_edit==1">
  48. <image @click="upload_img_cards('idcard')" style="width: 100upx;height: 100upx;"
  49. :src="serverUrlImg4">
  50. </image>
  51. <view style="color: #000000;font-size: 30upx;margin-top: 10upx;">请上传身份证人像面</view>
  52. </view>
  53. <view @click="change_show_ipt" v-if="!show_ipt"
  54. style="color: #01c6b5;display: flex;align-items: center;margin-top: 40upx;">
  55. <image style="width: 35upx;height: 20upx;margin-right: 20upx;" :src="serverUrlImg6"></image>
  56. 没带身份证?切换至手动输入
  57. </view>
  58. <view v-else style="margin-top: 40upx;">
  59. <view class="ipt_box">
  60. <view class="ipt_item">姓名</view>
  61. <input :disabled="allow_edit==0" class="auth_ipt" v-model="sub_data.lawer_name"
  62. @input="ipt_name" placeholder="身份证姓名" />
  63. </view>
  64. <view style="margin-top: 30upx;" class="ipt_box">
  65. <view class="ipt_item">身份证号</view>
  66. <input :disabled="allow_edit==0" class="auth_ipt" v-model="sub_data.lawer_idcard"
  67. @input="ipt_num" placeholder="身份证号" />
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 只在编辑状态显示 -->
  74. <view v-if="allow_edit==1">
  75. <view class="read main_width2">
  76. <checkbox-group @change="checkboxChange">
  77. <checkbox color="#48ccae" value="1" />
  78. </checkbox-group>
  79. <view style="margin-left: 10upx;">我们将严格按照<navigator url="../login/web?index=6"
  80. style="color: rgb(0, 199, 178);display: inline-block;">《用户协议》</navigator>和<navigator
  81. url="../login/web?index=7" style="color: rgb(0, 199, 178);display: inline-block;">《隐私政策》
  82. </navigator>
  83. <view>
  84. 保障您的信息安全
  85. </view>
  86. </view>
  87. </view>
  88. <view @click="sub" style="margin-top: 60upx;" class="main_btn_m">确定</view>
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. import commonData from '../../commonData.js'
  94. import commonFun from '../../commonFun.js'
  95. export default {
  96. data() {
  97. return {
  98. serverUrlImg4: this.serverUrl + 'show/camera.png',
  99. serverUrlImg5: this.serverUrl + 'show/camera_lis.png',
  100. serverUrlImg6: this.serverUrl + 'show/auth_change.png',
  101. allow_edit: 0, //是否允许编辑
  102. is_agree: [], //是否同意协议
  103. sub_data: {}, //提交信息
  104. type: 0, //认证类型:0-个人商家;1-企业商家
  105. loading: true,
  106. is_upgrade: false, //是否正在升级为企业认证操作
  107. show_ipt: false,
  108. }
  109. },
  110. onLoad(e) {
  111. this.get_info()
  112. },
  113. onPullDownRefresh() {
  114. this.get_info()
  115. },
  116. methods: {
  117. change_show_ipt() {
  118. this.show_ipt = true
  119. },
  120. // 升级为企业认证
  121. upgrade() {
  122. this.type = 1
  123. this.allow_edit = 1
  124. this.is_upgrade = true
  125. },
  126. // 获取个人信息
  127. get_info() {
  128. this.loading = true
  129. uni.showLoading({
  130. title: '加载中...',
  131. mask: true,
  132. })
  133. commonFun.get_user_info(res => {
  134. let title = '' //设置当前页面标题
  135. if (res.status) {
  136. uni.hideLoading()
  137. this.sub_data = res.data.Result
  138. console.log(this.sub_data)
  139. //sub_data参数说明:catalog未认证类型,0个人商家,1企业商家
  140. // certif_confirmed代表是否处于认证审核中,0是审核中,1是个人认证审核通过,2是企业认证审核通过
  141. // 如果个人认证审核通过,升级为企业认证的审核中,则catalog为0,certif_confirmed为1,bizlicense_pic不为空
  142. this.type = this.sub_data.catalog || 0
  143. if (!this.sub_data.lawer_idcard) {
  144. title = '未认证'
  145. this.allow_edit = 1
  146. } else if (this.sub_data.certif_confirmed == 0) {
  147. title = this.sub_data.catalog == 0 ? '个人商家认证中' : '企业商家认证中'
  148. this.sub_data = commonFun.formate_name_card(res.data.Result)
  149. this.show_ipt = true
  150. } else if (this.sub_data.certif_confirmed == 1 && this.sub_data.catalog == 0) {
  151. if (this.sub_data.bizlicense_pic) {
  152. title = '升级为企业认证中'
  153. this.type = 1
  154. this.sub_data = commonFun.formate_name_card(res.data.Result)
  155. } else {
  156. title = '个人商家已认证'
  157. this.sub_data = commonFun.formate_name_card(res.data.Result)
  158. }
  159. this.show_ipt = true
  160. } else if (this.sub_data.certif_confirmed == 2 && this.sub_data.catalog == 1) {
  161. title = '企业商家已认证'
  162. this.sub_data = commonFun.formate_name_card(res.data.Result)
  163. this.show_ipt = true
  164. }
  165. uni.setNavigationBarTitle({
  166. title
  167. })
  168. console.log('实名认证页面获取个人信息')
  169. console.log(this.sub_data)
  170. }
  171. uni.stopPullDownRefresh()
  172. this.loading = false
  173. })
  174. },
  175. // 选中同意协议
  176. checkboxChange(e) {
  177. this.is_agree = e.detail.value
  178. },
  179. // 选择认证类型
  180. radio_change(e) {
  181. this.type = e.target.value
  182. },
  183. // 输入姓名
  184. ipt_name(e) {
  185. let sub_data = {
  186. ...this.sub_data
  187. }
  188. sub_data['lawer_name'] = e.target.value
  189. this.sub_data = sub_data
  190. },
  191. // 输入身份证号
  192. ipt_num(e) {
  193. let sub_data = {
  194. ...this.sub_data
  195. }
  196. sub_data['lawer_idcard'] = e.target.value
  197. this.sub_data = sub_data
  198. },
  199. // 上传身份证人像面或营业执照
  200. upload_img_cards(type) {
  201. let is_idcard = type == 'idcard'
  202. if (!this.allow_edit) {
  203. return
  204. }
  205. commonFun.uploadFileApiOSS(res => {
  206. if (res.status) {
  207. uni.showLoading({
  208. title: '加载中...',
  209. mask: true
  210. })
  211. let ImageUrl = res.data
  212. let params = {
  213. ocrParams: {
  214. ImageUrl,
  215. CardSide: 'FRONT'
  216. },
  217. bizCatalog: 'TXCLOUD_OCR',
  218. handleMode: is_idcard ? 'IDCardOCR' : 'BizLicenseOCR',
  219. }
  220. // console.log('上传身份证人像面或营业执照请求参数')
  221. // console.log(params)
  222. commonFun.requestUrl('&WsAjaxBiz=Trader&WsAjaxAction=entityDataHandle', params, res => {
  223. // console.log('上传身份证人像面或营业执照返回数据')
  224. // console.log(res)
  225. if (res.status) {
  226. uni.hideLoading()
  227. let sub_data = {
  228. ...this.sub_data
  229. }
  230. if (is_idcard) {
  231. sub_data.lawer_idcard_npic = ImageUrl
  232. sub_data.lawer_name = res.data.Result.Name
  233. sub_data.lawer_idcard = res.data.Result.IdNum
  234. this.show_ipt = true
  235. } else {
  236. sub_data.bizlicense_pic = ImageUrl
  237. sub_data.company_name = res.data.Result.Name
  238. sub_data.company_idcard = res.data.Result.RegNum
  239. }
  240. this.sub_data = sub_data
  241. uni.showModal({
  242. title: '上传成功',
  243. showCancel: false
  244. })
  245. }
  246. })
  247. }
  248. }, 'image', false)
  249. },
  250. // 点击确定提交
  251. sub() {
  252. if (this.is_agree.length == 0) {
  253. uni.showModal({
  254. content: '请勾选隐私政策',
  255. showCancel: false,
  256. success: function(res) {}
  257. });
  258. return
  259. }
  260. let sub_data = {
  261. ...this.sub_data
  262. }
  263. console.log('实名认证提交的数据')
  264. console.log(sub_data)
  265. if (!sub_data.lawer_name || !sub_data.lawer_idcard) {
  266. uni.showModal({
  267. title: '请上传身份证人像面,或手输姓名和身份证号!',
  268. showCancel: false
  269. })
  270. return
  271. }
  272. if (this.type == 1 && !sub_data.bizlicense_pic) {
  273. uni.showModal({
  274. title: '请上传营业执照照片!',
  275. showCancel: false
  276. })
  277. return
  278. }
  279. uni.showModal({
  280. content: '确认提交后不可修改,请谨慎操作',
  281. success: (res) => {
  282. if (res.confirm) {
  283. uni.showLoading({
  284. title: '加载中...',
  285. mask: true
  286. })
  287. // 校验身份证号和姓名的真实性
  288. commonFun.requestUrl('&WsAjaxBiz=Trader&WsAjaxAction=entityDataHandle', {
  289. bizCatalog: 'TraderEntity',
  290. handleMode: 'idCardCheck',
  291. trueName: sub_data.lawer_name,
  292. idCard: sub_data.lawer_idcard,
  293. },
  294. res => {
  295. if (res.status) {
  296. let params = {
  297. ...sub_data,
  298. catalog: this.is_upgrade ? 0 : this.type,
  299. biz_catalog: 0,
  300. }
  301. console.log('实名认证提交请求')
  302. console.log(params)
  303. commonFun.requestUrl('&WsAjaxBiz=Trader&WsAjaxAction=registerInfo',
  304. params,
  305. res => {
  306. console.log(res)
  307. if (res.status) {
  308. uni.hideLoading()
  309. uni.showModal({
  310. content: '提交成功,待审核',
  311. showCancel: false,
  312. success: res => {
  313. if (res.confirm) {
  314. uni.navigateBack({
  315. delta: 1
  316. });
  317. }
  318. }
  319. })
  320. }
  321. })
  322. }
  323. })
  324. }
  325. }
  326. });
  327. },
  328. }
  329. }
  330. </script>
  331. <style>
  332. .ipt_box {
  333. display: flex;
  334. width: 100%;
  335. align-items: center;
  336. }
  337. .ipt_item {
  338. width: 130upx;
  339. text-align: right;
  340. margin-right: 40upx;
  341. }
  342. .auth_ipt {
  343. background-color: #f5f5f5;
  344. height: 70upx;
  345. width: 450upx;
  346. }
  347. .mem_text {
  348. margin-top: 15upx;
  349. color: #FF0000;
  350. text-align: center;
  351. }
  352. .main_width2 {
  353. width: 96%;
  354. margin-left: 2%;
  355. }
  356. .read {
  357. color: #8E97AE;
  358. margin-top: 200upx;
  359. font-size: 28upx;
  360. display: flex;
  361. flex-direction: row;
  362. justify-content: center;
  363. align-items: center;
  364. }
  365. .up_img {
  366. width: 100%;
  367. }
  368. .img_box {
  369. width: 643upx;
  370. /* height: 350upx; */
  371. margin: 30upx auto 0;
  372. }
  373. .img_box_in {
  374. width: 100%;
  375. height: 100%;
  376. text-align: center;
  377. align-items: center;
  378. justify-content: center;
  379. display: flex;
  380. flex-direction: column;
  381. border: 2upx dotted #E8E8E8;
  382. border-radius: 10upx;
  383. }
  384. </style>