Commit 0ea05723 by 吴学德

套餐管理

parent f4fa9538
......@@ -13,8 +13,10 @@ let modify = (params) => postAction(prefix + "/packageManagement/package/update"
//新增
let insert= (params) => postAction(prefix + "/packageManagement/package/insert" , params);
//隐藏状态
let hidestatus= (params) => postAction(prefix + "/packageManagement/package/hidestatus" , params);
//删除
let delet= (params) => postAction(prefix + "/packageManagement/package/delete" , params);
//套餐全称列表
let packageAllList= () => postAction(prefix + "/packageManagement/package/packageAllList" );
export {
findByList,choosepages,modify,insert,hidestatus
findByList,choosepages,modify,insert,packageAllList,delet
}
\ No newline at end of file
......@@ -13,7 +13,7 @@
<span class="table-page-search-submitButtons" style="float: left; overflow: hidden;">
<a-col :md="6" :sm="24">
<a-button @click="search()" type="primary">查询</a-button>
<a-divider type="vertical"/>
<a-divider type="vertical"/>
<a-button @click="add()" type="primary">添加</a-button>
</a-col>
</span>
......@@ -25,16 +25,68 @@
<!--列表-->
<s-table :columns="columns" :data="rowdata" bordered ref="table" size="small" class="flex-filling">
<template slot="operation" slot-scope="text,record">
<a >编辑</a>
<a @click="modifyfunction(record)">编辑</a>
<a-divider type="vertical"/>
<a-popconfirm title="是否删除?" @confirm="delet(record.id)">
<a>删除</a>
</a-popconfirm>
</template>
</s-table>
<!--编辑----弹框-->
<a-modal :title="titleName" :visible="modifyvisible" @ok="createfunctionOk" @cancel="createfunctionCancel" html-type="submit" width="840px">
<a-form :form="Formtable">
<a-form-item :labelCol="{span: 6}" :wrapperCol="{span: 8, offset: 1}" label="套餐名称">
<a-input placeholder="套餐名称" v-decorator="[ 'packageName', {rules: [{ required: true, message: '套餐名称不能为空!' ,whitespace:true}]} ]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 6}" :wrapperCol="{span: 8, offset: 1}" label="套餐全称">
<a-auto-complete placeholder="套餐全称" v-decorator="[ 'name', {rules: [{ required: true, message: '县分不能为空!' ,whitespace:true}]} ]">
<template slot="dataSource">
<a-select-option v-for="website in autoCompleteResult" :key="website">
{{ website }}
</a-select-option>
</template>
</a-auto-complete>
</a-form-item>
<a-form-item :labelCol="{span: 6}" :wrapperCol="{span: 8, offset: 1}" label="卡品类型">
<a-radio-group v-decorator="['isXbCard']" :defaultValue="0">
<a-radio :value="0">小白卡</a-radio>
<a-radio :value="1">预制卡</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item :labelCol="{span: 6}" :wrapperCol="{span: 8, offset: 1}" label="月基本费用">
<a-input placeholder="月基本费用" v-decorator="[ 'monthFee', {rules: [{ required: true, message: '月基本费用不能为空!' ,whitespace:true}]} ]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 6}" :wrapperCol="{span: 8, offset: 1}" label="流量">
<a-input placeholder="流量" v-decorator="[ 'flow', {rules: [{ required: true, message: '流量不能为空!' ,whitespace:true}]} ]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 6}" :wrapperCol="{span: 8, offset: 1}" label="语音">
<a-input placeholder="语音" v-decorator="[ 'voice', {rules: [{ required: true, message: '语音不能为空!' ,whitespace:true}]} ]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 6}" :wrapperCol="{span: 8, offset: 1}" label="小白卡套餐id">
<a-input placeholder="小白卡套餐id" v-decorator="[ 'xbId', {rules: [{ required: true, message: '小白卡套餐id不能为空!' ,whitespace:true}]} ]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 6}" :wrapperCol="{span: 8, offset: 1}" label="温馨提示">
<a-input placeholder="温馨提示" v-decorator="[ 'warmTip']"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 6}" :wrapperCol="{span: 8, offset: 1}" label="简介">
<a-input placeholder="简介" v-decorator="[ 'explains', {rules: [{ required: true, message: '简介不能为空!' ,whitespace:true}]}]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 6}" :wrapperCol="{span: 8, offset: 1}" label="背景图">
<img style="width: 150px">
</a-form-item>
<a-form-item :labelCol="{span: 6}" :wrapperCol="{span: 8, offset: 1}" label="小图">
<img style="width: 150px">
</a-form-item>
</a-form>
</a-modal>
</div>
</template>
<script>
import STable from '@/components/table';
import {findByList,choosepages,modify,insert,hidestatus} from "@/api/school-center/packageManagementAPI"
import {findByList,modify,insert,packageAllList,delet} from "@/api/school-center/packageManagementAPI"
import {cloneObject} from '@/utils/util';
export default {
name: "package",
......@@ -43,15 +95,31 @@
},
data: function () {
return {
Formtable: this.$form.createForm(this, {name: 'Formtable'}),
//输入框列表
autoCompleteResult:[],
modifyForm: {
id:"",
packageName:"",
name:"",
isXbCard:"",
monthFee:"",
flow:"",
voice:"",
xbId:"",
warmTip:"",
explains:"",
},
queryParam: {
name: '',
},
modifyvisible:false,
titleName:"",
columns: [
{dataIndex: 'packageName', width: 200, title: '学校名称', align: "center"},
{dataIndex: 'monthFee', width: 200, title: '学校名称', align: "center"},
{dataIndex: 'flow', width: 200, title: '学校名称', align: "center"},
{dataIndex: 'voice', width: 200, title: '学校名称', align: "center"},
{dataIndex: 'packageName', width: 200, title: '套餐名称', align: "center"},
{dataIndex: 'monthFee', width: 200, title: '标准月租', align: "center"},
{dataIndex: 'flow', width: 200, title: '流量', align: "center"},
{dataIndex: 'voice', width: 200, title: '语音', align: "center"},
{
dataIndex: 'operation',
width: 100,
......@@ -94,6 +162,110 @@
search() {
this.$refs.table.refresh({search: true})
},
delet(id){
let parent={
id:id
}
delet(parent).then(res=>{
if (res.state=="success") {
this.$message.success(res.data ? res.data : '修改成功!', 5);
this.search();
return null;
}
this.$message.error(res.data ? res.data : '修改失败!', 5);
})
},
add(){
this.modifyvisible=true
this.modifyForm.id=""
this.titleName="添加"
packageAllList().then(res=>{
if (res.state=="success"){
this.autoCompleteResult=res.data
}
})
setTimeout(()=>{
this.Formtable.setFieldsValue({
isXbCard:0,
})
},0)
},
modifyfunction(data){
this.modifyForm.id=data.id
this.titleName="编辑"
this.modifyvisible=true
setTimeout(()=>{
this.Formtable.setFieldsValue({
packageName:data.packageName,
name:data.name,
isXbCard:data.isXbCard,
monthFee:data.monthFee,
flow:data.flow,
voice:data.voice,
xbId:data.xbId,
warmTip:data.warmTip,
explains:data.explains,
})
},0)
packageAllList().then(res=>{
if (res.state=="success"){
this.autoCompleteResult=res.data
}
})
},
//提交表单
createfunctionOk(){
this.Formtable.validateFields(['packageName', 'name',"isXbCard","monthFee", 'flow',"voice", 'xbId',"warmTip" ,'explains'], {force: true}, (err, values)=>{
if (!err){
this.modifyForm.packageName=values.packageName
this.modifyForm.name=values.name
this.modifyForm.isXbCard=values.isXbCard
this.modifyForm.monthFee=values.monthFee
this.modifyForm.flow=values.flow
this.modifyForm.voice=values.voice
this.modifyForm.xbId=values.xbId
this.modifyForm.warmTip=values.warmTip
this.modifyForm.explains=values.explains
//插入数据
if (this.modifyForm.id==""){
insert(this.modifyForm).then(res=>{
if (res.state=="success") {
this.$message.success(res.data ? res.data : '添加成功!', 5);
this.search();
return null;
}
this.$message.error(res.data ? res.data : '添加失败!', 5);
})
return null;
}
//修改数据
modify(this.modifyForm).then(res=>{
if (res.state=="success") {
this.$message.success(res.data ? res.data : '修改成功!', 5);
this.search();
return null;
}
this.$message.error(res.data ? res.data : '修改失败!', 5);
})
}
})
},
createfunctionCancel(){
this.modifyvisible=false
this.autoCompleteResult=[]
this.Formtable.setFieldsValue({
packageName:"",
name:"",
isXbCard:0,
monthFee:"",
flow:"",
voice:"",
xbId:"",
warmTip:"",
explains:"",
})
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment