wenjie 9 mesiacov pred
rodič
commit
72996005af

+ 19 - 1
src/api/goods.js

@@ -2,7 +2,7 @@
  * @Author: wj 1454560336@qq.com
  * @Date: 2023-11-09 11:35:30
  * @LastEditors: wenjie 1454560336@qq.com
- * @LastEditTime: 2024-08-30 10:10:11
+ * @LastEditTime: 2024-08-30 17:47:09
  * @FilePath: \admin-manage\src\api\goods.js
  * @Description: 
  * 
@@ -255,6 +255,15 @@ export function listShowTypes(data) {
   })
 }
 
+// 获取配置了的行政区
+export function listSetTypesRegions(data) {
+  return request({
+    url: '/productcenterserver/product/data/listSetTypesRegions',
+    method: 'post',
+    data
+  })
+}
+
 // 首页商品所有类型
 export function listAllTypes(data) {
   return request({
@@ -264,6 +273,15 @@ export function listAllTypes(data) {
   })
 }
 
+// 删除区域配置
+export function removeType(data) {
+  return request({
+    url: '/productcenterserver/product/data/deleteRegionShowType?regionCode='+data,
+    method: 'post',
+  })
+}
+
+
 // 设置首页商品展示类型
 export function setShowTypes(data) {
   return request({

+ 139 - 24
src/views/operationManage/goodsManage/homeGoodsSet.vue

@@ -4,6 +4,9 @@
     <div class="tab-list">
       <div class="tab" :class="[query.productType == ''?'active':'']" @click="handleTab('')">全部</div>
       <div class="tab" :class="[query.productType == item.value?'active':'']" v-for="item in tabList" :key="item.value" @click="handleTab(item.value)">{{item.label}}</div>
+    </div>
+    <div class="tab-list">
+      <div class="tab" :class="[query.regionCode == item.value?'active':'']" v-for="item in regionOptions" :key="item.value" @click="handleRegionCode(item.value)">{{item.label}}</div>
     </div>
      <div class="search">
       <div>
@@ -126,9 +129,7 @@
 
       <el-table-column align="center" label="操作">
         <template slot-scope="scope">
-          <!-- <el-button type="text" size="small" @click="handleEdit(scope.row)"
-            >编辑</el-button
-          > -->
+   
           <el-button type="text" size="small" @click="handleDel(scope.row,true)"
             >加入黑名单</el-button
           >
@@ -231,9 +232,7 @@
 
         <el-table-column align="center" label="操作">
           <template slot-scope="scope">
-            <!-- <el-button type="text" size="small" @click="handleEdit(scope.row)"
-              >编辑</el-button
-            > -->
+
             <el-button type="text" size="small" @click="handleDel(scope.row,false)"
               >移除黑名单</el-button
             >
@@ -257,7 +256,61 @@
     </el-dialog>
 
 <el-dialog title="产品配置" width="550px" :visible.sync="dialogFormVisible1">
-    <el-form label-width="130px" :model="setQuery1"
+  <el-table
+        :data="tableData2"
+        tooltip-effect="dark"
+        border
+        v-loading="loading"
+        style="width: 100%"
+      >
+      <el-table-column
+          align="center"
+          label="行政区域"
+          prop="产品信息"
+          show-overflow-tooltip
+        >
+        <template slot-scope="scope">
+          <div v-if="editList.indexOf(scope.row.regionCod) == -1">
+            {{productType[scope.row.productType]||'暂无分类'}}
+          </div>
+           <el-select v-else v-model="scope.row.regionCode" filterable placeholder="请搜索选择区域">
+            <el-option
+              v-for="item in cityOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+        </template>
+        </el-table-column>
+     
+        <el-table-column
+          align="center"
+          label="产品类型"
+          prop="productType"
+          show-overflow-tooltip
+        >
+        <template slot-scope="scope">
+          {{productType[scope.row.productType]||'暂无分类'}}
+        </template>
+        </el-table-column>
+
+        <el-table-column align="center" label="操作">
+          <template slot-scope="scope">
+            <el-button type="text" size="small" @click="handleEdit(scope.row.regionCode)"
+              > 编辑</el-button
+            >
+             <el-button type="text" size="small" @click="handleEdit(scope.row.regionCode)"
+              > 保存 </el-button
+            >
+
+            <el-button type="text" size="small" @click="handleRemove(scope.row.regionCode)"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+    <!-- <el-form label-width="130px" :model="setQuery1"
       ref="setQuery1"
       :rules="rules1">
         <el-form-item label="产品类型"  prop="type">
@@ -271,7 +324,7 @@
               </el-option>
             </el-select>
         </el-form-item>
-    </el-form>
+    </el-form> -->
   <div slot="footer" class="dialog-footer">
     <el-button @click="dialogFormVisible1 = false">取 消</el-button>
     <el-button type="primary" :loading="btnLoading1" @click="save1">确 定</el-button>
@@ -301,15 +354,21 @@
   
   <script>
 import { debounce } from "@/utils/index";
-import { homeGoodsList,setHidden,listShowTypes,listAllTypes,setShowTypes,setTop,listHidden } from "@/api/goods";
+import { homeGoodsList,setHidden,listShowTypes,listAllTypes,setShowTypes,setTop,listHidden,removeType,listSetTypesRegions } from "@/api/goods";
+import { getCityList } from "@/api/common";
+
 export default {
   name: "marketing",
   data() {
     return {
+      regionOptions:[],
+      cityOptions:[],
+      editList:[],
       date:'',
       title:'',
       tableData: [],
       tableData1: [],
+      tableData2: [],
       loading: false,
       btnLoading: false,
       dialogFormVisible: false,
@@ -334,7 +393,15 @@ export default {
       total: 0,
       total1: 0,
       setQuery1:{
-        type:''
+        "region": [
+          "区域"
+        ],
+        "regionCode": [
+          "区域编码"
+        ],
+        "types": [
+          "显示产品类型"
+        ]
       },
       options:[],
       setQuery:{
@@ -439,6 +506,10 @@ export default {
       this.query.productType = val
       this.handleSearch()
     },
+    handleRegionCode(val){
+       this.query.regionCode = val
+      this.handleSearch()
+    },
     handleSetting(){
       this.dialogFormVisible1 = true
       
@@ -447,18 +518,35 @@ export default {
         this.query.page = 1;
         this.getList();
     },
-    handleEdit(row){
-        this.title = '编辑'
-      this.dialogFormVisible = true
-      this.setQuery = {
-        "activityContent": row.activityContent,
-        "activityId": row.activityId,
-        "activityMoney": row.activityMoney,
-        "endTime": row.endTime,
-        "startTime": row.startTime,
-        "id":row.id
-      }
-      this.date = [row.startTime, row.endTime]
+    handleRemove(code){
+      this.$confirm(`此操作将${str}该数据, 是否继续?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          removeType(code).then(res=>{
+            if(res.state == 'Success'){
+               this.$notify({
+                title: '成功',
+                message: '操作成功',
+                type: 'success'
+              });
+              if(hidden){
+                this.getList()
+
+              }else{
+                this.listHidden()
+              }
+            }
+          })
+        })
+    },
+    handleEdit(code){
+      if(this.editList.indexOf(code) == -1){
+        this.editList.push(code)
+      }else{
+        this.editList = this.editList.filter(item => item != code)
+       }
     },
     handleAdd() {
         this.title = '添加'
@@ -601,7 +689,7 @@ export default {
       });
     },
     listShowTypes(){
-      listShowTypes().then(res=>{
+      listShowTypes({paged:false}).then(res=>{
         if (res.state == "Success") {
           this.tabList = []
           res.content.map(item=>{
@@ -640,7 +728,7 @@ export default {
         this.$refs.setQuery1.validate((v) => {
         if (v) {
           this.btnLoading1 = true
-          setShowTypes(this.setQuery1.type).then(res=>{
+          setShowTypes(this.setQuery1).then(res=>{
             this.btnLoading1 = false
             if(res.state == 'Success'){
                 this.dialogFormVisible1 = false
@@ -679,9 +767,34 @@ export default {
         }
       });
     },
+    getCityList() {
+      this.loading = true
+      getCityList({name:'',
+        page: 0,
+        size: 999,}).then((res) => {
+        this.loading = false
+        if (res.state == "Success") {
+          this.cityOptions = res.content.content.map(item => {
+            return {
+              value: item.code,
+              label: item.name
+              }
+            })
+        }
+      });
+    },
+    listSetTypesRegions() {
+      listSetTypesRegions().then((res) => {
+        if (res.state == "Success") {
+          this.regionOptions = res.content
+        }
+      });
+    }
   
   },
   created() {
+    this.listSetTypesRegions();
+    this.getCityList();
     this.getList();
     this.listAllTypes()
     this.listShowTypes()
@@ -695,6 +808,8 @@ export default {
     display: flex;
     align-items: center;
     padding-bottom: 20px;
+    flex-wrap: wrap;
+    width: 100%;
     .tab{
       font-size: 14px;
       color: #222;