feat:核销活动

This commit is contained in:
dzc committed 2025-10-31 16:35:20 +08:00
1 parent 4a5eec3809
commit e97152e242
7 files changed
+469 -260

No files matched your search

+90
View File
@@ -0,0 +1,90 @@
<template>
<el-select style="width: 100%" v-model="selectId" :placeholder="props.placeholder" clearable remote-show-suffix
filterable remote :disabled="props.disabled" :remote-method="remoteSearch" :loading="state.loading"
@visible-change="(e: boolean) => e && getOptions()" :multiple="props.multiple">
<el-option v-for="v in state.options" :key="v.id" :label="`${v.title}`" :value="v.id">
<div class="flex items-center">
<div class="color-primary"> {{ v.title }}</div>
</div>
</el-option>
</el-select>
</template>
<script setup lang="ts" name="select-merchant">
import { reactive } from "vue"
import * as noticeApi from "/@/api/integrated/notice"
const selectId = defineModel()
const props = withDefaults(
defineProps<{
placeholder?: string
apiParams?: any
autoFirst?: boolean
disabled?: boolean
multiple?: boolean
}>(),
{
placeholder: "请选择",
apiParams: {},
autoFirst: false,
disabled: false,
multiple: false
},
)
const queryForm = reactive<any>({
name: null,
current: 1,
size: 9999,
})
const state = reactive<any>({
loading: true,
selectId: selectId.value,
options: [],
})
watch(
selectId,
(newVal, oldValue) => {
if (newVal == oldValue) return
state.selectId = newVal
getOptions()
},
{ immediate: true },
)
async function getOptions() {
try {
state.loading = true
const _pa = {
...queryForm,
...props.apiParams,
}
const { data } = await noticeApi.fetchList(_pa)
state.options = data.records ?? []
if (props.autoFirst && state.options.length != 0) {
state.selectId = state.options[0].id
}
} finally {
setTimeout(() => (state.loading = false), 500)
}
}
function remoteSearch(params: string) {
if (params != queryForm.name) {
queryForm.name = params
getOptions()
}
}
function clear() {
state.selectId = null
getOptions()
}
onMounted(() => {
props.autoFirst && getOptions()
})
</script>
+2
View File
@@ -38,6 +38,7 @@ import SelectCabinet from "/@/components/Select/SelectCabinet.vue"
import SelectMchCatory from "/@/components/Select/SelectMchCatory.vue"
import SelectCanteenSupplier from "/@/components/Select/SelectCanteenSupplier.vue"
import SelectWalletInvoice from "/@/components/Select/SelectWalletInvoice.vue"
import SelectNotice from "/@/components/Select/SelectNotice.vue"
// 地图组件
import MapSelect from "/@/components/map/map-select.vue"
@@ -98,6 +99,7 @@ export default {
app.component("SelectCabinet", SelectCabinet)
app.component("SelectCanteenSupplier", SelectCanteenSupplier)
app.component("SelectWalletInvoice", SelectWalletInvoice)
app.component("SelectNotice", SelectNotice)
app.component("MapSelect", MapSelect)