Prechádzať zdrojové kódy

修改删除套餐初始化为空请求接口的bug

wxy 3 mesiacov pred
rodič
commit
898726ba24

+ 2 - 2
src/i18n/zh/form.js

@@ -83,6 +83,6 @@ export default {
     pleaseEnter: "请输入",
   },
 
-  alter:'变更'
-   
+  alter:'变更',
+  confirm:'保存'
 }

+ 1 - 2
src/views/tariffManagement/Management/add.vue

@@ -152,7 +152,7 @@ const state = ref({
         // 价格(必填)
         "pricing": "",
         // 币种(必填)
-        "currency": "usb",
+        "currency": "USD",
         // 流量资费计费
         "trafficBilling": '',
         // 流量资费计费类型
@@ -320,7 +320,6 @@ const detaile = (val) => {
 onMounted(() => {
     handleDictValue()
     handleModelId()
-    formState.value.trafficBillingType = 'MB'
 })
 
 defineExpose({ detaile })

+ 22 - 16
src/views/tariffManagement/Management/meal.vue

@@ -1,7 +1,8 @@
 <template>
-    <a-modal width="55%" v-model:visible="modelValue" @ok="handleOk" @cancel="handleCancel" :title="$t('tariffManagement.SetMeal')"  :okText="$t('form.Confirm')"
-    :cancelText="$t('form.Cancel')"> 
-        <div class="add"><a-button type="primary" @click="addMeal" v-if="role.getRole == 1">{{ $t('tariffManagement.AddPackage') }}</a-button></div>
+    <a-modal width="55%" v-model:visible="modelValue" @ok="handleOk" @cancel="handleCancel"
+        :title="$t('tariffManagement.SetMeal')" :okText="$t('form.Confirm')" :cancelText="$t('form.Cancel')">
+        <div class="add"><a-button type="primary" @click="addMeal" v-if="role.getRole == 1">{{
+            $t('tariffManagement.AddPackage') }}</a-button></div>
         <div class="item_warp">
             <a-table :columns="columns" :data="wanberFloter" style="margin-top: 20px" :pagination="false"
                 :scroll="{ y: 'auto' }">
@@ -12,22 +13,22 @@
                     <a-input v-model="record.price" />
                 </template>
                 <template #currency="{ record, rowIndex }">
-                    <a-select v-model="record.currency" :style="{ width: '300px' }" :placeholder="$t('form.datapoolForm.pleaseSelect')"
-                        :disabled="role.getRole == 2">
+                    <a-select v-model="record.currency" :style="{ width: '300px' }"
+                        :placeholder="$t('form.datapoolForm.pleaseSelect')" :disabled="role.getRole == 2">
                         <a-option v-for="res of Pricing" :value="res.value" :label="res.label" />
                     </a-select>
                 </template>
                 <template #label="{ record, rowIndex }">
                     <a-input v-model="record.label" v-if="role.getRole !== 1" />
                 </template>
-                <template #setting="{ record }">
+                <template #setting="{ record, rowIndex }">
                     <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="addUpate(record)">{{
-                        record.id == '' ? $t('form.Add') : $t('form.Edit') }}</a>
+                        $t('form.confirm') }}</a>
                     <a-popconfirm :content="$t('form.Delete')" :ok-text="$t('form.Confirm')"
-                        :cancel-text="$t('form.Cancel')" @ok="deletaMeal(record.id)">
+                        :cancel-text="$t('form.Cancel')" @ok="deletaMeal(record.id, rowIndex)">
                         <a class="a-link" href="javascript:;" v-if="role.getRole == 1">{{
                             $t('form.Delete')
-                        }}</a>
+                            }}</a>
                     </a-popconfirm>
                 </template>
             </a-table>
@@ -41,8 +42,8 @@ import { Getdictionary } from '@/mixins/index.js'
 import { useSystemStore } from '@/store/modules/systemStore'
 import { Message } from '@arco-design/web-vue'
 import { addTariffPackage, CheckTariffPackages, UpdateTariffTtems, DeleteTariffItems } from '@/api/path/tariffManagement.api'
-import {useI18n} from 'vue-i18n'
-const {t} = useI18n();
+import { useI18n } from 'vue-i18n'
+const { t } = useI18n();
 const props = defineProps({
     modelValue: {
         type: Boolean,
@@ -128,12 +129,17 @@ const addMeal = () => {
     wanberFloter.value.push({ id: '', period: '', price: '', currency: '', label: '' })
 }
 // 删除
-const deletaMeal = async (ids) => {
-    let res = await DeleteTariffItems({ id: ids })
-    if (res.code === 200) {
-        Message.success(t('setting.deleteSuccess'))
-        await getList()
+const deletaMeal = async (ids, index) => {
+    if (ids) {
+        let res = await DeleteTariffItems({ id: ids })
+        if (res.code === 200) {
+            Message.success(t('setting.deleteSuccess'))
+            await getList()
+        }
+    } else {
+        wanberFloter.value.splice(index, 1)
     }
+
 }
 
 const handeDict = async () => {