binding.vue 16 KB

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