orderShareLogin.vue 4.2 KB

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