Ver Fonte

修改套餐计划

吴sir há 2 meses atrás
pai
commit
2fb6cca799

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

@@ -105,8 +105,8 @@ export default {
 
     // 卡详情
      currencyBalance:'SIM货币余额',
-     ActivationDate:'激活日期',
-     DueDate:'到期日期',
+     ActivationDate:'激活日期',
+     DueDate:'到期日期',
      validity:'有效期',
      supplier:'供应商',
      month:'月',

+ 0 - 2
src/mixins/index.js

@@ -24,8 +24,6 @@ export function Getdictionary(params) {
 // 过滤字典值
 export function filterDict(item, value) {
     if (!Array.isArray(item)) return false
-
-    if (typeof value !== 'string') return value
     return item.find(val => val.value == value)?.label
 }
 

+ 110 - 0
src/views/SetMeal/addSetMeal.vue

@@ -0,0 +1,110 @@
+<template>
+    <div>
+        <div class="search">
+            <Search :SearchForm="SetMealSearchForm" @query="initData" @reset="reset"></Search>
+        </div>
+
+        <div class="addSetMeal">
+            <a-button  @click="breakFlos">返回</a-button>
+        </div>
+
+        <div class="table">
+            <a-table row-key="id" :data="tableData" :columns="columnsTarrit" :pagination="pagination"
+                :scroll="{ x: 'auto' }" @page-change="evChangePage">
+                <template #status="{ record }">
+                    <a-tag :color="record.status == 1 ? '#7bc616' : '#86909c'">{{ record.status == 1 ? '上架' : '下架'
+                        }}</a-tag>
+                </template>
+            </a-table>
+        </div>
+
+    </div>
+</template>
+
+<script setup>
+import { defineEmits, defineProps, toRefs, ref, onMounted } from 'vue';
+import { CheckTariffPackages } from '@/api/path/tariffManagement.api'
+import { Getdictionary, tableFunction, filterDict } from '@/mixins/index.js'
+import Search from '@/components/Search/index.vue'
+import { columnsTarrit } from './config'
+import { tariffList} from "@/api/path/tariffManagement.api"
+const props = defineProps({
+    id: [Array, String]
+})
+
+const emits = defineEmits(['break'])
+
+const state = ref({
+    pagination: {
+        total: 0,
+        pageSize: 10,
+        current: 1,
+        simTerminalId: null
+    },
+    visible: false,
+    puyType: [],
+    cyciy: [],
+    Currency: [],
+    tariffListData: [],
+    billingMethodList: [],
+    Type: true,
+})
+const { pagination, visible, puyType, Currency, cyciy, tariffListData, formRef, billingMethodList, Type } = toRefs(state.value)
+
+
+const processData = (data) => {
+    return (data.records || []).map((item, index) => {
+        return {
+            ...item,
+            price: item.price + '/' + item.currency,
+            typeName: item.type == 1 ? '服务时长' : "购买流量",
+            profitPrice: item.profitPrice + '/' + item.currency,
+            billingMethod: filterDict(billingMethodList.value, item.billingMethod),
+            costPrice: item.costPrice + '/' + item.trafficCurrency,
+            oldPrice: item.oldPrice + '/' + item.trafficCurrency
+        }
+    })
+}
+
+const { tableData, evChangePage, initData, reset } = tableFunction(pagination.value, CheckTariffPackages, processData)
+
+
+const breakFlos = ()=>{
+   emits('break',true)
+}
+
+onMounted(async () => {
+    let dict = await Getdictionary(['RechargeType', 'PuyCycle', 'currencyType', 'billingMethod'])
+    puyType.value = dict[0]
+    Form.value.type = puyType.value[0]?.value
+    cyciy.value = dict[1]
+    Form.value.timeUnit = cyciy.value[0]?.value
+    Currency.value = dict[2]
+    Form.value.currency = Currency.value[0]?.value
+    billingMethodList.value = dict[3]
+    let res = await tariffList({ current: 1, size: 99999 })
+    if (res.code === 200) {
+        tariffListData.value = (res.data.records || []).map(item => {
+            return {
+                ...item,
+                value: item.id,
+                label: item.label + '---' + item.userName
+            }
+        })
+    }
+    pagination.value.simTerminalId = props.id
+    initData()
+})
+</script>
+
+<style scoped lang='less'>
+.search,
+.table {
+    margin-top: 20px;
+}
+
+.addSetMeal{
+    display: flex;
+    justify-content: space-between;
+}
+</style>

+ 196 - 39
src/views/SetMeal/config.js

@@ -1,41 +1,198 @@
 
 export const SetMealSearchForm = [
-    {
-      type: "input",
-      label: "套餐名称",
-      field: "label",
-      value: "", // 双向绑定的值
-    },
-    {
-      type: "input",
-      label: "套餐ID",
-      field: "label",
-      value: "", // 双向绑定的值
-    },
-    {
-      type: "select",
-      label: "所属客户",
-      field: "state",
-      options: [], // 默认空,后面会通过字典加载
-      dict: "userType",
-      value: "", // 双向绑定的值
-      width: "200",
-    },
-    {
-      type: "range-picker",
-      label: "创建时间",
-      field: "createdAt",
-      value: [], // 双向绑定的值
-      width: "300",
-      Custom: 'mode="month"', // 自定义值
-    },
-    {
-      type: "select",
-      label: "状态",
-      field: "state",
-      options: [], // 默认空,后面会通过字典加载
-      dict: "userType",
-      value: "", // 双向绑定的值
-      width: "200",
-    },
-  ]
+  {
+    type: "input",
+    label: "套餐名称",
+    field: "label",
+    value: "", // 双向绑定的值
+  },
+  {
+    type: "input",
+    label: "套餐ID",
+    field: "label",
+    value: "", // 双向绑定的值
+  },
+  {
+    type: "select",
+    label: "套餐计划类型",
+    field: "isRecharge",
+    options: [], // 默认空,后面会通过字典加载
+    dict: "setMeal",
+    value: "", // 双向绑定的值
+    width: "200",
+  },
+  {
+    type: "range-picker",
+    label: "创建时间",
+    field: "createdAt",
+    value: [], // 双向绑定的值
+    width: "300",
+    Custom: 'mode="month"', // 自定义值
+  },
+  {
+    type: "select",
+    label: "状态",
+    field: "state",
+    options: [
+      {label:'上架',value:'1'}, 
+      {label:'下架',value:'2'}, 
+    ], // 默认空,后面会通过字典加载
+    value: "", // 双向绑定的值
+    width: "200",
+  },
+]
+
+
+export const columnsSetMeal = [
+  {
+    title: "序号",
+    dataIndex: "index",
+    align: "center",
+    ellipsis: true,
+    render: ({ rowIndex }) => rowIndex + 1,
+  },
+  {
+    title: "套餐计划名称",
+    dataIndex: "label",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "所属客户",
+    dataIndex: "userName",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "套餐计划类型",
+    slotName: "isRecharge",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "绑定资费",
+    dataIndex: "defaultTrafficName",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "状态",
+    slotName: "status",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "创建时间",
+    dataIndex: "createdAt",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "更新时间",
+    dataIndex: "updatedAt",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "操作",
+    align: "center",
+    ellipsis: true,
+    slotName: 'Controls',
+    fixed: 'right'
+  },
+];
+
+
+export const columnsTarrit = [
+  {
+    title: "序号",
+    dataIndex: "index",
+    align: "center",
+    ellipsis: true,
+    render: ({ rowIndex }) => rowIndex + 1,
+  },
+  {
+    title: "套餐名称",
+    dataIndex: "label",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "所属套餐计划",
+    dataIndex: "terminalName",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "资费名称",
+    dataIndex: "trafficName",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "套餐类型",
+    dataIndex: "typeName",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "充值币种",
+    dataIndex: "currency",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "原价",
+    dataIndex: "oldPrice",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "成本",
+    dataIndex: "costPrice",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "售价(终端充值)",
+    dataIndex: "price",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "利润",
+    dataIndex: "profitPrice",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "流量成本结算方式",
+    dataIndex: "billingMethod",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "创建时间",
+    dataIndex: "createdAt",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "更新时间",
+    dataIndex: "updatedAt",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "状态",
+    slotName: "status",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "操作",
+    align: "center",
+    slotName: 'options',
+    fixed: 'right'
+  },
+]

+ 71 - 17
src/views/SetMeal/index.vue

@@ -1,22 +1,76 @@
 <template>
-    <div>
+  <div>
+    <template v-if="AddSet">
       <div class="search">
-          <Search :SearchForm="SetMealSearchForm"></Search>
+        <Search :SearchForm="SetMealSearchForm" @query="initData" @reset="reset"></Search>
       </div>
-  
+
       <div class="table">
-          
+        <a-table row-key="id" :data="tableData" :columns="columnsSetMeal" :pagination="pagination"
+          :scroll="{ x: 'auto' }" @page-change="evChangePage">
+          <template #status="{ record }">
+            <a-tag :color="record.status == 1 ? '#7bc616' : '#86909c'">{{ record.status == 1 ? '上架' : '下架' }}</a-tag>
+          </template>
+          <template #Controls="{ record }">
+            <a-space>
+              <a-button type="text" @click="SetUpPackage(record)">查看套餐</a-button>
+            </a-space>
+          </template>
+          <template #isRecharge="{ record }">
+            {{ filterDict(SetMealList, record.isRecharge) }}
+          </template>
+        </a-table>
       </div>
-    </div>
-  </template>
-  
-  <script setup>
-  import { ref, onMounted, toRefs } from 'vue';
-  import Search from '@/components/Search/index.vue'
-  import {SetMealSearchForm} from './config.js'
-  </script>
-  <style lang="less" scoped>
-  .search{
-      margin-top: 1rem;
-  }
-  </style>
+    </template>
+
+    <!-- 新增套餐计划 -->
+    <AddSetMeal v-if="!AddSet" :id="pid" @break="AddSet=true"/>
+  </div>
+
+</template>
+
+<script setup>
+import { ref, onMounted, toRefs } from 'vue';
+import Search from '@/components/Search/index.vue'
+import { SetMealSearchForm, columnsSetMeal } from './config.js'
+import { PackageSchedule } from '@/api/path/tariffManagement.api.js'
+import { Getdictionary, tableFunction, filterDict } from '@/mixins/index.js'
+import AddSetMeal from './addSetMeal.vue'
+
+const state = ref({
+  pagination: {
+    total: 0,
+    pageSize: 10,
+    current: 1,
+  },
+  AddSet: true,
+  pid: null,
+  SetMealList: [],
+})
+const { pagination,AddSet, pid,SetMealList } = toRefs(state.value)
+
+
+const { tableData, evChangePage, initData, reset } = tableFunction(pagination.value, PackageSchedule)
+
+
+const SetUpPackage = (item) => {
+  pid.value = item.id
+  AddSet.value = false
+}
+
+onMounted(async () => {
+  SetMealList.value = await Getdictionary('setMeal')
+  initData()
+})
+</script>
+<style lang="less" scoped>
+.search,
+.table {
+  margin-top: 1rem;
+}
+
+.code {
+  justify-content: center;
+  display: flex;
+}
+</style>

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

@@ -23,7 +23,7 @@
                     </a-select>
                 </a-form-item>
             </template>
-            <template v-if="formState.source">
+            <!-- <template v-if="formState.source">
                 <a-form-item :label="$t('tariffManagement.TestFlowPacket')" field="testSimDataPlanId">
                     <a-select v-model="formState.testSimDataPlanId">
                         <a-option v-for=" (item, index) in planList" :key="item.id" :value="item.productId">{{
@@ -33,7 +33,7 @@
                         </a-option>
                     </a-select>
                 </a-form-item>
-            </template>
+            </template> -->
             <a-form-item :label="$t('tariffManagement.label')" field="label">
                 <a-input v-model="formState.label" />
             </a-form-item>
@@ -185,7 +185,6 @@ const state = ref({
         // 网络接入费
         "networkAccessFee": '',
         "endDate": '',
-        "testSimDataPlanId": null, // 测试流量包
         "oldPricing": "",
         "oldTrafficBilling": "",
         "oldTrafficBillingType": "MB",

+ 27 - 9
src/views/tariffManagement/SetMeal/addSetMeal.vue

@@ -6,6 +6,7 @@
 
         <div class="addSetMeal">
             <a-button type="primary" @click="visible = true">新增套餐</a-button>
+            <a-button  @click="breakFlos">返回</a-button>
         </div>
 
         <div class="table">
@@ -79,7 +80,7 @@
 </template>
 
 <script setup>
-import { watch, defineProps, toRefs, ref, onMounted } from 'vue';
+import { defineEmits, defineProps, toRefs, ref, onMounted } from 'vue';
 import { CheckTariffPackages } from '@/api/path/tariffManagement.api'
 import { Getdictionary, tableFunction, filterDict } from '@/mixins/index.js'
 import Search from '@/components/Search/index.vue'
@@ -90,6 +91,8 @@ const props = defineProps({
     id: [Array, String]
 })
 
+const emits = defineEmits(['break'])
+
 const state = ref({
     pagination: {
         total: 0,
@@ -112,8 +115,8 @@ const state = ref({
         currency: "",
         trafficId: "",
         flow: "",
-        flowUnit: "1",
-        id:"",
+        flowUnit: "MB",
+        id: "",
     },
     formRef: null,
     Type: true,
@@ -150,12 +153,12 @@ const processData = (data) => {
     return (data.records || []).map((item, index) => {
         return {
             ...item,
-            price: item.price + '/' + item.currency,
+            price: item.price+item.currency,
             typeName: item.type == 1 ? '服务时长' : "购买流量",
-            profitPrice: item.profitPrice + '/' + item.currency,
+            profitPrice: item.profitPrice  + item.currency,
             billingMethod: filterDict(billingMethodList.value, item.billingMethod),
-            costPrice:item.costPrice + '/' + item.trafficCurrency,
-            oldPrice:item.oldPrice + '/' + item.trafficCurrency
+            costPrice: item.costPrice  + item.trafficCurrency,
+            oldPrice: item.oldPrice  + item.trafficCurrency
         }
     })
 }
@@ -172,7 +175,7 @@ const handleSubmit = () => {
                 period: Number(Form.value.period),
                 simTerminalId: props.id
             }
-            if(Type.value){
+            if (Type.value) {
                 delete FormList.id
             }
             let res = Type.value ? await addTariffPackage(FormList) : await UpdateTariffTtems(FormList)
@@ -236,6 +239,10 @@ const SetUpPackage = async (record) => {
     Type.value = false
 }
 
+const breakFlos = ()=>{
+   emits('break',true)
+}
+
 onMounted(async () => {
     let dict = await Getdictionary(['RechargeType', 'PuyCycle', 'currencyType', 'billingMethod'])
     puyType.value = dict[0]
@@ -247,7 +254,13 @@ onMounted(async () => {
     billingMethodList.value = dict[3]
     let res = await tariffList({ current: 1, size: 99999 })
     if (res.code === 200) {
-        tariffListData.value = res.data.records || res.data
+        tariffListData.value = (res.data.records || []).map(item => {
+            return {
+                ...item,
+                value: item.id,
+                label: item.label + '---' + item.userName
+            }
+        })
     }
     pagination.value.simTerminalId = props.id
     initData()
@@ -259,4 +272,9 @@ onMounted(async () => {
 .table {
     margin-top: 20px;
 }
+
+.addSetMeal{
+    display: flex;
+    justify-content: space-between;
+}
 </style>

+ 40 - 5
src/views/tariffManagement/SetMeal/index.vue

@@ -22,6 +22,9 @@
               <a-button type="text" @click="unmount(record)">{{ record.status == 1 ? '下架' : '上架' }}</a-button>
             </a-space>
           </template>
+          <template #isRecharge="{ record }">
+            {{ filterDict(SetMealList, record.isRecharge) }}
+          </template>
         </a-table>
       </div>
     </template>
@@ -35,7 +38,7 @@
       </template>
     </a-modal>
 
-    <a-modal v-model:visible="visibleSetMeal" width="600px" @cancel="visibleSetMeal = false" title="新增套餐计划">
+    <a-modal v-model:visible="visibleSetMeal" width="600px" @cancel="handelCancel" title="新增套餐计划">
       <div class="Form">
         <a-form ref="formRef" :rules="rules" :model="Form">
           <a-form-item label="套餐计划名称" field="label" validate-trigger="blur">
@@ -46,6 +49,15 @@
               <a-option v-for="(item, index) in userList" :value="item.id">{{ item.name }}</a-option>
             </a-select>
           </a-form-item>
+          <a-form-item label="套餐计划类型" field="isRecharge">
+            <a-radio-group v-model="Form.isRecharge" :options="SetMealList" />
+          </a-form-item>
+          <a-form-item label="充值绑定资费" field="defaultTrafficId" validate-trigger="blur">
+            <a-select v-model="Form.defaultTrafficId">
+              <a-option v-for="item in tariffListData" :value="item.id" :key="item.id">{{ item.label
+                }}</a-option>
+            </a-select>
+          </a-form-item>
         </a-form>
       </div>
       <template #footer>
@@ -54,7 +66,7 @@
       </template>
     </a-modal>
     <!-- 新增套餐计划 -->
-    <AddSetMeal v-if="!AddSet" :id="pid"/>
+    <AddSetMeal v-if="!AddSet" :id="pid" @break="AddSet = true" />
   </div>
 
 </template>
@@ -64,7 +76,7 @@ import { ref, onMounted, toRefs } from 'vue';
 import Search from '@/components/Search/index.vue'
 import { SetMealSearchForm, columnsSetMeal } from '../config.js'
 import { getMessUserList, } from '@/api/customer.js';
-import { PackageSchedule, addTariffSchedule, PackageTakedown } from '@/api/path/tariffManagement.api.js'
+import { PackageSchedule, addTariffSchedule, PackageTakedown, tariffList } from '@/api/path/tariffManagement.api.js'
 import QrcodeVue from 'qrcode.vue'
 import { Getdictionary, tableFunction, filterDict } from '@/mixins/index.js'
 import { Message, Modal } from '@arco-design/web-vue';
@@ -93,12 +105,16 @@ const state = ref({
   Form: {
     userId: null,
     label: null,
+    isRecharge: null,
+    defaultTrafficId: null
   },
   userList: [],
+  SetMealList: [],
+  tariffListData: [],
   AddSet: true,
   pid: null
 })
-const { pagination, visibleQrCode, codeUrl, visibleSetMeal, userList, Form, AddSet, pid } = toRefs(state.value)
+const { pagination, visibleQrCode, codeUrl, visibleSetMeal, userList, Form, AddSet, pid, SetMealList, tariffListData } = toRefs(state.value)
 
 
 const { tableData, evChangePage, initData, reset } = tableFunction(pagination.value, PackageSchedule)
@@ -117,6 +133,7 @@ const fetchCustomerList = async (item) => {
 const handleSubmit = ({ values, errors }) => {
   formRef.value.validate(async (values, errors) => {
     if (!errors) {
+      Form.value.isRecharge = Number(Form.value.isRecharge)
       const response = await addTariffSchedule(Form.value)
       if (response.code === 200) {
         Message.success('添加成功')
@@ -148,7 +165,25 @@ const SetUpPackage = (item) => {
   AddSet.value = false
 }
 
-onMounted(() => {
+const handelCancel = () => {
+  Object.keys(Form.value).forEach(res => {
+    Form.value[res] = null
+  })
+  visibleSetMeal.value = false
+}
+
+onMounted(async () => {
+  SetMealList.value = await Getdictionary('setMeal')
+  let res = await tariffList({ current: 1, size: 99999 })
+  if (res.code === 200) {
+    tariffListData.value = (res.data.records || []).map(item => {
+      return {
+        ...item,
+        value: item.id,
+        label: item.label + '---' + item.userName
+      }
+    })
+  }
   initData()
   fetchCustomerList()
 })

+ 22 - 7
src/views/tariffManagement/config.js

@@ -272,6 +272,7 @@ export const trafficSearchFrom = [
 ];
 
 
+
 export const SetMealSearchForm = [
   {
     type: "input",
@@ -286,10 +287,13 @@ export const SetMealSearchForm = [
     value: "", // 双向绑定的值
   },
   {
-    type: "input",
-    label: "所属客户",
-    field: "name",
+    type: "select",
+    label: "套餐计划类型",
+    field: "isRecharge",
+    options: [], // 默认空,后面会通过字典加载
+    dict: "setMeal",
     value: "", // 双向绑定的值
+    width: "200",
   },
   {
     type: "range-picker",
@@ -304,14 +308,13 @@ export const SetMealSearchForm = [
     label: "状态",
     field: "state",
     options: [
-      { label: "上架", value: 1 },
-      { label: "下架", value: 2 },
+      {label:'上架',value:'1'}, 
+      {label:'下架',value:'2'}, 
     ], // 默认空,后面会通过字典加载
-    dict: "userType",
     value: "", // 双向绑定的值
     width: "200",
   },
-];
+]
 
 export const columnsSetMeal = [
   {
@@ -333,6 +336,18 @@ export const columnsSetMeal = [
     align: "center",
     ellipsis: true,
   },
+  {
+    title: "套餐计划类型",
+    slotName: "isRecharge",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: "绑定资费",
+    dataIndex: "defaultTrafficName",
+    align: "center",
+    ellipsis: true,
+  },
   {
     title: "状态",
     slotName: "status",

+ 2 - 2
vite.config.js

@@ -66,8 +66,8 @@ export default defineConfig(({ command, mode }) => {
             proxy: {
                 "/api": {
                     // target:"https://sim.nanodreamtech.com",
-                    // target: "http://192.168.0.78:3001",
-                    target: process.env.VITE_DEV_TYPE == 0 ? "http://sim.ainets.net" : "https://flexi.flexistream.link",
+                    target: "http://192.168.0.78:3001",
+                    // target: process.env.VITE_DEV_TYPE == 0 ? "http://sim.ainets.net" : "https://flexi.flexistream.link",
                     changeOrigin: true,
                     ws: true,
                     secure: true,