鸿宇研学生前端代码
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.

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