orderShareLogin.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. serviceProviderId:''
  32. }
  33. },
  34. onLoad(e) {
  35. console.log(e)
  36. this.orderID = e.orderID
  37. this.userID = e.userID
  38. this.serviceProviderId = e.serviceProviderId
  39. },
  40. methods:{
  41. initQueryUser(){
  42. authorize.getCode('weixin').then(wechatcode =>{
  43. let params ={
  44. code:wechatcode,
  45. orderID:this.orderID,
  46. userID:this.userID,
  47. shareCode:this.shareCode,
  48. serviceProviderId:this.serviceProviderId
  49. }
  50. orderShareCode(params).then(response =>{
  51. if(response.code === 2){
  52. this.$api.navigateTo(`/market/pages/order/order-details?type=share&orderID=${this.orderID}`)
  53. }else if(response.code === 0) {
  54. if(response.data == true){//同为会所运营人员查看订单详情
  55. this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderID=${this.orderID}`)
  56. }else{//游客第二次查看订单详情
  57. this.$api.redirectTo(`/pages/user/order/order-sharedetails?orderID=${this.orderID}`)
  58. }
  59. }else if(response.code === -2){
  60. this.$util.modal('提示',response.msg,'确定','',false,() =>{})
  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. this.$api.redirectTo('/pages/user/order/order-sharedetails?orderID='+this.orderID)
  86. }else{
  87. this.$util.msg(response.msg,2000);
  88. }
  89. })
  90. })
  91. },
  92. },
  93. onShow() {
  94. this.initQueryUser()
  95. }
  96. }
  97. </script>
  98. <style lang="scss">
  99. .login{
  100. width: 100%;
  101. height:100%;
  102. background: #FFFFFF;
  103. .model-warp.none{
  104. display: none;
  105. }
  106. .model-warp.show{
  107. display: block;
  108. }
  109. .login-main{
  110. width: 100%;
  111. display: flex;
  112. flex-direction: column;
  113. align-items: center;
  114. padding: 128rpx 0;
  115. .logo{
  116. width: 658rpx;
  117. height: 354rpx;
  118. display: block;
  119. }
  120. }
  121. .login-input{
  122. width: 654rpx;
  123. height: 40rpx;
  124. padding: 24rpx;
  125. margin: 0 auto;
  126. margin-bottom: 60rpx;
  127. background: #F7F7F7;
  128. .input{
  129. width: 100%;
  130. height: 100%;
  131. background: #F7F7F7;
  132. font-size: $font-size-28;
  133. border-radius: 14rpx;
  134. line-height: 40rpx;
  135. color: #333333;
  136. }
  137. }
  138. .login-btn{
  139. width: 702rpx;
  140. height: 88rpx;
  141. font-size: $font-size-28;
  142. line-height: 88rpx;
  143. color: #FFFFFF;
  144. margin: 0 auto;
  145. margin-top: 100rpx;
  146. text-align: center;
  147. background: $btn-confirm;
  148. border-radius: 14rpx;
  149. }
  150. .model-authorization{
  151. width: 100%;
  152. height: 100%;
  153. position: fixed;
  154. top: 0;
  155. left: 0;
  156. z-index: 999;
  157. .authorization{
  158. width: 518rpx;
  159. height: 320rpx;
  160. position: absolute;
  161. background: rgba(255,255,255,.7);
  162. left: 0;
  163. right: 0;
  164. bottom: 0;
  165. top: 0;
  166. margin: auto;
  167. .to-btn{
  168. position: absolute;
  169. top: 0;
  170. left: 0;
  171. right: 0;
  172. bottom: 0;
  173. margin: auto;
  174. width: 70%;
  175. height: 88rpx;
  176. font-size: $font-size-28;
  177. line-height: 88rpx;
  178. color: #FFFFFF;
  179. text-align: center;
  180. border-radius: 44rpx;
  181. }
  182. }
  183. }
  184. }
  185. </style>