orderShareLogin.vue 4.4 KB

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