Jelajahi Sumber

商品审核

LiuJ 1 bulan lalu
induk
melakukan
edcb4cd879

+ 29 - 0
src/api/news.js

@@ -152,6 +152,35 @@ export function getJobHuntingData(data) {
     data
   })
 }
+export function updateGoodStatus(data) {
+  return request({
+    url: '/news/updateGoodStatus',
+    method: 'post',
+    data
+  })
+}
+export function updateJobHuntingStatus(data) {
+  return request({
+    url: '/news/updateJobHuntingStatus',
+    method: 'post',
+    data
+  })
+}
+export function updateNoticeStatus(data) {
+  return request({
+    url: '/news/updateNoticeStatus',
+    method: 'post',
+    data
+  })
+}
+export function updateComplaintStatus(data) {
+  return request({
+    url: '/news/updateComplaintStatus',
+    method: 'post',
+    data
+  })
+}
+
 //20250306求职
 
 

+ 16 - 0
src/router/index.js

@@ -433,6 +433,22 @@ export const constantRoutes = [
         }
       ]
     },
+    {
+      path: '/goodListApply',
+      component: Layout,
+      children: [
+        {
+          name: '',
+          path: '',
+          component: () => import('@/views/news/GoodListApply'),
+          meta: {
+            title: '商品待审核列表',
+            hidden: true,
+            breadcrumb: true
+          }
+        }
+      ]
+    },
     {
         path: '/addGood',
         component: Layout,

+ 44 - 1
src/store/modules/news.js

@@ -3,7 +3,8 @@ import { getArticleList, addArticle, delArticle, getArticleInfo, updateArticle,
   getGoodInfo, updateGood, websiteList, getWebsiteNavList, getWebsiteNavPool, getWebsiteNavPoolSite,
   getSurveyList,getSurveyInfo, getJobHuntingList, getJobHuntingInfo,addJobHunting,delJobHunting,updateJobHunting,getJobHuntingData,
   getComplaintList,
-  getComplaintInfo, updateComplaint, deleteComplaint,  addComplaint1,  getMSG,  getNoticeList, getNoticeInfo, addNotice, updateNotice, deleteNotice
+  getComplaintInfo, updateComplaint, deleteComplaint,  addComplaint1,  getMSG,  getNoticeList, getNoticeInfo, addNotice, updateNotice, deleteNotice,
+  updateGoodStatus, updateJobHuntingStatus, updateNoticeStatus, updateComplaintStatus,
 } from '@/api/news'
 
 const state = {
@@ -209,6 +210,48 @@ const actions = {
       })
     })
   },
+  updateGoodStatus
+  ({ commit }, data)  {
+    return new Promise((resolve, reject) => {
+      updateGoodStatus(data).then(response => {
+        resolve(response)
+      }).catch(error => {
+        reject(error)
+      })
+    })
+  },
+  updateJobHuntingStatus
+  ({ commit }, data)  {
+    return new Promise((resolve, reject) => {
+      updateJobHuntingStatus(data).then(response => {
+        resolve(response)
+      }).catch(error => {
+        reject(error)
+      })
+    })
+  },
+  updateNoticeStatus
+  ({ commit }, data)  {
+    return new Promise((resolve, reject) => {
+      updateNoticeStatus(data).then(response => {
+        resolve(response)
+      }).catch(error => {
+        reject(error)
+      })
+    })
+
+  }
+  ,
+  updateComplaintStatus
+  ({ commit }, data)  {
+    return new Promise((resolve, reject) => {
+      updateComplaintStatus(data).then(response => {
+        resolve(response)
+      }).catch(error => {
+        reject(error)
+      })
+    })
+  },
   //20250306  求职信息
 
 

+ 28 - 4
src/views/news/GoodList.vue

@@ -35,7 +35,15 @@
               <el-input placeholder="请输入网站名称" autocomplete="off" v-model="getApiData.category_name" />
             </div>
           </el-col>
-
+          <!-- <el-col :span="8">
+            <div class="searchBox"></div>
+            <div class="searchTitle">审核状态:</div>
+            <el-select v-model="getApiData.status" placeholder="请选择..">
+              <el-option label="待审核" value="1"></el-option>
+              <el-option label="已审核" value="2"></el-option>
+              <el-option label="已拒绝" value="3"></el-option>
+            </el-select>
+          </el-col> -->
         </el-row>
       </div>
     </div>
