serverOrderItem.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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" >
  8. <image style="width: 144rpx; height: 144rpx; border-radius: 10rpx;margin-right: 30rpx;flex-shrink: 0;"
  9. :src="data.goods_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.goods_name}}</text>
  14. <text ><text class="fs10">¥</text>{{data.goods_price}}</text>
  15. </view>
  16. <view class="display-flex-between fs12 lh18 color-333 fw400">
  17. <text class="color-666">预约时间:{{data.order_date}}&nbsp;{{data.order_time}}</text>
  18. <text >{{data.order_num}}人</text>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="goods-total display-flex-between">
  23. <view >
  24. <text class="fs12 lh18 color-3E3D44 fw400">实付:</text><text class="fs18 lh15 fw600 color-556"><text class="fs10">¥</text>{{data.amount_total}}</text>
  25. </view>
  26. <view class="display-flex-center">
  27. <text class="btn-gray-border" @click.stop="cancelOrder"
  28. v-if="[1, 2, 3].includes(data.status) && !isRefund">取消报名</text>
  29. <text class="common-btn ml10" @click.stop="toPay" v-if="[1,2].includes(data.status)">立即付款</text>
  30. </view>
  31. </view>
  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 {yvyueOrderCancel} from "@/common/api/yvyeService";
  40. import {toWechatPayPaymentSave} 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 -2:
  84. return '已取消'
  85. case 0:
  86. return '预订单'
  87. case 1:
  88. return '待支付'
  89. case 2:
  90. return '支付中'
  91. case 3:
  92. return '已支付'
  93. case 4:
  94. return '已签到'
  95. case 9:
  96. return '已完成'
  97. default:
  98. return ''
  99. }
  100. } else {
  101. return this.data.refund_status_name
  102. }
  103. },
  104. isRefund() {
  105. return this.data.refund_status != 0
  106. }
  107. },
  108. methods: {
  109. toPay() {
  110. // 立即付款
  111. toWechatPayPaymentSave(this.data.order_no)
  112. },
  113. confirmHandler() {
  114. // 确认弹框
  115. let currentApi = null
  116. if (this.confirmType == 'cancelOrder') {
  117. // 取消订单
  118. yvyueOrderCancel({order_no: this.data.order_no}).then(({data}) => {
  119. uni.showToast({
  120. title:"取消成功",
  121. icon: 'none'
  122. })
  123. this.confirmShow = false
  124. this.$emit('refresh')
  125. });
  126. } else if (this.confirmType == 'confirm') {
  127. this.$api.confirmOrder({ order_no: this.data.order_no }).then(res => {
  128. this.confirmShow = false
  129. this.$emit('refresh')
  130. }).catch(() => {
  131. this.confirmShow = false
  132. })
  133. } else if (this.confirmType == 'cancelAfter') {
  134. this.$api.cancelAfterSales({ order_no: this.data.order_no }).then(res => {
  135. this.confirmShow = false
  136. this.$emit('refresh')
  137. }).catch(() => {
  138. this.confirmShow = false
  139. })
  140. }
  141. },
  142. cancelAfter() {
  143. this.confirmShow = true
  144. this.confirmType = 'cancelAfter'
  145. this.confirmData = {
  146. title: '取消申请',
  147. content: '确认取消申请吗?'
  148. }
  149. },
  150. cancelOrder() {
  151. this. cancelConfirm()
  152. },
  153. cancelConfirm() {
  154. this.confirmShow = true
  155. this.confirmType = 'cancelOrder'
  156. this.confirmData = {
  157. title: '取消订单',
  158. content: '确认取消订单吗?'
  159. }
  160. },
  161. confirm() {
  162. this.confirmShow = true
  163. this.confirmType = 'confirm'
  164. this.confirmData = {
  165. title: '确认收货',
  166. content: '确认收货码?'
  167. }
  168. },
  169. toDetail() {
  170. uni.navigateTo({
  171. url: `/subPages/service/serviceSave?code=${this.data.goods_code}&setid=${this.data.id}`
  172. })
  173. },
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .order-item {
  179. background-color: #fff;
  180. border-radius: 16rpx;
  181. padding: 30rpx 30rpx 24rpx;
  182. margin-bottom: 20rpx;
  183. }
  184. .goods-list {
  185. // margin: 0 30rpx;
  186. margin-bottom: 20rpx;
  187. padding: 30rpx 0;
  188. border-bottom: 1rpx solid #F5F5F5;
  189. }
  190. .common-btn,
  191. .btn-gray-border {
  192. height: 64rpx;
  193. line-height: 64rpx;
  194. }
  195. </style>