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

309 lines
8.5 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. 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. idNo: "430223********9999",
  167. isDefault: false,
  168. isSelected: true,
  169. name: "李梓发",
  170. type: 0,
  171. },
  172. {
  173. id: "002",
  174. idNo: "430223********9999",
  175. isDefault: false,
  176. isSelected: true,
  177. name: "吴彦谦",
  178. type: 0,
  179. },
  180. {
  181. id: "003",
  182. idNo: "430223********9999",
  183. isDefault: false,
  184. isSelected: true,
  185. name: "冯云",
  186. type: 1,
  187. },
  188. {
  189. id: "004",
  190. idNo: "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. status: 0,
  205. }
  206. console.log('orderInfo', this.detail)
  207. // todo: check fetch by id?
  208. // this.detail = await this.$fetch('queryOrderById', { id: this.id })
  209. } catch (err) {
  210. }
  211. uni.stopPullDownRefresh()
  212. },
  213. async onPay() {
  214. try {
  215. // todo: fetch pay
  216. uni.showToast({
  217. title: '支付成功',
  218. icon: 'none'
  219. })
  220. setTimeout(() => {
  221. // todo: check → jump to order list page ?
  222. uni.reLaunch({
  223. url: `/pages_order/order/orderList/index`
  224. });
  225. }, 700)
  226. } catch (err) {
  227. }
  228. },
  229. },
  230. }
  231. </script>
  232. <style scoped lang="scss">
  233. @import '../styles/style.scss';
  234. .bottom {
  235. .bar {
  236. .price {
  237. justify-content: flex-start;
  238. column-gap: 8rpx;
  239. &-label {
  240. font-size: 24rpx;
  241. color: #626262;
  242. }
  243. &-unit,
  244. &-value {
  245. font-weight: 500;
  246. color: #FF4800;
  247. }
  248. &-unit {
  249. font-size: 24rpx;
  250. }
  251. &-value {
  252. font-size: 40rpx;
  253. }
  254. }
  255. .btn-simple {
  256. flex: none;
  257. width: auto;
  258. font-family: PingFang SC;
  259. font-weight: 400;
  260. font-size: 22rpx;
  261. line-height: 1.1;
  262. color: #999999;
  263. border: none;
  264. border-radius: unset;
  265. .icon {
  266. width: 52rpx;
  267. height: auto;
  268. margin-bottom: 4rpx;
  269. }
  270. }
  271. }
  272. }
  273. </style>