orderShareLogin.vue 3.8 KB

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