resetSound.vue 32 KB

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