binding.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  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. userId:0,
  138. mobile:'',
  139. linkName:'',
  140. unionId:0,
  141. isCheckSmsCode:1,
  142. nickName:'',
  143. avatarUrl:'',
  144. },
  145. clubInfo:{
  146. linkMan:'',
  147. bindMobile:'',
  148. userId:0,
  149. isAgreed:1
  150. }
  151. }
  152. },
  153. filters: {
  154. },
  155. onLoad(option) {
  156. console.log('option=========>',this.option)
  157. uni.setStorageSync('bind_id', option.bindId)
  158. this.bindId = Number(option.bindId)
  159. this.isUserIdentity = option.Identity
  160. },
  161. filters: {
  162. FirstFormat:function(type) {//处理金额
  163. let name=''
  164. switch(type){
  165. case 1: name = '医美'; break
  166. case 2: name = '生美'; break
  167. case 3: name = '项目公司'; break
  168. case 4: name = '个人'; break
  169. case 5: name = '其他'; break
  170. }
  171. return name
  172. },
  173. TwoFormat:function(type) {//处理金额
  174. let text=''
  175. switch(type){
  176. case 1: text = '诊所'; break
  177. case 2: text = '门诊'; break
  178. case 3: text = '医院'; break
  179. }
  180. return text
  181. },
  182. },
  183. computed: {
  184. ...mapState(['isWxAuthorize'])
  185. },
  186. methods:{
  187. ...mapMutations(['login','logout','wxLogin']),
  188. async getWxAuthorize(){
  189. const wechatCode = await authorize.getCode('weixin')// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
  190. const getUserInfo = await authorize.getUserInfo('weixin')
  191. this.UserService.UserLoginAuthApplets({
  192. code:wechatCode,
  193. encryptedData:getUserInfo.encryptedData,
  194. iv:getUserInfo.iv ,
  195. })
  196. .then(response =>{
  197. this.login(response.data)
  198. this.$store.commit('updateStatus',response.data)
  199. uni.setStorageSync('token',response.data.token)
  200. uni.setStorageSync('unionId',response.data.unionId)
  201. setTimeout(()=>{
  202. if(response.data.userIdentity === 1){
  203. this.$api.navigateTo('/pages/seller/index/index')
  204. }else if(response.data.userIdentity === 2 || response.data.userIdentity === 4){
  205. this.$api.switchTabTo('/pages/tabBar/user/user')
  206. }else if(response.data.userIdentity === 3){
  207. this.$api.navigateTo('/pages/supplier/index/index')
  208. }else{
  209. this.GetClubUserInfo()
  210. this.isRegisterShow= true
  211. }
  212. },1000)
  213. })
  214. .catch(error =>{
  215. this.logout()
  216. uni.setStorageSync('unionId',error.data.unionId)
  217. this.$store.commit('updateStatus',error.data)
  218. this.GetClubUserInfo()
  219. this.isRegisterShow = true
  220. })
  221. },
  222. GetClubUserInfo(){//查询填写资料
  223. console.log('=========<查询填写资料>===========')
  224. console.log('bindId',this.bindId)
  225. this.UserService.UseRregisterTemporaryInfo({id:this.bindId})
  226. .then(response =>{
  227. this.clubInfo = response.data
  228. this.params.mobile = this.clubInfo.bindMobile
  229. this.params.linkName = this.clubInfo.linkMan
  230. console.log('params=========>',this.params)
  231. if(this.clubInfo.mainProduct){
  232. this.medicaCampList = this.ArrayFormat(this.clubInfo.mainProduct)
  233. }
  234. })
  235. .catch(error =>{
  236. this.isInvalid = true
  237. })
  238. },
  239. SubmitRegister(){//确认并登录绑定微信
  240. if(this.isSubLoading){ return }
  241. this.GetUserProfile()
  242. },
  243. GetUserProfile(){//获取微信用户信息
  244. const self = this
  245. wx.getUserProfile({
  246. desc: '采美采购商城小程序获取您的信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  247. success(res) {
  248. console.log('微信获取用户信息新API',res)
  249. self.wxLogin(res.userInfo)
  250. self.params.nickName = res.userInfo.nickName
  251. self.params.avatarUrl = res.userInfo.avatarUrl
  252. self.params.unionId = uni.getStorageSync('unionId')
  253. self.SellerClubRegister()
  254. },
  255. fail() {
  256. self.isSubLoading = false
  257. self.$util.msg('授权失败', 2000)
  258. }
  259. })
  260. },
  261. SellerClubRegister(){//机构注册
  262. this.SellerService.SellerClubRegister(
  263. {
  264. id:this.bindId
  265. }
  266. )
  267. .then(response =>{
  268. this.params.userId = response.data
  269. setTimeout(()=>{
  270. this.BindingWechat(this.params)
  271. },1000)
  272. })
  273. .catch(error =>{
  274. this.$util.msg(error.msg,2000)
  275. })
  276. },
  277. BindingWechat(params){
  278. this.UserService.BindingWechat(params)
  279. .then(response =>{
  280. this.login(response.data)
  281. this.isSubLoading = false
  282. this.$api.switchTabTo('/pages/tabBar/home/index')
  283. })
  284. .catch(error =>{
  285. this.$util.msg(error.msg,2000)
  286. this.isSubLoading = false
  287. this.isUserInfo = true
  288. })
  289. },
  290. ArrayFormat(Array) {//处理金额
  291. const newArray = []
  292. Array.split('/').forEach((item,index) =>{
  293. let _OBJ = {value:(index+1).toString(),name:item,checked:true}
  294. newArray.push(_OBJ)
  295. })
  296. return newArray
  297. }
  298. },
  299. onShow() {
  300. this.getWxAuthorize()
  301. }
  302. }
  303. </script>
  304. <style lang="scss">
  305. page{
  306. height: auto;
  307. }
  308. .register{
  309. width: 100%;
  310. position: relative;
  311. box-sizing: border-box;
  312. padding-bottom: 350rpx;
  313. .register-main{
  314. width: 100%;
  315. height: auto;
  316. box-sizing: border-box;
  317. padding: 0 24rpx;
  318. margin-top: 24rpx;
  319. .main-form-item{
  320. width: 100%;
  321. height: 88rpx;
  322. box-sizing: border-box;
  323. padding: 13rpx 0;
  324. border-bottom: 1px solid #e1e1e1;
  325. margin-top: 10rpx;
  326. position: relative;
  327. &.none{
  328. border-bottom: none;
  329. height: auto;
  330. }
  331. &.file{
  332. height: 273rpx;
  333. border-bottom: none;
  334. .main-form-upload{
  335. width: 50%;
  336. height: 100%;
  337. float: left;
  338. .label{
  339. width: 100%;
  340. float: left;
  341. height: 56rpx;
  342. line-height: 56rpx;
  343. font-size: $font-size-28;
  344. text-align: left;
  345. color: #999999;
  346. }
  347. .upload-picture{
  348. width: 100%;
  349. height: 180rpx;
  350. float: left;
  351. margin-top: 17rpx;
  352. .upload-none{
  353. width: 200rpx;
  354. height: 180rpx;
  355. border-radius: 6rpx;
  356. border:1px solid #e1e1e1;
  357. box-sizing: border-box;
  358. padding-top: 64rpx;
  359. .icon-jiahao{
  360. display: inline-block;
  361. width: 100%;
  362. text-align: center;
  363. line-height: 48rpx;
  364. font-size: 40rpx;
  365. color: #b2b2b2;
  366. }
  367. .upload-text{
  368. display: inline-block;
  369. width: 100%;
  370. text-align: center;
  371. line-height: 40rpx;
  372. font-size: $font-size-24;
  373. color: #b2b2b2;
  374. }
  375. }
  376. .upload-image{
  377. width: 200rpx;
  378. height: 180rpx;
  379. border-radius: 6rpx;
  380. border:1px solid #e1e1e1;
  381. box-sizing: border-box;
  382. position: relative;
  383. image{
  384. width: 200rpx;
  385. height: 180rpx;
  386. display: block;
  387. }
  388. .upload-del{
  389. width: 40rpx;
  390. height: 40rpx;
  391. position: absolute;
  392. top: -20rpx;
  393. right: -20rpx;
  394. line-height: 40rpx;
  395. text-align: center;
  396. .iconfont{
  397. font-size: $font-size-32;
  398. color: #999999;
  399. }
  400. }
  401. }
  402. }
  403. }
  404. }
  405. &.picker{
  406. border-bottom: none;
  407. .label-radio{
  408. margin-left: 30rpx;
  409. font-size: $font-size-28;
  410. float: left;
  411. }
  412. .row-radio{
  413. float: left;
  414. transform: scale(0.7);
  415. }
  416. .row-text{
  417. text-align: center;
  418. float: left;
  419. font-size: $font-size-28;
  420. }
  421. .picker-radio{
  422. box-sizing: border-box;
  423. padding-left: 180rpx;
  424. .secondTyperadio{
  425. border: 2rpx solid #e1e1e1;
  426. display: inline-block;
  427. font-size: 26rpx;
  428. color: #999999;
  429. padding: 0 24rpx;
  430. border-radius: 22rpx;
  431. line-height: 42rpx;
  432. margin-right: 28rpx;
  433. float: left;
  434. &.active{
  435. border: 2rpx solid #ffe6dc;
  436. color: $color-system;
  437. }
  438. }
  439. }
  440. }
  441. &.textarea{
  442. height: 142rpx;
  443. .textarea{
  444. width: 100%;
  445. height: 142rpx;
  446. box-sizing: border-box;
  447. font-size: $font-size-28;
  448. color: $text-color;
  449. z-index: 1;
  450. }
  451. .textarea.hide{
  452. opacity: 0;
  453. }
  454. .textarea.show{
  455. color: #999999;
  456. }
  457. }
  458. .textarea-ke{
  459. width: 100%;
  460. height: 160rpx;
  461. border-radius: 6rpx;
  462. border: 1px solid #e1e1e1;
  463. font-size: $font-size-28;
  464. box-sizing: border-box;
  465. padding: 15rpx 20rpx;
  466. }
  467. .form-textarea{
  468. font-size: $font-size-28;
  469. color: #333333;
  470. }
  471. .form-label{
  472. width: 148rpx;
  473. float: left;
  474. height: 100%;
  475. line-height: 56rpx;
  476. font-size: $font-size-28;
  477. text-align: left;
  478. color: #999999;
  479. &.lang{
  480. width: 188rpx;
  481. }
  482. &.none{
  483. width: 100%;
  484. }
  485. }
  486. .form-input{
  487. width: 554rpx;
  488. height: 56rpx;
  489. line-height: 56rpx;
  490. font-size: $font-size-28;
  491. text-align: left;
  492. color: #333333;
  493. float: left;
  494. &.lang{
  495. width: 514rpx;
  496. }
  497. &.phone{
  498. width: 418rpx;
  499. }
  500. }
  501. .form-text{
  502. width: 554rpx;
  503. height: 56rpx;
  504. line-height: 56rpx;
  505. font-size: $font-size-28;
  506. text-align: left;
  507. color: #333333;
  508. float: left;
  509. }
  510. .form-btn{
  511. width: 136rpx;
  512. height: 56rpx;
  513. background: $btn-confirm;
  514. color: #FFFFFF;
  515. font-size: $font-size-28;
  516. text-align: center;
  517. border-radius: 28rpx;
  518. line-height: 56rpx;
  519. float: left;
  520. }
  521. .icon-xiayibu{
  522. width: 80rpx;
  523. height: 80rpx;
  524. position: absolute;
  525. right: 0;
  526. top: 0;
  527. line-height: 80rpx;
  528. text-align: center;
  529. color: #b2b2b2;
  530. }
  531. .form-checkbox-group {
  532. width: 100%;
  533. float: left;
  534. .form-table-item{
  535. height: 48rpx;
  536. padding: 0 32rpx;
  537. border: 1px solid #b2b2b2;
  538. text-align: center;
  539. font-size: $font-size-28;
  540. color: #333333;
  541. float: left;
  542. line-height: 48rpx;
  543. border-radius: 26rpx;
  544. margin-right: 12rpx;
  545. margin-top: 20rpx;
  546. }
  547. }
  548. .form-checkbox-input{
  549. width: 100%;
  550. height: 64rpx;
  551. margin-top: 20rpx;
  552. .checkbox-input{
  553. width: 518rpx;
  554. height: 64rpx;
  555. box-sizing: border-box;
  556. text-align: left;
  557. font-size: $font-size-26;
  558. color: #333333;
  559. line-height: 64rpx;
  560. float: left;
  561. border: 1px solid #e1e1e1;
  562. border-radius: 32rpx;
  563. padding: 0 20rpx;
  564. }
  565. .checkbox-btn{
  566. width: 160rpx;
  567. height: 64rpx;
  568. border-radius: 32rpx;
  569. background-color: #ffe6dc;
  570. line-height: 64rpx;
  571. text-align: center;
  572. color: #FF5B00;
  573. font-size: $font-size-28;
  574. float: right;
  575. }
  576. }
  577. }
  578. .register-fiexd{
  579. width: 100%;
  580. height: auto;
  581. padding: 20rpx 0;
  582. position: fixed;
  583. bottom: 0;
  584. left: 0;
  585. z-index: 888;
  586. background: #FFFFFF;
  587. .register-agree{
  588. display: flex;
  589. flex-direction: column;
  590. align-items: center;
  591. margin:0 0 32rpx 0;
  592. box-sizing: border-box;
  593. padding: 0 105rpx;
  594. .agree-text{
  595. font-size: 20rpx;
  596. line-height: 38rpx;
  597. color: #fea785;
  598. }
  599. }
  600. }
  601. .register-btn{
  602. width: 702rpx;
  603. height: 88rpx;
  604. border-radius: 44rpx;
  605. font-size: $font-size-28;
  606. line-height: 88rpx;
  607. color: #FFFFFF;
  608. margin: 0 auto;
  609. text-align: center;
  610. background: $btn-confirm;
  611. margin-top: 96rpx;
  612. &.disabled{
  613. background: #e4e8eb;
  614. color: #999999;
  615. }
  616. &.none{
  617. background: #FFFFFF;
  618. color: $text-color;
  619. margin-top: 0;
  620. }
  621. &.sub{
  622. margin-top: 0;
  623. }
  624. }
  625. }
  626. }
  627. </style>