@@ -75,16 +83,31 @@
 
             </el-table-column>
             <el-table-column prop="category_name" label="导航池名称" width=""></el-table-column>
-            <el-table-column prop="created_at" label="创建时间" width=""></el-table-column>
+            <el-table-column prop="status" label="审核状态" width="">
+              <template slot-scope="scope">
+                <span v-if="scope.row.status == 1">
+                  待审核
+                </span>
+                <span v-if="scope.row.status == 2">
+                  已审核
+                </span>
+                <span v-if="scope.row.status == 3">
+                  已拒绝
+                </span>
+              </template>
+            </el-table-column>
+
             <el-table-column prop="updated_at" label="修改时间" width=""></el-table-column>
 
             <el-table-column fixed="right" label="操作" width="200" header-align="center">
               <template slot-scope="scope">
                 <div class="listBtnBox">
                   <div class="listDeleteBtn" @click="deleteRow(scope.row.id, tableData)"><i
-                      class="el-icon-delete"></i>删除</div>
+                      class="el-icon-delete"></i>删除
+                  </div>
                   <div class="listEditBtn" @click="goEdit(scope.row.id, tableData)"><i
-                      class="el-icon-edit-outline"></i>编辑</div>
+                      class="el-icon-edit-outline"></i>编辑
+                  </div>
                 </div>
               </template>
             </el-table-column>
