index.tsx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import { moneyFormat } from '@/helpers/utils'
  2. import { Button, Cell } from 'vant'
  3. import { defineComponent, PropType } from 'vue'
  4. import styles from '../../index.module.less'
  5. export default defineComponent({
  6. name: 'AfterSaleBtns',
  7. props: {
  8. item: {
  9. type: Object,
  10. default: {}
  11. },
  12. onCancelOrder: {
  13. type: Function,
  14. default: (n: any) => {}
  15. },
  16. onPayOrder: {
  17. type: Function,
  18. default: (n: any) => {}
  19. },
  20. onConfirmReceipt: {
  21. type: Function,
  22. default: (n: any) => {}
  23. },
  24. onAginOrder: {
  25. type: Function,
  26. default: (n: any) => {}
  27. }
  28. },
  29. setup({ item, onCancelOrder, onPayOrder, onConfirmReceipt, onAginOrder }) {
  30. return () => (
  31. <Cell
  32. center
  33. v-slots={{
  34. title: () => (
  35. <div class={styles.orderPrice}>
  36. <div>
  37. 订单金额
  38. <span class={styles.price} style={{ paddingLeft: '5px' }}>
  39. <i>¥ </i>
  40. {moneyFormat(item.payAmount)}
  41. </span>
  42. </div>
  43. {!!item.couponAmount && (
  44. <div class={styles.coupon}>
  45. 优惠券: -¥ {moneyFormat(item.couponAmount)}
  46. </div>
  47. )}
  48. </div>
  49. ),
  50. default: () => (
  51. <div class={styles.btnList}>
  52. {/* <span class={styles.sureGoods}>已确认收货</span> */}
  53. {item.status === 0 || item.status === 6 ? (
  54. <>
  55. <Button
  56. size="small"
  57. round
  58. onClick={(e: Event) => {
  59. e.stopPropagation()
  60. onCancelOrder!(item)
  61. }}
  62. >
  63. 取消订单
  64. </Button>
  65. <Button
  66. size="small"
  67. round
  68. type="primary"
  69. onClick={(e: Event) => {
  70. e.stopPropagation()
  71. onPayOrder!(item)
  72. }}
  73. >
  74. 继续支付
  75. </Button>
  76. </>
  77. ) : null}
  78. {item.status === 2 ? (
  79. <Button
  80. size="small"
  81. round
  82. type="primary"
  83. onClick={(e: Event) => {
  84. e.stopPropagation()
  85. onConfirmReceipt!(item)
  86. }}
  87. >
  88. 确认收货
  89. </Button>
  90. ) : null}
  91. {/* {item.status === 3 ? (
  92. <>
  93. <span class={styles.confirmReceipt}>已确认收货</span>
  94. <Button
  95. size="small"
  96. round
  97. type="primary"
  98. onClick={(e: Event) => {
  99. e.stopPropagation()
  100. onAginOrder!(item)
  101. }}
  102. >
  103. 再来一单
  104. </Button>
  105. </>
  106. ) : null} */}
  107. </div>
  108. )
  109. }}
  110. ></Cell>
  111. )
  112. }
  113. })