|
@@ -10,31 +10,32 @@
|
|
:rules="formRules"
|
|
:rules="formRules"
|
|
label-width="80px">
|
|
label-width="80px">
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <h4>设置 王羲之 2021-05-19 第一节的点歌歌单</h4>
|
|
|
|
|
|
+ <h4>设置 {{ plan_author_name }} {{ plan_start_time.replace(/\s\w.*/, '') }} 第一节的点歌歌单</h4>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item v-for="(domain, index) in form.domains"
|
|
|
|
- :label="(index + 1)"
|
|
|
|
- :key="domain.key"
|
|
|
|
- :prop="'domains.' + index + '.value'">
|
|
|
|
|
|
+ <el-form-item v-for="(song, index) in form.songs"
|
|
|
|
+ :label="(index + 1).toString()"
|
|
|
|
+ :key="index"
|
|
|
|
+ :prop="'songs.' + index + '.value'">
|
|
<el-select class="af-el-select"
|
|
<el-select class="af-el-select"
|
|
- v-model="domain.singer"
|
|
|
|
|
|
+ v-model="song.song_id"
|
|
filterable
|
|
filterable
|
|
placeholder="请选择歌曲">
|
|
placeholder="请选择歌曲">
|
|
<el-option
|
|
<el-option
|
|
- v-for="item in options"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value">
|
|
|
|
|
|
+ v-for="item in musicData"
|
|
|
|
+ :key="item.id"
|
|
|
|
+ :label="item.song_name"
|
|
|
|
+ :value="item.song_id">
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
<el-button type="warning"
|
|
<el-button type="warning"
|
|
- @click.prevent="removeDomain(domain)">删除
|
|
|
|
|
|
+ :disabled="form.songs.length <= 1"
|
|
|
|
+ @click.prevent="removeSong(song)">删除
|
|
</el-button>
|
|
</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer text-center">
|
|
<div slot="footer" class="dialog-footer text-center">
|
|
<el-button @click="dialog = false">取 消</el-button>
|
|
<el-button @click="dialog = false">取 消</el-button>
|
|
- <el-button @click="addDomain">新增歌曲</el-button>
|
|
|
|
|
|
+ <el-button @click="addSong">新增歌曲</el-button>
|
|
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
|
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
@@ -54,65 +55,51 @@ export default {
|
|
default: function () {
|
|
default: function () {
|
|
return {}
|
|
return {}
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ musicData: {
|
|
|
|
+ type: Array,
|
|
|
|
+ default: function () {
|
|
|
|
+ return []
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
dialog: !!this.value,
|
|
dialog: !!this.value,
|
|
form: {
|
|
form: {
|
|
- bar_name: '', // 门店名称
|
|
|
|
- bar_address: '', // 门店地址
|
|
|
|
- bar_status: '1', // 门店状态(0无效1有效)
|
|
|
|
- bar_img_url: [], // 门店图片
|
|
|
|
- bar_song_start_time: '', // 点歌开始时间
|
|
|
|
- bar_song_end_time: '', // 点歌结束时间
|
|
|
|
- bar_place_reserve_start_time: '', // 座位预定开始时间
|
|
|
|
- bar_place_reserve_end_time: '', // 座位预定结束时间
|
|
|
|
- note: '', // 备注
|
|
|
|
- domains: [
|
|
|
|
|
|
+ plan_id: '',
|
|
|
|
+ songs: [
|
|
{
|
|
{
|
|
- singer: '',
|
|
|
|
- value1: [new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 9, 40)]
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- singer: '',
|
|
|
|
- value1: [new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 9, 40)]
|
|
|
|
|
|
+ 'song_id': '',
|
|
|
|
+ 'song_name': '',
|
|
|
|
+ 'song_price': '',
|
|
|
|
+ 'song_auth_name': ''
|
|
}
|
|
}
|
|
]
|
|
]
|
|
},
|
|
},
|
|
- options: [{
|
|
|
|
- value: '选项1',
|
|
|
|
- label: '黄金糕'
|
|
|
|
- }, {
|
|
|
|
- value: '选项2',
|
|
|
|
- label: '双皮奶'
|
|
|
|
- }, {
|
|
|
|
- value: '选项3',
|
|
|
|
- label: '蚵仔煎'
|
|
|
|
- }, {
|
|
|
|
- value: '选项4',
|
|
|
|
- label: '龙须面'
|
|
|
|
- }, {
|
|
|
|
- value: '选项5',
|
|
|
|
- label: '北京烤鸭'
|
|
|
|
- }]
|
|
|
|
|
|
+ plan_author_name: '', // 歌手名
|
|
|
|
+ plan_start_time: '' // 演唱日期
|
|
|
|
+ // todo 第几节演唱
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- removeDomain (item) {
|
|
|
|
- var index = this.form.domains.indexOf(item)
|
|
|
|
|
|
+ removeSong (item) {
|
|
|
|
+ var index = this.form.songs.indexOf(item)
|
|
if (index !== -1) {
|
|
if (index !== -1) {
|
|
- this.form.domains.splice(index, 1)
|
|
|
|
|
|
+ this.form.songs.splice(index, 1)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- addDomain () {
|
|
|
|
- this.form.domains.push({
|
|
|
|
- value: '',
|
|
|
|
- key: Date.now()
|
|
|
|
|
|
+ addSong () {
|
|
|
|
+ this.form.songs.push({
|
|
|
|
+ 'song_id': '',
|
|
|
|
+ 'song_name': '',
|
|
|
|
+ 'song_price': '',
|
|
|
|
+ 'song_auth_name': ''
|
|
})
|
|
})
|
|
},
|
|
},
|
|
handleSubmit () {
|
|
handleSubmit () {
|
|
- const url = this.exData.id ? '/v1/bar/modify' : '/v1/bar/show/plan/song/add'
|
|
|
|
|
|
+ // TODO 修改
|
|
|
|
+ const url = this.exData.id ? '' : '/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, {
|
|
@@ -129,14 +116,13 @@ export default {
|
|
},
|
|
},
|
|
mounted () {
|
|
mounted () {
|
|
if (this.exData.id) {
|
|
if (this.exData.id) {
|
|
- this.$set(this.form, 'id', this.exData.id)
|
|
|
|
|
|
+ this.plan_author_name = this.exData.plan_author_name
|
|
|
|
+ this.plan_start_time = this.exData.plan_start_time
|
|
|
|
+
|
|
for (const key in this.exData) {
|
|
for (const key in this.exData) {
|
|
if (this.form.hasOwnProperty(key)) {
|
|
if (this.form.hasOwnProperty(key)) {
|
|
let value = this.exData[key]
|
|
let value = this.exData[key]
|
|
if ((Array.isArray(value) && value.length > 0) || value) {
|
|
if ((Array.isArray(value) && value.length > 0) || value) {
|
|
- if (key === 'bar_status') {
|
|
|
|
- value = value.toString()
|
|
|
|
- }
|
|
|
|
this.$set(this.form, key, value)
|
|
this.$set(this.form, key, value)
|
|
}
|
|
}
|
|
}
|
|
}
|