Browse Source

管理后台-艺人曲库:歌曲管理

panyong 3 years ago
parent
commit
adc62e9b2b

+ 2 - 3
htmldev/manage/src/views/business/place/reserve/details.vue

@@ -37,10 +37,9 @@
           </el-col>
         </el-form-item>
         <el-form-item prop="order_sign_status"
-                      :rules="formRules.InterNum"
+                      :rules="formRules.required"
                       label="签到状态:">
-          <el-radio v-model="form.order_sign_status" label="1">签到</el-radio>
-          <br>
+          <el-radio v-model="form.order_sign_status" label="1">已签到</el-radio>
           <el-radio v-model="form.order_sign_status" label="0">未签到</el-radio>
         </el-form-item>
       </el-form>

+ 4 - 3
htmldev/manage/src/views/business/show/musicLib/index.vue

@@ -40,7 +40,8 @@
       <el-table-column label="操作">
         <template slot-scope="scope">
           <el-button type="text"
-                     @click="$router.push({name: 'BusinessShowPlayList', query: {id: scope.row.id }})">设置曲库
+                     @click="$router.push({name: 'BusinessShowPlayList', query: {id: scope.row.id, name: encodeURIComponent(scope.row.user_name) }})">
+            设置曲库
           </el-button>
         </template>
       </el-table-column>
@@ -91,8 +92,8 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(async () => {
-        const data = await this.$fetch('/api/auth/department/del', { id: row.id })
-        if (data.code == 200) {
+        const data = await this.$fetch('/v1/user/song/delete', { id: row.id })
+        if (data.code === 200) {
           this.$message.success('删除成功')
           this.init()
         }

+ 35 - 31
htmldev/manage/src/views/business/show/playList/details.vue

@@ -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)

+ 14 - 9
htmldev/manage/src/views/business/show/playList/index.vue

@@ -24,24 +24,28 @@
         </el-form-item>
       </el-form>
     </div>
+    <h3 class="marginT-10">{{ decodeURIComponent($route.query.name) }}的曲库</h3>
     <el-table :data="tableData"
               stripe
               v-loading="tableLoading"
               fit
-              class="marginT-10 order-table"
+              class="order-table"
               border
               :max-height="vheight">
       <el-table-column label="ID" prop="id"></el-table-column>
-      <el-table-column label="歌曲名字" prop="department_name"></el-table-column>
-      <el-table-column label="原唱" prop="department_name"></el-table-column>
-      <el-table-column label="点歌次数" prop="department_project_name"></el-table-column>
-      <el-table-column label="添加时间" prop="department_project_name"></el-table-column>
-      <el-table-column label="已预定" prop="department_project_name"></el-table-column>
-      <el-table-column label="日期" prop="department_desc"></el-table-column>
+      <el-table-column label="歌曲名字" prop="song_name"></el-table-column>
+      <el-table-column label="原唱" prop="song_auth_name"></el-table-column>
+      <el-table-column label="歌曲状态">
+        <template slot-scope="scope">
+          <p>{{ ['无效', '有效'][scope.row.song_status] }}</p>
+        </template>
+      </el-table-column>
+      <el-table-column label="点歌次数" prop="song_num"></el-table-column>
+      <el-table-column label="添加时间" prop="created_at"></el-table-column>
       <el-table-column label="操作">
         <template slot-scope="scope">
           <el-button type="text" @click="edit(scope.row)">编辑</el-button>
-          <el-button type="text">删除</el-button>
+          <el-button type="text" @click="del(scope.row)">删除</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -97,7 +101,7 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(async () => {
-        const data = await this.$fetch('/v1/user/song/modify', { id: row.id })
+        const data = await this.$fetch('/v1/user/song/delete', { id: row.id }, 'get')
         if (data.code === 200) {
           this.$message.success('删除成功')
           this.init()
@@ -106,6 +110,7 @@ export default {
     }
   },
   mounted () {
+    // 用户ID
     this.$set(this.searchForm, 'id', this.$route.query.id)
     this.init()
   },