| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | </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="receiptPaymentType" |
| | | 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, |
| | |
| | | }) |
| | | } |
| | | |
| | | 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() |
| | | |
| | |
| | | const { receipt_payment_type: dictReceiptPaymentType } = useDict('receipt_payment_type') |
| | | |
| | | // 转换字典数据格式为选择器需要的格式 |
| | | const receipt_payment_type = computed(() => { |
| | | const receiptPaymentType = computed(() => { |
| | | return dictReceiptPaymentType.value.map(item => ({ |
| | | text: item.label, |
| | | name: item.label, |
| | | value: item.value |
| | | })) |
| | | }) |
| | |
| | | } |
| | | |
| | | // 确认回款方式选择 |
| | | 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 |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | // 确认日期选择 |
| | | 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 |
| | | } |
| | | |
| | | if (!form.value.receiptPaymentDate) { |
| | | showNotify({ type: 'warning', message: '请选择来款日期' }) |
| | | showToast('请选择来款日期') |
| | | return |
| | | } |
| | | |
| | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .account-detail { |
| | | min-height: 100vh; |
| | | background: #f8f9fa; |
| | | 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; } |
| | | @import '@/static/scss/form-common.scss'; |
| | | </style> |