1404/11/04- first

This commit is contained in:
2026-01-24 17:45:54 +03:30
commit edf1824229
554 changed files with 59581 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
<template>
<div class="">
<div class="text-gray-400">{{title}}:</div>
<div v-if="value" class="font-bold mt-1">{{value}}</div>
<slot v-else></slot>
</div>
</template>
<script setup lang="ts">
interface Prop {
title: string
value?: string
}
const props = defineProps<Prop>()
</script>
<style scoped lang="less">
</style>
@@ -0,0 +1,250 @@
<template>
<ADrawer :class="prefixCls" v-model:visible="localValue" placement="bottom" class="wrapp-taraz">
<div>
<div class="rounded-lg border-solid border-1px border-gray-200 p-2 mb-5">
<div class="flex items-center gap-5">
<div class="font-bold">تعیین وضعیت:</div>
<a-radio-group v-model:value="localSts" :options="stsOptions" />
</div>
<transition>
<div v-if="localSts === 3" class="flex items-center gap-3">
<div class="font-bold">قیمت پیشنهادی:</div>
<BasicInput
v-model:value="suggestedPrice"
addon-before="ریال"
type="price"
@click="hotSelect"
/>
</div>
</transition>
</div>
<div class="w-full bg-gray-50 border-solid border-1px border-gray-200 p-2 rounded-lg">
<div class="font-bold">مشخصات سفارش</div>
<div class="grid grid-cols-2 gap-2">
<div
class="rounded-lg bg-white grid grid-cols-2 col-span-2 p-2 mt-2 border-solid border-1px border-gray-100"
>
<Item title="شماره" :value="selectedItem?.id ?? '-'" />
<Item
title="مقدار"
:value="`${selectedItem?.amount ?? '-'} ${
selectedItem?.product?.unit === 'گرم' ? 'گرم' : 'عدد'
}`"
/>
<Item title="قیمت کل برای مشتری" :value="usePrice(selectedItem?.total_price ?? 0)" />
<Item title="سود کل برای مدیر" :value="usePrice(selectedItem?.total_fee_master ?? 0)" />
</div>
<Item title="میزان پرداخت شده" :value="usePrice(selectedItem?.payment_amount ?? 0)" />
<Item title="میزان مبلغ باقیمانده" :value="usePrice(selectedItem?.payment_remind ?? 0)" />
<Item
v-if="selectedItem?.product?.unit === 'گرم'"
title="قیمت هر مثقال"
:value="usePrice(parseInt((selectedItem?.price * 4.331800000515843).toFixed(0)))"
/>
<Item title="قیمت هر واحد برای مشتری" :value="usePrice(selectedItem?.price ?? 0)" />
<Item
title="قیمت هر واحد بدون سود"
:value="usePrice(selectedItem?.price_original ?? 0)"
/>
<Item
title="قیمت کل بدون سود"
:value="usePrice(selectedItem?.total_price_original ?? 0)"
/>
<Item title="سود هر واحد برای نماینده" :value="usePrice(selectedItem?.fee_agent ?? 0)" />
<Item title="سود کل برای نماینده" :value="usePrice(selectedItem?.total_fee_agent ?? 0)" />
<Item title="سود هر واحد برای مدیر" :value="usePrice(selectedItem?.fee_master ?? 0)" />
<Item title="قیمت پیشنهادی مدیر" :value="usePrice(selectedItem?.offer_price ?? 0)" />
<Item title="قیمت پیشنهادی قبلی مشتری" :value="usePrice(selectedItem?.pre_price ?? 0)" />
<Item title="تاریخ ایجاد رکورد" :value="toJalali(selectedItem?.created_at)" />
<Item title="تاریخ انجام سفارش" :value="toJalali(selectedItem?.pay_at)" />
<Item title="وضعیت پرداخت">
<CustomTag bg-color="#e0f2fe" text-color="#0284c7" class="px-3 font-bold py-1">
{{ paymentStsString(selectedItem?.payment_sts) }}
</CustomTag>
</Item>
<Item title="وضعیت سفارش">
<CustomTag
:bg-color="returnStsBgColor(selectedItem?.sts)"
:text-color="returnStsTextColor(selectedItem?.sts)"
class="px-3 font-bold py-1"
>{{ selectedItem?.sts_str }}
</CustomTag>
</Item>
</div>
<div class="font-bold mt-5">مشخصات محصول</div>
<div class="grid grid-cols-2 gap-2">
<Item title="کد" :value="selectedItem?.product?.id ?? '-'" />
<Item title="نام محصول" :value="selectedItem?.product?.title ?? '-'" />
<Item title="واحد" :value="selectedItem?.product?.unit ?? '-'" />
</div>
<div class="font-bold mt-5">مشخصات مشتری و نماینده</div>
<div class="grid grid-cols-2 gap-2">
<Item title="کد مشتری" :value="selectedItem?.customer?.id ?? '-'" />
<Item title="کد نماینده" :value="selectedItem?.customer?.agent_id ?? '-'" />
<Item title="نام و نام خانوادگی مشتری" :value="selectedItem?.customer?.name ?? '-'" />
<Item title="نام و نام خانوادگی نماینده" :value="selectedItem?.customer?.name ?? '-'" />
<Item title="نوع کاربر">
<CustomTag bg-color="#e0f2fe" text-color="#0284c7" class="px-3 font-bold py-1">
{{ selectedItem?.type === 1 ? 'نماینده' : 'مشتری' }}
</CustomTag>
</Item>
<Item title="شماره موبایل مشتری" :value="selectedItem?.customer?.mobile ?? '-'" />
<Item title="شماره موبایل نماینده" :value="selectedItem?.customer?.mobile ?? '-'" />
</div>
<ADivider class="!my-2" />
<div class="font-bold mt-5 mb-3 border-t">تراکنش ها</div>
<div
class="grid grid-cols-2 py-2 gap-2"
:class="[{'border-b-solid border-b-1px border-gray-300':selectedItem?.transaction?.length-1 !== index}]"
v-for="(item, index) in selectedItem?.transaction"
:key="index"
>
<Item title="عنوان تراکنش" :value="item?.title ?? '-'" />
<Item title="مقدار مبادله شده" :value="item.amount ?? '-'" />
<Item title="کد تراکنش" :value="item.id ?? '-'" />
<Item title="تاریخ ایجاد" :value="item.caj ?? '-'" />
</div>
</div>
<div class="flex justify-end mt-2">
<BaseButton @click="setStatus" type="primary">ثبت</BaseButton>
</div>
</div>
</ADrawer>
</template>
<script lang="ts" setup>
import { usePrefix } from '@core/composable/usePrefix'
import useBaseTable from '@core/components/BaseTable/hooks/useBaseTable'
const [reload] = useBaseTable()
const { prefixCls } = usePrefix('base-transactions')
import { usePrice } from '@core/utils/usePrice'
import { hotSelect, loading } from '@/utils'
import { message, type RadioGroupProps, Tooltip } from 'ant-design-vue'
import { toJalali } from '@core/utils/useDataTime'
import type { Order } from '@/model/order'
import Item from '@/pages/balance/components/Item.vue'
import CustomTag from '@/components/CustomTag.vue'
import { changeOrderSts } from '@/api/order'
interface Prop {
showTransactionsDrawer?: boolean
selectedItem?: object
}
const props = withDefaults(defineProps<Prop>(), {})
const emits = defineEmits(['update:showTransactionsDrawer', 'update:selectedSts'])
const stsOptions: RadioGroupProps['options'] = [
{ label: 'باز', value: 1 },
{ label: 'تایید شده', value: 2 },
{ label: 'ردشده', value: 4 },
{ label: 'رد شده و ثبت قیمت جدید', value: 3 }
]
function paymentStsString(localSts: number) {
switch (localSts) {
case 1:
return 'در انتظار پرداخت'
case 2:
return 'در حال پرداخت'
case 3:
return 'قسمتی پرداخت شده'
case 4:
return 'پرداخت شده'
case 5:
return 'قسمتی باز پرداخت شده'
case 6:
return 'مرجوعی'
case 7:
return 'پرداخت نشده'
}
}
const suggestedPrice = ref<number>(0)
const localValue = computed({
get() {
return props.showTransactionsDrawer
},
set(value) {
emits('update:showTransactionsDrawer', value)
}
})
const localSts = computed({
get() {
return props.selectedItem?.sts
},
set(value) {
emits('update:selectedSts', value)
}
})
function returnStsTextColor(val: number | undefined) {
switch (val) {
case 1:
return '#2563eb'
case 2:
return '#16a34a'
case 3:
return '#ca8a04'
case 4:
return '#dc2626'
case 6:
return '#57534e'
default:
return '#7c3aed'
}
}
function returnStsBgColor(val: number | undefined) {
switch (val) {
case 1:
return '#dbeafe'
case 2:
return '#dcfce7'
case 3:
return '#fef9c3'
case 4:
return '#fee2e2'
case 6:
return '#f5f5f4'
default:
return '#ede9fe'
}
}
async function setStatus() {
try {
loading.value = true
if (localSts.value === 3 && suggestedPrice.value === 0) {
message.error('لطفا قیمت پیشنهادی خود را وارد کنید')
return
} else {
await changeOrderSts({
order_id: props.selectedItem?.id,
sts: localSts.value,
offer_price: suggestedPrice.value
})
reload()
emits('update:showTransactionsDrawer', false)
message.success('وضعیت با موفقیت تغییر یافت')
}
} catch (e) {
console.log(e)
} finally {
loading.value = false
}
}
</script>
<style lang="less" scoped>
@prefix:~ '@{prefixCls}-base-transactions';
.@{prefix}{
.layout-item{
cursor: pointer;
border:2px solid #eee;
padding:5px;
&.active{
border-color: @primary-color;
color:#000000
}
}
}
</style>
+252
View File
@@ -0,0 +1,252 @@
<template>
<div class="wrapp">
<div class="w-full flex items-baseline gap-10 p-2 rounded-lg col-span-2">
<div class="w-full flex items-baseline flex-1 gap-3">
<p class="font-bold">تراز از :</p>
<BaseDatePicker
v-model:value="startTaraz"
@on-change="getTaraz(startTaraz, endTaraz)"
format="YYYY-MM-DD HH:mm:ss"
class="flex-1"
/>
</div>
<div class="w-full flex items-baseline flex-1 gap-3">
<p class="font-bold">تا :</p>
<BaseDatePicker
v-model:value="endTaraz"
@on-change="getTaraz(startTaraz, endTaraz)"
format="YYYY-MM-DD HH:mm:ss"
class="flex-1"
/>
</div>
</div>
<div class="mb-5 mr-2">
<a-switch
v-model:checked="directionChangeCheck"
checked-children="ارائه دهنده"
un-checked-children="مشتری"
/>
</div>
<div class="px-2 col-span-2 grid grid-cols-4 gap-1">
<div class="bg-blue rounded text-white py-1 flex justify-center items-center">تراز ها</div>
<div class="bg-blue rounded text-white py-1 flex justify-center items-center">
تراز ریالی (ریال)
</div>
<div class="bg-blue rounded text-white py-1 flex justify-center items-center">
تراز طلایی (گرم)
</div>
<div class="bg-blue rounded text-white py-1 flex justify-center items-center">
تراز مظنه (ریال)
</div>
<div class="bg-blue rounded text-white py-1 flex justify-center items-center">
تراز افجو
</div>
<div
class="rounded text-white py-1 flex justify-center items-center"
:class="
(balance?.cashBalanceOfLiman ?? 0) > 0
? 'bg-green'
: (balance?.cashBalanceOfLiman ?? 0) === 0
? 'bg-yellow'
: 'bg-red'
"
>
{{ usePrice(balance?.cashBalanceOfLiman ?? 0, true, '') }}
</div>
<div
class="rounded text-white py-1 flex justify-center items-center"
:class="
(balance?.goldBalanceOfLiman ?? 0) > 0
? 'bg-green'
: (balance?.goldBalanceOfLiman ?? 0) === 0
? 'bg-yellow'
: 'bg-red'
"
>
{{ (balance?.goldBalanceOfLiman ?? 0).toFixed(2) }}
</div>
<div
class="rounded text-white py-1 flex justify-center items-center"
:class="
(balance?.mazanehBalanceOfLiman ?? 0) > 0
? 'bg-green'
: (balance?.mazanehBalanceOfLiman ?? 0) === 0
? 'bg-yellow'
: 'bg-red'
"
>
{{
balance?.mazanehBalanceOfLiman
? usePrice(parseInt(balance?.mazanehBalanceOfLiman.toFixed(0)), true, '')
: 0
}}
</div>
</div>
<div class="flex justify-center items-center mx-2">
<a-spin :spinning="loading" size="40">
<div>
<div class="mt-2" v-if="balance?.liman?.orders.length">
<div class="px-2 col-span-2 grid grid-cols-4 gap-1">
<div class="bg-blue text-white py-1 flex justify-center items-center rounded">
کاربر
</div>
<div
class="bg-blue text-white py-1 flex justify-center items-center text-center rounded"
>
قیمت
</div>
<div
class="bg-blue text-white py-1 flex justify-center items-center text-center rounded"
>
میزان
</div>
<div
class="bg-blue text-white py-1 flex justify-center items-center text-center rounded"
>
تاریخ ثبت
</div>
</div>
<div
v-for="(order, index) in balance?.liman?.orders"
:key="index"
class="px-2 col-span-2 grid grid-cols-4 mt-1 bg-gray-100 hover:bg-gray-200 cursor-pointer"
@click="selectedOrder(order)"
>
<div class="py-1 flex justify-center items-center">
<p class="text-[12px] mb-0">{{ order?.customer?.name }}</p>
</div>
<div class="p-1">
<div
:class="[
getDirectionChange(order, directionChangeCheck) === 'خرید'
? 'text-[#006c05]'
: 'text-[#c3030a]'
]"
>
<p
class="text-[14px] mb-0 rounded text-center font-600"
:class="[order?.input_mode === 'gold' ? 'text-[#000000]' : '']"
>
{{ usePrice(order?.total_price ?? 0, true, '') }}
</p>
</div>
<div class="min-w-[100px]">
<label class="text-[8px] mb-0"> در مظنه : </label>
<label class="text-[12px] mb-0 text-center">
{{ usePrice(order?.price_in_mesghal ?? 0, true, '') }}
</label>
</div>
</div>
<div class="p-1 flex flex-col items-center justify-center">
<div
:class="[
getDirectionChange(order, directionChangeCheck) === 'خرید'
? 'text-[#006c05]'
: 'text-[#c3030a]'
]"
>
<p
class="text-[14px] mb-0 rounded text-center font-600"
:class="[order?.input_mode === 'cash' ? 'text-[#000000]' : '']"
>
{{ order?.amount.toFixed(3) }}
</p>
</div>
<p
class="text-[12px] mb-0 inline rounded px-2 font-600 pr"
:class="[
getDirectionChange(order, directionChangeCheck) === 'خرید'
? 'text-[#006c05]'
: 'text-[#c3030a]'
]"
>
{{ getDirectionChange(order, directionChangeCheck) }}
</p>
</div>
<div class="py-1 flex justify-center items-center text-center">
<p class="text-[12px] mb-0 min-w-[100px]">{{ toJalali(order?.pay_at) }}</p>
</div>
</div>
</div>
<p v-else class="mb-0 mt-2 text-center text-[15px]">هیچ سفارشی موجود نیست</p>
</div>
</a-spin>
</div>
<TransactionDetail
v-model:showTransactionsDrawer="visible"
:selectedItem="selectedItem"
@update:selectedSts="editSts"
/>
</div>
</template>
<script setup lang="ts">
import TransactionDetail from './components/TransactionDetail.vue'
import { loading } from '@/utils/index'
import { balance, getTaraz } from '@core/utils/price'
import { usePrice } from '@core/utils/usePrice'
import { onMounted, ref } from 'vue'
import { getNow, toJalali } from '@core/utils/useDataTime'
const startTaraz = ref<string>('')
const endTaraz = ref<string>('')
const selectedItem = ref<object>({})
const visible = ref<boolean>(false)
const directionChangeCheck = ref<boolean>(false)
const orginalDirectionget = ref<number>()
const color = ref<string>()
onMounted(async () => {
startTaraz.value = getNow('YYYY-MM-DD HH:mm:ss')
endTaraz.value = getNow('YYYY-MM-DD HH:mm:ss')
await getTaraz(startTaraz.value, endTaraz.value)
})
type Order = {
direction?: number
}
//---------------مشتری یا ارایه دهنده
function getDirectionChange(order: Order | null, directionChangeCheck: boolean): string {
let directionChange: number | undefined
let caption: string | undefined
directionChange = order?.direction
if (directionChangeCheck) {
if (directionChange === 1) {
directionChange = 2
caption = 'فروش'
color.value = '#c3030a'
} else {
directionChange = 1
caption = 'خرید'
color.value = '#006c05'
}
} else {
if (order?.direction === 1) {
caption = 'خرید'
color.value = '#006c05'
} else {
caption = 'فروش'
color.value = '#c3030a'
}
}
orginalDirectionget.value = directionChange
return caption
}
function selectedOrder(val: object) {
visible.value = true
selectedItem.value = val
}
function editSts(sts: number) {
const order = selectedItem?.value
order.sts = sts
}
</script>
<style lang="less">
.wrapp {
@media screen and (min-width: 768px) {
width: 400px;
margin: 0 auto;
}
}
</style>