203 lines
6.5 KiB
Vue
203 lines
6.5 KiB
Vue
<template>
|
|||
|
|
<div>
|
||
|
|
<BasicShowContext title="لیست کیف پول">
|
||
|
|
<BaseTable v-bind="tblProps" @register="submit" ref="tbl">
|
||
|
|
<!-- <template #extraHeader>
|
||
|
|
<BaseButton type="primary" size="small" class="flex" @click="emits('add')">
|
||
|
|
<div>افزودن کیف پول</div>
|
||
|
|
<BaseIcon icon="vuesax-linear:wallet-add" Size="16px" />
|
||
|
|
</BaseButton>
|
||
|
|
</template>-->
|
||
|
|
<template #extraHeader>
|
||
|
|
<div class="w-60vw hidden md:block">
|
||
|
|
<div class="grid grid-cols-2 gap-3 w-full py-2 px-5">
|
||
|
|
<div
|
||
|
|
:class="
|
||
|
|
sums?.cash >= 0
|
||
|
|
? sums?.cash === 0
|
||
|
|
? 'bg-amber-100'
|
||
|
|
: 'bg-green-100'
|
||
|
|
: 'bg-red-100'
|
||
|
|
"
|
||
|
|
class="rounded-lg p-2"
|
||
|
|
>
|
||
|
|
<div class="mb-1">مجموع موجودی کیف پول:</div>
|
||
|
|
<div class="flex gap-2">
|
||
|
|
<div
|
||
|
|
class="gap-5 rounded-lg border-1 border-solid border-gray flex-1 p-1 text-center"
|
||
|
|
>
|
||
|
|
<div class="font-bold">{{ usePrice(sums?.cash ?? 0) }}</div>
|
||
|
|
</div>
|
||
|
|
<div
|
||
|
|
class="gap-5 rounded-lg border-1 border-solid border-gray flex-1 p-1 text-center"
|
||
|
|
>
|
||
|
|
<div class="font-bold">
|
||
|
|
{{ usePrice(sums?.cashToGold.toFixed(2) ?? 0, true, 'گرم') }}
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div
|
||
|
|
:class="
|
||
|
|
sums?.gold >= 0
|
||
|
|
? sums?.gold === 0
|
||
|
|
? 'bg-amber-100'
|
||
|
|
: 'bg-green-100'
|
||
|
|
: 'bg-red-100'
|
||
|
|
"
|
||
|
|
class="rounded-lg p-2"
|
||
|
|
>
|
||
|
|
<div class="mb-1">مجموع موجودی کیف طلا:</div>
|
||
|
|
<div class="flex gap-2">
|
||
|
|
<div
|
||
|
|
class="gap-5 rounded-lg border-1 border-solid border-gray flex-1 p-1 text-center"
|
||
|
|
>
|
||
|
|
<div class="font-bold">{{ usePrice(sums?.gold ?? 0, true, 'گرم') }}</div>
|
||
|
|
</div>
|
||
|
|
<div
|
||
|
|
class="gap-5 rounded-lg border-1 border-solid border-gray flex-1 p-1 text-center"
|
||
|
|
>
|
||
|
|
<div class="font-bold">{{ usePrice(sums?.goldToCash ?? 0) }}</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
<template #action="{ column, record }">
|
||
|
|
<div class="gap-2 flex justify-center">
|
||
|
|
<!-- <a-tooltip
|
||
|
|
:key="record.active"
|
||
|
|
placement="bottom"
|
||
|
|
class="cursor-pointer"
|
||
|
|
@click="changeCustomerActivationFunction(record.id)"
|
||
|
|
>
|
||
|
|
<template #title>
|
||
|
|
<span>{{ record.active ? 'غیرفعال کردن' : 'فعال کردن' }}</span>
|
||
|
|
</template>
|
||
|
|
<Icon
|
||
|
|
:icon="record.active ? 'vuesax-linear:tick-circle' : 'vuesax-linear:close-circle'"
|
||
|
|
:color="record.active ? '#54AD06' : '#ad0627'"
|
||
|
|
/>
|
||
|
|
</a-tooltip>-->
|
||
|
|
<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('edit', record)">
|
||
|
|
<template #title>
|
||
|
|
<span>ویرایش</span>
|
||
|
|
</template>
|
||
|
|
<Icon icon="vuesax-linear:edit" color="#4572E9" />
|
||
|
|
</a-tooltip>
|
||
|
|
<!-- <a-tooltip
|
||
|
|
placement="bottom"
|
||
|
|
class="cursor-pointer"
|
||
|
|
@click="emits('delete', record.id)"
|
||
|
|
>
|
||
|
|
<template #title>
|
||
|
|
<span>حذف</span>
|
||
|
|
</template>
|
||
|
|
<Icon icon="vuesax-linear:trash" color="#EB3535" />
|
||
|
|
</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/walletColumns'
|
||
|
|
import { useUserStore } from '@/store/userStore'
|
||
|
|
import { usePrefix } from '@core/composable/usePrefix'
|
||
|
|
import { message } from 'ant-design-vue'
|
||
|
|
import { getWalletTable } from '@/api/wallet'
|
||
|
|
import { usePrice } from '../../../../core/utils/usePrice'
|
||
|
|
|
||
|
|
const [submit, reload] = useBaseTable()
|
||
|
|
/*const select = (val) => {
|
||
|
|
val.sts === 1 ? return ['1'] : ['2']
|
||
|
|
}*/
|
||
|
|
//emits
|
||
|
|
const emits = defineEmits(['delete', 'edit', 'add', 'info', 'sums'])
|
||
|
|
|
||
|
|
const { prefixCls } = usePrefix('pophoverstatus')
|
||
|
|
|
||
|
|
//permission
|
||
|
|
/*function checkPermission(temp: string) {
|
||
|
|
const store = useUserStore()
|
||
|
|
return store.canAccess(temp)
|
||
|
|
}*/
|
||
|
|
|
||
|
|
//define table
|
||
|
|
const table = ref(null)
|
||
|
|
const sums = ref<any>()
|
||
|
|
|
||
|
|
const tblProps = ref<any>({
|
||
|
|
columns: cols,
|
||
|
|
api: async (params: TableInput) => {
|
||
|
|
const data = await getWalletTable(params)
|
||
|
|
sums.value = data?.sums
|
||
|
|
emits('sums', data?.sums)
|
||
|
|
console.log(sums.value)
|
||
|
|
return data
|
||
|
|
}
|
||
|
|
//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>
|