binding.vue 16 KB

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