This commit is contained in:
@@ -154,11 +154,11 @@
|
||||
<!-- 额外流量信息 -->
|
||||
<div class="extra-traffic-info">
|
||||
<div class="info-item">
|
||||
<span class="label">已使用流量(真)</span>
|
||||
<span class="label">总流量(虚)</span>
|
||||
<span class="value">{{ cardInfo.realUsedFlow || '0.00MB' }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">实际流量</span>
|
||||
<span class="label">已使用量(虚)</span>
|
||||
<span class="value">{{ cardInfo.actualFlow || '0.00MB' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -280,9 +280,9 @@
|
||||
</div>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<div v-else class="empty-state">
|
||||
<ElCard v-else>
|
||||
<ElEmpty description="请在上方输入ICCID进行查询" />
|
||||
</div>
|
||||
</ElCard>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -75,9 +75,11 @@
|
||||
clearable
|
||||
style="flex: 1"
|
||||
/>
|
||||
<ElButton v-if="dialogType === 'add'" @click="handleGenerateSeriesCode">
|
||||
生成编码
|
||||
</ElButton>
|
||||
<CodeGeneratorButton
|
||||
v-if="dialogType === 'add'"
|
||||
code-type="series"
|
||||
@generated="handleCodeGenerated"
|
||||
/>
|
||||
</div>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="系列名称" prop="series_name">
|
||||
@@ -407,6 +409,7 @@
|
||||
import ArtMenuRight from '@/components/core/others/ArtMenuRight.vue'
|
||||
import TableContextMenuHint from '@/components/core/others/TableContextMenuHint.vue'
|
||||
import type { MenuItemType } from '@/components/core/others/ArtMenuRight.vue'
|
||||
import CodeGeneratorButton from '@/components/business/CodeGeneratorButton.vue'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import {
|
||||
CommonStatus,
|
||||
@@ -414,7 +417,6 @@
|
||||
frontendStatusToApi,
|
||||
apiStatusToFrontend
|
||||
} from '@/config/constants'
|
||||
import { generateSeriesCode } from '@/utils/codeGenerator'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
defineOptions({ name: 'PackageSeries' })
|
||||
@@ -938,14 +940,13 @@
|
||||
})
|
||||
}
|
||||
|
||||
// 生成系列编码
|
||||
const handleGenerateSeriesCode = () => {
|
||||
form.series_code = generateSeriesCode()
|
||||
// 处理编码生成
|
||||
const handleCodeGenerated = (code: string) => {
|
||||
form.series_code = code
|
||||
// 清除该字段的验证错误提示
|
||||
nextTick(() => {
|
||||
formRef.value?.clearValidate('series_code')
|
||||
})
|
||||
ElMessage.success('编码生成成功')
|
||||
}
|
||||
|
||||
// 删除套餐系列
|
||||
|
||||
@@ -65,7 +65,18 @@
|
||||
</ElCol>
|
||||
<ElCol :span="12" v-if="dialogType === 'add'">
|
||||
<ElFormItem label="店铺编号" prop="shop_code">
|
||||
<ElInput v-model="formData.shop_code" placeholder="请输入店铺编号" />
|
||||
<div style="display: flex; gap: 8px">
|
||||
<ElInput
|
||||
v-model="formData.shop_code"
|
||||
placeholder="请输入店铺编号或点击生成"
|
||||
clearable
|
||||
style="flex: 1"
|
||||
/>
|
||||
<CodeGeneratorButton
|
||||
code-type="shop"
|
||||
@generated="handleCodeGenerated"
|
||||
/>
|
||||
</div>
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
@@ -73,44 +84,37 @@
|
||||
<ElRow :gutter="20" v-if="dialogType === 'add'">
|
||||
<ElCol :span="12">
|
||||
<ElFormItem label="上级店铺" prop="parent_id">
|
||||
<ElSelect
|
||||
<ElTreeSelect
|
||||
v-model="formData.parent_id"
|
||||
:data="parentShopTreeData"
|
||||
placeholder="一级店铺可不选"
|
||||
filterable
|
||||
remote
|
||||
:remote-method="searchParentShops"
|
||||
:loading="parentShopLoading"
|
||||
clearable
|
||||
check-strictly
|
||||
:render-after-expand="false"
|
||||
:props="{
|
||||
label: 'shop_name',
|
||||
value: 'id',
|
||||
children: 'children'
|
||||
}"
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption
|
||||
v-for="shop in parentShopList"
|
||||
:key="shop.id"
|
||||
:label="shop.shop_name"
|
||||
:value="shop.id"
|
||||
/>
|
||||
</ElSelect>
|
||||
/>
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
|
||||
<ElRow :gutter="20">
|
||||
<ElCol :span="12">
|
||||
<ElFormItem label="省份" prop="province">
|
||||
<ElInput v-model="formData.province" placeholder="请输入省份" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :span="12">
|
||||
<ElFormItem label="城市" prop="city">
|
||||
<ElInput v-model="formData.city" placeholder="请输入城市" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
|
||||
<ElRow :gutter="20">
|
||||
<ElCol :span="12">
|
||||
<ElFormItem label="区县" prop="district">
|
||||
<ElInput v-model="formData.district" placeholder="请输入区县" />
|
||||
<ElFormItem label="所在地区" prop="region">
|
||||
<ElCascader
|
||||
v-model="formData.region"
|
||||
:options="regionData"
|
||||
placeholder="请选择省/市/区"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@change="handleRegionChange"
|
||||
/>
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :span="12">
|
||||
@@ -298,7 +302,9 @@
|
||||
ElTag,
|
||||
ElSwitch,
|
||||
ElSelect,
|
||||
ElOption
|
||||
ElOption,
|
||||
ElTreeSelect,
|
||||
ElCascader
|
||||
} from 'element-plus'
|
||||
import type { FormRules } from 'element-plus'
|
||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||
@@ -308,6 +314,7 @@
|
||||
import ArtMenuRight from '@/components/core/others/ArtMenuRight.vue'
|
||||
import TableContextMenuHint from '@/components/core/others/TableContextMenuHint.vue'
|
||||
import type { MenuItemType } from '@/components/core/others/ArtMenuRight.vue'
|
||||
import CodeGeneratorButton from '@/components/business/CodeGeneratorButton.vue'
|
||||
import { ShopService, RoleService } from '@/api/modules'
|
||||
import type { SearchFormItem } from '@/types'
|
||||
import type { ShopResponse, ShopRoleResponse } from '@/types/api'
|
||||
@@ -315,6 +322,7 @@
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import { CommonStatus, getStatusText, STATUS_SELECT_OPTIONS } from '@/config/constants'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
import { regionData } from '@/utils/constants/regionData'
|
||||
|
||||
defineOptions({ name: 'Shop' })
|
||||
|
||||
@@ -336,7 +344,7 @@
|
||||
const submitLoading = ref(false)
|
||||
const parentShopLoading = ref(false)
|
||||
const parentShopList = ref<ShopResponse[]>([])
|
||||
const searchParentShopList = ref<ShopResponse[]>([])
|
||||
const parentShopTreeData = ref<ShopResponse[]>([])
|
||||
const defaultRoleLoading = ref(false)
|
||||
const defaultRoleList = ref<any[]>([])
|
||||
|
||||
@@ -415,36 +423,19 @@
|
||||
{
|
||||
label: '上级店铺',
|
||||
prop: 'parent_id',
|
||||
type: 'select',
|
||||
options: searchParentShopList.value.map((shop) => ({
|
||||
label: shop.shop_name,
|
||||
value: shop.id
|
||||
})),
|
||||
type: 'tree-select',
|
||||
config: {
|
||||
data: parentShopTreeData.value,
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
remote: true,
|
||||
remoteMethod: handleSearchParentShop,
|
||||
loading: parentShopLoading.value,
|
||||
placeholder: '请选择或搜索上级店铺'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '店铺层级',
|
||||
prop: 'level',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '1级', value: 1 },
|
||||
{ label: '2级', value: 2 },
|
||||
{ label: '3级', value: 3 },
|
||||
{ label: '4级', value: 4 },
|
||||
{ label: '5级', value: 5 },
|
||||
{ label: '6级', value: 6 },
|
||||
{ label: '7级', value: 7 }
|
||||
],
|
||||
config: {
|
||||
clearable: true,
|
||||
placeholder: '请选择店铺层级'
|
||||
checkStrictly: true,
|
||||
renderAfterExpand: false,
|
||||
props: {
|
||||
label: 'shop_name',
|
||||
value: 'id',
|
||||
children: 'children'
|
||||
},
|
||||
placeholder: '请选择上级店铺'
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -463,7 +454,6 @@
|
||||
const columnOptions = [
|
||||
{ label: '店铺名称', prop: 'shop_name' },
|
||||
{ label: '店铺编号', prop: 'shop_code' },
|
||||
{ label: '层级', prop: 'level' },
|
||||
{ label: '所在地区', prop: 'region' },
|
||||
{ label: '联系人', prop: 'contact_name' },
|
||||
{ label: '联系电话', prop: 'contact_phone' },
|
||||
@@ -487,6 +477,12 @@
|
||||
formData.province = row.province || ''
|
||||
formData.city = row.city || ''
|
||||
formData.district = row.district || ''
|
||||
// 编辑时回显地区
|
||||
if (row.province && row.city && row.district) {
|
||||
formData.region = [row.province, row.city, row.district]
|
||||
} else {
|
||||
formData.region = []
|
||||
}
|
||||
formData.address = row.address || ''
|
||||
formData.contact_name = row.contact_name || ''
|
||||
formData.contact_phone = row.contact_phone || ''
|
||||
@@ -500,6 +496,7 @@
|
||||
formData.shop_name = ''
|
||||
formData.shop_code = ''
|
||||
formData.parent_id = undefined
|
||||
formData.region = []
|
||||
formData.province = ''
|
||||
formData.city = ''
|
||||
formData.district = ''
|
||||
@@ -556,14 +553,6 @@
|
||||
width: 140,
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'level',
|
||||
label: '层级',
|
||||
width: 80,
|
||||
formatter: (row: ShopResponse) => {
|
||||
return h(ElTag, { type: 'info', size: 'small' }, () => `${row.level}级`)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'region',
|
||||
label: '所在地区',
|
||||
@@ -643,6 +632,7 @@
|
||||
shop_name: '',
|
||||
shop_code: '',
|
||||
parent_id: undefined as number | undefined,
|
||||
region: [] as string[], // 省市区级联数据
|
||||
province: '',
|
||||
city: '',
|
||||
district: '',
|
||||
@@ -656,6 +646,28 @@
|
||||
default_role_id: undefined as number | undefined
|
||||
})
|
||||
|
||||
// 处理编码生成
|
||||
const handleCodeGenerated = (code: string) => {
|
||||
formData.shop_code = code
|
||||
// 清除该字段的验证错误提示
|
||||
nextTick(() => {
|
||||
formRef.value?.clearValidate('shop_code')
|
||||
})
|
||||
}
|
||||
|
||||
// 处理地区选择变化
|
||||
const handleRegionChange = (value: string[]) => {
|
||||
if (value && value.length === 3) {
|
||||
formData.province = value[0]
|
||||
formData.city = value[1]
|
||||
formData.district = value[2]
|
||||
} else {
|
||||
formData.province = ''
|
||||
formData.city = ''
|
||||
formData.district = ''
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索默认角色(仅加载客户角色)
|
||||
const searchDefaultRoles = async (query: string) => {
|
||||
defaultRoleLoading.value = true
|
||||
@@ -683,24 +695,26 @@
|
||||
onMounted(() => {
|
||||
getShopList()
|
||||
loadParentShopList()
|
||||
loadSearchParentShopList()
|
||||
searchDefaultRoles('') // 加载初始默认角色列表
|
||||
})
|
||||
|
||||
// 加载上级店铺列表(用于新增对话框,默认加载20条)
|
||||
// 加载上级店铺列表(用于新增对话框和搜索栏,获取所有店铺构建树形结构)
|
||||
const loadParentShopList = async (shopName?: string) => {
|
||||
parentShopLoading.value = true
|
||||
try {
|
||||
const params: any = {
|
||||
page: 1,
|
||||
pageSize: 20
|
||||
page_size: 9999 // 获取所有数据用于构建树形结构
|
||||
}
|
||||
if (shopName) {
|
||||
params.shop_name = shopName
|
||||
}
|
||||
const res = await ShopService.getShops(params)
|
||||
if (res.code === 0) {
|
||||
parentShopList.value = res.data.items || []
|
||||
const items = res.data.items || []
|
||||
parentShopList.value = items
|
||||
// 构建树形数据
|
||||
parentShopTreeData.value = buildTreeData(items)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取上级店铺列表失败:', error)
|
||||
@@ -709,43 +723,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 加载搜索栏上级店铺列表(默认加载20条)
|
||||
const loadSearchParentShopList = async (shopName?: string) => {
|
||||
try {
|
||||
const params: any = {
|
||||
page: 1,
|
||||
pageSize: 20
|
||||
}
|
||||
if (shopName) {
|
||||
params.shop_name = shopName
|
||||
}
|
||||
const res = await ShopService.getShops(params)
|
||||
if (res.code === 0) {
|
||||
searchParentShopList.value = res.data.items || []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取上级店铺列表失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索上级店铺(用于新增对话框)
|
||||
const searchParentShops = (query: string) => {
|
||||
if (query) {
|
||||
loadParentShopList(query)
|
||||
} else {
|
||||
loadParentShopList()
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索上级店铺(用于搜索栏)
|
||||
const handleSearchParentShop = (query: string) => {
|
||||
if (query) {
|
||||
loadSearchParentShopList(query)
|
||||
} else {
|
||||
loadSearchParentShopList()
|
||||
}
|
||||
}
|
||||
|
||||
// 获取店铺列表
|
||||
const getShopList = async () => {
|
||||
loading.value = true
|
||||
|
||||
Reference in New Issue
Block a user