Explorar el Código

管理后台-用户中心:艺人

panyong hace 3 años
padre
commit
ce34abec6f

+ 149 - 0
htmldev/manage/src/views/ums/boss/details.vue

@@ -0,0 +1,149 @@
+<template>
+  <div>
+    <el-dialog :title="exData.id ? '编辑': '新增'"
+               :visible.sync="dialog"
+               width="50%"
+               :close-on-click-modal="false"
+               top="50px">
+      <el-form ref="form"
+               :model="form"
+               :rules="formRules"
+               label-width="160px">
+        <el-form-item prop="user_song_name"
+                      :rules="formRules.required"
+                      label="吧台姓名:">
+          <el-col :span="16">
+            <el-input v-model="form.user_song_name"
+                      placeholder="请输入吧台姓名"
+                      clearable></el-input>
+          </el-col>
+        </el-form-item>
+        <el-form-item prop="phone"
+                      :rules="formRules.mobile"
+                      label="手机号:">
+          <el-col :span="10">
+            <el-input v-model="form.phone"
+                      placeholder="请输入手机号"
+                      @input="form.phone = form.phone.replace(/[^\d]/g, '').slice(0, 11)"
+                      clearable></el-input>
+          </el-col>
+          <el-col :span="5" :offset="1">
+            <el-button
+              type="primary"
+              @click="validatePhone('form')"
+              :disabled="[0, 60].findIndex(item => item === numCount) < 0">
+              获取验证码<span>{{ [0, 60].findIndex(item => item === numCount) > -1 ? '' : numCount + '秒' }}</span>
+            </el-button>
+          </el-col>
+        </el-form-item>
+        <el-form-item prop="code"
+                      :rules="formRules.code"
+                      label="短信验证码:">
+          <el-col :span="16">
+            <el-input v-model="form.code"
+                      placeholder="请输入短信验证码"
+                      @input="form.code=form.code.replace(/[^\d]/g, '').slice(0, 6)"
+                      clearable></el-input>
+          </el-col>
+        </el-form-item>
+        <el-form-item prop="user_sign_status"
+                      :rules="formRules.required"
+                      label="状态:">
+          <el-radio v-model="form.user_sign_status"
+                    label="1">启用
+          </el-radio>
+          <el-radio v-model="form.user_sign_status"
+                    label="0">关闭
+          </el-radio>
+        </el-form-item>
+        <el-form-item>
+          <p>关闭后,登录“听邦App”不能查看驾驶舱数据</p>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer text-center">
+        <el-button @click="dialog = false">取 消</el-button>
+        <el-button type="primary" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { fen2Yuan, yuan2Fen } from '@/utils'
+import getCode from '@/views/ums/mixin/getCode'
+
+export default {
+  mixins: [getCode],
+  components: {},
+  props: {
+    value: {
+      type: Boolean,
+      default: true
+    },
+    exData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      dialog: !!this.value,
+      form: {
+        user_song_name: '', // 歌手名称
+        phone: '', // 手机号码
+        code: '', // 验证码
+        user_sign_status: '1', // 艺人签约状态(0未签约1已签约)
+      }
+    }
+  },
+  methods: {
+    handleSubmit () {
+      // todo 艺人添加、艺人海报数组转字符串
+      const url = this.exData.id ? '/v1/user/member/song/modify' : ''
+      this.$refs.form.validate(async valid => {
+        if (valid) {
+          const data = await this.$fetch(url, {
+            ...this.form,
+            place_price: yuan2Fen(this.form.place_price)
+          })
+          if (data.code === 200) {
+            this.$message.success('提交成功')
+            this.$emit('success')
+            this.dialog = false
+          }
+        }
+      })
+    }
+  },
+  mounted () {
+    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 >= 1) || (Object.prototype.toString.call(value) === '[object Object]') || (typeof value === 'string' && value) || typeof value === 'number') {
+            if (key === 'place_price') {
+              value = fen2Yuan(value)
+            }
+            this.$set(this.form, key, value)
+          }
+        }
+      }
+    }
+  },
+  watch: {
+    dialog (val) {
+      if (!val) this.$emit('input', val)
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.top-tip {
+  margin-top: -20px;
+  margin-bottom: 20px;
+}
+</style>

+ 110 - 2
htmldev/manage/src/views/ums/boss/index.vue

@@ -1,13 +1,121 @@
 <template>
-  <div></div>
+  <div class="padding-20">
+    <div class="search-box">
+      <el-form ref="form"
+               :inline="true"
+               :model="searchForm"
+               clearable
+               label-width="100px"
+               class="mt-10">
+        <el-form-item label="座位名称:">
+          <el-input v-model="searchForm.department_name" placeholder="请输入座位名称" clearable></el-input>
+        </el-form-item>
+        <el-form-item class="ml-10">
+          <el-button icon="el-icon-search" type="primary" @click="searchSubmit">查询</el-button>
+        </el-form-item>
+        <el-form-item class="ml-10">
+          <el-button icon="el-icon-plus" type="primary" @click="add">添加艺人</el-button>
+        </el-form-item>
+      </el-form>
+    </div>
+    <el-table :data="tableData"
+              stripe
+              v-loading="tableLoading"
+              fit
+              class="marginT-10 order-table"
+              border
+              :max-height="vheight">
+      <el-table-column label="ID" prop="id"></el-table-column>
+      <el-table-column label="头像" prop="bar_name">
+        <template slot-scope="scope">
+          <el-image style="width: 100px; height: 100px"
+                    :src="scope.row.user_head_url"
+                    :preview-src-list="[scope.row.user_head_url]">
+          </el-image>
+        </template>
+      </el-table-column>
+      <el-table-column label="昵称" prop="user_name"></el-table-column>
+      <el-table-column label="手机号" prop="user_phone"></el-table-column>
+      <el-table-column label="生日" prop="user_birthday"></el-table-column>
+      <el-table-column label="性别" prop="user_sex"></el-table-column>
+      <el-table-column label="注册时间" prop="created_at"></el-table-column>
+      <!--todo 创建时间-->
+      <el-table-column label="创建时间"></el-table-column>
+      <!--todo 状态-->
+      <el-table-column label="状态"></el-table-column>
+      <el-table-column label="操作">
+        <template slot-scope="scope">
+          <el-button type="text"
+                     @click="edit(scope.row)">编辑
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-pagination
+      class="marginT-20"
+      @size-change="handleSizeChange"
+      @current-change="handleCurrentChange"
+      :hide-on-single-page="true"
+      :current-page="page"
+      :page-size="page_size"
+      :page-sizes="[10, 20, 100, 200, 300, 400]"
+      background
+      layout="total, sizes, prev, pager, next, jumper"
+      :total="totalCount"/>
+    <detail v-if="detailsDialog.show"
+            v-model="detailsDialog.show"
+            :exData="detailsDialog.exData"
+            @success="init"></detail>
+  </div>
 </template>
 
 <script>
+import page from '@/mixin/page'
+import detail from './details'
+import axios from 'axios'
+
 export default {
-  name: 'index'
+  mixins: [page],
+  components: {
+    detail,
+  },
+  data () {
+    return {
+      detailsDialog: {
+        show: false,
+        exData: {}
+      },
+      time: [],
+      searchForm: {
+        user_type: '0' // 用户类型(0用户1艺人2吧台3老板)
+      },
+      tableData: [],
+      tableUrl: '/v1/user/member/List'
+    }
+  },
+  methods: {
+    add () {
+      this.detailsDialog.exData = {}
+      this.detailsDialog.show = true
+    },
+    edit (row) {
+      this.detailsDialog.exData = row
+      this.detailsDialog.show = true
+    }
+  },
+  mounted () {
+    this.init()
+  },
 }
 </script>
 
 <style lang="scss" scoped>
+.el-dropdown {
+  margin: 0 10px;
 
+  .el-dropdown-link {
+    cursor: pointer;
+    color: #409EFF;
+  }
+}
 </style>

+ 49 - 0
htmldev/manage/src/views/ums/mixin/getCode.js

@@ -0,0 +1,49 @@
+export default {
+  data () {
+    return {
+      numCount: 60,
+      timer: null
+    }
+  },
+  methods: {
+    validatePhone (formName) {
+      this.$refs[formName].validateField('phone', emailError => {
+        if (!emailError) {
+          this.funGetCode()
+        } else {
+          return false
+        }
+      })
+    },
+    funCutDown () {
+      clearInterval(this.timer)
+      this.timer = setInterval(() => {
+        if (this.numCount === 0) {
+          clearInterval(this.timer)
+          this.numCount = 0
+          return
+        }
+        this.numCount--
+      }, 1000)
+    },
+    // 获取验证码
+    async funGetCode () {
+      const numCount = this.numCount
+      const { phone } = this.form
+      if (numCount < 60 && numCount > 0) {
+        return
+      }
+      this.numCount = 60
+      this.funCutDown()
+      const data = await this.$fetch('/v1/send/code', {
+        phone
+      })
+      if (data.code === 200) {
+        this.$message.success('发送成功')
+      } else {
+        clearInterval(this.timer)
+        this.numCount = 60
+      }
+    }
+  }
+}

+ 149 - 0
htmldev/manage/src/views/ums/personnel/details.vue

@@ -0,0 +1,149 @@
+<template>
+  <div>
+    <el-dialog :title="exData.id ? '编辑': '新增'"
+               :visible.sync="dialog"
+               width="50%"
+               :close-on-click-modal="false"
+               top="50px">
+      <el-form ref="form"
+               :model="form"
+               :rules="formRules"
+               label-width="160px">
+        <el-form-item prop="user_song_name"
+                      :rules="formRules.required"
+                      label="吧台姓名:">
+          <el-col :span="16">
+            <el-input v-model="form.user_song_name"
+                      placeholder="请输入吧台姓名"
+                      clearable></el-input>
+          </el-col>
+        </el-form-item>
+        <el-form-item prop="phone"
+                      :rules="formRules.mobile"
+                      label="手机号:">
+          <el-col :span="10">
+            <el-input v-model="form.phone"
+                      placeholder="请输入手机号"
+                      @input="form.phone = form.phone.replace(/[^\d]/g, '').slice(0, 11)"
+                      clearable></el-input>
+          </el-col>
+          <el-col :span="5" :offset="1">
+            <el-button
+              type="primary"
+              @click="validatePhone('form')"
+              :disabled="[0, 60].findIndex(item => item === numCount) < 0">
+              获取验证码<span>{{ [0, 60].findIndex(item => item === numCount) > -1 ? '' : numCount + '秒' }}</span>
+            </el-button>
+          </el-col>
+        </el-form-item>
+        <el-form-item prop="code"
+                      :rules="formRules.code"
+                      label="短信验证码:">
+          <el-col :span="16">
+            <el-input v-model="form.code"
+                      placeholder="请输入短信验证码"
+                      @input="form.code=form.code.replace(/[^\d]/g, '').slice(0, 6)"
+                      clearable></el-input>
+          </el-col>
+        </el-form-item>
+        <el-form-item prop="user_sign_status"
+                      :rules="formRules.required"
+                      label="状态:">
+          <el-radio v-model="form.user_sign_status"
+                    label="1">启用
+          </el-radio>
+          <el-radio v-model="form.user_sign_status"
+                    label="0">关闭
+          </el-radio>
+        </el-form-item>
+        <el-form-item>
+          <p>关闭后,登录“听邦App”不能核销订座</p>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer text-center">
+        <el-button @click="dialog = false">取 消</el-button>
+        <el-button type="primary" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { fen2Yuan, yuan2Fen } from '@/utils'
+import getCode from '@/views/ums/mixin/getCode'
+
+export default {
+  mixins: [getCode],
+  components: {},
+  props: {
+    value: {
+      type: Boolean,
+      default: true
+    },
+    exData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      dialog: !!this.value,
+      form: {
+        user_song_name: '', // 歌手名称
+        phone: '', // 手机号码
+        code: '', // 验证码
+        user_sign_status: '1', // 艺人签约状态(0未签约1已签约)
+      }
+    }
+  },
+  methods: {
+    handleSubmit () {
+      // todo 艺人添加、艺人海报数组转字符串
+      const url = this.exData.id ? '/v1/user/member/song/modify' : ''
+      this.$refs.form.validate(async valid => {
+        if (valid) {
+          const data = await this.$fetch(url, {
+            ...this.form,
+            place_price: yuan2Fen(this.form.place_price)
+          })
+          if (data.code === 200) {
+            this.$message.success('提交成功')
+            this.$emit('success')
+            this.dialog = false
+          }
+        }
+      })
+    }
+  },
+  mounted () {
+    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 >= 1) || (Object.prototype.toString.call(value) === '[object Object]') || (typeof value === 'string' && value) || typeof value === 'number') {
+            if (key === 'place_price') {
+              value = fen2Yuan(value)
+            }
+            this.$set(this.form, key, value)
+          }
+        }
+      }
+    }
+  },
+  watch: {
+    dialog (val) {
+      if (!val) this.$emit('input', val)
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.top-tip {
+  margin-top: -20px;
+  margin-bottom: 20px;
+}
+</style>

+ 110 - 2
htmldev/manage/src/views/ums/personnel/index.vue

@@ -1,13 +1,121 @@
 <template>
-  <div></div>
+  <div class="padding-20">
+    <div class="search-box">
+      <el-form ref="form"
+               :inline="true"
+               :model="searchForm"
+               clearable
+               label-width="100px"
+               class="mt-10">
+        <el-form-item label="座位名称:">
+          <el-input v-model="searchForm.department_name" placeholder="请输入座位名称" clearable></el-input>
+        </el-form-item>
+        <el-form-item class="ml-10">
+          <el-button icon="el-icon-search" type="primary" @click="searchSubmit">查询</el-button>
+        </el-form-item>
+        <el-form-item class="ml-10">
+          <el-button icon="el-icon-plus" type="primary" @click="add">添加艺人</el-button>
+        </el-form-item>
+      </el-form>
+    </div>
+    <el-table :data="tableData"
+              stripe
+              v-loading="tableLoading"
+              fit
+              class="marginT-10 order-table"
+              border
+              :max-height="vheight">
+      <el-table-column label="ID" prop="id"></el-table-column>
+      <el-table-column label="头像" prop="bar_name">
+        <template slot-scope="scope">
+          <el-image style="width: 100px; height: 100px"
+                    :src="scope.row.user_head_url"
+                    :preview-src-list="[scope.row.user_head_url]">
+          </el-image>
+        </template>
+      </el-table-column>
+      <el-table-column label="昵称" prop="user_name"></el-table-column>
+      <el-table-column label="手机号" prop="user_phone"></el-table-column>
+      <el-table-column label="生日" prop="user_birthday"></el-table-column>
+      <el-table-column label="性别" prop="user_sex"></el-table-column>
+      <el-table-column label="注册时间" prop="created_at"></el-table-column>
+      <!--todo 创建时间-->
+      <el-table-column label="创建时间"></el-table-column>
+      <!--todo 状态-->
+      <el-table-column label="状态"></el-table-column>
+      <el-table-column label="操作">
+        <template slot-scope="scope">
+          <el-button type="text"
+                     @click="edit(scope.row)">编辑
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-pagination
+      class="marginT-20"
+      @size-change="handleSizeChange"
+      @current-change="handleCurrentChange"
+      :hide-on-single-page="true"
+      :current-page="page"
+      :page-size="page_size"
+      :page-sizes="[10, 20, 100, 200, 300, 400]"
+      background
+      layout="total, sizes, prev, pager, next, jumper"
+      :total="totalCount"/>
+    <detail v-if="detailsDialog.show"
+            v-model="detailsDialog.show"
+            :exData="detailsDialog.exData"
+            @success="init"></detail>
+  </div>
 </template>
 
 <script>
+import page from '@/mixin/page'
+import detail from './details'
+import axios from 'axios'
+
 export default {
-  name: 'index'
+  mixins: [page],
+  components: {
+    detail,
+  },
+  data () {
+    return {
+      detailsDialog: {
+        show: false,
+        exData: {}
+      },
+      time: [],
+      searchForm: {
+        user_type: '0' // 用户类型(0用户1艺人2吧台3老板)
+      },
+      tableData: [],
+      tableUrl: '/v1/user/member/List'
+    }
+  },
+  methods: {
+    add () {
+      this.detailsDialog.exData = {}
+      this.detailsDialog.show = true
+    },
+    edit (row) {
+      this.detailsDialog.exData = row
+      this.detailsDialog.show = true
+    }
+  },
+  mounted () {
+    this.init()
+  },
 }
 </script>
 
 <style lang="scss" scoped>
+.el-dropdown {
+  margin: 0 10px;
 
+  .el-dropdown-link {
+    cursor: pointer;
+    color: #409EFF;
+  }
+}
 </style>

+ 4 - 58
htmldev/manage/src/views/ums/singer/details.vue

@@ -30,7 +30,7 @@
           <el-col :span="5" :offset="1">
             <el-button
               type="primary"
-              @click="validatePhone"
+              @click="validatePhone('form')"
               :disabled="[0, 60].findIndex(item => item === numCount) < 0">
               获取验证码<span>{{ [0, 60].findIndex(item => item === numCount) > -1 ? '' : numCount + '秒' }}</span>
             </el-button>
@@ -84,8 +84,10 @@
 
 <script>
 import { fen2Yuan, yuan2Fen } from '@/utils'
+import getCode from '@/views/ums/mixin/getCode'
 
 export default {
+  mixins: [getCode],
   components: {},
   props: {
     value: {
@@ -109,9 +111,7 @@ export default {
         plan_cover_url: [],
         user_sign_status: '1', // 艺人签约状态(0未签约1已签约)
       },
-      fileList: [],
-      numCount: 60,
-      timer: null
+      fileList: []
     }
   },
   methods: {
@@ -143,60 +143,6 @@ export default {
         type: 'warning'
       })
     },
-    removeDeskNum (item) {
-      var index = this.form.place_number.indexOf(item)
-      if (this.form.place_number.length <= 1) {
-        this.$message.warning('桌数不能小于1')
-        return
-      }
-      if (index !== -1) {
-        this.form.place_number.splice(index, 1)
-      }
-    },
-    addDomain () {
-      this.form.place_number.push({
-        value: ''
-      })
-    },
-    validatePhone () {
-      this.$refs['form'].validateField('phone', emailError => {
-        if (!emailError) {
-          this.funGetCode()
-        } else {
-          return false
-        }
-      })
-    },
-    funCutDown () {
-      clearInterval(this.timer)
-      this.timer = setInterval(() => {
-        if (this.numCount === 0) {
-          clearInterval(this.timer)
-          this.numCount = 0
-          return
-        }
-        this.numCount--
-      }, 1000)
-    },
-    // 获取验证码
-    async funGetCode () {
-      const numCount = this.numCount
-      const { phone } = this.form
-      if (numCount < 60 && numCount > 0) {
-        return
-      }
-      this.numCount = 60
-      this.funCutDown()
-      const data = await this.$fetch('/v1/send/code', {
-        phone
-      })
-      if (data.code === 200) {
-        this.$message.success('发送成功')
-      } else {
-        clearInterval(this.timer)
-        this.numCount = 60
-      }
-    },
     handleSubmit () {
       // todo 艺人添加、艺人海报数组转字符串
       const url = this.exData.id ? '/v1/user/member/song/modify' : ''