orderShareLogin.vue 3.3 KB

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