|
@@ -9,22 +9,38 @@
|
|
|
:model="form"
|
|
|
:rules="formRules"
|
|
|
label-width="160px">
|
|
|
- <el-form-item prop="bar_name"
|
|
|
+ <el-form-item prop="song_name"
|
|
|
:rules="formRules.required"
|
|
|
label="歌曲名称:">
|
|
|
<el-col :span="16">
|
|
|
- <el-input v-model="form.bar_name"
|
|
|
+ <el-input v-model="form.song_name"
|
|
|
placeholder="请输入歌曲名称"
|
|
|
clearable></el-input>
|
|
|
</el-col>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="原唱:">
|
|
|
+ <el-form-item label="原唱:" prop="song_auth_name">
|
|
|
<el-col :span="16">
|
|
|
- <el-input v-model="form.bar_name"
|
|
|
+ <el-input v-model="form.song_auth_name"
|
|
|
placeholder="请输入原唱"
|
|
|
clearable></el-input>
|
|
|
</el-col>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item prop="song_status"
|
|
|
+ :rules="formRules.required"
|
|
|
+ label="歌曲状态:">
|
|
|
+ <el-radio v-model="form.song_status" label="1">有效</el-radio>
|
|
|
+ <el-radio v-model="form.song_status" label="0">无效</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="song_price"
|
|
|
+ :rules="formRules.numPot2"
|
|
|
+ label="单价(元):">
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-input v-model="form.song_price"
|
|
|
+ placeholder="请输入单价"
|
|
|
+ @input="form.song_price=form.song_price.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
|
|
|
+ clearable></el-input>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer text-center">
|
|
|
<el-button @click="dialog = false">取 消</el-button>
|
|
@@ -35,6 +51,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { fen2Yuan, yuan2Fen } from '@/utils'
|
|
|
+
|
|
|
export default {
|
|
|
components: {},
|
|
|
props: {
|
|
@@ -53,40 +71,22 @@ export default {
|
|
|
return {
|
|
|
dialog: !!this.value,
|
|
|
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: [{
|
|
|
- value: ''
|
|
|
- }]
|
|
|
+ user_id: '', // 用户ID
|
|
|
+ song_name: '', // 歌曲名称
|
|
|
+ song_auth_name: '', // 歌曲作者
|
|
|
+ song_status: '1', // 歌曲状态(0无效1有效)
|
|
|
+ song_price: '' // 歌曲价格
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- removeDomain (item) {
|
|
|
- var index = this.form.domains.indexOf(item)
|
|
|
- if (index !== -1) {
|
|
|
- this.form.domains.splice(index, 1)
|
|
|
- }
|
|
|
- },
|
|
|
- addDomain () {
|
|
|
- this.form.domains.push({
|
|
|
- value: '',
|
|
|
- key: Date.now()
|
|
|
- })
|
|
|
- },
|
|
|
handleSubmit () {
|
|
|
const url = this.exData.id ? '/v1/user/song/modify' : '/v1/user/song/add'
|
|
|
this.$refs.form.validate(async valid => {
|
|
|
if (valid) {
|
|
|
const data = await this.$fetch(url, {
|
|
|
- ...this.form
|
|
|
+ ...this.form,
|
|
|
+ song_price: yuan2Fen(this.form.song_price)
|
|
|
})
|
|
|
if (data.code === 200) {
|
|
|
this.$message.success('提交成功')
|
|
@@ -98,13 +98,17 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
|
+ this.$set(this.form, 'user_id', this.$route.query.id)
|
|
|
if (this.exData.id) {
|
|
|
this.$set(this.form, '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) {
|
|
|
- if (key === 'bar_status') {
|
|
|
+ if ((Array.isArray(value) && value.length > 0) || value === 0 || value) {
|
|
|
+ if (key === 'song_price') {
|
|
|
+ value = fen2Yuan(value)
|
|
|
+ }
|
|
|
+ if (key === 'song_status') {
|
|
|
value = value.toString()
|
|
|
}
|
|
|
this.$set(this.form, key, value)
|