Browse Source

营销活动

潘超林 1 month ago
parent
commit
fbc6c74484

+ 33 - 0
src/api/marketing/activity.js

@@ -0,0 +1,33 @@
+import request from '@/utils/request'
+
+
+export function queryPage(query) {
+  return request({
+    url: 'system/storeMarketingActivity/queryPage',
+    method: 'get',
+    params: query
+  })
+}
+
+export function saveOrUpdates(query) {
+  return request({
+    url: 'system/storeMarketingActivity/saveOrUpdates',
+    method: 'post',
+    data: query
+  })
+}
+
+export function activityRemove(query) {
+  return request({
+    url: 'system/storeMarketingActivity/remove',
+    method: 'get',
+    params: query
+  })
+}
+export function storeMarketingActivityInfo(query) {
+  return request({
+    url: 'system/storeMarketingActivity/info/' + query,
+    method: 'get',
+  })
+}
+

+ 17 - 0
src/api/marketing/voucher.js

@@ -69,3 +69,20 @@ export function enable(query) {
     params: query
     params: query
   })
   })
 }
 }
+
+export function voucherStatistics(query) {
+  return request({
+    url: 'system/voucher/voucherStatistics',
+    method: 'get',
+    params: query
+  })
+}
+
+export function recordPage(query) {
+  return request({
+    url: 'system/voucher/recordPage',
+    method: 'get',
+    params: query
+  })
+}
+

+ 270 - 0
src/views/activity/add.vue

@@ -0,0 +1,270 @@
+<template>
+  <div class="app-container">
+    <el-form ref="form" :rules="rules" :model="shopInfo" label-width="120px">
+      <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="dateRange"
+            style="margin-top: 30px"
+          >
+            <el-date-picker
+              v-model="shopInfo.dateRange"
+              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="fullAmount"
+            style="margin-top: 30px"
+          >
+            满
+            <el-input-number
+              v-model="shopInfo.fullAmount"
+              style="width: 130px"
+              :controls="false"
+              max="9999"
+              min=""
+              step="1"
+            ></el-input-number>
+            元 减
+            <el-input-number
+              v-model="shopInfo.returnAmount"
+              style="width: 130px"
+              :controls="false"
+              max="9999"
+              min=""
+              step="1"
+            ></el-input-number>
+          </el-form-item>
+          <el-form-item
+            label="满减条件"
+            prop="sendAmount"
+            style="margin-top: 30px"
+          >
+            <el-button type="primary" size="mini" @click="spuSelect"
+              >选择商品</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.spuType == 0
+                      ? "农商商品"
+                      : scope.row.spuType == 1
+                      ? "同城秒送商品"
+                      : scope.row.spuType == 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 " },
+        ],
+      },
+      shopInfo: {
+        type: 1,
+        showType: 0,
+      },
+      tabSelects: [],
+      spuSelectList: [],
+      tabList: [],
+    };
+  },
+  mounted() {},
+  methods: {
+    cancel() {
+      this.$confirm("是否确认取消,当前页面所进行的操作将不会保存?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.$store.dispatch("tagsView/delView", this.$route); //关闭当前页
+          this.$router.replace({
+            path: "/marketing/activity/index",
+          });
+        })
+        .catch(() => {});
+    },
+    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() {
+      this.tabList = this.spuSelectList;
+      this.shopDialog = false;
+    },
+    submitForm() {
+      let ids = this.tabList.map((item) => item.id);
+      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/activity/index",
+              });
+            }
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+    resetForm(formName) {
+      this.$refs[formName].resetFields();
+    },
+  },
+};
+</script>
+
+<style>
+.el-dialog__body {
+  padding: 0px 20px;
+}
+</style>

+ 283 - 0
src/views/activity/components/spulist.vue

@@ -0,0 +1,283 @@
+<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-select
+          v-model="queryParams.spuType"
+          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-select>
+      </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.spuType == 0
+              ? "农商商品"
+              : scope.row.spuType == 1
+              ? "同城秒送商品"
+              : scope.row.spuType == 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: "",
+        spuType: "",
+      },
+      // 表单参数
+      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>

+ 189 - 0
src/views/activity/detail.vue

@@ -0,0 +1,189 @@
+<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"
+            ></el-input>
+          </el-form-item>
+
+          <el-form-item
+            label="活动时间"
+            prop="dateRange"
+            style="margin-top: 30px"
+          >
+            <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="datePicker"
+            >
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item
+            label="满减条件"
+            prop="fullAmount"
+            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-form-item>
+          <el-form-item
+            label="满减条件"
+            prop="sendAmount"
+            style="margin-top: 30px"
+          >
+            <el-table
+              v-if="shopInfo.spuList && shopInfo.spuList.length > 0"
+              v-loading="loading"
+              :data="shopInfo.spuList"
+              @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.spuType == 0
+                      ? "农商商品"
+                      : scope.row.spuType == 1
+                      ? "同城秒送商品"
+                      : scope.row.spuType == 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];
+            console.log(this.shopInfo);
+
+          }
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style>
+.el-dialog__body {
+  padding: 0px 20px;
+}
+</style>

+ 311 - 0
src/views/activity/edit.vue

@@ -0,0 +1,311 @@
+<template>
+  <div class="app-container">
+    <el-form ref="form" :rules="rules" :model="shopInfo" label-width="120px">
+      <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="dateRange"
+            style="margin-top: 30px"
+          >
+            <el-date-picker
+              v-model="shopInfo.dateRange"
+              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="fullAmount"
+            style="margin-top: 30px"
+          >
+            满
+            <el-input-number
+              v-model="shopInfo.fullAmount"
+              style="width: 130px"
+              :controls="false"
+              max="9999"
+              min=""
+              step="1"
+            ></el-input-number>
+            元 减
+            <el-input-number
+              v-model="shopInfo.returnAmount"
+              style="width: 130px"
+              :controls="false"
+              max="9999"
+              min=""
+              step="1"
+            ></el-input-number>
+          </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.spuType == 0
+                      ? "农商商品"
+                      : scope.row.spuType == 1
+                      ? "同城秒送商品"
+                      : scope.row.spuType == 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/activity/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.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 = this.tabList.map((item) => item.id);
+      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/activity/index",
+              });
+            }
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+    resetForm(formName) {
+      this.$refs[formName].resetFields();
+    },
+  },
+};
+</script>
+
+<style>
+.el-dialog__body {
+  padding: 0px 20px;
+}
+</style>

+ 218 - 0
src/views/activity/index.vue

