binding.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  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(JSON.stringify({id:this.bindId})).then(response =>{
  225. this.params.userId = response.data.userId
  226. setTimeout(()=>{
  227. this.BindingWechat(this.params)
  228. },1000)
  229. }).catch(error =>{
  230. this.$util.msg(error.msg,2000);
  231. })
  232. },
  233. GetUserProfile(){//获取微信用户信息
  234. const self = this
  235. wx.getUserProfile({
  236. desc: '采美采购商城小程序获取您的信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  237. success(res) {
  238. console.log('微信获取用户信息新API',res)
  239. self.wxLogin(res.userInfo)
  240. self.params.nickName = res.userInfo.nickName
  241. self.params.avatarUrl = res.userInfo.avatarUrl
  242. self.params.unionId = uni.getStorageSync('unionId')
  243. self.SellerClubRegister()
  244. },
  245. fail() {
  246. self.$util.msg('授权失败', 2000)
  247. }
  248. })
  249. },
  250. BindingWechat(params){
  251. this.UserService.BindingWechat(params)
  252. .then(response =>{
  253. this.login(response.data)
  254. this.$api.switchTabTo('/pages/tabBar/home/index')
  255. })
  256. .catch(error =>{
  257. this.$util.msg(error.msg,2000)
  258. this.isUserInfo = true
  259. })
  260. },
  261. ArrayFormat(Array) {//处理金额
  262. const newArray = []
  263. Array.split('/').forEach((item,index) =>{
  264. let _OBJ = {value:(index+1).toString(),name:item,checked:true}
  265. newArray.push(_OBJ)
  266. })
  267. return newArray
  268. }
  269. },
  270. onShow() {
  271. authorize.getSetting().then(res =>{
  272. console.log('用户是否授权过',res)
  273. if(res == 1){
  274. this.getWxAuthorize()
  275. }else{
  276. console.log(new Date +'用户未授权微信信息')
  277. this.$api.navigateTo('/pages/authorization/authorization')
  278. }
  279. })
  280. }
  281. }
  282. </script>
  283. <style lang="scss">
  284. page{
  285. height: auto;
  286. }
  287. .register{
  288. width: 100%;
  289. position: relative;
  290. box-sizing: border-box;
  291. padding-bottom: 440rpx;
  292. .register-main{
  293. width: 100%;
  294. height: auto;
  295. box-sizing: border-box;
  296. padding: 0 24rpx;
  297. margin-top: 24rpx;
  298. .main-form-item{
  299. width: 100%;
  300. height: 88rpx;
  301. box-sizing: border-box;
  302. padding: 13rpx 0;
  303. border-bottom: 1px solid #e1e1e1;
  304. margin-top: 10rpx;
  305. position: relative;
  306. &.none{
  307. border-bottom: none;
  308. height: auto;
  309. }
  310. &.file{
  311. height: 273rpx;
  312. border-bottom: none;
  313. .main-form-upload{
  314. width: 50%;
  315. height: 100%;
  316. float: left;
  317. .label{
  318. width: 100%;
  319. float: left;
  320. height: 56rpx;
  321. line-height: 56rpx;
  322. font-size: $font-size-28;
  323. text-align: left;
  324. color: #999999;
  325. }
  326. .upload-picture{
  327. width: 100%;
  328. height: 180rpx;
  329. float: left;
  330. margin-top: 17rpx;
  331. .upload-none{
  332. width: 200rpx;
  333. height: 180rpx;
  334. border-radius: 6rpx;
  335. border:1px solid #e1e1e1;
  336. box-sizing: border-box;
  337. padding-top: 64rpx;
  338. .icon-jiahao{
  339. display: inline-block;
  340. width: 100%;
  341. text-align: center;
  342. line-height: 48rpx;
  343. font-size: 40rpx;
  344. color: #b2b2b2;
  345. }
  346. .upload-text{
  347. display: inline-block;
  348. width: 100%;
  349. text-align: center;
  350. line-height: 40rpx;
  351. font-size: $font-size-24;
  352. color: #b2b2b2;
  353. }
  354. }
  355. .upload-image{
  356. width: 200rpx;
  357. height: 180rpx;
  358. border-radius: 6rpx;
  359. border:1px solid #e1e1e1;
  360. box-sizing: border-box;
  361. position: relative;
  362. image{
  363. width: 200rpx;
  364. height: 180rpx;
  365. display: block;
  366. }
  367. .upload-del{
  368. width: 40rpx;
  369. height: 40rpx;
  370. position: absolute;
  371. top: -20rpx;
  372. right: -20rpx;
  373. line-height: 40rpx;
  374. text-align: center;
  375. .iconfont{
  376. font-size: $font-size-32;
  377. color: #999999;
  378. }
  379. }
  380. }
  381. }
  382. }
  383. }
  384. &.picker{
  385. border-bottom: none;
  386. .label-radio{
  387. margin-left: 30rpx;
  388. font-size: $font-size-28;
  389. float: left;
  390. }
  391. .row-radio{
  392. float: left;
  393. transform: scale(0.7);
  394. }
  395. .row-text{
  396. text-align: center;
  397. float: left;
  398. font-size: $font-size-28;
  399. }
  400. .picker-radio{
  401. box-sizing: border-box;
  402. padding-left: 180rpx;
  403. .secondTyperadio{
  404. border: 2rpx solid #e1e1e1;
  405. display: inline-block;
  406. font-size: 26rpx;
  407. color: #999999;
  408. padding: 0 24rpx;
  409. border-radius: 22rpx;
  410. line-height: 42rpx;
  411. margin-right: 56rpx;
  412. float: left;
  413. &.active{
  414. border: 2rpx solid #ffe6dc;
  415. color: $color-system;
  416. }
  417. }
  418. }
  419. }
  420. &.textarea{
  421. height: 142rpx;
  422. .textarea{
  423. width: 100%;
  424. height: 142rpx;
  425. box-sizing: border-box;
  426. font-size: $font-size-28;
  427. color: $text-color;
  428. z-index: 1;
  429. }
  430. .textarea.hide{
  431. opacity: 0;
  432. }
  433. .textarea.show{
  434. color: #999999;
  435. }
  436. }
  437. .textarea-ke{
  438. width: 100%;
  439. height: 160rpx;
  440. border-radius: 6rpx;
  441. border: 1px solid #e1e1e1;
  442. font-size: $font-size-28;
  443. box-sizing: border-box;
  444. padding: 15rpx 20rpx;
  445. }
  446. .form-textarea{
  447. font-size: $font-size-28;
  448. color: #333333;
  449. }
  450. .form-label{
  451. width: 148rpx;
  452. float: left;
  453. height: 100%;
  454. line-height: 56rpx;
  455. font-size: $font-size-28;
  456. text-align: left;
  457. color: #999999;
  458. &.lang{
  459. width: 188rpx;
  460. }
  461. &.none{
  462. width: 100%;
  463. }
  464. }
  465. .form-input{
  466. width: 554rpx;
  467. height: 56rpx;
  468. line-height: 56rpx;
  469. font-size: $font-size-28;
  470. text-align: left;
  471. color: #333333;
  472. float: left;
  473. &.lang{
  474. width: 514rpx;
  475. }
  476. &.phone{
  477. width: 418rpx;
  478. }
  479. }
  480. .form-text{
  481. width: 554rpx;
  482. height: 56rpx;
  483. line-height: 56rpx;
  484. font-size: $font-size-28;
  485. text-align: left;
  486. color: #333333;
  487. float: left;
  488. }
  489. .form-btn{
  490. width: 136rpx;
  491. height: 56rpx;
  492. background: $btn-confirm;
  493. color: #FFFFFF;
  494. font-size: $font-size-28;
  495. text-align: center;
  496. border-radius: 28rpx;
  497. line-height: 56rpx;
  498. float: left;
  499. }
  500. .icon-xiayibu{
  501. width: 80rpx;
  502. height: 80rpx;
  503. position: absolute;
  504. right: 0;
  505. top: 0;
  506. line-height: 80rpx;
  507. text-align: center;
  508. color: #b2b2b2;
  509. }
  510. .form-checkbox-group {
  511. width: 100%;
  512. float: left;
  513. .form-table-item{
  514. height: 48rpx;
  515. padding: 0 32rpx;
  516. border: 1px solid #b2b2b2;
  517. text-align: center;
  518. font-size: $font-size-28;
  519. color: #333333;
  520. float: left;
  521. line-height: 48rpx;
  522. border-radius: 26rpx;
  523. margin-right: 12rpx;
  524. margin-top: 20rpx;
  525. }
  526. }
  527. .form-checkbox-input{
  528. width: 100%;
  529. height: 64rpx;
  530. margin-top: 20rpx;
  531. .checkbox-input{
  532. width: 518rpx;
  533. height: 64rpx;
  534. box-sizing: border-box;
  535. text-align: left;
  536. font-size: $font-size-26;
  537. color: #333333;
  538. line-height: 64rpx;
  539. float: left;
  540. border: 1px solid #e1e1e1;
  541. border-radius: 32rpx;
  542. padding: 0 20rpx;
  543. }
  544. .checkbox-btn{
  545. width: 160rpx;
  546. height: 64rpx;
  547. border-radius: 32rpx;
  548. background-color: #ffe6dc;
  549. line-height: 64rpx;
  550. text-align: center;
  551. color: #e15616;
  552. font-size: $font-size-28;
  553. float: right;
  554. }
  555. }
  556. }
  557. .register-fiexd{
  558. width: 100%;
  559. height: auto;
  560. padding: 20rpx 0;
  561. position: fixed;
  562. bottom: 0;
  563. left: 0;
  564. z-index: 888;
  565. background: #FFFFFF;
  566. .register-agree{
  567. display: flex;
  568. flex-direction: column;
  569. align-items: center;
  570. margin:0 0 32rpx 0;
  571. box-sizing: border-box;
  572. padding: 0 105rpx;
  573. .agree-text{
  574. font-size: 20rpx;
  575. line-height: 38rpx;
  576. color: #fea785;
  577. }
  578. }
  579. }
  580. .register-btn{
  581. width: 702rpx;
  582. height: 88rpx;
  583. border-radius: 44rpx;
  584. font-size: $font-size-28;
  585. line-height: 88rpx;
  586. color: #FFFFFF;
  587. margin: 0 auto;
  588. text-align: center;
  589. background: $btn-confirm;
  590. margin-top: 96rpx;
  591. &.none{
  592. background: #FFFFFF;
  593. color: $text-color;
  594. margin-top: 0;
  595. }
  596. &.sub{
  597. margin-top: 0;
  598. }
  599. }
  600. }
  601. }
  602. </style>