This commit is contained in:
@@ -33,6 +33,11 @@ import type {
|
|||||||
} from '@/types/api'
|
} from '@/types/api'
|
||||||
|
|
||||||
export class DeviceService extends BaseService {
|
export class DeviceService extends BaseService {
|
||||||
|
/** 查询未删除设备中的去重设备类型选项 */
|
||||||
|
static getDeviceTypes(): Promise<BaseResponse<string[]>> {
|
||||||
|
return this.get<BaseResponse<string[]>>('/api/admin/devices/types')
|
||||||
|
}
|
||||||
|
|
||||||
// ========== 设备基础管理 ==========
|
// ========== 设备基础管理 ==========
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,6 +4,13 @@
|
|||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<span>套餐列表</span>
|
<span>套餐列表</span>
|
||||||
<div class="card-header-right">
|
<div class="card-header-right">
|
||||||
|
<ElSelect v-model="statusFilter" clearable placeholder="套餐状态" style="width: 140px" @change="handleStatusChange">
|
||||||
|
<ElOption label="待生效" :value="0" />
|
||||||
|
<ElOption label="生效中" :value="1" />
|
||||||
|
<ElOption label="已用完" :value="2" />
|
||||||
|
<ElOption label="已过期" :value="3" />
|
||||||
|
<ElOption label="已失效" :value="4" />
|
||||||
|
</ElSelect>
|
||||||
<ElButton
|
<ElButton
|
||||||
type="primary"
|
type="primary"
|
||||||
:disabled="Boolean(props.boundDeviceId)"
|
:disabled="Boolean(props.boundDeviceId)"
|
||||||
@@ -642,6 +649,7 @@
|
|||||||
total?: number
|
total?: number
|
||||||
page?: number
|
page?: number
|
||||||
pageSize?: number
|
pageSize?: number
|
||||||
|
status?: number
|
||||||
boundDeviceId?: number
|
boundDeviceId?: number
|
||||||
boundDeviceNo?: string
|
boundDeviceNo?: string
|
||||||
loading?: boolean
|
loading?: boolean
|
||||||
@@ -652,6 +660,7 @@
|
|||||||
total: 0,
|
total: 0,
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
status: undefined,
|
||||||
boundDeviceId: undefined,
|
boundDeviceId: undefined,
|
||||||
boundDeviceNo: '',
|
boundDeviceNo: '',
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -668,6 +677,7 @@
|
|||||||
(e: 'navigateToOrder', orderId: number): void
|
(e: 'navigateToOrder', orderId: number): void
|
||||||
(e: 'navigateToRefund', refundId: number): void
|
(e: 'navigateToRefund', refundId: number): void
|
||||||
(e: 'refresh'): void
|
(e: 'refresh'): void
|
||||||
|
(e: 'status-change', status: number | undefined): void
|
||||||
}
|
}
|
||||||
|
|
||||||
const emit = defineEmits<Emits>()
|
const emit = defineEmits<Emits>()
|
||||||
@@ -678,6 +688,7 @@
|
|||||||
page_size: props.pageSize,
|
page_size: props.pageSize,
|
||||||
total: props.total
|
total: props.total
|
||||||
})
|
})
|
||||||
|
const statusFilter = ref<number | undefined>(props.status)
|
||||||
|
|
||||||
const defaultExpandedPackageUsageIds = computed(() =>
|
const defaultExpandedPackageUsageIds = computed(() =>
|
||||||
props.packageList
|
props.packageList
|
||||||
@@ -763,6 +774,8 @@
|
|||||||
emit('page-change', page)
|
emit('page-change', page)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleStatusChange = (status: number | undefined) => emit('status-change', status)
|
||||||
|
|
||||||
// 每页条数变化
|
// 每页条数变化
|
||||||
const handleSizeChange = (size: number) => {
|
const handleSizeChange = (size: number) => {
|
||||||
emit('size-change', size)
|
emit('size-change', size)
|
||||||
|
|||||||
@@ -213,12 +213,13 @@ export function useAssetInfo() {
|
|||||||
* @param page - 页码
|
* @param page - 页码
|
||||||
* @param pageSize - 每页条数
|
* @param pageSize - 每页条数
|
||||||
*/
|
*/
|
||||||
const loadPackageList = async (identifier: string, page: number = 1, pageSize: number = 10) => {
|
const loadPackageList = async (identifier: string, page: number = 1, pageSize: number = 10, status?: number) => {
|
||||||
try {
|
try {
|
||||||
packageLoading.value = true
|
packageLoading.value = true
|
||||||
const response = await AssetService.getAssetPackages(identifier, {
|
const response = await AssetService.getAssetPackages(identifier, {
|
||||||
page,
|
page,
|
||||||
page_size: pageSize
|
page_size: pageSize,
|
||||||
|
status
|
||||||
})
|
})
|
||||||
if (response.code === 0 && response.data) {
|
if (response.code === 0 && response.data) {
|
||||||
// items 代表顶层主套餐关系组,必须保留其 children,不得展平。
|
// items 代表顶层主套餐关系组,必须保留其 children,不得展平。
|
||||||
|
|||||||
@@ -70,6 +70,7 @@
|
|||||||
:total="packagePagination.total"
|
:total="packagePagination.total"
|
||||||
:page="packagePagination.page"
|
:page="packagePagination.page"
|
||||||
:page-size="packagePagination.pageSize"
|
:page-size="packagePagination.pageSize"
|
||||||
|
:status="packagePagination.status"
|
||||||
:asset-identifier="cardInfo.identifier"
|
:asset-identifier="cardInfo.identifier"
|
||||||
:bound-device-id="cardInfo.bound_device_id"
|
:bound-device-id="cardInfo.bound_device_id"
|
||||||
:bound-device-no="cardInfo.bound_device_no"
|
:bound-device-no="cardInfo.bound_device_no"
|
||||||
@@ -82,6 +83,7 @@
|
|||||||
@navigate-to-order="handleNavigateToOrder"
|
@navigate-to-order="handleNavigateToOrder"
|
||||||
@navigate-to-refund="handleNavigateToRefund"
|
@navigate-to-refund="handleNavigateToRefund"
|
||||||
@refresh="handlePackageRefresh"
|
@refresh="handlePackageRefresh"
|
||||||
|
@status-change="handlePackageStatusChange"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -321,7 +323,8 @@
|
|||||||
const packagePagination = ref({
|
const packagePagination = ref({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
total: 0
|
total: 0,
|
||||||
|
status: undefined as number | undefined
|
||||||
})
|
})
|
||||||
const walletTransactionSearchToken = ref(0)
|
const walletTransactionSearchToken = ref(0)
|
||||||
|
|
||||||
@@ -723,6 +726,19 @@
|
|||||||
packagePagination.value.total = result.total
|
packagePagination.value.total = result.total
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handlePackageStatusChange = async (status: number | undefined) => {
|
||||||
|
if (!cardInfo.value) return
|
||||||
|
packagePagination.value.status = status
|
||||||
|
packagePagination.value.page = 1
|
||||||
|
const result = await loadPackageList(
|
||||||
|
cardInfo.value.identifier,
|
||||||
|
1,
|
||||||
|
packagePagination.value.pageSize,
|
||||||
|
status
|
||||||
|
)
|
||||||
|
packagePagination.value.total = result.total
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示流量详单
|
* 显示流量详单
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -154,6 +154,7 @@
|
|||||||
{
|
{
|
||||||
prop: 'external_transaction_no',
|
prop: 'external_transaction_no',
|
||||||
label: '外部交易流水号',
|
label: '外部交易流水号',
|
||||||
|
showOverflowTooltip: true,
|
||||||
formatter: (row: EmployeeCollectionApplication) =>
|
formatter: (row: EmployeeCollectionApplication) =>
|
||||||
h(
|
h(
|
||||||
'span',
|
'span',
|
||||||
|
|||||||
@@ -153,11 +153,11 @@
|
|||||||
v-model="form.device_types"
|
v-model="form.device_types"
|
||||||
multiple
|
multiple
|
||||||
filterable
|
filterable
|
||||||
allow-create
|
placeholder="选择设备类型(不选表示全量投放)"
|
||||||
default-first-option
|
|
||||||
placeholder="选择或输入设备类型(不选表示全量投放)"
|
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
/>
|
>
|
||||||
|
<ElOption v-for="item in deviceTypeOptions" :key="item" :label="item" :value="item" />
|
||||||
|
</ElSelect>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem label="卡类型范围" prop="card_types">
|
<ElFormItem label="卡类型范围" prop="card_types">
|
||||||
<ElSelect
|
<ElSelect
|
||||||
@@ -191,7 +191,7 @@
|
|||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { ElMessage, ElMessageBox, ElTag, FormInstance, FormRules } from 'element-plus'
|
import { ElMessage, ElMessageBox, ElTag, FormInstance, FormRules } from 'element-plus'
|
||||||
import { Plus } from '@element-plus/icons-vue'
|
import { Plus } from '@element-plus/icons-vue'
|
||||||
import { H5PopupConfigurationService, ShopService } from '@/api/modules'
|
import { DeviceService, H5PopupConfigurationService, ShopService } from '@/api/modules'
|
||||||
import { useAuth } from '@/composables/useAuth'
|
import { useAuth } from '@/composables/useAuth'
|
||||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||||
import { formatDateTime } from '@/utils/business/format'
|
import { formatDateTime } from '@/utils/business/format'
|
||||||
@@ -270,6 +270,7 @@
|
|||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const configurationList = ref<H5PopupConfiguration[]>([])
|
const configurationList = ref<H5PopupConfiguration[]>([])
|
||||||
|
const deviceTypeOptions = ref<string[]>([])
|
||||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||||
|
|
||||||
const initialSearchState = {
|
const initialSearchState = {
|
||||||
@@ -445,6 +446,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const loadDeviceTypeOptions = async () => {
|
||||||
|
try {
|
||||||
|
const res = await DeviceService.getDeviceTypes()
|
||||||
|
if (res.code === 0) deviceTypeOptions.value = res.data || []
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取设备类型选项失败:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
Object.assign(searchForm, { ...initialSearchState })
|
Object.assign(searchForm, { ...initialSearchState })
|
||||||
pagination.page = 1
|
pagination.page = 1
|
||||||
@@ -751,6 +761,7 @@
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getTableData()
|
getTableData()
|
||||||
|
loadDeviceTypeOptions()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user