|
@@ -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 () => {
|