index.tsx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import { moneyFormat } from '@/helpers/utils'
  2. import { Button, Cell } from 'vant'
  3. import { defineComponent } 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. 订单金额
  37. <span class={styles.price} style={{ paddingLeft: '5px' }}>
  38. <i>¥</i>
  39. {moneyFormat(item.payAmount)}
  40. </span>
  41. </div>
  42. ),
  43. default: () => (
  44. <div class={styles.btnList}>
  45. {/* <span class={styles.sureGoods}>已确认收货</span> */}
  46. {item.status === 0 || item.status === 6 ? (
  47. <>
  48. <Button
  49. size="small"
  50. round
  51. onClick={(e: Event) => {
  52. e.stopPropagation()
  53. onCancelOrder(item)
  54. }}
  55. >
  56. 取消订单
  57. </Button>
  58. <Button
  59. size="small"
  60. round
  61. type="primary"
  62. onClick={(e: Event) => {
  63. e.stopPropagation()
  64. onPayOrder(item)
  65. }}
  66. >
  67. 继续支付
  68. </Button>
  69. </>
  70. ) : null}
  71. {item.status === 2 ? (
  72. <Button
  73. size="small"
  74. round
  75. type="primary"
  76. onClick={(e: Event) => {
  77. e.stopPropagation()
  78. onConfirmReceipt(item)
  79. }}
  80. >
  81. 确认收货
  82. </Button>
  83. ) : null}
  84. {item.status === 3 ? (
  85. <Button
  86. size="small"
  87. round
  88. type="primary"
  89. onClick={(e: Event) => {
  90. e.stopPropagation()
  91. onAginOrder(item)
  92. }}
  93. >
  94. 再来一单
  95. </Button>
  96. ) : null}
  97. </div>
  98. )
  99. }}
  100. ></Cell>
  101. )
  102. }
  103. })