|
@@ -17,27 +17,21 @@
|
|
|
</template>
|
|
|
<template #Controls="{ record }">
|
|
|
<a-space>
|
|
|
- <a-button type="text" @click="SetUpPackage(record)" v-if="record.isRecharge==1"> 设置套餐</a-button>
|
|
|
+ <a-button type="text" @click="SetUpPackage(record)" v-if="record.isRecharge == 1"> 设置套餐</a-button>
|
|
|
<a-button type="text" @click="unmount(record)">{{ record.status == 1 ? '下架' : '上架' }}</a-button>
|
|
|
</a-space>
|
|
|
</template>
|
|
|
<template #isRechargeName="{ record }">
|
|
|
{{ filterDict(SetMealList, record.isRecharge) }}
|
|
|
</template>
|
|
|
+ <template #defaultTrafficName="{ record }">
|
|
|
+ {{ record.defaultTraffic.label }}
|
|
|
+ </template>
|
|
|
</a-table>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
- <a-modal v-model:visible="visibleQrCode" width="700px" @cancel="visibleQrCode = false" title="充值二维码">
|
|
|
- <div class="code">
|
|
|
- <qrcode-vue :value="codeUrl" size="150" level="H"></qrcode-vue>
|
|
|
- </div>
|
|
|
- <template #footer>
|
|
|
- <a-button @click="visibleQrCode = false">关闭</a-button>
|
|
|
- </template>
|
|
|
- </a-modal>
|
|
|
-
|
|
|
- <!-- <a-modal v-model:visible="visibleSetMeal" width="600px" @cancel="handelCancel" 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">
|
|
@@ -48,6 +42,11 @@
|
|
|
<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="source" validate-trigger="blur">
|
|
|
+ <a-select :style="{ width: '320px' }" v-model="Form.source" placeholder="请选择运营商">
|
|
|
+ <a-option v-for="(item, index) in sourceList" :value="item.value">{{ item.label }}</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>
|
|
@@ -60,18 +59,18 @@
|
|
|
</a-form>
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
- <a-button @click="visibleSetMeal = false">取消</a-button>
|
|
|
+ <a-button @click="handelCancel">取消</a-button>
|
|
|
<a-button type="primary" @click="handleSubmit">确定</a-button>
|
|
|
</template>
|
|
|
- </a-modal> -->
|
|
|
+ </a-modal>
|
|
|
<!-- 新增套餐计划 -->
|
|
|
- <AddSetMeal v-if="!AddSet" :id="pid" @break="AddSet = true" />
|
|
|
+ <AddSetMeal v-if="!AddSet" :list="list" @break="AddSet = true" />
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, onMounted, toRefs } from 'vue';
|
|
|
+import { ref, onMounted, toRefs, watch } from 'vue';
|
|
|
import Search from '@/components/Search/index.vue'
|
|
|
import { SetMealSearchForm, columnsSetMeal } from '../config.js'
|
|
|
import { getMessUserList, } from '@/api/customer.js';
|
|
@@ -80,7 +79,6 @@ import QrcodeVue from 'qrcode.vue'
|
|
|
import { Getdictionary, tableFunction, filterDict } from '@/mixins/index.js'
|
|
|
import { Message, Modal } from '@arco-design/web-vue';
|
|
|
import AddSetMeal from './addSetMeal.vue'
|
|
|
-import { add } from 'lodash';
|
|
|
const formRef = ref(null);
|
|
|
const rules = {
|
|
|
userId: [
|
|
@@ -89,6 +87,9 @@ const rules = {
|
|
|
label: [
|
|
|
{ required: true, message: '请输入套餐计划名称', trigger: 'blur' },
|
|
|
],
|
|
|
+ source: [
|
|
|
+ { required: true, message: '请选择运营商', trigger: 'blur' },
|
|
|
+ ],
|
|
|
};
|
|
|
|
|
|
|
|
@@ -98,22 +99,22 @@ const state = ref({
|
|
|
pageSize: 10,
|
|
|
current: 1,
|
|
|
},
|
|
|
- visibleQrCode: false,
|
|
|
- codeUrl: 'https://baidu.com',
|
|
|
visibleSetMeal: false,
|
|
|
Form: {
|
|
|
userId: null,
|
|
|
label: null,
|
|
|
isRecharge: '1',
|
|
|
- defaultTrafficId: null
|
|
|
+ defaultTrafficId: null,
|
|
|
+ source: null
|
|
|
},
|
|
|
userList: [],
|
|
|
SetMealList: [],
|
|
|
tariffListData: [],
|
|
|
+ sourceList:[],
|
|
|
AddSet: true,
|
|
|
- pid: null
|
|
|
+ list: {}
|
|
|
})
|
|
|
-const { pagination, visibleQrCode, codeUrl, visibleSetMeal, userList, Form, AddSet, pid, SetMealList, tariffListData } = toRefs(state.value)
|
|
|
+const { pagination, visibleSetMeal, userList, Form, AddSet, SetMealList, tariffListData, sourceList, list } = toRefs(state.value)
|
|
|
|
|
|
|
|
|
const { tableData, evChangePage, initData, reset } = tableFunction(pagination.value, PackageSchedule)
|
|
@@ -132,6 +133,7 @@ const fetchCustomerList = async (item) => {
|
|
|
const handleSubmit = ({ values, errors }) => {
|
|
|
formRef.value.validate(async (values, errors) => {
|
|
|
if (!errors) {
|
|
|
+ if (Form.value.isRecharge == 1 && Form.value.defaultTrafficId == null) return Message.error('请选择充值绑定资费')
|
|
|
Form.value.isRecharge = Number(Form.value.isRecharge)
|
|
|
const response = await addTariffSchedule(Form.value)
|
|
|
if (response.code === 200) {
|
|
@@ -160,7 +162,8 @@ const unmount = async (record) => {
|
|
|
}
|
|
|
|
|
|
const SetUpPackage = (item) => {
|
|
|
- pid.value = item.id
|
|
|
+ list.value.id = item.id
|
|
|
+ list.value.source = item.source
|
|
|
AddSet.value = false
|
|
|
}
|
|
|
|
|
@@ -169,11 +172,23 @@ const handelCancel = () => {
|
|
|
Form.value[res] = null
|
|
|
})
|
|
|
visibleSetMeal.value = false
|
|
|
+ Form.value.isRecharge = "1"
|
|
|
}
|
|
|
|
|
|
-onMounted(async () => {
|
|
|
- SetMealList.value = await Getdictionary('setMeal')
|
|
|
- let res = await tariffList({ current: 1, size: 99999 })
|
|
|
+
|
|
|
+watch(() => Form.value.userId, val => {
|
|
|
+ getTarrife(val)
|
|
|
+}, { deep: true })
|
|
|
+
|
|
|
+watch(() => Form.value.source, val => {
|
|
|
+ getTarrife(Form.value.userId, val)
|
|
|
+}, { deep: true })
|
|
|
+
|
|
|
+// 资费
|
|
|
+const getTarrife = async (item, sourceId) => {
|
|
|
+ let res = await tariffList({ current: 1, size: 99999, userId: item, source: sourceId })
|
|
|
+ tariffListData.value = []
|
|
|
+ Form.value.defaultTrafficId = null
|
|
|
if (res.code === 200) {
|
|
|
tariffListData.value = (res.data.records || []).map(item => {
|
|
|
return {
|
|
@@ -183,8 +198,15 @@ onMounted(async () => {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(async () => {
|
|
|
+ let dict = await Getdictionary(['setMeal', 'source'])
|
|
|
+ SetMealList.value = dict[0]
|
|
|
+ sourceList.value = dict[1]
|
|
|
initData()
|
|
|
fetchCustomerList()
|
|
|
+ getTarrife()
|
|
|
})
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|