Bläddra i källkod

feat():添加聊天记录

geek 4 år sedan
förälder
incheckning
624e5fa8c3

+ 48 - 0
src/api/branchJoin.js

@@ -0,0 +1,48 @@
+import request from '@/utils/request'
+
+export function fetchList(query) {
+  return request({
+    url: '/BranchJoin/index',
+    method: 'get',
+    params: query
+  })
+}
+
+export function fetchBranchJoin(id) {
+  return request({
+    url: '/BranchJoin/read',
+    method: 'get',
+    params: { id }
+  })
+}
+
+export function createBanner(data) {
+  return request({
+    url: '/Carousel/save',
+    method: 'post',
+    data
+  })
+}
+
+export function updateBranchJoin(data) {
+  return request({
+    url: '/BranchJoin/update?id=' + data.id,
+    method: 'post',
+    data
+  })
+}
+
+export function dealBranchJoin(data) {
+  return request({
+    url: '/BranchJoin/dealBranchJoin',
+    method: 'post',
+    data
+  })
+}
+
+export function deleteBranchJoin(id) {
+  return request({
+    url: '/BranchJoin/delete?id=' + id,
+    method: 'get'
+  })
+}

+ 21 - 2
src/router/index.js

@@ -75,13 +75,32 @@ export const constantRoutes = [
         path: 'list',
         name: 'join',
         component: () => import('@/views/join/list'),
-        meta: { title: '加盟申请列表', icon: 'el-icon-s-help' }
+        meta: { title: '新店加盟申请列表', icon: 'el-icon-s-help' }
       },
       {
         path: 'edit/:id(\\d+)',
         name: 'editJoin',
         component: () => import('@/views/join/edit'),
-        meta: { title: '加盟申请查看', icon: 'el-icon-s-help' },
+        meta: { title: '新店加盟申请查看', icon: 'el-icon-s-help' },
+        hidden: true
+      }
+    ]
+  },
+  {
+    path: '/branchJoin',
+    component: Layout,
+    children: [
+      {
+        path: 'list',
+        name: 'join',
+        component: () => import('@/views/branchJoin/list'),
+        meta: { title: '分店加盟申请列表', icon: 'el-icon-s-help' }
+      },
+      {
+        path: 'edit/:id(\\d+)',
+        name: 'editJoin',
+        component: () => import('@/views/branchJoin/edit'),
+        meta: { title: '分店申请查看', icon: 'el-icon-s-help' },
         hidden: true
       }
     ]

+ 1 - 1
src/settings.js

@@ -1,6 +1,6 @@
 module.exports = {
 
-  title: 'Vue Admin Template',
+  title: '阿姨合伙人',
 
   /**
    * @type {boolean} true | false

+ 210 - 0
src/views/branchJoin/components/ArticleDetail.vue

@@ -0,0 +1,210 @@
+<template>
+  <div class="createPost-container">
+    <el-form ref="postForm" :label-position="labelPosition" :model="postForm" :rules="rules" class="form-container" label-width="200px">
+      <div class="createPost-main-container">
+        <el-form-item prop="old_partner" label="老店合同人姓名">
+          <el-input v-model="postForm.old_partner" placeholder="" style="width: 300px;" />
+        </el-form-item>
+        <el-form-item prop="mobile" label="手机号">
+          <el-input v-model="postForm.mobile" placeholder="" style="width: 300px;" />
+        </el-form-item>
+        <el-form-item prop="old_store_name" label="老店店名">
+          <el-input v-model="postForm.old_store_name" placeholder="" style="width: 300px;" />
+        </el-form-item>
+        <el-form-item prop="store_name" label="店号">
+          <el-input v-model="postForm.store_name" placeholder="" style="width: 300px;" />
+        </el-form-item>
+        <el-form-item prop="store_num" label="申请第几家店">
+          <el-input v-model="postForm.store_num" placeholder="" style="width: 600px;" />
+        </el-form-item>
+        <el-form-item prop="address" label="意向开店位置">
+          <el-input v-model="postForm.address" placeholder="" style="width: 300px;" />
+        </el-form-item>
+        <el-form-item prop="staff_num" label="分店有几位员工">
+          <el-input v-model="postForm.staff_num" placeholder="" style="width: 300px;" />
+        </el-form-item>
+        <el-form-item prop="manager" label="分店管理者">
+          <el-input v-model="postForm.manager" placeholder="" style="width: 300px;" />
+        </el-form-item>
+        <el-form-item prop="old_order_rate" label="老店小程序点单占比">
+          <el-input v-model="postForm.old_order_rate" placeholder="" style="width: 300px;" />
+        </el-form-item>
+        <el-form-item prop="old_profit" label="老店月净利润">
+          <el-input v-model="postForm.old_profit" placeholder="" style="width: 300px;" />
+        </el-form-item>
+        <el-form-item prop="old_take_out" label="老店外卖评分">
+          <el-input v-model="postForm.old_take_out" placeholder="" style="width: 300px;" />
+        </el-form-item>
+        <el-row>
+          <el-button v-if="!isEdit" v-loading="loading" type="success" @click="submitForm">
+            查看
+          </el-button>
+          <el-button v-if="isEdit" v-loading="loading" type="success" @click="updateArticle">
+            返回
+          </el-button>
+        </el-row>
+      </div>
+    </el-form>
+  </div>
+</template>
+
+<script>
+
+// import Upload from '@/components/Upload/SingleImage3'
+
+// import Sticky from '@/components/Sticky' // 粘性header组件
+// import { validURL } from '@/utils/validate'
+import { fetchBranchJoin } from '@/api/branchJoin'
+// import Warning from './Warning'
+// import { CommentDropdown, PlatformDropdown, SourceUrlDropdown } from './Dropdown'
+
+const defaultForm = {
+  // status: 'draft',
+  redirect: '', // 文章题目
+  status: true, // 文章内容
+  position: 1, // 文章摘要
+  url: '', // 文章外链
+  cover_img: '', // 文章图片
+  display_time: undefined, // 前台展示时间
+  id: undefined,
+  platforms: ['a-platform'],
+  comment_disabled: false,
+  importance: 0
+}
+
+export default {
+  name: 'ArticleDetail',
+  components: { },
+  props: {
+    isEdit: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data() {
+    return {
+      postForm: Object.assign({}, defaultForm),
+      loading: false,
+      userListOptions: [],
+      rules: {
+      },
+      tempRoute: {},
+      labelPosition: 'left'
+    }
+  },
+  computed: {
+  },
+  created() {
+    if (this.isEdit) {
+      const id = this.$route.params && this.$route.params.id
+      this.fetchData(id)
+    }
+    // Why need to make a copy of this.$route here?
+    // Because if you enter this page and quickly switch tag, may be in the execution of the setTagsViewTitle function, this.$route is no longer pointing to the current page
+    // https://github.com/PanJiaChen/vue-element-admin/issues/1221
+    this.tempRoute = Object.assign({}, this.$route)
+  },
+  methods: {
+    fetchData(id) {
+      fetchBranchJoin(id).then(response => {
+        this.postForm = response.data.info
+        // set tags view title
+        // this.setTagsViewTitle()
+        // set page title
+        // this.setPageTitle()
+      }).catch(err => {
+        console.log(err)
+      })
+    },
+    setPageTitle() {
+      const title = 'Edit Article'
+      document.title = `${title} - ${this.postForm.id}`
+    },
+    submitForm() {
+      this.$refs.postForm.validate(valid => {
+        if (valid) {
+          this.loading = true
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
+    updateArticle() {
+      console.log(this.postForm)
+      this.$router.push(`/branchJoin/list`)
+    },
+    draftForm() {
+      if (this.postForm.content.length === 0 || this.postForm.title.length === 0) {
+        this.$message({
+          message: '请填写必要的标题和内容',
+          type: 'warning'
+        })
+        return
+      }
+      this.$message({
+        message: '保存成功',
+        type: 'success',
+        showClose: true,
+        duration: 1000
+      })
+      this.postForm.status = 'draft'
+    },
+    formatCreatePosition(position) {
+      switch (position) {
+        case 1:
+          return 'HOME'
+        case 2:
+          return 'ACTIVITY'
+      }
+    },
+    editPosition(position) {
+      switch (position) {
+        case 'HOME':
+          return 1
+        case 'ACTIVITY':
+          return 2
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+@import "~@/styles/mixin.scss";
+
+.createPost-container {
+  position: relative;
+
+  .createPost-main-container {
+    padding: 40px 45px 20px 50px;
+
+    .postInfo-container {
+      position: relative;
+      @include clearfix;
+      margin-bottom: 10px;
+
+      .postInfo-container-item {
+        float: left;
+      }
+    }
+  }
+
+  .word-counter {
+    width: 40px;
+    position: absolute;
+    right: 10px;
+    top: 0px;
+  }
+}
+
+.article-textarea ::v-deep {
+  textarea {
+    padding-right: 40px;
+    resize: none;
+    border: none;
+    border-radius: 0px;
+    border-bottom: 1px solid #bfcbd9;
+  }
+}
+</style>

+ 41 - 0
src/views/branchJoin/components/Dropdown/Comment.vue

@@ -0,0 +1,41 @@
+<template>
+  <el-dropdown :show-timeout="100" trigger="click">
+    <el-button plain>
+      {{ !comment_disabled?'Comment: opened':'Comment: closed' }}
+      <i class="el-icon-caret-bottom el-icon--right" />
+    </el-button>
+    <el-dropdown-menu slot="dropdown" class="no-padding">
+      <el-dropdown-item>
+        <el-radio-group v-model="comment_disabled" style="padding: 10px;">
+          <el-radio :label="true">
+            Close comment
+          </el-radio>
+          <el-radio :label="false">
+            Open comment
+          </el-radio>
+        </el-radio-group>
+      </el-dropdown-item>
+    </el-dropdown-menu>
+  </el-dropdown>
+</template>
+
+<script>
+export default {
+  props: {
+    value: {
+      type: Boolean,
+      default: false
+    }
+  },
+  computed: {
+    comment_disabled: {
+      get() {
+        return this.value
+      },
+      set(val) {
+        this.$emit('input', val)
+      }
+    }
+  }
+}
+</script>

+ 46 - 0
src/views/branchJoin/components/Dropdown/Platform.vue

@@ -0,0 +1,46 @@
+<template>
+  <el-dropdown :hide-on-click="false" :show-timeout="100" trigger="click">
+    <el-button plain>
+      Platfroms({{ platforms.length }})
+      <i class="el-icon-caret-bottom el-icon--right" />
+    </el-button>
+    <el-dropdown-menu slot="dropdown" class="no-border">
+      <el-checkbox-group v-model="platforms" style="padding: 5px 15px;">
+        <el-checkbox v-for="item in platformsOptions" :key="item.key" :label="item.key">
+          {{ item.name }}
+        </el-checkbox>
+      </el-checkbox-group>
+    </el-dropdown-menu>
+  </el-dropdown>
+</template>
+
+<script>
+export default {
+  props: {
+    value: {
+      required: true,
+      default: () => [],
+      type: Array
+    }
+  },
+  data() {
+    return {
+      platformsOptions: [
+        { key: 'a-platform', name: 'a-platform' },
+        { key: 'b-platform', name: 'b-platform' },
+        { key: 'c-platform', name: 'c-platform' }
+      ]
+    }
+  },
+  computed: {
+    platforms: {
+      get() {
+        return this.value
+      },
+      set(val) {
+        this.$emit('input', val)
+      }
+    }
+  }
+}
+</script>

+ 38 - 0
src/views/branchJoin/components/Dropdown/SourceUrl.vue

@@ -0,0 +1,38 @@
+<template>
+  <el-dropdown :show-timeout="100" trigger="click">
+    <el-button plain>
+      Link
+      <i class="el-icon-caret-bottom el-icon--right" />
+    </el-button>
+    <el-dropdown-menu slot="dropdown" class="no-padding no-border" style="width:400px">
+      <el-form-item label-width="0px" style="margin-bottom: 0px" prop="source_uri">
+        <el-input v-model="source_uri" placeholder="Please enter the content">
+          <template slot="prepend">
+            URL
+          </template>
+        </el-input>
+      </el-form-item>
+    </el-dropdown-menu>
+  </el-dropdown>
+</template>
+
+<script>
+export default {
+  props: {
+    value: {
+      type: String,
+      default: ''
+    }
+  },
+  computed: {
+    source_uri: {
+      get() {
+        return this.value
+      },
+      set(val) {
+        this.$emit('input', val)
+      }
+    }
+  }
+}
+</script>

+ 3 - 0
src/views/branchJoin/components/Dropdown/index.js

@@ -0,0 +1,3 @@
+export { default as CommentDropdown } from './Comment'
+export { default as PlatformDropdown } from './Platform'
+export { default as SourceUrlDropdown } from './SourceUrl'

+ 9 - 0
src/views/branchJoin/components/Warning.vue

@@ -0,0 +1,9 @@
+<template>
+  <aside>
+    <!--<a
+      href="https://panjiachen.github.io/vue-element-admin-site/guide/essentials/tags-view.html"
+      target="_blank"
+    >Document</a>-->
+  </aside>
+</template>
+

+ 13 - 0
src/views/branchJoin/create.vue

@@ -0,0 +1,13 @@
+<template>
+  <article-detail :is-edit="false" />
+</template>
+
+<script>
+import ArticleDetail from './components/ArticleDetail'
+
+export default {
+  name: 'CreateArticle',
+  components: { ArticleDetail }
+}
+</script>
+

+ 13 - 0
src/views/branchJoin/edit.vue

@@ -0,0 +1,13 @@
+<template>
+  <article-detail :is-edit="true" />
+</template>
+
+<script>
+import ArticleDetail from './components/ArticleDetail'
+
+export default {
+  name: 'EditForm',
+  components: { ArticleDetail }
+}
+</script>
+

+ 224 - 0
src/views/branchJoin/list.vue

@@ -0,0 +1,224 @@
+<template>
+  <div class="app-container">
+    <div class="filter-container">
+      <el-input v-model="listQuery.mobile" placeholder="手机号" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />
+      <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">
+        搜索
+      </el-button>
+    </div>
+    <el-table v-loading="listLoading" :data="list" border fit highlight-current-row style="width: 100%">
+      <el-table-column align="center" label="ID" width="80">
+        <template slot-scope="scope">
+          <span>{{ scope.row.id }}</span>
+        </template>
+      </el-table-column>
+
+      <el-table-column width="180px" align="center" label="申请日期">
+        <template slot-scope="scope">
+          <span>{{ scope.row.create_time }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column class-name="status-col" label="手机号" align="center">
+        <template slot-scope="scope">
+          <span>{{ scope.row.mobile }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column class-name="status-col" label="老店合同人姓名" align="center">
+        <template slot-scope="scope">
+          <span>{{ scope.row.old_partner }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column class-name="status-col" label="老店店名" align="center">
+        <template slot-scope="scope">
+          <span>{{ scope.row.old_store_name }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column class-name="status-col" label="店号">
+        <template slot-scope="scope">
+          <span>{{ scope.row.store_name }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column class-name="status-col" label="状态" width="80px">
+        <template slot-scope="{row}">
+          <el-tag :type="row.status | statusFilter">
+            {{ row.status | statusFilterTxt }}
+          </el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="Actions" width="300" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-row>
+            <router-link :to="'/branchJoin/edit/'+scope.row.id">
+              <el-button type="primary" size="mini" icon="el-icon-edit" style="margin-right: 10px;">
+                查看
+              </el-button>
+            </router-link>
+            <el-button type="primary" size="mini" icon="el-icon-s-check" :disabled="(scope.row.status === 1 || scope.row.status === 3)" @click="handleUpdate(scope)">
+              {{ scope.row.status === 1 || scope.row.status === 3 ? '已处理' : '处理' }}
+            </el-button>
+            <!--<el-button type="danger" size="mini" icon="el-icon-delete" style="margin-left: 10px;" @click="handleDelete(scope)">
+              删除
+            </el-button>-->
+          </el-row>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.pageSize" @pagination="getList" />
+    <el-dialog title="处理" :visible.sync="dialogFormVisible">
+      <el-form ref="dataForm" :model="temp" label-position="left" label-width="70px" style="width: 400px; margin-left:50px;">
+        <el-form-item label="理由" prop="mark">
+          <el-input v-model="temp.mark" />
+        </el-form-item>
+        <el-form-item label="处理意见" prop="mark">
+          <template>
+            <el-radio-group v-model="temp.status">
+              <el-radio :label="1">同意</el-radio>
+              <el-radio :label="3">拒绝</el-radio>
+            </el-radio-group>
+          </template>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dialogFormVisible = false">
+          取消
+        </el-button>
+        <el-button type="primary" @click="updateData()">
+          确定
+        </el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { fetchList, deleteBranchJoin, dealBranchJoin, fetchBranchJoin } from '@/api/branchJoin'
+import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
+import waves from '@/directive/waves'
+
+export default {
+  name: 'ArticleList',
+  components: { Pagination },
+  directives: { waves },
+  filters: {
+    statusFilter(status) {
+      const statusMap = {
+        1: 'success',
+        3: 'info',
+        0: 'danger'
+      }
+      return statusMap[status]
+    },
+    statusFilterTxt(status) {
+      const statusMap = {
+        1: '同意',
+        3: '拒绝',
+        0: '未处理',
+        2: '删除'
+      }
+      return statusMap[status]
+    },
+    positionFilter(status) {
+      const statusMap = {
+        'HOME': 'success',
+        draft: 'info',
+        2: 'danger'
+      }
+      return statusMap[status]
+    }
+  },
+  data() {
+    return {
+      list: null,
+      total: 0,
+      listLoading: true,
+      listQuery: {
+        page: 1,
+        pageSize: 10
+      },
+      temp: {
+        id: undefined,
+        mark: '',
+        status: ''
+      },
+      dialogFormVisible: false
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    getList() {
+      this.listLoading = true
+      fetchList(this.listQuery).then(response => {
+        this.list = response.data.list
+        this.total = response.data.count
+        this.listLoading = false
+      })
+    },
+    handleFilter() {
+      this.listLoading = true
+      fetchList(this.listQuery).then(response => {
+        this.list = response.data.list
+        this.total = response.data.count
+        this.listLoading = false
+      })
+    },
+    handleDelete({ $index, row }) {
+      console.log(row.id)
+      this.$confirm('您确定要隐藏吗', '警告', {
+        confirmButtonText: '是的',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+        .then(async() => {
+          await deleteBranchJoin(row.id)
+          this.list.splice($index, 1)
+          this.$message({
+            type: 'success',
+            message: '隐藏成功'
+          })
+        })
+    },
+    async handleUpdate({ $index, row }) {
+      this.temp = Object.assign({}, row) // copy obj
+      this.dialogFormVisible = true
+      this.$nextTick(() => {
+        this.$refs['dataForm'].clearValidate()
+      })
+    },
+    async updateData() {
+      const tempData = Object.assign({}, this.temp)
+      await dealBranchJoin(tempData)
+      const rs = await fetchBranchJoin(tempData.id)
+      const index = this.list.findIndex(v => v.id === this.temp.id)
+      this.list.splice(index, 1, rs.data.info)
+      this.dialogFormVisible = false
+      this.$notify({
+        title: '成功',
+        message: '更新成功',
+        type: 'success',
+        duration: 2000
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.edit-input {
+  padding-right: 100px;
+}
+.cancel-btn {
+  position: absolute;
+  right: 15px;
+  top: 10px;
+}
+.filter-container{
+  margin-bottom: 20px;
+}
+.filter-item {
+  margin-right: 10px;
+}
+
+</style>

+ 1 - 1
vue.config.js

@@ -6,7 +6,7 @@ function resolve(dir) {
   return path.join(__dirname, dir)
 }
 
-const name = defaultSettings.title || 'vue Admin Template' // page title
+const name = defaultSettings.title || '阿姨合伙人' // page title
 
 // If your port is set to 80,
 // use administrator privileges to execute the command line.