add DateTimeNowPicker.vue
This commit is contained in:
@@ -169,23 +169,7 @@
|
||||
</t-form>
|
||||
</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="openPurchasedAtPicker"
|
||||
/>
|
||||
<t-button
|
||||
v-if="purchasedAtText"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="extra-small"
|
||||
content="此刻"
|
||||
@click="resetPurchasedAt"
|
||||
/>
|
||||
</div>
|
||||
<date-time-now-picker v-model="purchasedAtText" title="购买时间" :start="minimumDateTimeText" />
|
||||
</t-form-item>
|
||||
<t-form-item
|
||||
v-if="canReceiveImmediately"
|
||||
@@ -324,21 +308,10 @@
|
||||
</div>
|
||||
</t-popup>
|
||||
</div>
|
||||
<t-popup v-model="purchasedAtPickerVisible" placement="bottom">
|
||||
<t-date-time-picker
|
||||
v-if="purchasedAtPickerVisible"
|
||||
v-model="purchasedAtDraftText"
|
||||
:start="minimumDateTimeText"
|
||||
:mode="['date', 'minute']"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
title="购买时间"
|
||||
@cancel="purchasedAtPickerVisible = false"
|
||||
@confirm="confirmPurchasedAt"
|
||||
/>
|
||||
</t-popup>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import DateTimeNowPicker from "@/components/DateTimeNowPicker.vue";
|
||||
import { Time } from "timi-web";
|
||||
import { useUserStore } from "timi-web-api";
|
||||
import { BottomPopup } from "timi-tdesign-mobile";
|
||||
@@ -499,23 +472,6 @@ function handleScanStatusChange(value: string): void {
|
||||
|
||||
const minimumDateTimeText = "1970-01-01 00:00";
|
||||
const purchasedAtText = ref("");
|
||||
const purchasedAtDraftText = ref("");
|
||||
const purchasedAtPickerVisible = ref(false);
|
||||
|
||||
function openPurchasedAtPicker(): void {
|
||||
purchasedAtDraftText.value = purchasedAtText.value || Time.toDateTime(new Date());
|
||||
purchasedAtPickerVisible.value = true;
|
||||
}
|
||||
|
||||
function confirmPurchasedAt(value?: string | number): void {
|
||||
purchasedAtText.value = String(value || purchasedAtDraftText.value);
|
||||
purchasedAtPickerVisible.value = false;
|
||||
}
|
||||
|
||||
function resetPurchasedAt(): void {
|
||||
purchasedAtText.value = "";
|
||||
purchasedAtDraftText.value = "";
|
||||
}
|
||||
|
||||
function buildPurchasedAt(): number {
|
||||
return Time.toTimestamp(parseDateTime(purchasedAtText.value));
|
||||
@@ -1129,13 +1085,6 @@ watch(config, value => {
|
||||
}
|
||||
}
|
||||
|
||||
.time-actions {
|
||||
gap: .5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.file-input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user