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

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