store2
This commit is contained in:
@@ -194,6 +194,14 @@
|
||||
<a-form-item label="واحد" name="unit" :rules="inputRules()">
|
||||
<BasicSelect v-model:value="form.unit" :items="unitItems" valueName="value" keyName="value" />
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
v-if="isStore && !isMeltedCategory"
|
||||
label="تعداد موجودی"
|
||||
name="inventory"
|
||||
:rules="inputRules()"
|
||||
>
|
||||
<BasicInput v-model:value="form.inventory" type="number" />
|
||||
</a-form-item>
|
||||
<a-form-item label="هزینه نقدی موقع خرید" name="cash_fee_buy" :rules="inputRules()">
|
||||
<BasicInput v-model:value="form.cash_fee_buy" addon-before="ریال" type="price" />
|
||||
</a-form-item>
|
||||
@@ -249,6 +257,7 @@ import Icon from '@core/components/BaseIcon/src/Icon.vue'
|
||||
import BaseCollapse from '@/components/BaseCollapse.vue'
|
||||
import IndexImageUploader from '@/components/ProductUploader/IndexImageUploader.vue'
|
||||
import { getConfiguration } from '@/api/configuration'
|
||||
import { isSwitchOn } from '@/pages/menuPages/configuration/settingTypes'
|
||||
import type { last } from '@/model/price'
|
||||
import type { MethodePrices } from '@/model/product'
|
||||
import { usePrice } from '@core/utils/usePrice'
|
||||
@@ -275,8 +284,11 @@ const props = defineProps<{
|
||||
customLocale: any
|
||||
productIndexImage: any[]
|
||||
editId?: number
|
||||
isStore?: boolean
|
||||
}>()
|
||||
|
||||
const isStore = ref(Boolean(props.isStore))
|
||||
|
||||
const tradeWeightUnit = ref('گرم')
|
||||
const isMeltedCategory = computed(() => isMeltedTradeGroup(props.form.group_type))
|
||||
|
||||
@@ -314,6 +326,11 @@ onMounted(async () => {
|
||||
const rows = await getConfiguration()
|
||||
const unitRow = Array.isArray(rows) ? rows.find((row) => row.key === 'unit') : null
|
||||
tradeWeightUnit.value = resolveTradeWeightUnit(unitRow?.value)
|
||||
|
||||
const storeRow = Array.isArray(rows) ? rows.find((row) => row.key === 'is_store') : null
|
||||
if (storeRow) {
|
||||
isStore.value = isSwitchOn(storeRow.value)
|
||||
}
|
||||
} catch {
|
||||
tradeWeightUnit.value = 'گرم'
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ import {
|
||||
getCustomerTable,
|
||||
setActiveTime
|
||||
} from '@/api/product'
|
||||
import { cols } from '@/pages/menuPages/products/base/hooks/productColumns'
|
||||
import { getProductColumns } from '@/pages/menuPages/products/base/hooks/productColumns'
|
||||
import ProductMobileCardList from '@/pages/menuPages/products/base/components/ProductMobileCardList.vue'
|
||||
import useBaseTable from '@core/components/BaseTable/hooks/useBaseTable'
|
||||
import type { TableInput } from '@core/type/baseTable'
|
||||
@@ -148,7 +148,7 @@ const customLocale = ref({
|
||||
})
|
||||
|
||||
const tblProps = ref<any>({
|
||||
columns: cols,
|
||||
columns: getProductColumns(),
|
||||
api: async (params: TableInput) => {
|
||||
const data = (await getCustomerTable(params)) as any
|
||||
startTime.value = dayjs(data?.auto_open_at, 'HH:mm:ss')
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
import type { BaseTableColumn } from '@core/type/baseTable'
|
||||
import CustomTag from '@/components/CustomTag.vue'
|
||||
import { isStoreApp } from '@/utils/config'
|
||||
|
||||
export const cols: BaseTableColumn[] = [
|
||||
const inventoryColumn: BaseTableColumn = {
|
||||
title: 'موجودی',
|
||||
dataIndex: 'inventory',
|
||||
key: 'inventory',
|
||||
type: 'Number'
|
||||
}
|
||||
|
||||
export function getProductColumns(): BaseTableColumn[] {
|
||||
return [
|
||||
{
|
||||
title: 'ردیف',
|
||||
dataIndex: 'id',
|
||||
@@ -78,6 +87,7 @@ export const cols: BaseTableColumn[] = [
|
||||
key: 'cash_fee_sell',
|
||||
type: 'Number'
|
||||
},
|
||||
...(isStoreApp() ? [inventoryColumn] : []),
|
||||
{
|
||||
title: 'وضعیت محصول',
|
||||
dataIndex: 'active',
|
||||
@@ -102,4 +112,8 @@ export const cols: BaseTableColumn[] = [
|
||||
slot: 'action',
|
||||
filterable: false
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
/** @deprecated از getProductColumns استفاده کنید */
|
||||
export const cols = getProductColumns()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<CustomersStoreView v-if="isStoreApp()" />
|
||||
<div v-else class="h-full min-h-0 min-w-0 overflow-hidden">
|
||||
<div class="h-full min-h-0 min-w-0 overflow-hidden">
|
||||
<tbl ref="table" class="h-full min-h-0 w-full" @edit="edit" @add="add" />
|
||||
<BasicActionSheet
|
||||
v-model:visible="addUserVisible"
|
||||
@@ -34,6 +33,7 @@
|
||||
:productIndexImage="ProductIndexImage"
|
||||
:editId="editId"
|
||||
:meltedPriceOption="meltedPriceOption"
|
||||
:isStore="isStoreApp()"
|
||||
@update:methodOption="methodOption = $event"
|
||||
@update:weightOption="weightOption = $event"
|
||||
@update:meltedPriceOption="meltedPriceOption = $event"
|
||||
@@ -57,7 +57,6 @@ import { cloneDeep } from 'lodash'
|
||||
import dayjs from 'dayjs'
|
||||
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import CustomersStoreView from '@/pages/menuPages/customers/base/index.vue'
|
||||
import { isStoreApp } from '@/utils/config'
|
||||
import { createProduct, getCustomerById, updateCustomer } from '@/api/product'
|
||||
import { fetchProductImageUrl } from '@/api/file'
|
||||
@@ -326,6 +325,7 @@ function resetData() {
|
||||
order_limit_enabled: false,
|
||||
show_in_assets: false,
|
||||
use_last_price_if_zero: false,
|
||||
inventory: 0,
|
||||
min_order_cash: undefined,
|
||||
max_order_cash: undefined,
|
||||
auto_open_at: dayjs('00:00:00', 'HH:mm:ss'),
|
||||
@@ -375,6 +375,10 @@ async function ok() {
|
||||
}
|
||||
if (weightOption.value === '2') payload.amount = 1
|
||||
|
||||
if (isStoreApp() && !isMeltedTradeGroup(payload.group_type)) {
|
||||
payload.inventory = Math.max(0, Number(payload.inventory ?? 0))
|
||||
}
|
||||
|
||||
payload.auto_open_at = payload.auto_open_at
|
||||
? dayjs(payload.auto_open_at).format('HH:mm:ss')
|
||||
: '00:00:00'
|
||||
|
||||
Reference in New Issue
Block a user