Merge remote-tracking branch 'origin/modular' into modular
This commit is contained in:
@@ -26,6 +26,8 @@ export interface Product{
|
||||
prices: MethodePrices[]
|
||||
direct_price: number
|
||||
price: number
|
||||
price_profit?: number
|
||||
price_offset_percent?: number
|
||||
reading_method: string
|
||||
weight: number
|
||||
auto_open_at: string
|
||||
|
||||
@@ -24,9 +24,23 @@
|
||||
<template #icon><Icon icon="vuesax-linear:minus" size="20" /></template>
|
||||
</AButton>
|
||||
</div>
|
||||
<div v-if="methodOption === '2'" class="md:flex justify-between items-center">
|
||||
<div class="ml-4">قیمت :</div>
|
||||
<BasicSelect class="w-11rem method_style" allowClear :items="pricesList" valueName="name" keyName="id" v-model:value="form.reading_method" />
|
||||
<div v-if="methodOption === '2'" class="flex flex-col gap-2">
|
||||
<div class="md:flex justify-between items-center">
|
||||
<div class="ml-4">قیمت :</div>
|
||||
<BasicSelect class="w-11rem method_style" allowClear :items="pricesList" valueName="name" keyName="id" v-model:value="form.reading_method" />
|
||||
</div>
|
||||
<div class="md:flex justify-between items-center">
|
||||
<div class="ml-4">تعدیل نسبت به قیمت مرجع (٪) :</div>
|
||||
<BasicInput
|
||||
class="w-11rem"
|
||||
type="number"
|
||||
v-model:value="form.price_offset_percent"
|
||||
placeholder="مثلاً 5 یا -3"
|
||||
/>
|
||||
</div>
|
||||
<div class="text-xs text-gray-500">
|
||||
مثبت = گرانتر، منفی = ارزانتر نسبت به قیمت اتوماتیک. مثلاً ۵ یعنی ۵٪ بالاتر از مرجع.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -40,6 +40,19 @@ export const cols: BaseTableColumn[] = [
|
||||
key: 'price',
|
||||
type: 'Text'
|
||||
},
|
||||
{
|
||||
title: 'تعدیل قیمت (٪)',
|
||||
dataIndex: 'price_offset_percent',
|
||||
key: 'price_offset_percent',
|
||||
type: 'Number',
|
||||
customRender: (record) => (
|
||||
<div class="flex justify-center">
|
||||
{record?.record.reading_method
|
||||
? `${record?.record.price_offset_percent ?? 0}`
|
||||
: '—'}
|
||||
</div>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'متد',
|
||||
dataIndex: 'reading_method',
|
||||
|
||||
@@ -243,6 +243,7 @@ async function edit(record: Product) {
|
||||
|
||||
form.value = {
|
||||
...productData,
|
||||
price_offset_percent: productData.price_offset_percent ?? 0,
|
||||
direct_price: productData.direct_price ?? 0,
|
||||
auto_open_at: start.isValid() ? start : dayjs('00:00:00', 'HH:mm:ss'),
|
||||
auto_close_at: close.isValid() ? close : dayjs('00:00:00', 'HH:mm:ss')
|
||||
@@ -275,6 +276,7 @@ function resetData() {
|
||||
cash_fee_buy: 0,
|
||||
percent_fee_sell: 0,
|
||||
cash_fee_sell: 0,
|
||||
price_offset_percent: 0,
|
||||
metal_id: 1,
|
||||
direct_price: 0,
|
||||
file_id: undefined,
|
||||
@@ -294,8 +296,13 @@ async function ok() {
|
||||
loading.value = true
|
||||
try {
|
||||
const payload = cloneDeep(form.value)
|
||||
if (methodOption.value === '1') delete payload.reading_method
|
||||
else delete payload.price
|
||||
if (methodOption.value === '1') {
|
||||
delete payload.reading_method
|
||||
payload.price_offset_percent = 0
|
||||
} else {
|
||||
delete payload.price
|
||||
payload.price_offset_percent = Number(payload.price_offset_percent ?? 0)
|
||||
}
|
||||
if (weightOption.value === '2') payload.amount = 1
|
||||
|
||||
payload.auto_open_at = payload.auto_open_at
|
||||
|
||||
Reference in New Issue
Block a user