From 025e46e11cb2962fd7692adfa401333758cc779b Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 02 九月 2025 14:00:34 +0800 Subject: [PATCH] 修改组件 --- src/pages/sales/receiptPayment/edit.vue | 139 ++++++++++++++++++++-------------------------- 1 files changed, 61 insertions(+), 78 deletions(-) diff --git a/src/pages/sales/receiptPayment/edit.vue b/src/pages/sales/receiptPayment/edit.vue index 3e3e2d7..bb5c1b3 100644 --- a/src/pages/sales/receiptPayment/edit.vue +++ b/src/pages/sales/receiptPayment/edit.vue @@ -59,13 +59,26 @@ readonly @click="showPaymentTypePicker" /> + <template #right> + <up-icon + name="arrow-right" + @click="showPaymentTypePicker" + ></up-icon> + </template> </u-form-item> <u-form-item label="鏉ユ鏃ユ湡" prop="receiptPaymentDate" required border-bottom> <u-input v-model="form.receiptPaymentDate" placeholder="璇烽�夋嫨" readonly + @click="showDatePicker" /> + <template #right> + <up-icon + name="arrow-right" + @click="showDatePicker" + ></up-icon> + </template> </u-form-item> <u-form-item label="鐧昏浜�" border-bottom> <u-input @@ -77,41 +90,46 @@ </u-cell-group> <!-- 鎻愪氦鎸夐挳 --> - <view class="footer-btns"> - <u-button class="cancel-btn" @click="onClickLeft">鍙栨秷</u-button> - <u-button class="save-btn" type="primary" @click="onSubmit" :loading="loading">淇濆瓨</u-button> - </view> + <FooterButtons + cancelText="鍙栨秷" + confirmText="淇濆瓨" + :loading="loading" + @cancel="onClickLeft" + @confirm="onSubmit" + /> </u-form> <!-- 鍥炴鏂瑰紡閫夋嫨鍣� --> - <u-popup v-model="showPaymentType" mode="bottom"> - <u-picker - v-model="pickerValue" - :columns="receipt_payment_type" - @confirm="onPaymentTypeConfirm" - @cancel="showPaymentType = false" - /> - </u-popup> + <up-action-sheet + :show="showPaymentType" + :actions="receipt_payment_type" + title="閫夋嫨鍥炴褰㈠紡" + @select="onPaymentTypeConfirm" + @close="showPaymentType = false" + /> <!-- 鏃ユ湡閫夋嫨鍣� --> - <u-popup v-model="showDate" mode="bottom"> - <u-datetime-picker + <up-popup :show="showDate" mode="bottom" @close="showDate = false"> + <up-datetime-picker + :show="true" v-model="currentDate" - title="閫夋嫨鏃ユ湡" @confirm="onDateConfirm" @cancel="showDate = false" + mode="date" /> - </u-popup> + </up-popup> </view> </template> <script setup> import { ref, onMounted, computed } from 'vue' +import FooterButtons from '@/components/FooterButtons.vue' import { receiptPaymentSaveOrUpdate, invoiceInfo } from '@/api/salesManagement/receiptPayment' import useUserStore from '@/store/modules/user' import { useDict } from '@/utils/dict' +import { formatDateToYMD } from '@/utils/ruoyi' -// 鏇挎崲 toast 鍜� notify 鏂规硶 +// 鏄剧ず鎻愮ず淇℃伅 const showToast = (message) => { uni.showToast({ title: message, @@ -119,12 +137,18 @@ }) } -const showNotify = ({ type, message }) => { - uni.showToast({ +// 鏄剧ず鍔犺浇鎻愮ず +const showLoadingToast = (message) => { + uni.showLoading({ title: message, - icon: type === 'warning' ? 'none' : 'success' - }) -} + mask: true + }); +}; + +// 鍏抽棴鍔犺浇鎻愮ず +const closeToast = () => { + uni.hideLoading(); +}; const userStore = useUserStore() @@ -160,7 +184,7 @@ // 杞崲瀛楀吀鏁版嵁鏍煎紡涓洪�夋嫨鍣ㄩ渶瑕佺殑鏍煎紡 const receipt_payment_type = computed(() => { return dictReceiptPaymentType.value.map(item => ({ - text: item.label, + name: item.label, value: item.value })) }) @@ -183,10 +207,9 @@ } // 纭鍥炴鏂瑰紡閫夋嫨 -const onPaymentTypeConfirm = ({ selectedValues, selectedOptions }) => { - form.value.receiptPaymentType = selectedOptions[0].value - form.value.receiptPaymentTypeName = selectedOptions[0].text - pickerValue.value = selectedValues; +const onPaymentTypeConfirm = (action) => { + form.value.receiptPaymentType = action.value + form.value.receiptPaymentTypeName = action.name showPaymentType.value = false } @@ -196,22 +219,22 @@ } // 纭鏃ユ湡閫夋嫨 -const onDateConfirm = ({ selectedValues }) => { - form.value.receiptPaymentDate = selectedValues.join('-') - currentDate.value = selectedValues - showDate.value = false +const onDateConfirm = (e) => { + form.value.receiptPaymentDate = formatDateToYMD(e.value) + currentDate.value = formatDateToYMD(e.value) + showDate.value = false; } // 鎻愪氦琛ㄥ崟 const onSubmit = () => { // 琛ㄥ崟楠岃瘉 if (!form.value.receiptPaymentAmount) { - showNotify({ type: 'warning', message: '璇疯緭鍏ュ洖娆鹃噾棰�' }) + showToast('璇疯緭鍏ュ洖娆鹃噾棰�') return } if (!form.value.receiptPaymentType) { - showNotify({ type: 'warning', message: '璇烽�夋嫨鍥炴褰㈠紡' }) + showToast('璇烽�夋嫨鍥炴褰㈠紡') return } loading.value = true @@ -254,51 +277,11 @@ </script> <style scoped lang="scss"> +@import '@/static/scss/form-common.scss'; + .account-detail { - min-height: 100vh; - background: #f8f9fa; - padding-bottom: 5rem; + min-height: 100vh; + background: #f5f5f5; + padding-bottom: 5rem; } - -.footer-btns { - position: fixed; - left: 0; - right: 0; - bottom: 0; - background: #fff; - display: flex; - justify-content: space-around; - align-items: center; - padding: 0.75rem 0; - box-shadow: 0 -0.125rem 0.5rem rgba(0,0,0,0.05); - z-index: 1000; -} - -.cancel-btn { - font-weight: 400; - font-size: 1rem; - color: #FFFFFF; - width: 6.375rem; - background: #C7C9CC; - box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2); - border-radius: 2.5rem 2.5rem 2.5rem 2.5rem; -} - -.save-btn { - font-weight: 400; - font-size: 1rem; - color: #FFFFFF; - width: 14rem; - background: linear-gradient( 140deg, #00BAFF 0%, #006CFB 100%); - box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2); - border-radius: 2.5rem 2.5rem 2.5rem 2.5rem; -} - -// 鍝嶅簲寮忚皟鏁� -@media (max-width: 768px) { - .submit-section { - padding: 12px; - } -} -.tip-text { padding: 4px 16px 0 16px; font-size: 12px; color: #888; } </style> -- Gitblit v1.9.3