123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- <!-- 资费管理 -->
- <template>
- <div class="container">
- <!-- 搜索条件区 -->
- <div class="search-section">
- <Search :SearchForm="trafficSearchFrom" @query="intData" @reset="reset" />
- </div>
- <div class="audit-btn">
- <a-button type="text" @click="dictShowModel(1, false)" v-if="role.getRole == 1">
- <template #icon>
- <icon-plus-circle />
- </template>
- <template #default>{{ $t('form.Add') }}</template>
- </a-button>
- </div>
- <a-table row-key="id" :data="dataSource" :columns="columns" :pagination="pagination" :scroll="{ x: 'auto' }"
- @page-change="evChangePage">
- <template #id="{ record }">
- <!-- 修改 -->
- <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="dictShowModel(2, record)"
- v-if="role.getRole == 1">{{
- $t('form.alter')
- }}</a>
- <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="meal(record)">{{
- $t('tariffManagement.SetMeal') }}</a>
- <!-- 删除 -->
- <a-popconfirm :content="$t('form.Delete')" :ok-text="$t('form.Confirm')" :cancel-text="$t('form.Cancel')"
- @ok="handleDel(record.id)">
- <a class="a-link" href="javascript:;" style="margin-right: 1rem" v-if="role.getRole == 1">{{
- $t('form.Delete')
- }}</a>
- </a-popconfirm>
- </template>
- </a-table>
- <a-modal width="70%" :visible="planVisible" :title="$t('tariffManagement.SelectiveTrafficPacket')"
- @ok="handleSubmitPlan" @cancel="handleCancel">
- <!-- 搜索条件区 -->
- <div class="search-section">
- <a-form :model="formData" layout="inline">
- <a-form-item field="label" :label="$t('tariffManagement.label')">
- <a-input v-model="formData.label" :placeholder="$t('lotCard.please') + $t('tariffManagement.label')"
- allow-clear />
- </a-form-item>
- <a-form-item>
- <a-space>
- <a-button type="primary" @click="handleSearchPlan">{{ $t('form.Search') }}</a-button>
- <a-button @click="resetSearchPlan">{{ $t('form.Reset') }}</a-button>
- </a-space>
- </a-form-item>
- </a-form>
- </div>
- <a-table row-key="id" :data="planList" :columns="planColumns" :scroll="{ x: 'auto' }"
- :row-selection="rowSelectionPlan" v-model:selectedKeys="selectedKeysPlan">
- </a-table>
- </a-modal>
- <Meal v-model:model-value="modealShow" :traffIds="ids" @submit="intData()" />
- <Add v-model:model-value="visible" :type-index="typeCurrent" ref="addDetaile" @submit="intData()"></Add>
- </div>
- </template>
- <script setup>
- import { onMounted, ref, toRefs, getCurrentInstance } from "vue";
- import { useRoute } from "vue-router";
- import { columns, planColumns, trafficSearchFrom } from "./config";
- import { deleteTariff, tariffList } from "@/api/path/tariffManagement.api"
- import { Getdictionary } from '@/mixins/index.js'
- import { useSystemStore } from '@/store/modules/systemStore'
- import Meal from './Management/meal.vue'
- import Add from './Management/add.vue'
- import Search from '@/components/Search/index.vue'
- import { useI18n } from 'vue-i18n'
- import { Message } from '@arco-design/web-vue'
- const { t } = useI18n();
- const role = useSystemStore()
- const { proxy } = getCurrentInstance()
- const route = useRoute();
- const state = ref({
- searchForm: {},
- currency: [],
- dataSource: [],
- pagination: {
- total: 0,
- pageSize: 10,
- current: 1,
- },
- planList: [],
- visible: false,
- typeCurrent: null,
- sourceList: [],
- cycleist: [],
- modealShow: false,
- planVisible: false,
- formData: {},
- selectedKeysPlan: [],
- rowSelectionPlan: {
- type: 'radio',
- showCheckedAll: true,
- onlyCurrent: false,
- },
- ids: null,
- methodList: []
- })
- const {
- searchForm,
- currency,
- dataSource,
- pagination,
- planList,
- visible,
- typeCurrent,
- sourceList,
- cycleist,
- modealShow,
- planVisible,
- formData,
- selectedKeysPlan,
- rowSelectionPlan,
- ids,
- methodList
- } = toRefs(state.value);
- const addDetaile = ref(null)
- const intData = async (item) => {
- if (item) {
- searchForm.value = item
- }
- const param = {
- current: pagination.value.current,
- size: pagination.value.pageSize,
- ...searchForm.value,
- }
- const { data } = await tariffList(param)
- dataSource.value = (data.records || []).map((item, index) => {
- const sourceName = sourceList.value.find(val => val.value == item.source)?.label
- const billingCycleName = cycleist.value.find(val => val.value == item.billingCycle)?.label
- const pricingCurrty = currency.value.find(val => val.value == item.currency)?.label || '人民币'
- const Activated = item.trafficBilling + item.trafficBillingType
- const bagSize = item.pricing + '/' + item.mrcAmount + '/' + item.networkAccessFee
- const billingMethodName = methodList.value.find(val => val.value == item.billingMethod)?.label
- delete item.children
- let pricingName;
- if (item.billingMethod == 1) {
- pricingName = item.trafficBillingAmount + '/' + pricingCurrty
- } else if (item.billingMethod == 2) {
- pricingName = item.pricing + '/' + pricingCurrty
- }
- return {
- ...item,
- sourceName,
- pricingName,
- billingCycleName,
- Activated: Activated,
- status: "正常",
- bagSize,
- billingMethodName,
- Number: index + 1
- }
- })
- pagination.value.total = data.total
- }
- const reset = (item) => {
- searchForm.value = item
- pagination.value.current = 1
- intData()
- }
- // 删除
- const handleDel = async (id) => {
- const { code } = await deleteTariff({ id })
- if (code == 200) {
- Message.success({
- content: t('setting.deleteSuccess'),
- duration: 2000,
- })
- intData()
- }
- };
- const evChangePage = (page) => {
- pagination.value.current = page
- intData()
- }
- // 弹框
- const dictShowModel = (type, data) => {
- addDetaile.value.detaile(data)
- typeCurrent.value = type;
- visible.value = true;
- }
- const resetSearchPlan = () => {
- }
- const handleSearchPlan = () => {
- }
- const handleCancel = () => {
- planVisible.value = false
- }
- const handleSubmitPlan = () => {
- if (selectedKeysPlan.value.length > 0) {
- formState.value.simDataPlanId = String(selectedKeysPlan.value[0])
- planVisible.value = false
- }
- }
- const handleDictValue = async () => {
- sourceList.value = await Getdictionary('source')
- cycleist.value = await Getdictionary('Billingcycle')
- currency.value = await Getdictionary('currencyType')
- methodList.value = await Getdictionary('billingMethod')
- }
- const meal = (data) => {
- ids.value = data.id
- modealShow.value = true
- }
- onMounted(async () => {
- await handleDictValue()
- await intData()
- })
- </script>
- <style scoped lang="less">
- .head-title-right {
- .m-r-10 {
- margin-right: 10px;
- }
- }
- .search-section {
- margin-top: 20px;
- margin-bottom: 20px;
- }
- .container {
- .head-title {
- display: flex;
- justify-content: space-between;
- }
- .form-row {
- display: flex;
- .form-row-col {
- width: 25%;
- display: flex;
- align-items: center;
- .form-row-label {
- width: 120px;
- text-align: right;
- }
- }
- }
- }
- .audit-btn {
- margin-bottom: 10px;
- }
- .formTitle {
- font-size: 18px;
- margin-bottom: 20px;
- display: flex;
- align-items: center
- }
- .formTitle::before {
- content: "";
- display: inline-block;
- width: 4px;
- height: 20px;
- background-color: green;
- margin-right: 10px;
- }
- </style>
|