潘超林 před 1 měsícem
rodič
revize
a8b533517a

+ 37 - 7
src/views/activity/add.vue

@@ -62,6 +62,12 @@
             <el-button type="primary" size="mini" @click="spuSelect"
               >选择商品</el-button
             >
+            <el-button
+              size="mini"
+              @click="removeRow"
+              v-if="tabList && tabList.length > 0"
+              >批量移除</el-button
+            >
             <el-table
               v-if="tabList && tabList.length > 0"
               v-loading="loading"
@@ -135,12 +141,14 @@
               <el-table-column label="类型" align="center" width="120">
                 <template slot-scope="scope">
                   {{
-                    scope.row.spuType == 0
-                      ? "农商商品"
-                      : scope.row.spuType == 1
+                    scope.row.scope == 1
+                      ? "农商批发商品"
+                      : scope.row.scope == 3
                       ? "同城秒送商品"
-                      : scope.row.spuType == 2
+                      : scope.row.scope == 4
                       ? "会员专区"
+                      : scope.row.scope == 2
+                      ? "同城特价商品"
                       : ""
                   }}
                 </template>
@@ -199,16 +207,28 @@ export default {
         ],
       },
       shopInfo: {
-        type: 1,
+        type: 2,
         showType: 0,
       },
       tabSelects: [],
       spuSelectList: [],
       tabList: [],
