order-sharelogin.vue 8.3 KB

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