resetSound.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956
  1. <template>
  2. <div>
  3. <el-table :data='activeSoundList'
  4. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  5. <el-table-column align='center'
  6. width="180px;"
  7. prop="sound"
  8. label="声部名称">
  9. </el-table-column>
  10. <el-table-column align='center'
  11. width="180px;"
  12. prop="yuji"
  13. label="课程费用">
  14. <!-- <template slot-scope="scope">
  15. <div>
  16. <el-input style="width:100px"
  17. v-model.trim="scope.row.yuji"></el-input>
  18. </div>
  19. </template> -->
  20. </el-table-column>
  21. <el-table-column label="可选乐器规格"
  22. align="center"
  23. prop="zhonglei"
  24. width="300">
  25. <template slot-scope="scope">
  26. <!-- 'typeVisible':false,'provideVisible':false,'markVisible':false -->
  27. <div>
  28. <span>{{scope.row.zhonglei | zhongleiFilter(scope.row.goodsList)}}</span>
  29. <el-popover placement="bottom"
  30. @show='chioseType(scope.row)'
  31. v-model.trim="scope.row.typeVisible"
  32. v-if='scope.row.type == 1'>
  33. <el-button type="text"
  34. v-if="lookType!=='look'"
  35. slot='reference'>
  36. 修改
  37. </el-button>
  38. <!-- zhonglei -->
  39. <el-select v-model.trim="scope.row.zhonglei"
  40. multiple
  41. clearable
  42. filterable
  43. @change="changezhonglei(scope.row)"
  44. collapse-tags>
  45. <el-option v-for="(item,index) in scope.row.goodsList"
  46. :key='index'
  47. :label="item.name"
  48. :value="item.id"></el-option>
  49. </el-select>
  50. <div style="text-align: right; margin-top: 20px">
  51. <!-- <el-button size="mini"
  52. type="text"
  53. @click="closechioseType(scope.row)">取消</el-button> -->
  54. <el-button type="primary"
  55. size="mini"
  56. @click="scope.row.typeVisible = false">确定</el-button>
  57. </div>
  58. </el-popover>
  59. </div>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="乐器提供方式"
  63. width="300"
  64. align="center"
  65. prop="fangshi">
  66. <template slot-scope="scope">
  67. <div>
  68. <!-- <div class="chiose"
  69. >选择</div> -->
  70. <div style='white-space:pre'
  71. v-if="scope.row.fangshi.length >0">{{scope.row.fangshi | fangshiFilter(scope.row)}}</div>
  72. <i class='el-icon-edit'
  73. v-if="lookType!=='look'"
  74. @click="setGiveMode(scope.row)">
  75. </i>
  76. <!-- <el-popover placement="bottom"
  77. v-model.trim="scope.row.provideVisible"
  78. v-if='scope.row.type == 1'>
  79. <i class='el-icon-edit'
  80. slot='reference'>
  81. </i>
  82. <el-select v-model.trim="scope.row.fangshi"
  83. clearable>
  84. <el-option label="团购"
  85. value="GROUP"></el-option>
  86. <el-option label="借用"
  87. value="LEASE"></el-option>
  88. <el-option label="免费"
  89. value="FREE"></el-option>
  90. </el-select>
  91. <el-input placeholder="请输入费用"
  92. v-if='scope.row.fangshi == "LEASE"'
  93. v-model.trim="scope.row.fangshiprice"
  94. style='width:180px; margin-top:20px'></el-input>
  95. <div style="text-align: right; margin-top: 20px">
  96. <el-button type="primary"
  97. size="mini"
  98. @click="scope.row.provideVisible = false">确定</el-button>
  99. </div>
  100. </el-popover> -->
  101. </div>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="教辅组合"
  105. align="center"
  106. prop="jiaopu">
  107. <template slot-scope="scope">
  108. <!-- item.name && -->
  109. <div>
  110. <el-dialog title="添加教辅" :visible.sync="scope.row.markVisible"
  111. style="text-align:left;"
  112. width="60%">
  113. <el-button type='text'
  114. @click="addMark(scope.row)">添加教辅</el-button>
  115. <div class="markWrap">
  116. <div class="markItem"
  117. v-for="(item, index) in scope.row.markList"
  118. :key='index'>
  119. <el-form :model="item"
  120. :inline="true">
  121. <el-form-item label="教辅名称">
  122. <el-input type="text"
  123. v-model.trim="item.name"></el-input>
  124. </el-form-item>
  125. <el-form-item label="教辅商品">
  126. <el-select v-model.trim="item.goods"
  127. filterable
  128. multiple
  129. collapse-tags>
  130. <el-option v-for='(item,index) in scope.row.markChioseList'
  131. :key='index'
  132. :label="item.name"
  133. :value="item.id"></el-option>
  134. </el-select>
  135. </el-form-item>
  136. <el-form-item label="教辅打包价">
  137. <el-input type='number'
  138. @mousewheel.native.prevent
  139. v-model.trim="item.price"></el-input>
  140. </el-form-item>
  141. <el-form-item>
  142. <el-button type="danger"
  143. icon="el-icon-delete"
  144. circle
  145. @click='removeMartItem(scope.row,index)'>
  146. </el-button>
  147. </el-form-item>
  148. </el-form>
  149. </div>
  150. </div>
  151. <span slot="footer"
  152. class="dialog-footer">
  153. <!-- <el-button @click="scope.row.markVisible = false">取 消</el-button> -->
  154. <el-button type="primary"
  155. @click="scope.row.markVisible = false">确 定</el-button>
  156. </span>
  157. </el-dialog>
  158. <span>
  159. <span v-for='(item,index) in scope.row.markList'
  160. v-if=" scope.row.markChioseList.length>0"
  161. :key='index'>{{item.name?item.name+':':''}}{{item.goods|goodsFilter(scope.row.markChioseList)}}{{' 价格 '+item.price }} </span>
  162. </span>
  163. <i class='el-icon-edit'
  164. slot='reference'
  165. v-if="lookType!=='look'"
  166. @click="chioseMark(scope.row)">
  167. </i>
  168. </div>
  169. </template>
  170. </el-table-column>
  171. </el-table>
  172. <!-- <div class="remove"
  173. @click="removeListItem">删除</div> -->
  174. <div class="floor"
  175. v-if="lookType!=='look'">
  176. <div class='add'
  177. @click="addListItem">添加</div>
  178. </div>
  179. <div class="btnWrap"
  180. v-if="lookType!=='look'"
  181. style="margin-top:30px">
  182. <div class="closeBtn"
  183. @click="getSound">取消</div>
  184. <div class="okBtn"
  185. v-permission="{child: 'musicGroup/updateSubjectInfo', parent: '/resetTeaming/resetSound'}"
  186. @click="saveInfo">保存</div>
  187. </div>
  188. <el-dialog title="声部选择"
  189. :visible.sync="dialogTableVisible"
  190. :modal-append-to-body="false">
  191. <div class="soundWrap">
  192. <div class="itemList">
  193. <div class="categroy"
  194. v-for="(item,index) in soundList"
  195. :key="index">
  196. <p>{{item.name }}</p>
  197. <el-checkbox-group v-model.trim="soundLists[index]"
  198. @change='changeList'>
  199. <!-- sound: this.activeSoundList[item].name, // id
  200. jihua: '10', //计划招生人数
  201. yuji: '10', // 预计收费
  202. zhonglei: [], // 可选乐器种类
  203. fangshi: 2, // 乐器提供方式
  204. jiaopu: 'jiaopu1', // 教辅组合
  205. type: 1, // 操作
  206. id: this.activeSoundList[item].id, //声部id
  207. visible: false, // 当前乐器提供方式的pop提示框显示隐藏 -->
  208. <el-checkbox :label="sound.id"
  209. @change="checkinlist({'id':sound.id,'sound':sound.name,'jihua':0,'yuji':0,'zhonglei':[],'fangshi':[],'fangshiprice':1500,'jiaopu':'','type':1,'typeVisible':false,'provideVisible':false,'markVisible':false,'goodsList':[],'markList':[],'markChioseList':[]})"
  210. v-for="(sound,indexs) in item.subjects"
  211. :key="indexs">{{sound.name }}</el-checkbox>
  212. </el-checkbox-group>
  213. </div>
  214. </div>
  215. </div>
  216. <p class='soundSubP'>当前选择声部数:{{chioseSoundNum}}</p>
  217. <div class="btnWrapss">
  218. <div class="dialogBtn"
  219. @click="generates">确定</div>
  220. </div>
  221. </el-dialog>
  222. <el-dialog tilte='请选择乐器的提供方式及减免金额'
  223. width="800px"
  224. :visible.sync="reductionVisible">
  225. <div v-if="editSound&&editSound.fangshi.length >0">
  226. <div class="reductionWrap"
  227. v-for="(item,index) in editSound.fangshi"
  228. :key='index'>
  229. <div class="lineWrap">
  230. <div class="item">{{ item.shopName}}</div>
  231. <div class="item">提供方式</div>
  232. <div class="item">提供方式对应金额</div>
  233. <div class="item">乐器费用减免</div>
  234. <div class="item">课程费用减免</div>
  235. </div>
  236. <div class="lineWrap">
  237. <div class="item"></div>
  238. <div class="item">
  239. <el-checkbox v-model.trim="item.mode.isGROUP"></el-checkbox>
  240. 团购
  241. </div>
  242. <div class="item">
  243. <el-input style="width:80%"
  244. @mousewheel.native.prevent
  245. v-model.trim="item.mode.price"
  246. type="number"
  247. disabled></el-input>
  248. </div>
  249. <div class="item">
  250. <el-input style="width:80%"
  251. @mousewheel.native.prevent
  252. @input='groupInput(item)'
  253. type="number"
  254. v-model.trim="item.mode.GROUP"></el-input>
  255. </div>
  256. <div class="item">
  257. <el-input style="width:80%"
  258. type="number"
  259. @mousewheel.native.prevent
  260. v-model.trim="item.mode.courseGroup"
  261. @input="groupCourseInput(item)"></el-input>
  262. </div>
  263. </div>
  264. <div class="lineWrap">
  265. <div class="item"></div>
  266. <div class="item">
  267. <el-checkbox v-model.trim="item.mode.isLEASE"></el-checkbox>
  268. 租赁
  269. </div>
  270. <div class="item">
  271. <el-input style="width:80%"
  272. @mousewheel.native.prevent
  273. type="number"
  274. @input='(val)=>{
  275. setDeposiInput(val,item)
  276. }'
  277. v-model.trim="item.mode.depositFee"></el-input>
  278. </div>
  279. <div class="item">
  280. <el-input style="width:80%"
  281. type="number"
  282. disabled
  283. @mousewheel.native.prevent
  284. @input='deposiInput(item)'
  285. v-model.trim="item.mode.LEASE"></el-input>
  286. </div>
  287. <div class="item">
  288. <el-input style="width:80%"
  289. disabled
  290. type="number"></el-input>
  291. </div>
  292. </div>
  293. <div class="lineWrap">
  294. <div class="item"></div>
  295. <div class="item">
  296. <el-checkbox v-model.trim="item.mode.isFREE"></el-checkbox>
  297. 免费
  298. </div>
  299. <div class="item">
  300. <el-input style="width:80%"
  301. @mousewheel.native.prevent
  302. disabled></el-input>
  303. </div>
  304. <div class="item">
  305. <!-- v-model.trim="item.mode.FREE" -->
  306. <el-input style="width:80%"
  307. type="number"
  308. @mousewheel.native.prevent
  309. disabled></el-input>
  310. </div>
  311. <div class="item">
  312. <el-input style="width:80%"
  313. disabled
  314. type="number"></el-input>
  315. </div>
  316. </div>
  317. </div>
  318. </div>
  319. <div slot="footer"
  320. class="dialog-footer">
  321. <el-button type="primary"
  322. @click="resetSoundItem">确 定</el-button>
  323. </div>
  324. </el-dialog>
  325. </div>
  326. </template>
  327. <script>
  328. import { findMusicGroupSubjectInfo, resetSubjectPlan, getSoundTree, getGoods, updateSubjectInfo } from '@/api/buildTeam'
  329. export default {
  330. name: 'resetSound',
  331. data () {
  332. return {
  333. reductionVisible: false,
  334. dialogTableVisible: false,
  335. tableList: [],
  336. teamid: '',
  337. activeSoundList: [],
  338. soundList: [],
  339. checkList: [],
  340. multipleSelection: [], // 列表选择的集合
  341. soundList: [],
  342. soundLists: [], // 存储选中项的声部id 记录变量
  343. editSound: null,
  344. lookType: ''
  345. }
  346. },
  347. mounted () {
  348. this.init()
  349. },
  350. activated () {
  351. this.init()
  352. },
  353. methods: {
  354. init () {
  355. // 获取声部信息
  356. this.teamid = this.$route.query.id
  357. this.lookType = this.$route.query.type
  358. sessionStorage.setItem('resetCode', '2');
  359. // 获取所有声部
  360. getSoundTree({ tenantId: 1 }).then(res => {
  361. if (res.code == 200) {
  362. this.soundList = res.data.rows;
  363. // // 生成动态的checkList
  364. for (let key in this.soundList) {
  365. this.$set(this.soundLists, key, [])
  366. }
  367. this.getSound();
  368. }
  369. })
  370. },
  371. changeList (e) {
  372. },
  373. getSound () {
  374. findMusicGroupSubjectInfo({ musicGroupId: this.teamid }).then(res => {
  375. if (res.code == 200) {
  376. this.activeSoundList = res.data.musicGroupSubjectPlans.map(item => {
  377. let fangshi = []
  378. res.data.musicGroupSubjectGoodsGroups.forEach(sub => {
  379. if (sub.subjectId == item.subjectId && sub.type == 'INSTRUMENT') {
  380. let FREE, courseFree, LEASE, courseLease, GROUP, courseGroup;
  381. let isFREE = false
  382. let isLEASE = false
  383. let isGROUP = false
  384. let depositFee = sub.depositFee
  385. let price = sub.price
  386. if (sub.kitGroupPurchaseTypeJson) {
  387. let expectJson = JSON.parse(sub.kitGroupPurchaseTypeJson);
  388. if (expectJson && expectJson.hasOwnProperty("FREE")) {
  389. FREE = expectJson.FREE
  390. isFREE = true
  391. }
  392. if (expectJson && expectJson.hasOwnProperty("LEASE")) {
  393. LEASE = expectJson.LEASE
  394. isLEASE = true;
  395. }
  396. if (expectJson && expectJson.hasOwnProperty("GROUP")) {
  397. GROUP = expectJson.GROUP
  398. isGROUP = true
  399. }
  400. }
  401. if (sub.coursePurchaseTypeJson) {
  402. let courseJson = JSON.parse(sub.coursePurchaseTypeJson)
  403. if (courseJson && courseJson.hasOwnProperty("FREE")) {
  404. courseFree = courseJson.FREE;
  405. }
  406. if (courseJson && courseJson.hasOwnProperty("LEASE")) {
  407. courseLease = courseJson.LEASE;
  408. }
  409. if (courseJson && courseJson.hasOwnProperty("GROUP")) {
  410. courseGroup = courseJson.GROUP;
  411. }
  412. }
  413. fangshi.push({
  414. shopName: sub.name,
  415. id: sub.goodsIdList,
  416. mode: {
  417. 'FREE': FREE || 0,
  418. 'GROUP': GROUP || 0,
  419. 'LEASE': LEASE || 0,
  420. courseFree: courseFree || 0,
  421. courseLease: courseLease || null,
  422. courseGroup: courseGroup || 0,
  423. 'depositFee': depositFee || 1500, // 保证金
  424. 'price': price,
  425. 'isFREE': isFREE,
  426. 'isGROUP': isGROUP,
  427. 'isLEASE': isLEASE,
  428. }
  429. })
  430. }
  431. })
  432. let obj = { 'id': item.subjectId, 'sound': item.subName, 'jihua': item.expectedStudentNum, 'yuji': item.fee, 'zhonglei': [], 'fangshi': fangshi, 'fangshiprice': item.depositFee, 'jiaopu': '', 'type': 1, 'typeVisible': false, 'provideVisible': false, 'markVisible': false, 'goodsList': [], 'markList': [], 'markChioseList': [] }
  433. this.checkinlist(obj)
  434. return obj;
  435. })
  436. // 这里循环
  437. for (let z = 0; z < this.activeSoundList.length; z++) {
  438. for (let x = 0; x < this.soundList.length; x++) {
  439. let tempSound = this.soundList[x].subjects
  440. for (let y = 0; y < tempSound.length; y++) {
  441. if (tempSound[y].id == this.activeSoundList[z].id) {
  442. tempSound.splice(y, 1)
  443. y--
  444. }
  445. }
  446. }
  447. }
  448. // this.soundList.forEach((item, i) => {
  449. // item.subjects.forEach((some, j) => {
  450. // this.activeSoundList.forEach((sub, x) => {
  451. // console.log(some.name + '-' + sub.sound)
  452. // console.log(some.id + '-' + sub.id)
  453. // if (sub.id == some.id) {
  454. // console.log(1)
  455. // item.subjects.splice(x, 1)
  456. // }
  457. // })
  458. // })
  459. // })
  460. // 循环列表里的声部 拿取商品
  461. for (let i in this.activeSoundList) {
  462. for (let j in res.data.musicGroupSubjectGoodsGroups) {
  463. if (this.activeSoundList[i].id == res.data.musicGroupSubjectGoodsGroups[j].subjectId) {
  464. //
  465. if (res.data.musicGroupSubjectGoodsGroups[j].type == 'INSTRUMENT') {
  466. this.activeSoundList[i].zhonglei = this.activeSoundList[i].zhonglei.concat(res.data.musicGroupSubjectGoodsGroups[j].goodsIdList)
  467. this.activeSoundList[i].zhonglei = this.activeSoundList[i].zhonglei.map(item => {
  468. return parseInt(item);
  469. })
  470. this.activeSoundList[i].goodsList = this.activeSoundList[i].goodsList.concat(res.data.musicGroupSubjectGoodsGroups[j].goodsList);
  471. // goodsList
  472. }
  473. // 拿辅件
  474. if (res.data.musicGroupSubjectGoodsGroups[j].type == 'ACCESSORIES') {
  475. if (res.data.musicGroupSubjectGoodsGroups[j].goodsList.length >= 0) {
  476. this.activeSoundList[i].markList ? this.activeSoundList[i].markList : this.activeSoundList[i].markList = []
  477. let obj = {};
  478. obj.goods = res.data.musicGroupSubjectGoodsGroups[j].goodsIdList.split(',');
  479. obj.goods = obj.goods.map(item => {
  480. return parseInt(item);
  481. })
  482. obj.name = res.data.musicGroupSubjectGoodsGroups[j].name
  483. obj.price = res.data.musicGroupSubjectGoodsGroups[j].price;
  484. this.activeSoundList[i].markList.push(obj);
  485. // this.activeSoundList[i].markList.goodsList.goods = JSON.parse(res.data.musicGroupSubjectGoodsGroups[j].goodsIdList)
  486. this.activeSoundList[i].markChioseList = this.activeSoundList[i].markChioseList.concat(res.data.musicGroupSubjectGoodsGroups[j].goodsList);
  487. }
  488. }
  489. }
  490. }
  491. }
  492. }
  493. })
  494. },
  495. // 添加教辅
  496. addMark (row) {
  497. row.markList.push({ 'name': '', 'goods': [], 'price': '' })
  498. },
  499. removeMartItem (row, index) {
  500. row.markList.splice(index, 1);
  501. },
  502. saveInfo () {
  503. // 只提交第二页的数据
  504. let obj = {};
  505. let activeSoundList = this.activeSoundList
  506. // 添加商品以及教辅
  507. obj.musicGroupId = this.teamid
  508. obj.musicGroupStatus = 'PROGRESS';
  509. obj.musicGroupSubjectGoodsGroups = []
  510. obj.musicGroupSubjectPlans = []
  511. activeSoundList.forEach(active => {
  512. // 乐器
  513. active.zhonglei.forEach(zl => {
  514. let goodsItem = []
  515. active.goodsList.forEach(goods => {
  516. if (goods.id == zl) {
  517. goodsItem = goods
  518. }
  519. })
  520. let kitGroupPurchaseTypeJson = null
  521. let depositFee;
  522. let price
  523. let coursePurchaseTypeJson = null;
  524. active.fangshi.forEach(fs => {
  525. if (fs.id == zl) {
  526. depositFee = fs.mode.depositFee
  527. price = fs.mode.price
  528. let types = {}
  529. if (fs.mode.isFREE) {
  530. types.FREE = fs.mode.FREE
  531. }
  532. if (fs.mode.isGROUP) {
  533. types.GROUP = fs.mode.GROUP
  534. }
  535. if (fs.mode.isLEASE) {
  536. types.LEASE = fs.mode.LEASE
  537. }
  538. kitGroupPurchaseTypeJson = JSON.stringify(types)
  539. if (kitGroupPurchaseTypeJson.length <= 0) {
  540. kitGroupPurchaseTypeJson = null
  541. }
  542. let courseTypes = {}
  543. if (fs.mode.courseFree) {
  544. courseTypes.FREE = fs.mode.courseFree
  545. }
  546. if (fs.mode.courseGroup) {
  547. courseTypes.GROUP = fs.mode.courseGroup ? fs.mode.courseGroup : 0
  548. }
  549. if (fs.mode.courseLease) {
  550. courseTypes.LEASE = fs.mode.courseLease
  551. }
  552. coursePurchaseTypeJson = JSON.stringify(courseTypes)
  553. if (coursePurchaseTypeJson.length <= 0) {
  554. coursePurchaseTypeJson = null;
  555. }
  556. }
  557. })
  558. let some = {
  559. subjectId: active.id,
  560. type: 'INSTRUMENT',
  561. goodsIdList: zl,
  562. name: goodsItem.name,
  563. kitGroupPurchaseTypeJson,
  564. coursePurchaseTypeJson,
  565. depositFee,
  566. price
  567. }
  568. obj.musicGroupSubjectGoodsGroups.push(some);
  569. })
  570. // 遍历声部里的教辅
  571. active.markList.forEach(mark => {
  572. if (mark.goods.length >= 1) {
  573. let some = {
  574. subjectId: active.id,
  575. type: 'ACCESSORIES',
  576. goodsIdList: mark.goods.join(','),
  577. name: mark.name,
  578. price: mark.price
  579. }
  580. obj.musicGroupSubjectGoodsGroups.push(some);
  581. }
  582. })
  583. // 添加声部
  584. let item = {
  585. expectedStudentNum: active.jihua,
  586. fee: active.yuji,
  587. // kitGroupPurchaseType: active.fangshi,
  588. subName: active.sound,
  589. subjectId: active.id,
  590. depositFee: active.fangshiprice // depositFee 只有租赁才有
  591. }
  592. obj.musicGroupSubjectPlans.push(item);
  593. })
  594. // 发请求修改声部信息
  595. this.$confirm(`确定提交?`, '提示', {
  596. confirmButtonText: '确定',
  597. cancelButtonText: '取消',
  598. type: 'warning'
  599. }).then(() => {
  600. updateSubjectInfo(obj).then(res => {
  601. if (res.code == 200) {
  602. this.$message.success('提交成功')
  603. // this.$router.push({ path: '/teamList' })
  604. this.getSound();
  605. }
  606. })
  607. }).catch(() => { })
  608. },
  609. // 根据声部id查询可选教辅
  610. chioseMark (row) {
  611. row.markVisible = true
  612. let id = row.id;
  613. getGoods({ 'subjectId': id, 'type': 'ACCESSORIES' }).then(res => {
  614. if (res.code == 200) {
  615. row.markChioseList = res.data;
  616. }
  617. })
  618. }, // 根据声部id获取可选乐器种类
  619. chioseType (row) {
  620. // 根据id查询可选类型种类
  621. let id = row.id;
  622. // 'subjectId': id, ' type'='INSTRUMENT'
  623. getGoods({ 'subjectId': id, 'type': 'INSTRUMENT' }).then(res => {
  624. if (res.code == 200) {
  625. row.goodsList = res.data;
  626. }
  627. })
  628. },
  629. // 勾选选中框处理数据,存储勾选过的checkbox值
  630. checkinlist (obj) {
  631. let flag = false;
  632. this.activeSoundList.map(item => {
  633. if (item.id == obj.id) {
  634. flag = true
  635. }
  636. })
  637. if (!flag) {
  638. this.activeSoundList.push(obj)
  639. } else {
  640. for (let i = 0; i < this.activeSoundList.length; i++) {
  641. if (this.activeSoundList[i].id == obj.id) {
  642. this.activeSoundList.splice(i, 1);
  643. }
  644. }
  645. }
  646. },
  647. // 添加声部
  648. // 点击添加按钮
  649. addListItem () {
  650. this.dialogTableVisible = true;
  651. },
  652. // 点击确认按钮生成表单
  653. generates () {
  654. this.dialogTableVisible = false;
  655. },
  656. // 设置乐器提供方式
  657. setGiveMode (row) {
  658. // goodsList
  659. if (row.zhonglei.length <= 0) {
  660. this.$message.error('请先选择乐器规格')
  661. return
  662. }
  663. // row.fangshi = []
  664. // row.zhonglei
  665. // row.goodsList
  666. const tyuji = row.yuji
  667. if (row.fangshi[0] && row.fangshi[0].mode) {
  668. row.fangshi.forEach(item => {
  669. item.mode.yuji = tyuji
  670. })
  671. } else {
  672. for (let i in row.goodsList) {
  673. for (let j in row.zhonglei) {
  674. if (row.goodsList[i].id == row.zhonglei[j]) {
  675. console.log(row.goodsList[i].groupPurchasePrice)
  676. row.fangshi.push({
  677. shopName: row.goodsList[i].name,
  678. id: row.goodsList[i].id,
  679. mode: {
  680. 'FREE': 0,
  681. 'GROUP': 0,
  682. 'LEASE': 0,
  683. courseFree: 0,
  684. courseLease: null,
  685. courseGroup: 0,
  686. 'depositFee': 1500, // 保证金
  687. 'price': row.goodsList[i].groupPurchasePrice,// 团购价
  688. 'isFREE': false,
  689. 'isGROUP': false,
  690. 'isLEASE': false,
  691. }
  692. })
  693. }
  694. }
  695. }
  696. }
  697. this.editSound = row;
  698. this.reductionVisible = true
  699. },
  700. resetSoundItem () {
  701. for (let i in this.activeSoundList) {
  702. if (this.activeSoundList[i].id == this.editSound.id) {
  703. this.activeSoundList[i].id = this.editSound.id
  704. this.reductionVisible = false
  705. }
  706. }
  707. },
  708. groupInput (item) {
  709. if (item.mode.price - item.mode.GROUP < 0) {
  710. item.mode.GROUP = item.mode.price
  711. }
  712. },
  713. groupCourseInput (item) {
  714. console.log(item)
  715. let mode = item.mode
  716. if (mode.yuji - mode.courseGroup < 0) {
  717. mode.courseGroup = mode.yuji
  718. }
  719. },
  720. deposiInput (item) {
  721. if (item.mode.depositFee - item.mode.LEASE < 0) {
  722. item.mode.LEASE = item.mode.depositFee
  723. }
  724. },
  725. setDeposiInput (val, item) {
  726. item.mode.LEASE = 0;
  727. },
  728. changezhonglei (row) {
  729. row.fangshi = []
  730. },
  731. }, filters: {
  732. zhongleiFilter (val, list) {
  733. if (list && list.length <= 0) {
  734. return;
  735. }
  736. let arr = []
  737. for (let i = 0; i < list.length; i++) {
  738. for (let j = 0; j < val.length; j++) {
  739. if (val[j] == list[i].id) {
  740. arr.push(list[i].name)
  741. }
  742. }
  743. }
  744. if (arr.length > 0) {
  745. return arr.join(',')
  746. } else {
  747. return ''
  748. }
  749. },
  750. fangshiFilter (val, price) {
  751. let str = ''
  752. for (let i in val) {
  753. // str += `${val[i].shopName}:`
  754. // if (val[i].mode.isFREE) {
  755. // str += `免费:减免金额${val[i].mode['FREE']}\n`
  756. // }
  757. // if (val[i].mode.isGROUP) {
  758. // str += `团购:减免金额${val[i].mode['GROUP']}\n`
  759. // }
  760. // if (val[i].mode.isLEASE) {
  761. // str += `租赁:${val[i].mode.depositFee},减免金额${val[i].mode['LEASE']}\n`
  762. // }
  763. let vals = val[i]
  764. str += `${vals.shopName}:`;
  765. if (vals.mode.isFREE) {
  766. str += `免费:减免金额${vals.mode["FREE"]},课程减免${vals.mode['courseFree'] ? vals.mode['courseFree'] : 0}\n`;
  767. }
  768. if (vals.mode.isGROUP) {
  769. str += `团购:团购价${vals.mode["price"]},减免金额${vals.mode["GROUP"] ? vals.mode["GROUP"] : 0},课程减免${vals.mode['courseGroup'] ? vals.mode['courseGroup'] : 0}\n`;
  770. }
  771. if (vals.mode.isLEASE) {
  772. str += `租赁:${vals.mode.depositFee},减免金额${vals.mode["LEASE"] ? vals.mode["LEASE"] : 0},课程减免${vals.mode['courseLease'] ? vals.mode['courseLease'] : 0}\n`;
  773. }
  774. }
  775. // if (val == 'FREE') {
  776. // str = '免费'
  777. // return str;
  778. // } else if (val == 'GROUP') {
  779. // str = '团购'
  780. // return str
  781. // } else if (val == 'LEASE') {
  782. // str = '借用'
  783. // }
  784. // str = str.substring(0, str.length - 1)
  785. return str
  786. },
  787. goodsFilter (val, list) {
  788. if (list && list.length <= 0) {
  789. return '';
  790. }
  791. let arr = [];
  792. for (let i = 0; i < val.length; i++) {
  793. for (let j = 0; j < list.length; j++) {
  794. if (val[i] == list[j].id) {
  795. arr.push(list[j].name);
  796. }
  797. }
  798. }
  799. if (arr.length > 0) {
  800. return arr.join(',')
  801. } else {
  802. return ''
  803. }
  804. }
  805. // markFilter(val){
  806. // for
  807. // let name = val.name;
  808. // let goods = val.goods.join(',');
  809. // let price = val.price
  810. // }
  811. }, computed: {
  812. // 返回当前选中声部数量
  813. chioseSoundNum () {
  814. let num = 0;
  815. for (let key in this.soundList) {
  816. num += this.soundLists[key].length;
  817. }
  818. return num;
  819. }
  820. }
  821. }
  822. </script>
  823. <style lang="scss">
  824. .floor {
  825. display: flex;
  826. flex-direction: row;
  827. justify-content: flex-start;
  828. width: 100%;
  829. height: 48px;
  830. line-height: 48px;
  831. background: rgba(237, 238, 240, 1);
  832. font-size: 14px;
  833. color: #444;
  834. align-items: center;
  835. position: relative;
  836. z-index: 1;
  837. .remove {
  838. width: 98px;
  839. height: 32px;
  840. background: rgba(248, 80, 67, 1);
  841. border-radius: 3px;
  842. color: #fff;
  843. line-height: 32px;
  844. text-align: center;
  845. margin-left: 164px;
  846. cursor: pointer;
  847. }
  848. .add {
  849. width: 98px;
  850. height: 32px;
  851. background: rgba(20, 146, 138, 1);
  852. border-radius: 3px;
  853. color: #fff;
  854. line-height: 32px;
  855. text-align: center;
  856. margin-left: 20px;
  857. cursor: pointer;
  858. }
  859. }
  860. .soundWrap {
  861. width: 100%;
  862. overflow: auto;
  863. .itemList {
  864. display: flex;
  865. flex-direction: row;
  866. justify-content: flex-start;
  867. flex-wrap: nowrap;
  868. flex-grow: 1;
  869. height: 300px;
  870. max-height: 300px;
  871. overflow: auto;
  872. .categroy {
  873. width: 150px;
  874. min-width: 150px;
  875. .el-checkbox {
  876. height: 30px;
  877. line-height: 30px;
  878. display: block;
  879. padding-left: 20px;
  880. }
  881. p {
  882. height: 40px;
  883. line-height: 40px;
  884. background-color: #edeef0;
  885. margin-bottom: 15px;
  886. text-align: center;
  887. }
  888. }
  889. }
  890. }
  891. .soundSubP {
  892. height: 40px;
  893. line-height: 40px;
  894. background-color: #edeef0;
  895. padding-left: 25px;
  896. }
  897. .btnWrapss {
  898. display: flex;
  899. flex-direction: column;
  900. align-items: center;
  901. margin-top: 150px;
  902. .dialogBtn {
  903. width: 188px;
  904. height: 40px;
  905. background: rgba(249, 114, 21, 1);
  906. border-radius: 4px;
  907. line-height: 40px;
  908. color: #fff;
  909. text-align: center;
  910. cursor: pointer;
  911. }
  912. }
  913. .reductionWrap {
  914. width: 100%;
  915. .lineWrap {
  916. display: flex;
  917. flex-direction: row;
  918. justify-content: space-around;
  919. height: 40px;
  920. line-height: 40px;
  921. margin-bottom: 10px;
  922. .item {
  923. width: 25%;
  924. text-align: left;
  925. }
  926. }
  927. }
  928. </style>