zhengjinyi 5 năm trước cách đây
mục cha
commit
0f822287b7
3 tập tin đã thay đổi với 133 bổ sung77 xóa
  1. 34 0
      src/api/club.js
  2. 88 60
      src/views/club/list.vue
  3. 11 17
      src/views/club/operateList.vue

+ 34 - 0
src/api/club.js

@@ -0,0 +1,34 @@
+import request from '@/utils/request'
+
+export function getList(query) {
+  return request({
+    url: '/goods/list',
+    method: 'get',
+    params: query
+  })
+}
+
+export function getCategory(query) {
+  return request({
+    url: '/goods/category/list',
+    method: 'get',
+    params: query
+  })
+}
+
+export function updateCategory(query) {
+  return request({
+    url: '/goods/category/update',
+    method: 'post',
+    params: query
+  })
+}
+
+export function createCategory(query) {
+  return request({
+    url: '/goods/category/create',
+    method: 'post',
+    params: query
+  })
+}
+

+ 88 - 60
src/views/club/list.vue

@@ -13,8 +13,8 @@
         </el-form-item>
         <el-form-item label="上线状态:">
           <el-select v-model="form.status" placeholder="请选择">
-            <el-option label="已上线" value="shanghai"></el-option>
-            <el-option label="已下线" value="beijing"></el-option>
+            <el-option label="已上线" value="shanghai" />
+            <el-option label="已下线" value="beijing" />
           </el-select>
         </el-form-item>
         <el-form-item label="创建时间:">
@@ -23,8 +23,8 @@
             type="daterange"
             range-separator="至"
             start-placeholder="开始日期"
-            end-placeholder="结束日期">
-          </el-date-picker>
+            end-placeholder="结束日期"
+          />
         </el-form-item>
         <el-form-item>
           <el-button type="primary" @click="onSubmit">搜索</el-button>
@@ -51,9 +51,10 @@
       <el-table-column class-name="status-col" label="上线状态" width="150" align="center" prop="status">
         <template slot-scope="{row}">
           <el-tag>
-            {{ row.status*1 === 1 ? '已下线' : '已上线' }}
+            {{ row.status === 1 ? '已下线' : '已上线' }}
           </el-tag>
-          <el-button type="primary" size="mini" @click="handleEdit(row)">{{ row.status*1 === 1 ? '上线' : '下线' }}</el-button>
+          <el-button v-if="row.status === 1" type="primary" size="mini" @click="handOnline(row)">上线</el-button>
+          <el-button v-else type="primary" size="mini" @click="handOffline(row)">下线</el-button>
         </template>
       </el-table-column>
       <el-table-column align="center" label="会所地址" width="350" prop="address" />
@@ -61,12 +62,12 @@
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="{row}">
           <router-link :to="'/club/form/'">
-            <el-button type="primary" size="mini">编辑</el-button>
+            <el-button type="primary" size="small">编辑</el-button>
           </router-link>
           <router-link :to="'/club/operateList/'">
-            <el-button type="primary" size="mini">查看运营人员</el-button>
+            <el-button type="primary" size="small">查看运营人员</el-button>
           </router-link>
-          <el-button type="success" size="mini" @click="handleEdit(row)">添加运营人员</el-button>
+          <el-button type="primary" size="small" @click="handleEdit(row.id)">添加运营人员</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -74,26 +75,33 @@
     <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="fetchData" />
 
     <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
-      <el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="70px" style="width: 400px; margin-left:24%;">
+      <el-form ref="dataForm" :rules="rules" :model="addPeople" label-position="left" label-width="70px" style="width: 400px; margin-left:24%;">
         <el-form-item label="姓名" prop="classifyName">
-          <el-input v-model="temp.classifyName" />
+          <el-input v-model="addPeople.classifyName" />
         </el-form-item>
-        <el-form-item label="*手机号" prop="telephone">
-          <el-input v-model="temp.telephone" />
+        <el-form-item label="手机号" prop="telephone">
+          <el-input v-model="addPeople.telephone" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button @click="dialogFormVisible = false">取消</el-button>      
-        <el-button type="primary" @click="dialogStatus==='create' ? createData() : updateData()">保存</el-button>
-        <el-button type="primary" @click="dialogStatus==='create' ? createData() : updateData()">保存生成邀请码</el-button>
+        <el-button @click="dialogFormVisible = false">取消</el-button>
+        <el-button type="primary" @click="createData()">保存</el-button>
+        <el-button type="primary" @click="updateData()">保存生成邀请码</el-button>
       </div>
     </el-dialog>
 
