1404/10/28-base

This commit is contained in:
2026-01-18 13:01:46 +03:30
parent f95b0cef95
commit 9d96ae106b
455 changed files with 58164 additions and 0 deletions
@@ -0,0 +1,221 @@
<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="false"/>
<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">
</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>
</template>
<script lang="ts" setup>
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 defaultImg from '@/assets/img/defaultAbshodeh.svg'
import {usePrice} from '@/utils/usePrice'
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
}
</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,57 @@
<template>
<div class="rounded-lg shadow-md mx-2 bg-gradient-to-l from-primary rounded-lg p-[2px] to-transparent ">
<div class="rounded-lg flex flex-col gap-2 bg-white p-2 ">
<div class="flex justify-between ">
<div class="font-bold">شماره سند: {{ props.item.id }}</div>
<div class="font-bold">{{ toJalali(props.item.created_at) }}</div>
</div>
<div class="flex justify-between">
<div class="flex flex-col w-full gap-1 ">
<div class="w-full flex justify-between" v-for="item in props.item.transaction">
<div class="flex items-center gap-1 ">
<div class="w-7 h-7 flex justify-center rounded-lg bg-gray-100 ">
<img width="30" class="p-1" :src="item.product.group_type=='گوی'?goyImg:mokaabImg">
</div>
<div>{{ item.title }}</div>
</div>
<div>{{ item.gold * -1 }} عدد</div>
</div>
</div>
</div>
<div class="flex justify-between">
<div class="font-bold">وضعیت:</div>
<ATag color="blue" class="!py-1 !px-2 !ml-0">
{{ props.item.sts_str }}
</ATag>
</div>
<ADivider class="!m-1"></ADivider>
<div class="flex flex-col justify-between">
<div class="font-bold">آدرس:</div>
<div>{{ props.item.address.province }}/{{ props.item.address.city }}/{{ props.item.address.address }}</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import type {Physicalreceive} from "@/models/physicalreceive";
import {toJalali} from "../../../../utils/useDateTime";
import goyImg from "@/assets/img/goyImg.svg"
import mokaabImg from "@/assets/img/mokaabImg.svg"
interface Prop {
item: Physicalreceive
}
const props = withDefaults(defineProps<Prop>(), {})</script>
<style scoped>
</style>
@@ -0,0 +1,39 @@
<template>
<div>
<div class="flex flex-col gap-4 pt-13 pb-35 px-2">
<RequestItem v-for="item in requestItems" :item="item"></RequestItem>
</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>
</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 BasicIcon from "@/components/BasicPacks/BasicIcon.vue";
import router from "@/router";
const requestItems = ref<Physicalreceive[]>([])
const openAdd = () => {
router.push('physicalReceive/new')
}
onMounted(async () => {
let {rows} = await getPhysicalReceiveList()
requestItems.value = rows
console.log(rows)
})
</script>
<style scoped>
</style>
+43
View File
@@ -0,0 +1,43 @@
<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>