order-sharelogin.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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: [{ label: 'isPay', val: [11, 12, 13, 21, 22, 23, 111], status: true }]
  54. }
  55. },
  56. onLoad(e) {
  57. console.log(e)
  58. this.params.shopOrderId = e.shopOrderId
  59. this.params.userId = e.userId
  60. if (e.serviceProviderId) {
  61. this.params.serviceProviderId = e.serviceProviderId
  62. }
  63. this.initQueryUser()
  64. },
  65. methods: {
  66. async initQueryUser() {
  67. const getUserInfo = await authorize.getUserInfo('weixin')
  68. this.params.code = await authorize.getCode('weixin')
  69. this.params.iv = getUserInfo.iv
  70. this.params.encryptedData = getUserInfo.encryptedData
  71. this.OrderService.OrderShareCodeIdentity(this.params).then(response => {
  72. if (response.code == 0) {
  73. // 初始化订单商品数据
  74. console.log(response.msg)
  75. this.getOrderCommodityData()
  76. } else if (response.code == 1) {
  77. // 同为会所运营人员查看订单详情
  78. this.$api.navigateTo(
  79. `/pages/user/order/order-details?type=share&shopOrderId=${this.params.shopOrderId}`
  80. )
  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=${
  130. this.params.userId
  131. }`
  132. )
  133. break
  134. }
  135. },
  136. btnConfirmPay() {
  137. //监听根据付款状态做操作
  138. this.OrderService.OrderPaymentValidation({ orderId: this.params.shopOrderId })
  139. .then(response => {
  140. if (response.data.code == -1) {
  141. this.$util.modal('', '订单已申请全部退款,无需再付款!', '确定', '', false, () => {})
  142. } else {
  143. this.$api.navigateTo(`/pages/user/order/order-pay-list?shopOrderId=${this.params.shopOrderId}`)
  144. }
  145. })
  146. .catch(error => {
  147. this.$util.msg(error.msg, 2000)
  148. })
  149. }
  150. },
  151. onShow() {}
  152. }
  153. </script>
  154. <style lang="scss">
  155. .login {
  156. width: 100%;
  157. height: 100%;
  158. background: #f7f7f7;
  159. .model-warp.none {
  160. display: none;
  161. }
  162. .model-warp.show {
  163. display: block;
  164. }
  165. .container-main {
  166. width: 100%;
  167. height: auto;
  168. padding-top: 80rpx;
  169. padding-bottom: 352rpx;
  170. .main-title {
  171. width: 100%;
  172. height: 80rpx;
  173. padding: 0 20rpx;
  174. background-color: #f7f7f7;
  175. line-height: 80rpx;
  176. text-align: left;
  177. font-size: $font-size-30;
  178. color: #333;
  179. box-sizing: border-box;
  180. position: fixed;
  181. top: 0;
  182. left: 0;
  183. }
  184. .main-list {
  185. box-sizing: border-box;
  186. width: 100%;
  187. height: auto;
  188. background-color: #ffffff;
  189. .main-list-item {
  190. box-sizing: border-box;
  191. width: 100%;
  192. height: 200rpx;
  193. padding: 20rpx;
  194. border-bottom: 1px solid #f7f7f7;
  195. .item-image {
  196. width: 160rpx;
  197. height: 160rpx;
  198. float: left;
  199. image {
  200. width: 160rpx;
  201. height: 160rpx;
  202. display: block;
  203. }
  204. }
  205. .item-mesage {
  206. width: 530rpx;
  207. height: 160rpx;
  208. float: left;
  209. margin-left: 20rpx;
  210. .item-name {
  211. width: 100%;
  212. height: 84rpx;
  213. line-height: 42rpx;
  214. font-size: $font-size-28;
  215. color: #333333;
  216. text-align: justify;
  217. text-overflow: ellipsis;
  218. display: -webkit-box;
  219. word-break: break-all;
  220. -webkit-box-orient: vertical;
  221. -webkit-line-clamp: 2;
  222. overflow: hidden;
  223. }
  224. .item-num {
  225. width: 100%;
  226. height: 46rpx;
  227. line-height: 46rpx;
  228. margin-top: 30rpx;
  229. font-size: $font-size-28;
  230. color: #333333;
  231. text-align: left;
  232. text {
  233. font-size: $font-size-20;
  234. }
  235. }
  236. }
  237. }
  238. }
  239. }
  240. .login-btn {
  241. width: 600rpx;
  242. height: 88rpx;
  243. font-size: $font-size-28;
  244. line-height: 88rpx;
  245. color: #ffffff;
  246. margin: 0 auto;
  247. margin-bottom: 24rpx;
  248. text-align: center;
  249. background: $btn-confirm;
  250. border-radius: 50rpx;
  251. }
  252. .login-sub {
  253. width: 600rpx;
  254. height: 88rpx;
  255. margin: 0 auto;
  256. margin-bottom: 24rpx;
  257. display: flex;
  258. .btn {
  259. flex: 1;
  260. width: 288rpx;
  261. height: 88rpx;
  262. box-sizing: border-box;
  263. border: 1px solid #b2b2b2;
  264. text-align: center;
  265. line-height: 88rpx;
  266. margin: 0 12rpx;
  267. font-size: $font-size-30;
  268. color: #333333;
  269. border-radius: 50rpx;
  270. }
  271. }
  272. .container-footer {
  273. box-sizing: border-box;
  274. width: 100%;
  275. height: auto;
  276. padding: 0 24rpx;
  277. padding-top: 24rpx;
  278. padding-bottom: 24rpx;
  279. background-color: #ffffff;
  280. position: fixed;
  281. bottom: 0;
  282. left: 0;
  283. }
  284. .pay-statustext {
  285. width: 100%;
  286. height: auto;
  287. float: left;
  288. .pay-statustext-inner {
  289. width: 600rpx;
  290. margin: 0 auto;
  291. .pay-text {
  292. width: 600rpx;
  293. height: 100%;
  294. float: left;
  295. line-height: 40rpx;
  296. font-size: $font-size-26;
  297. color: #fea785;
  298. text-align: justify;
  299. }
  300. }
  301. }
  302. }
  303. </style>