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

299 lines
8.6 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. priceDiscount: 688.99,
  122. priceOrigin: 1200,
  123. registered: 4168,
  124. timeOptions: [
  125. {
  126. id: '0011',
  127. startDate: '08/25',
  128. endDate: '09/01',
  129. priceDiscount: 1200.99,
  130. priceOrigin: 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. priceDiscount: 1200.99,
  140. priceOrigin: 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. priceDiscount: 1200.99,
  150. priceOrigin: 2300,
  151. adultsPrice: 2400,
  152. teenagerPrice: 1800,
  153. childPrice: 1200.99,
  154. },
  155. ],
  156. },
  157. time: "0012",
  158. adults: 2,
  159. teenager: 1,
  160. child: 1,
  161. members: [
  162. {
  163. id: "001",
  164. idNo: "430223********9999",
  165. isDefault: false,
  166. isSelected: true,
  167. name: "李梓发",
  168. type: 0,
  169. },
  170. {
  171. id: "002",
  172. idNo: "430223********9999",
  173. isDefault: false,
  174. isSelected: true,
  175. name: "吴彦谦",
  176. type: 0,
  177. },
  178. {
  179. id: "003",
  180. idNo: "430223********9999",
  181. isDefault: false,
  182. isSelected: true,
  183. name: "冯云",
  184. type: 1,
  185. },
  186. {
  187. id: "004",
  188. idNo: "430223********9999",
  189. isDefault: false,
  190. isSelected: true,
  191. name: "冯思钗",
  192. type: 2,
  193. },
  194. ],
  195. coupon: "001",
  196. discount: 88,
  197. invoice: null,
  198. name: "测试",
  199. phone: "13345678910",
  200. orderNo: 'BH872381728321983929',
  201. createTime: '2025-04-28 08:14',
  202. mentorPhone: '0731-599327-8899',
  203. status: 1,
  204. }
  205. console.log('orderInfo', this.detail)
  206. // todo: check fetch by id?
  207. // this.detail = await this.$fetch('queryOrderById', { id: this.id })
  208. } catch (err) {
  209. }
  210. uni.stopPullDownRefresh()
  211. },
  212. onComment(id) {
  213. this.$refs.commentPopup.open(id)
  214. },
  215. onApplyService() {
  216. // todo
  217. },
  218. onContactMentor() {
  219. this.$refs.contactMentorPopup.open(this.detail.mentorPhone)
  220. },
  221. },
  222. }
  223. </script>
  224. <style scoped lang="scss">
  225. @import '../styles/style.scss';
  226. .bottom {
  227. .bar {
  228. .price {
  229. justify-content: flex-start;
  230. column-gap: 8rpx;
  231. &-label {
  232. font-size: 24rpx;
  233. color: #626262;
  234. }
  235. &-unit,
  236. &-value {
  237. font-weight: 500;
  238. color: #FF4800;
  239. }
  240. &-unit {
  241. font-size: 24rpx;
  242. }
  243. &-value {
  244. font-size: 40rpx;
  245. }
  246. }
  247. .btn-simple {
  248. flex: none;
  249. width: auto;
  250. font-family: PingFang SC;
  251. font-weight: 400;
  252. font-size: 22rpx;
  253. line-height: 1.1;
  254. color: #999999;
  255. border: none;
  256. border-radius: unset;
  257. .icon {
  258. width: 52rpx;
  259. height: auto;
  260. margin-bottom: 4rpx;
  261. }
  262. }
  263. }
  264. }
  265. </style>