@@ -128,6 +151,7 @@ export default {
         category_name: "",//导航池id
         website_name: "",//网站名称
         type_id: "",//发布类型
+        status: 2,//审核状态 1待审核 2已审核 3已拒绝
 
         page: 1,//当前是第几页
         page_size: 10,//一共多少条

+ 367 - 0
src/views/news/GoodListApply.vue

@@ -0,0 +1,367 @@
+<template>
+  <div class="mainBox">
+    <!--搜索功能 start------------------------------------------------------------>
+    <div class="layerBox_search">
+      <div class="layerBoxLine">
+        <el-row>
+          <el-col :span="8">
+            <div class="searchBox">
+              <div class="searchTitle">发布类型:</div>
+              <el-select v-model="getApiData.type_id" placeholder="请选择..">
+                <el-option label="供应商品" value="1"></el-option>
+                <el-option label="求购商品" value="2"></el-option>
+              </el-select>
+            </div>
+          </el-col>
+          <el-col :span="8">
+            <div class="searchBox">
+              <div class="searchTitle">名称:</div>
+              <el-input placeholder="请输入名称" autocomplete="off" v-model="getApiData.name" />
+            </div>
+          </el-col>
+          <el-col :span="8">
+            <div class="searchBox">
+              <div class="searchTitle">网站名称:</div>
+              <el-input placeholder="请输入网站名称" autocomplete="off" v-model="getApiData.website_name" />
+            </div>
+          </el-col>
+        </el-row>
+      </div>
+      <div class="layerBoxLineTwo">
+        <el-row>
+          <el-col :span="8">
+            <div class="searchBox">
+              <div class="searchTitle">导航名称:</div>
+              <el-input placeholder="请输入网站名称" autocomplete="off" v-model="getApiData.category_name" />
+            </div>
+          </el-col>
+          <!-- <el-col :span="8">
+            <div class="searchBox"></div>
+            <div class="searchTitle">审核状态:</div>
+            <el-select v-model="getApiData.status" placeholder="请选择..">
+              <el-option label="待审核" value="1"></el-option>
+              <el-option label="已审核" value="2"></el-option>
+              <el-option label="已拒绝" value="3"></el-option>
+            </el-select>
+          </el-col> -->
+        </el-row>
+      </div>
+    </div>
+
+    <div class="layerBoxNoBg">
+      <div>
+        <el-button type="primary" @click="goCreat">发布商品</el-button>
+      </div>
+      <div>
+        <el-button @click="clearSearchList">重置</el-button>
+        <el-button type="primary" @click="getData('search')">搜索</el-button>
+      </div>
+    </div>
+    <!--搜索功能 end------------------------------------------------------------>
+
+    <!--表格内容 start------------------------------------------------------------>
+    <div class="layerBox">
+      <tableTitle :name="tableDivTitle" />
+      <el-row>
+        <template>
+          <el-table :data="tableData" style="width: 100%">
+            <el-table-column fixed prop="id" label="编号" width="50"></el-table-column>
+            <el-table-column prop="type_id" label="发布类型" width="">
+
+              <template slot-scope="scope">
+                <span v-if="scope.row.type_id == 1">
+                  供应商品
+                </span>
+                <span v-if="scope.row.type_id == 2">
+                  求购商品
+                </span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="name" label="名称" width=""></el-table-column>
+            <el-table-column prop="cityname" label="发布地点" width=""></el-table-column>
+            <el-table-column prop="website_name" label="网站名称" width="">
+
+            </el-table-column>
+            <el-table-column prop="category_name" label="导航池名称" width=""></el-table-column>
+            <el-table-column prop="status" label="审核状态" width="">
+              <template slot-scope="scope">
+                <span v-if="scope.row.status == 1">
+                  待审核
+                </span>
+                <span v-if="scope.row.status == 2">
+                  已审核
+                </span>
+                <span v-if="scope.row.status == 3">
+                  已拒绝
+                </span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="updated_at" label="修改时间" width=""></el-table-column>
+
+            <el-table-column fixed="right" label="操作" width="200" header-align="center">
+              <template slot-scope="scope">
+                <div class="listBtnBox">
+
+                  <div class="listMainBtn" @click="getUpRow(scope.row.id, tableData)"><i class="el-icon-check"></i>审核
+                  </div>
+                  <div class="listDeleteBtn" @click="deleteRow(scope.row.id, tableData)"><i
+                      class="el-icon-delete"></i>删除
+                  </div>
+                  <div class="listEditBtn" @click="goEdit(scope.row.id, tableData)"><i
+                      class="el-icon-edit-outline"></i>编辑
+                  </div>
+                </div>
+              </template>
+            </el-table-column>
+          </el-table>
+        </template>
+      </el-row>
+    </div>
+    <!--分页 start------------------------------------------------------------>
+    <div class="alignBox">
+      <el-row>
+        <el-col :span="24">
+          <el-pagination @size-change="handleSizeChange" :current-page="getApiData.page"
+            @current-change="handleCurrentChange" :page-size="10" layout="total, prev, pager, next, jumper"
+            :total="allCount"></el-pagination>
+        </el-col>
+      </el-row>
+    </div>
+    <!--分页 end------------------------------------------------------------>
+    <!--弹出框1:外部表单弹出框 start------------------------------------------------------------>
+    <el-dialog title="请输入驳回理由" :visible.sync="examineWindow" :close-on-click-modal="false">
+      <el-form :model="form" ref="form" :rules="formRules" label-position="left">
+        <div class="formDiv">
+          <el-form-item label="驳回原因:" :label-width="formLabelWidth" prop="reason" class="custom-align-right">
+            <el-input type="textarea" v-model="form.reason" class="custom-textarea" placeholder="请输入驳回原因"
+              :rows="3"></el-input>
+          </el-form-item>
+        </div>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <div>
+          <el-button type="info" @click="examineWindow = false">取消</el-button>
+          <el-button type="primary" @click="examineToServe">确定</el-button>
+        </div>
+      </div>
+    </el-dialog>
+    <!--弹出框1:外部表单弹出框 end------------------------------------------------------------>
+
+    <!--表格内容 end------------------------------------------------------------>
+  </div>
+</template>
+
+<script>
+//表格标题
+import tableTitle from './components/tableTitle';
+//引入公用样式
+import '@/styles/global.less';
+
+export default {
+  components: {
+    tableTitle,//表格标题
+  },
+  data() {
+    return {
+      //1.列表和分页相关 start ------------------------------------------------------------>
+      tableDivTitle: "商品列表",
+      tableData: [],//内容
+      editId: 0,//要修改的网站id.
+      examineWindow: false,//审核窗口
+      getApiData: {
+        name: "",//标题
+        category_name: "",//导航池id
+        website_name: "",//网站名称
+        type_id: "",//发布类型
+        status1: 1,//审核状态 1待审核 2已审核 3已拒绝
+
+        page: 1,//当前是第几页
+        page_size: 10,//一共多少条
+      },
+      //提交驳回
+      form: {
+        reason: ""
+      },
+      allCount: 0,//总条数
+      //分页相关 end ------------------------------------------------------------>
+
+    }
+  },
+  methods: {
+    //提交驳回内容
+    examineToServe(id) {
+      this.$refs.form.validate(valid => {
+        if (valid) {
+          let data = {
+            id: this.editId,
+            status: 3,//驳回status
+            reason: this.form.reason
+          }
+          this.$store.dispatch('news/updateGoodStatus', data).then(res => {
+            if (res.code == 200) {
+              this.$message({
+                type: 'success',
+                message: '操作成功!'
+              });
+              this.getData();
+              this.form.reason = "";//清空上一次的输入
+              this.examineWindow = false;
+            }
+          })
+        } else {
+          this.$message.error("驳回理由不能为空!")
+        }
+      })
+    },
+    getUpRow(id) {
+      //设置待审核的id
+      this.editId = id;
+      console.log(id)
+      this.$confirm('将此商品通过审核吗?', '提示', {
+        confirmButtonText: '通过',
+        cancelButtonText: '拒绝',
+        type: 'warning'
+      }).then(() => {
+        this.upRow(id, 2)
+      }).catch(() => {
+        //输入驳回理由
+        console.log("驳回")
+        this.examineWindow = true;
+      })
+    },
+    //1.列表和分页相关 start ------------------------------------------------------------>
+    //1.1 开始请求列表信息方法
+    getData(type) {
+      if (type == "search") {
+        this.getApiData.page = 1;
+      }
+      console.log(this.getApiData, '---1--')
+      this.$store.dispatch('news/getGoodList', this.getApiData).then(res => {
+        //格式化:islink=0为不使用外面 islink=1为使用外链
+        //status=1为显示 status=2为不显示
+        console.log(this.getApiData, '---2-')
+        let data = [];
+        for (let item of res.data.rows) {
+          // if(item.status==0){item.status="隐藏"}
+          // if(item.status==1){item.status="显示"}
+          // if(item.status==404){item.status="已删除"}
+          // if (item.islink == 0) { item.islink = "否" }
+          // if (item.islink == 1) { item.islink = "是" }
+          data.push(item)
+        }
+        this.tableData = res.data.rows; //给与内容
+        this.allCount = res.data.count; //给与总条数
+      }).catch(() => {
+        this.$message({
+          type: 'warning',
+          message: '网络错误,请重试!'
+        });
+      })
+    },
+    //1.2 删除内容
+    deleteRow(id) {
+      this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        console.log("当前删除:" + id)
+        this.$store.dispatch('news/delGood', { id: id }).then(res => {
+          this.getData();
+          this.$message({
+            type: 'success',
+            message: '删除成功!'
+          });
+        }).catch(() => {
+          this.$message({
+            type: 'warning',
+            message: '网络错误,请重试!'
+          });
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'warning',
+          message: '已取消删除'
+        });
+      });
+    },
+    //1.3 修改网站状态
+    upRow(id, status) {
+      let data = {
+        id: id,
+        status: status
+      }
+      this.$store.dispatch('news/updateGoodStatus', data).then(res => {
+        if (res.code == 200) {
+          this.$message({
+            type: 'success',
+            message: '商品状态已修改!'
+          });
+          this.getData();
+        }
+      }).catch(() => {
+        this.$message({
+          type: 'warning',
+          message: '已取消删除'
+        });
+      });
+    },
+    //1.4 列表内容分页
+    //直接跳转
+    handleSizeChange(val) {
+      this.getApiData.page = val;
+      this.getData();
+    },
+    //1.5 点击分页
+    handleCurrentChange(val) {
+      this.getApiData.page = val;
+      this.getData();
+    },
+    //1.6 重置按钮
+    clearSearchList() {
+      this.tableData = [];
+      this.getApiData.name = "";
+      this.getApiData.category_name = "";
+      this.getApiData.type_id = "";
+      this.getApiData.website_name = "";
+
+      this.getApiData.page = 1;
+      this.getApiData.pageSize = 10;
+      this.getData();
+    },
+    //列表和分页相关 end ------------------------------------------------------------>
+
+    //2.添加新闻 start ------------------------------------------------------------>
+    //跳转到商品发布页面
+    goCreat() {
+      this.$router.push({
+        path: '/addGood',
+      });
+    },
+    goEdit(id) {
+      let data = {
+        id: id
+      }
+      this.$router.push({
+        path: '/addGood',
+        query: data
+      });
+    }
+    //添加新闻 end ------------------------------------------------------------>
+  },
+  mounted() {
+    //1.获得初始数据
+    this.getData();
+  }
+}
+</script>
+
+<style scoped lang="less">
+.listBtnBox div {
+  width: 90px;
+  cursor: pointer;
+  font-size: 14px;
+
+}
+</style>

