order-sharelogin.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  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" v-if="btnState.isPay" @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. btnState: {
  51. isPay:false
  52. },
  53. mapStateArr: [
  54. { label: 'isPay', val: [11, 12, 13, 21, 22, 23, 111], status: true }
  55. ]
  56. }
  57. },
  58. onLoad(e) {
  59. console.log(e)
  60. this.params.orderId = e.orderId
  61. this.params.userId = e.userId
  62. if (e.serviceProviderId) {
  63. this.params.serviceProviderId = e.serviceProviderId
  64. }
  65. this.initQueryUser()
  66. },
  67. methods: {
  68. async initQueryUser() {
  69. const getUserInfo = await authorize.getUserInfo('weixin')
  70. this.params.code = await authorize.getCode('weixin')
  71. this.params.iv = getUserInfo.iv
  72. this.params.encryptedData = getUserInfo.encryptedData
  73. this.OrderService.OrderShareCodeIdentity(this.params).then(response => {
  74. if (response.code == 0) {
  75. // 初始化订单商品数据
  76. console.log(response.msg)
  77. this.getOrderCommodityData()
  78. } else if (response.code == 1) {
  79. // 同为会所运营人员查看订单详情
  80. this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderId=${this.params.orderId}`)
  81. } else if (response.code == 2) {
  82. // 协销查看分享订单
  83. this.$api.navigateTo(
  84. `/pages/seller/order/order-details?type=share&orderId=${this.params.orderId}&userId=${
  85. this.params.userId
  86. }`
  87. )
  88. } else if (response.code == 3) {
  89. // 游客第二次查看订单详情
  90. this.$api.redirectTo(
  91. `/pages/user/order/order-sharedetails?orderId=${this.params.orderId}&userId=${
  92. this.params.userId
  93. }`
  94. )
  95. } else {
  96. // 错误信息返回
  97. this.$util.modal('提示', response.msg, '确定', '', false, () => {})
  98. }
  99. })
  100. },
  101. getOrderCommodityData() {
  102. //查询订单商品信息s
  103. this.OrderService.OrderCommodityData({ orderId: this.params.orderId })
  104. .then(response => {
  105. const data = response.data
  106. this.productList = data.productList
  107. this.mapStateArr.forEach(el => {
  108. el.val.forEach(value => {
  109. if (!data.payButton && data.orderStatus === value) {
  110. this.btnState[el.label] = el.status
  111. }
  112. })
  113. })
  114. this.isShareStatus = true
  115. })
  116. .catch(error => {
  117. this.$util.msg(error.msg, 2000)
  118. })
  119. },
  120. goLogin(index) {
  121. switch (index) {
  122. case 1:
  123. this.$store.commit('setLoginType', 7)
  124. this.$store.commit('setLoginOrderId', this.params.orderId)
  125. this.$api.navigateTo('/pages/login/login')
  126. break
  127. case 2:
  128. this.$api.navigateTo(
  129. `/pages/user/order/orderShareLogin?orderId=${this.params.orderId}&userId=${this.params.userId}`
  130. )
  131. break
  132. }
  133. },
  134. btnConfirmPay() {
  135. // 待支付订单
  136. this.getOrderPaymentValidation(this.params.orderId)
  137. },
  138. getOrderPaymentValidation(orderId) {
  139. //监听根据付款状态做操作
  140. this.OrderService.OrderPaymentValidation({ orderId: orderId })
  141. .then(response => {
  142. if(response.data.code == -1){
  143. this.$util.modal('', '订单已申请全部退款,无需再付款!', '确定', '', false, () => {})
  144. }else{
  145. if (response.data.onlinePayFlag === 1) {// 只能线下
  146. this.$api.navigateTo(`/pages/user/pay/card-under?orderId=${orderId}`)
  147. } else {
  148. this.$api.navigateTo(`/pages/user/order/order-pay-list?orderId=${orderId}`)
  149. }
  150. }
  151. })
  152. .catch(error => {
  153. this.$util.msg(error.msg, 2000)
  154. })
  155. },
  156. },
  157. onShow() {}
  158. }
  159. </script>
  160. <style lang="scss">
  161. .login {
  162. width: 100%;
  163. height: 100%;
  164. background: #f7f7f7;
  165. .model-warp.none {
  166. display: none;
  167. }
  168. .model-warp.show {
  169. display: block;
  170. }
  171. .container-main {
  172. width: 100%;
  173. height: auto;
  174. padding-top: 80rpx;
  175. padding-bottom: 352rpx;
  176. .main-title {
  177. width: 100%;
  178. height: 80rpx;
  179. padding: 0 20rpx;
  180. background-color: #f7f7f7;
  181. line-height: 80rpx;
  182. text-align: left;
  183. font-size: $font-size-30;
  184. color: #333;
  185. box-sizing: border-box;
  186. position: fixed;
  187. top: 0;
  188. left: 0;
  189. }
  190. .main-list {
  191. box-sizing: border-box;
  192. width: 100%;
  193. height: auto;
  194. background-color: #ffffff;
  195. .main-list-item {
  196. box-sizing: border-box;
  197. width: 100%;
  198. height: 200rpx;
  199. padding: 20rpx;
  200. border-bottom: 1px solid #f7f7f7;
  201. .item-image {
  202. width: 160rpx;
  203. height: 160rpx;
  204. float: left;
  205. image {
  206. width: 160rpx;
  207. height: 160rpx;
  208. display: block;
  209. }
  210. }
  211. .item-mesage {
  212. width: 530rpx;
  213. height: 160rpx;
  214. float: left;
  215. margin-left: 20rpx;
  216. .item-name {
  217. width: 100%;
  218. height: 84rpx;
  219. line-height: 42rpx;
  220. font-size: $font-size-28;
  221. color: #333333;
  222. text-align: justify;
  223. text-overflow: ellipsis;
  224. display: -webkit-box;
  225. word-break: break-all;
  226. -webkit-box-orient: vertical;
  227. -webkit-line-clamp: 2;
  228. overflow: hidden;
  229. }
  230. .item-num {
  231. width: 100%;
  232. height: 46rpx;
  233. line-height: 46rpx;
  234. margin-top: 30rpx;
  235. font-size: $font-size-28;
  236. color: #333333;
  237. text-align: left;
  238. text {
  239. font-size: $font-size-20;
  240. }
  241. }
  242. }
  243. }
  244. }
  245. }
  246. .login-btn {
  247. width: 600rpx;
  248. height: 88rpx;
  249. font-size: $font-size-28;
  250. line-height: 88rpx;
  251. color: #ffffff;
  252. margin: 0 auto;
  253. margin-bottom: 24rpx;
  254. text-align: center;
  255. background: $btn-confirm;
  256. border-radius: 50rpx;
  257. }
  258. .login-sub {
  259. width: 600rpx;
  260. height: 88rpx;
  261. margin: 0 auto;
  262. margin-bottom: 24rpx;
  263. display: flex;
  264. .btn {
  265. flex: 1;
  266. width: 288rpx;
  267. height: 88rpx;
  268. box-sizing: border-box;
  269. border: 1px solid #b2b2b2;
  270. text-align: center;
  271. line-height: 88rpx;
  272. margin: 0 12rpx;
  273. font-size: $font-size-30;
  274. color: #333333;
  275. border-radius: 50rpx;
  276. }
  277. }
  278. .container-footer {
  279. box-sizing: border-box;
  280. width: 100%;
  281. height: auto;
  282. padding: 0 24rpx;
  283. padding-top: 24rpx;
  284. padding-bottom: 24rpx;
  285. background-color: #ffffff;
  286. position: fixed;
  287. bottom: 0;
  288. left: 0;
  289. }
  290. .pay-statustext {
  291. width: 100%;
  292. height: auto;
  293. float: left;
  294. .pay-statustext-inner {
  295. width: 600rpx;
  296. margin: 0 auto;
  297. .pay-text {
  298. width: 600rpx;
  299. height: 100%;
  300. float: left;
  301. line-height: 40rpx;
  302. font-size: $font-size-26;
  303. color: #fea785;
  304. text-align: justify;
  305. }
  306. }
  307. }
  308. }
  309. </style>