wanghairong 5 сар өмнө
parent
commit
4dc57a1002

+ 1 - 1
src/views/supplier/trafficList/NewDataPackageForm.vue

@@ -54,7 +54,7 @@ const formRef = ref(null);
 const formData = reactive({
     packageName: '',
     source: '',
-    status: 'normal',
+    status: '',
     packageCode: '',
     packageSize: null,
     packageSizeUnit: 'MB',

+ 7 - 0
src/views/supplier/trafficList/config.js

@@ -1,5 +1,12 @@
 export const columns = [
   { title: window.$t('dataPackage.id'), dataIndex: 'id', align: 'center', width: 200 },
+  { title: window.$t('dataPackage.superiorId'), dataIndex: 'superior_id', align: 'center', width: 200 },
+  { title: window.$t('dataPackage.typePackage'), dataIndex: 'typePackage', align: 'center', width: 200 },
+  { title: window.$t('dataPackage.statusPackage'), dataIndex: 'statusPackage', align: 'center', width: 200 },
+  { title: window.$t('dataPackage.period'), dataIndex: 'period', align: 'center', width: 200 },
+  { title: window.$t('dataPackage.periodType'), dataIndex: 'period_type', align: 'center', width: 200 },
+  { title: window.$t('dataPackage.lastModifyTime'), dataIndex: 'last_modify_time', align: 'center', width: 200 },
+  { title: window.$t('dataPackage.activationMode'), dataIndex: 'activation_mode', align: 'center', width: 200 },
   { title: window.$t('dataPackage.packageCode'), dataIndex: 'packageCode', align: 'center', width: 200 },
   { title: window.$t('dataPackage.packageName'), dataIndex: 'packageName', align: 'center', width: 200 },
   { title: window.$t('dataPackage.operatorName'), dataIndex: 'sourceName', align: 'center', width: 200 },

+ 49 - 20
src/views/tariffManagement/index.vue

@@ -54,12 +54,12 @@
             @onCancel="resetForm" centered :maskClosable="false" :footer="null">
             <a-form ref="formRef" :rules="rules" :model="formState" @submit="handleSubmit">
                 <div class="formTitle">基本信息</div>
+
                 <a-form-item :label="$t('tariffManagement.simDataPlanId')" field="sim_data_plan_id">
-                    <a-input v-model="formState.sim_data_plan_id">
-                        <template #append>
-                            <a-button class="m-r-10" @click="handlePlan()">选择流量包</a-button>
-                        </template>
-                    </a-input>
+                    <a-select v-model="formState.sim_data_plan_id">
+                        <a-option v-for=" item in planList" :key="item.superior_id" :value="item.id"> 流量包{{ item.id
+                            }}</a-option>
+                    </a-select>
                 </a-form-item>
                 <a-form-item :label="$t('tariffManagement.feeCode')" field="feeCode" required="">
                     <a-input v-model="formState.feeCode" />
@@ -68,7 +68,10 @@
                     <a-input v-model="formState.label" />
                 </a-form-item>
                 <a-form-item :label="$t('tariffManagement.userId')" field="user_id">
-                    <a-input v-model="formState.user_id" />
+                    <a-select v-model="formState.user_id">
+                        <a-option v-for=" item in userIdList" :key="item.id" :value="item.id">{{ item.name
+                            }}</a-option>
+                    </a-select>
                 </a-form-item>
                 <a-form-item :label="$t('tariffManagement.source')" field="source">
                     <a-select v-model="formState.source">
@@ -218,6 +221,8 @@ import { columns, planColumns } from "./config";
 import { Message, Notification } from '@arco-design/web-vue'
 import { deleteTariff, updateTariff, addTariff, tariffList } from "@/api/path/tariffManagement.api"
 import { dataPlanList } from "@/api/path/lotCard.api"
+import { userList } from '@/api/path/system.api'
+
 import { enum_dict } from "@/hooks/enum";
 import { useSystemStore } from '@/store/modules/systemStore'
 
@@ -305,6 +310,10 @@ const resetSearch = () => {
 
 
 // -------------------弹窗数据------------------------------------
+const planList = ref([])
+const userIdList = ref([])
+
+
 const visible = ref(false);
 const typeCurrent = ref(null);
 const sourceList = ref([])
@@ -349,9 +358,6 @@ const formState = ref({
     // 流量包大小类型
     "bagSizeUnit": "KB",
     "pricingUnit": "月",
-
-
-
 });
 
 const rules = {
@@ -373,10 +379,16 @@ const rules = {
 const handleSubmit = ({ values, errors }) => {
     formRef.value.validate(async (errors) => {
         if (!errors) {
-            values.user_id = Number(values.user_id)
-            values.currency = '1'
+            const formVal = JSON.parse(JSON.stringify(values))
+            delete formVal.settlementCycleMap
+            delete formVal.bagSizeUnit
+            delete formVal.pricingUnit
+
+            formVal.currency = '1'
+            formVal.user_id = Number(values.user_id)
+            formVal.sim_data_plan_id = String(values.sim_data_plan_id)
             if (values.settlementCycleMap.starTime && values.settlementCycleMap.starTime) {
-                values.settlement_cycle = values.settlementCycleMap.starTime + '~' + values.settlementCycleMap.endTime
+                formVal.settlement_cycle = values.settlementCycleMap.starTime + '~' + values.settlementCycleMap.endTime
             } else {
                 Message.warning({
                     content: "请选择订购周期!",
@@ -390,7 +402,7 @@ const handleSubmit = ({ values, errors }) => {
                 values.pricing = values.pricing + '元/' + values.pricingUnit
             }
             if (formState.value.id) {
-                const { code, data } = await updateTariff(values)
+                const { code, data } = await updateTariff(formVal)
 
                 if (code == 200) {
                     Message.success({
@@ -401,7 +413,7 @@ const handleSubmit = ({ values, errors }) => {
                     intData()
                 }
             } else {
-                const { code, data } = await addTariff(values)
+                const { code, data } = await addTariff(formVal)
                 if (code == 200) {
                     Message.success({
                         content: "添加成功!",
@@ -417,15 +429,17 @@ const handleSubmit = ({ values, errors }) => {
 }
 // 弹框
 const dictShowModel = (type, data) => {
+    handleModelId()
     formRef.value.resetFields();
     formState.value.settlementCycleMap.starTime = ''
     formState.value.settlementCycleMap.endTime = ''
     typeCurrent.value = type;
-    visible.value = true;
+
     // 编辑
     if (type == 2) {
-
         Object.assign(formState.value, data);
+        formState.value.sim_data_plan_id = Number(formState.value.sim_data_plan_id)
+        formState.value.user_id = Number(formState.value.user_id)
         if (data.bag_size) {
             formState.value.bagSizeUnit = data.bag_size.replace(/\d/g, '')
             formState.value.bag_size = data.bag_size.match(/\d+/)[0]
@@ -439,6 +453,22 @@ const dictShowModel = (type, data) => {
             formState.value.settlementCycleMap.endTime = data.settlement_cycle.split('~')[1] || ''
         }
     }
+    nextTick(() => {
+        visible.value = true;
+    })
+}
+
+const handleModelId = async () => {
+    const param = {
+        current: 1,
+        size: 999,
+    }
+    dataPlanList(param).then(res => {
+        planList.value = res.data.records || []
+    })
+    userList(param).then(res => {
+        userIdList.value = (res.data.records || []).filter((item) => item.user_type == '2')
+    })
 }
 // 取消
 const resetForm = () => {
@@ -451,7 +481,7 @@ const resetForm = () => {
 // 资费弹窗------------------------------------------------
 const planVisible = ref(false)
 const formData = ref({})
-const planList = ref([])
+// const planList = ref([])
 const selectedKeysPlan = ref([])
 const rowSelectionPlan = reactive({
     type: 'radio',
@@ -462,8 +492,8 @@ const rowSelectionPlan = reactive({
 const handlePlan = async () => {
     planVisible.value = true
     const param = {
-        current: pagination.value.current,
-        size: pagination.value.pageSize,
+        current: 1,
+        size: 10,
         ...formData.value,
     }
     const { data } = await dataPlanList(param)
@@ -477,7 +507,6 @@ const handlePlan = async () => {
             bag_size: "2.0MB"
         }
     })
-    pagination.value.total = data.total
 
 }
 const resetSearchPlan = () => {