|
@@ -8,7 +8,30 @@
|
|
|
name="totalFee"
|
|
|
type="number"
|
|
|
label="数字"
|
|
|
+ readonly
|
|
|
+ clickable
|
|
|
+ @touchstart.stop="showKeyboard = true"
|
|
|
/>
|
|
|
+
|
|
|
+ <div class="types-box">
|
|
|
+ <van-field
|
|
|
+ v-model="typeStr"
|
|
|
+ label="类型"
|
|
|
+ name="typeStr"
|
|
|
+ placeholder="请输入类型名称"
|
|
|
+ />
|
|
|
+ <div class="types-scroll-box" @click.stop>
|
|
|
+ <van-tag
|
|
|
+ type="primary"
|
|
|
+ @click="setTypes(item)"
|
|
|
+ mark
|
|
|
+ v-for="item in typeList"
|
|
|
+ :key="`tag${item.name}`"
|
|
|
+ >{{ item.name }}</van-tag
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <br />
|
|
|
<van-field name="uploader" label="文件上传">
|
|
|
<template #input>
|
|
|
<van-uploader
|
|
@@ -52,6 +75,12 @@
|
|
|
v-model:show="showCalendar"
|
|
|
@confirm="onConfirm"
|
|
|
/>
|
|
|
+ <van-number-keyboard
|
|
|
+ v-model="totalFee"
|
|
|
+ :show="showKeyboard"
|
|
|
+ :maxlength="6"
|
|
|
+ @blur="showKeyboard = false"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -59,7 +88,7 @@
|
|
|
import { watch, ref, onMounted, toRaw } from 'vue'
|
|
|
import { useRouter, useRoute } from 'vue-router'
|
|
|
import dayjs from 'dayjs'
|
|
|
-import { uploadFile, addRecord } from '@/api/api'
|
|
|
+import { uploadFile, addRecord, getAllType } from '@/api/api'
|
|
|
import { useCommonStore } from '@/store/common'
|
|
|
const commonStore = useCommonStore()
|
|
|
|
|
@@ -67,8 +96,11 @@ const router = useRouter()
|
|
|
const route = useRoute()
|
|
|
|
|
|
const files = ref([])
|
|
|
-const totalFee = ref(0)
|
|
|
+const totalFee = ref()
|
|
|
+const showKeyboard = ref(false)
|
|
|
const remark = ref('')
|
|
|
+const typeStr = ref('')
|
|
|
+const typeList = ref([])
|
|
|
|
|
|
const afterRead = async (file) => {
|
|
|
// 将文件上传至服务器
|
|
@@ -94,6 +126,19 @@ const onConfirm = (date) => {
|
|
|
const filesDelete = (file) => {
|
|
|
files.value = files.value.filter((elm) => elm.url !== file.url)
|
|
|
}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ commonStore.initBook();
|
|
|
+ setTimeout(() => {
|
|
|
+ getAllTypeByUser()
|
|
|
+ }, 300)
|
|
|
+})
|
|
|
+
|
|
|
+async function getAllTypeByUser() {
|
|
|
+ const res = await getAllType(commonStore.bookInfo.id)
|
|
|
+ typeList.value = res
|
|
|
+}
|
|
|
+
|
|
|
const onSubmit = async (values) => {
|
|
|
// 金额
|
|
|
// 附件
|
|
@@ -110,9 +155,35 @@ const onSubmit = async (values) => {
|
|
|
book_id: commonStore.bookInfo.id,
|
|
|
time: values.calendar,
|
|
|
total_fee: values.totalFee,
|
|
|
- types: 'consectetur',
|
|
|
+ type: values.typeStr,
|
|
|
remark: values.remark,
|
|
|
files: files.value.map((elm) => elm.file_id)
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+function setTypes(tag) {
|
|
|
+ console.log(146, tag)
|
|
|
+ typeStr.value = tag.name
|
|
|
+}
|
|
|
</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.types-box {
|
|
|
+ .types-scroll-box {
|
|
|
+ padding-left: 100px;
|
|
|
+ text-align: left;
|
|
|
+ padding-top: 10px;
|
|
|
+ padding-bottom: 10px;
|
|
|
+ max-height: 60px;
|
|
|
+ overflow-x: scroll;
|
|
|
+ > * {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+ // display: flex;
|
|
|
+ // overflow-y: scroll;
|
|
|
+ // flex-wrap: nowrap;
|
|
|
+ // margin-left: 24px;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|