@@ -0,0 +1,218 @@
+<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" />
+      <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,
+      },
+      // 表单参数
+      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/activity/add",
+      });
+    },
+
+    handleLook(record) {
+      this.$router.push({
+        path: "/marketing/activity/detail",
+        query: {
+          id: record.id,
+        },
+      });
+    },
+    handleEdit(record) {
+      this.$router.push({
+        path: "/marketing/activity/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>

+ 320 - 0
src/views/discount/add.vue

@@ -0,0 +1,320 @@
+<template>
+  <div class="app-container">
+    <el-form ref="form" :rules="rules" :model="shopInfo" label-width="120px">
+      <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="dateRange"
+            style="margin-top: 30px"
+          >
+            <el-date-picker
+              v-model="shopInfo.dateRange"
+              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="discountType"
+            style="margin-top: 30px"
+          >
+            <el-radio-group v-model="shopInfo.discountType">
+              <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="
+                item.index == 1
+                  ? '首件价格(元)'
+                  : '第' + item.index + '件价格(元)'
+              "
+              :key="index"
+              style="margin-top: 30px"
+            >
+              <el-input-number
+                v-model="item.discountVal"
+                style="width: 130px"
+                :controls="false"
+                max="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="参与活动商品"
+            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.spuType == 0
+                      ? "农商商品"
+                      : scope.row.spuType == 1
+                      ? "同城秒送商品"
+                      : scope.row.spuType == 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 " },
+        ],
+        discountType: [
+          { required: true, message: "请选择折扣条件", trigger: "blur " },
+        ],
+      },
+      shopInfo: {
+        type: 1,
+        discountType: 0,
+        discountRule: [{ index: 1, discountVal: "", discountType: 0 }],
+      },
+      tabSelects: [],
+      spuSelectList: [],
+      tabList: [],
+    };
+  },
+  mounted() {},
+  methods: {
+    removeRule() {
+      this.shopInfo.discountRule.splice(index, 1);
+    },
+    addRule() {
+      this.shopInfo.discountRule.push({
+        index: this.shopInfo.discountRule.length + 1,
+        discountVal: "",
+        discountType: this.shopInfo.discountType,
+      });
+    },
+    cancel() {
+      this.$confirm("是否确认取消,当前页面所进行的操作将不会保存?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.$store.dispatch("tagsView/delView", this.$route); //关闭当前页
+          this.$router.replace({
+            path: "/marketing/discount/index",
+          });
+        })
+        .catch(() => {});
+    },
+    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() {
+      this.tabList = this.spuSelectList;
+      this.shopDialog = false;
+    },
+    submitForm() {
+      let obj = { ...this.shopInfo };
+      let ids = this.tabList.map((item) => item.id);
+      obj.orderSpuIds = `[${ids.toString()}]`;
+      obj.discountRule[0].discountType = obj.discountType;
+      obj.discountRule = JSON.stringify(this.shopInfo.discountRule);
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          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",
+              });
+            }
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+    resetForm(formName) {
+      this.$refs[formName].resetFields();
+    },
+  },
+};
+</script>
+
+<style>
+.el-dialog__body {
+  padding: 0px 20px;
+}
+</style>

+ 283 - 0
src/views/discount/components/spulist.vue

@@ -0,0 +1,283 @@
+<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-select
+          v-model="queryParams.spuType"
+          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-select>
+      </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.spuType == 0
+              ? "农商商品"
+              : scope.row.spuType == 1
+              ? "同城秒送商品"
+              : scope.row.spuType == 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: "",
+        spuType: "",
+      },
+      // 表单参数
+      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>

+ 189 - 0
src/views/discount/detail.vue

@@ -0,0 +1,189 @@
+<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"
+            ></el-input>
+          </el-form-item>
+
+          <el-form-item
+            label="活动时间"
+            prop="dateRange"
+            style="margin-top: 30px"
+          >
+            <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="datePicker"
+            >
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item
+            label="满减条件"
+            prop="fullAmount"
+            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-form-item>
+          <el-form-item
+            label="满减条件"
+            prop="sendAmount"
+            style="margin-top: 30px"
+          >
+            <el-table
+              v-if="shopInfo.spuList && shopInfo.spuList.length > 0"
+              v-loading="loading"
+              :data="shopInfo.spuList"
+              @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.spuType == 0
+                      ? "农商商品"
+                      : scope.row.spuType == 1
+                      ? "同城秒送商品"
+                      : scope.row.spuType == 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];
+            console.log(this.shopInfo);
+
+          }
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style>
+.el-dialog__body {
+  padding: 0px 20px;
+}
+</style>

+ 351 - 0
src/views/discount/edit.vue

@@ -0,0 +1,351 @@
+<template>
+  <div class="app-container">
+    <el-form ref="form" :rules="rules" :model="shopInfo" label-width="120px">
+      <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="dateRange"
+            style="margin-top: 30px"
+          >
+            <el-date-picker
+              v-model="shopInfo.dateRange"
+              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="discountType"
+            style="margin-top: 30px"
+          >
+            <el-radio-group v-model="shopInfo.discountType">
+              <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="
+                item.index == 1
+                  ? '首件价格(元)'
+                  : '第' + item.index + '件价格(元)'
+              "
+              :key="index"
+              style="margin-top: 30px"
+            >
+              <el-input-number
+                v-model="item.discountVal"
+                style="width: 130px"
+                :controls="false"
+                max="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="参与活动商品"
+            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.spuType == 0
+                      ? "农商商品"
+                      : scope.row.spuType == 1
+                      ? "同城秒送商品"
+                      : scope.row.spuType == 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 " },
+        ],
+        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: {
+    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/activity/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.tabList = this.shopInfo.spuList;
+            if (this.shopInfo.discountRule) {
+              this.shopInfo.discountRule = JSON.parse(
+                this.shopInfo.discountRule
+              );
+            } else {
+              this.discountRule = [
+                { index: 1, discountVal: "", discountType: 0 },
+              ];
+            }
+
+            console.log(this.shopInfo);
+          }
+        }
+      });
+    },
+    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 = this.tabList.map((item) => item.id);
+      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/activity/index",
+              });
+            }
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+    resetForm(formName) {
+      this.$refs[formName].resetFields();
+    },
+  },
+};
+</script>
+
+<style>
+.el-dialog__body {
+  padding: 0px 20px;
+}
+</style>

+ 218 - 0
src/views/discount/index.vue