+    <el-dialog title="系统提示" :visible.sync="dialogVisible" width="15%">
+      <span>{{ dialogVisibleText }}</span>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="handleConfim()">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { getCategory, updateCategory, createCategory } from '@/api/goods'
+import { getCategory, updateCategory, createCategory } from '@/api/club'
 import Pagination from '@/components/Pagination'
 
 export default {
@@ -112,7 +120,7 @@ export default {
       list: null,
       listLoading: true,
       searchTimeVal: '',
-      total: 0,
+      total: 100,
       listQuery: {
         page: 1,
         limit: 10,
@@ -132,30 +140,24 @@ export default {
         imageUrl: '',
         doorwayImageUrl: ''
       },
-      temp: {
-        id: 1,
-        organizeID: 1,
-        classifyName: '针剂',
-        classifyImage: 'dfgdfsgsd',
-        sort: 60,
-        status: 1,
-        postage: 1,
-        addTime: new Date(),
-        updateTime: new Date(),
-        delFlag: 0
+      addPeople: {
+        classifyName: '',
+        telephone: ''
       },
+      updateTatusId: '',
+      updateTatusType: '',
+      dialogVisible: false,
+      dialogVisibleText: '',
       dialogFormVisible: false,
       dialogStatus: '',
       textMap: {
         update: '添加运营人员',
-        create: 'Create'
+        create: 'Create',
+        titleText: '系统提示'
       },
       rules: {
-        classifyName: [{ required: true, message: '分类名称不能为空', trigger: 'blur' }],
-        sort: [{ required: true, message: '分类名称不能为空', trigger: 'blur' }],
-        classifyImage: [{ type: 'file', required: true, message: '请上传分类图标', trigger: 'change' }],
-        postage: [{ required: true, message: '请选择邮费是否到付', trigger: 'change' }],
-        status: [{ required: true, message: '请选择状态', trigger: 'change' }]
+        classifyName: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
+        telephone: [{ required: true, message: '手机号码不能为空', trigger: 'blur' }]
       }
     }
   },
@@ -177,7 +179,7 @@ export default {
             classifyName: '商城测试演示会所',
             classifyNum: '2020010120201110',
             classifyPeo: '吴小研',
-            telephone: 138888888888,
+            telephone: 13888888888,
             address: '广东省深圳市福田区上步村1001号锦峰大厦A座',
             createTime: '2020-01-01:20:30:56',
             status: 1
@@ -188,7 +190,7 @@ export default {
             classifyName: '商城测试演示会所',
             classifyNum: '2020010120201110',
             classifyPeo: '吴小研',
-            telephone: 138888888888,
+            telephone: 13888888888,
             address: '广东省深圳市福田区上步村1001号锦峰大厦A座',
             createTime: '2020-01-01:20:30:56',
             status: 1
@@ -198,31 +200,23 @@ export default {
       this.listLoading = false
     },
     handleEdit(row) {
-      this.temp = Object.assign({}, row)
-      this.temp.timestamp = new Date(this.temp.timestamp)
+      this.addPeople = Object.assign({}, { id: row })
       this.dialogStatus = 'update'
       this.dialogFormVisible = true
       this.$nextTick(() => {
         this.$refs['dataForm'].clearValidate()
       })
     },
-    updateData() {
+    createData() {
       this.$refs['dataForm'].validate((valid) => {
         if (valid) {
-          const tempData = Object.assign({}, this.temp)
-          tempData.updateTime = +new Date(tempData.updateTime)
-          updateCategory(tempData).then(() => {
-            for (const v of this.list) {
-              if (v.id === this.temp.id) {
-                const index = this.list.indexOf(v)
-                this.list.splice(index, 1, this.temp)
-                break
-              }
-            }
+          const addPeopleData = Object.assign({}, this.addPeople)
+          console.log(addPeopleData)
+          updateCategory(addPeopleData).then(() => {
             this.dialogFormVisible = false
             this.$notify({
               title: 'Success',
-              message: '更新成功',
+              message: '保存成功',
               type: 'success',
               duration: 2000
             })
@@ -230,21 +224,55 @@ export default {
         }
       })
     },
-    createData() {
+    updateData() {
       this.$refs['dataForm'].validate((valid) => {
         if (valid) {
-          createCategory(this.temp).then(() => {
-            this.list.unshift(this.temp)
+          const addPeopleData = Object.assign({}, this.addPeople)
+          console.log(addPeopleData)
+          updateCategory(addPeopleData).then(() => {
             this.dialogFormVisible = false
-            this.$notify({
-              title: 'Success',
-              message: '添加分类成功',
-              type: 'success',
-              duration: 2000
-            })
           })
         }
       })
+    },
+    handOnline(row) {
+      console.log(row.id)
+      this.dialogVisible = true
+      this.dialogVisibleText = '确定上线该会所吗?'
+      this.updateTatusId = row.id
+      this.updateTatusType = 'online'
+    },
+    handOffline(row) {
+      console.log(row.id)
+      this.dialogVisible = true
+      this.dialogVisibleText = '确定下线该会所吗?'
+      this.updateTatusId = row.id
+      this.updateTatusType = 'offline'
+    },
+    handleConfim() {
+      if (this.updateTatusType === 'online') {
+        console.log(this.updateTatusId)
+        this.list[0].status = 2
+        this.$notify({
+          title: 'Success',
+          message: '上线成功',
+          type: 'success',
+          duration: 2000
+        })
+      } else {
+        console.log(this.updateTatusId)
+        this.list[1].status = 2
+        this.$notify({
+          title: 'Success',
+          message: '下线成功',
+          type: 'success',
+          duration: 2000
+        })
+      }
+      this.dialogVisible = false
+    },
+    onSubmit() {
+      console.log('search')
     }
   }
 }

+ 11 - 17
src/views/club/operateList.vue

@@ -16,7 +16,7 @@
       </el-table-column>
       <el-table-column label="账号" width="150" align="center" prop="classifyNum" />
       <el-table-column label="姓名" width="150" align="center" prop="classifyName" />
-      <el-table-column label="手机号码" width="150" align="center" prop="telephone" />
+      <el-table-column label="手机号码" width="110" align="center" prop="telephone" />
       <el-table-column label="邀请码" width="100" align="center" prop="code">
         <template slot-scope="{row}">
           <span>{{ row.code }}</span>
@@ -30,12 +30,13 @@
       </el-table-column>
       <el-table-column align="center" label="微信昵称" width="110" prop="watchName" />
       <el-table-column align="center" label="OpenID" width="250" prop="openID" />
-      <el-table-column align="center" label="添加时间" width="180" prop="createTime" />
-      <el-table-column align="center" label="绑定时间" width="180" prop="bindTime" />
+      <el-table-column align="center" label="添加时间" width="160" prop="createTime" />
+      <el-table-column align="center" label="绑定时间" width="160" prop="bindTime" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="{row}">
           <el-button type="primary" size="mini" @click="handleEdit(row)">编辑</el-button>
           <el-button type="primary" size="mini" @click="handleUntying(row)">解绑</el-button>
+          <el-button type="primary" size="small" @click="handleUntying(row)">生成邀请码</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -47,7 +48,7 @@
         <el-form-item label="姓名" prop="classifyName">
           <el-input v-model="temp.classifyName" />
         </el-form-item>
-        <el-form-item label="*手机号" prop="telephone">
+        <el-form-item label="手机号" prop="telephone">
           <el-input v-model="temp.telephone" />
         </el-form-item>
       </el-form>
@@ -56,11 +57,7 @@
         <el-button type="primary" @click="dialogStatus==='create' ? createData() : updateData()">确定</el-button>
       </div>
     </el-dialog>
-    <el-dialog
-      title="提示"
-      :visible.sync="dialogVisible"
-      width="20%"
-    >
+    <el-dialog title="提示" :visible.sync="dialogVisible" width="10%">
       <span>确定解绑该运营人员吗?</span>
       <span slot="footer" class="dialog-footer">
         <el-button @click="dialogVisible = false">取 消</el-button>
@@ -89,7 +86,7 @@ export default {
     return {
       list: null,
       listLoading: true,
-      total: 0,
+      total: 100,
       dialogVisible: false,
       listQuery: {
         page: 1,
@@ -113,11 +110,8 @@ export default {
         create: 'Create'
       },
       rules: {
-        classifyName: [{ required: true, message: '分类名称不能为空', trigger: 'blur' }],
-        sort: [{ required: true, message: '分类名称不能为空', trigger: 'blur' }],
-        classifyImage: [{ type: 'file', required: true, message: '请上传分类图标', trigger: 'change' }],
-        postage: [{ required: true, message: '请选择邮费是否到付', trigger: 'change' }],
-        status: [{ required: true, message: '请选择状态', trigger: 'change' }]
+        classifyName: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
+        telephone: [{ required: true, message: '手机号不能为空', trigger: 'blur' }]
       }
     }
   },
@@ -141,7 +135,7 @@ export default {
             watchName: '轻描淡写',
             openID: 'o0dXI5ajSPa6PkOmjjq1aar93JW4',
             code: '219845',
-            telephone: 138888888888,
+            telephone: 13888888888,
             createTime: '2020-01-01:20:30:56',
             bindTime: '2020-01-01:20:30:56',
             status: 1
@@ -154,7 +148,7 @@ export default {
             watchName: '轻描淡写',
             openID: 'o0dXI5ajSPa6PkOmjjq1aar93JW4',
             code: '315654',
-            telephone: 138888888888,
+            telephone: 13888888888,
             createTime: '2020-01-01:20:30:56',
             bindTime: '2020-01-01:20:30:56',
             status: 1