Browse Source

秒杀修改

chengjunhui 1 month ago
parent
commit
79c8c52ec8

+ 42 - 0
src/api/marketing/groupBooking.js

@@ -0,0 +1,42 @@
+import request from '@/utils/request'
+
+// 查询拼团活动列表
+export function groupBookingActivityPage_api(query) {
+    return request({
+        url: '/admin/groupBuy/groupBuyActivity/page',
+        method: 'get',
+        params: query
+    })
+}
+// 删除拼团活动
+export function groupBookingActivityDel_api(ids) {
+    return request({
+        url: `/admin/groupBuy/groupBuyActivity/del/${ids}`,
+        method: 'post',
+    })
+}
+
+// 新增拼团活动
+export function groupBookingActivityAdd_api (data) {
+  return request({
+    url: '/admin/groupBuy/groupBuyActivity/add',  
+    method: 'post',
+    data
+  })
+}
+// 修改拼团活动
+export function groupBookingActivityEdit_api (data) {
+  return request({
+    url: '/admin/groupBuy/groupBuyActivity/edit',
+    method: 'post',
+    data
+  })
+}
+
+// 获取拼团活动详细信息
+export function groupBookingActivityInfo_api (id) {
+  return request({
+    url: `/admin/groupBuy/groupBuyActivity/info/${id}`,
+    method: 'get',
+  })
+}

+ 9 - 1
src/api/marketing/seckill.js

@@ -16,6 +16,14 @@ export function seckillActivityDel_api(ids) {
     })
 }
 
