orderShareLogin.vue 4.5 KB

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