140 lines
3.9 KiB
Vue
140 lines
3.9 KiB
Vue
<template>
|
|
<div>
|
|
<BasicShowContext title="لیست کارت های هدیه">
|
|
<BaseTable v-bind="tblProps" @register="submit" ref="tbl">
|
|
<template #extraHeader>
|
|
<div class="flex gap-2">
|
|
<BaseButton v-if="!customerId" type="primary" size="small" class="flex" @click="emits('add', 'gift')">
|
|
<div>افزودن کارت هدیه</div>
|
|
<BaseIcon icon="vuesax-linear:gift" Size="16px" />
|
|
</BaseButton>
|
|
<BaseButton v-if="!customerId" type="primary" size="small" class="flex" @click="emits('add' ,'code')">
|
|
<div>افزودن کد تخفیف</div>
|
|
<BaseIcon icon="vuesax-linear:discount-circle" Size="16px" />
|
|
</BaseButton>
|
|
</div>
|
|
|
|
</template>
|
|
<template #action="{ column, record }">
|
|
<div class="gap-2 flex justify-center">
|
|
<a-tooltip placement="bottom" class="cursor-pointer" @click="emits('info', record)">
|
|
<template #title>
|
|
<span>مشخصات</span>
|
|
</template>
|
|
<Icon icon="vuesax-linear:stickynote" color="#10913A" />
|
|
</a-tooltip>
|
|
<a-tooltip placement="bottom" class="cursor-pointer" @click="emits('giftcardcodes', record)">
|
|
<template #title>
|
|
<div>کدهای {{record.unit==3?'تخفیف':'کارت هدیه'}}</div>
|
|
</template>
|
|
<Icon icon="vuesax-linear:document-text" color="#1890ff" />
|
|
</a-tooltip>
|
|
</div>
|
|
</template>
|
|
</BaseTable>
|
|
</BasicShowContext>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="tsx" setup>
|
|
import type { TableInput } from '@core/type/baseTable'
|
|
import useBaseTable from '@core/components/BaseTableOld/hooks/useBaseTable'
|
|
import Icon from '@core/components/BaseIcon/src/Icon.vue'
|
|
import { changeCustomerActivation, getCustomerTable } from '@/api/customer'
|
|
import { cols } from '../hooks/orderColumns'
|
|
import { useUserStore } from '@/store/userStore'
|
|
import { usePrefix } from '@core/composable/usePrefix'
|
|
import { message } from 'ant-design-vue'
|
|
import { getOrderTable } from '@/api/order'
|
|
import {getGiftCardTable} from "@/api/giftCard";
|
|
|
|
const [submit, reload] = useBaseTable()
|
|
/*const select = (val) => {
|
|
val.sts === 1 ? return ['1'] : ['2']
|
|
}*/
|
|
//emits
|
|
interface Prop {
|
|
customerId: number
|
|
}
|
|
const emits = defineEmits(['delete', 'edit', 'add', 'info', 'giftcardcodes'])
|
|
const props = defineProps<Prop>()
|
|
|
|
const { prefixCls } = usePrefix('pophoverstatus')
|
|
|
|
//permission
|
|
function checkPermission(temp: string) {
|
|
const store = useUserStore()
|
|
return store.canAccess(temp)
|
|
}
|
|
|
|
//define table
|
|
const table = ref(null)
|
|
|
|
const tblProps = ref<any>({
|
|
columns: cols,
|
|
api: (params: TableInput) => {
|
|
if (props.customerId) {
|
|
params.filters = []
|
|
params.filters?.push({
|
|
field: "customer_id",
|
|
type: "text",
|
|
value: props.customerId,
|
|
cr: "and",
|
|
op: "eq",
|
|
hidden: false
|
|
})
|
|
}
|
|
return getGiftCardTable(params)
|
|
}
|
|
//bordered: true
|
|
})
|
|
const loading = ref<boolean>(false)
|
|
|
|
async function changeCustomerActivationFunction(id: number) {
|
|
try {
|
|
loading.value = true
|
|
await changeCustomerActivation(id)
|
|
reload()
|
|
message.success('تغییر وضعیت با موفقیت انجام شد')
|
|
} catch (e) {
|
|
console.error(e)
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
const fetch = () => {
|
|
// console.log('sss')
|
|
reload()
|
|
}
|
|
// const spinTable = (val: boolean) => {
|
|
// // console.log('sss')
|
|
// table?.value?.loading.value = val
|
|
// }
|
|
defineExpose({
|
|
fetch
|
|
// spinTable
|
|
})
|
|
</script>
|
|
|
|
<style lang="less">
|
|
@prefix: ~'@{prefixCls}-pophoverstatus';
|
|
|
|
.@{prefix} {
|
|
.ant-menu-rtl.ant-menu-inline,
|
|
.ant-menu-rtl.ant-menu-vertical {
|
|
border-left: none;
|
|
}
|
|
|
|
.ant-menu-item-only-child {
|
|
border-radius: @border-radius-base;
|
|
}
|
|
|
|
//bor
|
|
/* .ant-input-group-addon:first-child {
|
|
!* border: #d9d9d9 1px solid;
|
|
border-radius: 0 6px 6px 0;*!
|
|
}*/
|
|
}
|
|
</style>
|