orderShareLogin.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view class="container login">
  3. <view class="login-main">
  4. <image class="logo" :src="staticUrl+'icon_share_login@2x.png'" mode=""></image>
  5. </view>
  6. <view class="login-input">
  7. <input type="number"
  8. v-model="params.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. export default{
  20. data() {
  21. return{
  22. staticUrl:this.global.staticUrl,
  23. shareCode:'', // 获取用户登录的邀请码
  24. isUserInfo:false, // 控制显示授权弹窗
  25. params:{
  26. code:'', // 微信code
  27. iv:'',
  28. encryptedData:'',
  29. shareCode:'', // 邀请码
  30. shopOrderId:0, // 订单ID
  31. userId:0, // 分享人的用户ID
  32. },
  33. isShareStatus:false,
  34. }
  35. },
  36. onLoad(e) {
  37. console.log(e)
  38. this.params.shopOrderId = e.orderId
  39. this.params.userId = e.userId
  40. this.initGetCode()
  41. },
  42. methods:{
  43. async initGetCode(){
  44. const getUserInfo = await authorize.getUserInfo('weixin')
  45. this.params.iv = getUserInfo.iv
  46. this.params.encryptedData = getUserInfo.encryptedData
  47. this.params.code = await authorize.getCode('weixin')
  48. },
  49. goLogin() {
  50. if(this.params.shareCode == ''){
  51. this.$util.msg('请联系分享人获取分享码',2000)
  52. return
  53. }
  54. if(!this.$api.isNumber(this.params.shareCode)){
  55. this.$util.msg('分享码格式不正确',2000)
  56. return
  57. }
  58. this.OrderService.OrderShareCode(this.params).then(response =>{
  59. if (response.code === 0) {//游客第一次查看订单详情
  60. this.$api.redirectTo(`/pages/user/order/order-sharedetails?orderId=${this.params.shopOrderId}&userId=${this.params.userId}`)
  61. }else{
  62. this.$util.msg(response.msg,2000)
  63. }
  64. })
  65. },
  66. },
  67. onShow() {
  68. }
  69. }
  70. </script>
  71. <style lang="scss">
  72. .login{
  73. width: 100%;
  74. height:100%;
  75. background: #FFFFFF;
  76. .model-warp.none{
  77. display: none;
  78. }
  79. .model-warp.show{
  80. display: block;
  81. }
  82. .login-main{
  83. width: 100%;
  84. display: flex;
  85. flex-direction: column;
  86. align-items: center;
  87. padding: 128rpx 0;
  88. .logo{
  89. width: 460rpx;
  90. height: 300rpx;
  91. display: block;
  92. }
  93. }
  94. .login-input{
  95. width: 600rpx;
  96. height: 40rpx;
  97. padding: 24rpx 0;
  98. margin: 0 auto;
  99. margin-bottom: 60rpx;
  100. background: #FFFFFF;
  101. border-bottom: 1px solid #E1E1E1;
  102. .input{
  103. width: 100%;
  104. height: 100%;
  105. background: #FFFFFF;
  106. font-size: $font-size-28;
  107. line-height: 40rpx;
  108. color: #333333;
  109. }
  110. }
  111. .login-btn{
  112. width: 600rpx;
  113. height: 88rpx;
  114. font-size: $font-size-28;
  115. line-height: 88rpx;
  116. color: #FFFFFF;
  117. margin: 0 auto;
  118. margin-top: 100rpx;
  119. text-align: center;
  120. background: $btn-confirm;
  121. border-radius: 44rpx;
  122. }
  123. .model-authorization{
  124. width: 100%;
  125. height: 100%;
  126. position: fixed;
  127. top: 0;
  128. left: 0;
  129. z-index: 999;
  130. .authorization{
  131. width: 518rpx;
  132. height: 320rpx;
  133. position: absolute;
  134. background: rgba(255,255,255,.7);
  135. left: 0;
  136. right: 0;
  137. bottom: 0;
  138. top: 0;
  139. margin: auto;
  140. .to-btn{
  141. position: absolute;
  142. top: 0;
  143. left: 0;
  144. right: 0;
  145. bottom: 0;
  146. margin: auto;
  147. width: 70%;
  148. height: 88rpx;
  149. font-size: $font-size-28;
  150. line-height: 88rpx;
  151. color: #FFFFFF;
  152. text-align: center;
  153. border-radius: 44rpx;
  154. }
  155. }
  156. }
  157. }
  158. </style>