order-sharelogin.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <view class="container login">
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. ></tui-skeleton>
  10. <template v-else>
  11. <view class="container-main clearfix">
  12. <view class="main-title">此订单包含如下商品:</view>
  13. <view class="main-list clearfix">
  14. <view class="main-list-item" v-for="(item, index) in productList" :key="index">
  15. <view class="item-image"> <image :src="item.image" mode="scaleToFill"></image> </view>
  16. <view class="item-mesage">
  17. <view class="item-name">{{ item.name }}</view>
  18. <view class="item-num"><text>X</text>{{ item.num }}</view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="container-footer" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  24. <view class="login-btn" v-if="btnState.isPay" @click.stop="btnConfirmPay">立即支付</view>
  25. <view class="login-sub">
  26. <view class="btn" @click.stop="goLogin(2)">使用分享码查看</view>
  27. </view>
  28. </view>
  29. </template>
  30. <!-- 提示弹窗 -->
  31. <tui-modal
  32. :show="modal"
  33. @click="handleClick"
  34. :content="contentModalText"
  35. :button="modalButton"
  36. color="#333"
  37. :size="32"
  38. shape="circle"
  39. :maskClosable="false"
  40. >
  41. </tui-modal>
  42. </view>
  43. </template>
  44. <script>
  45. import authorize from '@/common/config/authorize.js'
  46. export default {
  47. data() {
  48. return {
  49. isIphoneX: this.$store.state.isIphoneX,
  50. shareCode: '', //获取用户登录的邀请码
  51. isUserInfo: false, //控制显示授权弹窗
  52. skeletonShow: true,
  53. productList: [],
  54. params: {
  55. code: '',
  56. iv: '',
  57. encryptedData: '',
  58. orderId: 0, //订单ID
  59. userId: 0, //机构用户ID
  60. serviceProviderId: 0 //协销ID
  61. },
  62. btnState: {
  63. isPay:false
  64. },
  65. mapStateArr: [
  66. { label: 'isPay', val: [11, 12, 13, 21, 22, 23, 111], status: true }
  67. ],
  68. modal:false,
  69. contentModalText: '', //操作文字提示语句
  70. modalButton: [
  71. {
  72. text: '确定',
  73. customStyle: {
  74. color: '#fff',
  75. bgColor: '#F3B574'
  76. },
  77. plain: false
  78. }
  79. ]
  80. }
  81. },
  82. onLoad(e) {
  83. console.log(e)
  84. this.params.orderId = e.orderId
  85. this.params.userId = e.userId
  86. if (e.serviceProviderId) {
  87. this.params.serviceProviderId = e.serviceProviderId
  88. }
  89. this.initQueryUser()
  90. },
  91. methods: {
  92. async initQueryUser() {
  93. try{
  94. const getUserInfo = await authorize.getUserInfo('weixin')
  95. this.params.code = await authorize.getCode('weixin')
  96. this.params.iv = getUserInfo.iv
  97. this.params.encryptedData = getUserInfo.encryptedData
  98. const res = await this.OrderService.OrderShareCodeIdentity(this.params)
  99. if(res.code === 0){
  100. // 初始化订单商品数据
  101. this.getOrderCommodityData()
  102. }else if (res.code === 1) {
  103. // 同为会所运营人员查看订单详情
  104. this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderId=${this.params.orderId}`)
  105. } else if (res.code === 2) {
  106. // 协销查看分享订单
  107. this.$api.navigateTo(
  108. `/pages/seller/order/order-details?type=share&orderId=${this.params.orderId}&userId=${
  109. this.params.userId
  110. }`
  111. )
  112. } else if (res.code === 3) {
  113. // 游客第二次查看订单详情
  114. this.$api.redirectTo(
  115. `/pages/user/order/order-sharedetails?orderId=${this.params.orderId}&userId=${
  116. this.params.userId
  117. }`
  118. )
  119. } else {
  120. this.modal = true
  121. this.contentModalText = res.msg
  122. }
  123. }catch(error){
  124. // 错误信息返回
  125. console.log(error)
  126. }
  127. },
  128. async getOrderCommodityData() {
  129. //查询订单商品信息s
  130. try{
  131. const res = await this.OrderService.OrderCommodityData({ orderId: this.params.orderId })
  132. const data = res.data
  133. this.productList = data.productList
  134. this.mapStateArr.forEach(el => {
  135. el.val.forEach(value => {
  136. if (!data.payButton && data.orderStatus === value) {
  137. this.btnState[el.label] = el.status
  138. }
  139. })
  140. })
  141. this.skeletonShow = false
  142. }catch(error){
  143. console.log('查询订单商品信息失败')
  144. }
  145. },
  146. btnConfirmPay() {
  147. // 待支付订单
  148. this.getOrderPaymentValidation(this.params.orderId)
  149. },
  150. async getOrderPaymentValidation(orderId) {
  151. //监听根据付款状态做操作
  152. try{
  153. const res = await this.OrderService.OrderPaymentValidation({ orderId: orderId })
  154. const data = res.data
  155. if(data.code == -1){
  156. this.modal = true
  157. this.contentModalText ='订单已申请全部退款,无需再付款!'
  158. }else{
  159. if (data.onlinePayFlag === 1) {// 只能线下
  160. this.$api.navigateTo(`/pages/user/pay/card-under?orderId=${orderId}`)
  161. } else {
  162. this.$api.navigateTo(`/pages/user/order/order-pay-list?orderId=${orderId}`)
  163. }
  164. }
  165. }catch(error){
  166. this.$util.msg(error.msg, 2000)
  167. }
  168. },
  169. goLogin(index) {
  170. switch (index) {
  171. case 1:
  172. this.$store.commit('setLoginType', 7)
  173. this.$store.commit('setLoginOrderId', this.params.orderId)
  174. this.$api.navigateTo('/pages/login/login')
  175. break
  176. case 2:
  177. this.$api.navigateTo(
  178. `/pages/user/order/orderShareLogin?orderId=${this.params.orderId}&userId=${this.params.userId}`
  179. )
  180. break
  181. }
  182. },
  183. handleClick(e){
  184. //确认操作
  185. if (e.index == 1) {
  186. this.modal = false
  187. }
  188. this.modal = false
  189. },
  190. },
  191. onShow() {}
  192. }
  193. </script>
  194. <style lang="scss">
  195. .login {
  196. width: 100%;
  197. height: 100%;
  198. background: #f7f7f7;
  199. .model-warp.none {
  200. display: none;
  201. }
  202. .model-warp.show {
  203. display: block;
  204. }
  205. .container-main {
  206. width: 100%;
  207. height: auto;
  208. padding-top: 80rpx;
  209. padding-bottom: 352rpx;
  210. .main-title {
  211. width: 100%;
  212. height: 80rpx;
  213. padding: 0 20rpx;
  214. background-color: #f7f7f7;
  215. line-height: 80rpx;
  216. text-align: left;
  217. font-size: $font-size-30;
  218. color: #333;
  219. box-sizing: border-box;
  220. position: fixed;
  221. top: 0;
  222. left: 0;
  223. }
  224. .main-list {
  225. box-sizing: border-box;
  226. width: 100%;
  227. height: auto;
  228. background-color: #ffffff;
  229. .main-list-item {
  230. box-sizing: border-box;
  231. width: 100%;
  232. height: 200rpx;
  233. padding: 20rpx;
  234. border-bottom: 1px solid #f7f7f7;
  235. .item-image {
  236. width: 160rpx;
  237. height: 160rpx;
  238. float: left;
  239. image {
  240. width: 160rpx;
  241. height: 160rpx;
  242. display: block;
  243. }
  244. }
  245. .item-mesage {
  246. width: 530rpx;
  247. height: 160rpx;
  248. float: left;
  249. margin-left: 20rpx;
  250. .item-name {
  251. width: 100%;
  252. height: 84rpx;
  253. line-height: 42rpx;
  254. font-size: $font-size-28;
  255. color: #333333;
  256. text-align: justify;
  257. text-overflow: ellipsis;
  258. display: -webkit-box;
  259. word-break: break-all;
  260. -webkit-box-orient: vertical;
  261. -webkit-line-clamp: 2;
  262. overflow: hidden;
  263. }
  264. .item-num {
  265. width: 100%;
  266. height: 46rpx;
  267. line-height: 46rpx;
  268. margin-top: 30rpx;
  269. font-size: $font-size-28;
  270. color: #333333;
  271. text-align: left;
  272. text {
  273. font-size: $font-size-20;
  274. }
  275. }
  276. }
  277. }
  278. }
  279. }
  280. .login-btn {
  281. width: 600rpx;
  282. height: 88rpx;
  283. font-size: $font-size-28;
  284. line-height: 88rpx;
  285. color: #ffffff;
  286. margin: 0 auto;
  287. margin-bottom: 24rpx;
  288. text-align: center;
  289. background: $btn-confirm;
  290. border-radius: 50rpx;
  291. }
  292. .login-sub {
  293. width: 600rpx;
  294. height: 88rpx;
  295. margin: 0 auto;
  296. margin-bottom: 24rpx;
  297. display: flex;
  298. .btn {
  299. flex: 1;
  300. width: 600rpx;
  301. height: 88rpx;
  302. box-sizing: border-box;
  303. border: 1px solid #b2b2b2;
  304. text-align: center;
  305. line-height: 88rpx;
  306. margin: 0 12rpx;
  307. font-size: $font-size-30;
  308. color: #333333;
  309. border-radius: 50rpx;
  310. }
  311. }
  312. .container-footer {
  313. box-sizing: border-box;
  314. width: 100%;
  315. height: auto;
  316. padding: 0 24rpx;
  317. padding-top: 24rpx;
  318. padding-bottom: 24rpx;
  319. background-color: #ffffff;
  320. position: fixed;
  321. bottom: 0;
  322. left: 0;
  323. }
  324. }
  325. </style>