binding.vue 17 KB

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