¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="account-detail"> |
| | | <!-- 使ç¨éç¨é¡µé¢å¤´é¨ç»ä»¶ --> |
| | | <PageHeader title="æ°å¢å款" @back="onClickLeft" /> |
| | | |
| | | <!-- 表åå
容 --> |
| | | <van-form @submit="onSubmit" ref="formRef" label-width="110px" input-align="right" error-message-align="right" scroll-to-error scroll-to-error-position="center"> |
| | | <!-- åºæ¬ä¿¡æ¯ --> |
| | | <van-cell-group title="åºæ¬ä¿¡æ¯" inset> |
| | | <van-field |
| | | v-model="form.salesContractNo" |
| | | label="éå®ååå·" |
| | | placeholder="èªå¨å¡«å
" |
| | | readonly |
| | | /> |
| | | <van-field |
| | | v-model="form.customerName" |
| | | label="客æ·åç§°" |
| | | placeholder="èªå¨å¡«å
" |
| | | readonly |
| | | /> |
| | | <!-- <van-field--> |
| | | <!-- v-model="form.invoiceNo"--> |
| | | <!-- label="å票å·"--> |
| | | <!-- placeholder="èªå¨å¡«å
"--> |
| | | <!-- readonly--> |
| | | <!-- />--> |
| | | <!-- <van-field--> |
| | | <!-- v-model="form.invoiceTotal"--> |
| | | <!-- label="å票éé¢(å
)"--> |
| | | <!-- placeholder="èªå¨å¡«å
"--> |
| | | <!-- readonly--> |
| | | <!-- />--> |
| | | <!-- <van-field--> |
| | | <!-- v-model="form.taxRate"--> |
| | | <!-- label="ç¨ç"--> |
| | | <!-- placeholder="èªå¨å¡«å
"--> |
| | | <!-- readonly--> |
| | | <!-- />--> |
| | | <view class="tip-text">å¾
忬¾éé¢ï¼{{ currentNoReceiptAmount }} å
</view> |
| | | <van-field |
| | | v-model="form.receiptPaymentAmount" |
| | | label="æ¬æ¬¡å款éé¢" |
| | | type="number" |
| | | placeholder="请è¾å
¥" |
| | | @blur="changeNum" |
| | | :rules="[{ required: true, message: '请è¾å
¥å款éé¢' }]" |
| | | clearable |
| | | /> |
| | | <van-field |
| | | v-model="form.receiptPaymentTypeName" |
| | | label="忬¾å½¢å¼" |
| | | placeholder="è¯·éæ©" |
| | | readonly |
| | | @click="showPaymentTypePicker" |
| | | :rules="[{ required: true, message: 'è¯·éæ©åæ¬¾å½¢å¼' }]" |
| | | /> |
| | | <van-field |
| | | v-model="form.receiptPaymentDate" |
| | | label="æ¥æ¬¾æ¥æ" |
| | | placeholder="è¯·éæ©" |
| | | readonly |
| | | :rules="[{ required: true, message: 'è¯·éæ©æ¥æ¬¾æ¥æ' }]" |
| | | /> |
| | | <van-field |
| | | v-model="form.registrant" |
| | | label="ç»è®°äºº" |
| | | placeholder="èªå¨å¡«å
" |
| | | readonly |
| | | /> |
| | | </van-cell-group> |
| | | |
| | | <!-- æäº¤æé® --> |
| | | <view class="footer-btns"> |
| | | <van-button class="cancel-btn" @click="onClickLeft">åæ¶</van-button> |
| | | <van-button class="save-btn" native-type="submit" form-type="submit" :loading="loading">ä¿å</van-button> |
| | | </view> |
| | | </van-form> |
| | | |
| | | <!-- 忬¾æ¹å¼éæ©å¨ --> |
| | | <van-popup v-model:show="showPaymentType" position="bottom"> |
| | | <van-picker |
| | | :model-value="pickerValue" |
| | | :columns="receipt_payment_type" |
| | | @confirm="onPaymentTypeConfirm" |
| | | @cancel="showPaymentType = false" |
| | | /> |
| | | </van-popup> |
| | | |
| | | <!-- æ¥æéæ©å¨ --> |
| | | <van-popup v-model:show="showDate" position="bottom"> |
| | | <van-date-picker |
| | | v-model="currentDate" |
| | | title="éæ©æ¥æ" |
| | | @confirm="onDateConfirm" |
| | | @cancel="showDate = false" |
| | | /> |
| | | </van-popup> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, onMounted, computed } from 'vue' |
| | | import { receiptPaymentSaveOrUpdate, invoiceInfo } from '@/api/salesManagement/receiptPayment' |
| | | import useUserStore from '@/store/modules/user' |
| | | import { showToast, showNotify } from 'vant' |
| | | import { useDict } from '@/utils/dict' |
| | | |
| | | const userStore = useUserStore() |
| | | |
| | | // 表åå¼ç¨ |
| | | const formRef = ref() |
| | | |
| | | // ååºå¼æ°æ® |
| | | const loading = ref(false) |
| | | const showPaymentType = ref(false) |
| | | const pickerValue = ref([]) |
| | | const showDate = ref(false) |
| | | const currentDate = ref([new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate()]) |
| | | |
| | | // è¡¨åæ°æ® |
| | | const form = ref({ |
| | | salesContractNo: '', |
| | | customerName: '', |
| | | invoiceNo: '', |
| | | invoiceTotal: '', |
| | | taxRate: '', |
| | | receiptPaymentAmount: '', |
| | | receiptPaymentType: '', |
| | | receiptPaymentTypeName: '', |
| | | registrant: '', |
| | | receiptPaymentDate: '', |
| | | invoiceLedgerId: '' |
| | | }) |
| | | const currentNoReceiptAmount = ref(0) |
| | | |
| | | // è·ååå
¸æ°æ® |
| | | const { receipt_payment_type: dictReceiptPaymentType } = useDict('receipt_payment_type') |
| | | |
| | | // 转æ¢åå
¸æ°æ®æ ¼å¼ä¸ºéæ©å¨éè¦çæ ¼å¼ |
| | | const receipt_payment_type = computed(() => { |
| | | return dictReceiptPaymentType.value.map(item => ({ |
| | | text: item.label, |
| | | value: item.value |
| | | })) |
| | | }) |
| | | |
| | | // è¿åä¸ä¸é¡µ |
| | | const onClickLeft = () => { |
| | | uni.removeStorageSync('invoiceLedgerEditRow'); |
| | | uni.navigateBack() |
| | | } |
| | | |
| | | // æ¾ç¤ºå款æ¹å¼éæ©å¨ |
| | | const showPaymentTypePicker = () => { |
| | | showPaymentType.value = true |
| | | } |
| | | const changeNum = () => { |
| | | if (form.value.receiptPaymentAmount > currentNoReceiptAmount.value) { |
| | | form.value.receiptPaymentAmount = currentNoReceiptAmount.value |
| | | showToast('ä¸å¯å¤§äºå¾
忬¾éé¢') |
| | | } |
| | | } |
| | | |
| | | // ç¡®è®¤åæ¬¾æ¹å¼éæ© |
| | | const onPaymentTypeConfirm = ({ selectedValues, selectedOptions }) => { |
| | | form.value.receiptPaymentType = selectedOptions[0].value |
| | | form.value.receiptPaymentTypeName = selectedOptions[0].text |
| | | pickerValue.value = selectedValues; |
| | | showPaymentType.value = false |
| | | } |
| | | |
| | | // æ¾ç¤ºæ¥æéæ©å¨ |
| | | const showDatePicker = () => { |
| | | showDate.value = true |
| | | } |
| | | |
| | | // ç¡®è®¤æ¥æéæ© |
| | | const onDateConfirm = ({ selectedValues }) => { |
| | | form.value.receiptPaymentDate = selectedValues.join('-') |
| | | currentDate.value = selectedValues |
| | | showDate.value = false |
| | | } |
| | | |
| | | // æäº¤è¡¨å |
| | | const onSubmit = () => { |
| | | // 表åéªè¯ |
| | | if (!form.value.receiptPaymentAmount) { |
| | | showNotify({ type: 'warning', message: '请è¾å
¥å款éé¢' }) |
| | | return |
| | | } |
| | | |
| | | if (!form.value.receiptPaymentType) { |
| | | showNotify({ type: 'warning', message: 'è¯·éæ©åæ¬¾å½¢å¼' }) |
| | | return |
| | | } |
| | | loading.value = true |
| | | let updateData = { |
| | | id: form.value.id, |
| | | receiptPaymentType: form.value.receiptPaymentType, |
| | | receiptPaymentAmount: form.value.receiptPaymentAmount, |
| | | }; |
| | | receiptPaymentSaveOrUpdate(updateData) |
| | | .then(() => { |
| | | showToast('æäº¤æå') |
| | | onClickLeft() |
| | | }) |
| | | .catch((error) => { |
| | | loading.value = false |
| | | }) |
| | | } |
| | | |
| | | // åå§åæ°æ® |
| | | const initData = () => { |
| | | const rowStr = uni.getStorageSync('invoiceLedgerEditRow') |
| | | const row = JSON.parse(rowStr) |
| | | form.value = { ...row} |
| | | form.value.receiptPaymentTypeName = formatReceiptType(row.receiptPaymentType); |
| | | form.value.id = ""; |
| | | currentNoReceiptAmount.value = row.noReceiptAmount |
| | | } |
| | | const formatReceiptType = (type) => { |
| | | if (type == 0) { |
| | | return "çµæ±"; |
| | | } else if (type == 1) { |
| | | return "æ¿å
"; |
| | | } else { |
| | | return "æªç¥"; |
| | | } |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | initData() |
| | | }) |
| | | </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; } |
| | | </style> |