order-sharelogin.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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. />
  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. shopOrderId: 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], 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.shopOrderId = e.shopOrderId
  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&shopOrderId=${this.params.shopOrderId}`)
  105. } else if (res.code === 2) {
  106. // 协销查看分享订单
  107. this.$api.navigateTo(
  108. `/pages/seller/order/order-details?type=share&shopOrderId=${this.params.shopOrderId}&userId=${
  109. this.params.userId
  110. }`
  111. )
  112. } else if (res.code === 3) {
  113. // 游客第二次查看订单详情
  114. this.$api.redirectTo(
  115. `/pages/user/order/order-sharedetails?shopOrderId=${this.params.shopOrderId}&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({ shopOrderId: this.params.shopOrderId })
  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.shopOrderId)
  149. },
  150. async getOrderPaymentValidation(shopOrderId) {
  151. //监听根据付款状态做操作
  152. try{
  153. const res = await this.OrderService.OrderPaymentValidation({ shopOrderId: shopOrderId })
  154. const data = res.data
  155. if(data.code == -1){
  156. this.modal = true
  157. this.contentModalText ='订单已申请全部退款,无需再付款!'
  158. }else{
  159. this.$api.navigateTo(`/pages/user/order/order-pay-list?shopOrderId=${shopOrderId}`)
  160. }
  161. }catch(error){
  162. this.$util.msg(error.msg, 2000)
  163. }
  164. },
  165. goLogin(index) {
  166. switch (index) {
  167. case 1:
  168. this.$store.commit('setLoginType', 7)
  169. this.$store.commit('setLoginOrderId', this.params.shopOrderId)
  170. this.$api.navigateTo('/pages/login/login')
  171. break
  172. case 2:
  173. this.$api.navigateTo(
  174. `/pages/user/order/orderShareLogin?shopOrderId=${this.params.shopOrderId}&userId=${this.params.userId}`
  175. )
  176. break
  177. }
  178. },
  179. handleClick(e){
  180. //确认操作
  181. if (e.index == 1) {
  182. this.modal = false
  183. }
  184. this.modal = false
  185. },
  186. },
  187. onShow() {}
  188. }
  189. </script>
  190. <style lang="scss">
  191. .login {
  192. width: 100%;
  193. height: 100%;
  194. background: #f7f7f7;
  195. .model-warp.none {
  196. display: none;
  197. }
  198. .model-warp.show {
  199. display: block;
  200. }
  201. .container-main {
  202. width: 100%;
  203. height: auto;
  204. padding-top: 80rpx;
  205. padding-bottom: 352rpx;
  206. .main-title {
  207. width: 100%;
  208. height: 80rpx;
  209. padding: 0 20rpx;
  210. background-color: #f7f7f7;
  211. line-height: 80rpx;
  212. text-align: left;
  213. font-size: $font-size-30;
  214. color: #333;
  215. box-sizing: border-box;
  216. position: fixed;
  217. top: 0;
  218. left: 0;
  219. }
  220. .main-list {
  221. box-sizing: border-box;
  222. width: 100%;
  223. height: auto;
  224. background-color: #ffffff;
  225. .main-list-item {
  226. box-sizing: border-box;
  227. width: 100%;
  228. height: 200rpx;
  229. padding: 20rpx;
  230. border-bottom: 1px solid #f7f7f7;
  231. .item-image {
  232. width: 160rpx;
  233. height: 160rpx;
  234. float: left;
  235. image {
  236. width: 160rpx;
  237. height: 160rpx;
  238. display: block;
  239. }
  240. }
  241. .item-mesage {
  242. width: 530rpx;
  243. height: 160rpx;
  244. float: left;
  245. margin-left: 20rpx;
  246. .item-name {
  247. width: 100%;
  248. height: 84rpx;
  249. line-height: 42rpx;
  250. font-size: $font-size-28;
  251. color: #333333;
  252. text-align: justify;
  253. text-overflow: ellipsis;
  254. display: -webkit-box;
  255. word-break: break-all;
  256. -webkit-box-orient: vertical;
  257. -webkit-line-clamp: 2;
  258. overflow: hidden;
  259. }
  260. .item-num {
  261. width: 100%;
  262. height: 46rpx;
  263. line-height: 46rpx;
  264. margin-top: 30rpx;
  265. font-size: $font-size-28;
  266. color: #333333;
  267. text-align: left;
  268. text {
  269. font-size: $font-size-20;
  270. }
  271. }
  272. }
  273. }
  274. }
  275. }
  276. .login-btn {
  277. width: 600rpx;
  278. height: 88rpx;
  279. font-size: $font-size-28;
  280. line-height: 88rpx;
  281. color: #ffffff;
  282. margin: 0 auto;
  283. margin-bottom: 24rpx;
  284. text-align: center;
  285. background: $btn-confirm;
  286. border-radius: 50rpx;
  287. }
  288. .login-sub {
  289. width: 600rpx;
  290. height: 88rpx;
  291. margin: 0 auto;
  292. margin-bottom: 24rpx;
  293. display: flex;
  294. .btn {
  295. flex: 1;
  296. width: 600rpx;
  297. height: 88rpx;
  298. box-sizing: border-box;
  299. border: 1px solid #b2b2b2;
  300. text-align: center;
  301. line-height: 88rpx;
  302. margin: 0 12rpx;
  303. font-size: $font-size-30;
  304. color: #333333;
  305. border-radius: 50rpx;
  306. }
  307. }
  308. .container-footer {
  309. box-sizing: border-box;
  310. width: 100%;
  311. height: auto;
  312. padding: 0 24rpx;
  313. padding-top: 24rpx;
  314. padding-bottom: 24rpx;
  315. background-color: #ffffff;
  316. position: fixed;
  317. bottom: 0;
  318. left: 0;
  319. }
  320. }
  321. </style>