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

318 lines
9.5 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="订单详情" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="main">
  5. <productCard :data="detail"></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="agreement">
  17. <uv-checkbox-group
  18. v-model="checkboxValue"
  19. shape="circle"
  20. >
  21. <uv-checkbox
  22. size="40rpx"
  23. icon-size="40rpx"
  24. activeColor="#00A9FF"
  25. :name="1"
  26. ></uv-checkbox>
  27. </uv-checkbox-group>
  28. <view class="desc">
  29. 我已阅读并同意
  30. <!-- todo: 替换配置项key -->
  31. <text class="highlight" @click="$refs.modal.open('config_agreement', '退订政策')">退订政策</text>
  32. <!-- todo: 替换配置项key -->
  33. <text class="highlight" @click="$refs.modal.open('config_privacy', '合同范本')">合同范本</text>
  34. <!-- todo: 替换配置项key -->
  35. <text class="highlight" @click="$refs.modal.open('config_privacy', '预订须知')">预订须知</text>
  36. <!-- todo: 替换配置项key -->
  37. <text class="highlight" @click="$refs.modal.open('config_privacy', '安全提示')">安全提示</text>
  38. </view>
  39. </view>
  40. <view class="flex bar">
  41. <button plain class="flex flex-column btn btn-simple" open-type="contact">
  42. <image class="icon" src="@/pages_order/static/product/icon-service.png" mode="widthFix"></image>
  43. <view>联系客服</view>
  44. </button>
  45. <!-- 已支付 -->
  46. <template v-if="detail.status == 1">
  47. <button class="col btn" @click="onContactMentor">联系导师</button>
  48. </template>
  49. <!-- 待评价 -->
  50. <template v-else-if="data.status == 2">
  51. <button class="btn" @click="onComment">立即评价</button>
  52. </template>
  53. <!-- 已完成 -->
  54. <template v-else-if="detail.status == 3">
  55. <button class="col btn" @click="onApplyService">申请售后</button>
  56. </template>
  57. </view>
  58. </view>
  59. <contactMentorPopup ref="contactMentorPopup"></contactMentorPopup>
  60. <commentPopup ref="commentPopup" @submitted="getData"></commentPopup>
  61. <agreementModal ref="modal" @confirm="onConfirmAgreement"></agreementModal>
  62. </view>
  63. </template>
  64. <script>
  65. import { mapState } from 'vuex'
  66. import productCard from '@/pages_order/order/components/productCard.vue'
  67. import orderInfoView from '@/pages_order/order/components/orderInfoView.vue'
  68. import contactMentorPopup from '@/pages_order/order/components/contactMentorPopup.vue'
  69. import commentPopup from '@/pages_order/comment/commentPopup.vue'
  70. import agreementModal from '@/pages_order/components/agreementModal.vue'
  71. export default {
  72. components: {
  73. productCard,
  74. orderInfoView,
  75. contactMentorPopup,
  76. commentPopup,
  77. agreementModal,
  78. },
  79. data() {
  80. return {
  81. detail: {},
  82. }
  83. },
  84. computed: {
  85. ...mapState(['configList', 'userInfo', 'orderInfo']),
  86. productPackage() {
  87. const { time, product } = this.detail
  88. const { timeOptions } = product || {}
  89. return timeOptions?.find?.(item => item.id === time) || {}
  90. },
  91. totalPrice() {
  92. const { adults, teenager, child, coupon, couponInfo } = this.detail
  93. const { adultsPrice, teenagerPrice, childPrice } = this.productPackage
  94. let total = 0
  95. adults && (total += adults * (adultsPrice || 0))
  96. teenager && (total += teenager * (teenagerPrice || 0))
  97. child && (total += child * (childPrice || 0))
  98. coupon && (total -= (couponInfo?.price || 0))
  99. return total
  100. },
  101. },
  102. onLoad() {
  103. // console.log('orderInfo', this.orderInfo)
  104. // this.detail = this.orderInfo
  105. // todo: check fetch by id?
  106. this.getData()
  107. },
  108. onPullDownRefresh() {
  109. this.getData()
  110. },
  111. methods: {
  112. async getData() {
  113. try {
  114. this.detail = {
  115. product: {
  116. id: '001',
  117. image: new Array(6).fill('/static/image/temp-20.png').join(','),
  118. name: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐',
  119. desc: '每天车程4小时内,含一程高铁丨喀拉峻草原、夏塔古道、昭苏天马、赛里木湖、昭苏油菜花、伊犁薰衣草丨吐鲁番坎儿井&火焰山',
  120. tags: ['坝上草原', '自然探索', '户外探索', '亲子游玩'],
  121. currentPrice: 688.99,
  122. originalPrice: 1200,
  123. registered: 4168,
  124. timeOptions: [
  125. {
  126. id: '0011',
  127. startDate: '08/25',
  128. endDate: '09/01',
  129. currentPrice: 1200.99,
  130. originalPrice: 2300,
  131. adultsPrice: 2400,
  132. teenagerPrice: 1800,
  133. childPrice: 1200.99,
  134. },
  135. {
  136. id: '0012',
  137. startDate: '09/02',
  138. endDate: '09/11',
  139. currentPrice: 1200.99,
  140. originalPrice: 2300,
  141. adultsPrice: 2400,
  142. teenagerPrice: 1800,
  143. childPrice: 1200.99,
  144. },
  145. {
  146. id: '0013',
  147. startDate: '09/12',
  148. endDate: '09/19',
  149. currentPrice: 1200.99,
  150. originalPrice: 2300,
  151. adultsPrice: 2400,
  152. teenagerPrice: 1800,
  153. childPrice: 1200.99,
  154. },
  155. ],
  156. itineraryHighlights: `
  157. <p>
  158. <img style="width: 100%;" src="/static/image/temp-31.png" mode="widthFix"/>
  159. <img style="width: 100%;" src="/static/image/temp-32.png" mode="widthFix"/>
  160. <img style="width: 100%;" src="/static/image/temp-33.png" mode="widthFix"/>
  161. <img style="width: 100%;" src="/static/image/temp-34.png" mode="widthFix"/>
  162. <img style="width: 100%;" src="/static/image/temp-35.png" mode="widthFix"/>
  163. </p>
  164. `,
  165. courseObjectives: `
  166. <p style="font-size: 36rpx;">
  167. 课程目标
  168. <p>
  169. `,
  170. itineraryDetail: `
  171. <p style="font-size: 36rpx;">
  172. 详细行程
  173. <p>
  174. `,
  175. },
  176. time: "0012",
  177. adults: 2,
  178. teenager: 1,
  179. child: 1,
  180. members: [
  181. {
  182. id: "001",
  183. idNo: "430223********9999",
  184. isDefault: false,
  185. isSelected: true,
  186. name: "李梓发",
  187. type: 0,
  188. },
  189. {
  190. id: "002",
  191. idNo: "430223********9999",
  192. isDefault: false,
  193. isSelected: true,
  194. name: "吴彦谦",
  195. type: 0,
  196. },
  197. {
  198. id: "003",
  199. idNo: "430223********9999",
  200. isDefault: false,
  201. isSelected: true,
  202. name: "冯云",
  203. type: 1,
  204. },
  205. {
  206. id: "004",
  207. idNo: "430223********9999",
  208. isDefault: false,
  209. isSelected: true,
  210. name: "冯思钗",
  211. type: 2,
  212. },
  213. ],
  214. coupon: "001",
  215. discount: 88,
  216. invoice: null,
  217. name: "测试",
  218. phone: "13345678910",
  219. orderNo: 'BH872381728321983929',
  220. createTime: '2025-04-28 08:14',
  221. mentorPhone: '0731-599327-8899',
  222. status: 1,
  223. }
  224. console.log('orderInfo', this.detail)
  225. // todo: check fetch by id?
  226. // this.detail = await this.$fetch('queryOrderById', { id: this.id })
  227. } catch (err) {
  228. }
  229. uni.stopPullDownRefresh()
  230. },
  231. onComment(id) {
  232. this.$refs.commentPopup.open(id)
  233. },
  234. onApplyService() {
  235. // todo
  236. },
  237. onContactMentor() {
  238. this.$refs.contactMentorPopup.open(this.detail.mentorPhone)
  239. },
  240. },
  241. }
  242. </script>
  243. <style scoped lang="scss">
  244. @import '../styles/style.scss';
  245. .bottom {
  246. .bar {
  247. .price {
  248. justify-content: flex-start;
  249. column-gap: 8rpx;
  250. &-label {
  251. font-size: 24rpx;
  252. color: #626262;
  253. }
  254. &-unit,
  255. &-value {
  256. font-weight: 500;
  257. color: #FF4800;
  258. }
  259. &-unit {
  260. font-size: 24rpx;
  261. }
  262. &-value {
  263. font-size: 40rpx;
  264. }
  265. }
  266. .btn-simple {
  267. flex: none;
  268. width: auto;
  269. font-family: PingFang SC;
  270. font-weight: 400;
  271. font-size: 22rpx;
  272. line-height: 1.1;
  273. color: #999999;
  274. border: none;
  275. border-radius: unset;
  276. .icon {
  277. width: 52rpx;
  278. height: auto;
  279. margin-bottom: 4rpx;
  280. }
  281. }
  282. }
  283. }
  284. </style>