orderShareLogin.vue 4.3 KB

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