@@ -0,0 +1,218 @@
+<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" />
+      <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,
+      },
+      // 表单参数
+      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/discount/add",
+      });
+    },
+
+    handleLook(record) {
+      this.$router.push({
+        path: "/marketing/discount/detail",
+        query: {
+          id: record.id,
+        },
+      });
+    },
+    handleEdit(record) {
+      this.$router.push({
+        path: "/marketing/discount/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>

+ 1 - 1
src/views/marketing/lottery/index.vue

@@ -119,7 +119,7 @@
             type="text"
             type="text"
             style="color: red"
             style="color: red"
             @click="handleRemove(scope.row)"
             @click="handleRemove(scope.row)"
-            >编辑</el-button
+            >删除</el-button
           >
           >
         </template>
         </template>
       </el-table-column>
       </el-table-column>

+ 29 - 3
src/views/marketing/lottery/new/components/spulist.vue

@@ -71,7 +71,12 @@
       @selection-change="handleSelectionChange"
       @selection-change="handleSelectionChange"
       row-key="id"
       row-key="id"
     >
     >
-      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column
+        type="selection"
+        width="55"
+        align="center"
+        :selectable="checkSelectable"
+      />
       <el-table-column label="商品Id" align="center" prop="id" />
       <el-table-column label="商品Id" align="center" prop="id" />
       <el-table-column label="商品信息" align="center">
       <el-table-column label="商品信息" align="center">
         <template slot-scope="scope">
         <template slot-scope="scope">
@@ -90,7 +95,7 @@
             >
             >
             </el-image>
             </el-image>
             <div
             <div
-              :title="scope.row.title"
+              :title="scope.row.spuName"
               style="
               style="
                 width: 80px;
                 width: 80px;
                 height: auto;
                 height: auto;
@@ -100,7 +105,7 @@
                 white-space: nowrap;
                 white-space: nowrap;
               "
               "
             >
             >
-              {{ scope.row.title }}
+              {{ scope.row.spuName }}
             </div>
             </div>
           </div>
           </div>
         </template>
         </template>
@@ -154,6 +159,7 @@ import { getRaffleSpuListPage } from "@/api/marketing/lottery";
 import { getClassificationListPage } from "@/api/common/index";
 import { getClassificationListPage } from "@/api/common/index";
 import { getStoreInfo } from "@/api/common/index";
 import { getStoreInfo } from "@/api/common/index";
 export default {
 export default {
+  props: ["selectData"],
   name: "product",
   name: "product",
   data() {
   data() {
     return {
     return {
@@ -192,6 +198,26 @@ export default {
     this.getList();
     this.getList();
   },
   },
   methods: {
   methods: {
+    checkSelectable(row) {
+      if (this.selectData) {
+        let a = this.selectData.taskIds || this.selectData.giftIds;
+        if (a) {
+          if (
+            !JSON.parse(
+              this.selectData.taskIds
+                ? this.selectData.taskIds
+                : this.selectData.giftIds
+            ).includes(row.id)
+          ) {
+            return row.status !== "禁用";
+          }
+        } else {
+          return row.status !== "启用";
+        }
+      } else {
+        return row.status !== "启用";
+      }
+    },
     handleSelectionChange(val) {
     handleSelectionChange(val) {
       this.$emit("voucherChoose", val);
       this.$emit("voucherChoose", val);
     },
     },

+ 10 - 10
src/views/marketing/lottery/new/detail.vue

@@ -529,16 +529,16 @@ export default {
             const endTime = new Date(this.shopInfo.storeRaffle.endTime);
             const endTime = new Date(this.shopInfo.storeRaffle.endTime);
             this.shopInfo.storeRaffle.dateRange = [startTime, endTime];
             this.shopInfo.storeRaffle.dateRange = [startTime, endTime];
           }
           }
-          if (this.shopInfo.storeRaffleGiftList) {
-            this.shopInfo.storeRaffleGiftList.forEach((e) => {
-              if (e.giftRatio) {
-                e.giftRatio = e.giftRatio * 100;
-              }
-              if (e.discountRatio) {
-                e.discountRatio = e.discountRatio * 100;
-              }
-            });
-          }
+          // if (this.shopInfo.storeRaffleGiftList) {
+          //   this.shopInfo.storeRaffleGiftList.forEach((e) => {
+          //     if (e.giftRatio) {
+          //       e.giftRatio = e.giftRatio * 100;
+          //     }
+          //     if (e.discountRatio) {
+          //       e.discountRatio = e.discountRatio * 100;
+          //     }
+          //   });
+          // }
           if (this.shopInfo.storeRaffle.startTime) {
           if (this.shopInfo.storeRaffle.startTime) {
             const orderStartTime = new Date(
             const orderStartTime = new Date(
               this.shopInfo.storeRaffle.orderStartTime
               this.shopInfo.storeRaffle.orderStartTime

+ 87 - 44
src/views/marketing/lottery/new/edit.vue

@@ -185,7 +185,6 @@
                   @click="Choose(item, 'djq')"
                   @click="Choose(item, 'djq')"
                   >选择代金券</el-button
                   >选择代金券</el-button
                 >
                 >
-
                 <el-table
                 <el-table
                   v-if="item.storeVoucherVos"
                   v-if="item.storeVoucherVos"
                   v-loading="loading"
                   v-loading="loading"
@@ -343,7 +342,7 @@
                         size="mini"
                         size="mini"
                         type="text"
                         type="text"
                         style="color: #00b529"
                         style="color: #00b529"
-                        @click="removeVercherspu(item, scope.$index)"
+                        @click="removeVercherspu2(item, scope.$index)"
                         >移除</el-button
                         >移除</el-button
                       >
                       >
                     </template>
                     </template>
@@ -441,7 +440,11 @@
                   placeholder="请输入可完成任务次数"
                   placeholder="请输入可完成任务次数"
                 ></el-input-number>
                 ></el-input-number>
               </el-form-item>
               </el-form-item>
-              <el-form-item label="选择商品" prop="userLimitNum">
+              <el-form-item
+                label="选择商品"
+                prop="userLimitNum"
+                v-if="item.taskType != 2"
+              >
                 <el-button
                 <el-button
                   type="primary"
                   type="primary"
                   size="mini"
                   size="mini"
@@ -585,6 +588,7 @@
       :destroy-on-close="true"
       :destroy-on-close="true"
     >
     >
       <voucherSpuList
       <voucherSpuList
+        :selectData="selectSpuRow"
         :dialog="false"
         :dialog="false"
         @voucherChoose="voucherChooseSpu"
         @voucherChoose="voucherChooseSpu"
       ></voucherSpuList>
       ></voucherSpuList>
@@ -703,6 +707,11 @@ export default {
       spuRemoveList: [],
       spuRemoveList: [],
       contont: "",
       contont: "",
       tablevalue: null,
       tablevalue: null,
+      pageinfo: {
+        page: 1,
+        size: 10,
+        total: 0,
+      },
     };
     };
   },
   },
   mounted() {
   mounted() {
@@ -712,19 +721,20 @@ export default {
     getInfo() {
     getInfo() {
       storeRaffleInfo(this.$route.query.id).then((res) => {
       storeRaffleInfo(this.$route.query.id).then((res) => {
         if (res.code === 200) {
         if (res.code === 200) {
+          console.log(res.data);
           this.shopInfo.storeRaffle = res.data.storeRaffle;
           this.shopInfo.storeRaffle = res.data.storeRaffle;
-          this.shopInfo.storeRaffleGiftList = res.data.storeRaffleGiftVoList;
           this.shopInfo.storeRaffleTaskList = res.data.storeRaffleTaskVoList;
           this.shopInfo.storeRaffleTaskList = res.data.storeRaffleTaskVoList;
-          if (this.shopInfo.storeRaffleGiftList) {
-            this.shopInfo.storeRaffleGiftList.forEach((e) => {
-              if (e.giftRatio) {
-                e.giftRatio = e.giftRatio * 100;
-              }
-              if (e.discountRatio) {
-                e.discountRatio = e.discountRatio * 100;
-              }
-            });
-          }
+          // if (res.data.storeRaffleGiftVoList) {
+          //   res.data.storeRaffleGiftVoList.forEach((e) => {
+          //     if (e.giftRatio) {
+          //       e.giftRatio = e.giftRatio * 100;
+          //     }
+          //     if (e.discountRatio) {
+          //       e.discountRatio = e.discountRatio * 100;
+          //     }
+          //   });
+          // }
+          this.shopInfo.storeRaffleGiftList = res.data.storeRaffleGiftVoList;
           if (this.shopInfo.storeRaffle.startTime) {
           if (this.shopInfo.storeRaffle.startTime) {
             const startTime = new Date(this.shopInfo.storeRaffle.startTime);
             const startTime = new Date(this.shopInfo.storeRaffle.startTime);
             const endTime = new Date(this.shopInfo.storeRaffle.endTime);
             const endTime = new Date(this.shopInfo.storeRaffle.endTime);
@@ -750,11 +760,13 @@ export default {
       });
       });
     },
     },
     submitFormOK() {
     submitFormOK() {
-      for (let i = 0; i < this.shopInfo.storeRaffleGiftList.length; i++) {
+      for (let i = 0; i < this.shopInfo.storeRaffleTaskList.length; i++) {
         const e = this.shopInfo.storeRaffleTaskList[i];
         const e = this.shopInfo.storeRaffleTaskList[i];
-        if (!e.taskIds) {
-          this.$message.error("请先选择商品!");
-          return; // 如果满足条件,跳出函数,不再继续执行循环
+        if (e.taskType != 2) {
+          if (!e.taskIds) {
+            this.$message.error("请先选择商品!");
+            return; // 如果满足条件,跳出函数,不再继续执行循环
+          }
         }
         }
       }
       }
       const form = this.$refs.form3;
       const form = this.$refs.form3;
@@ -774,13 +786,13 @@ export default {
       })
       })
         .then(() => {
         .then(() => {
           console.log(this.shopInfo);
           console.log(this.shopInfo);
-          this.shopInfo.storeRaffleGiftList.forEach((e) => {
-            e.discountRatio = e.discountRatio * 0.01;
-            e.giftRatio = e.giftRatio * 0.01;
-          });
-          this.shopInfo.storeRaffleGiftList.forEach((e) => {
-            e.discountRatio = e.discountRatio * 0.01;
-          });
+          // this.shopInfo.storeRaffleGiftList.forEach((e) => {
+          //   e.discountRatio = e.discountRatio * 0.01;
+          //   e.giftRatio = e.giftRatio * 0.01;
+          // });
+          // this.shopInfo.storeRaffleGiftList.forEach((e) => {
+          //   e.discountRatio = e.discountRatio * 0.01;
+          // });
           storeRaffleSave(this.shopInfo).then((res) => {
           storeRaffleSave(this.shopInfo).then((res) => {
             if (res.code == 200) {
             if (res.code == 200) {
               this.$message({
               this.$message({
@@ -804,36 +816,69 @@ export default {
     handleSelectionChange(val) {
     handleSelectionChange(val) {
       this.spuRemoveList = val;
       this.spuRemoveList = val;
     },
     },
-    radioChange(val) {
-      val.giftIds = "";
-      this.selectRow.storeVoucherVos = [];
-      this.selectSpuRow.spuList = [];
+    // radioChange(val) {
+      // val.giftIds = "";
+      // this.selectRow.storeVoucherVos = [];
+      // this.selectSpuRow.spuList = [];
+    // },
+    removeVercherspu2(record, index) {
+      record.spuList.splice(index, 1);
+      let ids = record.spuList.map((item) => item.id);
+      record.giftIds = `[${ids.toString()}]`;
     },
     },
     removeVercherspu(record, index) {
     removeVercherspu(record, index) {
       record.spuList.splice(index, 1);
       record.spuList.splice(index, 1);
+      let ids = record.spuList.map((item) => item.id);
+      record.taskIds = `[${ids.toString()}]`;
     },
     },
     removeVercher(record, index) {
     removeVercher(record, index) {
       record.storeVoucherVos.splice(index, 1);
       record.storeVoucherVos.splice(index, 1);
+      let ids = record.spuList.map((item) => item.id);
+      record.giftIds = `[${ids.toString()}]`;
     },
     },
     SpuDialogOk() {
     SpuDialogOk() {
+      console.log(this.selectSpuRow);
       if (this.steps == 2) {
       if (this.steps == 2) {
         let ids = this.tablevalue.map((item) => item.id);
         let ids = this.tablevalue.map((item) => item.id);
-        let old = JSON.parse(this.selectSpuRow.giftIds);
-        let list = [...old, ...ids];
+        let old = this.selectSpuRow.giftIds
+          ? JSON.parse(this.selectSpuRow.giftIds)
+          : [];
+        let list = [];
+        console.log("old", old);
+        if (old.length < 1) {
+          list = ids;
+        } else {
+          list = [...old, ...ids];
+        }
         this.selectSpuRow.giftIds = "[" + list.toString() + "]";
         this.selectSpuRow.giftIds = "[" + list.toString() + "]";
-        this.selectSpuRow.spuList = [
-          ...this.selectSpuRow.spuList,
-          ...this.tablevalue,
-        ];
+        if (this.selectSpuRow.spuList) {
+          this.selectSpuRow.spuList = [
+            ...this.selectSpuRow.spuList,
+            ...this.tablevalue,
+          ];
+        } else {
+          this.selectSpuRow.spuList = this.tablevalue;
+        }
       } else {
       } else {
         let ids = this.tablevalue.map((item) => item.id);
         let ids = this.tablevalue.map((item) => item.id);
-        let old = JSON.parse(this.selectSpuRow.taskIds);
-        let list = [...old, ...ids];
+        let old = this.selectSpuRow.taskIds
+          ? JSON.parse(this.selectSpuRow.taskIds)
+          : [];
+        let list = [];
+        if (old.length < 1) {
+          list = ids;
+        } else {
+          list = [...old, ...ids];
+        }
         this.selectSpuRow.taskIds = "[" + list.toString() + "]";
         this.selectSpuRow.taskIds = "[" + list.toString() + "]";
-        this.selectSpuRow.spuList = [
-          ...this.selectSpuRow.spuList,
-          ...this.tablevalue,
-        ];
+        if (this.selectSpuRow.spuList) {
+          this.selectSpuRow.spuList = [
+            ...this.selectSpuRow.spuList,
+            ...this.tablevalue,
+          ];
+        } else {
+          this.selectSpuRow.spuList = this.tablevalue;
+        }
       }
       }
       this.SpuDialog = false;
       this.SpuDialog = false;
     },
     },
@@ -845,8 +890,6 @@ export default {
       this.VoucherDialog = false;
       this.VoucherDialog = false;
       this.selectRow.storeVoucherVos = [];
       this.selectRow.storeVoucherVos = [];
       this.selectRow.storeVoucherVos.push(val);
       this.selectRow.storeVoucherVos.push(val);
-      console.log(this.selectRow);
-
       // this.selectRow.storeVoucherVos.push(val);
       // this.selectRow.storeVoucherVos.push(val);
     },
     },
     Choose(record, type) {
     Choose(record, type) {
@@ -854,8 +897,8 @@ export default {
         this.selectRow = record;
         this.selectRow = record;
         this.VoucherDialog = true;
         this.VoucherDialog = true;
       } else if (type == "spu") {
       } else if (type == "spu") {
-        this.SpuDialog = true;
         this.selectSpuRow = record;
         this.selectSpuRow = record;
+        this.SpuDialog = true;
       }
       }
     },
     },
     removePrize(record, index, type) {
     removePrize(record, index, type) {

+ 23 - 15
src/views/marketing/lottery/new/index.vue

@@ -387,11 +387,12 @@
             <el-col :span="18">
             <el-col :span="18">
               <el-form-item label="任务类型:" prop="taskType">
               <el-form-item label="任务类型:" prop="taskType">
                 <el-radio-group v-model="item.taskType">
                 <el-radio-group v-model="item.taskType">
-                  <el-radio :label="0">浏览商品</el-radio>
-                  <el-radio :label="1">加购商品</el-radio>
-                  <el-radio :label="2">店铺下单</el-radio>
+                  <el-radio :label="0" :name="0">浏览商品</el-radio>
+                  <el-radio :label="1" :name="1">加购商品</el-radio>
+                  <el-radio :label="2" :name="2">店铺下单</el-radio>
                 </el-radio-group>
                 </el-radio-group>
               </el-form-item>
               </el-form-item>
+
               <el-form-item
               <el-form-item
                 v-if="item.taskType != 2"
                 v-if="item.taskType != 2"
                 :label="
                 :label="
@@ -443,8 +444,13 @@
                   placeholder="请输入可完成任务次数"
                   placeholder="请输入可完成任务次数"
                 ></el-input-number>
                 ></el-input-number>
               </el-form-item>
               </el-form-item>
-              <el-form-item label="选择商品" prop="userLimitNum">
+              <el-form-item
+                label="选择商品"
+                prop="userLimitNum"
+              >
+
                 <el-button
                 <el-button
+                  v-if="item.taskType != 2"
                   type="primary"
                   type="primary"
                   size="mini"
                   size="mini"
                   @click="Choose(item, 'spu')"
                   @click="Choose(item, 'spu')"
@@ -783,11 +789,13 @@ export default {
     //   this.$set(record, "spuList", list);
     //   this.$set(record, "spuList", list);
     // },
     // },
     submitFormOK() {
     submitFormOK() {
-      for (let i = 0; i < this.shopInfo.storeRaffleGiftList.length; i++) {
+      for (let i = 0; i < this.shopInfo.storeRaffleTaskList.length; i++) {
         const e = this.shopInfo.storeRaffleTaskList[i];
         const e = this.shopInfo.storeRaffleTaskList[i];
-        if (!e.taskIds) {
-          this.$message.error("请先选择商品!");
-          return; // 如果满足条件,跳出函数,不再继续执行循环
+        if (e.taskType != 2) {
+          if (!e.taskIds) {
+            this.$message.error("请先选择商品!");
+            return; // 如果满足条件,跳出函数,不再继续执行循环
+          }
         }
         }
       }
       }
       const form = this.$refs.form3;
       const form = this.$refs.form3;
@@ -807,13 +815,13 @@ export default {
       })
       })
         .then(() => {
         .then(() => {
           console.log(this.shopInfo);
           console.log(this.shopInfo);
-          this.shopInfo.storeRaffleGiftList.forEach((e) => {
-            e.discountRatio = e.discountRatio * 0.01;
-            e.giftRatio = e.giftRatio * 0.01;
-          });
-          this.shopInfo.storeRaffleGiftList.forEach((e) => {
-            e.discountRatio = e.discountRatio * 0.01;
-          });
+          // this.shopInfo.storeRaffleGiftList.forEach((e) => {
+          //   e.discountRatio = e.discountRatio * 0.01;
+          //   e.giftRatio = e.giftRatio * 0.01;
+          // });
+          // this.shopInfo.storeRaffleGiftList.forEach((e) => {
+          //   e.discountRatio = e.discountRatio * 0.01;
+          // });
           storeRaffleSave(this.shopInfo).then((res) => {
           storeRaffleSave(this.shopInfo).then((res) => {
             if (res.code == 200) {
             if (res.code == 200) {
               this.$message({
               this.$message({

+ 5 - 3
src/views/marketing/voucher/add.vue

@@ -94,6 +94,8 @@
               style="width: 300px"
               style="width: 300px"
               placeholder="请输入代金券名称"
               placeholder="请输入代金券名称"
               v-model="shopInfo.title"
               v-model="shopInfo.title"
+              :show-word-limit="true"
+              :maxlength="12"
             ></el-input>
             ></el-input>
           </el-form-item>
           </el-form-item>
           <el-form-item label="代金券金额" prop="sendAmount">
           <el-form-item label="代金券金额" prop="sendAmount">
@@ -112,11 +114,11 @@
             <el-input-number
             <el-input-number
               v-model="shopInfo.sendNum"
               v-model="shopInfo.sendNum"
               style="width: 300px"
               style="width: 300px"
-               :controls="false"
+              :controls="false"
               max="9999"
               max="9999"
               min=""
               min=""
-            ></el-input-number>
-
+            ></el-input-number
+            >张
           </el-form-item>
           </el-form-item>
         </el-col>
         </el-col>
         <el-col
         <el-col

+ 110 - 546
src/views/marketing/voucher/components/record.vue

@@ -1,260 +1,115 @@
-<!-- <template>
+<template>
   <div class="app-container">
   <div class="app-container">
+    <div style="text-align: right; margin-bottom: 10px">
+      <el-date-picker
+        v-model="dateRange"
+        type="datetimerange"
+        range-separator="-"
+        value-format="yyyy-MM-dd HH:mm:ss"
+        start-placeholder="开始日期"
+        end-placeholder="结束日期"
+        @change="tjdatePicker"
+      >
+      </el-date-picker>
+    </div>
     <div class="header" style="width: 100%">
     <div class="header" style="width: 100%">
       <el-row class="row" :gutter="12">
       <el-row class="row" :gutter="12">
         <el-col :span="3">
         <el-col :span="3">
           <div class="item">
           <div class="item">
-            <div class="title">
-              <span>今日新增订单</span>
-            </div>
             <div class="count">
             <div class="count">
-              {{ orderStatistics ? orderStatistics.AllOrder : 0 }} 个
+              {{ orderStatistics ? orderStatistics.amount : 0 }} 个
             </div>
             </div>
-          </div>
-        </el-col>
-        <el-col :span="3">
-          <div class="item">
             <div class="title">
             <div class="title">
-              <span>待接单</span>
-            </div>
-            <div class="count">
-              {{ orderStatistics ? orderStatistics.waitOrderCount : 0 }}个
+              <span>总发放数量</span>
             </div>
             </div>
           </div>
           </div>
         </el-col>
         </el-col>
         <el-col :span="3">
         <el-col :span="3">
           <div class="item">
           <div class="item">
-            <div class="title">
-              <span>账期待审核</span>
-            </div>
             <div class="count">
             <div class="count">
-              {{ orderStatistics ? orderStatistics.waitAuditOrderCount : 0 }}个
+              {{ orderStatistics ? orderStatistics.receiveNum : 0 }}
             </div>
             </div>
-          </div>
-        </el-col>
-        <el-col :span="3">
-          <div class="item">
             <div class="title">
             <div class="title">
-              <span>待发货</span>
-            </div>
-            <div class="count">
-              {{ orderStatistics ? orderStatistics.waitDelivery : 0 }}个
+              <span>总发放金额(元)</span>
             </div>
             </div>
           </div>
           </div>
         </el-col>
         </el-col>
         <el-col :span="3">
         <el-col :span="3">
           <div class="item">
           <div class="item">
-            <div class="title">
-              <span>未发货待退款</span>
-            </div>
             <div class="count">
             <div class="count">
-              {{ orderStatistics ? orderStatistics.waitDeliveryRefund : 0 }}个
+              {{ orderStatistics ? orderStatistics.sendAmount : 0 }}个
             </div>
             </div>
-          </div>
-        </el-col>
-        <el-col :span="3">
-          <div class="item">
             <div class="title">
             <div class="title">
-              <span>待处理售后</span>
-            </div>
-            <div class="count">
-              {{ orderStatistics ? orderStatistics.afterSalesOrder : 0 }}个
+              <span>全部领取人数</span>
             </div>
             </div>
           </div>
           </div>
         </el-col>
         </el-col>
         <el-col :span="3">
         <el-col :span="3">
           <div class="item">
           <div class="item">
-            <div class="title">
-              <span>到账金额</span>
-            </div>
             <div class="count">
             <div class="count">
-              {{ orderStatistics ? orderStatistics.divideSuccessPrice : 0 }}个
+              {{ orderStatistics ? orderStatistics.sendNum : 0 }}个
             </div>
             </div>
-          </div>
-        </el-col>
-        <el-col :span="3">
-          <div class="item">
             <div class="title">
             <div class="title">
-              <span>冻结金额</span>
-            </div>
-            <div class="count">
-              {{ orderStatistics ? orderStatistics.divideWaitPrice : 0 }}元
-            </div>
-          </div>
-        </el-col>
-        <el-col :span="3">
-          <div class="item">
-            <div class="title">
-              <span>账期待付款</span>
-            </div>
-            <div class="count">
-              {{
-                orderStatistics.divideWaitPayPrice
-                  ? orderStatistics.divideWaitPayPrice
-                  : 0
-              }}元
-            </div>
-          </div>
-        </el-col>
-        <el-col :span="3">
-          <div class="item">
-            <div class="title">
-              <span>账期逾期金额</span>
-            </div>
-            <div class="count">
-              {{
-                orderStatistics.divideOverduePrice
-                  ? orderStatistics.divideOverduePrice
-                  : 0
-              }}元
+              <span>全部领取金额(元)</span>
             </div>
             </div>
           </div>
           </div>
         </el-col>
         </el-col>
       </el-row>
       </el-row>
     </div>
     </div>
-    <div class="radio">
-      <el-radio-group
-        v-model="queryParams.queryOrderStatus"
-        @change="radioChange"
-      >
-        <el-radio-button size="medium" label="0" name="0">
-          全部
-        </el-radio-button>
-        <el-radio-button
-          size="medium"
-          :label="item.value"
-          :name="item.value"
-          v-for="item in dict.type.sys_order_query_orderStatus"
-          :key="item.value"
-        >
-          {{ item.label }}
-        </el-radio-button>
-      </el-radio-group>
-    </div>
-
     <el-form
     <el-form
+      style="margin-top: 20px"
       :model="queryParams"
       :model="queryParams"
       ref="queryForm"
       ref="queryForm"
       size="small"
       size="small"
       :inline="true"
       :inline="true"
-      label-width="100px"
+      label-width="80px"
     >
     >
-      <el-form-item label="关键字" prop="key" label-width="100px">
+      <el-form-item label="" prop="key">
         <el-input
         <el-input
-          v-model="queryParams.spuName"
-          placeholder="请输入订单编号/商品ID/商品名称/买家手机号/买家ID搜索"
+          v-model="queryParams.key"
+          placeholder="请输入代金券ID/代金券名称/用户Id/用户昵称/用户手机号搜索"
           clearable
           clearable
-          style="width: 420px"
+          style="width: 300px"
         />
         />
       </el-form-item>
       </el-form-item>
-
-      <el-form-item label="下单时间" prop="createTime">
-        <el-date-picker
-          v-model="queryParams.createTime"
-          value-format="yyyy-MM-dd"
-          format="yyyy-MM-dd"
-          type="date"
-          placeholder="请选择下单时间"
-        >
-        </el-date-picker>
-      </el-form-item>
-      <el-form-item label="配送方式" prop="deliveryType">
+      <el-form-item label="推广方式" prop="showType">
         <el-select
         <el-select
-          v-model="queryParams.deliveryType"
-          placeholder="请选择配送方式"
+          v-model="queryParams.showType"
+          placeholder="请选择推广方式"
           style="width: 180px"
           style="width: 180px"
         >
         >
           <el-option label="全部" value=""> </el-option>
           <el-option label="全部" value=""> </el-option>
-          <el-option
-            :label="item.label"
-            :value="item.value"
-            v-for="item in dict.type.sys_order_deliveryType"
-          >
-          </el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item label="订单状态" prop="orderStatusKey">
-        <el-select
-          v-model="queryParams.orderStatusKey"
-          placeholder="请选择订单状态"
-          style="width: 220px"
-        >
-          <el-option label="全部" value=""> </el-option>
-          <el-option
-            :label="item.label"
-            :value="item.value"
-            v-for="item in dict.type.sys_order_orderStatusKey"
-          >
-          </el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item label="支付方式" prop="paymentType" label-width="100px">
-        <el-select
-          v-model="queryParams.paymentType"
-          placeholder="请选择支付方式"
-          style="width: 22 0px"
-        >
-          <el-option label="全部" value=""> </el-option>
-          <el-option
-            :label="item.label"
-            :value="item.value"
-            v-for="item in dict.type.sys_order_paymentType"
-          >
-          </el-option>
+          <el-option label="全网自动推出" value="0"> </el-option>
+          <el-option label="定向渠道推广" value="1"> </el-option>
         </el-select>
         </el-select>
       </el-form-item>
       </el-form-item>
 
 
-      <el-form-item
-        label="先用后付支付状态"
-        prop="paymentType"
-        label-width="140px"
-      >
+      <el-form-item label="类型" prop="type">
         <el-select
         <el-select
-          v-model="queryParams.paymentStatus"
-          placeholder="请选择支付状态"
+          v-model="queryParams.type"
+          placeholder="请选择券类型"
           style="width: 180px"
           style="width: 180px"
         >
         >
           <el-option label="全部" value=""> </el-option>
           <el-option label="全部" value=""> </el-option>
-          <el-option
-            :label="item.label"
-            :value="item.value"
-            v-for="item in dict.type.sys_order_payStatus"
-          >
-          </el-option>
+          <el-option label="独立券" value="1"> </el-option>
+          <el-option label="连锁券" value="2"> </el-option>
+          <el-option label="联合券" value="3"> </el-option>
         </el-select>
         </el-select>
       </el-form-item>
       </el-form-item>
 
 
-      <el-form-item label="售后状态" prop="afterSaleStatus">
-        <el-select
-          v-model="queryParams.afterSaleStatus"
-          placeholder="请选择售后状态"
-          style="width: 180px"
+      <el-form-item label="领取时间" prop="dateRange">
+        <el-date-picker
+          v-model="queryParams.dateRange"
+          type="datetimerange"
+          range-separator="-"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          @change="datePicker"
         >
         >
-          <el-option label="全部" value=""> </el-option>
-          <el-option
-            :label="item.label"
-            :value="item.value"
-            v-for="item in dict.type.sys_order_aftersalestatus"
-          >
-          </el-option>
-        </el-select>
+        </el-date-picker>
       </el-form-item>
       </el-form-item>
 
 
-      <el-form-item label="先用后付审核" prop="paymentType" label-width="140px">
-        <el-select
-          v-model="queryParams.paymentType"
-          placeholder="请选择支付方式"
-          style="width: 180px"
-        >
-          <el-option label="全部" value=""> </el-option>
-          <el-option
-            :label="item.label"
-            :value="item.value"
-            v-for="item in dict.type.sys_order_audit"
-          >
-          </el-option>
-        </el-select>
-      </el-form-item>
       <el-form-item>
       <el-form-item>
         <el-button
         <el-button
           type="primary"
           type="primary"
@@ -268,212 +123,55 @@
         >
         >
       </el-form-item>
       </el-form-item>
     </el-form>
     </el-form>
-
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button
-          plain
-          size="mini"
-          @click="printOrderBtn"
-          :disabled="!selectList.length > 0"
-          >批量接单</el-button
-        >
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          plain
-          size="mini"
-          @click="printOrderBtn"
-          :disabled="!selectList.length > 0"
-          >批量发货</el-button
-        >
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          size="mini"
-          @click="printOrderBtn"
-          :disabled="!selectList.length > 0"
-          >订单打印</el-button
-        >
-      </el-col>
-
-      <el-col :span="1.5">
-        <el-dropdown :hide-on-click="false" trigger="click">
-          <el-button type="primary" plain size="mini">
-            更多批量操作<i class="el-icon-arrow-down el-icon--right"></i>
-          </el-button>
-          <el-dropdown-menu slot="dropdown">
-            <el-dropdown-item @click.native=""
-              >批量先用后付审核</el-dropdown-item
-            >
-            <el-dropdown-item @click.native=""
-              >批量确认是否线下支付</el-dropdown-item
-            >
-            <el-dropdown-item @click.native="handleExport"
-              >批量导出</el-dropdown-item
-            >
-          </el-dropdown-menu>
-        </el-dropdown>
-      </el-col>
-    </el-row>
     <el-table
     <el-table
       ref="multipleTable"
       ref="multipleTable"
       v-loading="loading"
       v-loading="loading"
-      :span-method="objectSpanMethod"
       :data="spuList"
       :data="spuList"
       :border="true"
       :border="true"
-      @selection-change="handleSelectionChange"
       row-key="id"
       row-key="id"
     >
     >
       <el-table-column type="selection" align="center" />
       <el-table-column type="selection" align="center" />
-      <el-table-column
-        label="订单编号"
-        align="center"
-        prop="carPayNo"
-        width="230"
-      />
+      <el-table-column label="领取人ID" align="center" prop="userId" />
+      <el-table-column label="领取人昵称" align="center" prop="nick" />
+      <el-table-column label="领取人手机号" align="center" prop="phone" />
+      <el-table-column label="代金券ID" align="center" prop="voucherId" />
+      <el-table-column label="代金券名称" align="center" prop="voucherName" />
 
 
-      <el-table-column
-        label="商品名称"
-        align="center"
-        prop="skuName"
-        width="200"
-      >
+      <el-table-column label="类型" align="center" width="120">
         <template slot-scope="scope">
         <template slot-scope="scope">
           {{
           {{
-            scope.row.goodsInfo
-              ? JSON.parse(scope.row.goodsInfo)[0].skuName
+            scope.row.type == 0
+              ? "通用券"
+              : scope.row.type == 1
+              ? "独立券"
+              : scope.row.type == 2
+              ? "连锁券"
+              : scope.row.type == 3
+              ? "联合券"
               : ""
               : ""
           }}
           }}
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <el-table-column label="单价" align="center" prop="price">
-        <template slot-scope="scope">
-          <span>
-            {{
-              scope.row.goodsInfo
-                ? JSON.parse(scope.row.goodsInfo)[0].price + "元"
-                : ""
-            }}
-          </span>
-        </template>
-      </el-table-column>
-
-      <el-table-column label="数量" align="center" prop="price">
-        <template slot-scope="scope">
-          <span>
-            {{
-              scope.row.goodsInfo
-                ? JSON.parse(scope.row.goodsInfo)[0].quantity
-                : ""
-            }}{{
-              scope.row.goodsInfo ? JSON.parse(scope.row.goodsInfo)[0].unit : ""
-            }}</span
-          >
-        </template>
-      </el-table-column>
-
-      <el-table-column
-        label="交易金额(元)"
-        align="center"
-        prop="paymentAmount"
-        width="100"
-      >
-        <template slot-scope="scope">
-          {{ scope.row.goodsAmount.toFixed(2) }}元
-        </template>
-      </el-table-column>
 
 
-      <el-table-column label="订单状态" align="center" width="120">
-        <template slot-scope="scope">
-          <dict-tag
-            :options="dict.type.sys_order_orderStatus_table"
-            :value="scope.row.orderStatus"
-          />
-        </template>
-      </el-table-column>
-
-      <el-table-column label="售后状态" align="center">
-        <template slot-scope="scope">
-          <dict-tag
-            :options="dict.type.sys_order_aftersalestatus"
-            :value="scope.row.afterSaleStatus"
-          />
-        </template>
-      </el-table-column>
-      <el-table-column
-        label="下单人ID"
-        align="center"
-        prop="userId"
-        width="100"
-      />
-      <el-table-column
-        label="下单时间"
-        align="center"
-        prop="createTime"
-        width="160"
-      />
-      <el-table-column label="支付方式" align="center">
-        <template slot-scope="scope">
-          <dict-tag
-            :options="dict.type.sys_order_paymentType"
-            :value="scope.row.paymentType"
-          />
-        </template>
-      </el-table-column>
-      <el-table-column label="支付状态" align="center" prop="paymentStatus">
+      <el-table-column label="推广方式" align="center">
         <template slot-scope="scope">
         <template slot-scope="scope">
-          <dict-tag
-            :options="dict.type.sys_order_payStatus"
-            :value="scope.row.paymentStatus"
-          />
-        </template>
-      </el-table-column>
-      <el-table-column
-        label="配送方式"
-        align="center"
-        prop="paymentType"
-        width="120"
-      >
-        <template slot-scope="scope">
-          <dict-tag
-            :options="dict.type.sys_order_deliveryType"
-            :value="scope.row.deliveryType"
-          />
+          {{
+            scope.row.showType == 0
+              ? "全网自动推出"
+              : scope.row.showType == 1
+              ? "定向渠道推广"
+              : ""
+          }}
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-
-      <el-table-column label="操作" align="center" width="150" fixed="right">
+      <el-table-column label="面额(元)" align="center" prop="sendAmount" />
+      <el-table-column label="领取时间" align="center">
         <template slot-scope="scope">
         <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            @click="handlePrior(scope.row)"
-            v-if="
-              scope.row.paymentType == 'firstuse' &&
-              scope.row.auditFirstUse != 0
-            "
-            >先用后付审核</el-button
-          >
-          <el-button
-            size="mini"
-            type="text"
-            @click="handleOffline(scope.row)"
-            v-if="
-              scope.row.paymentStatus == '2' &&
-              scope.row.confirmOfflinePayment != 0
-            "
-            >确认是否已线下支付</el-button
-          >
-          <el-button
-            size="mini"
-            type="text"
-            @click="handleDetail(scope.row)"
-            v-hasPermi="['manage:order:detail']"
-            >订单详情</el-button
-          >
+          {{
+            scope.row.reviewTime
+              ? $moment(scope.row.reviewTime).format("YYYY-MM-DD HH:mm:ss")
+              : ""
+          }}
         </template>
         </template>
       </el-table-column>
       </el-table-column>
     </el-table>
     </el-table>
@@ -489,20 +187,9 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { statisticsOrderNum, queryUserOrderByShopId } from "@/api/manage/order";
-import Utils from "@/utils/derive";
+import moment from "moment";
+import { voucherStatistics, recordPage } from "@/api/marketing/voucher";
 export default {
 export default {
-  name: "wholesale",
-  dicts: [
-    "sys_order_deliveryType",
-    "sys_order_orderStatusKey",
-    "sys_order_paymentType",
-    "sys_order_aftersalestatus",
-    "sys_order_payStatus",
-    "sys_order_orderStatus_table",
-    "sys_order_query_orderStatus",
-    "sys_order_audit",
-  ],
   data() {
   data() {
     return {
     return {
       // 遮罩层
       // 遮罩层
@@ -512,51 +199,24 @@ export default {
       // 参数表格数据
       // 参数表格数据
       spuList: [],
       spuList: [],
       // 弹出层标题
       // 弹出层标题
-      title: "订单详情",
+      title: "",
       // 查询参数
       // 查询参数
+      dateRange: [],
       queryParams: {
       queryParams: {
-        queryOrderStatus: "0",
-        spuType: 0,
-        userId: "",
         pageNo: 1,
         pageNo: 1,
         pageSize: 10,
         pageSize: 10,
-        spuName: "",
-        userOrderSn: "",
-        userPhone: "",
-        createTime: "",
-        orderStatusKey: "",
-        afterSaleStatus: "",
-        paymentType: "",
-        deliveryType: "",
-      },
-      printForm: {
-        sn: "",
+        key: "",
+        showType: "",
+        startTime: "",
+        endTime: "",
+        type: "",
+        dateRange: [],
       },
       },
-      column: [
-        { header: "订单编号", key: "userOrderSn", width: 20 },
-        { header: "买家姓名", key: "userNick", width: 20 },
-        { header: "买家手机号", key: "userPhone", width: 20 },
-        { header: "商品名称", key: "skuName", width: 20 },
-        { header: "商品类型", key: "categoryName", width: 20 },
-        { header: "商品价格", key: "price", width: 20 },
-        { header: "包装方式", key: "packageType", width: 20 },
-        { header: "规格名称", key: "specsName", width: 20 },
-        { header: "规格值", key: "specsValue", width: 20 },
-        { header: "实付金额(元)", key: "goodsAmount", width: 20 },
-        { header: "商品数量", key: "goodsDetails", width: 20 },
-        { header: "运费", key: "freightFee", width: 20 },
-        { header: "订单状态", key: "orderStatus", width: 20 },
-        { header: "售后状态", key: "afterSaleStatus", width: 20 },
-        { header: "下单时间", key: "createTime", width: 20 },
-        { header: "付款时间 ", key: "paymentTime", width: 20 },
-      ],
-      // 表单参数
-      form: {},
-      // 表单校验
       orderStatistics: {},
       orderStatistics: {},
-      selectList: [],
-      selectListDC: [],
-      queryOrderStatus: 0,
+      queryStatistics: {
+        startTime: "",
+        endTime: "",
+      },
     };
     };
   },
   },
   mounted() {
   mounted() {
@@ -564,51 +224,23 @@ export default {
     this.getstatisticsOrder();
     this.getstatisticsOrder();
   },
   },
   methods: {
   methods: {
-    radioChange() {
-      this.getList();
-    },
-    orderReturn(type) {
-      switch (type) {
-        case "print":
-          this.$refs.multipleTable.clearSelection();
-          this.getList();
-        case "prior":
-          this.getList();
-        case "offline":
-          this.getList();
+    tjdatePicker(val) {
+      if (val) {
+        this.queryStatistics.startTime = moment(val[0]).valueOf();
+        this.queryStatistics.endTime = moment(val[1]).valueOf();
+      } else {
+        this.queryStatistics.startTime = "";
+        this.queryStatistics.endTime = "";
       }
       }
-    },
-    handleOffline(record) {
-      this.$refs.orderDialogRef.openDialog("offline", record);
-    },
-    handlePrior(record) {
-      this.$refs.orderDialogRef.openDialog("prior", record);
-    },
-    printOrderBtn() {
-      this.$refs.orderDialogRef.openDialog("print", this.selectList);
+      this.getstatisticsOrder();
     },
     },
 
 
-    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
-      if (columnIndex === 0 || columnIndex === 1) {
-        if (
-          rowIndex === 0 ||
-          row.carPayNo != this.spuList[rowIndex - 1].carPayNo
-        ) {
-          let rowspan = 0;
-          this.spuList.forEach((element) => {
-            if (element.carPayNo === row.carPayNo) {
-              rowspan++;
-            }
-          });
-          return [rowspan, 1];
-        } else {
-          return [0, 0];
-        }
-      }
+    datePicker(val) {
+      this.queryParams.startTime = moment(val[0]).valueOf();
+      this.queryParams.endTime = moment(val[1]).valueOf();
     },
     },
-
     getstatisticsOrder() {
     getstatisticsOrder() {
-      statisticsOrderNum({ spuType: 0 }).then((res) => {
+      voucherStatistics(this.queryStatistics).then((res) => {
         if (res.code == 200) {
         if (res.code == 200) {
           this.orderStatistics = res.data;
           this.orderStatistics = res.data;
         } else {
         } else {
@@ -619,71 +251,21 @@ export default {
 
 
     /** 查询参数列表 */
     /** 查询参数列表 */
     getList() {
     getList() {
-      this.selectList = [];
       this.loading = true;
       this.loading = true;
-      queryUserOrderByShopId(this.queryParams).then((response) => {
+      recordPage(this.queryParams).then((response) => {
         if (response.code == 200) {
         if (response.code == 200) {
-          let list = response.data.records;
-          let infoList = [];
-          for (let index = 0; index < list.length; index++) {
-            let e = list[index];
-            if (e.dxUserOrderVOList) {
-              for (let i = 0; i < e.dxUserOrderVOList.length; i++) {
-                let a = e.dxUserOrderVOList[i];
-                let c = { ...e, ...a };
-                infoList.push(c);
-              }
-            } else {
-              infoList.push(e);
-            }
-          }
-          let totalList = [];
-          for (let index = 0; index < infoList.length; index++) {
-            let e = infoList[index];
-            if (e.goodsInfo) {
-              try {
-                var goods = JSON.parse(e.goodsInfo);
-                e = { ...e, ...goods[0] };
-              } catch (error) {
-                console.error("解析 JSON 时出错:", error);
-                // 跳出当前循环,继续处理下一个元素
-                continue;
-              }
-            }
-            if (e.specsValue) {
-              for (let i = 0; i < e.specsValue.length; i++) {
-                let a = e.specsValue[i];
-                e = { ...e, ...a };
-              }
-            }
-
-            totalList.push(e);
-          }
-
-          totalList.forEach((e) => {
-            try {
-              let goos = JSON.parse(e.goodsInfo);
-              let detail = "";
-              if (goos && goos.length > 0) {
-                // 检查 goos 是否为空
-                goos.forEach((a) => {
-                  detail += `${a.skuName}(${a.specsValue[0]?.specsName})-数量:${a.quantity}${a.unit};`;
-                });
-              }
-              e.goodsDetails = detail;
-            } catch (error) {
-              console.error("解析 goodsInfo 时出错:", error);
-            }
-          });
-
-          this.spuList = totalList;
+          this.spuList = response.data.records;
           this.total = response.data.total;
           this.total = response.data.total;
           this.loading = false;
           this.loading = false;
         }
         }
       });
       });
     },
     },
+
     /** 重置按钮操作 */
     /** 重置按钮操作 */
     resetQuery() {
     resetQuery() {
+      this.dateRange = [];
+      this.queryParams.endTime = "";
+      this.queryParams.startTime = "";
       this.resetForm("queryForm");
       this.resetForm("queryForm");
       this.queryParams.pageNo = 1;
       this.queryParams.pageNo = 1;
       this.getList();
       this.getList();
@@ -693,24 +275,6 @@ export default {
       this.queryParams.pageNo = 1;
       this.queryParams.pageNo = 1;
       this.getList();
       this.getList();
     },
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.selectList = selection.map((item) => item.carPayNo);
-      this.selectListDC = selection.map((item) => item);
-    },
-
-    /** 导出按钮操作 */
-    handleExport() {
-      let lists = [];
-      for (let index = 0; index < this.spuList.length; index++) {
-        for (let a = 0; a < this.selectListDC.length; a++) {
-          if (this.spuList[index].id == this.selectListDC[a].id) {
-            lists.push(this.spuList[index]);
-          }
-        }
-      }
-      Utils.exportExcel(this.column, lists, "订单列表"); //导出方法
-    },
   },
   },
 };
 };
 </script>
 </script>
@@ -755,4 +319,4 @@ export default {
 .el-radio-button__inner {
 .el-radio-button__inner {
   width: 150px;
   width: 150px;
 }
 }
-</style> -->
+</style>

+ 8 - 3
src/views/marketing/voucher/components/stores-list/index.vue

@@ -170,9 +170,14 @@ export default {
     checkSelectable(row) {
     checkSelectable(row) {
       // 根据状态判断是否可选择,这里假设状态为 '禁用' 时禁止选择
       // 根据状态判断是否可选择,这里假设状态为 '禁用' 时禁止选择
       if (this.type == 1) {
       if (this.type == 1) {
-        let oldShop = JSON.parse(this.oldShopIds);
-        if (!oldShop.includes(row.id)) {
-          return row.status !== "禁用";
+        console.log(this.oldShopIds);
+        if (this.oldShopIds) {
+          let oldShop = JSON.parse(this.oldShopIds);
+          if (!oldShop.includes(row.id)) {
+            return row.status !== "禁用";
+          }
+        } else {
+          return row.status !== "启用";
         }
         }
       }
       }
     },
     },