+// 提交废弃秒杀活动
+export function seckillActivityDiscard_api(id) {
+    return request({
+        url: `/seckill/seckillActivity/discard/${id}`,
+        method: 'post',
+    })
+}
+
 // 新增秒杀活动
 export function seckillActivityAdd_api (data) {
   return request({
@@ -53,7 +61,7 @@ export function seckillActivityProductPage_api(query) {
 // 删除秒杀活动商品
 export function seckillActivityProductDel_api(ids) {
     return request({
-        url: `/seckill/seckillActivity/del/${ids}`,
+        url: `/seckill/seckillActivityProduct/del/${ids}`,
         method: 'post',
     })
 }

+ 9 - 1
src/views/marketing/seckill/components/ActivityPdAdd.vue

@@ -91,7 +91,7 @@
               ></el-input-number>
             </template>
           </el-table-column>
-          <el-table-column prop="originalStock" align="center" label="库存">
+          <el-table-column prop="originalStock" align="center" label="库存" v-if="showInventory">
           </el-table-column>
           <el-table-column prop="stock" align="center" label="投放数量">
             <template slot-scope="scope">
@@ -169,6 +169,12 @@ import {
 } from "@/api/marketing/seckill";
 
 export default {
+  props: {
+    showInventory: {
+      type: Boolean,
+      default: true,
+    },
+  },
   data() {
     return {
       visible: false,
@@ -237,8 +243,10 @@ export default {
         seckillActivityProductInfo_api(id).then((res) => {
           if (res && res.code == 200) {
             this.dataForm = res.data;
+            this.dataList = res.data.productSkuSetList || [];
           }
         });
+        return;
       }
       this.dataList = skuList;
     },

+ 4 - 4
src/views/marketing/seckill/components/SeckillAddUpdate.vue

@@ -82,11 +82,11 @@
         />
         <div>上传jpg/png文件;尺寸建议750x268</div>
       </el-form-item>
-      <el-form-item label="活动说明" prop="explain">
+      <el-form-item label="活动说明" prop="explainInfo">
         <el-input
           type="textarea"
           placeholder=""
-          v-model="dataForm.explain"
+          v-model="dataForm.explainInfo"
           :maxlength="200"
         ></el-input>
       </el-form-item>
@@ -219,7 +219,7 @@ export default {
 
       if (id != undefined) {
         seckillActivityInfo_api(id).then((res) => {
-          if (res && res.data.code == 200) {
+          if (res && res.code == 200) {
             res.data.weekList = res.data.weekList || [];
             this.dataForm = res.data;
 
@@ -243,7 +243,7 @@ export default {
         endHour: "",
         endTime: "",
         imgUrl: "",
-        explain: "",
+        explainInfo: "",
         closeTime: "",
         cycleMode: "",
         weekList: [],

+ 11 - 18
src/views/marketing/seckill/list.vue

@@ -78,9 +78,8 @@
         </template>
       </el-table-column>
       <el-table-column
-        prop="active_state"
+        prop="activeTimeState"
         align="center"
-        :formatter="activeState"
         label="活动状态"
       >
         <template slot-scope="scope">
@@ -130,7 +129,7 @@
             type="text"
             size="small"
             @click="goSeckillStop(scope.row.id)"
-            v-if="scope.row.activeState == 1 && !scope.row.discard"
+            v-if="scope.row.activeTimeState == 1 && !scope.row.discard"
             >终止</el-button
           >
         </template>
@@ -153,7 +152,7 @@
 </template>
 
 <script>
-import { seckillActivityPage_api } from "@/api/marketing/seckill";
+import { seckillActivityPage_api, seckillActivityDel_api, seckillActivityDiscard_api } from "@/api/marketing/seckill";
 import getListApi from "@/mixins/getListApi";
 import SeckillAddUpdate from "./components/SeckillAddUpdate";
 
@@ -194,8 +193,8 @@ export default {
       }
     },
     // 活动状态
-    activeState(row, column) {
-      let status = row.activeState;
+    activeTimeState(row, column) {
+      let status = row.activeTimeState;
       if (status === 0) {
         return "未开始";
       } else if (status === 1) {
@@ -226,12 +225,9 @@ export default {
         type: "warning",
       })
         .then(() => {
-          seviceApi.delSeckillactivity(id).then((res) => {
-            if (res && res.data.code == 200) {
-              this.$message({
-                message: "删除成功",
-                type: "success",
-              });
+          seckillActivityDel_api(id).then((res) => {
+            if (res && res.code == 200) {
+              this.$message.success("删除成功");
               this.getList();
             }
           });
@@ -245,12 +241,9 @@ export default {
         type: "warning",
       })
         .then(() => {
-          sysService.seckillStop(id).then((res) => {
-            if (res && res.data.code == 200) {
-              this.$message({
-                message: "终止成功",
-                type: "success",
-              });
+          seckillActivityDiscard_api(id).then((res) => {
+            if (res && res.code == 200) {
+              this.$message.success("终止成功");
               this.getList();
             }
           });

+ 5 - 8
src/views/marketing/seckill/seckillPd.vue

@@ -85,6 +85,7 @@
     <!-- 弹窗,  修改 -->
     <ActivityPdAdd
       ref="activityPdAddRef"
+      :showInventory="false"
       @updataList="updataList"
     ></ActivityPdAdd>
   </div>
@@ -92,7 +93,7 @@
 
 <script>
 import getListApi from "@/mixins/getListApi";
-import { seckillActivityProductPage_api } from "@/api/marketing/seckill";
+import { seckillActivityProductPage_api, seckillActivityProductDel_api } from "@/api/marketing/seckill";
 
 import ActivityPdAdd from "./components/ActivityPdAdd";
 // import seviceApi from "@/api/serviceApi.js";
@@ -115,7 +116,6 @@ export default {
   },
   methods: {
     updataList() {
-      debugger;
       this.getList();
     },
     // 新增
@@ -141,12 +141,9 @@ export default {
         type: "warning",
       })
         .then(() => {
-          seviceApi.delSeckillActivityGoods(id).then((res) => {
-            if (res && res.data.code == 200) {
-              this.$message({
-                message: "删除成功",
-                type: "success",
-              });
+          seckillActivityProductDel_api(id).then((res) => {
+            if (res && res.code == 200) {
+              this.$message.success("删除成功");
               this.getList();
             }
           });

+ 2 - 0
src/views/marketing/seckill/seckillPdAddUpdate.vue

@@ -116,6 +116,8 @@ export default {
         v.id = undefined;
         v.originalStock = v.stock ? v.stock * 1 : 0;
         v.stock = 0;
+        v.createTime = undefined;
+        v.updateTime = undefined;
         return v;
       });
       this.$nextTick(() => {