add DateTimeNowPicker.vue
This commit is contained in:
@@ -125,23 +125,7 @@
|
||||
</div>
|
||||
</t-form-item>
|
||||
<t-form-item label="下单时间" content-align="right">
|
||||
<div class="time-actions">
|
||||
<t-button
|
||||
theme="primary"
|
||||
variant="outline"
|
||||
size="extra-small"
|
||||
:content="purchasedAtText || '此刻'"
|
||||
@click="openTimePicker"
|
||||
/>
|
||||
<t-button
|
||||
v-if="purchasedAtText"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="extra-small"
|
||||
content="此刻"
|
||||
@click="resetPurchasedAt"
|
||||
/>
|
||||
</div>
|
||||
<date-time-now-picker v-model="purchasedAtText" title="下单时间" />
|
||||
</t-form-item>
|
||||
<t-form-item
|
||||
v-if="canReceiveImmediately"
|
||||
@@ -223,15 +207,13 @@
|
||||
>提交订单</t-button>
|
||||
</div>
|
||||
<customer-selector v-model="customerIdList" v-model:visible="customerSelectorVisible" selection-mode="single" :enable-scan="false" @change="loadCustomer" />
|
||||
<t-popup v-model="pickerVisible" placement="bottom">
|
||||
<t-date-time-picker v-if="pickerVisible" v-model="draftTime" format="YYYY-MM-DD HH:mm" :mode="['date', 'minute']" title="下单时间" @cancel="pickerVisible = false" @confirm="confirmTime" />
|
||||
</t-popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import DateTimeNowPicker from "@/components/DateTimeNowPicker.vue";
|
||||
import { type Attachment, useUserStore } from "timi-web-api";
|
||||
import { AnimatedAmount, Time } from "timi-web";
|
||||
import { AnimatedAmount } from "timi-web";
|
||||
import { DialogPlugin } from "tdesign-mobile-vue";
|
||||
import CustomerAPI from "@/api/CustomerAPI";
|
||||
import ProductAPI from "@/api/ProductAPI";
|
||||
@@ -270,8 +252,6 @@ const customerSelectorVisible = ref(false);
|
||||
const items = ref<FormItem[]>([]);
|
||||
const remark = ref("");
|
||||
const purchasedAtText = ref("");
|
||||
const draftTime = ref("");
|
||||
const pickerVisible = ref(false);
|
||||
const isSaving = ref(false);
|
||||
const photoItems = ref<PhotoItem[]>([]);
|
||||
const paymentPhotoItems = ref<PhotoItem[]>([]);
|
||||
@@ -481,9 +461,6 @@ async function applyScanCode(): Promise<void> {
|
||||
function handleScanStatusChange(value: string): void {
|
||||
scanStatus.value = value;
|
||||
}
|
||||
function openTimePicker(): void { draftTime.value = purchasedAtText.value || Time.toDateTime(new Date()); pickerVisible.value = true; }
|
||||
function confirmTime(value?: string | number): void { purchasedAtText.value = String(value || draftTime.value); pickerVisible.value = false; }
|
||||
function resetPurchasedAt(): void { purchasedAtText.value = ""; draftTime.value = ""; }
|
||||
function resolveTimestamp(value: string): number | undefined {
|
||||
if (!value) return undefined;
|
||||
const timestamp = new Date(value.replace(" ", "T")).getTime();
|
||||
@@ -649,13 +626,6 @@ onMounted(() => {
|
||||
margin: 1rem;
|
||||
}
|
||||
|
||||
.time-actions {
|
||||
gap: .5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.payment-item.disabled {
|
||||
color: var(--td-text-color-disabled);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user