Compare commits
10
Commits
5a4de3c870
...
668becae9d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
668becae9d | ||
|
|
e5503f8864 | ||
|
|
e5a76193b7 | ||
|
|
d4db3e4e95 | ||
|
|
57dfb44396 | ||
|
|
6fb5bb763b | ||
|
|
9bf89cf938 | ||
|
|
3eaeb7bc07 | ||
|
|
6b918237fc | ||
|
|
15e3e3e6c1 |
Vendored
+1
@@ -58,6 +58,7 @@ declare module '@vue/runtime-core' {
|
||||
BaseTable: typeof import('./src/core/components/BaseTable/index.ts')['default']
|
||||
BaseTableOld: typeof import('./src/core/components/BaseTableOld/index.ts')['default']
|
||||
BasicCard: typeof import('./src/components/BasicCard.vue')['default']
|
||||
BasicImageUploader: typeof import('./src/components/BasicImageUploader.vue')['default']
|
||||
BasicInfoItem: typeof import('./src/components/BasicInfoItem.vue')['default']
|
||||
BasicInput: typeof import('./src/components/BasicInput.vue')['default']
|
||||
BasicMainCard: typeof import('./src/components/BasicMainCard.vue')['default']
|
||||
|
||||
@@ -5,7 +5,7 @@ import pkg from './package.json'
|
||||
|
||||
const baseURL: string = 'https://ghatreh.gold/server/'
|
||||
|
||||
const uploadURL = `${baseURL}/site/file`
|
||||
const uploadURL = `${baseURL}admin/file`
|
||||
const baseURLStorage = baseURL
|
||||
const prefixCls = 'hr-tamin'
|
||||
const version = pkg.version
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ export const createProduct = async (obj: Customer) =>
|
||||
await useAxios.post<AddId>(`/admin/product`, obj)
|
||||
|
||||
export const deleteCustomer = async (id: number) => await useAxios.delete(`/admin/product/${id}`)
|
||||
export const updateCustomer = async (id: number, obj: Customer) =>
|
||||
export const updateProduct = async (id: number, obj: Customer) =>
|
||||
await useAxios.put<AddId>(`/admin/product/${id}`, obj)
|
||||
|
||||
export const getCustomerTable = async (params: TableInput) =>
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<div class="clearfix">
|
||||
<a-upload
|
||||
v-model:file-list="fileList"
|
||||
:action="props.url"
|
||||
list-type="picture-card"
|
||||
:headers="props.headers"
|
||||
:maxCount="props.maxCount"
|
||||
@preview="handlePreview"
|
||||
@change="handleChange"
|
||||
>
|
||||
<div v-if="fileList.length < maxCount">
|
||||
<plus-outlined/>
|
||||
<div style="margin-top: 8px">بارگذاری</div>
|
||||
</div>
|
||||
</a-upload>
|
||||
<a-modal :visible="previewVisible" :title="previewTitle" :footer="null" @cancel="handleCancel">
|
||||
<img alt="example" style="width: 100%" :src="previewImage"/>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {PlusOutlined} from '@ant-design/icons-vue';
|
||||
import {defineComponent, ref} from 'vue';
|
||||
|
||||
import {message, type UploadChangeParam, type UploadProps} from 'ant-design-vue';
|
||||
|
||||
function getBase64(file: File) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = () => resolve(reader.result);
|
||||
reader.onerror = error => reject(error);
|
||||
});
|
||||
}
|
||||
|
||||
const previewVisible = ref(false);
|
||||
const previewImage = ref('');
|
||||
const previewTitle = ref('');
|
||||
|
||||
interface Prop {
|
||||
url: string
|
||||
multiple?: boolean
|
||||
fileList?: Array<FileList>
|
||||
maxCount?: number
|
||||
headers?: any
|
||||
}
|
||||
|
||||
const props = defineProps<Prop>()
|
||||
|
||||
//emits
|
||||
const emits = defineEmits(['update:fileList', 'ok', 'delete'])
|
||||
const fileList = computed({
|
||||
get() {
|
||||
return props.fileList || ([] as Array<FileList>)
|
||||
},
|
||||
set(value) {
|
||||
emits('update:fileList', value)
|
||||
}
|
||||
})
|
||||
|
||||
const handleChange = (info: UploadChangeParam) => {
|
||||
// console.log(info)
|
||||
const status = info.file.status
|
||||
if (status !== 'uploading') {
|
||||
// console.log(info.file, info.fileList)
|
||||
/*emits('ok', info.file.response.id)*/
|
||||
}
|
||||
if (status === 'done') {
|
||||
// message.success(`${info.file.name} file uploaded successfully.`)
|
||||
console.log(fileList)
|
||||
emits('ok', info.file.response.id)
|
||||
} else if (status === 'error') {
|
||||
message.error(`خطا در بارگذاری فایل`)
|
||||
} else if (status === 'removed') {
|
||||
emits('delete', info.file.uid)
|
||||
}
|
||||
}
|
||||
|
||||
const handleCancel = () => {
|
||||
previewVisible.value = false;
|
||||
previewTitle.value = '';
|
||||
};
|
||||
const handlePreview = async (file: UploadProps['fileList'][number]) => {
|
||||
if (!file.url && !file.preview) {
|
||||
file.preview = (await getBase64(file.originFileObj)) as string;
|
||||
}
|
||||
previewImage.value = file.url || file.preview;
|
||||
previewVisible.value = true;
|
||||
previewTitle.value = file.name || file.url.substring(file.url.lastIndexOf('/') + 1);
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
/* you can make up upload button and sample style by using stylesheets */
|
||||
.ant-upload-select-picture-card i {
|
||||
font-size: 32px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.ant-upload-select-picture-card .ant-upload-text {
|
||||
margin-top: 8px;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
@@ -76,9 +76,9 @@ const handleCancel = () => {
|
||||
}
|
||||
|
||||
const beforeUpload = (file: UploadProps['fileList'][number]) => {
|
||||
const isLt100k = file.size / 1024 / 1024 < 0.2
|
||||
const isLt100k = file.size / 1024 / 1024 < 0.4
|
||||
if (!isLt100k) {
|
||||
message.error('حداکثر حجم بارگذاری 200 کیلو بایت میباشد')
|
||||
message.error('حداکثر حجم بارگذاری 400 کیلو بایت میباشد')
|
||||
}
|
||||
return isLt100k
|
||||
}
|
||||
|
||||
@@ -6,6 +6,14 @@ export function usePrice(price: number, digit = true, unit = 'ریال') {
|
||||
return `${_price} ${unit}`
|
||||
}
|
||||
|
||||
export function usePriceWithoutType(price?: number, digit = true, unit = 'ریال') {
|
||||
let _price = price?.toString()
|
||||
if (digit) {
|
||||
_price = _price?.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
||||
}
|
||||
return `${_price}`
|
||||
}
|
||||
|
||||
export function useTowDecimal(num: string | number): string | number {
|
||||
const temp = num.toString().match(/^-?\d+(?:\.\d{0,2})?/)
|
||||
if (temp && temp.length > 0) return temp[0]
|
||||
|
||||
+46
-42
@@ -1,55 +1,59 @@
|
||||
import type { User } from '@/model/user'
|
||||
import type { Wallet } from '@/model/wallet'
|
||||
import type {User} from '@/model/user'
|
||||
import type {Wallet} from '@/model/wallet'
|
||||
|
||||
export interface AddId {
|
||||
id: number
|
||||
id: number
|
||||
}
|
||||
|
||||
export interface Product{
|
||||
id: number,
|
||||
amount: number,
|
||||
percent_fee_buy: number,
|
||||
cash_fee_buy: number,
|
||||
percent_fee_sell: number,
|
||||
cash_fee_sell: number
|
||||
group_type: string
|
||||
unit: string
|
||||
active: boolean
|
||||
created_at: string
|
||||
open_buy: boolean
|
||||
open_sell: boolean
|
||||
show: boolean
|
||||
title: string
|
||||
updated_at: string
|
||||
methodOption: number
|
||||
prices: MethodePrices[]
|
||||
price: number
|
||||
reading_method: string
|
||||
weight: number
|
||||
auto_open_at: string
|
||||
auto_close_at: string
|
||||
export interface Product {
|
||||
id: number,
|
||||
amount: number,
|
||||
percent_fee_buy: number,
|
||||
cash_fee_buy: number,
|
||||
percent_fee_sell: number,
|
||||
cash_fee_sell: number
|
||||
group_type: string
|
||||
unit: string
|
||||
active: boolean
|
||||
created_at: string
|
||||
open_buy: boolean
|
||||
open_sell: boolean
|
||||
show: boolean
|
||||
title: string
|
||||
updated_at: string
|
||||
methodOption: number
|
||||
prices: MethodePrices[]
|
||||
price: number
|
||||
reading_method: string
|
||||
weight: number
|
||||
auto_open_at: string
|
||||
auto_close_at: string
|
||||
description: string
|
||||
file_id: number | null
|
||||
inventory: number
|
||||
}
|
||||
|
||||
export interface MethodePrices {
|
||||
id: string
|
||||
name: string
|
||||
price: number
|
||||
profit: number
|
||||
id: string
|
||||
name: string
|
||||
price: number
|
||||
profit: number
|
||||
}
|
||||
|
||||
export interface SetActiveTime {
|
||||
auto_open_at: string
|
||||
auto_close_at: string
|
||||
auto_open_at: string
|
||||
auto_close_at: string
|
||||
}
|
||||
|
||||
export interface Balance {
|
||||
cashBalance: number
|
||||
cashBalanceOfKalhor: number
|
||||
cashBalanceOfLiman: number
|
||||
goldBalance: number
|
||||
goldBalanceOfKalhor: number
|
||||
goldBalanceOfLiman: number
|
||||
mazanehBalance: number
|
||||
mazanehBalanceOfKalhor: number
|
||||
income_money: number
|
||||
mazanehBalanceOfLiman: number
|
||||
cashBalance: number
|
||||
cashBalanceOfKalhor: number
|
||||
cashBalanceOfLiman: number
|
||||
goldBalance: number
|
||||
goldBalanceOfKalhor: number
|
||||
goldBalanceOfLiman: number
|
||||
mazanehBalance: number
|
||||
mazanehBalanceOfKalhor: number
|
||||
income_money: number
|
||||
mazanehBalanceOfLiman: number
|
||||
}
|
||||
@@ -108,7 +108,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</BaseCard>
|
||||
<BaseCard class="h-full md:col-span-7">
|
||||
<BaseCard class="h-full w-full md:col-span-7">
|
||||
<ASpin :spinning="tarazLoading">
|
||||
<div class="grid md:grid-cols-3 gap-3 mt-2">
|
||||
<div>
|
||||
@@ -199,12 +199,13 @@
|
||||
</div>
|
||||
</ASpin>
|
||||
</BaseCard>
|
||||
|
||||
<BaseCard class="w-full md:w-none md:col-span-2">
|
||||
<div class="text-lg font-bold">تراز بدهی</div>
|
||||
<div ref="main" class="w-full aspect-square"></div>
|
||||
</BaseCard>
|
||||
|
||||
<BaseCard class="md:col-span-5">
|
||||
<BaseCard class="w-full md:col-span-5">
|
||||
<div id="chart">
|
||||
<div class="font-bold text-lg mt-2 text-center md:text-right mb-2">مقایسه قیمت ها</div>
|
||||
<apexchart
|
||||
@@ -257,9 +258,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</BaseCard>
|
||||
<div class="md:col-span-7 md:grid gap-4">
|
||||
|
||||
<div class="md:col-span-7 w-full grid gap-4">
|
||||
<BaseCard>
|
||||
<div class=" ">
|
||||
<div>
|
||||
<div class="flex flex-col md:flex-row justify-between items-center">
|
||||
<div class="flex items-end">
|
||||
<div class="text-2xl font-bold ml-2">{{ usePrice(123456789123, true, '') }}</div>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
import type {BaseTableColumn} from '@core/type/baseTable'
|
||||
import {toJalaliNoTime, toTime} from '@core/utils/useDataTime'
|
||||
import CustomTag from '@/components/CustomTag.vue'
|
||||
import {usePrice} from '@core/utils/usePrice'
|
||||
import { usePrice, usePriceWithoutType } from "@core/utils/usePrice";
|
||||
/*import BudgetSelect from '@/components/BudgetSelect.vue'
|
||||
import { useStaticApiListsStore } from '@/store/staticApisStore'
|
||||
import type { FilterSelect } from '@/model/filterSelect'
|
||||
@@ -84,6 +84,40 @@ export const cols: BaseTableColumn[] = [
|
||||
key: 'customer.name',
|
||||
type: 'Text'
|
||||
},
|
||||
{
|
||||
title: 'موجودی طلایی بعد تراکنش (گرم)',
|
||||
dataIndex: 'balance_gold',
|
||||
key: 'balance_gold',
|
||||
type: 'Number',
|
||||
customRender: ({record}) => {
|
||||
return record.balance_gold > 0 ? (
|
||||
<div class="flex justify-center">
|
||||
<div class={'font-bold px-6 text-green'}>{record?.balance_gold ?? '_'}</div>
|
||||
</div>
|
||||
) : (
|
||||
<div class="flex justify-center">
|
||||
<div class={'font-bold px-6 text-red'}>{record?.balance_gold ?? '_'}</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'موجودی ریالی بعد تراکنش (ریال)',
|
||||
dataIndex: 'balance_cash',
|
||||
key: 'balance_cash',
|
||||
type: 'Number',
|
||||
customRender: ({record}) => {
|
||||
return record?.balance_cash > 0 ? (
|
||||
<div class="flex justify-center">
|
||||
<div class={'font-bold px-6 text-green'}>{usePriceWithoutType(record?.balance_cash) ?? '_'}</div>
|
||||
</div>
|
||||
) : (
|
||||
<div class="flex justify-center">
|
||||
<div class={'font-bold px-6 text-red'}>{usePriceWithoutType(record?.balance_cash) ?? '_'}</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'مقدار طلا طی تراکنش (گرم)',
|
||||
dataIndex: 'gold',
|
||||
|
||||
@@ -55,9 +55,9 @@
|
||||
@close="confirmWeightVisible = false"
|
||||
>
|
||||
<div class=" bg-gray-100 rounded-lg p-2">
|
||||
<div class="mb-4">برداشت فیزیکی ({{ confirmWithdraw.title }})</div>
|
||||
<div class="mb-4 mr-1"> به وزن ({{ confirmWithdraw.amount }})</div>
|
||||
<div class="mb-4 mr-1"> و قیمت ({{ usePrice(confirmWithdraw.price ?? 0, true, '') }})</div>
|
||||
<div class="mb-4">برداشت فیزیکی ({{ confirmWithdraw?.title }})</div>
|
||||
<div class="mb-4 mr-1"> به وزن ({{ confirmWithdraw?.amount }})</div>
|
||||
<div class="mb-4 mr-1"> و قیمت ({{ usePrice(confirmWithdraw?.price ?? 0, true, '') }})</div>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</div>
|
||||
@@ -261,18 +261,6 @@ function openWeight(val) {
|
||||
confirmWeightVisible.value = true
|
||||
}
|
||||
|
||||
function ok(i) {
|
||||
try {
|
||||
// await sendWeights()
|
||||
message.success('با موفقیت ثبت شد')
|
||||
} catch (e) {
|
||||
// message.error('خطا در بارگذاری اطلاعات')
|
||||
console.error(e)
|
||||
} finally {
|
||||
console.log()
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
Reference in New Issue
Block a user