orderShareLogin.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <view class="container login" v-if="isShareStatus">
  3. <view class="login-main">
  4. <image class="logo" :src="imagePath" mode=""></image>
  5. </view>
  6. <view class="login-input">
  7. <input type="number"
  8. v-model="shareCode"
  9. maxlength="4"
  10. class="input"
  11. placeholder="请输入分享码"
  12. />
  13. </view>
  14. <view class="login-btn" @click="goLogin">查看订单</view>
  15. </view>
  16. </template>
  17. <script>
  18. import authorize from '@/common/config/authorize.js'
  19. export default{
  20. data() {
  21. return{
  22. imagePath:'https://img.caimei365.com/group1/M00/03/83/Cmis214FbbCAQhKoAAKWfqqSIds292.png',
  23. shareCode:'', //获取用户登录的邀请码
  24. isUserInfo:false, //控制显示授权弹窗
  25. nickName:'', //存储用户名
  26. userInfo:'', //存储微信用户授权信息
  27. orderID:0, //订单ID
  28. userID:0 ,//分享人的用户ID
  29. isShareStatus:false,
  30. }
  31. },
  32. onLoad(e) {
  33. console.log(e)
  34. this.orderID = e.orderID
  35. this.userID = e.userID
  36. },
  37. methods:{
  38. initQueryUser(){
  39. authorize.getCode('weixin').then(wechatcode =>{
  40. let param ={
  41. code:wechatcode,
  42. orderID:this.orderID,
  43. userID:this.userID,
  44. organizeID:this.userOrganizeID,
  45. shareCode:this.shareCode
  46. }
  47. this.$api.lodingGet('/order/shareCode',param,
  48. response => {
  49. console.log(response)
  50. if (response.code === "1") {
  51. if(response.data == true){
  52. // console.log('同为会所运营人员查看订单详情')
  53. this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderID=${this.orderID}`)
  54. }else{
  55. // console.log('游客第二次查看订单详情')
  56. this.$api.redirectTo(`/pages/user/order/order-sharedetails?orderID=${this.orderID}`)
  57. }
  58. }else if(response.code === "-2"){
  59. this.$util.modal('提示',response.msg,false,() =>{
  60. this.$api.switchTabTo('/pages/tabBar/home/home');
  61. })
  62. }else{
  63. this.isShareStatus = true
  64. }
  65. }
  66. )
  67. })
  68. },
  69. goLogin() {
  70. if(this.shareCode == ''){
  71. this.$util.msg('请联系分享人获取分享码',2000);
  72. return
  73. }
  74. if(!this.$api.isNumber(this.shareCode)){
  75. this.$util.msg('分享码格式不正确',2000);
  76. return
  77. }
  78. authorize.getCode('weixin').then(wechatcode =>{
  79. let param ={
  80. code:wechatcode,
  81. orderID:this.orderID,
  82. userID:this.userID,
  83. organizeID:this.userOrganizeID,
  84. shareCode:this.shareCode
  85. }
  86. this.$api.get('/order/shareCode',param,
  87. response => {
  88. if (response.code == "1") {
  89. console.log('游客第一次查看订单详情')
  90. this.$api.redirectTo('/pages/user/order/order-sharedetails?orderID='+this.orderID)
  91. }else{
  92. this.$util.msg(response.msg,2000);
  93. }
  94. }
  95. )
  96. })
  97. },
  98. },
  99. onShow() {
  100. this.initQueryUser()
  101. }
  102. }
  103. </script>
  104. <style lang="scss">
  105. .login{
  106. width: 100%;
  107. height:100%;
  108. background: #FFFFFF;
  109. .model-warp.none{
  110. display: none;
  111. }
  112. .model-warp.show{
  113. display: block;
  114. }
  115. .login-main{
  116. width: 100%;
  117. display: flex;
  118. flex-direction: column;
  119. align-items: center;
  120. padding: 128rpx 0;
  121. .logo{
  122. width: 658rpx;
  123. height: 354rpx;
  124. display: block;
  125. }
  126. }
  127. .login-input{
  128. width: 654rpx;
  129. height: 40rpx;
  130. padding: 24rpx;
  131. margin: 0 auto;
  132. margin-bottom: 60rpx;
  133. background: #F7F7F7;
  134. .input{
  135. width: 100%;
  136. height: 100%;
  137. background: #F7F7F7;
  138. font-size: $font-size-28;
  139. line-height: 40rpx;
  140. color: #333333;
  141. }
  142. }
  143. .login-btn{
  144. width: 702rpx;
  145. height: 88rpx;
  146. font-size: $font-size-28;
  147. line-height: 88rpx;
  148. color: #FFFFFF;
  149. margin: 0 auto;
  150. margin-top: 100rpx;
  151. text-align: center;
  152. background: $btn-confirm;
  153. border-radius: 0;
  154. }
  155. .model-authorization{
  156. width: 100%;
  157. height: 100%;
  158. position: fixed;
  159. top: 0;
  160. left: 0;
  161. z-index: 999;
  162. .authorization{
  163. width: 518rpx;
  164. height: 320rpx;
  165. position: absolute;
  166. background: rgba(255,255,255,.7);
  167. left: 0;
  168. right: 0;
  169. bottom: 0;
  170. top: 0;
  171. margin: auto;
  172. .to-btn{
  173. position: absolute;
  174. top: 0;
  175. left: 0;
  176. right: 0;
  177. bottom: 0;
  178. margin: auto;
  179. width: 70%;
  180. height: 88rpx;
  181. font-size: $font-size-28;
  182. line-height: 88rpx;
  183. color: #FFFFFF;
  184. text-align: center;
  185. border-radius: 44rpx;
  186. }
  187. }
  188. }
  189. }
  190. </style>