binding.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  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('/pages/seller/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('/pages/supplier/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. this.getWxAuthorize()
  298. }
  299. }
  300. </script>
  301. <style lang="scss">
  302. page{
  303. height: auto;
  304. }
  305. .register{
  306. width: 100%;
  307. position: relative;
  308. box-sizing: border-box;
  309. padding-bottom: 350rpx;
  310. .register-main{
  311. width: 100%;
  312. height: auto;
  313. box-sizing: border-box;
  314. padding: 0 24rpx;
  315. margin-top: 24rpx;
  316. .main-form-item{
  317. width: 100%;
  318. height: 88rpx;
  319. box-sizing: border-box;
  320. padding: 13rpx 0;
  321. border-bottom: 1px solid #e1e1e1;
  322. margin-top: 10rpx;
  323. position: relative;
  324. &.none{
  325. border-bottom: none;
  326. height: auto;
  327. }
  328. &.file{
  329. height: 273rpx;
  330. border-bottom: none;
  331. .main-form-upload{
  332. width: 50%;
  333. height: 100%;
  334. float: left;
  335. .label{
  336. width: 100%;
  337. float: left;
  338. height: 56rpx;
  339. line-height: 56rpx;
  340. font-size: $font-size-28;
  341. text-align: left;
  342. color: #999999;
  343. }
  344. .upload-picture{
  345. width: 100%;
  346. height: 180rpx;
  347. float: left;
  348. margin-top: 17rpx;
  349. .upload-none{
  350. width: 200rpx;
  351. height: 180rpx;
  352. border-radius: 6rpx;
  353. border:1px solid #e1e1e1;
  354. box-sizing: border-box;
  355. padding-top: 64rpx;
  356. .icon-jiahao{
  357. display: inline-block;
  358. width: 100%;
  359. text-align: center;
  360. line-height: 48rpx;
  361. font-size: 40rpx;
  362. color: #b2b2b2;
  363. }
  364. .upload-text{
  365. display: inline-block;
  366. width: 100%;
  367. text-align: center;
  368. line-height: 40rpx;
  369. font-size: $font-size-24;
  370. color: #b2b2b2;
  371. }
  372. }
  373. .upload-image{
  374. width: 200rpx;
  375. height: 180rpx;
  376. border-radius: 6rpx;
  377. border:1px solid #e1e1e1;
  378. box-sizing: border-box;
  379. position: relative;
  380. image{
  381. width: 200rpx;
  382. height: 180rpx;
  383. display: block;
  384. }
  385. .upload-del{
  386. width: 40rpx;
  387. height: 40rpx;
  388. position: absolute;
  389. top: -20rpx;
  390. right: -20rpx;
  391. line-height: 40rpx;
  392. text-align: center;
  393. .iconfont{
  394. font-size: $font-size-32;
  395. color: #999999;
  396. }
  397. }
  398. }
  399. }
  400. }
  401. }
  402. &.picker{
  403. border-bottom: none;
  404. .label-radio{
  405. margin-left: 30rpx;
  406. font-size: $font-size-28;
  407. float: left;
  408. }
  409. .row-radio{
  410. float: left;
  411. transform: scale(0.7);
  412. }
  413. .row-text{
  414. text-align: center;
  415. float: left;
  416. font-size: $font-size-28;
  417. }
  418. .picker-radio{
  419. box-sizing: border-box;
  420. padding-left: 180rpx;
  421. .secondTyperadio{
  422. border: 2rpx solid #e1e1e1;
  423. display: inline-block;
  424. font-size: 26rpx;
  425. color: #999999;
  426. padding: 0 24rpx;
  427. border-radius: 22rpx;
  428. line-height: 42rpx;
  429. margin-right: 28rpx;
  430. float: left;
  431. &.active{
  432. border: 2rpx solid #ffe6dc;
  433. color: $color-system;
  434. }
  435. }
  436. }
  437. }
  438. &.textarea{
  439. height: 142rpx;
  440. .textarea{
  441. width: 100%;
  442. height: 142rpx;
  443. box-sizing: border-box;
  444. font-size: $font-size-28;
  445. color: $text-color;
  446. z-index: 1;
  447. }
  448. .textarea.hide{
  449. opacity: 0;
  450. }
  451. .textarea.show{
  452. color: #999999;
  453. }
  454. }
  455. .textarea-ke{
  456. width: 100%;
  457. height: 160rpx;
  458. border-radius: 6rpx;
  459. border: 1px solid #e1e1e1;
  460. font-size: $font-size-28;
  461. box-sizing: border-box;
  462. padding: 15rpx 20rpx;
  463. }
  464. .form-textarea{
  465. font-size: $font-size-28;
  466. color: #333333;
  467. }
  468. .form-label{
  469. width: 148rpx;
  470. float: left;
  471. height: 100%;
  472. line-height: 56rpx;
  473. font-size: $font-size-28;
  474. text-align: left;
  475. color: #999999;
  476. &.lang{
  477. width: 188rpx;
  478. }
  479. &.none{
  480. width: 100%;
  481. }
  482. }
  483. .form-input{
  484. width: 554rpx;
  485. height: 56rpx;
  486. line-height: 56rpx;
  487. font-size: $font-size-28;
  488. text-align: left;
  489. color: #333333;
  490. float: left;
  491. &.lang{
  492. width: 514rpx;
  493. }
  494. &.phone{
  495. width: 418rpx;
  496. }
  497. }
  498. .form-text{
  499. width: 554rpx;
  500. height: 56rpx;
  501. line-height: 56rpx;
  502. font-size: $font-size-28;
  503. text-align: left;
  504. color: #333333;
  505. float: left;
  506. }
  507. .form-btn{
  508. width: 136rpx;
  509. height: 56rpx;
  510. background: $btn-confirm;
  511. color: #FFFFFF;
  512. font-size: $font-size-28;
  513. text-align: center;
  514. border-radius: 28rpx;
  515. line-height: 56rpx;
  516. float: left;
  517. }
  518. .icon-xiayibu{
  519. width: 80rpx;
  520. height: 80rpx;
  521. position: absolute;
  522. right: 0;
  523. top: 0;
  524. line-height: 80rpx;
  525. text-align: center;
  526. color: #b2b2b2;
  527. }
  528. .form-checkbox-group {
  529. width: 100%;
  530. float: left;
  531. .form-table-item{
  532. height: 48rpx;
  533. padding: 0 32rpx;
  534. border: 1px solid #b2b2b2;
  535. text-align: center;
  536. font-size: $font-size-28;
  537. color: #333333;
  538. float: left;
  539. line-height: 48rpx;
  540. border-radius: 26rpx;
  541. margin-right: 12rpx;
  542. margin-top: 20rpx;
  543. }
  544. }
  545. .form-checkbox-input{
  546. width: 100%;
  547. height: 64rpx;
  548. margin-top: 20rpx;
  549. .checkbox-input{
  550. width: 518rpx;
  551. height: 64rpx;
  552. box-sizing: border-box;
  553. text-align: left;
  554. font-size: $font-size-26;
  555. color: #333333;
  556. line-height: 64rpx;
  557. float: left;
  558. border: 1px solid #e1e1e1;
  559. border-radius: 32rpx;
  560. padding: 0 20rpx;
  561. }
  562. .checkbox-btn{
  563. width: 160rpx;
  564. height: 64rpx;
  565. border-radius: 32rpx;
  566. background-color: #ffe6dc;
  567. line-height: 64rpx;
  568. text-align: center;
  569. color: #e15616;
  570. font-size: $font-size-28;
  571. float: right;
  572. }
  573. }
  574. }
  575. .register-fiexd{
  576. width: 100%;
  577. height: auto;
  578. padding: 20rpx 0;
  579. position: fixed;
  580. bottom: 0;
  581. left: 0;
  582. z-index: 888;
  583. background: #FFFFFF;
  584. .register-agree{
  585. display: flex;
  586. flex-direction: column;
  587. align-items: center;
  588. margin:0 0 32rpx 0;
  589. box-sizing: border-box;
  590. padding: 0 105rpx;
  591. .agree-text{
  592. font-size: 20rpx;
  593. line-height: 38rpx;
  594. color: #fea785;
  595. }
  596. }
  597. }
  598. .register-btn{
  599. width: 702rpx;
  600. height: 88rpx;
  601. border-radius: 44rpx;
  602. font-size: $font-size-28;
  603. line-height: 88rpx;
  604. color: #FFFFFF;
  605. margin: 0 auto;
  606. text-align: center;
  607. background: $btn-confirm;
  608. margin-top: 96rpx;
  609. &.disabled{
  610. background: #e4e8eb;
  611. color: #999999;
  612. }
  613. &.none{
  614. background: #FFFFFF;
  615. color: $text-color;
  616. margin-top: 0;
  617. }
  618. &.sub{
  619. margin-top: 0;
  620. }
  621. }
  622. }
  623. }
  624. </style>