vipNewActive.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  1. <template>
  2. <div class="m-container">
  3. <!-- <h2><div class="squrt"></div>VIP活动方案新增 </h2> -->
  4. <h2>
  5. <el-page-header
  6. @back="onCancel"
  7. :content="
  8. 'VIP/乐理课活动方案' + (pageType == 'create' ? '新增' : '修改')
  9. "
  10. ></el-page-header>
  11. </h2>
  12. <div class="m-core">
  13. <el-form
  14. :label-position="labelPosition"
  15. :model="vipform"
  16. ref="vipform"
  17. label-width="120px"
  18. :rules="vipformRules"
  19. class="vipform"
  20. >
  21. <el-form-item label="活动名称" prop="name">
  22. <el-input style="width: 400px" v-model.trim="vipform.name"></el-input>
  23. </el-form-item>
  24. <el-form-item label="适用分部" prop="organ">
  25. <select-all
  26. v-model.trim="vipform.organ"
  27. style="width: 400px"
  28. multiple
  29. filterable
  30. @visible-change="$forceUpdate()"
  31. @change="onOrganChange"
  32. clearable
  33. >
  34. <el-option
  35. v-for="(item, index) in selects.branchs"
  36. :key="index"
  37. :label="item.name"
  38. :value="item.id"
  39. ></el-option>
  40. </select-all>
  41. <!-- <el-button @click="onCheckAllBranch">适用所有分部</el-button> -->
  42. </el-form-item>
  43. <el-form-item label="课程形式" prop="stauts">
  44. <select-all
  45. v-model.trim="vipform.stauts"
  46. style="width: 400px"
  47. @visible-change="$forceUpdate()"
  48. clearable
  49. multiple
  50. >
  51. <el-option
  52. v-for="item in selects.vipGroupCategory"
  53. :key="item.id"
  54. :value="item.id"
  55. :label="item.name"
  56. ></el-option>
  57. </select-all>
  58. </el-form-item>
  59. <el-form-item label="课程调整方式" prop="allowOnlineToOffline">
  60. <el-select
  61. v-model.trim="vipform.allowOnlineToOffline"
  62. placeholder="请选择课程调整方式"
  63. clearable
  64. >
  65. <el-option label="无限制" :value="1"></el-option>
  66. <el-option label="线上不可转线下" :value="0"></el-option>
  67. </el-select>
  68. </el-form-item>
  69. <el-form-item label="使用学员" prop="applyToStudentType">
  70. <el-select
  71. v-model.trim="vipform.applyToStudentType"
  72. placeholder="请选择使用学员"
  73. clearable
  74. >
  75. <el-option label="新学员" :value="1"></el-option>
  76. <el-option label="老学员" :value="0"></el-option>
  77. <el-option label="所有学员" :value="-1"></el-option>
  78. </el-select>
  79. </el-form-item>
  80. <el-form-item label="活动描述" prop="desc">
  81. <el-input
  82. type="textarea"
  83. v-model.trim="vipform.desc"
  84. style="width: 400px"
  85. :rows="5"
  86. placeholder="请输入活动说明"
  87. ></el-input>
  88. </el-form-item>
  89. <el-form-item label="活动时间" prop="activeTime">
  90. <el-date-picker
  91. v-model.trim="vipform.activeTime"
  92. type="datetimerange"
  93. range-separator="至"
  94. value-format="yyyy-MM-dd HH:mm:ss"
  95. start-placeholder="开始日期"
  96. :picker-options="{
  97. firstDayOfWeek: 1,
  98. }"
  99. end-placeholder="结束日期"
  100. ></el-date-picker>
  101. </el-form-item>
  102. <el-form-item label="课程时间" prop="courseTime">
  103. <el-date-picker
  104. v-model.trim="vipform.courseTime"
  105. type="datetimerange"
  106. range-separator="至"
  107. value-format="yyyy-MM-dd HH:mm:ss"
  108. start-placeholder="开始日期"
  109. :picker-options="{
  110. firstDayOfWeek: 1,
  111. }"
  112. end-placeholder="结束日期"
  113. ></el-date-picker>
  114. </el-form-item>
  115. </el-form>
  116. <el-alert
  117. title="活动适用范围&结算标准:"
  118. type="info"
  119. :closable="false"
  120. class="alert"
  121. >
  122. </el-alert>
  123. <div class="activeRange" style="padding-left: 120px">
  124. <!-- <div class="left">
  125. <p>活动适用范围&结算标准:</p>
  126. </div> -->
  127. <div class="right">
  128. <div class="chioseWrap">
  129. <el-checkbox label="线上课" v-model.trim="online"></el-checkbox>
  130. <el-select
  131. v-model.trim="onlineSalary"
  132. disabled
  133. clearable
  134. filterable
  135. >
  136. <el-option
  137. label="老师默认课酬"
  138. value="TEACHER_DEFAULT"
  139. ></el-option>
  140. <el-option
  141. label="实际课程单价比例折扣"
  142. value="RATIO_DISCOUNT"
  143. ></el-option>
  144. <el-option label="固定课酬" value="FIXED_SALARY"></el-option>
  145. </el-select>
  146. <el-input
  147. placeholder="请输入"
  148. v-if="onlineSalary == 'RATIO_DISCOUNT'"
  149. style="width: 200px"
  150. type="number"
  151. @mousewheel.native.prevent
  152. v-model.trim="onlineprice"
  153. >
  154. <template slot="append">%</template>
  155. </el-input>
  156. <el-input
  157. placeholder="请输入"
  158. v-if="onlineSalary == 'FIXED_SALARY'"
  159. style="width: 200px"
  160. type="number"
  161. @mousewheel.native.prevent
  162. v-model.trim="onlineprice"
  163. >
  164. <template slot="append">元</template>
  165. </el-input>
  166. <div
  167. style="width: 200px"
  168. v-if="onlineSalary == 'TEACHER_DEFAULT'"
  169. ></div>
  170. <!-- <el-checkbox label="是否参加梯度"
  171. style="margin-left:20px;"
  172. v-model.trim="onlineClassJoinGradientRewards"></el-checkbox> -->
  173. </div>
  174. <div class="chioseWrap">
  175. <el-checkbox label="线下课" v-model.trim="unonline"></el-checkbox>
  176. <el-select
  177. v-model.trim="unonlineSalary"
  178. clearable
  179. disabled
  180. filterable
  181. >
  182. <el-option
  183. label="老师默认课酬"
  184. value="TEACHER_DEFAULT"
  185. ></el-option>
  186. <el-option
  187. label="实际课程单价比例折扣"
  188. value="RATIO_DISCOUNT"
  189. ></el-option>
  190. <el-option label="固定课酬" value="FIXED_SALARY"></el-option>
  191. </el-select>
  192. <el-input
  193. placeholder="请输入"
  194. v-if="unonlineSalary == 'RATIO_DISCOUNT'"
  195. style="width: 200px"
  196. type="number"
  197. @mousewheel.native.prevent
  198. v-model.trim="unonlineprice"
  199. >
  200. <template slot="append">%</template>
  201. </el-input>
  202. <el-input
  203. placeholder="请输入"
  204. style="width: 200px"
  205. v-if="unonlineSalary == 'FIXED_SALARY'"
  206. type="number"
  207. @mousewheel.native.prevent
  208. v-model.trim="unonlineprice"
  209. >
  210. <template slot="append">元</template>
  211. </el-input>
  212. <div
  213. style="width: 200px"
  214. v-if="unonlineSalary == 'TEACHER_DEFAULT'"
  215. ></div>
  216. <!-- <el-checkbox label="是否参加梯度"
  217. style="margin-left:20px;"
  218. v-model.trim="offlineClassJoinGradientRewards"></el-checkbox> -->
  219. </div>
  220. <!-- <div class="chioseWrap">
  221. <el-checkbox v-model.trim="paymentReadonlyFlag"
  222. label="可自定义单价"></el-checkbox>
  223. <el-checkbox v-model.trim="salaryReadonlyFlag"
  224. label="可自定义课酬"></el-checkbox>
  225. </div> -->
  226. </div>
  227. </div>
  228. <el-alert
  229. title="活动类型:"
  230. type="info"
  231. style="margin-bottom: 15px"
  232. :closable="false"
  233. class="alert"
  234. >
  235. </el-alert>
  236. <div class="activeType">
  237. <!-- <div class="left">
  238. <p>活动类型</p>
  239. </div> -->
  240. <div class="right">
  241. <div>
  242. <div
  243. class="head"
  244. :class="activeType == 'BASE_ACTIVITY' ? 'active' : ''"
  245. @click="
  246. () => {
  247. this.$refs['form'].resetFields();
  248. activeType = 'BASE_ACTIVITY';
  249. courseNumForm = {
  250. minCourseNum: '',
  251. maxCourseNum: '',
  252. studentMaxUsedTimes: '',
  253. };
  254. attribute1 = '';
  255. attribute2 = '';
  256. }
  257. "
  258. >
  259. 基础活动
  260. </div>
  261. <p class="title" v-if="activeType == 'BASE_ACTIVITY'">课程原价</p>
  262. </div>
  263. <div>
  264. <div
  265. class="head"
  266. :class="activeType == 'DISCOUNT' ? 'active' : ''"
  267. @click="activeType = 'DISCOUNT'"
  268. >
  269. 折扣
  270. </div>
  271. <el-input
  272. v-if="activeType == 'DISCOUNT'"
  273. v-model.trim="attribute1"
  274. style="width: 200px !important"
  275. placeholder="请输入折扣数值"
  276. >
  277. <template slot="append">%</template>
  278. </el-input>
  279. <el-form
  280. :model="courseNumForm"
  281. :inline="true"
  282. ref="form"
  283. v-show="activeType == 'DISCOUNT'"
  284. :rules="activeType == 'DISCOUNT' ? courseNumrules : {}"
  285. >
  286. <el-form-item prop="minCourseNum">
  287. <el-input
  288. @change="handleMinChange"
  289. v-model.number="courseNumForm.minCourseNum"
  290. type="number"
  291. style="margin-left: 10px; width: 120px !important"
  292. placeholder="最小课时数"
  293. >
  294. </el-input>
  295. </el-form-item>
  296. <el-form-item prop="maxCourseNum">
  297. <el-input
  298. @change="handleMaxChange"
  299. v-model.number="courseNumForm.maxCourseNum"
  300. type="number"
  301. style="margin-left: 10px; width: 120px !important"
  302. placeholder="最大课时数"
  303. >
  304. </el-input>
  305. </el-form-item>
  306. <el-form-item>
  307. <el-input
  308. v-model.number="courseNumForm.studentMaxUsedTimes"
  309. type="number"
  310. style="margin-left: 10px; width: 120px !important"
  311. placeholder="学员购买次数"
  312. >
  313. </el-input>
  314. </el-form-item>
  315. </el-form>
  316. </div>
  317. <div>
  318. <div
  319. class="head"
  320. :class="activeType == 'GIVE_CLASS' ? 'active' : ''"
  321. @click="
  322. () => {
  323. this.$refs['form'].resetFields();
  324. activeType = 'GIVE_CLASS';
  325. courseNumForm.minCourseNum = '';
  326. courseNumForm.maxCourseNum = '';
  327. attribute1 = '';
  328. attribute2 = '';
  329. }
  330. "
  331. >
  332. 赠送课时
  333. </div>
  334. <el-input
  335. placeholder="多少节开始赠"
  336. v-if="activeType == 'GIVE_CLASS'"
  337. v-model.trim="attribute1"
  338. type="number"
  339. @mousewheel.native.prevent
  340. style="margin-right: 10px; width: 200px !important"
  341. >
  342. <template slot="append">节</template>
  343. </el-input>
  344. <span v-if="activeType == 'GIVE_CLASS'">赠</span>
  345. <el-input
  346. v-if="activeType == 'GIVE_CLASS'"
  347. placeholder="请输入赠送课时数"
  348. type="number"
  349. @mousewheel.native.prevent
  350. v-model.trim="attribute2"
  351. style="margin: 0 10px; width: 200px !important"
  352. >
  353. <template slot="append">节</template>
  354. </el-input>
  355. <el-input
  356. v-show="activeType == 'GIVE_CLASS'"
  357. v-model.number="courseNumForm.studentMaxUsedTimes"
  358. type="number"
  359. style="margin-left: 10px; width: 120px !important"
  360. placeholder="学员购买次数"
  361. >
  362. </el-input>
  363. <!-- <el-checkbox
  364. v-if="activeType=='GIVE_CLASS'"
  365. v-model.trim="giveClassPaySalaryFlag"
  366. label="赠送课时结算课酬"
  367. ></el-checkbox> -->
  368. </div>
  369. </div>
  370. </div>
  371. </div>
  372. <div
  373. class="btnWrap"
  374. style="justify-content: flex-start; padding-left: 120px"
  375. >
  376. <el-button type="primary" @click="submitFrom">确定</el-button>
  377. <el-button type="info" @click="onReSet">重置</el-button>
  378. <!-- <div class="okBtn"
  379. @click="submitFrom">确定</div> -->
  380. </div>
  381. </div>
  382. </template>
  383. <script>
  384. import { vipGroupCategory, addVipActive } from "@/api/vipSeting";
  385. import { getEmployeeOrgan } from "@/api/buildTeam";
  386. import cleanDeep from "clean-deep";
  387. const MIN_NUMBER = 1;
  388. const MAX_NUMBER = 999;
  389. export default {
  390. name: "vipNewActive",
  391. data() {
  392. return {
  393. pageType: "",
  394. labelPosition: "right",
  395. vipform: {
  396. name: "",
  397. desc: "",
  398. activeTime: [],
  399. courseTime: [],
  400. organ: [],
  401. },
  402. vipformRules: {
  403. name: [
  404. { required: true, message: "请输入活动名称", trigger: "blur" },
  405. {
  406. min: 1,
  407. max: 25,
  408. message: "长度在 1 到 25 个字符",
  409. trigger: "blur",
  410. },
  411. ],
  412. desc: [
  413. { required: false, message: "请输入文字描述", trigger: "blur" },
  414. {
  415. min: 1,
  416. max: 200,
  417. message: "长度在 1 到 200 个字符",
  418. trigger: "blur",
  419. },
  420. ],
  421. activeTime: [
  422. { required: false, message: "请选择活动时间", trigger: "blur" },
  423. ],
  424. courseTime: [
  425. { required: false, message: "请选择课程时间", trigger: "blur" },
  426. ],
  427. organ: [{ required: true, message: "请选择适用分部", trigger: "blur" }],
  428. stauts: [
  429. { required: true, message: "请选择活动形式", trigger: "blur" },
  430. ],
  431. applyToStudentType: [{ required: true, message: "请选择是否新生专享" }],
  432. allowOnlineToOffline: [
  433. { required: true, message: "请选择课程调整方式" },
  434. ],
  435. },
  436. courseStatusList: [], // 获取所有课程形式
  437. activeType: "",
  438. online: true,
  439. unonline: true,
  440. onlineSalary: "TEACHER_DEFAULT",
  441. unonlineSalary: "TEACHER_DEFAULT",
  442. onlineprice: "",
  443. unonlineprice: "",
  444. salaryReadonlyFlag: false,
  445. paymentReadonlyFlag: false,
  446. attribute1: "",
  447. attribute2: "",
  448. courseNumForm: {
  449. minCourseNum: "",
  450. maxCourseNum: "",
  451. studentMaxUsedTimes: "",
  452. },
  453. giveClassPaySalaryFlag: true,
  454. organList: [],
  455. onlineClassJoinGradientRewards: false,
  456. offlineClassJoinGradientRewards: false,
  457. courseNumrules: {
  458. minCourseNum: [
  459. { required: true, message: "请输入最小课时数", trigger: "blur" },
  460. { validator: this.validateCom, trigger: "blur" },
  461. { validator: this.validateMin, trigger: "blur" },
  462. ],
  463. maxCourseNum: [
  464. { required: true, message: "请输入最大课时数", trigger: "blur" },
  465. { validator: this.validateCom, trigger: "blur" },
  466. { validator: this.validateMax, trigger: "blur" },
  467. ],
  468. },
  469. };
  470. },
  471. activated() {
  472. this.onReSet();
  473. // if (this.$route.query.rules) {
  474. // this.rules = this.$route.query.rules;
  475. // }
  476. // if (this.$route.query.searchForm) {
  477. // this.searchForm = this.$route.query.searchForm;
  478. // }
  479. this.pageType = this.$route.query.type;
  480. this.$refs.vipform.resetFields();
  481. },
  482. async mounted() {
  483. // 首先获取课程形式
  484. // vipGroupCategory().then(res => {
  485. // if (res.code == 200) {
  486. // this.courseStatusList = res.data;
  487. // }
  488. // });
  489. // // 适用分部
  490. // getEmployeeOrgan().then(res => {
  491. // if (res.code == 200) {
  492. // this.organList = res.data;
  493. // }
  494. // });
  495. // 获取类型
  496. await this.$store.dispatch("setVipGroupCategory");
  497. // 获取分部
  498. await this.$store.dispatch("setBranchs");
  499. this.onReSet();
  500. // if (this.$route.query.rules) {
  501. // this.rules = this.$route.query.rules;
  502. // }
  503. // if (this.$route.query.searchForm) {
  504. // this.searchForm = this.$route.query.searchForm;
  505. // }
  506. this.pageType = this.$route.query.type;
  507. this.$refs.vipform.resetFields();
  508. },
  509. methods: {
  510. resetForm() {
  511. this.$refs.form.resetFields();
  512. },
  513. handleMinChange() {
  514. this.$refs.form.validateField("maxCourseNum");
  515. },
  516. handleMaxChange() {
  517. this.$refs.form.validateField("minCourseNum");
  518. },
  519. validateCom(rule, value, callback) {
  520. const one = Number(value);
  521. if (Number.isInteger(one)) {
  522. if (one < MIN_NUMBER) {
  523. return callback(new Error("输入值必须大于0"));
  524. } else if (one > MAX_NUMBER) {
  525. return callback(new Error("输入值必须小于999"));
  526. }
  527. return callback();
  528. }
  529. return callback(new Error("输入值必须为正整数"));
  530. },
  531. validateMin(rule, value, callback) {
  532. const one = Number(value);
  533. const max = Number(this.courseNumForm.maxCourseNum);
  534. if (!max || one <= max) {
  535. return callback();
  536. }
  537. return callback(new Error("输入值不得大于最大课时数"));
  538. },
  539. validateMax(rule, value, callback) {
  540. const one = Number(value);
  541. const min = Number(this.courseNumForm.minCourseNum);
  542. if (!min || one >= min) {
  543. return callback();
  544. }
  545. return callback(new Error("输入值不得小于最小课时数"));
  546. },
  547. changeStauts(val) {
  548. console.log(val);
  549. },
  550. submitFrom() {
  551. this.$refs.form.validate((isok) => {
  552. if (isok) {
  553. this.$refs["vipform"].validate((valid) => {
  554. if (valid) {
  555. // 验证通过
  556. let coursesStartTime = null,
  557. coursesEndTime = null,
  558. startTime = null,
  559. endTime = null;
  560. if (
  561. this.vipform.courseTime &&
  562. this.vipform.courseTime.length > 0
  563. ) {
  564. coursesStartTime = this.vipform.courseTime[0];
  565. coursesEndTime = this.vipform.courseTime[1];
  566. }
  567. if (
  568. this.vipform.activeTime &&
  569. this.vipform.activeTime.length > 0
  570. ) {
  571. startTime = this.vipform.activeTime[0];
  572. endTime = this.vipform.activeTime[1];
  573. }
  574. let organId = this.vipform.organ.join(",");
  575. let type = this.activeType;
  576. if (!type) {
  577. this.$message.error("请选择活动类型");
  578. return;
  579. }
  580. if (!this.online && !this.unonline) {
  581. this.$message.error("请选择活动适用范围");
  582. return;
  583. }
  584. if (type == "DISCOUNT") {
  585. if (!this.attribute1 || this.attribute1 < 0) {
  586. this.$message.error("折扣必须大于等于0");
  587. return;
  588. }
  589. } else if (type == "GIVE_CLASS") {
  590. if (!this.attribute1) {
  591. this.$message.error("请输入多少节开始赠");
  592. return;
  593. }
  594. if (!this.attribute2) {
  595. this.$message.error("请输入赠送课时数");
  596. return;
  597. }
  598. }
  599. let vipGroupCategoryIdList = this.vipform.stauts.join(",");
  600. let onlineSalarySettlement;
  601. let offlineSalarySettlement;
  602. if (this.online) {
  603. // 勾选线上
  604. if (this.onlineSalary == "RATIO_DISCOUNT") {
  605. if (this.onlineprice < 0 || this.onlineprice > 100) {
  606. this.$message.error("折扣比必须大于0且小于100");
  607. return;
  608. }
  609. } else if (this.onlineSalary == "TEACHER_DEFAULT") {
  610. this.onlineprice = 0;
  611. }
  612. onlineSalarySettlement = {
  613. salarySettlementType: this.onlineSalary,
  614. settlementValue: this.onlineprice,
  615. };
  616. } else {
  617. onlineSalarySettlement = null;
  618. }
  619. if (this.unonline) {
  620. // 勾选线下
  621. if (this.unonlineSalary == "RATIO_DISCOUNT") {
  622. if (this.unonlineprice < 0 || this.unonlineprice > 100) {
  623. this.$message.error("折扣比必须大于0且小于100");
  624. return;
  625. }
  626. } else if (this.unonlineSalary == "TEACHER_DEFAULT") {
  627. this.unonlineprice = 0;
  628. }
  629. offlineSalarySettlement = {
  630. salarySettlementType: this.unonlineSalary,
  631. settlementValue: this.unonlineprice,
  632. };
  633. } else {
  634. offlineSalarySettlement = null;
  635. }
  636. let salaryReadonlyFlag = this.salaryReadonlyFlag * 1;
  637. let paymentReadonlyFlag = this.paymentReadonlyFlag * 1;
  638. // let giveClassPaySalaryFlag = this.giveClassPaySalaryFlag * 1;
  639. let vipGroupSalarySettlement = {
  640. onlineSalarySettlement,
  641. offlineSalarySettlement,
  642. };
  643. if (type == "BASE_ACTIVITY") {
  644. this.courseNumForm.studentMaxUsedTimes = -1;
  645. this.courseNumForm.minCourseNum = -1;
  646. this.courseNumForm.maxCourseNum = -1;
  647. } else if (type == "GIVE_CLASS") {
  648. this.courseNumForm.minCourseNum = -1;
  649. this.courseNumForm.maxCourseNum = -1;
  650. }
  651. // 发请求创建活动
  652. addVipActive(
  653. cleanDeep({
  654. coursesStartTime,
  655. coursesEndTime,
  656. startTime,
  657. endTime,
  658. name: this.vipform.name,
  659. description: this.vipform.desc,
  660. applyToStudentType: this.vipform.applyToStudentType,
  661. allowOnlineToOffline: this.vipform.allowOnlineToOffline,
  662. organId,
  663. type,
  664. vipGroupCategoryIdList,
  665. vipGroupSalarySettlement,
  666. salaryReadonlyFlag,
  667. paymentReadonlyFlag,
  668. giveClassPaySalaryFlag: 1,
  669. attribute1: this.attribute1,
  670. attribute2: this.attribute2,
  671. minCourseNum: this.courseNumForm.minCourseNum,
  672. maxCourseNum: this.courseNumForm.maxCourseNum,
  673. studentMaxUsedTimes: this.courseNumForm.studentMaxUsedTimes
  674. ? this.courseNumForm.studentMaxUsedTimes
  675. : -1,
  676. offlineClassJoinGradientRewards:
  677. this.offlineClassJoinGradientRewards * 1,
  678. onlineClassJoinGradientRewards:
  679. this.onlineClassJoinGradientRewards * 1,
  680. })
  681. ).then((res) => {
  682. if (res.code == 200) {
  683. this.$message.success("恭喜你,活动创建成功");
  684. this.onReSet();
  685. this.$store.dispatch("delVisitedViews", this.$route);
  686. this.$router.push({
  687. path: "/vipActiveManager/vipActiveList",
  688. });
  689. }
  690. });
  691. } else {
  692. this.$nextTick(() => {
  693. let isError = document.getElementsByClassName("is-error");
  694. isError[0].scrollIntoView({
  695. block: "center",
  696. behavior: "smooth",
  697. });
  698. });
  699. // this.$message.error("请填写必要参数");
  700. }
  701. });
  702. }
  703. });
  704. // 线上线下课 勾选就传不勾选就不传
  705. // addVipActive().then(res => { })
  706. },
  707. onOrganChange() {
  708. this.$forceUpdate();
  709. },
  710. onCheckAllBranch() {
  711. // 选择所有分部
  712. let vipform = this.vipform;
  713. vipform.organ = [];
  714. this.selects.branchs.forEach((item) => {
  715. vipform.organ.push(item.id);
  716. });
  717. this.$forceUpdate();
  718. },
  719. onCancel() {
  720. this.$store.dispatch("delVisitedViews", this.$route);
  721. this.$router.push({
  722. path: "/vipActiveManager/vipActiveList",
  723. query: { rules: this.rules, searchForm: this.searchForm },
  724. });
  725. },
  726. onReSet() {
  727. this.vipform = {
  728. name: "",
  729. desc: "",
  730. activeTime: [],
  731. courseTime: [],
  732. };
  733. this.activeType = "";
  734. this.online = true;
  735. this.unonline = true;
  736. this.salaryReadonlyFlag = false;
  737. this.onlineSalary = "TEACHER_DEFAULT";
  738. this.unonlineSalary = "TEACHER_DEFAULT";
  739. this.onlineprice = "";
  740. this.unonlineprice = "";
  741. this.onlineClassJoinGradientRewards = false;
  742. this.offlineClassJoinGradientRewards = false;
  743. this.attribute1 = "";
  744. this.attribute2 = "";
  745. this.courseNumForm.maxCourseNum = "";
  746. this.courseNumForm.minCourseNum = "";
  747. this.$refs.vipform.resetFields();
  748. },
  749. },
  750. };
  751. </script>
  752. <style lang="scss" scoped>
  753. .m-core {
  754. font-size: 14px;
  755. width: 100%;
  756. display: flex;
  757. flex-direction: column;
  758. justify-content: center;
  759. // text-align: center;
  760. .activeRange {
  761. display: flex;
  762. flex-direction: row;
  763. justify-content: flex-start;
  764. .left {
  765. height: 72px;
  766. line-height: 72px;
  767. }
  768. .right {
  769. .chioseWrap {
  770. display: flex;
  771. flex-direction: row;
  772. justify-content: flex-start;
  773. height: 72px;
  774. line-height: 72px;
  775. align-items: center;
  776. .el-checkbox {
  777. margin-right: 20px;
  778. }
  779. .el-select {
  780. margin-right: 20px;
  781. }
  782. }
  783. }
  784. }
  785. .activeType {
  786. display: flex;
  787. flex-direction: row;
  788. justify-content: flex-start;
  789. .left {
  790. margin-right: 20px;
  791. p {
  792. height: 40px;
  793. line-height: 40px;
  794. }
  795. }
  796. .right {
  797. > div {
  798. display: flex;
  799. flex-direction: row;
  800. justify-content: flex-start;
  801. height: 40px;
  802. line-height: 40px;
  803. margin-bottom: 20px;
  804. .head {
  805. width: 120px;
  806. height: 40px;
  807. line-height: 40px;
  808. border: 1px solid #ccc;
  809. text-align: center;
  810. border-radius: 5px;
  811. cursor: pointer;
  812. margin-right: 10px;
  813. }
  814. > .head.active {
  815. background-color: #13817a;
  816. color: #fff;
  817. border: none;
  818. }
  819. .title {
  820. line-height: 40px;
  821. height: 40px;
  822. }
  823. }
  824. }
  825. }
  826. }
  827. </style>
  828. <style lang="scss">
  829. .m-core {
  830. .vipform {
  831. .el-select {
  832. width: 400px !important;
  833. .el-input__inner {
  834. width: 400px;
  835. }
  836. }
  837. }
  838. .activeType {
  839. .right {
  840. .el-input {
  841. width: 150px !important;
  842. }
  843. }
  844. }
  845. }
  846. </style>