dingdan.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view>
  3. <view class="icon-title-navBar-box">
  4. <view class="nav-bar-icon" @click="handleBack"></view>
  5. <text class="nav-bar-title">确认订单</text>
  6. </view>
  7. <!-- 卡片 -->
  8. <view>
  9. <view><image :src="data.cover"></image></view>
  10. <view>名称:{{data.name}}</view>
  11. <view>简介:{{data.intro}}</view>
  12. <view>价格:{{data.xianjia}}</view>
  13. </view>
  14. <!-- 等级 -->
  15. <view>
  16. <view>课程学习等级</view>
  17. <view>
  18. <!-- 套餐 -->
  19. <view v-for="item in data.taocanList" @click="handleSelectTaoCan(item)" :class="{active: item.taocanId == activeTaocan.taocanId}">
  20. {{item.name}}
  21. </view>
  22. </view>
  23. </view>
  24. <!-- 商品总价 -->
  25. <view>
  26. <view>商品总价 ¥{{yuanjia}}</view>
  27. <view>优惠券 -¥{{youhui}}</view>
  28. <view>合计 ¥{{xianjia}}</view>
  29. </view>
  30. <!-- 支付模式 -->
  31. <view>
  32. <view>微信</view>
  33. <view>支付宝</view>
  34. </view>
  35. <!-- 支付区 -->
  36. <view>
  37. <view>
  38. <view>合计:¥{{xianjia}}</view>
  39. <view>共优惠¥{{youhui}}</view>
  40. </view>
  41. <view @click="handlePay">立即支付</view>
  42. </view>
  43. </view>
  44. <kaiTongFongShiVue ref="kaiRef"></kaiTongFongShiVue>
  45. </template>
  46. <script setup>
  47. import {
  48. reactive,
  49. ref,
  50. computed,
  51. } from "vue";
  52. import {
  53. onLoad,
  54. onShow
  55. } from "@dcloudio/uni-app"
  56. import * as shopHttp from "@/api/shop.js"
  57. import kaiTongFongShiVue from "../components/kaiTongFongShi.vue";
  58. const data = reactive({
  59. chanpinId:null,
  60. cover: null,
  61. intro: null,
  62. name: null,
  63. taocanList: []
  64. })
  65. const activeTaocan = ref(null)
  66. const kaiRef = ref(null)
  67. const youhui = computed(() => {
  68. if (!activeTaocan.value) {
  69. return '0.00'
  70. } else {
  71. return activeTaocan.value.youhui
  72. }
  73. })
  74. const xianjia = computed(() => {
  75. if (!activeTaocan.value) {
  76. return '0.00'
  77. } else {
  78. return activeTaocan.value.xianjia
  79. }
  80. })
  81. const yuanjia = computed(() => {
  82. if (!activeTaocan.value) {
  83. return '0.00'
  84. } else {
  85. return activeTaocan.value.yuanjia
  86. }
  87. })
  88. onLoad(() => {
  89. initPage()
  90. })
  91. function handleSelectTaoCan(item) {
  92. activeTaocan.value = item;
  93. }
  94. function initPage() {
  95. shopHttp.getAppShuxueBuy().then(res => {
  96. Object.assign(data, res.data)
  97. activeTaocan.value = res.data.taocanList[0]
  98. })
  99. }
  100. function handlePay() {
  101. kaiRef.value.handleShow();
  102. /* if (getUserIsYouke()) {
  103. // 游客
  104. kaiRef.value.handleShow();
  105. } else {
  106. // 非游客
  107. } */
  108. }
  109. function handleBack() {
  110. uni.navigateBack()
  111. }
  112. </script>
  113. <style>
  114. </style>