courseOrderItem.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view class="order-item" @click.stop="toDetail">
  3. <view class="display-flex-between">
  4. <text class="fw400 fs12 lh18 color-666">订单号:{{data.order_no}}</text>
  5. <view class="color-556 fs12 lh18">{{statusDisplay}}</view>
  6. </view>
  7. <view class="display-flex-common goods-list" v-for="(item, index) in data.items" :key="index">
  8. <image style="width: 144rpx; height: 144rpx; border-radius: 10rpx;margin-right: 30rpx;flex-shrink: 0;"
  9. :src="item.goods_cover" mode="aspectFill">
  10. </image>
  11. <view style="width: 100%;">
  12. <view class="display-flex mb8 fs14 lh18 color-333">
  13. <text class="fw600 ">{{item.goods_name}}</text>
  14. </view>
  15. <view class="display-flex fs12 lh18 color-333 fw400">
  16. <text class="gray-tag">{{item.created_at}}</text>
  17. </view>
  18. <view class="mt9 display-flex color-333 fw400">
  19. <view class="mr12 lh18"><text class="fs12 mr5"> 总价</text> <text class="fs10 lh15">¥</text><text class="fs14 lh18">{{item.price_selling}}</text></view>
  20. <view >
  21. <text class=" fs12 lh18 color-3E3D44 fw400">实付:</text><text class="fs18 lh15 fw600 color-556"><text class="fs10">¥</text>{{data.amount_total}}</text>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 确认框 -->
  27. <u-modal :show="confirmShow" :showCancelButton="true" @cancel="confirmShow = false"
  28. @confirm="confirmHandler"></u-modal>
  29. </view>
  30. </template>
  31. <script>
  32. import AfterReson from '@/components/AfterReson.vue'
  33. export default {
  34. props: {
  35. data: {
  36. type: Object,
  37. default: () => {
  38. return {}
  39. }
  40. }
  41. },
  42. components: { AfterReson },
  43. data() {
  44. return {
  45. confirmShow : false
  46. }
  47. },
  48. watch: {
  49. },
  50. computed: {
  51. statusDisplay() {
  52. if (this.data.refund_status == 0) {
  53. switch (this.data.status) {
  54. case 0:
  55. return '已取消'
  56. case 1:
  57. case 2:
  58. return '待付款'
  59. case 3:
  60. return '待发货'
  61. case 4:
  62. return '待收货'
  63. case 6:
  64. case 9:
  65. return '已完成'
  66. default:
  67. return ''
  68. }
  69. } else {
  70. return this.data.refund_status_name
  71. }
  72. },
  73. },
  74. methods: {
  75. cancelOrder() {
  76. this. cancelConfirm()
  77. },
  78. cancelConfirm() {
  79. this.confirmShow = true
  80. this.confirmType = 'cancelOrder'
  81. this.confirmData = {
  82. title: '取消订单',
  83. content: '确认取消订单吗?'
  84. }
  85. },
  86. confirmHandler() {
  87. // 确认弹框
  88. let currentApi = null
  89. if (this.confirmType == 'cancelOrder') {
  90. // 取消订单
  91. this.$api.cancelOrder({ order_no: this.data.order_no }).then(res => {
  92. this.confirmShow = false
  93. this.$emit('refresh')
  94. }).catch(() => {
  95. this.confirmShow = false
  96. })
  97. } else if (this.confirmType == 'confirm') {
  98. this.$api.confirmOrder({ order_no: this.data.order_no }).then(res => {
  99. this.confirmShow = false
  100. this.$emit('refresh')
  101. }).catch(() => {
  102. this.confirmShow = false
  103. })
  104. }
  105. },
  106. toDetail() {
  107. uni.navigateTo({
  108. url: `../orderDetail/courseOrderDetail?orderNo=${this.data.order_no}`
  109. })
  110. },
  111. }
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. .order-item {
  116. background-color: #fff;
  117. border-radius: 16rpx;
  118. padding: 30rpx 30rpx 24rpx;
  119. margin-bottom: 20rpx;
  120. }
  121. .goods-list {
  122. margin: 20rpx 0 0;
  123. padding: 30rpx 0 0;
  124. border-top: 1rpx solid #F5F5F5;
  125. }
  126. </style>