Files
exchange-2.0/resources/assets/vue/components/bookings/elements/SupplierRefundComponent.vue
T
JiaSheng c95c274db7 update
2024-03-25 00:47:52 +08:00

99 lines
3.9 KiB
Vue

<template>
<div class="row m-b-10 parentContainer">
<div class="col">
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="isLoading"></loading-component>
<div class="row align-items-center p-b-5 b-b b-grey" :class="[{'pointer': clickable}]" v-show="!isLoading" @click="clickable ? activate() : undefined">
<div class="col-auto p-r-0">
<div class="b-grey b-a fs-10 btn-rounded icon-thumbnail icon-25 m-r-0" :class="[{'bg-primary': active}, {'bg-transparent': !active}]" v-if="clickable">
<i class="fa fa-check text-white fs-12 fa-fw"></i>
</div>
<div style="width: 25px;" v-else></div>
</div>
<div class="col">
<div class="row m-b-10">
<div class="col-auto">
<div class="font-heading fs-10 muted all-caps">Date</div>
<div class="font-heading fs-10">
{{item.created_at}}
</div>
</div>
<div class="col-auto">
<div class="font-heading fs-10 muted all-caps">Reference</div>
<div class="font-heading fs-10">
<a :href="route('booking.details', item.booking.marking)">{{item.booking.marking}}</a>
</div>
</div>
<div class="col text-right">
<div class="font-heading fs-10 muted all-caps">Amount</div>
<div class="font-heading fs-14 text-success bold">
{{item.currency.short_code}} {{((Math.round(( item.amount + Number.EPSILON) * 100) / 100)).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
import staticFormHandler from '../../../general/mixins/staticFormHandler'
export default {
props: {
section:{
type: String,
required: true
},
is1688Supplier:{
type: Boolean,
required: true
},
payments:{
type: Array,
required: true
},
paymentTotal: {
type: Number,
required: true
},
inputPaymentTotal: {
type: Number,
required: true
},
refundTotal: {
type: Number,
required: true
},
supplierRefunds:{
type: Array,
required: true
}
},
computed: {
clickable(){
if (this.is1688Supplier) {
return this.refundTotal < this.inputPaymentTotal || this.supplierRefunds.some((i) => this.item.id === i.id );
} else {
return this.refundTotal < this.paymentTotal || this.supplierRefunds.some((i) => this.item.id === i.id );
}
}
},
data(){
return {
active: this.item ? this.supplierRefunds.some(supplierRefund => supplierRefund.id === this.item.id) : false,
}
},
created(){
this.active = this.supplierRefunds.some(supplierRefund => supplierRefund.id === this.item.id);
},
methods: {
activate(){
this.active = !this.active;
this.$emit('input', this.item)
},
},
mixins: [componentHandler, staticFormHandler]
}
</script>