activityOrderItem.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="order-item" @click.stop="toDetail">
  3. <view class="display-flex-between">
  4. <text class="fw400 fs12 lh18 color-666">{{startTime }}&nbsp;到&nbsp;{{ endTime}}</text>
  5. <view class="color-556 fs12 lh18">{{statusDisplay}}</view>
  6. </view>
  7. <view class="display-flex-common goods-list" >
  8. <image style="width: 144rpx; height: 144rpx; border-radius: 10rpx;margin-right: 30rpx;flex-shrink: 0;"
  9. :src="data.activity.cover" mode="aspectFill">
  10. </image>
  11. <view style="width: 100%;">
  12. <view class="display-flex-between mb8 fs14 lh18 color-333">
  13. <text class="fw600 ">{{data.activity.name}}</text>
  14. </view>
  15. <view class="display-flex-between fs12 lh18 color-333 fw400">
  16. <text>{{data.num}}人</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="goods-total display-flex-between">
  21. <view >
  22. <text class="fs12 lh18 color-3E3D44 fw400">实付:</text><text class="fs18 lh15 fw600 color-556"><text class="fs10">¥</text>{{data.amount_total}}</text>
  23. </view>
  24. <view class="display-flex-center">
  25. <text class="btn-gray-border" @click.stop="cancelOrder"
  26. v-if="[1, 2, 3].includes(data.status) && !isRefund">取消报名</text>
  27. <text class="common-btn ml10" @click.stop="toPay" v-if="[1, 2].includes(data.status)">立即付款</text>
  28. </view>
  29. </view>
  30. <!-- 取消订单原因 -->
  31. <AfterReson v-model="showReson" @confirm="cancelConfirm"></AfterReson>
  32. <!-- 确认框 -->
  33. <u-modal :show="confirmShow" :showCancelButton="true" @cancel="confirmShow = false"
  34. :content='confirmData.content' @confirm="confirmHandler"></u-modal>
  35. </view>
  36. </template>
  37. <script>
  38. import AfterReson from '@/components/AfterReson.vue'
  39. import {cancel} from "@/common/api/activity";
  40. import {toWechatPayActivitySave} from "../../common/utils/tools";
  41. export default {
  42. props: {
  43. data: {
  44. type: Object,
  45. default: () => {
  46. return {}
  47. }
  48. }
  49. },
  50. components: { AfterReson },
  51. data() {
  52. return {
  53. showReson: false,
  54. cancelRemark: '',
  55. confirmShow: false,
  56. confirmData: {
  57. title: '',
  58. content: ''
  59. },
  60. confirmType: ''
  61. }
  62. },
  63. watch: {
  64. },
  65. computed: {
  66. startTime() {
  67. if (this.data.activity && this.data.activity.start_time){
  68. return this.data.activity.start_time.split(' ')[0]
  69. }
  70. return ''
  71. },
  72. endTime() {
  73. if (this.data.activity &&this. data.activity.end_time){
  74. return this.data.activity.end_time.split(' ')[0]
  75. }
  76. return ''
  77. },
  78. statusDisplay() {
  79. if (this.data.refund_status == 0) {
  80. switch (this.data.status) {
  81. case -1:
  82. return '已退款'
  83. case 0:
  84. return '已取消'
  85. case 1:
  86. return '待支付'
  87. case 2:
  88. return '支付中'
  89. case 3:
  90. return '已支付'
  91. case 4:
  92. return '已成功'
  93. default:
  94. return ''
  95. }
  96. } else {
  97. return this.data.refund_status_name
  98. }
  99. },
  100. isRefund() {
  101. return this.data.refund_status != 0
  102. }
  103. },
  104. methods: {
  105. confirmHandler() {
  106. // 确认弹框
  107. let currentApi = null
  108. if (this.confirmType == 'cancelOrder') {
  109. cancel({id:this.data.id}).then(({data})=>{
  110. uni.showToast({
  111. title:"取消成功",
  112. icon: 'none'
  113. })
  114. this.confirmShow = false
  115. this.$emit('refresh')
  116. })
  117. } else if (this.confirmType == 'confirm') {
  118. this.$api.confirmOrder({ order_no: this.data.order_no }).then(res => {
  119. this.confirmShow = false
  120. this.$emit('refresh')
  121. }).catch(() => {
  122. this.confirmShow = false
  123. })
  124. } else if (this.confirmType == 'cancelAfter') {
  125. this.$api.cancelAfterSales({ order_no: this.data.order_no }).then(res => {
  126. this.confirmShow = false
  127. this.$emit('refresh')
  128. }).catch(() => {
  129. this.confirmShow = false
  130. })
  131. }
  132. },
  133. toPay() {
  134. // 立即付款
  135. toWechatPayActivitySave(this.data.order_no)
  136. },
  137. cancelAfter() {
  138. this.confirmShow = true
  139. this.confirmType = 'cancelAfter'
  140. this.confirmData = {
  141. title: '取消申请',
  142. content: '确认取消申请吗?'
  143. }
  144. },
  145. cancelOrder() {
  146. this.cancelConfirm({})
  147. },
  148. cancelConfirm(data) {
  149. this.confirmShow = true
  150. this.confirmType = 'cancelOrder'
  151. this.confirmData = {
  152. title: '取消订单',
  153. content: '确认取消订单吗?'
  154. }
  155. },
  156. confirm() {
  157. this.confirmShow = true
  158. this.confirmType = 'confirm'
  159. this.confirmData = {
  160. title: '确认收货',
  161. content: '确认收货码?'
  162. }
  163. },
  164. toDetail() {
  165. uni.navigateTo({
  166. url: `/subPages/activityDetail/activitySave?orderId=${this.data.id}&orderFlag=true`
  167. })
  168. },
  169. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. .order-item {
  174. background-color: #fff;
  175. border-radius: 16rpx;
  176. padding: 30rpx 30rpx 24rpx;
  177. margin-bottom: 20rpx;
  178. }
  179. .goods-list {
  180. // margin: 0 30rpx;
  181. margin-bottom: 20rpx;
  182. padding: 30rpx 0;
  183. border-bottom: 1rpx solid #F5F5F5;
  184. }
  185. .common-btn,
  186. .btn-gray-border {
  187. height: 64rpx;
  188. line-height: 64rpx;
  189. }
  190. </style>