order-sharelogin.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view class="container login" v-if="isShareStatus">
  3. <view class="container-main clearfix">
  4. <view class="main-title">此订单包含如下商品:</view>
  5. <view class="main-list clearfix">
  6. <view class="main-list-item" v-for="(item, index) in productList" :key="index">
  7. <view class="item-image"> <image :src="item.image" mode="scaleToFill"></image> </view>
  8. <view class="item-mesage">
  9. <view class="item-name">{{ item.name }}</view>
  10. <view class="item-num"><text>X</text>{{ item.num }}</view>
  11. </view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="container-footer" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  16. <view class="login-btn" @click.stop="btnConfirmPay">立即支付</view>
  17. <view class="login-sub">
  18. <view class="btn" @click.stop="goLogin(1)">账号登录查看</view>
  19. <view class="btn" @click.stop="goLogin(2)">使用分享码查看</view>
  20. </view>
  21. <view class="pay-statustext">
  22. <view class="pay-statustext-inner">
  23. <view class="pay-text">
  24. <text>使用账号登录支持确认订单和直接付款,使用分享码只支持查看订单,不能操作</text>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import authorize from '@/common/config/authorize.js'
  33. export default {
  34. data() {
  35. return {
  36. isIphoneX: this.$store.state.isIphoneX,
  37. imagePath: 'https://img.caimei365.com/group1/M00/03/83/Cmis214FbbCAQhKoAAKWfqqSIds292.png',
  38. shareCode: '', //获取用户登录的邀请码
  39. isUserInfo: false, //控制显示授权弹窗
  40. isShareStatus: false,
  41. productList: [],
  42. params: {
  43. code: '',
  44. iv: '',
  45. encryptedData: '',
  46. orderId: 0, //订单ID
  47. userId: 0, //机构用户ID
  48. serviceProviderId: 0 //协销ID
  49. }
  50. }
  51. },
  52. onLoad(e) {
  53. console.log(e)
  54. this.params.orderId = e.orderId
  55. this.params.userId = e.userId
  56. if (e.serviceProviderId) {
  57. this.params.serviceProviderId = e.serviceProviderId
  58. }
  59. this.initQueryUser()
  60. },
  61. methods: {
  62. async initQueryUser() {
  63. const getUserInfo = await authorize.getUserInfo('weixin')
  64. this.params.code = await authorize.getCode('weixin')
  65. this.params.iv = getUserInfo.iv
  66. this.params.encryptedData = getUserInfo.encryptedData
  67. this.OrderService.OrderShareCodeIdentity(this.params).then(response => {
  68. if (response.code == 0) {
  69. // 初始化订单商品数据
  70. console.log(response.msg)
  71. this.getOrderCommodityData()
  72. } else if (response.code == 1) {
  73. // 同为会所运营人员查看订单详情
  74. this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderId=${this.params.orderId}`)
  75. } else if (response.code == 2) {
  76. // 协销查看分享订单
  77. this.$api.navigateTo(
  78. `/pages/seller/order/order-details?type=share&orderId=${this.params.orderId}&userId=${
  79. this.params.userId
  80. }`
  81. )
  82. } else if (response.code == 3) {
  83. // 游客第二次查看订单详情
  84. this.$api.redirectTo(
  85. `/pages/user/order/order-sharedetails?orderId=${this.params.orderId}&userId=${
  86. this.params.userId
  87. }`
  88. )
  89. } else {
  90. // 错误信息返回
  91. this.$util.modal('提示', response.msg, '确定', '', false, () => {})
  92. }
  93. })
  94. },
  95. getOrderCommodityData() {
  96. //查询订单商品信息s
  97. this.OrderService.OrderCommodityData({ orderId: this.params.orderId })
  98. .then(response => {
  99. this.productList = response.data
  100. this.isShareStatus = true
  101. })
  102. .catch(error => {
  103. this.$util.msg(error.msg, 2000)
  104. })
  105. },
  106. goLogin(index) {
  107. switch (index) {
  108. case 1:
  109. this.$store.commit('setLoginType', 7)
  110. this.$store.commit('setLoginOrderId', this.params.orderId)
  111. this.$api.navigateTo('/pages/login/login')
  112. break
  113. case 2:
  114. this.$api.navigateTo(
  115. `/pages/user/order/orderShareLogin?orderId=${this.params.orderId}&userId=${this.params.userId}`
  116. )
  117. break
  118. }
  119. },
  120. btnConfirmPay() {
  121. // 待支付订单
  122. this.$api.navigateTo(`/pages/user/order/order-payment?type=payfirm&orderId=${this.params.orderId}`)
  123. }
  124. },
  125. onShow() {}
  126. }
  127. </script>
  128. <style lang="scss">
  129. .login {
  130. width: 100%;
  131. height: 100%;
  132. background: #f7f7f7;
  133. .model-warp.none {
  134. display: none;
  135. }
  136. .model-warp.show {
  137. display: block;
  138. }
  139. .container-main {
  140. width: 100%;
  141. height: auto;
  142. padding-top: 80rpx;
  143. padding-bottom: 352rpx;
  144. .main-title {
  145. width: 100%;
  146. height: 80rpx;
  147. padding: 0 20rpx;
  148. background-color: #f7f7f7;
  149. line-height: 80rpx;
  150. text-align: left;
  151. font-size: $font-size-30;
  152. color: #333;
  153. box-sizing: border-box;
  154. position: fixed;
  155. top: 0;
  156. left: 0;
  157. }
  158. .main-list {
  159. box-sizing: border-box;
  160. width: 100%;
  161. height: auto;
  162. background-color: #ffffff;
  163. .main-list-item {
  164. box-sizing: border-box;
  165. width: 100%;
  166. height: 200rpx;
  167. padding: 20rpx;
  168. border-bottom: 1px solid #f7f7f7;
  169. .item-image {
  170. width: 160rpx;
  171. height: 160rpx;
  172. float: left;
  173. image {
  174. width: 160rpx;
  175. height: 160rpx;
  176. display: block;
  177. }
  178. }
  179. .item-mesage {
  180. width: 530rpx;
  181. height: 160rpx;
  182. float: left;
  183. margin-left: 20rpx;
  184. .item-name {
  185. width: 100%;
  186. height: 84rpx;
  187. line-height: 42rpx;
  188. font-size: $font-size-28;
  189. color: #333333;
  190. text-align: justify;
  191. text-overflow: ellipsis;
  192. display: -webkit-box;
  193. word-break: break-all;
  194. -webkit-box-orient: vertical;
  195. -webkit-line-clamp: 2;
  196. overflow: hidden;
  197. }
  198. .item-num {
  199. width: 100%;
  200. height: 46rpx;
  201. line-height: 46rpx;
  202. margin-top: 30rpx;
  203. font-size: $font-size-28;
  204. color: #333333;
  205. text-align: left;
  206. text {
  207. font-size: $font-size-20;
  208. }
  209. }
  210. }
  211. }
  212. }
  213. }
  214. .login-btn {
  215. width: 600rpx;
  216. height: 88rpx;
  217. font-size: $font-size-28;
  218. line-height: 88rpx;
  219. color: #ffffff;
  220. margin: 0 auto;
  221. margin-bottom: 24rpx;
  222. text-align: center;
  223. background: $btn-confirm;
  224. border-radius: 50rpx;
  225. }
  226. .login-sub {
  227. width: 600rpx;
  228. height: 88rpx;
  229. margin: 0 auto;
  230. margin-bottom: 24rpx;
  231. display: flex;
  232. .btn {
  233. flex: 1;
  234. width: 288rpx;
  235. height: 88rpx;
  236. box-sizing: border-box;
  237. border: 1px solid #b2b2b2;
  238. text-align: center;
  239. line-height: 88rpx;
  240. margin: 0 12rpx;
  241. font-size: $font-size-30;
  242. color: #333333;
  243. border-radius: 50rpx;
  244. }
  245. }
  246. .container-footer {
  247. box-sizing: border-box;
  248. width: 100%;
  249. height: auto;
  250. padding: 0 24rpx;
  251. padding-top: 24rpx;
  252. padding-bottom: 24rpx;
  253. background-color: #ffffff;
  254. position: fixed;
  255. bottom: 0;
  256. left: 0;
  257. }
  258. .pay-statustext {
  259. width: 100%;
  260. height: auto;
  261. float: left;
  262. .pay-statustext-inner {
  263. width: 600rpx;
  264. margin: 0 auto;
  265. .pay-text {
  266. width: 600rpx;
  267. height: 100%;
  268. float: left;
  269. line-height: 40rpx;
  270. font-size: $font-size-26;
  271. color: #fea785;
  272. text-align: justify;
  273. }
  274. }
  275. }
  276. }
  277. </style>