+ 47 - 1
src/views/news/addGood.vue

@@ -157,6 +157,7 @@
 </template>
 
 <script>
+import { getWebSiteId, getUseType } from '@/utils/auth'
 //表格标题
 import tableTitle from './components/tableTitle';
 //引入公用样式
@@ -211,6 +212,7 @@ export default {
       searchCascaderKey: 0, //列表缓存key
       // imgurl: ['http://192.168.1.127:9501/image/20250227/1740674706184955.jpg', 'http://192.168.1.127:9501/image/20250227/1740674706184955.jpg'],//图片路径
       website_id: 2,
+
       //提交表单
       form: {
         //1.1使用了外链
@@ -407,6 +409,32 @@ export default {
       ]
       //表单项 end ------------------------------------------------------------>
     };
+  },
+  watch: {
+    '$route'(to, from) {
+      console.log(from, '---------------------------------------');
+      // 监听路由参数中的 id 变化,若变化则更新页面状态并获取数据
+      if (to.query.id) {
+        this.getMainData();
+      }
+    },
+
+
+    // 监听路由参数中的 id 变化,若变化则更新页面状态并获取数据
+    // '$route.query.id': function (newVal, oldVal) {
+    //   console.log('当前 id:', newVal, '旧的 id:', oldVal);
+    //   if (newVal) {
+    //     this.editStatus = true;
+    //     this.tableDivTitle = "编辑资讯";
+    //     //     // 调用方法名保持大小写一致
+    //     this.getMainData();
+    //   } else {
+    //     this.editStatus = false;
+    //     this.tableDivTitle = "添加资讯";
+    //   }
+    // }
+
+
   },
   methods: {
     async fetchWebsiteOptions() {
@@ -428,7 +456,7 @@ export default {
         console.log(res)
         this.userType = res.data.type_id;
         if (this.userType == 10000) {
-          this.form.website_id = res.data.website_id !== undefined ? res.data.website_id : 2;;
+          this.form.website_id = getWebSiteId() !== undefined ? getWebSiteId() : 2;;
         }
         //if(res.data.type_id==10000){}//管理员
         //if(res.data.type_id==4){}//调研员
@@ -504,6 +532,14 @@ export default {
             this.form.hits = null;
           }
           console.log(this.form, '提交的数据')
+          //判断用户身份
+          if (this.user_type == 10000) {
+            console.log("用户身份为管理员,无需审核直接发布!")
+            this.form.status = 2;
+          } else {
+            console.log("用户身份为其他用户,提交到审核!")
+            this.form.status = 1;
+          }
           this.$store.dispatch('news/addGood', this.form).then(res => {
             if (res.code == 200) {
               //汇报结果
@@ -653,6 +689,15 @@ export default {
           }
           this.form.imgurl = this.imgurl;
           //console.log(this.form)
+          //判断用户身份
+          if (this.user_type == 10000) {
+            console.log("用户身份为管理员,无需审核直接发布!")
+            this.form.status = 2;
+          } else {
+            console.log("用户身份为其他用户,提交到审核!")
+            this.form.status = 1;
+          }
+
           this.$store.dispatch('news/updateGood', this.form).then(res => {
             if (res.code != 200) {
               this.$message.error("修改失败,请稍后再试!");
@@ -737,6 +782,7 @@ export default {
     }
   },
   mounted() {
+    this.user_type = getUseType();
     //1.判断是新建还是回显
     if (this.$route.query.id != undefined) {
       this.editId = this.$route.query.id;