|
@@ -10,21 +10,23 @@
|
|
:rules="formRules"
|
|
:rules="formRules"
|
|
label-width="80px">
|
|
label-width="80px">
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <h4>设置 {{ plan_author_name }} {{ plan_start_time.replace(/\s\w.*/, '') }} 第一节的点歌歌单</h4>
|
|
|
|
|
|
+ <h4>设置 {{ plan_author_name }} {{ plan_start_time + '至' + plan_end_time }} 的演唱歌单</h4>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item v-for="(song, index) in form.songs"
|
|
<el-form-item v-for="(song, index) in form.songs"
|
|
:label="(index + 1).toString()"
|
|
:label="(index + 1).toString()"
|
|
:key="index"
|
|
:key="index"
|
|
- :prop="'songs.' + index + '.value'">
|
|
|
|
|
|
+ :prop="'songs.' + index + '.song_id'"
|
|
|
|
+ :rules="{required: true, trigger: ['blur', 'change'], message:'该项为必填项'}">
|
|
<el-select class="af-el-select"
|
|
<el-select class="af-el-select"
|
|
v-model="song.song_id"
|
|
v-model="song.song_id"
|
|
filterable
|
|
filterable
|
|
- placeholder="请选择歌曲">
|
|
|
|
|
|
+ placeholder="请选择歌曲"
|
|
|
|
+ @change="handleChange(index, song.song_id)">
|
|
<el-option
|
|
<el-option
|
|
v-for="item in musicData"
|
|
v-for="item in musicData"
|
|
:key="item.id"
|
|
:key="item.id"
|
|
:label="item.song_name"
|
|
:label="item.song_name"
|
|
- :value="item.song_id">
|
|
|
|
|
|
+ :value="item.id">
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
<el-button type="warning"
|
|
<el-button type="warning"
|
|
@@ -55,12 +57,6 @@ export default {
|
|
default: function () {
|
|
default: function () {
|
|
return {}
|
|
return {}
|
|
}
|
|
}
|
|
- },
|
|
|
|
- musicData: {
|
|
|
|
- type: Array,
|
|
|
|
- default: function () {
|
|
|
|
- return []
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
@@ -70,16 +66,17 @@ export default {
|
|
plan_id: '',
|
|
plan_id: '',
|
|
songs: [
|
|
songs: [
|
|
{
|
|
{
|
|
- 'song_id': '',
|
|
|
|
- 'song_name': '',
|
|
|
|
- 'song_price': '',
|
|
|
|
- 'song_auth_name': ''
|
|
|
|
|
|
+ song_id: '',
|
|
|
|
+ song_name: '',
|
|
|
|
+ song_price: '',
|
|
|
|
+ song_auth_name: ''
|
|
}
|
|
}
|
|
]
|
|
]
|
|
},
|
|
},
|
|
plan_author_name: '', // 歌手名
|
|
plan_author_name: '', // 歌手名
|
|
- plan_start_time: '' // 演唱日期
|
|
|
|
- // todo 第几节演唱
|
|
|
|
|
|
+ plan_start_time: '', // 演唱日期
|
|
|
|
+ plan_end_time: '',
|
|
|
|
+ musicData: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -91,15 +88,53 @@ export default {
|
|
},
|
|
},
|
|
addSong () {
|
|
addSong () {
|
|
this.form.songs.push({
|
|
this.form.songs.push({
|
|
- 'song_id': '',
|
|
|
|
- 'song_name': '',
|
|
|
|
- 'song_price': '',
|
|
|
|
- 'song_auth_name': ''
|
|
|
|
|
|
+ song_id: '',
|
|
|
|
+ song_name: '',
|
|
|
|
+ song_price: '',
|
|
|
|
+ song_auth_name: ''
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ handleChange (index, value) {
|
|
|
|
+ const result = this.musicData.find(item => item.id === value)
|
|
|
|
+ console.log(result)
|
|
|
|
+ this.form.songs[index] = {
|
|
|
|
+ song_id: result.id,
|
|
|
|
+ song_name: result.song_name,
|
|
|
|
+ song_price: result.song_price,
|
|
|
|
+ song_auth_name: result.song_auth_name
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 获取歌手当天演出歌曲列表
|
|
|
|
+ async fetchSongDetail (planId) {
|
|
|
|
+ const api = '/v1/bar/show/plan/song/detail'
|
|
|
|
+ const { code, data } = await this.$fetch(api, {
|
|
|
|
+ plan_id: planId
|
|
|
|
+ }, 'get')
|
|
|
|
+ if (code === 200) {
|
|
|
|
+ if (Array.isArray(data) && data.length) {
|
|
|
|
+ this.form.songs = data.map(item => ({
|
|
|
|
+ song_id: item.song_id,
|
|
|
|
+ song_name: item.song_name,
|
|
|
|
+ song_price: item.song_price,
|
|
|
|
+ song_auth_name: item.song_auth_name
|
|
|
|
+ }))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 获取歌手曲库
|
|
|
|
+ async fetchMusicList (id) {
|
|
|
|
+ const api = '/v1/user/song/list'
|
|
|
|
+ const { code, data } = await this.$fetch(api, {
|
|
|
|
+ page: 1,
|
|
|
|
+ page_size: 10000,
|
|
|
|
+ id: id
|
|
|
|
+ }, 'get')
|
|
|
|
+ if ((data.data || data.list) && code === 200) {
|
|
|
|
+ this.musicData = data.data || data.list
|
|
|
|
+ }
|
|
|
|
+ },
|
|
handleSubmit () {
|
|
handleSubmit () {
|
|
- // TODO 修改
|
|
|
|
- const url = this.exData.id ? '' : '/v1/bar/show/plan/song/add'
|
|
|
|
|
|
+ const url = this.exData.id ? '/v1/bar/show/plan/song/add' : '/v1/bar/show/plan/song/add'
|
|
this.$refs.form.validate(async valid => {
|
|
this.$refs.form.validate(async valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
const data = await this.$fetch(url, {
|
|
const data = await this.$fetch(url, {
|
|
@@ -118,15 +153,11 @@ export default {
|
|
if (this.exData.id) {
|
|
if (this.exData.id) {
|
|
this.plan_author_name = this.exData.plan_author_name
|
|
this.plan_author_name = this.exData.plan_author_name
|
|
this.plan_start_time = this.exData.plan_start_time
|
|
this.plan_start_time = this.exData.plan_start_time
|
|
|
|
+ this.plan_end_time = this.exData.plan_end_time
|
|
|
|
+ this.$set(this.form, 'plan_id', this.exData.id)
|
|
|
|
|
|
- for (const key in this.exData) {
|
|
|
|
- if (this.form.hasOwnProperty(key)) {
|
|
|
|
- let value = this.exData[key]
|
|
|
|
- if ((Array.isArray(value) && value.length > 0) || value) {
|
|
|
|
- this.$set(this.form, key, value)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ this.fetchMusicList(this.exData.user_id)
|
|
|
|
+ this.fetchSongDetail(this.exData.id)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|