Merge remote-tracking branch 'origin/kashkool' into kashkool

This commit is contained in:
2026-07-02 09:43:22 +03:30
52 changed files with 2885 additions and 1051 deletions
@@ -1,221 +1,14 @@
<template>
<div class="">
<div ref="el" class="px-3 pt-15"
>
<div class="flex gap-2">
<BasicSelect v-model:value="selectedProduct" :items="items"
class="w-full"
key-name="id"
:show-search="false"
value-name="title"
size="large"
placeholder="لطفا محصول را انتخاب کنید"
:has-tooltip="true"/>
<BasicButton :disabled-b="selectedProduct==null" type="primary" @click="handleAdd">افزودن</BasicButton>
</div>
<div class="h-70vh rounded-lg bg-white mt-2 border-gray-200 border-1 overflow-y-auto p-2">
<div v-for="(val,index) in selectedProducts" class="rounded-lg p-2 bg-gray-100 mb-2">
<div class="flex">
<div class="bg-gray-100 m-2 rounded-lg w-28 h-28 flex justify-center p-2">
<img v-if="val.product.group_type=='گوی'" :src="goyImg">
<img v-if="val.product.group_type=='مکعب'" :src="mokaabImg">
<img v-if="val.product.group_type=='سکه'" :src="sekkeImg">
<img v-if="val.product.group_type=='شمش ونوس'" :src="venusImg">
</div>
<div class="w-full">
<div class="flex justify-between">
<div class="font-bold text-lg">
{{ val.product.title }}
</div>
<BasicButton icon="vuesax-linear:trash" icon-class="text-red" @click="handleRemove(val.product.id)"/>
</div>
<div class="flex mt-3 justify-between items-center">
<div>تعداد موجودی:</div>
<div class="flex gap-1 items-center">
<div class="font-bold">{{ val.product.wallet.gold }}</div>
<div>{{ val.product.unit }}</div>
</div>
</div>
<div class="flex justify-between items-center mt-2">
<div>تعداد درخواستی:</div>
<div class="flex gap-1 items-center w-40%">
<BasicInput v-model:value="val.count" addon-before="عدد"/>
</div>
</div>
</div>
</div>
</div>
</div>
<BasicButton :disabled-b="selectedProducts.length==0" class="w-full absolute bottom-10 mt-2"
@click="handelFirstSubmit()">ثبت
</BasicButton>
</div>
<!-- <ActionSheet v-model:show="editPassVisible">salam</ActionSheet>-->
</div>
<BasicActionSheet v-model:show="showAddress">
<div class="h-120 flex flex-col ">
<div class="text-center">
انتخاب آدرس
</div>
<div class="overflow-y-scroll h-85">
<ARadioGroup v-model:value="selectedAddressID">
<div class="flex flex-col ">
<div class="text-base rounded-lg p-4 m-2 shadow-md font-medium" v-for="item in address">
<ARadio :value="item.id">{{ item.province }} / {{ item.city }} / {{ item.address }}</ARadio>
</div>
</div>
</ARadioGroup>
</div>
<div class="flex gap-2 pt-2">
<BasicButton class=" " @click="showAddress=false;addAddressVisible=true">افزودن آدرس +</BasicButton>
<BasicButton class="w-2/3 " type="primary" @click="handelsubmit">ثبت نهایی</BasicButton>
</div>
</div>
</BasicActionSheet>
<BasicActionSheet v-model:show="addAddressVisible" >
<div class=" ">
<New_EditAddress @onOk="handleAddress"></New_EditAddress>
</div>
</BasicActionSheet>
<MobileNewRequestView v-if="!isDesktop" />
<DesktopNewRequestView v-if="isDesktop" />
</template>
<script lang="ts" setup>
import { useNewPhysicalRequestPage } from '../composables/useNewPhysicalRequestPage'
import { usePhysicalReceiveShellContext } from '../composables/usePhysicalReceiveShell'
import DesktopNewRequestView from '../desktop/DesktopNewRequestView.vue'
import MobileNewRequestView from '../mobile/MobileNewRequestView.vue'
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
import router from '@/router'
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import BasicSelect from '@/components/BasicPacks/BasicSelect.vue'
import {onMounted, ref} from 'vue'
import {loading} from '@/utils'
import {getProductInventory} from '@/api/products'
import type {CountPInventory, PInventory} from '@/models/products'
import goyImg from '@/assets/img/goyImg.svg'
import mokaabImg from '@/assets/img/mokaabImg.svg'
import sekkeImg from '@/assets/img/sekkeImg.svg'
import venusImg from "@/assets/img/venousImg.svg"
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
import {cloneDeep} from 'lodash'
import BasicActionSheet from "@/components/BasicPacks/BasicActionSheet.vue"
import {getCity, tableAddress} from "@/api/address"
import type {Address} from "@/models/address"
import Item from "@/views/base/address/components/Item.vue"
import {physicalReceiveApi} from "@/api/physicalreceive"
import {message} from "ant-design-vue"
import {required} from "@/utils/inputRules"
import BasicTextArea from "@/components/BasicPacks/BasicTextArea.vue"
import New_EditAddress from "@/views/base/address/components/New_EditAddress.vue"
const items = ref<PInventory[]>()
const baseItems = ref<PInventory[]>()
const selectedAddressID = ref<number>()
const selectedProduct = ref<number>()
const productsByWalletId = ref<Array>([])
const address = ref<Address>()
const selectedProducts = ref<CountPInventory[]>([])
const showAddress = ref<boolean>(false)
const addAddressVisible = ref<boolean>(false)
function handleAdd() {
console.log(selectedProducts.value)
selectedProducts.value?.push({
count: 0,
product: items.value?.find(x => x.id === selectedProduct.value)
})
items.value?.splice(items.value?.findIndex(x => x.id === selectedProduct.value), 1)
selectedProduct.value = undefined
}
function handleAddress() {
getAddress()
addAddressVisible.value = false
showAddress.value = true
}
function handleRemove(id: number) {
const findItem = baseItems.value?.find(x => x.id === id)
console.log(baseItems.value, id)
if (findItem) {
items.value?.push(findItem)
}
selectedProducts.value?.splice(selectedProducts.value?.findIndex(x => x.product.id === id), 1)
}
async function initProductWallet() {
try {
loading.value = true
items.value = (await getProductInventory()).rows.filter(x => (x.title !== 'آبشده نقدی' && x.wallet?.gold && x.wallet?.gold > 0))
baseItems.value = cloneDeep(items.value)
} catch (e) {
console.log(e)
} finally {
loading.value = false
}
}
async function handelFirstSubmit() {
try {
const zeroAmount = selectedProducts.value.map(item => item.count <= 0)
if (zeroAmount.includes(true)) {
message.error(`لطفاً تعداد درخواستی محصول را وارد کنید.`)
}
else {
showAddress.value = true
}
} catch (e) {
console.log(e)
}
}
async function handelsubmit() {
try {
loading.value = true
productsByWalletId.value = selectedProducts.value.map((val) => {
return {
wallet_id: val.product.wallet.id,
value: val.count
}
})
await physicalReceiveApi({
address_id: selectedAddressID.value,
wallets: productsByWalletId.value
}
)
await initProductWallet()
message.success("درخواست شما با موفقیت ارسال شد")
selectedProducts.value = []
} catch (e) {
console.log(e)
} finally {
loading.value = false
showAddress.value = false
}
}
onMounted(async () => {
await initProductWallet()
await getAddress()
})
async function getAddress(){
let {rows} = await tableAddress({page: 0, limit: 150})
address.value = rows
}
const { isDesktop } = usePhysicalReceiveShellContext()
useNewPhysicalRequestPage()
</script>
<style scoped>
/*.fade-enter-active,
.fade-leave-active {
transition: opacity 0.2s ease;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}*/
/*.trans{
transition: height 1s;
}*/
</style>
@@ -0,0 +1,50 @@
<template>
<div class="h-120 flex flex-col">
<div class="text-center">انتخاب آدرس</div>
<div class="overflow-y-scroll h-85">
<ARadioGroup v-model:value="selectedAddressID">
<div class="flex flex-col">
<div
v-for="addr in addresses"
:key="addr.id"
class="text-base rounded-lg p-4 m-2 shadow-md font-medium"
>
<ARadio :value="addr.id">
{{ addr.province }} / {{ addr.city }} / {{ addr.address }}
</ARadio>
</div>
</div>
</ARadioGroup>
</div>
<div class="flex gap-2 pt-2">
<BasicButton @click="emit('addAddress')">افزودن آدرس +</BasicButton>
<BasicButton class="w-2/3" type="primary" @click="emit('submit')">
ثبت نهایی
</BasicButton>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import type { Address } from '@/models/address'
interface Props {
addresses?: Address[]
selectedAddressId?: number
}
const props = defineProps<Props>()
const emit = defineEmits<{
addAddress: []
submit: []
'update:selectedAddressId': [value: number | undefined]
}>()
const selectedAddressID = computed({
get: () => props.selectedAddressId,
set: (value: number | undefined) => emit('update:selectedAddressId', value),
})
</script>
@@ -0,0 +1,108 @@
<template>
<div>
<div class="flex">
<div class="bg-gray-100 m-2 rounded-lg w-18 h-18 flex justify-center p-1 shrink-0">
<img :src="displayImage" class="object-contain w-full h-full" alt="" />
</div>
<div class="w-full min-w-0">
<div class="pr-cart-row__head">
<div class="truncate text-base font-bold">{{ item.product.title }}</div>
<BasicButton
icon="vuesax-linear:trash"
icon-class="text-red"
class="pr-cart-row__trash shrink-0"
@click="emit('remove', item.product.id)"
/>
<div class="pr-cart-row__stock text-xs">
<span>مقدار موجودی</span>
<span class="font-bold">{{ item.product.wallet.gold }}</span>
<span>{{ item.product.unit }}</span>
</div>
</div>
<div class="mt-2 flex justify-between items-center gap-2">
<div class="shrink-0">تعداد درخواستی:</div>
<div class="flex items-center gap-1 pr-cart-row__input">
<BasicInput
v-model:value="item.count"
:addon-before="item.product.unit"
addon-bg-color="#a72b77"
addon-text-color="white"
type="text"
inputmode="numeric"
/>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
import type { CountPInventory } from '@/models/products'
import { getProductDisplayImage } from '@/utils/productAssets'
interface Props {
item: CountPInventory
}
const props = defineProps<Props>()
const displayImage = computed(() =>
getProductDisplayImage({
group_type: props.item.product.group_type,
title: props.item.product.title,
file: props.item.product.file,
}),
)
const emit = defineEmits<{
remove: [id: number]
}>()
</script>
<style scoped lang="less">
.pr-cart-row__head {
display: grid;
grid-template-columns: 1fr auto;
grid-template-rows: auto auto;
column-gap: 0.5rem;
row-gap: 0.125rem;
align-items: start;
}
.pr-cart-row__trash {
grid-column: 2;
grid-row: 1 / span 2;
justify-self: end;
}
.pr-cart-row__stock {
grid-column: 1;
grid-row: 2;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.25rem;
}
.pr-cart-row__input {
width: auto;
max-width: 10rem;
:deep(.noname-input),
:deep(.ant-input-group-wrapper) {
width: 100%;
}
:deep(.ant-input-group-addon) {
min-width: 3.75rem;
padding-inline: 6px;
white-space: nowrap;
font-size: 12px;
font-weight: 600;
}
}
</style>
@@ -1,59 +1,18 @@
<template>
<div class="physical-receive-page-root">
<DesktopPhysicalReceiveListView
v-show="isDesktop"
:request-items="requestItems"
@add="openAdd"
/>
<div v-show="!isDesktop">
<div class="absolute inset-0 bg-cover bg-center opacity-60" :style="{ backgroundImage: `url(${img})` }" />
<div class="bg-white w-full transaction-list py-3 px-3 font-bold drop-shadow flex justify-between z-10">
<div>لیست دریافت فیزیکی</div>
</div>
<div class="flex flex-col gap-4 pt-13 pb-35 px-2">
<RequestItem v-for="item in requestItems" :key="item.id" :item="item" />
</div>
<Transition mode="out-in" name="fade">
<div
class="wrap-fix bottom-0 h-[19vh] bg-[#FBFBFC] shadow-lg rounded-3xl flex justify-center pt-3 z-200"
style="box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 26px 11px"
@click="openAdd"
>
<BasicIcon icon="vuesax-linear:add" />
<div class="cursor-pointer">افزودن درخواست جدید</div>
</div>
</Transition>
</div>
</div>
<MobileRequestListView v-show="!isDesktop" />
<DesktopPhysicalReceiveListView
v-show="isDesktop"
:request-items="requestItems"
@add="openAdd"
/>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { getPhysicalReceiveList } from '@/api/physicalreceive'
import type { Physicalreceive } from '@/models/physicalreceive'
import RequestItem from '@/views/base/physicalReceive/components/RequestItem.vue'
import router from '@/router'
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
import img from '@/assets/img/user_ly1.svg'
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
import { usePhysicalReceiveList } from '../composables/usePhysicalReceiveList'
import { usePhysicalReceiveShellContext } from '../composables/usePhysicalReceiveShell'
import DesktopPhysicalReceiveListView from '../desktop/DesktopPhysicalReceiveListView.vue'
import MobileRequestListView from '../mobile/MobileRequestListView.vue'
const isDesktop = useDesktopBreakpoint()
const requestItems = ref<Physicalreceive[]>([])
const openAdd = () => {
router.push({ name: 'new' })
}
onMounted(async () => {
const { rows } = await getPhysicalReceiveList()
requestItems.value = rows
})
const { isDesktop } = usePhysicalReceiveShellContext()
const { requestItems, openAdd } = usePhysicalReceiveList()
</script>
<style scoped>
.physical-receive-page-root {
min-height: 100%;
height: 100%;
}
</style>
@@ -0,0 +1,170 @@
import { inject, nextTick, onMounted, provide, ref, type InjectionKey, type Ref } from 'vue'
import { cloneDeep } from 'lodash'
import { message } from 'ant-design-vue'
import router from '@/router'
import { getProductInventory } from '@/api/products'
import { physicalReceiveApi } from '@/api/physicalreceive'
import { tableAddress } from '@/api/address'
import type { CountPInventory, PInventory } from '@/models/products'
import type { Address } from '@/models/address'
import { loading } from '@/utils'
import { usePhysicalReceiveShellContext } from './usePhysicalReceiveShell'
export interface NewPhysicalRequestContext {
isDesktop: Ref<boolean>
items: Ref<PInventory[] | undefined>
selectedProduct: Ref<number | undefined>
selectedProducts: Ref<CountPInventory[]>
address: Ref<Address[] | undefined>
selectedAddressID: Ref<number | undefined>
showAddress: Ref<boolean>
addAddressVisible: Ref<boolean>
handleAdd: () => void
handleRemove: (id: number) => void
handelFirstSubmit: () => Promise<void>
handelsubmit: () => Promise<void>
handleAddress: () => void
}
export const NEW_PHYSICAL_REQUEST_KEY: InjectionKey<NewPhysicalRequestContext> =
Symbol('newPhysicalRequest')
export function useNewPhysicalRequestPage() {
const { isDesktop } = usePhysicalReceiveShellContext()
const items = ref<PInventory[]>()
const baseItems = ref<PInventory[]>()
const selectedAddressID = ref<number>()
const selectedProduct = ref<number>()
const productsByWalletId = ref<Array<{ wallet_id: number; value: number }>>([])
const address = ref<Address[]>()
const selectedProducts = ref<CountPInventory[]>([])
const showAddress = ref(false)
const addAddressVisible = ref(false)
function handleAdd() {
const product = items.value?.find((x) => x.id === selectedProduct.value)
if (!product) return
selectedProducts.value.push({
count: 0,
product,
})
items.value?.splice(items.value.findIndex((x) => x.id === selectedProduct.value), 1)
selectedProduct.value = undefined
}
function handleAddress() {
getAddress()
addAddressVisible.value = false
showAddress.value = true
}
function handleRemove(id: number) {
const findItem = baseItems.value?.find((x) => x.id === id)
if (findItem) {
items.value?.push(findItem)
}
selectedProducts.value.splice(
selectedProducts.value.findIndex((x) => x.product.id === id),
1,
)
}
async function initProductWallet() {
try {
loading.value = true
const inventory = (await getProductInventory()).rows.filter(
(x) => x.title !== 'آبشده نقدی' && x.wallet?.gold && x.wallet.gold > 0,
)
items.value = inventory
baseItems.value = cloneDeep(inventory)
} catch (e) {
console.log(e)
} finally {
loading.value = false
}
}
async function handelFirstSubmit() {
try {
const zeroAmount = selectedProducts.value.map((item) => item.count <= 0)
if (zeroAmount.includes(true)) {
message.error('لطفاً تعداد درخواستی محصول را وارد کنید.')
} else {
showAddress.value = true
}
} catch (e) {
console.log(e)
}
}
async function handelsubmit() {
if (!selectedAddressID.value) {
message.error('لطفاً آدرس را انتخاب کنید.')
return
}
try {
loading.value = true
productsByWalletId.value = selectedProducts.value.map((val) => ({
wallet_id: val.product.wallet.id,
value: val.count,
}))
await physicalReceiveApi({
address_id: selectedAddressID.value,
wallets: productsByWalletId.value,
})
showAddress.value = false
selectedAddressID.value = undefined
selectedProducts.value = []
await nextTick()
message.success('درخواست شما با موفقیت ارسال شد')
await initProductWallet()
await router.push({ name: 'list' })
} catch (e) {
console.log(e)
} finally {
loading.value = false
}
}
async function getAddress() {
const { rows } = await tableAddress({ page: 0, limit: 150 })
address.value = rows
}
onMounted(async () => {
await initProductWallet()
await getAddress()
})
const context: NewPhysicalRequestContext = {
isDesktop,
items,
selectedProduct,
selectedProducts,
address,
selectedAddressID,
showAddress,
addAddressVisible,
handleAdd,
handleRemove,
handelFirstSubmit,
handelsubmit,
handleAddress,
}
provide(NEW_PHYSICAL_REQUEST_KEY, context)
return context
}
export function useNewPhysicalRequestContext() {
const context = inject(NEW_PHYSICAL_REQUEST_KEY)
if (!context) {
throw new Error('useNewPhysicalRequestContext must be used within useNewPhysicalRequestPage')
}
return context
}
@@ -0,0 +1,37 @@
import { inject, onMounted, provide, ref, type InjectionKey, type Ref } from 'vue'
import { getPhysicalReceiveList } from '@/api/physicalreceive'
import type { Physicalreceive } from '@/models/physicalreceive'
import router from '@/router'
export interface PhysicalReceiveListContext {
requestItems: Ref<Physicalreceive[]>
openAdd: () => void
}
export const PHYSICAL_RECEIVE_LIST_KEY: InjectionKey<PhysicalReceiveListContext> =
Symbol('physicalReceiveList')
export function usePhysicalReceiveList() {
const requestItems = ref<Physicalreceive[]>([])
function openAdd() {
router.push({ name: 'new' })
}
onMounted(async () => {
const { rows } = await getPhysicalReceiveList()
requestItems.value = rows
})
const context: PhysicalReceiveListContext = { requestItems, openAdd }
provide(PHYSICAL_RECEIVE_LIST_KEY, context)
return context
}
export function usePhysicalReceiveListContext() {
const context = inject(PHYSICAL_RECEIVE_LIST_KEY)
if (!context) {
throw new Error('usePhysicalReceiveListContext must be used within usePhysicalReceiveList')
}
return context
}
@@ -0,0 +1,23 @@
import { inject, provide, type InjectionKey } from 'vue'
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
export interface PhysicalReceiveShellContext {
isDesktop: ReturnType<typeof useDesktopBreakpoint>
}
export const PHYSICAL_RECEIVE_SHELL_KEY: InjectionKey<PhysicalReceiveShellContext> =
Symbol('physicalReceiveShell')
export function usePhysicalReceiveShell() {
const isDesktop = useDesktopBreakpoint()
provide(PHYSICAL_RECEIVE_SHELL_KEY, { isDesktop })
return { isDesktop }
}
export function usePhysicalReceiveShellContext() {
const context = inject(PHYSICAL_RECEIVE_SHELL_KEY)
if (!context) {
throw new Error('usePhysicalReceiveShellContext must be used within physical receive shell')
}
return context
}
@@ -0,0 +1,126 @@
<template>
<div class="dinner physical-receive-page">
<div class="dinner__container">
<DesktopPageTopbar title="درخواست جدید" show-back />
<div class="dinner-surface p-5 space-y-4">
<div class="physical-new-request__picker-row">
<div class="physical-new-request__select">
<BasicSelect
v-model:value="selectedProduct"
:items="items"
key-name="id"
:show-search="false"
value-name="title"
size="large"
placeholder="لطفا محصول را انتخاب کنید"
:has-tooltip="false"
/>
</div>
<BasicButton
class="physical-new-request__add-btn"
:disabled-b="selectedProduct == null"
type="primary"
@click="handleAdd"
>
افزودن
</BasicButton>
</div>
<div class="space-y-2">
<div
v-for="val in selectedProducts"
:key="val.product.id"
class="rounded-lg p-2 bg-gray-100"
>
<PhysicalReceiveCartRow :item="val" @remove="handleRemove" />
</div>
<div v-if="selectedProducts.length === 0" class="text-center text-gray-500 py-8">
محصولی به سبد اضافه نشده است.
</div>
</div>
<BasicButton
:disabled-b="selectedProducts.length == 0"
class="w-full"
type="primary"
@click="handelFirstSubmit()"
>
ادامه و انتخاب آدرس
</BasicButton>
</div>
</div>
<BasicActionSheet v-model:show="showAddress">
<PhysicalReceiveAddressPicker
v-model:selected-address-id="selectedAddressID"
:addresses="address"
@add-address="addAddressVisible = true; showAddress = false"
@submit="handelsubmit"
/>
</BasicActionSheet>
<BasicActionSheet v-model:show="addAddressVisible">
<New_EditAddress v-if="addAddressVisible" :visible="addAddressVisible" @onOk="handleAddress" />
</BasicActionSheet>
</div>
</template>
<script lang="ts" setup>
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import BasicSelect from '@/components/BasicPacks/BasicSelect.vue'
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
import DesktopPageTopbar from '@/layouts/components/DesktopPageTopbar.vue'
import New_EditAddress from '@/views/base/address/components/New_EditAddress.vue'
import PhysicalReceiveCartRow from '../components/PhysicalReceiveCartRow.vue'
import PhysicalReceiveAddressPicker from '../components/PhysicalReceiveAddressPicker.vue'
import { useNewPhysicalRequestContext } from '../composables/useNewPhysicalRequestPage'
const {
items,
selectedProduct,
selectedProducts,
address,
selectedAddressID,
showAddress,
addAddressVisible,
handleAdd,
handleRemove,
handelFirstSubmit,
handelsubmit,
handleAddress,
} = useNewPhysicalRequestContext()
</script>
<style scoped>
.physical-new-request__picker-row {
display: flex;
align-items: center;
gap: 0.5rem;
min-width: 0;
}
.physical-new-request__select {
flex: 1 1 0;
min-width: 0;
}
.physical-new-request__select :deep(.ant-select) {
width: 100%;
}
.physical-new-request__select :deep(.ant-select-selector) {
overflow: hidden;
}
.physical-new-request__select :deep(.ant-select-selection-item),
.physical-new-request__select :deep(.ant-select-selection-placeholder) {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.physical-new-request__add-btn {
flex-shrink: 0;
}
</style>
+56 -185
View File
@@ -1,196 +1,67 @@
<template>
<div class="flex justify-center items-center text-5">
در حال بروزرسانی...
<div
class="physical-receive-page-root main-with-bottom-chrome-inner--contained"
:class="{ 'physical-receive-page-root--desktop': isDesktop }"
>
<MobilePhysicalReceiveChrome v-show="!isDesktop" />
<div :class="isDesktop ? '' : 'physical-receive-page-root__shell'">
<div :class="isDesktop ? '' : 'physical-receive-page-root__content'">
<router-view />
</div>
</div>
</div>
</template>
<!--<template>-->
<!-- <div class="bottom-0 fixed top-0">-->
<!-- <img :src="img" alt="" class=" w-inherit "-->
<!-- :style="{ backgroundRepeat: 'repeat', }"-->
<!-- />-->
<!-- </div>-->
<!-- <a-spin :spinning="loading">-->
<script lang="ts" setup>
import { usePhysicalReceiveShell } from './composables/usePhysicalReceiveShell'
import MobilePhysicalReceiveChrome from './mobile/MobilePhysicalReceiveChrome.vue'
<!-- <div class=" !h-full overflow-y-scroll">-->
const { isDesktop } = usePhysicalReceiveShell()
</script>
<!-- <div class="w-full flex justify-center top-0 py-5" style="align-self: center">-->
<!-- <ARadioGroup @change="changeTab" v-model:value="activekey" button-style="solid">-->
<!-- <ARadioButton class="cats" value="همه">همه</ARadioButton>-->
<!-- <ARadioButton class="cats" v-for="item in typeItems.filter(a => a != 'آبشده')" :value="item">{{ item }}</ARadioButton>-->
<!-- </ARadioGroup>-->
<!-- </div>-->
<style scoped>
.physical-receive-page-root {
display: flex;
flex-direction: column;
min-height: 100%;
height: 100%;
overflow: hidden;
}
<!-- <div class="mx-5 pb-30 pt-2" style="color: #1b2b07">-->
<!-- <div class="mt-3" v-for="item in items?.filter(a => a.group_type != 'آبشده')">-->
<!-- <ProductItem :ProductItem="item" @click="clickProduct(item)"></ProductItem>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </a-spin>-->
<!-- &lt;!&ndash; <BasicActionSheet v-model:show="showFilter">&ndash;&gt;-->
<!-- &lt;!&ndash; <indexGold ></indexGold>&ndash;&gt;-->
<!-- &lt;!&ndash; </BasicActionSheet>&ndash;&gt;-->
.physical-receive-page-root__shell {
flex: 1 1 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
<!-- <BasicActionSheet placement="bottom" v-model:show="showFilter">-->
<!-- <div class="">-->
<!--&lt;!&ndash; <indexGold v-if="selectedProduct?.group_type=='آبشده'" :ProductItem="selectedProduct"></indexGold>&ndash;&gt;-->
<!-- <ReceiveDealProduct :ProductItem="selectedProduct"></ReceiveDealProduct>-->
<!-- </div>-->
<!-- </BasicActionSheet>-->
.physical-receive-page-root__content {
flex: 1 1 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
<!--</template>-->
.physical-receive-page-root__content > * {
flex: 1 1 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
<!--<script setup lang="ts">-->
<!--import { onMounted, onUnmounted, ref, watch } from 'vue'-->
<!--import router from '@/router'-->
<!--import ProductItem from '@/views/base/products/components/ProductItem.vue'-->
<!--import { getProducts } from '@/api/products'-->
<!--import {-->
<!-- getLastPrices,-->
<!-- lastPrice,-->
<!-- stopPriceInterval-->
<!--} from '@/utils/price'-->
<!--import { loading } from '@/utils'-->
<!--import { Price } from '@/models/home'-->
<!--import type { Product } from '@/models/products'-->
<!--import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'-->
<!--import { cloneDeep } from 'lodash'-->
<!--import img from "@/assets/img/user_ly1.svg";-->
<!--import ReceiveDealProduct from '@/views/base/physicalReceive/components/ReceiveDealProduct.vue'-->
.physical-receive-page-root--desktop {
height: auto;
min-height: 0;
overflow: visible;
}
</style>
<!--const activekey = ref('آبشده')-->
<!--const showFilter = ref()-->
<!--const selectedProduct = ref<Product>()-->
<!--function clickProduct(item: Product) {-->
<!-- if(item?.show){-->
<!-- showFilter.value = true-->
<!-- selectedProduct.value = cloneDeep(item)-->
<!-- }-->
<!--}-->
<!--function changeTab() {-->
<!-- if (activekey.value != 'همه') {-->
<!-- items.value = firstItems.value?.filter((val) =>-->
<!-- val.group_type == activekey.value-->
<!-- )-->
<!-- } else items.value = firstItems.value-->
<!--}-->
<!--const firstItems = ref<Product[]>()-->
<!--const price = ref<Price>()-->
<!--const items = ref<Product[]>()-->
<!--const typeItems = ref([])-->
<!--onMounted(async () => {-->
<!-- try {-->
<!-- loading.value = true-->
<!-- items.value = await getProducts()-->
<!-- items.value?.forEach((val, index) => {-->
<!-- if (!typeItems.value.includes(val.group_type)){-->
<!-- typeItems.value.push(val.group_type)-->
<!-- }-->
<!-- // typeItems.value[index] = val.group_type-->
<!-- })-->
<!-- firstItems.value = items.value-->
<!-- await initPrice()-->
<!-- // await setIntervalGetLastPrice()-->
<!-- // console.log('run product')-->
<!-- } catch (e) {-->
<!-- console.log(e)-->
<!-- } finally {-->
<!-- loading.value = false-->
<!-- if (router.currentRoute.value.query.cat=="coin"){-->
<!-- activekey.value="سکه"-->
<!-- changeTab()-->
<!-- }-->
<!-- if (router.currentRoute.value.query.state) {-->
<!-- if (router.currentRoute.value.query.product) {-->
<!-- clickProduct(items.value?.find(x => x.title === 'سکه'))-->
<!-- } else {-->
<!-- clickProduct(items.value?.find(x => x.title === 'آبشده نقدی'))-->
<!-- }-->
<!-- }-->
<!-- }-->
<!--})-->
<!--onUnmounted(() => {-->
<!-- stopPriceInterval()-->
<!-- // console.log('stop product')-->
<!--})-->
<!--async function initPrice() {-->
<!-- try {-->
<!-- // chartLoading.value = true-->
<!-- await getLastPrices()-->
<!-- // await setIntervalGetPrice()-->
<!-- loading.value = true-->
<!-- price.value = lastPrice.value-->
<!-- } catch (e) {-->
<!-- console.log(e)-->
<!-- } finally {-->
<!-- loading.value = false-->
<!-- // chartLoading.value = false-->
<!-- }-->
<!--}-->
<!--</script>-->
<!--<style lang="less">-->
<!--.cats{-->
<!-- font-size: x-small;-->
<!--}-->
<!--.cats:hover span {-->
<!-- &#45;&#45;un-text-opacity: 1;-->
<!-- color: rgba(206, 163, 76, var(&#45;&#45;un-text-opacity))!important;-->
<!--}-->
<!--</style>-->
<!--&lt;!&ndash;-->
<!--<template>-->
<!-- <div style="max-height: calc(100vh - 50px)">-->
<!-- <div class="bg-white py-3 px-3 z-100000 text-primary font-bold drop-shadow flex flex-col wrap-fix">-->
<!-- <div class="flex">-->
<!-- <div @click="router.back()">-->
<!-- <BasicIcon icon="vuesax-linear:arrow-right-1"/>-->
<!-- </div>-->
<!-- <div v-if="route.name=='list'" class="mr-2">دریافت طلای فیزیکی</div>-->
<!-- <div v-else class="mr-2">دریافت طلای فیزیکی-درخواست جدید</div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div>-->
<!-- <router-view></router-view>-->
<!-- </div>-->
<!-- </div>-->
<!--</template>-->
<!--<script lang="ts" setup>-->
<!--import {ref} from "vue";-->
<!--import RequestList from "@/views/base/physicalReceive/components/RequestList.vue";-->
<!--import NewRequest from "@/views/base/physicalReceive/components/NewRequest.vue";-->
<!--import router from "@/router";-->
<!--import BasicIcon from "@/components/BasicPacks/BasicIcon.vue";-->
<!--import {useRoute} from "vue-router";-->
<!--const activekey=ref(1)-->
<!--const route=useRoute()-->
<!--</script>-->
<!--<style scoped>-->
<!--/*.fade-enter-active,-->
<!--.fade-leave-active {-->
<!-- transition: opacity 0.2s ease;-->
<!--}-->
<!--.fade-enter-from,-->
<!--.fade-leave-to {-->
<!-- opacity: 0;-->
<!--}*/-->
<!--/*.trans{-->
<!-- transition: height 1s;-->
<!--}*/-->
<!--</style>-->
<!--&ndash;&gt;-->
<style lang="less">
.physical-receive-page-root.main-with-bottom-chrome-inner {
overflow: hidden !important;
}
</style>
@@ -0,0 +1,165 @@
<template>
<div class="physical-new-request">
<div class="physical-new-request__toolbar mpage-content">
<div class="physical-new-request__picker-row px-3">
<div class="physical-new-request__select">
<BasicSelect
v-model:value="selectedProduct"
:items="items"
key-name="id"
:show-search="false"
value-name="title"
size="large"
placeholder="لطفا محصول را انتخاب کنید"
:has-tooltip="false"
/>
</div>
<BasicButton
class="physical-new-request__add-btn"
:disabled-b="selectedProduct == null"
type="primary"
@click="handleAdd"
>
افزودن
</BasicButton>
</div>
</div>
<div class="physical-new-request__items px-3">
<div class="physical-new-request__items-scroll">
<div
v-for="val in selectedProducts"
:key="val.product.id"
class="rounded-lg p-2 bg-gray-100 mb-2 last:mb-0"
>
<PhysicalReceiveCartRow :item="val" @remove="handleRemove" />
</div>
</div>
</div>
<div class="physical-new-request__footer px-3">
<BasicButton
:disabled-b="selectedProducts.length == 0"
class="w-full"
@click="handelFirstSubmit()"
>
ثبت
</BasicButton>
</div>
<BasicActionSheet v-model:show="showAddress">
<PhysicalReceiveAddressPicker
v-model:selected-address-id="selectedAddressID"
:addresses="address"
@add-address="addAddressVisible = true; showAddress = false"
@submit="handelsubmit"
/>
</BasicActionSheet>
<BasicActionSheet v-model:show="addAddressVisible">
<New_EditAddress v-if="addAddressVisible" :visible="addAddressVisible" @onOk="handleAddress" />
</BasicActionSheet>
</div>
</template>
<script lang="ts" setup>
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import BasicSelect from '@/components/BasicPacks/BasicSelect.vue'
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
import New_EditAddress from '@/views/base/address/components/New_EditAddress.vue'
import PhysicalReceiveCartRow from '../components/PhysicalReceiveCartRow.vue'
import PhysicalReceiveAddressPicker from '../components/PhysicalReceiveAddressPicker.vue'
import { useNewPhysicalRequestContext } from '../composables/useNewPhysicalRequestPage'
const {
items,
selectedProduct,
selectedProducts,
address,
selectedAddressID,
showAddress,
addAddressVisible,
handleAdd,
handleRemove,
handelFirstSubmit,
handelsubmit,
handleAddress,
} = useNewPhysicalRequestContext()
</script>
<style scoped>
.physical-new-request {
display: flex;
flex-direction: column;
flex: 1 1 0;
min-height: 0;
overflow: hidden;
box-sizing: border-box;
padding-bottom: var(--app-bottom-chrome-height, 80px);
}
.physical-new-request__toolbar {
flex-shrink: 0;
padding-bottom: 0.5rem;
}
.physical-new-request__picker-row {
display: flex;
align-items: center;
gap: 0.5rem;
min-width: 0;
}
.physical-new-request__select {
flex: 1 1 0;
min-width: 0;
}
.physical-new-request__select :deep(.ant-select) {
width: 100%;
}
.physical-new-request__select :deep(.ant-select-selector) {
overflow: hidden;
}
.physical-new-request__select :deep(.ant-select-selection-item),
.physical-new-request__select :deep(.ant-select-selection-placeholder) {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.physical-new-request__add-btn {
flex-shrink: 0;
}
.physical-new-request__items {
flex: 1 1 0;
min-height: 0;
display: flex;
flex-direction: column;
padding-bottom: 0.5rem;
}
.physical-new-request__items-scroll {
flex: 1 1 0;
min-height: 0;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
overscroll-behavior-y: contain;
border: 1px solid #e5e7eb;
border-radius: 0.5rem;
background: #fff;
padding: 0.5rem;
}
.physical-new-request__footer {
flex-shrink: 0;
padding-top: 0.75rem;
padding-bottom: 0.75rem;
background: #fff;
border-top: 1px solid #f3f4f6;
box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.06);
}
</style>
@@ -0,0 +1,15 @@
<template>
<MobilePageHeader :title="pageTitle" show-back />
</template>
<script lang="ts" setup>
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import MobilePageHeader from '@/layouts/components/MobilePageHeader.vue'
const route = useRoute()
const pageTitle = computed(() =>
route.name === 'list' ? 'دریافت فیزیکی' : 'دریافت فیزیکی-درخواست جدید',
)
</script>
@@ -0,0 +1,29 @@
<template>
<div>
<div
class="flex flex-col gap-4 mpage-content px-2 pb-[calc(var(--app-bottom-chrome-height)+var(--app-add-card-height)+1rem)]"
>
<RequestItem v-for="item in requestItems" :key="item.id" :item="item" />
<div
v-if="requestItems.length === 0"
class="flex flex-col items-center justify-center min-h-[40vh] text-gray-500"
>
هنوز درخواستی ثبت نشده است.
</div>
</div>
<Teleport to="body">
<div class="app-dock-add-bar" @click="openAdd()">
<BasicIcon icon="vuesax-linear:add" />
<div>افزودن درخواست جدید</div>
</div>
</Teleport>
</div>
</template>
<script setup lang="ts">
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
import RequestItem from '../components/RequestItem.vue'
import { usePhysicalReceiveListContext } from '../composables/usePhysicalReceiveList'
const { requestItems, openAdd } = usePhysicalReceiveListContext()
</script>