binding.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <template>
  2. <view class="register" v-show="isRegisterShow">
  3. <template v-if="isInvalid">
  4. <view class="cart-content empty">
  5. <view class="empty-container">
  6. <image class="empty-container-image" :src="productNoneImage" mode="aspectFit"></image>
  7. <text class="error-text">页面已失效~</text>
  8. </view>
  9. </view>
  10. </template>
  11. <template v-else>
  12. <view class="register-main clearfix" v-if="isUserIdentity == 4">
  13. <view class="main-form-item">
  14. <view class="form-label">联系人</view>
  15. <view class="form-text"> {{ clubInfo.linkMan }} </view>
  16. </view>
  17. <view class="main-form-item">
  18. <view class="form-label">手机号</view>
  19. <view class="form-text">{{ clubInfo.bindMobile }}</view>
  20. </view>
  21. <view class="register-fiexd clearfix" :style="{paddingBottom:isIphoneX ? '68rpx':''}">
  22. <view class="register-agree">
  23. <view class="agree-text">
  24. 提示:服务商已帮您填写好了注册信息,请确认信息是否正确。点击确认并登录按钮将为您自动生成账号进行登录,并绑定您的微信。
  25. </view>
  26. </view>
  27. <view class="register-row">
  28. <view class="register-btn sub" :class="isSubLoading ? 'disabled' : ''" @click.stop="SubmitRegister">确认并登录</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="register-main clearfix" v-if="isUserIdentity == 2">
  33. <view class="main-form-item">
  34. <view class="form-label">联系人</view>
  35. <view class="form-text"> {{ clubInfo.linkMan }} </view>
  36. </view>
  37. <view class="main-form-item">
  38. <view class="form-label">手机号</view>
  39. <view class="form-text">{{ clubInfo.bindMobile }}</view>
  40. </view>
  41. <view class="main-form-item">
  42. <view class="form-label">邮箱</view>
  43. <view class="form-text">{{ clubInfo.contractEmail ? clubInfo.contractEmail : '' }}</view>
  44. </view>
  45. <view class="main-form-item">
  46. <view class="form-label">机构名称</view>
  47. <view class="form-text">{{ clubInfo.name }}</view>
  48. </view>
  49. <view class="main-form-item">
  50. <view class="form-label">机构简称</view>
  51. <view class="form-text">{{ clubInfo.shortName }}</view>
  52. </view>
  53. <view class="main-form-item">
  54. <view class="form-label">机构地址</view>
  55. <view class="form-input">{{ clubInfo.provincialAddress }}</view>
  56. </view>
  57. <view class="main-form-item none">
  58. <view class="form-textarea">{{ clubInfo.address }}</view>
  59. </view>
  60. <view class="main-form-item">
  61. <view class="form-label lang">营业执照编号</view>
  62. <view class="form-input lang">{{ clubInfo.socialCreditCode }}</view>
  63. </view>
  64. <view class="main-form-item file">
  65. <view class="main-form-upload">
  66. <view class="label">营业执照</view>
  67. <view class="upload-picture">
  68. <view class="upload-image"><image :src="clubInfo.businessLicense" mode="" @click="ShowPreviewImage(1)"></image></view>
  69. </view>
  70. </view>
  71. <view class="main-form-upload">
  72. <view class="label">门头照</view>
  73. <view class="upload-picture">
  74. <view class="upload-image"><image :src="clubInfo.shopPhoto" mode="" @click="ShowPreviewImage(2)"></image></view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="main-form-item">
  79. <view class="form-label">机构类型</view>
  80. <view class="form-text">
  81. {{ clubInfo.firstClubType | FirstFormat }}
  82. -
  83. {{ clubInfo.secondClubType | TwoFormat }}
  84. </view>
  85. </view>
  86. <view class="main-form-item file" v-if="clubInfo.firstClubType == 1">
  87. <view class="main-form-upload">
  88. <view class="label">资质</view>
  89. <view class="upload-picture">
  90. <view class="upload-image"><image :src="clubInfo.medicalPracticeLicense" mode="" @click="ShowPreviewImage(2)"></image></view>
  91. </view>
  92. </view>
  93. </view>
  94. <view class="main-form-item" v-if="clubInfo.secondClubType == 2">
  95. <view class="form-label">科室</view>
  96. <view class="form-text">{{ clubInfo.department }}</view>
  97. </view>
  98. <view class="main-form-item none">
  99. <view class="form-label none">主营内容</view>
  100. <view class="form-checkbox-group">
  101. <view class="form-table-item" v-for="(item, index) in medicaCampList" :key="index">
  102. {{ item.name }}
  103. </view>
  104. </view>
  105. </view>
  106. <view class="register-fiexd clearfix" :style="{paddingBottom:isIphoneX ? '68rpx':''}">
  107. <view class="register-agree">
  108. <view class="agree-text">
  109. 提示:服务商已帮您填写好了注册信息,请确认信息是否正确。点击确认并登录按钮将为您自动生成账号进行登录,并绑定您的微信。
  110. </view>
  111. </view>
  112. <view class="register-row">
  113. <view class="register-btn sub" :class="isSubLoading ? 'disabled' : ''" @click.stop="SubmitRegister">确认并登录</view>
  114. </view>
  115. </view>
  116. </view>
  117. </template>
  118. </view>
  119. </template>
  120. <script>
  121. import { mapState,mapMutations } from 'vuex'
  122. import { uploadFileImage } from '@/services/public.js'
  123. import authorize from '@/common/config/authorize.js'
  124. import wxLogin from '@/common/config/wxLogin.js'
  125. export default{
  126. data() {
  127. return{
  128. isRegisterShow:false,
  129. isUserIdentity:0,
  130. isIphoneX:this.$store.state.isIphone,
  131. bindId:0,
  132. medicaCampList:[],
  133. isInvalid:false,
  134. isSubLoading:false,
  135. productNoneImage:'https://static.caimei365.com/app/img/icon/icon-pnone.png',
  136. params:{
  137. organizeId: 0,
  138. userId:0,
  139. mobile:'',
  140. linkName:'',
  141. unionId:0,
  142. isCheckSmsCode:1,
  143. nickName:'',
  144. avatarUrl:'',
  145. },
  146. clubInfo:{
  147. linkMan:'',
  148. bindMobile:'',
  149. userId:0,
  150. isAgreed:1
  151. }
  152. }
  153. },
  154. filters: {
  155. },
  156. onLoad(option) {
  157. console.log('option=========>',this.option)
  158. uni.setStorageSync('bind_id', option.bindId)
  159. this.bindId = Number(option.bindId)
  160. this.isUserIdentity = option.Identity
  161. },
  162. filters: {
  163. FirstFormat:function(type) {//处理金额
  164. let name=''
  165. switch(type){
  166. case 1: name = '医美'; break
  167. case 2: name = '生美'; break
  168. case 3: name = '项目公司'; break
  169. case 4: name = '个人'; break
  170. case 5: name = '其他'; break
  171. }
  172. return name
  173. },
  174. TwoFormat:function(type) {//处理金额
  175. let text=''
  176. switch(type){
  177. case 1: text = '诊所'; break
  178. case 2: text = '门诊'; break
  179. case 3: text = '医院'; break
  180. }
  181. return text
  182. },
  183. },
  184. computed: {
  185. ...mapState(['isWxAuthorize'])
  186. },
  187. methods:{
  188. ...mapMutations(['login','logout','wxLogin']),
  189. async getWxAuthorize(){
  190. const wechatCode = await authorize.getCode('weixin')// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
  191. const getUserInfo = await authorize.getUserInfo('weixin')
  192. this.UserService.UserLoginAuthApplets({
  193. organizeId: 0,
  194. code:wechatCode,
  195. encryptedData:getUserInfo.encryptedData,
  196. iv:getUserInfo.iv ,
  197. })
  198. .then(response =>{
  199. this.login(response.data)
  200. this.$store.commit('updateStatus',response.data)
  201. uni.setStorageSync('token',response.data.token)
  202. uni.setStorageSync('unionId',response.data.unionId)
  203. setTimeout(()=>{
  204. if(response.data.userIdentity === 1){
  205. this.$api.navigateTo('/pages/seller/index/index')
  206. }else if(response.data.userIdentity === 2 || response.data.userIdentity === 4){
  207. this.$api.switchTabTo('/pages/tabBar/user/user')
  208. }else if(response.data.userIdentity === 3){
  209. this.$api.navigateTo('/pages/supplier/index/index')
  210. }else{
  211. this.GetClubUserInfo()
  212. this.isRegisterShow= true
  213. }
  214. },1000)
  215. })
  216. .catch(error =>{
  217. this.logout()
  218. uni.setStorageSync('unionId',error.data.unionId)
  219. this.$store.commit('updateStatus',error.data)
  220. this.GetClubUserInfo()
  221. this.isRegisterShow = true
  222. })
  223. },
  224. GetClubUserInfo(){//查询填写资料
  225. console.log('=========<查询填写资料>===========')
  226. console.log('bindId',this.bindId)
  227. this.UserService.UseRregisterTemporaryInfo({id:this.bindId})
  228. .then(response =>{
  229. this.clubInfo = response.data
  230. this.params.mobile = this.clubInfo.bindMobile
  231. this.params.linkName = this.clubInfo.linkMan
  232. console.log('params=========>',this.params)
  233. if(this.clubInfo.mainProduct){
  234. this.medicaCampList = this.ArrayFormat(this.clubInfo.mainProduct)
  235. }
  236. })
  237. .catch(error =>{
  238. this.isInvalid = true
  239. })
  240. },
  241. SubmitRegister(){//确认并登录绑定微信
  242. if(this.isSubLoading){ return }
  243. this.GetUserProfile()
  244. },
  245. GetUserProfile(){//获取微信用户信息
  246. const self = this
  247. wx.getUserProfile({
  248. desc: '采美采购商城小程序获取您的信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  249. success(res) {
  250. console.log('微信获取用户信息新API',res)
  251. self.wxLogin(res.userInfo)
  252. self.params.nickName = res.userInfo.nickName
  253. self.params.avatarUrl = res.userInfo.avatarUrl
  254. self.params.unionId = uni.getStorageSync('unionId')
  255. self.SellerClubRegister()
  256. },
  257. fail() {
  258. self.isSubLoading = false
  259. self.$util.msg('授权失败', 2000)
  260. }
  261. })
  262. },
  263. SellerClubRegister(){//机构注册
  264. this.SellerService.SellerClubRegister(
  265. {
  266. id:this.bindId
  267. }
  268. )
  269. .then(response =>{
  270. this.params.userId = response.data
  271. setTimeout(()=>{
  272. this.BindingWechat(this.params)
  273. },1000)
  274. })
  275. .catch(error =>{
  276. this.$util.msg(error.msg,2000)
  277. })
  278. },
  279. BindingWechat(params){
  280. this.UserService.BindingWechat(params)
  281. .then(response =>{
  282. this.login(response.data)
  283. this.isSubLoading = false
  284. this.$api.switchTabTo('/pages/tabBar/home/index')
  285. })
  286. .catch(error =>{
  287. this.$util.msg(error.msg,2000)
  288. this.isSubLoading = false
  289. this.isUserInfo = true
  290. })
  291. },
  292. ArrayFormat(Array) {//处理金额
  293. const newArray = []
  294. Array.split('/').forEach((item,index) =>{
  295. let _OBJ = {value:(index+1).toString(),name:item,checked:true}
  296. newArray.push(_OBJ)
  297. })
  298. return newArray
  299. }
  300. },
  301. onShow() {
  302. this.getWxAuthorize()
  303. }
  304. }
  305. </script>
  306. <style lang="scss">
  307. page{
  308. height: auto;
  309. }
  310. .register{
  311. width: 100%;
  312. position: relative;
  313. box-sizing: border-box;
  314. padding-bottom: 350rpx;
  315. .register-main{
  316. width: 100%;
  317. height: auto;
  318. box-sizing: border-box;
  319. padding: 0 24rpx;
  320. margin-top: 24rpx;
  321. .main-form-item{
  322. width: 100%;
  323. height: 88rpx;
  324. box-sizing: border-box;
  325. padding: 13rpx 0;
  326. border-bottom: 1px solid #e1e1e1;
  327. margin-top: 10rpx;
  328. position: relative;
  329. &.none{
  330. border-bottom: none;
  331. height: auto;
  332. }
  333. &.file{
  334. height: 273rpx;
  335. border-bottom: none;
  336. .main-form-upload{
  337. width: 50%;
  338. height: 100%;
  339. float: left;
  340. .label{
  341. width: 100%;
  342. float: left;
  343. height: 56rpx;
  344. line-height: 56rpx;
  345. font-size: $font-size-28;
  346. text-align: left;
  347. color: #999999;
  348. }
  349. .upload-picture{
  350. width: 100%;
  351. height: 180rpx;
  352. float: left;
  353. margin-top: 17rpx;
  354. .upload-none{
  355. width: 200rpx;
  356. height: 180rpx;
  357. border-radius: 6rpx;
  358. border:1px solid #e1e1e1;
  359. box-sizing: border-box;
  360. padding-top: 64rpx;
  361. .icon-jiahao{
  362. display: inline-block;
  363. width: 100%;
  364. text-align: center;
  365. line-height: 48rpx;
  366. font-size: 40rpx;
  367. color: #b2b2b2;
  368. }
  369. .upload-text{
  370. display: inline-block;
  371. width: 100%;
  372. text-align: center;
  373. line-height: 40rpx;
  374. font-size: $font-size-24;
  375. color: #b2b2b2;
  376. }
  377. }
  378. .upload-image{
  379. width: 200rpx;
  380. height: 180rpx;
  381. border-radius: 6rpx;
  382. border:1px solid #e1e1e1;
  383. box-sizing: border-box;
  384. position: relative;
  385. image{
  386. width: 200rpx;
  387. height: 180rpx;
  388. display: block;
  389. }
  390. .upload-del{
  391. width: 40rpx;
  392. height: 40rpx;
  393. position: absolute;
  394. top: -20rpx;
  395. right: -20rpx;
  396. line-height: 40rpx;
  397. text-align: center;
  398. .iconfont{
  399. font-size: $font-size-32;
  400. color: #999999;
  401. }
  402. }
  403. }
  404. }
  405. }
  406. }
  407. &.picker{
  408. border-bottom: none;
  409. .label-radio{
  410. margin-left: 30rpx;
  411. font-size: $font-size-28;
  412. float: left;
  413. }
  414. .row-radio{
  415. float: left;
  416. transform: scale(0.7);
  417. }
  418. .row-text{
  419. text-align: center;
  420. float: left;
  421. font-size: $font-size-28;
  422. }
  423. .picker-radio{
  424. box-sizing: border-box;
  425. padding-left: 180rpx;
  426. .secondTyperadio{
  427. border: 2rpx solid #e1e1e1;
  428. display: inline-block;
  429. font-size: 26rpx;
  430. color: #999999;
  431. padding: 0 24rpx;
  432. border-radius: 22rpx;
  433. line-height: 42rpx;
  434. margin-right: 28rpx;
  435. float: left;
  436. &.active{
  437. border: 2rpx solid #ffe6dc;
  438. color: $color-system;
  439. }
  440. }
  441. }
  442. }
  443. &.textarea{
  444. height: 142rpx;
  445. .textarea{
  446. width: 100%;
  447. height: 142rpx;
  448. box-sizing: border-box;
  449. font-size: $font-size-28;
  450. color: $text-color;
  451. z-index: 1;
  452. }
  453. .textarea.hide{
  454. opacity: 0;
  455. }
  456. .textarea.show{
  457. color: #999999;
  458. }
  459. }
  460. .textarea-ke{
  461. width: 100%;
  462. height: 160rpx;
  463. border-radius: 6rpx;
  464. border: 1px solid #e1e1e1;
  465. font-size: $font-size-28;
  466. box-sizing: border-box;
  467. padding: 15rpx 20rpx;
  468. }
  469. .form-textarea{
  470. font-size: $font-size-28;
  471. color: #333333;
  472. }
  473. .form-label{
  474. width: 148rpx;
  475. float: left;
  476. height: 100%;
  477. line-height: 56rpx;
  478. font-size: $font-size-28;
  479. text-align: left;
  480. color: #999999;
  481. &.lang{
  482. width: 188rpx;
  483. }
  484. &.none{
  485. width: 100%;
  486. }
  487. }
  488. .form-input{
  489. width: 554rpx;
  490. height: 56rpx;
  491. line-height: 56rpx;
  492. font-size: $font-size-28;
  493. text-align: left;
  494. color: #333333;
  495. float: left;
  496. &.lang{
  497. width: 514rpx;
  498. }
  499. &.phone{
  500. width: 418rpx;
  501. }
  502. }
  503. .form-text{
  504. width: 554rpx;
  505. height: 56rpx;
  506. line-height: 56rpx;
  507. font-size: $font-size-28;
  508. text-align: left;
  509. color: #333333;
  510. float: left;
  511. }
  512. .form-btn{
  513. width: 136rpx;
  514. height: 56rpx;
  515. background: $btn-confirm;
  516. color: #FFFFFF;
  517. font-size: $font-size-28;
  518. text-align: center;
  519. border-radius: 28rpx;
  520. line-height: 56rpx;
  521. float: left;
  522. }
  523. .icon-xiayibu{
  524. width: 80rpx;
  525. height: 80rpx;
  526. position: absolute;
  527. right: 0;
  528. top: 0;
  529. line-height: 80rpx;
  530. text-align: center;
  531. color: #b2b2b2;
  532. }
  533. .form-checkbox-group {
  534. width: 100%;
  535. float: left;
  536. .form-table-item{
  537. height: 48rpx;
  538. padding: 0 32rpx;
  539. border: 1px solid #b2b2b2;
  540. text-align: center;
  541. font-size: $font-size-28;
  542. color: #333333;
  543. float: left;
  544. line-height: 48rpx;
  545. border-radius: 26rpx;
  546. margin-right: 12rpx;
  547. margin-top: 20rpx;
  548. }
  549. }
  550. .form-checkbox-input{
  551. width: 100%;
  552. height: 64rpx;
  553. margin-top: 20rpx;
  554. .checkbox-input{
  555. width: 518rpx;
  556. height: 64rpx;
  557. box-sizing: border-box;
  558. text-align: left;
  559. font-size: $font-size-26;
  560. color: #333333;
  561. line-height: 64rpx;
  562. float: left;
  563. border: 1px solid #e1e1e1;
  564. border-radius: 32rpx;
  565. padding: 0 20rpx;
  566. }
  567. .checkbox-btn{
  568. width: 160rpx;
  569. height: 64rpx;
  570. border-radius: 32rpx;
  571. background-color: #ffe6dc;
  572. line-height: 64rpx;
  573. text-align: center;
  574. color: #FF5B00;
  575. font-size: $font-size-28;
  576. float: right;
  577. }
  578. }
  579. }
  580. .register-fiexd{
  581. width: 100%;
  582. height: auto;
  583. padding: 20rpx 0;
  584. position: fixed;
  585. bottom: 0;
  586. left: 0;
  587. z-index: 888;
  588. background: #FFFFFF;
  589. .register-agree{
  590. display: flex;
  591. flex-direction: column;
  592. align-items: center;
  593. margin:0 0 32rpx 0;
  594. box-sizing: border-box;
  595. padding: 0 105rpx;
  596. .agree-text{
  597. font-size: 20rpx;
  598. line-height: 38rpx;
  599. color: #fea785;
  600. }
  601. }
  602. }
  603. .register-btn{
  604. width: 702rpx;
  605. height: 88rpx;
  606. border-radius: 44rpx;
  607. font-size: $font-size-28;
  608. line-height: 88rpx;
  609. color: #FFFFFF;
  610. margin: 0 auto;
  611. text-align: center;
  612. background: $btn-confirm;
  613. margin-top: 96rpx;
  614. &.disabled{
  615. background: #e4e8eb;
  616. color: #999999;
  617. }
  618. &.none{
  619. background: #FFFFFF;
  620. color: $text-color;
  621. margin-top: 0;
  622. }
  623. &.sub{
  624. margin-top: 0;
  625. }
  626. }
  627. }
  628. }
  629. </style>