ymy 1 year ago
parent
commit
d3d051d5c9
2 changed files with 89 additions and 3 deletions
  1. 9 0
      src/api/base/adManage.js
  2. 80 3
      src/views/base/adManage/index.vue

+ 9 - 0
src/api/base/adManage.js

@@ -23,4 +23,13 @@ export function detailHandle(id) {
     url: '/plan/'+id,
     method: 'get'
   })
+}
+
+//修改时间段
+export function updateTime(data) {
+  return request({
+    url: '/plan/update/time',
+    method: 'put',
+    params:data
+  })
 }

+ 80 - 3
src/views/base/adManage/index.vue

@@ -1,6 +1,19 @@
 <template>
   <div class="adManage">
     <moduleView :propConfig="config" ref="view" v-loading="load" @pagination="pagination" @onRefresh="getList" @resert="queryList" @search="queryList" @detail="detail" />
+
+    <vxe-modal v-model="show" width="600" height="300" show-footer title="修改时间段">
+      <div class="cont">
+        <div class="label">时间段:</div>
+        <el-date-picker v-model="timeValue" type="datetimerange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" ></el-date-picker>
+      </div>
+      <template #footer>
+        <div class="btn">
+          <el-button plain @click="show = false">取消</el-button>
+          <el-button type="primary" @click="updateHandle">新增</el-button>
+        </div>
+      </template>
+    </vxe-modal>
   </div>
 </template>
 
@@ -10,8 +23,12 @@
   import goodsImg from "./components/goodsImg.vue";
   import equipList from "./components/equipList.vue";
   import rangTime from './components/rangTime.vue';
-  import {list,upDownShelves,detailHandle} from '@/api/base/adManage'
+  import {list,upDownShelves,detailHandle,updateTime} from '@/api/base/adManage'
+  import Format from '@/benyun/utils/dateFormat'
 
+  const timeValue = ref([])
+  const show = ref(false)
+  const formValue = ref()
   const config = ref({
     attr:{
       calculateH:true
@@ -59,7 +76,7 @@
     tool:{
       tools:{
         search:true,
-        refresh:true
+        refresh:true,
       }
     },
     table:{
@@ -79,6 +96,11 @@
         isDetail:true,
         field:'planName',
       },
+      {
+        title:'广告图',
+        field:'goodsLogo',
+        component:shallowRef(goodsImg)
+      },
       {
         title:'商品图片',
         field:'goodsImg',
@@ -145,6 +167,15 @@
               upDownShelvesHandle(item.planId)
             }
           }
+        },{
+          name:'编辑',
+          event:{
+            click:item => {
+              show.value = true;
+              formValue.value = item;
+              timeValue.value = [item.planStartTime, item.planEndTime];
+            }
+          }
         }]
       }]
     },
@@ -198,10 +229,16 @@
           // }],
           [{
             label:'广告图片',
-            colspan:3,
+            colspan:1,
             prop:'goodsLogo',
             showComp:true,
             component:shallowRef(goodsImg)
+          },{
+            label:'商品图片',
+            colspan:2,
+            prop:'goodsImg',
+            showComp:true,
+            component:shallowRef(goodsImg)
           }],
           [{
             label:'推广设备',
@@ -232,6 +269,36 @@
     })
   }
 
+  const updateHandle = () => {
+    
+    if(timeValue.value.length != 2){
+      proxy.$message({
+        showClose: true,
+        message: '请选择时间段!',
+      })
+      return
+    }
+    load.value = true
+    updateTime(
+      {
+        planId:formValue.value.planId,
+        planStartTime: Format(timeValue.value[0],'yyyy-MM-dd HH:mm:ss'),
+        planEndTime: Format(timeValue.value[1],'yyyy-MM-dd HH:mm:ss')
+      }
+    ).then(res => {
+      load.value = false;
+      proxy.$message({
+        showClose: true,
+        message: '修改成功',
+        type: 'success'
+      })
+      show.value = false;
+      getList()
+    }).catch(()=>{
+      load.value = false
+    })
+  }
+
   const detail = row => {
     // config.value.modal.tool.tools.save = true;
     delete config.value.modal.tool.tools.add;
@@ -310,4 +377,14 @@
   width: 100%;
   height: 100%;
 }
+.cont{
+  width: 100%;
+  display: flex;
+  align-items: center;
+  padding-top: 30px;
+  .label{
+    width: 100px;
+    text-align: right;
+  }
+}
 </style>