orderShareLogin.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view class="container login">
  3. <!-- logo区域 -->
  4. <view class="login-main">
  5. <image class="logo" :src="imagePath" mode=""></image>
  6. </view>
  7. <!-- 输入框 -->
  8. <view class="login-input">
  9. <input type="number"
  10. v-model="shareCode"
  11. maxlength="6"
  12. class="input"
  13. placeholder="请输入分享码"
  14. />
  15. </view>
  16. <!-- 提示信息 -->
  17. <view class="logo-message" v-if="false"><text>分享码错误,请联系对方获取分享码</text> </view>
  18. <!-- 登录按钮 -->
  19. <button class="login-btn" :disabled="!canSubmit" @click="goLogin">查看订单</button>
  20. </view>
  21. </template>
  22. <script>
  23. import authorize from '@/common/config/authorize.js'
  24. export default{
  25. data() {
  26. return{
  27. imagePath:'/static/ws/logo.png',
  28. shareCode:'', //获取用户登录的邀请码
  29. isUserInfo:false, //控制显示授权弹窗
  30. nickName:'', //存储用户名
  31. userInfo:'', //存储微信用户授权信息
  32. orderID:0, //订单ID
  33. userID:0 ,//分享人的用户ID
  34. isShareStatus:false,
  35. }
  36. },
  37. onLoad(e) {
  38. console.log(e)
  39. this.orderID = e.orderID
  40. this.userID = e.userID
  41. },
  42. computed:{
  43. canSubmit(){
  44. return this.shareCode.trim().length>=6
  45. }
  46. },
  47. methods:{
  48. goLogin() {
  49. if(this.shareCode == ''){
  50. this.$util.msg('请联系分享人获取分享码',2000);
  51. return
  52. }
  53. if(!this.$api.isNumber(this.shareCode)){
  54. this.$util.msg('分享码格式不正确',2000);
  55. return
  56. }
  57. authorize.getCode('weixin').then(wechatcode =>{
  58. let params ={
  59. code:wechatcode,
  60. orderID:this.orderID,
  61. userID:this.userID,
  62. shareCode:this.shareCode
  63. }
  64. this.OrderService.OrderShareCode(params).then(response =>{
  65. if (response.code === 0) {//游客第一次查看订单详情
  66. this.$api.redirectTo('/pages/user/order/order-sharedetails?orderID='+this.orderID)
  67. }else{
  68. this.$util.msg(response.msg,2000);
  69. }
  70. })
  71. })
  72. },
  73. },
  74. onShow() {
  75. }
  76. }
  77. </script>
  78. <style lang="scss">
  79. .login{
  80. width: 100%;
  81. height:100%;
  82. background: #FFFFFF;
  83. .model-warp.none{
  84. display: none;
  85. }
  86. .model-warp.show{
  87. display: block;
  88. }
  89. .login-main{
  90. width: 100%;
  91. display: flex;
  92. flex-direction: column;
  93. align-items: center;
  94. padding: 178rpx 0 140rpx;
  95. .logo{
  96. width: 152rpx;
  97. height: 152rpx;
  98. display: block;
  99. }
  100. }
  101. .login-input{
  102. width: 550rpx;
  103. height: 40rpx;
  104. padding: 24rpx 0;
  105. margin: 0 auto;
  106. margin-bottom: 30rpx;
  107. background: #FFFFFF;
  108. border-bottom: 1px solid #E1E1E1;
  109. .input{
  110. width: 100%;
  111. height: 100%;
  112. background: #FFFFFF;
  113. font-size: $font-size-28;
  114. line-height: 40rpx;
  115. color: #333333;
  116. }
  117. }
  118. .login-btn{
  119. width: 600rpx;
  120. height: 90rpx;
  121. font-size: $font-size-30;
  122. line-height: 90rpx;
  123. color: #FFFFFF;
  124. margin: 0 auto;
  125. margin-top: 64rpx;
  126. text-align: center;
  127. background: $btn-confirm;
  128. border-radius: 44rpx;
  129. }
  130. .model-authorization{
  131. width: 100%;
  132. height: 100%;
  133. position: fixed;
  134. top: 0;
  135. left: 0;
  136. z-index: 999;
  137. .authorization{
  138. width: 518rpx;
  139. height: 320rpx;
  140. position: absolute;
  141. background: rgba(255,255,255,.7);
  142. left: 0;
  143. right: 0;
  144. bottom: 0;
  145. top: 0;
  146. margin: auto;
  147. .to-btn{
  148. position: absolute;
  149. top: 0;
  150. left: 0;
  151. right: 0;
  152. bottom: 0;
  153. margin: auto;
  154. width: 70%;
  155. height: 88rpx;
  156. font-size: $font-size-28;
  157. line-height: 88rpx;
  158. color: #FFFFFF;
  159. text-align: center;
  160. border-radius: 44rpx;
  161. }
  162. }
  163. }
  164. .logo-message {
  165. font-size: 24rpx;
  166. line-height: 33rpx;
  167. color: #ff2a2a;
  168. display: flex;
  169. justify-content: center;
  170. align-items: center;
  171. &::before {
  172. content: '!';
  173. display: block;
  174. width: 22rpx;
  175. height: 22rpx;
  176. border: 1px solid #ff2a2a;
  177. border-radius: 50%;
  178. color: #ff2a2a;
  179. text-align: center;
  180. line-height: 22rpx;
  181. margin-right: 6rpx;
  182. }
  183. }
  184. }
  185. </style>