order-sharelogin.vue 7.5 KB

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