binding.vue 15 KB

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