鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

194 lines
4.6 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="订单详情" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="main">
  5. <productCard :data="productCardData"></productCard>
  6. <orderInfoView :data="detail"></orderInfoView>
  7. <view class="notice">
  8. <view class="notice-header">下单须知</view>
  9. <view class="notice-content">
  10. <uv-parse :content="configList['order_instructions']"></uv-parse>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="bottom">
  15. <view class="flex bar">
  16. <button plain class="flex flex-column btn btn-simple" open-type="contact">
  17. <image class="icon" src="@/pages_order/static/product/icon-service.png" mode="widthFix"></image>
  18. <view>联系客服</view>
  19. </button>
  20. <!-- 已支付 -->
  21. <template v-if="detail.status == 1">
  22. <button class="col btn" @click="onContactMentor">联系导师</button>
  23. <button class="col btn" @click.stop="onFinish">已完成</button>
  24. </template>
  25. <!-- 待评价 -->
  26. <template v-else-if="data.status == 2">
  27. <button class="col btn" @click="onComment">立即评价</button>
  28. <button class="col btn" @click="onApplyService">申请售后</button>
  29. </template>
  30. <view class="col" v-else></view>
  31. </view>
  32. </view>
  33. <contactMentorPopup ref="contactMentorPopup"></contactMentorPopup>
  34. <commentPopup ref="commentPopup" @submitted="getData"></commentPopup>
  35. <servicePopup ref="servicePopup"></servicePopup>
  36. </view>
  37. </template>
  38. <script>
  39. import { mapState } from 'vuex'
  40. import productCard from '@/pages_order/order/components/productCard.vue'
  41. import orderInfoView from '@/pages_order/order/components/orderInfoView.vue'
  42. import contactMentorPopup from '@/pages_order/order/components/contactMentorPopup.vue'
  43. import commentPopup from '@/pages_order/comment/commentPopup.vue'
  44. import servicePopup from '@/components/base/servicePopup.vue'
  45. export default {
  46. components: {
  47. productCard,
  48. orderInfoView,
  49. contactMentorPopup,
  50. commentPopup,
  51. servicePopup,
  52. },
  53. data() {
  54. return {
  55. id: null,
  56. detail: {},
  57. }
  58. },
  59. computed: {
  60. ...mapState(['configList', 'userInfo', 'orderInfo']),
  61. productCardData() {
  62. const {
  63. activityId,
  64. activityTitle,
  65. activityBrief,
  66. activityTag,
  67. startDate,
  68. endDate,
  69. } = this.detail
  70. return {
  71. time: 'time',
  72. product: {
  73. id: activityId,
  74. title: activityTitle,
  75. brief: activityBrief,
  76. tagDetails: activityTag,
  77. dateList: [
  78. {
  79. id: 'time',
  80. startDate,
  81. endDate,
  82. }
  83. ]
  84. }
  85. }
  86. },
  87. },
  88. onLoad(arg) {
  89. const { id } = arg
  90. this.id = id
  91. this.getData()
  92. },
  93. async onPullDownRefresh() {
  94. await this.getData()
  95. uni.stopPullDownRefresh()
  96. },
  97. methods: {
  98. async getData() {
  99. try {
  100. this.detail = await this.$fetch('queryOrderById', { orderId: this.id })
  101. } catch (err) {
  102. }
  103. uni.stopPullDownRefresh()
  104. },
  105. onComment() {
  106. this.$refs.commentPopup.open(this.id, this.detail)
  107. },
  108. onApplyService() {
  109. this.$refs.servicePopup.open()
  110. },
  111. onContactMentor() {
  112. this.$refs.contactMentorPopup.open(this.detail.teacherPhone)
  113. },
  114. async onFinish() {
  115. try {
  116. await this.$fetch('updateOrder', { id: this.id, status: '2' }) // 订单状态 0待支付 1已支付 2已完成
  117. this.getData()
  118. } catch (err) {
  119. }
  120. },
  121. },
  122. }
  123. </script>
  124. <style scoped lang="scss">
  125. @import '../styles/style.scss';
  126. .bottom {
  127. .bar {
  128. .price {
  129. justify-content: flex-start;
  130. column-gap: 8rpx;
  131. &-label {
  132. font-size: 24rpx;
  133. color: #626262;
  134. }
  135. &-unit,
  136. &-value {
  137. font-weight: 500;
  138. color: #FF4800;
  139. }
  140. &-unit {
  141. font-size: 24rpx;
  142. }
  143. &-value {
  144. font-size: 40rpx;
  145. }
  146. }
  147. .btn-simple {
  148. flex: none;
  149. width: auto;
  150. font-family: PingFang SC;
  151. font-weight: 400;
  152. font-size: 22rpx;
  153. line-height: 1.1;
  154. color: #999999;
  155. border: none;
  156. border-radius: unset;
  157. .icon {
  158. width: 52rpx;
  159. height: auto;
  160. margin-bottom: 4rpx;
  161. }
  162. }
  163. }
  164. }
  165. </style>