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

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