binding.vue 16 KB

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