+      selectRow: null,
     };
   },
   mounted() {},
   methods: {
+    handleSelectionChange(val) {
+      this.selectRow = val;
+    },
+    removeRow() {
+      const filteredArray = this.tabList.filter(
+        (item1) => !this.selectRow.some((item2) => item2.id === item1.id)
+      );
+      console.log(filteredArray);
+      this.shopInfo.spuList = filteredArray;
+      this.tabList = filteredArray;
+    },
     cancel() {
       this.$confirm("是否确认取消,当前页面所进行的操作将不会保存?", "提示", {
         confirmButtonText: "确定",
@@ -234,11 +254,21 @@ export default {
       this.spuSelectList = val;
     },
     shopDialogSubmit() {
-      this.tabList = this.spuSelectList;
+      if (this.tabList) {
+        this.tabList = [...this.tabList, ...this.spuSelectList];
+      } else {
+        this.tabList = this.spuSelectList;
+      }
       this.shopDialog = false;
     },
     submitForm() {
-      let ids = this.tabList.map((item) => item.id);
+      let ids = [];
+      if (this.tabList) {
+        ids = this.tabList.map((item) => item.id);
+      } else {
+        this.$message.error("请选择商品!");
+        return;
+      }
       this.shopInfo.orderSpuIds = `[${ids.toString()}]`;
       this.$refs.form.validate((valid) => {
         if (valid) {

+ 13 - 10
src/views/activity/components/spulist.vue

@@ -27,16 +27,17 @@
           @change="cascaderChange"
         />
       </el-form-item>
-      <el-form-item label="类型" prop="spuType">
+      <el-form-item label="类型" prop="scope">
         <el-select
-          v-model="queryParams.spuType"
+          v-model="queryParams.scope"
           placeholder="请选择类型"
           style="width: 140px"
         >
           <el-option label="全部" value=""> </el-option>
-          <el-option label="农商商品" :value="0"> </el-option>
-          <el-option label="同城秒送商品" :value="1"> </el-option>
-          <el-option label="会员专区" :value="2"> </el-option>
+          <el-option label="农商批发商品" :value="1"> </el-option>
+          <el-option label="同城特价商品" :value="2"> </el-option>
+          <el-option label="同城秒送商品" :value="3"> </el-option>
+          <el-option label="会员专区商品" :value="4"> </el-option>
         </el-select>
       </el-form-item>
       <el-form-item label="商品状态" prop="spuStatus">
@@ -133,12 +134,14 @@
       <el-table-column label="类型" align="center" width="120">
         <template slot-scope="scope">
           {{
-            scope.row.spuType == 0
-              ? "农商商品"
-              : scope.row.spuType == 1
+            scope.row.scope == 1
+              ? "农商批发商品"
+              : scope.row.scope == 3
               ? "同城秒送商品"
-              : scope.row.spuType == 2
+              : scope.row.scope == 4
               ? "会员专区"
+               : scope.row.scope == 2
+              ? "同城特价商品"
               : ""
           }}
         </template>
@@ -182,7 +185,7 @@ export default {
         key: "",
         categoryId: "",
         categoryName: "",
-        spuType: "",
+        scope: "",
       },
       // 表单参数
       form: {},

+ 6 - 5
src/views/activity/detail.vue

@@ -129,12 +129,14 @@
               <el-table-column label="类型" align="center" width="120">
                 <template slot-scope="scope">
                   {{
-                    scope.row.spuType == 0
-                      ? "农商商品"
-                      : scope.row.spuType == 1
+                    scope.row.scope == 1
+                      ? "农商批发商品"
+                      : scope.row.scope == 3
                       ? "同城秒送商品"
-                      : scope.row.spuType == 2
+                      : scope.row.scope == 4
                       ? "会员专区"
+                      : scope.row.scope == 2
+                      ? "同城特价商品"
                       : ""
                   }}
                 </template>
@@ -173,7 +175,6 @@ export default {
             const orderEndTime = new Date(this.shopInfo.orderEndTime);
             this.shopInfo.dateRange = [orderStartTime, orderEndTime];
             console.log(this.shopInfo);
-
           }
         }
       });

+ 21 - 6
src/views/activity/edit.vue

@@ -141,12 +141,14 @@
               <el-table-column label="类型" align="center" width="120">
                 <template slot-scope="scope">
                   {{
-                    scope.row.spuType == 0
-                      ? "农商商品"
-                      : scope.row.spuType == 1
+                    scope.row.scope == 1
+                      ? "农商批发商品"
+                      : scope.row.scope == 3
                       ? "同城秒送商品"
-                      : scope.row.spuType == 2
+                      : scope.row.scope == 4
                       ? "会员专区"
+                      : scope.row.scope == 2
+                      ? "同城特价商品"
                       : ""
                   }}
                 </template>
@@ -253,8 +255,15 @@ export default {
           if (this.shopInfo.orderStartTime) {
             const orderStartTime = new Date(this.shopInfo.orderStartTime);
             const orderEndTime = new Date(this.shopInfo.orderEndTime);
-            this.shopInfo.dateRange = [orderStartTime, orderEndTime];
+            // this.shopInfo.dateRange = [orderStartTime, orderEndTime];
+
+            this.$set(this.shopInfo, "dateRange", [
+              orderStartTime,
+              orderEndTime,
+            ]);
+
             this.tabList = this.shopInfo.spuList;
+
             console.log(this.tabList);
           }
         }
@@ -279,7 +288,13 @@ export default {
       this.shopDialog = false;
     },
     submitForm() {
-      let ids = this.tabList.map((item) => item.id);
+      let ids = [];
+      if (this.tabList) {
+        ids = this.tabList.map((item) => item.id);
+      } else {
+        this.$message.error("请选择商品!");
+        return;
+      }
       this.shopInfo.orderSpuIds = `[${ids.toString()}]`;
       this.$refs.form.validate((valid) => {
         if (valid) {

+ 7 - 2
src/views/activity/index.vue

@@ -13,7 +13,7 @@
           placeholder="输入主题名称关键字搜索"
           clearable
           style="width: 240px"
-          @keyup.enter.native="handleQuery"
+        @keyup.enter.native="handleQuery"
         />
       </el-form-item>
 
@@ -55,7 +55,11 @@
     >
       <el-table-column label="ID" align="center" prop="id" />
       <el-table-column label="名称" align="center" prop="title" />
-      <el-table-column label="满减条件" align="center" prop="discountRule" />
+      <el-table-column label="满减条件" align="center" prop="discountRule">
+        <template slot-scope="scope">
+          满{{ scope.row.fullAmount }}元,减{{ scope.row.returnAmount }}元
+        </template>
+      </el-table-column>
       <el-table-column label="活动时间" align="center">
         <template slot-scope="scope">
           {{
@@ -124,6 +128,7 @@ export default {
         orderEndTime: "",
         orderStartTime: "",
         publishType: 0,
+        type: 2,
       },
       // 表单参数
       form: {},

+ 42 - 22
src/views/discount/add.vue

@@ -53,9 +53,13 @@
             <el-form-item
               v-for="(item, index) in shopInfo.discountRule"
               :label="
-                item.index == 1
-                  ? '首件价格(元)'
-                  : '第' + item.index + '件价格(元)'
+                shopInfo.discountType == 0
+                  ? item.index == 1
+                    ? '首件价格(元)'
+                    : '第' + item.index + '件价格(元)'
+                  : item.index == 1
+                  ? '首件折扣(%)'
+                  : '第' + item.index + '件折扣(%)'
               "
               :key="index"
               style="margin-top: 30px"
@@ -64,7 +68,7 @@
                 v-model="item.discountVal"
                 style="width: 130px"
                 :controls="false"
-                max="9999"
+                :max="shopInfo.discountType == 1 ? 100 : 9999"
                 min=""
                 step="1"
               ></el-input-number>
@@ -105,12 +109,7 @@
               @selection-change="handleSelectionChange"
               row-key="id"
             >
-              <el-table-column
-                type="selection"
-                width="55"
-                align="center"
-                :selectable="checkSelectable"
-              />
+              <el-table-column type="selection" width="55" align="center" />
               <el-table-column label="商品Id" align="center" prop="id" />
               <el-table-column label="商品信息" align="center">
                 <template slot-scope="scope">
@@ -171,12 +170,14 @@
               <el-table-column label="类型" align="center" width="120">
                 <template slot-scope="scope">
                   {{
-                    scope.row.spuType == 0
-                      ? "农商商品"
-                      : scope.row.spuType == 1
+                    scope.row.scope == 1
+                      ? "农商批发商品"
+                      : scope.row.scope == 3
                       ? "同城秒送商品"
-                      : scope.row.spuType == 2
+                      : scope.row.scope == 4
                       ? "会员专区"
+                      : scope.row.scope == 2
+                      ? "同城特价商品"
                       : ""
                   }}
                 </template>
@@ -235,20 +236,29 @@ export default {
         ],
       },
       shopInfo: {
-        type: 1,
+        type: 3,
         discountType: 0,
         discountRule: [{ index: 1, discountVal: "", discountType: 0 }],
       },
       tabSelects: [],
       spuSelectList: [],
       tabList: [],
+      selectRow: null,
     };
   },
   mounted() {},
   methods: {
-    removeRule() {
-      this.shopInfo.discountRule.splice(index, 1);
+    handleSelectionChange(val) {
+      this.selectRow = val;
     },
+    removeRow() {
+      const filteredArray = this.tabList.filter(
+        (item1) => !this.selectRow.some((item2) => item2.id === item1.id)
+      );
+      this.shopInfo.spuList = filteredArray;
+      this.tabList = filteredArray;
+    },
+
     addRule() {
       this.shopInfo.discountRule.push({
         index: this.shopInfo.discountRule.length + 1,
@@ -281,15 +291,25 @@ export default {
       this.spuSelectList = val;
     },
     shopDialogSubmit() {
-      this.tabList = this.spuSelectList;
+      if (this.tabList.length > 0) {
+        this.tabList = [...this.tabList, ...this.spuSelectList];
+      } else {
+        this.tabList = this.spuSelectList;
+      }
       this.shopDialog = false;
     },
     submitForm() {
       let obj = { ...this.shopInfo };
-      let ids = this.tabList.map((item) => item.id);
+      let ids = [];
+      if (this.tabList) {
+        ids = this.tabList.map((item) => item.id);
+      } else {
+        this.$message.error("请选择商品!");
+        return;
+      }
       obj.orderSpuIds = `[${ids.toString()}]`;
-      obj.discountRule[0].discountType = obj.discountType;
-      obj.discountRule = JSON.stringify(this.shopInfo.discountRule);
+      obj.discountRule = JSON.stringify(obj.discountRule);
+
       this.$refs.form.validate((valid) => {
         if (valid) {
           saveOrUpdates(obj).then((res) => {
@@ -297,7 +317,7 @@ export default {
               this.$message.success("保存成功!");
               this.$store.dispatch("tagsView/delView", this.$route); //关闭当前页
               this.$router.replace({
-                path: "/marketing/activity/index",
+                path: "/marketing/discount/index",
               });
             }
           });

+ 20 - 9
src/views/discount/components/spulist.vue

@@ -33,10 +33,19 @@
           placeholder="请选择类型"
           style="width: 140px"
         >
-          <el-option label="全部" value=""> </el-option>
-          <el-option label="农商商品" :value="0"> </el-option>
-          <el-option label="同城秒送商品" :value="1"> </el-option>
-          <el-option label="会员专区" :value="2"> </el-option>
+          <el-form-item label="类型" prop="scope">
+            <el-select
+              v-model="queryParams.scope"
+              placeholder="请选择类型"
+              style="width: 140px"
+            >
+              <el-option label="全部" value=""> </el-option>
+              <el-option label="农商批发商品" :value="1"> </el-option>
+          <el-option label="同城特价商品" :value="2"> </el-option>
+          <el-option label="同城秒送商品" :value="3"> </el-option>
+          <el-option label="会员专区商品" :value="4"> </el-option>
+            </el-select>
+          </el-form-item>
         </el-select>
       </el-form-item>
       <el-form-item label="商品状态" prop="spuStatus">
@@ -133,12 +142,14 @@
       <el-table-column label="类型" align="center" width="120">
         <template slot-scope="scope">
           {{
-            scope.row.spuType == 0
-              ? "农商商品"
-              : scope.row.spuType == 1
+            scope.row.scope == 1
+              ? "农商批发商品"
+              : scope.row.scope == 3
               ? "同城秒送商品"
-              : scope.row.spuType == 2
+              : scope.row.scope == 4
               ? "会员专区"
+               : scope.row.scope == 2
+              ? "同城特价商品"
               : ""
           }}
         </template>
@@ -182,7 +193,7 @@ export default {
         key: "",
         categoryId: "",
         categoryName: "",
-        spuType: "",
+        scope: "",
       },
       // 表单参数
       form: {},

+ 103 - 35
src/views/discount/detail.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form ref="form" :model="shopInfo" label-width="120px">
+    <el-form ref="form" :rules="rules" :model="shopInfo" label-width="120px">
       <el-row>
         <el-col :span="20">
           <el-form-item label="名称" prop="title">
@@ -10,6 +10,8 @@
               style="width: 300px"
               placeholder="请输入名称"
               v-model="shopInfo.title"
+              :show-word-limit="true"
+              :maxlength="12"
             ></el-input>
           </el-form-item>
 
@@ -31,44 +33,74 @@
             </el-date-picker>
           </el-form-item>
           <el-form-item
-            label="满减条件"
-            prop="fullAmount"
+            label="折扣条件"
+            prop="discountType"
             style="margin-top: 30px"
           >
-            满
-            <el-input
-              readonly
-              type="text"
-              style="width: 130px"
-              v-model="shopInfo.fullAmount"
-            ></el-input>
-
-            元 减
-            <el-input
-              readonly
-              type="text"
-              style="width: 130px"
-              v-model="shopInfo.returnAmount"
-            ></el-input>
+            <el-radio-group v-model="shopInfo.discountType" disabled>
+              <el-radio :label="0">固定金额</el-radio>
+              <el-radio :label="1">折扣</el-radio>
+            </el-radio-group>
           </el-form-item>
+
+          <div
+            style="
+              display: flex;
+              flex-direction: row;
+              align-items: center;
+              margin-left: 100px;
+              flex-wrap: wrap;
+            "
+          >
+            <el-form-item
+              v-for="(item, index) in shopInfo.discountRule"
+              :label="
+                shopInfo.discountType == 0
+                  ? item.index == 1
+                    ? '首件价格(元)'
+                    : '第' + item.index + '件价格(元)'
+                  : item.index == 1
+                  ? '首件折扣(%)'
+                  : '第' + item.index + '件折扣(%)'
+              "
+              :key="index"
+              style="margin-top: 30px"
+            >
+              <el-input-number
+                v-model="item.discountVal"
+                style="width: 130px"
+                :controls="false"
+                :max="shopInfo.discountType == 1 ? 100 : 9999"
+                min=""
+                step="1"
+              ></el-input-number>
+            </el-form-item>
+            <i
+              class="el-icon-circle-plus-outline"
+              @click="addRule"
+              style="
+                margin-top: 28px;
+                font-size: 22px;
+                color: #1288df;
+                margin-left: 10px;
+              "
+            ></i>
+          </div>
+          <span style="color: orange; margin-left: 100px"
+            >提示:未添加件数时,默认开始恢复原价</span
+          >
           <el-form-item
-            label="满减条件"
+            label="参与活动商品"
             prop="sendAmount"
             style="margin-top: 30px"
           >
             <el-table
-              v-if="shopInfo.spuList && shopInfo.spuList.length > 0"
-              v-loading="loading"
-              :data="shopInfo.spuList"
+              v-if="tabList && tabList.length > 0"
+              :data="tabList"
               @selection-change="handleSelectionChange"
               row-key="id"
             >
-              <el-table-column
-                type="selection"
-                width="55"
-                align="center"
-                :selectable="checkSelectable"
-              />
+              <el-table-column type="selection" width="55" align="center" />
               <el-table-column label="商品Id" align="center" prop="id" />
               <el-table-column label="商品信息" align="center">
                 <template slot-scope="scope">
@@ -129,12 +161,14 @@
               <el-table-column label="类型" align="center" width="120">
                 <template slot-scope="scope">
                   {{
-                    scope.row.spuType == 0
-                      ? "农商商品"
-                      : scope.row.spuType == 1
+                    scope.row.scope == 1
+                      ? "农商批发商品"
+                      : scope.row.scope == 3
                       ? "同城秒送商品"
-                      : scope.row.spuType == 2
+                      : scope.row.scope == 4
                       ? "会员专区"
+                      : scope.row.scope == 2
+                      ? "同城特价商品"
                       : ""
                   }}
                 </template>
@@ -148,32 +182,66 @@
 </template>
 
 <script>
-import moment from "moment";
 import { storeMarketingActivityInfo } from "@/api/marketing/activity";
 export default {
   data() {
     return {
+      shopDialog: false,
+      rules: {
+        title: [{ required: true, message: "请输入名称", trigger: "blur " }],
+        dateRange: [
+          { required: true, message: "请选择活动名称", trigger: "blur " },
+        ],
+        discountType: [
+          { required: true, message: "请选择折扣条件", trigger: "blur " },
+        ],
+      },
       shopInfo: {
         type: 1,
         showType: 0,
+        discountRule: [{ index: 1, discountVal: "", discountType: 0 }],
       },
+      tabSelects: [],
+      spuSelectList: [],
       tabList: [],
+      selectRow: [],
     };
   },
   mounted() {
     this.getInfoActivity();
   },
   methods: {
+    removeRow() {
+      const filteredArray = this.tabList.filter(
+        (item1) => !this.selectRow.some((item2) => item2.id === item1.id)
+      );
+      console.log(filteredArray);
+      this.shopInfo.spuList = filteredArray;
+      this.tabList = filteredArray;
+    },
     getInfoActivity() {
       storeMarketingActivityInfo(this.$route.query.id).then((res) => {
         if (res.code == 200) {
           this.shopInfo = res.data;
+          console.log(this.shopInfo);
           if (this.shopInfo.orderStartTime) {
             const orderStartTime = new Date(this.shopInfo.orderStartTime);
             const orderEndTime = new Date(this.shopInfo.orderEndTime);
-            this.shopInfo.dateRange = [orderStartTime, orderEndTime];
-            console.log(this.shopInfo);
+            // this.shopInfo.dateRange = [orderStartTime, orderEndTime];
+            this.$set(this.shopInfo, "dateRange", [
+              orderStartTime,
+              orderEndTime,
+            ]);
 
+            this.tabList = this.shopInfo.spuList;
+            if (this.shopInfo.discountRule) {
+              this.shopInfo.discountRule = this.shopInfo.discountRules;
+            } else {
+              this.shopInfo.discountRule = [
+                { index: 1, discountVal: "", discountType: 0 },
+              ];
+            }
+            console.log(this.shopInfo);
           }
         }
       });

+ 45 - 36
src/views/discount/edit.vue

@@ -53,9 +53,13 @@
             <el-form-item
               v-for="(item, index) in shopInfo.discountRule"
               :label="
-                item.index == 1
-                  ? '首件价格(元)'
-                  : '第' + item.index + '件价格(元)'
+                shopInfo.discountType == 0
+                  ? item.index == 1
+                    ? '首件价格(元)'
+                    : '第' + item.index + '件价格(元)'
+                  : item.index == 1
+                  ? '首件折扣(%)'
+                  : '第' + item.index + '件折扣(%)'
               "
               :key="index"
               style="margin-top: 30px"
@@ -64,7 +68,7 @@
                 v-model="item.discountVal"
                 style="width: 130px"
                 :controls="false"
-                max="9999"
+                :max="shopInfo.discountType == 1 ? 100 : 9999"
                 min=""
                 step="1"
               ></el-input-number>
@@ -99,17 +103,11 @@
             >
             <el-table
               v-if="tabList && tabList.length > 0"
-              v-loading="loading"
               :data="tabList"
               @selection-change="handleSelectionChange"
               row-key="id"
             >
-              <el-table-column
-                type="selection"
-                width="55"
-                align="center"
-                :selectable="checkSelectable"
-              />
+              <el-table-column type="selection" width="55" align="center" />
               <el-table-column label="商品Id" align="center" prop="id" />
               <el-table-column label="商品信息" align="center">
                 <template slot-scope="scope">
@@ -170,12 +168,14 @@
               <el-table-column label="类型" align="center" width="120">
                 <template slot-scope="scope">
                   {{
-                    scope.row.spuType == 0
-                      ? "农商商品"
-                      : scope.row.spuType == 1
+                    scope.row.scope == 1
+                      ? "农商批发商品"
+                      : scope.row.scope == 3
                       ? "同城秒送商品"
-                      : scope.row.spuType == 2
+                      : scope.row.scope == 4
                       ? "会员专区"
+                      : scope.row.scope == 2
+                      ? "同城特价商品"
                       : ""
                   }}
                 </template>
@@ -191,23 +191,14 @@
       </el-row>
     </el-form>
 
-    <el-dialog
-      :visible.sync="shopDialog"
-      width="50%"
-      :destroy-on-close="true"
-      @close="close"
-    >
+    <el-dialog :visible.sync="shopDialog" width="50%" :destroy-on-close="true">
       <SpuList
         :selectData="tabList"
         :dialog="false"
         @voucherChoose="voucherChooseSpu"
       ></SpuList>
 
-      <span
-        slot="footer"
-        class="dialog-footer"
-        v-if="$route.query.type != 'look'"
-      >
+      <span slot="footer" class="dialog-footer">
         <el-button @click="shopDialog = false">取 消</el-button>
         <el-button type="primary" @click="shopDialogSubmit">确 定</el-button>
       </span>
@@ -251,6 +242,13 @@ export default {
     this.getInfoActivity();
   },
   methods: {
+    addRule() {
+      this.shopInfo.discountRule.push({
+        index: this.shopInfo.discountRule.length + 1,
+        discountVal: "",
+        discountType: this.shopInfo.discountType,
+      });
+    },
     handleSelectionChange(val) {
       this.selectRow = val;
     },
@@ -280,21 +278,24 @@ export default {
       storeMarketingActivityInfo(this.$route.query.id).then((res) => {
         if (res.code == 200) {
           this.shopInfo = res.data;
+          console.log(this.shopInfo);
           if (this.shopInfo.orderStartTime) {
             const orderStartTime = new Date(this.shopInfo.orderStartTime);
             const orderEndTime = new Date(this.shopInfo.orderEndTime);
-            this.shopInfo.dateRange = [orderStartTime, orderEndTime];
+            // this.shopInfo.dateRange = [orderStartTime, orderEndTime];
+            this.$set(this.shopInfo, "dateRange", [
+              orderStartTime,
+              orderEndTime,
+            ]);
+
             this.tabList = this.shopInfo.spuList;
             if (this.shopInfo.discountRule) {
-              this.shopInfo.discountRule = JSON.parse(
-                this.shopInfo.discountRule
-              );
+              this.shopInfo.discountRule = this.shopInfo.discountRules;
             } else {
-              this.discountRule = [
+              this.shopInfo.discountRule = [
                 { index: 1, discountVal: "", discountType: 0 },
               ];
             }
-
             console.log(this.shopInfo);
           }
         }
@@ -319,16 +320,24 @@ export default {
       this.shopDialog = false;
     },
     submitForm() {
-      let ids = this.tabList.map((item) => item.id);
-      this.shopInfo.orderSpuIds = `[${ids.toString()}]`;
+      let obj = { ...this.shopInfo };
+      let ids = [];
+      if (this.tabList) {
+        ids = this.tabList.map((item) => item.id);
+      } else {
+        this.$message.error("请选择商品!");
+        return;
+      }
+      obj.orderSpuIds = `[${ids.toString()}]`;
+      obj.discountRule = JSON.stringify(obj.discountRule);
       this.$refs.form.validate((valid) => {
         if (valid) {
-          saveOrUpdates(this.shopInfo).then((res) => {
+          saveOrUpdates(obj).then((res) => {
             if (res.code == 200) {
               this.$message.success("保存成功!");
               this.$store.dispatch("tagsView/delView", this.$route); //关闭当前页
               this.$router.replace({
-                path: "/marketing/activity/index",
+                path: "/marketing/discount/index",
               });
             }
           });

+ 32 - 2
src/views/discount/index.vue

@@ -55,7 +55,36 @@
     >
       <el-table-column label="ID" align="center" prop="id" />
       <el-table-column label="名称" align="center" prop="title" />
-      <el-table-column label="满减条件" align="center" prop="discountRule" />
+      <el-table-column label="满减条件" align="center" prop="discountRule">
+        <template slot-scope="scope">
+          <span v-if="scope.row.discountRule && scope.row.discountType == 0">
+            <span
+              v-for="(item, index) in JSON.parse(scope.row.discountRule)"
+              :key="index"
+            >
+              <span v-if="item.index == 1"
+                >首件价格 {{ item.discountVal }}元</span
+              >
+              <span v-else
+                >第{{ item.index }}件价格 {{ item.discountVal }}元</span
+              ><br />
+            </span>
+          </span>
+          <span v-if="scope.row.discountRule && scope.row.discountType == 1">
+            <span
+              v-for="(item, index) in JSON.parse(scope.row.discountRule)"
+              :key="index"
+            >
+              <span v-if="item.index == 1"
+                >首件折扣 {{ item.discountVal }}%</span
+              >
+              <span v-else
+                >第{{ item.index }}件折扣 {{ item.discountVal }}%</span
+              ><br />
+            </span>
+          </span>
+        </template>
+      </el-table-column>
       <el-table-column label="活动时间" align="center">
         <template slot-scope="scope">
           {{
@@ -124,6 +153,7 @@ export default {
         orderEndTime: "",
         orderStartTime: "",
         publishType: 0,
+        type: 3,
       },
       // 表单参数
       form: {},
@@ -164,7 +194,7 @@ export default {
       });
     },
     handleRemove(record) {
-      this.$confirm("是否确认删除满减活动?", "提示", {
+      this.$confirm("是否确认删除首件折扣活动?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",

+ 376 - 0
src/views/fullReturn/add.vue

@@ -0,0 +1,376 @@
+<template>
+  <div class="app-container">
+    <el-form ref="form" :rules="rules" :model="shopInfo" label-width="180px">
+      <el-row>
+        <el-col :span="20">
+          <el-form-item label="名称" prop="title">
+            <el-input
+              type="text"
+              style="width: 300px"
+              placeholder="请输入名称"
+              v-model="shopInfo.title"
+              :show-word-limit="true"
+              :maxlength="12"
+            ></el-input>
+          </el-form-item>
+
+          <el-form-item
+            label="满返条件"
+            prop="fullAmount"
+            style="margin-top: 30px"
+          >
+            满
+            <el-input-number
+              v-model="shopInfo.fullAmount"
+              style="width: 130px"
+              :controls="false"
+              max="9999"
+              min=""
+              step="1"
+              placeholder="单笔下单金额"
+            ></el-input-number>
+            元 返
+            <el-input-number
+              v-model="shopInfo.returnAmount"
+              style="width: 130px"
+              :controls="false"
+              max="9999"
+              min=""
+              step="1"
+              placeholder="购物红包金额"
+            ></el-input-number>
+          </el-form-item>
+
+          <el-form-item
+            label="下单时间范围"
+            prop="orderType"
+            style="margin-top: 30px"
+          >
+            <el-radio-group v-model="shopInfo.orderType">
+              <el-radio :label="0">固定时间</el-radio>
+              <el-radio :label="1">长期有效</el-radio>
+            </el-radio-group>
+          </el-form-item>
+          <el-form-item>
+            <el-date-picker
+              v-model="shopInfo.dateRange"
+              type="datetimerange"
+              range-separator="-"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              @change="xddatePicker"
+            >
+            </el-date-picker>
+          </el-form-item>
+
+          <el-form-item
+            label="下单条件"
+            prop="orderTopNum"
+            style="margin-top: 30px"
+          >
+            下单前
+            <el-input-number
+              v-model="shopInfo.orderTopNum"
+              style="width: 130px"
+              :controls="false"
+              max="9999"
+              min=""
+              step="1"
+            ></el-input-number>
+            名
+          </el-form-item>
+
+          <el-form-item
+            label="购物红包使用时间范围"
+            prop="orderType"
+            style="margin-top: 30px"
+          >
+            <el-radio-group v-model="shopInfo.useType">
+              <el-radio :label="0">固定时间</el-radio>
+              <el-radio :label="1">长期有效</el-radio>
+            </el-radio-group>
+          </el-form-item>
+          <el-form-item>
+            <el-date-picker
+              v-model="shopInfo.dateRange1"
+              type="datetimerange"
+              range-separator="-"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              @change="datePicker"
+            >
+            </el-date-picker>
+          </el-form-item>
+
+          <el-form-item
+            label="参与活动商品"
+            prop="sendAmount"
+            style="margin-top: 30px"
+          >
+            <el-button type="primary" size="mini" @click="spuSelect"
+              >选择商品</el-button
+            >
+            <el-button
+              size="mini"
+              @click="removeRow"
+              v-if="tabList && tabList.length > 0"
+              >批量移除</el-button
+            >
+            <el-table
+              v-if="tabList && tabList.length > 0"
+              v-loading="loading"
+              :data="tabList"
+              @selection-change="handleSelectionChange"
+              row-key="id"
+            >
+              <el-table-column
+                type="selection"
+                width="55"
+                align="center"
+                :selectable="checkSelectable"
+              />
+              <el-table-column label="商品Id" align="center" prop="id" />
+              <el-table-column label="商品信息" align="center">
+                <template slot-scope="scope">
+                  <div
+                    style="
+                      display: flex;
+                      flex-direction: row;
+                      justify-content: space-between;
+                      align-items: center;
+                    "
+                  >
+                    <el-image
+                      style="width: 30px; height: 30px"
+                      :src="scope.row.pic"
+                      :preview-src-list="[scope.row.pic]"
+                    >
+                    </el-image>
+                    <div
+                      :title="scope.row.spuName"
+                      style="
+                        width: 80px;
+                        height: auto;
+                        word-wrap: break-word;
+                        overflow: hidden;
+                        text-overflow: ellipsis;
+                        white-space: nowrap;
+                      "
+                    >
+                      {{ scope.row.spuName }}
+                    </div>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="分类"
+                align="center"
+                prop="categoryName"
+              />
+              <el-table-column label="商品状态" align="center">
+                <template slot-scope="scope">
+                  {{
+                    scope.row.spuStatus == 2
+                      ? "售罄"
+                      : scope.row.spuStatus == 0
+                      ? "上架"
+                      : scope.row.spuStatus == 1
+                      ? "下架"
+                      : ""
+                  }}
+                </template>
+              </el-table-column>
+              <el-table-column label="销量" align="center" prop="salesVolume" />
+              <el-table-column label="价格" align="center" width="120">
+                <template slot-scope="scope">
+                  {{ scope.row.originalPrice }}元/{{ scope.row.unit }}
+                </template>
+              </el-table-column>
+              <el-table-column label="类型" align="center" width="120">
+                <template slot-scope="scope">
+                  {{
+                    scope.row.scope == 1
+                      ? "农商批发商品"
+                      : scope.row.scope == 3
+                      ? "同城秒送商品"
+                      : scope.row.scope == 4
+                      ? "会员专区"
+                      : scope.row.scope == 2
+                      ? "同城特价商品"
+                      : ""
+                  }}
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24" style="margin-top: 30px; text-align: center">
+          <el-button @click="cancel">取消</el-button>
+          <el-button type="primary" @click="submitForm">保存</el-button>
+          <!-- <el-button>取消</el-button> -->
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <el-dialog
+      :visible.sync="shopDialog"
+      width="50%"
+      :destroy-on-close="true"
+      @close="close"
+    >
+      <SpuList
+        :selectData="tabList"
+        :dialog="false"
+        @voucherChoose="voucherChooseSpu"
+      ></SpuList>
+
+      <span
+        slot="footer"
+        class="dialog-footer"
+        v-if="$route.query.type != 'look'"
+      >
+        <el-button @click="shopDialog = false">取 消</el-button>
+        <el-button type="primary" @click="shopDialogSubmit">确 定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import moment from "moment";
+import { saveOrUpdates } from "@/api/marketing/activity";
+import SpuList from "./components/spulist.vue";
+export default {
+  components: { SpuList },
+  data() {
+    return {
+      shopDialog: false,
+      rules: {
+        title: [{ required: true, message: "请输入名称", trigger: "blur " }],
+        dateRange: [
+          { required: true, message: "请选择活动名称", trigger: "blur " },
+        ],
+        fullAmount: [
+          { required: true, message: "请输入满减条件", trigger: "blur " },
+        ],
+        orderType: [
+          { required: true, message: "请选择下单时间范围", trigger: "blur " },
+        ],
+        orderTopNum: [
+          { required: true, message: "请选择下单条件", trigger: "blur " },
+        ],
+        useType: [
+          {
+            required: true,
+            message: "请选择购物红包使用范围",
+            trigger: "blur ",
+          },
+        ],
+      },
+      shopInfo: {
+        type: 1,
+        showType: 0,
+      },
+      tabSelects: [],
+      spuSelectList: [],
+      tabList: [],
+      selectRow: null,
+    };
+  },
+  mounted() {},
+  methods: {
+    handleSelectionChange(val) {
+      this.selectRow = val;
+    },
+    removeRow() {
+      const filteredArray = this.tabList.filter(
+        (item1) => !this.selectRow.some((item2) => item2.id === item1.id)
+      );
+      this.shopInfo.spuList = filteredArray;
+      this.tabList = filteredArray;
+    },
+    cancel() {
+      this.$confirm("是否确认取消,当前页面所进行的操作将不会保存?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.$store.dispatch("tagsView/delView", this.$route); //关闭当前页
+          this.$router.replace({
+            path: "/marketing/fullReturn/index",
+          });
+        })
+        .catch(() => {});
+    },
+    xddatePicker(val) {
+      if (val) {
+        this.shopInfo.orderStartTime = moment(val[0]).valueOf();
+        this.shopInfo.orderEndTime = moment(val[1]).valueOf();
+      } else {
+        this.shopInfo.orderStartTime = "";
+        this.shopInfo.orderEndTime = "";
+      }
+    },
+    datePicker(val) {
+      if (val) {
+        this.shopInfo.useStartTime = moment(val[0]).valueOf();
+        this.shopInfo.useEndTime = moment(val[1]).valueOf();
+      } else {
+        this.shopInfo.useStartTime = "";
+        this.shopInfo.useEndTime = "";
+      }
+    },
+    spuSelect() {
+      this.shopDialog = true;
+    },
+    voucherChooseSpu(val) {
+      this.spuSelectList = val;
+    },
+    shopDialogSubmit() {
+      if (this.tabList.length > 0) {
+        this.tabList = [...this.tabList, ...this.spuSelectList];
+      } else {
+        this.tabList = this.spuSelectList;
+      }
+      this.shopDialog = false;
+    },
+    submitForm() {
+      let ids = [];
+      if (this.tabList) {
+        ids = this.tabList.map((item) => item.id);
+      } else {
+        this.$message.error("请选择商品!");
+        return;
+      }
+      this.shopInfo.orderSpuIds = `[${ids.toString()}]`;
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          saveOrUpdates(this.shopInfo).then((res) => {
+            if (res.code == 200) {
+              this.$message.success("保存成功!");
+              this.$store.dispatch("tagsView/delView", this.$route); //关闭当前页
+              this.$router.replace({
+                path: "/marketing/fullReturn/index",
+              });
+            }
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+    resetForm(formName) {
+      this.$refs[formName].resetFields();
+    },
+  },
+};
+</script>
+
+<style>
+.el-dialog__body {
+  padding: 0px 20px;
+}
+</style>

+ 288 - 0
src/views/fullReturn/components/spulist.vue

@@ -0,0 +1,288 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+      label-width="80px"
+    >
+      <el-form-item prop="key">
+        <el-input
+          v-model="queryParams.key"
+          placeholder="请输入商品名称/商品id"
+          clearable
+          style="width: 200px"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="商品分类" prop="categoryId">
+        <el-cascader
+          v-model="queryParams.categoryId"
+          ref="formCascader"
+          placeholder="请选择分类"
+          :props="categoryprops"
+          style="width: 120px"
+          @change="cascaderChange"
+        />
+      </el-form-item>
+      <el-form-item label="类型" prop="spuType">
+        <el-form-item label="类型" prop="scope">
+        <el-select
+          v-model="queryParams.scope"
+          placeholder="请选择类型"
+          style="width: 140px"
+        >
+          <el-option label="全部" value=""> </el-option>
+          <el-option label="农商批发商品" :value="1"> </el-option>
+          <el-option label="同城特价商品" :value="2"> </el-option>
+          <el-option label="同城秒送商品" :value="3"> </el-option>
+          <el-option label="会员专区商品" :value="4"> </el-option>
+        </el-select>
+      </el-form-item>
+      </el-form-item>
+      <el-form-item label="商品状态" prop="spuStatus">
+        <el-select
+          v-model="queryParams.spuStatus"
+          placeholder="请选择商品状态"
+          style="width: 140px"
+        >
+          <el-option label="全部" value=""> </el-option>
+          <el-option label="售罄" value="2"> </el-option>
+          <el-option label="上架" value="0"> </el-option>
+          <el-option label="下架" value="1"> </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button
+          type="primary"
+          icon="el-icon-search"
+          size="mini"
+          @click="handleQuery"
+          >搜索</el-button
+        >
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
+          >重置</el-button
+        >
+      </el-form-item>
+    </el-form>
+    <el-table
+      v-loading="loading"
+      :data="tableList"
+      @selection-change="handleSelectionChange"
+      row-key="id"
+    >
+      <el-table-column
+        type="selection"
+        width="55"
+        align="center"
+        :selectable="checkSelectable"
+      />
+      <el-table-column label="商品Id" align="center" prop="id" />
+      <el-table-column label="商品信息" align="center">
+        <template slot-scope="scope">
+          <div
+            style="
+              display: flex;
+              flex-direction: row;
+              justify-content: space-between;
+              align-items: center;
+            "
+          >
+            <el-image
+              style="width: 30px; height: 30px"
+              :src="scope.row.pic"
+              :preview-src-list="[scope.row.pic]"
+            >
+            </el-image>
+            <div
+              :title="scope.row.spuName"
+              style="
+                width: 80px;
+                height: auto;
+                word-wrap: break-word;
+                overflow: hidden;
+                text-overflow: ellipsis;
+                white-space: nowrap;
+              "
+            >
+              {{ scope.row.spuName }}
+            </div>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="分类" align="center" prop="categoryName" />
+      <el-table-column label="商品状态" align="center">
+        <template slot-scope="scope">
+          {{
+            scope.row.spuStatus == 2
+              ? "售罄"
+              : scope.row.spuStatus == 0
+              ? "上架"
+              : scope.row.spuStatus == 1
+              ? "下架"
+              : ""
+          }}
+        </template>
+      </el-table-column>
+      <el-table-column label="销量" align="center" prop="salesVolume" />
+      <el-table-column label="价格" align="center" width="120">
+        <template slot-scope="scope">
+          {{ scope.row.originalPrice }}元/{{ scope.row.unit }}
+        </template>
+      </el-table-column>
+      <el-table-column label="类型" align="center" width="120">
+        <template slot-scope="scope">
+          {{
+            scope.row.scope == 1
+              ? "农商批发商品"
+              : scope.row.scope == 3
+              ? "同城秒送商品"
+              : scope.row.scope == 4
+              ? "会员专区"
+               : scope.row.scope == 2
+              ? "同城特价商品"
+              : ""
+          }}
+        </template>
+      </el-table-column>
+    </el-table>
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNo"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { getRaffleSpuListPage } from "@/api/marketing/lottery";
+import { getClassificationListPage } from "@/api/common/index";
+export default {
+  props: ["selectData"],
+  name: "product",
+  data() {
+    return {
+      sort: {
+        merchantClassifyId: "",
+      },
+      sortDialog: false,
+      // 遮罩层
+      loading: true,
+      showSearch: true,
+      total: 0,
+      tableList: [],
+      title: "",
+      dialogVisible: false,
+      // 日期范围
+      dateRange: [],
+      // 查询参数
+      queryParams: {
+        pageNo: 1,
+        pageSize: 10,
+        key: "",
+        categoryId: "",
+        categoryName: "",
+        scope: "",
+      },
+      // 表单参数
+      form: {},
+      categoryprops: {
+        checkStrictly: true,
+        lazy: true,
+        lazyLoad: this.categoryLazyLoad,
+      },
+      selectList: [],
+    };
+  },
+  mounted() {
+    this.getList();
+  },
+  methods: {
+    checkSelectable(row) {
+      // 如果已有选中数据,检查当前行是否已被选中且状态不为禁用
+      if (this.selectData && this.selectData.length > 0) {
+        const selectedIds = this.selectData.map((item) => item.id);
+        return !selectedIds.includes(row.id) && row.status !== "禁用";
+      }
+      // 如果没有选中数据,直接检查行状态
+      return row.status !== "禁用";
+    },
+    handleSelectionChange(val) {
+      this.selectList = val;
+      this.$emit("voucherChoose", val);
+    },
+    /** 查询参数列表 */
+    getList() {
+      this.loading = true;
+      getRaffleSpuListPage(this.queryParams).then((res) => {
+        this.tableList = res.data.records;
+        this.total = res.data.total;
+        this.loading = false;
+      });
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNo = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.dateRange = [];
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    cascaderChange(val) {
+      this.queryParams.categoryId = val[val.length - 1];
+    },
+    categoryLazyLoad(node, resolve) {
+      let level = node.level;
+      if (!node.data) {
+        getClassificationListPage({ parentId: 0 }).then((res) => {
+          //接口
+          const nodes = Array.from(res.data).map((item, index) => ({
+            value: item.id,
+            label: `${item.className}`,
+            leaf: level >= 2,
+          }));
+          // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+          resolve(nodes);
+        });
+      } else if (level == 1) {
+        getClassificationListPage({ parentId: node.data.value }).then((res) => {
+          const nodes = Array.from(res.data).map((item) => ({
+            value: item.id,
+            label: `${item.className}`,
+            leaf: level >= 2,
+            // level: 2,
+          }));
+          // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+          resolve(nodes);
+        });
+      } else if (level == 2) {
+        getClassificationListPage({ parentId: node.data.value }).then((res) => {
+          const nodes = Array.from(res.data).map((item) => ({
+            value: item.id,
+            label: `${item.className}`,
+            leaf: level >= 1,
+            level: 1,
+          }));
+          // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+          resolve(nodes);
+        });
+      } else {
+        resolve({});
+      }
+    },
+  },
+};
+</script>
+<style>
+.el-form-item {
+  margin-bottom: 10px;
+}
+</style>

+ 252 - 0
src/views/fullReturn/detail.vue

@@ -0,0 +1,252 @@
+<template>
+  <div class="app-container">
+    <el-form ref="form" :model="shopInfo" label-width="120px">
+      <el-row>
+        <el-col :span="20">
+          <el-form-item label="名称" prop="title">
+            <el-input
+              readonly
+              type="text"
+              style="width: 300px"
+              placeholder="请输入名称"
+              v-model="shopInfo.title"
+              :show-word-limit="true"
+              :maxlength="12"
+            ></el-input>
+          </el-form-item>
+
+          <el-form-item
+            label="满返条件"
+            prop="fullAmount"
+            style="margin-top: 30px"
+          >
+            满
+            <el-input
+              readonly
+              type="text"
+              style="width: 300px"
+              placeholder="请输入名称"
+              v-model="shopInfo.fullAmount"
+              :show-word-limit="true"
+              :maxlength="12"
+            ></el-input>
+
+            元 返
+            <el-input
+              readonly
+              type="text"
+              style="width: 300px"
+              placeholder="请输入名称"
+              v-model="shopInfo.returnAmount"
+              :show-word-limit="true"
+              :maxlength="12"
+            ></el-input>
+          </el-form-item>
+
+          <el-form-item
+            label="下单时间范围"
+            prop="orderType"
+            style="margin-top: 30px"
+          >
+            <el-radio-group v-model="shopInfo.orderType" disabled>
+              <el-radio :label="0">固定时间</el-radio>
+              <el-radio :label="1">长期有效</el-radio>
+            </el-radio-group>
+          </el-form-item>
+          <el-form-item>
+            <el-date-picker
+              readonly
+              v-model="shopInfo.dateRange"
+              type="datetimerange"
+              range-separator="-"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              @change="xddatePicker"
+            >
+            </el-date-picker>
+          </el-form-item>
+
+          <el-form-item
+            label="下单条件"
+            prop="orderTopNum"
+            style="margin-top: 30px"
+          >
+            下单前
+            <el-input
+              readonly
+              type="text"
+              style="width: 300px"
+              placeholder="请输入名称"
+              v-model="shopInfo.orderTopNum"
+              :show-word-limit="true"
+              :maxlength="12"
+            ></el-input>
+            名
+          </el-form-item>
+
+          <el-form-item
+            label="购物红包使用时间范围"
+            prop="orderType"
+            style="margin-top: 30px"
+          >
+            <el-radio-group v-model="shopInfo.useType" disabled>
+              <el-radio :label="0">固定时间</el-radio>
+              <el-radio :label="1">长期有效</el-radio>
+            </el-radio-group>
+          </el-form-item>
+          <el-form-item>
+            <el-date-picker
+              readonly
+              v-model="shopInfo.dateRange1"
+              type="datetimerange"
+              range-separator="-"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              @change="datePicker"
+            >
+            </el-date-picker>
+          </el-form-item>
+
+          <el-form-item
+            label="参与活动商品"
+            prop="sendAmount"
+            style="margin-top: 30px"
+          >
+            <el-table
+              v-if="tabList && tabList.length > 0"
+              v-loading="loading"
+              :data="tabList"
+              @selection-change="handleSelectionChange"
+              row-key="id"
+            >
+              <el-table-column
+                type="selection"
+                width="55"
+                align="center"
+                :selectable="checkSelectable"
+              />
+              <el-table-column label="商品Id" align="center" prop="id" />
+              <el-table-column label="商品信息" align="center">
+                <template slot-scope="scope">
+                  <div
+                    style="
+                      display: flex;
+                      flex-direction: row;
+                      justify-content: space-between;
+                      align-items: center;
+                    "
+                  >
+                    <el-image
+                      style="width: 30px; height: 30px"
+                      :src="scope.row.pic"
+                      :preview-src-list="[scope.row.pic]"
+                    >
+                    </el-image>
+                    <div
+                      :title="scope.row.spuName"
+                      style="
+                        width: 80px;
+                        height: auto;
+                        word-wrap: break-word;
+                        overflow: hidden;
+                        text-overflow: ellipsis;
+                        white-space: nowrap;
+                      "
+                    >
+                      {{ scope.row.spuName }}
+                    </div>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="分类"
+                align="center"
+                prop="categoryName"
+              />
+              <el-table-column label="商品状态" align="center">
+                <template slot-scope="scope">
+                  {{
+                    scope.row.spuStatus == 2
+                      ? "售罄"
+                      : scope.row.spuStatus == 0
+                      ? "上架"
+                      : scope.row.spuStatus == 1
+                      ? "下架"
+                      : ""
+                  }}
+                </template>
+              </el-table-column>
+              <el-table-column label="销量" align="center" prop="salesVolume" />
+              <el-table-column label="价格" align="center" width="120">
+                <template slot-scope="scope">
+                  {{ scope.row.originalPrice }}元/{{ scope.row.unit }}
+                </template>
+              </el-table-column>
+              <el-table-column label="类型" align="center" width="120">
+                <template slot-scope="scope">
+                  {{
+                    scope.row.scope == 1
+                      ? "农商批发商品"
+                      : scope.row.scope == 3
+                      ? "同城秒送商品"
+                      : scope.row.scope == 4
+                      ? "会员专区"
+                      : scope.row.scope == 2
+                      ? "同城特价商品"
+                      : ""
+                  }}
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+  </div>
+</template>
+
+<script>
+import moment from "moment";
+import { storeMarketingActivityInfo } from "@/api/marketing/activity";
+export default {
+  data() {
+    return {
+      shopInfo: {
+        type: 1,
+        showType: 0,
+      },
+      tabList: [],
+    };
+  },
+  mounted() {
+    this.getInfoActivity();
+  },
+  methods: {
+    getInfoActivity() {
+      storeMarketingActivityInfo(this.$route.query.id).then((res) => {
+        if (res.code == 200) {
+          this.shopInfo = res.data;
+          if (this.shopInfo.orderStartTime) {
+            const orderStartTime = new Date(this.shopInfo.orderStartTime);
+            const orderEndTime = new Date(this.shopInfo.orderEndTime);
+            this.shopInfo.dateRange = [orderStartTime, orderEndTime];
+            const useStartTime = new Date(this.shopInfo.useStartTime);
+            const useEndTime = new Date(this.shopInfo.useEndTime);
+            this.shopInfo.dateRange1 = [useStartTime, useEndTime];
+            console.log(this.shopInfo);
+            this.tabList = this.shopInfo.spuList;
+          }
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style>
+.el-dialog__body {
+  padding: 0px 20px;
+}
+</style>

+ 378 - 0
src/views/fullReturn/edit.vue

@@ -0,0 +1,378 @@
+<template>
+  <div class="app-container">
+    <el-form ref="form" :rules="rules" :model="shopInfo" label-width="180px">
+      <el-row>
+        <el-col :span="20">
+          <el-form-item label="名称" prop="title">
+            <el-input
+              type="text"
+              style="width: 300px"
+              placeholder="请输入名称"
+              v-model="shopInfo.title"
+              :show-word-limit="true"
+              :maxlength="12"
+            ></el-input>
+          </el-form-item>
+
+          <el-form-item
+            label="满返条件"
+            prop="fullAmount"
+            style="margin-top: 30px"
+          >
+            满
+            <el-input-number
+              v-model="shopInfo.fullAmount"
+              style="width: 130px"
+              :controls="false"
+              max="9999"
+              min=""
+              step="1"
+              placeholder="单笔下单金额"
+            ></el-input-number>
+            元 返
+            <el-input-number
+              v-model="shopInfo.returnAmount"
+              style="width: 130px"
+              :controls="false"
+              max="9999"
+              min=""
+              step="1"
+              placeholder="购物红包金额"
+            ></el-input-number>
+          </el-form-item>
+
+          <el-form-item
+            label="下单时间范围"
+            prop="orderType"
+            style="margin-top: 30px"
+          >
+            <el-radio-group v-model="shopInfo.orderType">
+              <el-radio :label="0">固定时间</el-radio>
+              <el-radio :label="1">长期有效</el-radio>
+            </el-radio-group>
+          </el-form-item>
+          <el-form-item>
+            <el-date-picker
+              v-model="shopInfo.dateRange"
+              type="datetimerange"
+              range-separator="-"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              @change="xddatePicker"
+            >
+            </el-date-picker>
+          </el-form-item>
+
+          <el-form-item
+            label="下单条件"
+            prop="orderTopNum"
+            style="margin-top: 30px"
+          >
+            下单前
+            <el-input-number
+              v-model="shopInfo.orderTopNum"
+              style="width: 130px"
+              :controls="false"
+              max="9999"
+              min=""
+              step="1"
+            ></el-input-number>
+            名
+          </el-form-item>
+
+          <el-form-item
+            label="购物红包使用时间范围"
+            prop="orderType"
+            style="margin-top: 30px"
+          >
+            <el-radio-group v-model="shopInfo.useType">
+              <el-radio :label="0">固定时间</el-radio>
+              <el-radio :label="1">长期有效</el-radio>
+            </el-radio-group>
+          </el-form-item>
+          <el-form-item>
+            <el-date-picker
+              v-model="shopInfo.dateRange1"
+              type="datetimerange"
+              range-separator="-"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              @change="datePicker"
+            >
+            </el-date-picker>
+          </el-form-item>
+
+          <el-form-item
+            label="参与活动商品"
+            prop="sendAmount"
+            style="margin-top: 30px"
+          >
+            <el-button type="primary" size="mini" @click="spuSelect"
+              >选择商品</el-button
+            >
+            <el-button
+              size="mini"
+              @click="removeRow"
+              v-if="tabList && tabList.length > 0"
+              >批量移除</el-button
+            >
+            <el-table
+              v-if="tabList && tabList.length > 0"
+              v-loading="loading"
+              :data="tabList"
+              @selection-change="handleSelectionChange"
+              row-key="id"
+            >
+              <el-table-column
+                type="selection"
+                width="55"
+                align="center"
+                :selectable="checkSelectable"
+              />
+              <el-table-column label="商品Id" align="center" prop="id" />
+              <el-table-column label="商品信息" align="center">
+                <template slot-scope="scope">
+                  <div
+                    style="
+                      display: flex;
+                      flex-direction: row;
+                      justify-content: space-between;
+                      align-items: center;
+                    "
+                  >
+                    <el-image
+                      style="width: 30px; height: 30px"
+                      :src="scope.row.pic"
+                      :preview-src-list="[scope.row.pic]"
+                    >
+                    </el-image>
+                    <div
+                      :title="scope.row.spuName"
+                      style="
+                        width: 80px;
+                        height: auto;
+                        word-wrap: break-word;
+                        overflow: hidden;
+                        text-overflow: ellipsis;
+                        white-space: nowrap;
+                      "
+                    >
+                      {{ scope.row.spuName }}
+                    </div>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="分类"
+                align="center"
+                prop="categoryName"
+              />
+              <el-table-column label="商品状态" align="center">
+                <template slot-scope="scope">
+                  {{
+                    scope.row.spuStatus == 2
+                      ? "售罄"
+                      : scope.row.spuStatus == 0
+                      ? "上架"
+                      : scope.row.spuStatus == 1
+                      ? "下架"
+                      : ""
+                  }}
+                </template>
+              </el-table-column>
+              <el-table-column label="销量" align="center" prop="salesVolume" />
+              <el-table-column label="价格" align="center" width="120">
+                <template slot-scope="scope">
+                  {{ scope.row.originalPrice }}元/{{ scope.row.unit }}
+                </template>
+              </el-table-column>
+              <el-table-column label="类型" align="center" width="120">
+                <template slot-scope="scope">
+                  {{
+                    scope.row.scope == 1
+                      ? "农商批发商品"
+                      : scope.row.scope == 3
+                      ? "同城秒送商品"
+                      : scope.row.scope == 4
+                      ? "会员专区"
+                      : scope.row.scope == 2
+                      ? "同城特价商品"
+                      : ""
+                  }}
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24" style="margin-top: 30px; text-align: center">
+          <el-button @click="cancel">取消</el-button>
+          <el-button type="primary" @click="submitForm">保存</el-button>
+          <!-- <el-button>取消</el-button> -->
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <el-dialog
+      :visible.sync="shopDialog"
+      width="50%"
+      :destroy-on-close="true"
+      @close="close"
+    >
+      <SpuList
+        :selectData="tabList"
+        :dialog="false"
+        @voucherChoose="voucherChooseSpu"
+      ></SpuList>
+
+      <span
+        slot="footer"
+        class="dialog-footer"
+        v-if="$route.query.type != 'look'"
+      >
+        <el-button @click="shopDialog = false">取 消</el-button>
+        <el-button type="primary" @click="shopDialogSubmit">确 定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import moment from "moment";
+import {
+  saveOrUpdates,
+  storeMarketingActivityInfo,
+} from "@/api/marketing/activity";
+import SpuList from "./components/spulist.vue";
+export default {
+  components: { SpuList },
+  data() {
+    return {
+      shopDialog: false,
+      rules: {
+        title: [{ required: true, message: "请输入名称", trigger: "blur " }],
+        dateRange: [
+          { required: true, message: "请选择活动名称", trigger: "blur " },
+        ],
+        fullAmount: [
+          { required: true, message: "请输入满减条件", trigger: "blur " },
+        ],
+      },
+      shopInfo: {
+        type: 1,
+        showType: 0,
+      },
+      tabSelects: [],
+      spuSelectList: [],
+      tabList: [],
+      selectRow: [],
+    };
+  },
+  mounted() {
+    this.getInfoActivity();
+  },
+  methods: {
+    handleSelectionChange(val) {
+      this.selectRow = val;
+    },
+    removeRow() {
+      const filteredArray = this.tabList.filter(
+        (item1) => !this.selectRow.some((item2) => item2.id === item1.id)
+      );
+      console.log(filteredArray);
+      this.shopInfo.spuList = filteredArray;
+      this.tabList = filteredArray;
+    },
+    cancel() {
+      this.$confirm("是否确认取消,当前页面所进行的操作将不会保存?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.$store.dispatch("tagsView/delView", this.$route); //关闭当前页
+          this.$router.replace({
+            path: "/marketing/fullReturn/index",
+          });
+        })
+        .catch(() => {});
+    },
+    getInfoActivity() {
+      storeMarketingActivityInfo(this.$route.query.id).then((res) => {
+        if (res.code == 200) {
+          this.shopInfo = res.data;
+          if (this.shopInfo.orderStartTime) {
+            const orderStartTime = new Date(this.shopInfo.orderStartTime);
+            const orderEndTime = new Date(this.shopInfo.orderEndTime);
+            // this.shopInfo.dateRange = [orderStartTime, orderEndTime];
+            this.$set(this.shopInfo, "dateRange", [
+              orderStartTime,
+              orderEndTime,
+            ]);
+            const useStartTime = new Date(this.shopInfo.useStartTime);
+            const useEndTime = new Date(this.shopInfo.useEndTime);
+            this.$set(this.shopInfo, "dateRange1", [useStartTime, useEndTime]);
+
+            // this.shopInfo.dateRange1 = [useStartTime, useEndTime];
+            this.tabList = this.shopInfo.spuList;
+            console.log(this.tabList);
+          }
+        }
+      });
+    },
+    datePicker(val) {
+      this.shopInfo.orderStartTime = moment(val[0]).valueOf();
+      this.shopInfo.orderEndTime = moment(val[1]).valueOf();
+    },
+    spuSelect() {
+      this.shopDialog = true;
+    },
+    voucherChooseSpu(val) {
+      this.spuSelectList = val;
+    },
+    shopDialogSubmit() {
+      if (this.tabList) {
+        this.tabList = [...this.tabList, ...this.spuSelectList];
+      } else {
+        this.tabList = this.spuSelectList;
+      }
+      this.shopDialog = false;
+    },
+    submitForm() {
+      let ids = [];
+      if (this.tabList) {
+        ids = this.tabList.map((item) => item.id);
+      } else {
+        this.$message.error("请选择商品!");
+        return;
+      }
+      this.shopInfo.orderSpuIds = `[${ids.toString()}]`;
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          saveOrUpdates(this.shopInfo).then((res) => {
+            if (res.code == 200) {
+              this.$message.success("保存成功!");
+              this.$store.dispatch("tagsView/delView", this.$route); //关闭当前页
+              this.$router.replace({
+                path: "/marketing/fullReturn/index",
+              });
+            }
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+    resetForm(formName) {
+      this.$refs[formName].resetFields();
+    },
+  },
+};
+</script>
+
+<style>
+.el-dialog__body {
+  padding: 0px 20px;
+}
+</style>

+ 223 - 0
src/views/fullReturn/index.vue

@@ -0,0 +1,223 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      label-width="120px"
+    >
+      <el-form-item label="" prop="key">
+        <el-input
+          v-model="queryParams.key"
+          placeholder="输入主题名称关键字搜索"
+          clearable
+          style="width: 240px"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="活动时间" prop="danages">
+        <el-date-picker
+          v-model="queryParams.danages"
+          style="width: 240px"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          @change="redChange"
+        >
+        </el-date-picker>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button
+          type="primary"
+          icon="el-icon-search"
+          size="mini"
+          @click="handleQuery"
+          >搜索</el-button
+        >
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
+          >重置</el-button
+        >
+      </el-form-item>
+    </el-form>
+    <div style="margin: 10px 0px">
+      <el-button type="primary" size="mini" @click="hanleAdd">添加</el-button>
+    </div>
+
+    <el-table
+      v-loading="loading"
+      :data="configList"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column label="ID" align="center" prop="id" />
+      <el-table-column label="名称" align="center" prop="title" />
+      <el-table-column label="满减条件" align="center" prop="discountRule">
+        <template slot-scope="scope">
+          满{{ scope.row.fullAmount }}元,返{{ scope.row.returnAmount }}元
+        </template>
+      </el-table-column>
+      <el-table-column label="活动时间" align="center">
+        <template slot-scope="scope">
+          {{
+            scope.row.orderStartTime
+              ? $moment(scope.row.orderStartTime).format("YYYY-MM-DD")
+              : ""
+          }}
+          --
+          {{
+            scope.row.orderEndTime
+              ? $moment(scope.row.orderEndTime).format("YYYY-MM-DD")
+              : ""
+          }}
+        </template>
+      </el-table-column>
+      <el-table-column label="下单商品价格" align="center" prop="spuLength" />
+
+      <el-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+      >
+        <template slot-scope="scope">
+          <el-button size="mini" type="text" @click="handleLook(scope.row)"
+            >查看</el-button
+          >
+          <el-button size="mini" type="text" @click="handleEdit(scope.row)"
+            >编辑</el-button
+          >
+          <el-button
+            size="mini"
+            style="color: red"
+            type="text"
+            @click="handleRemove(scope.row)"
+            >删除</el-button
+          >
+        </template>
+      </el-table-column>
+    </el-table>
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNo"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import moment from "moment";
+import { queryPage, activityRemove } from "@/api/marketing/activity";
+export default {
+  data() {
+    return {
+      loading: true,
+      total: 0,
+      configList: [],
+      title: "",
+      open: false,
+      queryParams: {
+        key: "",
+        danages: [],
+        pageNo: 1,
+        pageSize: 10,
+        orderEndTime: "",
+        orderStartTime: "",
+        publishType: 0,
+        type: 1,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      drawer: false,
+      userid: "",
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    redChange(val) {
+      this.queryParams.orderStartTime = moment(val[0]).valueOf();
+      this.queryParams.orderEndTime = moment(val[1]).valueOf();
+    },
+
+    hanleAdd() {
+      this.$router.push({
+        path: "/marketing/fullReturn/add",
+      });
+    },
+
+    handleLook(record) {
+      this.$router.push({
+        path: "/marketing/fullReturn/detail",
+        query: {
+          id: record.id,
+        },
+      });
+    },
+    handleEdit(record) {
+      this.$router.push({
+        path: "/marketing/fullReturn/edit",
+        query: {
+          id: record.id,
+        },
+      });
+    },
+    handleRemove(record) {
+      this.$confirm("是否确认删除满减活动?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          activityRemove({ removeIds: record.id }).then((res) => {
+            if (res.code == 200) {
+              this.$message({
+                type: "success",
+                message: "删除成功!",
+              });
+              this.getList();
+            }
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
+    },
+
+    /** 查询参数列表 */
+    getList() {
+      this.loading = true;
+      queryPage(this.queryParams).then((response) => {
+        this.configList = response.data.records;
+        this.total = response.data.total;
+        this.loading = false;
+      });
+    },
+
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNo = 1;
+
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.queryParams.danages = [];
+      this.queryParams.orderStartTime = "";
+      this.queryParams.orderEndTime = "";
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+  },
+};
+</script>
+<style scoped lang="scss"></style>

+ 11 - 8
src/views/marketing/lottery/new/components/spulist.vue

@@ -34,9 +34,10 @@
           style="width: 140px"
         >
           <el-option label="全部" value=""> </el-option>
-          <el-option label="农商商品" :value="0"> </el-option>
-          <el-option label="同城秒送商品" :value="1"> </el-option>
-          <el-option label="会员专区" :value="2"> </el-option>
+          <el-option label="农商批发商品" :value="1"> </el-option>
+          <el-option label="同城特价商品" :value="2"> </el-option>
+          <el-option label="同城秒送商品" :value="3"> </el-option>
+          <el-option label="会员专区商品" :value="4"> </el-option>
         </el-select>
       </el-form-item>
       <el-form-item label="商品状态" prop="spuStatus">
@@ -133,12 +134,14 @@
       <el-table-column label="类型" align="center" width="120">
         <template slot-scope="scope">
           {{
-            scope.row.spuType == 0
-              ? "农商商品"
-              : scope.row.spuType == 1
+            scope.row.scope == 1
+              ? "农商批发商品"
+              : scope.row.scope == 3
               ? "同城秒送商品"
-              : scope.row.spuType == 2
+              : scope.row.scope == 4
               ? "会员专区"
+               : scope.row.scope == 2
+              ? "同城特价商品"
               : ""
           }}
         </template>
@@ -183,7 +186,7 @@ export default {
         key: "",
         categoryId: "",
         categoryName: "",
-        spuType: "",
+        scope: "",
       },
       // 表单参数
       form: {},

+ 12 - 2
src/views/marketing/lottery/new/detail.vue

@@ -117,7 +117,7 @@
                   v-model="item.discountRatio"
                 ></el-input>
               </el-form-item>
-              <el-form-item label="奖数量:" prop="giftNum">
+              <el-form-item label="奖数量:" prop="giftNum">
                 <el-input
                   readonly
                   type="text"
@@ -327,6 +327,13 @@
                   v-model="item.taskVal"
                   style="width: 300px"
                   readonly
+                  :placeholder="
+                    item.taskType == 0
+                      ? '请输入浏览时间'
+                      : item.taskType == 1
+                      ? '加购商品数量'
+                      : ''
+                  "
                 ></el-input>
               </el-form-item>
               <el-form-item label="奖励抽奖次数" prop="rewardNum">
@@ -350,8 +357,11 @@
                   style="width: 300px"
                   readonly
                 ></el-input>
+                <div v-if="item.taskType == 2" style="color: orange">
+                  避免用户下单后退单,以此来获得抽奖机会薅羊毛,建议奖励抽奖次数配置少一点
+                </div>
               </el-form-item>
-              <el-form-item label="选择商品" prop="userLimitNum">
+              <el-form-item label="选择商品" prop="userLimitNum"  v-if="item.taskType != 2">
                 <el-table
                   v-if="item.spuList"
                   v-loading="loading"

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 117 - 72
src/views/marketing/lottery/new/edit.vue


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 204 - 128
src/views/marketing/lottery/new/index.vue


+ 2 - 2
src/views/marketing/voucher/add.vue

@@ -108,7 +108,7 @@
               step="1"
             ></el-input-number>
 
-            元
+             
           </el-form-item>
           <el-form-item label="代金券数量" prop="sendNum">
             <el-input-number
@@ -118,7 +118,7 @@
               max="9999"
               min=""
             ></el-input-number
-            >张
+            > 
           </el-form-item>
         </el-col>
         <el-col