index.tsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 && <div class={styles.coupon}>优惠劵: -¥ {moneyFormat(item.couponAmount)}</div>}
  44. </div>
  45. ),
  46. default: () => (
  47. <div class={styles.btnList}>
  48. {/* <span class={styles.sureGoods}>已确认收货</span> */}
  49. {item.status === 0 || item.status === 6 ? (
  50. <>
  51. <Button
  52. size="small"
  53. round
  54. onClick={(e: Event) => {
  55. e.stopPropagation()
  56. onCancelOrder!(item)
  57. }}
  58. >
  59. 取消订单
  60. </Button>
  61. <Button
  62. size="small"
  63. round
  64. type="primary"
  65. onClick={(e: Event) => {
  66. e.stopPropagation()
  67. onPayOrder!(item)
  68. }}
  69. >
  70. 继续支付
  71. </Button>
  72. </>
  73. ) : null}
  74. {item.status === 2 ? (
  75. <Button
  76. size="small"
  77. round
  78. type="primary"
  79. onClick={(e: Event) => {
  80. e.stopPropagation()
  81. onConfirmReceipt!(item)
  82. }}
  83. >
  84. 确认收货
  85. </Button>
  86. ) : null}
  87. {/* {item.status === 3 ? (
  88. <>
  89. <span class={styles.confirmReceipt}>已确认收货</span>
  90. <Button
  91. size="small"
  92. round
  93. type="primary"
  94. onClick={(e: Event) => {
  95. e.stopPropagation()
  96. onAginOrder!(item)
  97. }}
  98. >
  99. 再来一单
  100. </Button>
  101. </>
  102. ) : null} */}
  103. </div>
  104. )
  105. }}
  106. ></Cell>
  107. )
  108. }
  109. })