order-sharelogin.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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.getOrderPaymentValidation(this.params.orderId)
  123. },
  124. getOrderPaymentValidation(orderId) {
  125. //监听根据付款状态做操作
  126. this.OrderService.OrderPaymentValidation({ orderId: orderId })
  127. .then(response => {
  128. this.payModelData = response.data
  129. if(response.data.code == -1){
  130. this.$util.modal('', '订单已申请全部退款,无需再付款!', '确定', '', false, () => {})
  131. }else{
  132. if (response.data.onlinePayFlag === 1) {
  133. this.$api.navigateTo(
  134. `/pages/user/order/order-payment?type=onlinePay&Amount=${
  135. response.data.pendingPayments
  136. }&orderId=${orderId}`
  137. )
  138. } else {
  139. this.$api.navigateTo(
  140. `/pages/user/order/order-payment?type=payfirm&orderId=${orderId}`
  141. )
  142. }
  143. }
  144. })
  145. .catch(error => {
  146. this.$util.msg(error.msg, 2000)
  147. })
  148. },
  149. },
  150. onShow() {}
  151. }
  152. </script>
  153. <style lang="scss">
  154. .login {
  155. width: 100%;
  156. height: 100%;
  157. background: #f7f7f7;
  158. .model-warp.none {
  159. display: none;
  160. }
  161. .model-warp.show {
  162. display: block;
  163. }
  164. .container-main {
  165. width: 100%;
  166. height: auto;
  167. padding-top: 80rpx;
  168. padding-bottom: 352rpx;
  169. .main-title {
  170. width: 100%;
  171. height: 80rpx;
  172. padding: 0 20rpx;
  173. background-color: #f7f7f7;
  174. line-height: 80rpx;
  175. text-align: left;
  176. font-size: $font-size-30;
  177. color: #333;
  178. box-sizing: border-box;
  179. position: fixed;
  180. top: 0;
  181. left: 0;
  182. }
  183. .main-list {
  184. box-sizing: border-box;
  185. width: 100%;
  186. height: auto;
  187. background-color: #ffffff;
  188. .main-list-item {
  189. box-sizing: border-box;
  190. width: 100%;
  191. height: 200rpx;
  192. padding: 20rpx;
  193. border-bottom: 1px solid #f7f7f7;
  194. .item-image {
  195. width: 160rpx;
  196. height: 160rpx;
  197. float: left;
  198. image {
  199. width: 160rpx;
  200. height: 160rpx;
  201. display: block;
  202. }
  203. }
  204. .item-mesage {
  205. width: 530rpx;
  206. height: 160rpx;
  207. float: left;
  208. margin-left: 20rpx;
  209. .item-name {
  210. width: 100%;
  211. height: 84rpx;
  212. line-height: 42rpx;
  213. font-size: $font-size-28;
  214. color: #333333;
  215. text-align: justify;
  216. text-overflow: ellipsis;
  217. display: -webkit-box;
  218. word-break: break-all;
  219. -webkit-box-orient: vertical;
  220. -webkit-line-clamp: 2;
  221. overflow: hidden;
  222. }
  223. .item-num {
  224. width: 100%;
  225. height: 46rpx;
  226. line-height: 46rpx;
  227. margin-top: 30rpx;
  228. font-size: $font-size-28;
  229. color: #333333;
  230. text-align: left;
  231. text {
  232. font-size: $font-size-20;
  233. }
  234. }
  235. }
  236. }
  237. }
  238. }
  239. .login-btn {
  240. width: 600rpx;
  241. height: 88rpx;
  242. font-size: $font-size-28;
  243. line-height: 88rpx;
  244. color: #ffffff;
  245. margin: 0 auto;
  246. margin-bottom: 24rpx;
  247. text-align: center;
  248. background: $btn-confirm;
  249. border-radius: 50rpx;
  250. }
  251. .login-sub {
  252. width: 600rpx;
  253. height: 88rpx;
  254. margin: 0 auto;
  255. margin-bottom: 24rpx;
  256. display: flex;
  257. .btn {
  258. flex: 1;
  259. width: 288rpx;
  260. height: 88rpx;
  261. box-sizing: border-box;
  262. border: 1px solid #b2b2b2;
  263. text-align: center;
  264. line-height: 88rpx;
  265. margin: 0 12rpx;
  266. font-size: $font-size-30;
  267. color: #333333;
  268. border-radius: 50rpx;
  269. }
  270. }
  271. .container-footer {
  272. box-sizing: border-box;
  273. width: 100%;
  274. height: auto;
  275. padding: 0 24rpx;
  276. padding-top: 24rpx;
  277. padding-bottom: 24rpx;
  278. background-color: #ffffff;
  279. position: fixed;
  280. bottom: 0;
  281. left: 0;
  282. }
  283. .pay-statustext {
  284. width: 100%;
  285. height: auto;
  286. float: left;
  287. .pay-statustext-inner {
  288. width: 600rpx;
  289. margin: 0 auto;
  290. .pay-text {
  291. width: 600rpx;
  292. height: 100%;
  293. float: left;
  294. line-height: 40rpx;
  295. font-size: $font-size-26;
  296. color: #fea785;
  297. text-align: justify;
  298. }
  299. }
  300. }
  301. }
  302. </style>