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

328 lines
9.4 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar leftClick @leftClick="$utils.navigateBack" >
  4. <view class="flex">
  5. <view>待支付</view>
  6. <view>
  7. <view>剩余</view>
  8. <!-- todo -->
  9. <view>10:00</view>
  10. </view>
  11. <view>后关闭</view>
  12. </view>
  13. </navbar>
  14. <view class="main">
  15. <productCard :data="detail"></productCard>
  16. <orderInfoView :data="detail"></orderInfoView>
  17. <view class="notice">
  18. <view class="notice-header">下单须知</view>
  19. <view class="notice-content">
  20. <!-- todo: check key -->
  21. <uv-parse :content="configList['order_instructions']"></uv-parse>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="bottom">
  26. <view class="agreement">
  27. <uv-checkbox-group
  28. v-model="checkboxValue"
  29. shape="circle"
  30. >
  31. <uv-checkbox
  32. size="40rpx"
  33. icon-size="40rpx"
  34. activeColor="#00A9FF"
  35. :name="1"
  36. ></uv-checkbox>
  37. </uv-checkbox-group>
  38. <view class="desc">
  39. 我已阅读并同意
  40. <!-- todo: 替换配置项key -->
  41. <text class="highlight" @click="$refs.modal.open('config_agreement', '退订政策')">退订政策</text>
  42. <!-- todo: 替换配置项key -->
  43. <text class="highlight" @click="$refs.modal.open('config_privacy', '合同范本')">合同范本</text>
  44. <!-- todo: 替换配置项key -->
  45. <text class="highlight" @click="$refs.modal.open('config_privacy', '预订须知')">预订须知</text>
  46. <!-- todo: 替换配置项key -->
  47. <text class="highlight" @click="$refs.modal.open('config_privacy', '安全提示')">安全提示</text>
  48. </view>
  49. </view>
  50. <view class="flex bar">
  51. <button plain class="flex flex-column btn btn-simple" open-type="contact">
  52. <image class="icon" src="@/pages_order/static/product/icon-service.png" mode="widthFix"></image>
  53. <view>联系客服</view>
  54. </button>
  55. <view class="col flex price">
  56. <view class="price-label">
  57. 合计
  58. </view>
  59. <view class="price-unit">¥</view>
  60. <view class="price-value">
  61. {{ totalPrice }}
  62. </view>
  63. </view>
  64. <button class="col btn btn-primary" @click="onPay">立即支付</button>
  65. </view>
  66. </view>
  67. <agreementModal ref="modal" @confirm="onConfirmAgreement"></agreementModal>
  68. </view>
  69. </template>
  70. <script>
  71. import { mapState } from 'vuex'
  72. import productCard from '@/pages_order/order/components/productCard.vue'
  73. import orderInfoView from '@/pages_order/order/components/orderInfoView.vue'
  74. import agreementModal from '@/pages_order/components/agreementModal.vue'
  75. export default {
  76. components: {
  77. productCard,
  78. orderInfoView,
  79. agreementModal,
  80. },
  81. data() {
  82. return {
  83. detail: {},
  84. }
  85. },
  86. computed: {
  87. ...mapState(['configList', 'userInfo', 'orderInfo']),
  88. productPackage() {
  89. const { time, product } = this.detail
  90. const { timeOptions } = product || {}
  91. return timeOptions?.find?.(item => item.id === time) || {}
  92. },
  93. totalPrice() {
  94. const { adults, teenager, child, coupon, couponInfo } = this.detail
  95. const { adultsPrice, teenagerPrice, childPrice } = this.productPackage
  96. let total = 0
  97. adults && (total += adults * (adultsPrice || 0))
  98. teenager && (total += teenager * (teenagerPrice || 0))
  99. child && (total += child * (childPrice || 0))
  100. coupon && (total -= (couponInfo?.price || 0))
  101. return total
  102. },
  103. },
  104. onLoad() {
  105. // console.log('orderInfo', this.orderInfo)
  106. // this.detail = this.orderInfo
  107. // todo: check fetch by id?
  108. this.fetchOrderDetail()
  109. },
  110. onPullDownRefresh() {
  111. this.fetchOrderDetail()
  112. },
  113. methods: {
  114. async fetchOrderDetail() {
  115. try {
  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. currentPrice: 688.99,
  124. originalPrice: 1200,
  125. registered: 4168,
  126. timeOptions: [
  127. {
  128. id: '0011',
  129. startDate: '08/25',
  130. endDate: '09/01',
  131. currentPrice: 1200.99,
  132. originalPrice: 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. currentPrice: 1200.99,
  142. originalPrice: 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. currentPrice: 1200.99,
  152. originalPrice: 2300,
  153. adultsPrice: 2400,
  154. teenagerPrice: 1800,
  155. childPrice: 1200.99,
  156. },
  157. ],
  158. itineraryHighlights: `
  159. <p>
  160. <img style="width: 100%;" src="/static/image/temp-31.png" mode="widthFix"/>
  161. <img style="width: 100%;" src="/static/image/temp-32.png" mode="widthFix"/>
  162. <img style="width: 100%;" src="/static/image/temp-33.png" mode="widthFix"/>
  163. <img style="width: 100%;" src="/static/image/temp-34.png" mode="widthFix"/>
  164. <img style="width: 100%;" src="/static/image/temp-35.png" mode="widthFix"/>
  165. </p>
  166. `,
  167. courseObjectives: `
  168. <p style="font-size: 36rpx;">
  169. 课程目标
  170. <p>
  171. `,
  172. itineraryDetail: `
  173. <p style="font-size: 36rpx;">
  174. 详细行程
  175. <p>
  176. `,
  177. },
  178. time: "0012",
  179. adults: 2,
  180. teenager: 1,
  181. child: 1,
  182. members: [
  183. {
  184. id: "001",
  185. idNo: "430223********9999",
  186. isDefault: false,
  187. isSelected: true,
  188. name: "李梓发",
  189. type: 0,
  190. },
  191. {
  192. id: "002",
  193. idNo: "430223********9999",
  194. isDefault: false,
  195. isSelected: true,
  196. name: "吴彦谦",
  197. type: 0,
  198. },
  199. {
  200. id: "003",
  201. idNo: "430223********9999",
  202. isDefault: false,
  203. isSelected: true,
  204. name: "冯云",
  205. type: 1,
  206. },
  207. {
  208. id: "004",
  209. idNo: "430223********9999",
  210. isDefault: false,
  211. isSelected: true,
  212. name: "冯思钗",
  213. type: 2,
  214. },
  215. ],
  216. coupon: "001",
  217. discount: 88,
  218. invoice: null,
  219. name: "测试",
  220. phone: "13345678910",
  221. orderNo: 'BH872381728321983929',
  222. createTime: '2025-04-28 08:14',
  223. status: 0,
  224. }
  225. console.log('orderInfo', this.detail)
  226. // todo: check fetch by id?
  227. // this.detail = await this.$fetch('queryOrderById', { id: this.id })
  228. } catch (err) {
  229. }
  230. uni.stopPullDownRefresh()
  231. },
  232. async onPay() {
  233. try {
  234. // todo: fetch pay
  235. uni.showToast({
  236. title: '支付成功',
  237. icon: 'none'
  238. })
  239. setTimeout(() => {
  240. // todo: check → jump to order list page ?
  241. uni.reLaunch({
  242. url: `/pages_order/order/orderList/index`
  243. });
  244. }, 700)
  245. } catch (err) {
  246. }
  247. },
  248. },
  249. }
  250. </script>
  251. <style scoped lang="scss">
  252. @import '../styles/style.scss';
  253. .bottom {
  254. .bar {
  255. .price {
  256. justify-content: flex-start;
  257. column-gap: 8rpx;
  258. &-label {
  259. font-size: 24rpx;
  260. color: #626262;
  261. }
  262. &-unit,
  263. &-value {
  264. font-weight: 500;
  265. color: #FF4800;
  266. }
  267. &-unit {
  268. font-size: 24rpx;
  269. }
  270. &-value {
  271. font-size: 40rpx;
  272. }
  273. }
  274. .btn-simple {
  275. flex: none;
  276. width: auto;
  277. font-family: PingFang SC;
  278. font-weight: 400;
  279. font-size: 22rpx;
  280. line-height: 1.1;
  281. color: #999999;
  282. border: none;
  283. border-radius: unset;
  284. .icon {
  285. width: 52rpx;
  286. height: auto;
  287. margin-bottom: 4rpx;
  288. }
  289. }
  290. }
  291. }
  292. </style>