| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441 |
- <template>
- <div class="m-container">
- <!-- <h2>VIP活动方案新增 <div class="squrt"></div> </h2> -->
- <h2>
- <el-page-header @back="onCancel"
- :content="'VIP活动方案' + (pageType == 'create' ? '新增' : '修改')"></el-page-header>
- </h2>
- <div class="m-core">
- <el-form :label-position="labelPosition"
- :model="vipform"
- ref='vipform'
- :rules='vipformRules'
- class="vipform">
- <el-form-item label="活动名称"
- prop="name">
- <el-input style="width:400px"
- v-model="vipform.name"></el-input>
- </el-form-item>
- <el-form-item label="适用分部"
- prop="organ">
- <el-select v-model="vipform.organ"
- multiple
- clearable>
- <el-option v-for='(item,index) in organList'
- :key="index"
- :label="item.name"
- :value="item.id"></el-option>
- </el-select>
- <el-button @click="onCheckAllBranch">适用所有分部</el-button>
- </el-form-item>
- <el-form-item label="活动描述"
- prop="desc">
- <el-input type="textarea"
- v-model="vipform.desc"
- style="width:400px"
- :rows="5"
- placeholder="请输入活动说明"></el-input>
- </el-form-item>
- <el-form-item label="活动时间"
- prop="activeTime">
- <el-date-picker v-model="vipform.activeTime"
- type="datetimerange"
- range-separator="至"
- value-format="yyyy-MM-dd HH:mm:ss"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="课程时间"
- prop="courseTime">
- <el-date-picker v-model="vipform.courseTime"
- type="datetimerange"
- range-separator="至"
- value-format="yyyy-MM-dd HH:mm:ss"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="课程形式"
- prop="stauts">
- <el-select v-model="vipform.stauts"
- multiple>
- <el-option v-for="(item,index) in courseStatusList"
- :key='index'
- :value="item.id"
- :label="item.name"></el-option>
- </el-select>
- </el-form-item>
- </el-form>
- <div class="activeRange">
- <div class="left">
- <p>活动适用范围&结算标准:</p>
- </div>
- <div class="right">
- <div class="chioseWrap">
- <el-checkbox label="线上课"
- v-model="online"></el-checkbox>
- <el-select v-model="onlineSalary">
- <el-option label="老师默认课酬"
- value="TEACHER_DEFAULT"></el-option>
- <el-option label="课程单价比例折扣"
- value="RATIO_DISCOUNT"></el-option>
- <el-option label="固定课酬"
- value="FIXED_SALARY"></el-option>
- </el-select>
- <el-input placeholder="请输入"
- v-if='onlineSalary== "RATIO_DISCOUNT"'
- style="width:200px;"
- type="number"
- v-model="onlineprice">
- <template slot="append">%</template>
- </el-input>
- <el-input placeholder="请输入"
- v-if='onlineSalary == "FIXED_SALARY"'
- style="width:200px;"
- type="number"
- v-model="onlineprice">
- <template slot="append">元</template>
- </el-input>
- </div>
- <div class="chioseWrap">
- <el-checkbox label="线下课"
- v-model="unonline"></el-checkbox>
- <el-select v-model="unonlineSalary">
- <el-option label="老师默认课酬"
- value="TEACHER_DEFAULT"></el-option>
- <el-option label="课程单价比例折扣"
- value="RATIO_DISCOUNT"></el-option>
- <el-option label="固定课酬"
- value="FIXED_SALARY"></el-option>
- </el-select>
- <el-input placeholder="请输入"
- v-if='unonlineSalary== "RATIO_DISCOUNT"'
- style="width:200px;"
- type="number"
- v-model="unonlineprice">
- <template slot="append">%</template>
- </el-input>
- <el-input placeholder="请输入"
- style="width:200px;"
- v-if='unonlineSalary== "FIXED_SALARY"'
- type="number"
- v-model="unonlineprice">
- <template slot="append">元</template>
- </el-input>
- </div>
- <div class="chioseWrap">
- <el-checkbox v-model="salaryReadonlyFlag"
- label="可自定义收费、结算标准"></el-checkbox>
- </div>
- </div>
- </div>
- <div class="activeType">
- <div class="left">
- <p>活动类型</p>
- </div>
- <div class="right">
- <div>
- <div class="head"
- :class="activeType=='BASE_ACTIVITY'?'active':''"
- @click="activeType='BASE_ACTIVITY'">基础活动</div>
- <p class="title"
- v-if="activeType=='BASE_ACTIVITY'">课程原价</p>
- </div>
- <div>
- <div class="head"
- :class="activeType=='DISCOUNT'?'active':''"
- @click="activeType='DISCOUNT'">折扣</div>
- <el-input v-if="activeType=='DISCOUNT'"
- v-model="attribute1"
- style="width:200px!important"
- placeholder="请输入折扣数值">
- <template slot="append">%</template>
- </el-input>
- </div>
- <div>
- <div class="head"
- :class="activeType=='GIVE_CLASS'?'active':''"
- @click="activeType='GIVE_CLASS'">赠送课时</div>
- <el-input placeholder="多少节开始赠"
- v-if="activeType=='GIVE_CLASS'"
- v-model="attribute1"
- type="number"
- style='margin-right:10px;width:200px!important'>
- <template slot="append">节</template>
- </el-input> <span v-if="activeType=='GIVE_CLASS'">赠</span>
- <el-input v-if="activeType=='GIVE_CLASS'"
- placeholder="请输入赠送课时数"
- type="number"
- v-model="attribute2"
- style='margin:0 10px;width:200px!important'>
- <template slot="append">节</template>
- </el-input>
- <el-checkbox v-if="activeType=='GIVE_CLASS'"
- v-model="giveClassPaySalaryFlag"
- label="赠送课时结算课酬"></el-checkbox>
- </div>
- </div>
- </div>
- </div>
- <div class="btnWrap"
- style="justify-content:flex-start">
- <div class="closeBtn"
- @click="onReSet">重置</div>
- <div class="okBtn"
- @click='submitFrom'>确定</div>
- </div>
- </div>
- </template>
- <script>
- import { vipGroupCategory, addVipActive } from '@/api/vipSeting'
- import { getEmployeeOrgan } from '@/api/buildTeam'
- export default {
- data () {
- return {
- pageType: this.$route.query.type,
- labelPosition: 'left',
- vipform: {
- name: '',
- desc: '',
- activeTime: [],
- courseTime: [],
- organ: []
- },
- vipformRules: {
- name: [{ required: true, message: '请输入活动名称', trigger: 'blur' },
- { min: 1, max: 25, message: '长度在 1 到 25 个字符', trigger: 'blur' }],
- desc: [{ required: false, message: '请输入文字描述', trigger: 'blur' },
- { min: 1, max: 200, message: '长度在 1 到 200 个字符', trigger: 'blur' }],
- activeTime: [{ required: false, message: '请选择活动时间', trigger: 'blur' }],
- courseTime: [{ required: false, message: '请选择课程时间', trigger: 'blur' }],
- organ: [{ required: true, message: '请选择适用分部', trigger: 'blur' }]
- },
- courseStatusList: [], // 获取所有课程形式
- activeType: '',
- online: true,
- unonline: true,
- onlineSalary: 'TEACHER_DEFAULT',
- unonlineSalary: 'TEACHER_DEFAULT',
- onlineprice: '',
- unonlineprice: '',
- salaryReadonlyFlag: true,
- attribute1: '',
- attribute2: '',
- attribute3: '',
- giveClassPaySalaryFlag: true,
- organList: []
- }
- },
- mounted () {
- // 首先获取课程形式
- vipGroupCategory().then(res => {
- // console.log(res);
- if (res.code == 200) {
- this.courseStatusList = res.data;
- }
- })
- // 适用分部
- getEmployeeOrgan().then(res => {
- if (res.code == 200) {
- this.organList = res.data;
- }
- })
- },
- methods: {
- submitFrom () {
- this.$refs['vipform'].validate((valid) => {
- if (valid) {
- // 验证通过
- let coursesStartTime = this.vipform.courseTime[0];
- let coursesEndTime = this.vipform.courseTime[1];
- let startTime = this.vipform.activeTime[0];
- let endTime = this.vipform.activeTime[1];
- let organId = this.vipform.organ.join(',');
- let type = this.activeType;
- let vipGroupCategoryIdList = this.vipform.stauts.join(',')
- let onlineSalarySettlement;
- let offlineSalarySettlement;
- if (this.online) {
- // 勾选线上
- onlineSalarySettlement = {
- salarySettlementType: this.onlineSalary,
- settlementValue: this.onlineprice
- }
- } else {
- onlineSalarySettlement = null;
- }
- if (this.unonline) {
- // 勾选线下
- offlineSalarySettlement = {
- salarySettlementType: this.unonlineSalary,
- settlementValue: this.unonlineprice
- }
- } else {
- offlineSalarySettlement = null
- }
- let salaryReadonlyFlag = this.salaryReadonlyFlag * 1;
- let giveClassPaySalaryFlag = this.giveClassPaySalaryFlag * 1;
- let vipGroupSalarySettlement = {
- onlineSalarySettlement,
- offlineSalarySettlement
- }
- // 发请求创建活动
- addVipActive({
- coursesStartTime,
- coursesEndTime,
- startTime,
- endTime,
- name: this.vipform.name,
- description: this.vipform.desc,
- organId,
- type,
- vipGroupCategoryIdList,
- vipGroupSalarySettlement,
- salaryReadonlyFlag,
- giveClassPaySalaryFlag,
- attribute1: this.attribute1,
- attribute2: this.attribute2,
- attribute3: this.attribute3
- }).then(res => {
- if (res.code == 200) {
- this.$message.success('恭喜你,活动创建成功')
- this.$router.push('/vipClassSet/vipActiveList')
- }
- })
- } else {
- this.$message.error('请填写必要参数')
- }
- })
- // 线上线下课 勾选就传不勾选就不传
- // addVipActive().then(res => { })
- },
- onCheckAllBranch() {
- // 选择所有分部
- this.vipform.organ = []
- this.organList.forEach(item => {
- this.vipform.organ.push(item.id)
- })
- },
- onCancel () {
- this.$router.push("/vipClassSet/vipActiveList")
- },
- onReSet () {
- this.vipform = {
- name: '',
- desc: '',
- activeTime: [],
- courseTime: [],
- }
- this.activeType = ''
- this.online = true
- this.unonline = true
- this.salaryReadonlyFlag = true
- this.onlineSalary = 'TEACHER_DEFAULT'
- this.unonlineSalary = 'TEACHER_DEFAULT'
- this.onlineprice = ''
- this.unonlineprice = ''
- this.$refs.vipform.resetFields()
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .m-core {
- font-size: 14px;
- width: 100%;
- display: flex;
- flex-direction: column;
- justify-content: center;
- // text-align: center;
- .activeRange {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- .left {
- height: 72px;
- line-height: 72px;
- }
- .right {
- .chioseWrap {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- height: 72px;
- line-height: 72px;
- align-items: center;
- .el-checkbox {
- margin-right: 20px;
- }
- .el-select {
- margin-right: 20px;
- }
- }
- }
- }
- .activeType {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- .left {
- margin-right: 20px;
- p {
- height: 40px;
- line-height: 40px;
- }
- }
- .right {
- > div {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- height: 40px;
- line-height: 40px;
- margin-bottom: 20px;
- .head {
- width: 120px;
- height: 40px;
- line-height: 40px;
- border: 1px solid #ccc;
- text-align: center;
- border-radius: 5px;
- cursor: pointer;
- margin-right: 10px;
- }
- > .head.active {
- background-color: #13817a;
- color: #fff;
- border: none;
- }
- .title {
- line-height: 40px;
- height: 40px;
- }
- }
- }
- }
- }
- </style>
- <style lang="scss">
- .m-core {
- .vipform {
- .el-select {
- width: 400px !important;
- .el-input__inner {
- width: 400px;
- }
- }
- }
- .activeType {
- .right {
- .el-input {
- width: 150px !important;
- }
- }
- }
- }
- </style>
|