cmy преди 1 година
родител
ревизия
1ca2031b49

+ 2 - 2
.env.dev

@@ -4,7 +4,7 @@ VUE_APP_ENV='dev'
 # 页面 title
 VUE_APP_TITLE=易趣水果
 # socket 系统长连接地址
-VUE_APP_WS_ADMIN_URL='ws://store.shangshiyiqu.com/ws'
+VUE_APP_WS_ADMIN_URL='ws://store.jlxnykj.cn/ws'
 # 接口请求地址
-VUE_APP_API_URL='https://store.shangshiyiqu.com/adminapi'
+VUE_APP_API_URL='https://store.jlxnykj.cn/adminapi'
 

+ 2 - 2
.env.production

@@ -5,6 +5,6 @@ VUE_APP_ENV='production'
 # 页面 title
 VUE_APP_TITLE=易趣水果
 # socket 系统连接地址 (ws)或(wss)://www.crmeb.com(换成你的域名)/ws 非独立部署默认为空
-VUE_APP_WS_ADMIN_URL='ws://store.shangshiyiqu.com /ws'
+VUE_APP_WS_ADMIN_URL='ws://store.jlxnykj.cn/ws'
 # 接口请求地址 (http)或 (https)://www.crmeb.com(换成你的域名)/adminapi 非独立部署默认为空
-VUE_APP_API_URL='https://store.shangshiyiqu.com/adminapi'
+VUE_APP_API_URL='https://store.jlxnykj.cn/adminapi'

+ 1 - 1
src/components/copyright/index.vue

@@ -1,6 +1,6 @@
 <template>
   <!-- 底部企业logo -->
-  <GlobalFooter class="i-copyright" :links="links" :copyright="copyright" />
+  <!-- <GlobalFooter class="i-copyright" :links="links" :copyright="copyright" /> -->
 </template>
 <script>
 import { getCrmebCopyRight } from '@/api/system'

+ 2 - 1
src/layouts/basic-layout/menu-head/index.vue

@@ -65,11 +65,12 @@
             },
             tabClick(name) {
               let tab = this.filterHeader.find(item => item.header === name);
+			  console.log(name,'name');
               this.$router.push(tab.path);
             }
         },
         watch: {
-            filterHeader () {
+            filterHeader (newHeader) {
                 this.handleGetMenuHeight();
             },
             isMobile () {

+ 654 - 0
src/pages/erp/inventory/addStoreIntegral.vue

@@ -0,0 +1,654 @@
+<template>
+  <div>
+    <div class="i-layout-page-header">
+      <PageHeader class="product_tabs" hidden-breadcrumb>
+        <div slot="title">
+          <router-link :to="{ path: `${roterPre}/marketing/store_integral/index` }"
+            ><Button icon="ios-arrow-back" size="small" class="mr20"
+              >返回</Button
+            ></router-link
+          >
+          <span
+            v-text="$route.params.id ? '编辑积分商品' : '添加积分商品'"
+            class="mr20"
+          ></span>
+        </div>
+      </PageHeader>
+    </div>
+    <Card :bordered="false" dis-hover class="ivu-mt">
+      <Row type="flex" class="mt30 acea-row row-middle row-center">
+        <Col span="23">
+          <Form
+            class="form mt30"
+            ref="formValidate"
+            :model="formValidate"
+            :rules="ruleValidate"
+            :label-width="labelWidth"
+            :label-position="labelPosition"
+            @submit.native.prevent
+          >
+            <FormItem label="选择商品:" prop="image_input">
+              <div class="picBox" @click="changeGoods">
+                <div
+                  class="pictrue"
+                  v-for="(item, index) in goodsImg"
+                  :key="index"
+                >
+                  <img v-lazy="item.image" v-if="item.image" />
+                  <span
+                    class="iconfont icondel_1"
+                    @click.stop="bindDelete(index)"
+                  ></span>
+                </div>
+
+                <div class="upLoad acea-row row-center-wrapper">
+                  <Icon type="ios-camera-outline" size="26" class="iconfonts" />
+                </div>
+              </div>
+            </FormItem>
+            <Col type="flex">
+              <Col span="24">
+                <FormItem label="规格选择:">
+                  <Table
+                    :data="specsData"
+                    :columns="columns"
+                    border
+                    class="mt25"
+                    highlight-row
+                    :loading="loading"
+                    @on-selection-change="changeCheckbox"
+                  >
+                    <template slot-scope="{ row, index }" slot="pic">
+                      <div
+                        class="acea-row row-middle row-center-wrapper"
+                        @click="modalPicTap('dan', 'danTable', index)"
+                      >
+                        <div class="pictrue pictrueTab" v-if="row.pic">
+                          <img v-lazy="row.pic" />
+                        </div>
+                        <div
+                          class="upLoad pictrueTab acea-row row-center-wrapper"
+                          v-else
+                        >
+                          <Icon
+                            type="ios-camera-outline"
+                            size="21"
+                            class="iconfont"
+                          />
+                        </div>
+                      </div>
+                    </template>
+                  </Table>
+                </FormItem>
+              </Col>
+              <Col span="24">
+                <FormItem
+                  label="上架状态:"
+                  props="is_show"
+                  label-for="is_show"
+                >
+                  <RadioGroup
+                    element-id="is_show"
+                    v-model="formValidate.is_show"
+                  >
+                    <Radio :label="0">关闭</Radio>
+                    <Radio :label="1" class="radio">开启</Radio>
+                  </RadioGroup>
+                </FormItem>
+              </Col>
+            </Col>
+            <Col span="24">
+              <FormItem>
+                <Button
+                  class="submission mr15"
+                  @click="step"
+                  v-show="current !== 0"
+                  :disabled="$route.params.id && current === 1"
+                  >上一步
+                </Button>
+                <Button
+                  :disabled="submitOpen && current === 1"
+                  type="primary"
+                  class="submission"
+                  @click="next('formValidate')"
+                  v-text="'提交'"
+                ></Button>
+              </FormItem>
+            </Col>
+          </Form>
+          <Spin size="large" fix v-if="spinShow"></Spin>
+        </Col>
+      </Row>
+    </Card>
+    <!-- 选择商品-->
+    <Modal
+      v-model="modals"
+      title="商品列表"
+      class="paymentFooter"
+      footerHide
+      scrollable
+      width="900"
+      @on-cancel="cancel"
+    >
+      <goods-list
+        v-if="modals"
+        ref="goodslist"
+        :ischeckbox="true"
+        @getProductId="getProductId"
+      ></goods-list>
+    </Modal>
+    <!-- 上传图片-->
+    <Modal
+      v-model="modalPic"
+      width="960px"
+      scrollable
+      footer-hide
+      closable
+      title="上传商品图"
+      :mask-closable="false"
+      :z-index="1"
+    >
+      <uploadPictures
+        :isChoice="isChoice"
+        @getPic="getPic"
+        @getPicD="getPicD"
+        :gridBtn="gridBtn"
+        :gridPic="gridPic"
+        v-if="modalPic"
+      ></uploadPictures>
+    </Modal>
+  </div>
+</template>
+
+<script>
+import { mapState } from "vuex";
+import goodsList from "@/components/goodsList/index";
+import uploadPictures from "@/components/uploadPictures";
+import {
+  integralAddBatch,
+  productAttrsApi,
+  integralInfoApi,
+} from "@/api/marketing";
+import Setting from "@/setting";
+export default {
+  name: "storeIntegralCreate",
+  components: { goodsList, uploadPictures },
+  data() {
+    return {
+      roterPre: Setting.roterPre,
+      loading: false,
+      goodsImg: [],
+      productsId: [],
+      submitOpen: false,
+      spinShow: false,
+      isChoice: "",
+      current: 0,
+      modalPic: false,
+      grid: {
+        xl: 12,
+        lg: 20,
+        md: 24,
+        sm: 24,
+        xs: 24,
+      },
+      grid2: {
+        xl: 8,
+        lg: 12,
+        md: 12,
+        sm: 24,
+        xs: 24,
+      },
+      gridPic: {
+        xl: 6,
+        lg: 8,
+        md: 12,
+        sm: 12,
+        xs: 12,
+      },
+      gridBtn: {
+        xl: 4,
+        lg: 8,
+        md: 8,
+        sm: 8,
+        xs: 8,
+      },
+      modals: false,
+      modal_loading: false,
+      images: [],
+      formValidate: {
+        is_show: 0,
+        attrs: [],
+      },
+      templateList: [],
+      timeList: [],
+      columns: [],
+      specsData: [],
+      picTit: "",
+      tableIndex: 0,
+      ruleValidate: {
+        price: [
+          {
+            required: true,
+            type: "number",
+            message: "请输入兑换积分",
+            trigger: "blur",
+          },
+        ],
+
+        num: [
+          {
+            required: true,
+            type: "number",
+            message: "请输入购买数量限制",
+            trigger: "blur",
+          },
+        ],
+        once_num: [
+          {
+            required: true,
+            type: "number",
+            message: "请输入单次购买数量限制",
+            trigger: "blur",
+          },
+        ],
+      },
+      copy: 0,
+    };
+  },
+  computed: {
+    ...mapState("admin/layout", ["isMobile"]),
+    labelWidth() {
+      return this.isMobile ? undefined : 135;
+    },
+    labelPosition() {
+      return this.isMobile ? "top" : "right";
+    },
+  },
+  mounted() {
+    if (this.$route.params.id) {
+      this.copy = this.$route.params.copy;
+      this.current = 1;
+      this.getInfo();
+    }
+  },
+  methods: {
+    // 规格;
+    productAttrs(rows) {
+      this.loading = true;
+      return new Promise((resolve, reject) => {
+        let that = this;
+        productAttrsApi(rows.product_id, 4)
+          .then((res) => {
+            let data = res.data.info;
+            let selection = {
+              type: "selection",
+              width: 60,
+              align: "center",
+            };
+            that.specsData = that.specsData.concat(data.attrs);
+            that.specsData.forEach(function (item, index) {
+              that.$set(that.specsData[index], "id", index);
+            });
+            that.columns = data.header;
+            that.columns.unshift(selection);
+            that.inputChange(data);
+            resolve();
+            this.loading = false;
+          })
+          .catch((res) => {
+            this.loading = false;
+
+            reject();
+            that.$Message.error(res.msg);
+          });
+      });
+    },
+    inputChange(data) {
+      let that = this;
+      let $index = [];
+      data.header.forEach(function (item, index) {
+        if (item.type === 1) {
+          $index.push({ index: index, key: item.key, title: item.title });
+        }
+      });
+      $index.forEach(function (item, index) {
+        let title = item.title;
+        let key = item.key;
+        let row = {
+          title: title,
+          key: key,
+          align: "center",
+          minWidth: 120,
+          render: (h, params) => {
+            return h("div", [
+              h("InputNumber", {
+                props: {
+                  min: 0,
+                  precision: 0,
+                  value: key === "price" ? params.row.price : params.row.quota,
+                },
+                on: {
+                  "on-change": (e) => {
+                    key === "price"
+                      ? (params.row.price = e)
+                      : (params.row.quota = e);
+                    that.specsData[params.index] = params.row;
+                    if (
+                      !!that.formValidate.attrs &&
+                      that.formValidate.attrs.length
+                    ) {
+                      that.formValidate.attrs.forEach((v, index) => {
+                        if (v.id === params.row.id) {
+                          that.formValidate.attrs.splice(index, 1, params.row);
+                        }
+                      });
+                    }
+                  },
+                },
+              }),
+            ]);
+          },
+        };
+        that.columns.splice(item.index, 1, row);
+      });
+    },
+    // 多选
+    changeCheckbox(selection) {
+      this.formValidate.attrs = selection;
+    },
+    // 商品id
+    async getProductId(row) {
+      for (let i = 0; i < this.goodsImg.length; i++) {
+        const element = this.goodsImg[i];
+        if (element.product_id === row.product_id) {
+          this.$Message.error("该商品已经添加");
+          return;
+        }
+      }
+      this.modal_loading = false;
+      this.modals = false;
+      this.goodsImg = this.goodsImg.concat(row);
+      // this.goodsImg.push({
+      //   image: row.image,
+      //   id: row.id,
+      // });
+      for (let j = 0; j < row.length; j++) {
+        const element = row[j];
+        await this.productAttrs(element);
+      }
+    },
+
+    cancel() {
+      this.modals = false;
+    },
+    // 具体日期
+    onchangeTime(e) {
+      this.formValidate.section_time = e;
+    },
+    // 详情
+    getInfo() {
+      this.spinShow = true;
+      integralInfoApi(this.$route.params.id)
+        .then(async (res) => {
+          let that = this;
+          let info = res.data.info;
+          let selection = {
+            type: "selection",
+            width: 60,
+            align: "center",
+          };
+          this.formValidate = info;
+          this.columns = info.attrs.header;
+          this.columns.unshift(selection);
+          this.specsData = info.attrs.value;
+          that.specsData.forEach(function (item, index) {
+            that.$set(that.specsData[index], "id", index);
+          });
+          let data = info.attrs;
+          let attr = [];
+          for (let index in info.attrs.value) {
+            if (info.attrs.value[index]._checked) {
+              attr.push(info.attrs.value[index]);
+            }
+          }
+          that.formValidate.attrs = attr;
+          that.inputChange(data);
+          this.spinShow = false;
+        })
+        .catch((res) => {
+          this.spinShow = false;
+          this.$Message.error(res.msg);
+        });
+    },
+    bindDelete(index) {
+      let delId = this.goodsImg[index].product_id;
+      this.goodsImg.splice(index, 1);
+      this.loading = true;
+      // 删除逻辑待完善
+    },
+    // 下一步
+    next(name) {
+      let that = this;
+      if (!this.formValidate.attrs.length) {
+        return that.$Message.error("请先选择商品规格");
+      }
+      for (let index in that.formValidate.attrs) {
+        if (that.formValidate.attrs[index].quota <= 0) {
+          return that.$Message.error("商品限量必须大于0");
+        }
+      }
+      this.$refs[name].validate((valid) => {
+        if (valid) {
+          if (this.copy == 1) this.formValidate.copy = 1;
+          this.formValidate.id = Number(this.$route.params.id) || 0;
+          this.submitOpen = true;
+          integralAddBatch(this.formValidate)
+            .then(async (res) => {
+              this.submitOpen = false;
+              this.$Message.success(res.msg);
+              setTimeout(() => {
+                this.$router.push({
+                  path: this.roterPre + "/marketing/store_integral/index",
+                });
+              }, 500);
+            })
+            .catch((res) => {
+              this.submitOpen = false;
+              this.$Message.error(res.msg);
+            });
+        } else {
+          return false;
+        }
+      });
+    },
+    // 上一步
+    step() {
+      this.current--;
+    },
+    // 内容
+    getContent(val) {
+      this.formValidate.description = val;
+    },
+    // 点击商品图
+    modalPicTap(tit, picTit, index) {
+      this.modalPic = true;
+      this.isChoice = tit === "dan" ? "单选" : "多选";
+      this.picTit = picTit;
+      this.tableIndex = index;
+    },
+    // 获取单张图片信息
+    getPic(pc) {
+      switch (this.picTit) {
+        case "danFrom":
+          this.formValidate.image = pc.att_dir;
+          break;
+        // case 'danTable':
+        //     this.specsData[this.tableIndex].pic = pc.att_dir;
+        //     break;
+        default:
+          if (!!this.formValidate.attrs && this.formValidate.attrs.length) {
+            this.$set(this.specsData[this.tableIndex], "_checked", true);
+          }
+          this.specsData[this.tableIndex].pic = pc.att_dir;
+      }
+      this.modalPic = false;
+    },
+    // 获取多张图信息
+    getPicD(pc) {
+      this.images = pc;
+      this.images.map((item) => {
+        this.formValidate.images.push(item.att_dir);
+        this.formValidate.images = this.formValidate.images.splice(0, 10);
+      });
+      this.modalPic = false;
+    },
+    handleRemove(i) {
+      this.images.splice(i, 1);
+      this.formValidate.images.splice(i, 1);
+    },
+    // 选择商品
+    changeGoods() {
+      this.modals = true;
+    }, // 移动
+    handleDragStart(e, item) {
+      this.dragging = item;
+    },
+    handleDragEnd(e, item) {
+      this.dragging = null;
+    },
+    // 首先把div变成可以放置的元素,即重写dragenter/dragover
+    handleDragOver(e) {
+      e.dataTransfer.dropEffect = "move"; // e.dataTransfer.dropEffect="move";//在dragenter中针对放置目标来设置!
+    },
+    handleDragEnter(e, item) {
+      e.dataTransfer.effectAllowed = "move"; // 为需要移动的元素设置dragstart事件
+      if (item === this.dragging) {
+        return;
+      }
+      const newItems = [...this.formValidate.images];
+      const src = newItems.indexOf(this.dragging);
+      const dst = newItems.indexOf(item);
+      newItems.splice(dst, 0, ...newItems.splice(src, 1));
+      this.formValidate.images = newItems;
+    },
+    // 添加自定义弹窗
+    addCustomDialog(editorId) {
+      window.UE.registerUI(
+        "test-dialog",
+        function (editor, uiName) {
+          // 创建 dialog
+          let dialog = new window.UE.ui.Dialog({
+            // 指定弹出层中页面的路径,这里只能支持页面,路径参考常见问题 2
+            iframeUrl: "/admin/widget.images/index.html?fodder=dialog",
+            // 需要指定当前的编辑器实例
+            editor: editor,
+            // 指定 dialog 的名字
+            name: uiName,
+            // dialog 的标题
+            title: "上传图片",
+            // 指定 dialog 的外围样式
+            cssRules: "width:1200px;height:500px;padding:20px;",
+          });
+          this.dialog = dialog;
+          // 参考上面的自定义按钮
+          var btn = new window.UE.ui.Button({
+            name: "dialog-button",
+            title: "上传图片",
+            cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -726px -77px;`,
+            onclick: function () {
+              // 渲染dialog
+              dialog.render();
+              dialog.open();
+            },
+          });
+          return btn;
+        },
+        37 /* 指定添加到工具栏上的那个位置,默认时追加到最后 */,
+        editorId /* 指定这个UI是哪个编辑器实例上的,默认是页面上所有的编辑器都会添加这个按钮 */
+      );
+    },
+  },
+};
+</script>
+
+<style scoped lang="stylus">
+.custom-label {
+  display: inline-flex;
+  line-height: 1.5;
+}
+
+.grey {
+  color: #999;
+}
+
+.maxW /deep/.ivu-select-dropdown {
+  max-width: 600px;
+}
+
+.tabBox_img {
+  width: 50px;
+  height: 50px;
+  margin: 0 auto;
+}
+
+.tabBox_img img {
+  width: 100%;
+  height: 100%;
+}
+
+.priceBox {
+  width: 100%;
+}
+
+.form {
+  .picBox {
+    display: inline-block;
+    cursor: pointer;
+    display: flex;
+    align-items: center;
+  }
+
+  .pictrue {
+    width: 60px;
+    height: 60px;
+    border: 1px dotted rgba(0, 0, 0, 0.1);
+    margin-right: 15px;
+    display: inline-block;
+    position: relative;
+    cursor: pointer;
+
+    img {
+      width: 100%;
+      height: 100%;
+    }
+
+    .icondel_1 {
+      position: absolute;
+      right: -10px;
+      top: -16px;
+      color: #999999;
+      font-size: 28px;
+      cursor: pointer;
+    }
+
+    .btndel {
+      position: absolute;
+      z-index: 9;
+      width: 20px !important;
+      height: 20px !important;
+      left: 46px;
+      top: -4px;
+    }
+  }
+
+  .upLoad {
+    width: 58px;
+    height: 58px;
+    line-height: 58px;
+    border: 1px dotted rgba(0, 0, 0, 0.1);
+    border-radius: 4px;
+    background: rgba(0, 0, 0, 0.02);
+    cursor: pointer;
+  }
+}
+</style>

+ 934 - 0
src/pages/erp/inventory/create.vue

@@ -0,0 +1,934 @@
+<template>
+  <div class="form-submit">
+    <div class="i-layout-page-header">
+      <PageHeader class="product_tabs" hidden-breadcrumb>
+        <div slot="title">
+          <router-link :to="{ path: `${roterPre}/marketing/store_integral/index` }"
+          >
+            <div class="font-sm after-line">
+              <span class="iconfont iconfanhui"></span>
+              <span class="pl10">返回</span>
+            </div>
+          </router-link
+          >
+          <span
+              v-text="$route.params.id ? '编辑积分商品' : '添加积分商品'"
+              class="mr20 ml16"
+          ></span>
+        </div>
+      </PageHeader>
+    </div>
+    <Card :bordered="false" dis-hover class="ivu-mt">
+      <Row type="flex" class="mt30 acea-row row-middle row-center">
+        <Col span="20">
+          <Steps :current="current">
+            <Step title="选择积分商品"></Step>
+            <Step title="填写基础信息"></Step>
+            <Step title="修改商品详情"></Step>
+          </Steps>
+        </Col>
+        <Col span="23">
+          <Form
+              class="form mt30"
+              ref="formValidate"
+              :model="formValidate"
+              :rules="ruleValidate"
+              @on-validate="validate"
+              :label-width="labelWidth"
+              :label-position="labelPosition"
+              @submit.native.prevent
+          >
+            <FormItem
+                label="选择商品:"
+                prop="image_input"
+                v-if="current === 0"
+            >
+              <div class="picBox" @click="changeGoods">
+                <div class="pictrue" v-if="formValidate.image">
+                  <img v-lazy="formValidate.image" />
+                </div>
+                <div class="upLoad acea-row row-center-wrapper" v-else>
+                  <Icon type="ios-camera-outline" size="26" class="iconfonts" />
+                </div>
+              </div>
+            </FormItem>
+            <Col v-show="current === 1" type="flex">
+              <!--<Col span="24">-->
+              <!--<FormItem prop="image">-->
+              <!--<div class="custom-label" slot="label">-->
+              <!--<div>-->
+              <!--<div>商品主图</div>-->
+              <!--<div>(750*750)</div>-->
+              <!--</div>-->
+              <!--<div>:</div>-->
+              <!--</div>-->
+              <!--<div class="picBox" @click="modalPicTap('dan', 'danFrom')">-->
+              <!--<div class="pictrue" v-if="formValidate.image">-->
+              <!--<img v-lazy="formValidate.image" />-->
+              <!--</div>-->
+              <!--<div class="upLoad acea-row row-center-wrapper" v-else>-->
+              <!--<Icon-->
+              <!--type="ios-camera-outline"-->
+              <!--size="26"-->
+              <!--class="iconfonts"-->
+              <!--/>-->
+              <!--</div>-->
+              <!--</div>-->
+              <!--</FormItem>-->
+              <!--</Col>-->
+              <Col span="24">
+                <FormItem prop="images">
+                  <div class="custom-label" slot="label">
+                    <div>
+                      <div>商品轮播图</div>
+                      <div>(750*750)</div>
+                    </div>
+                    <div>:</div>
+                  </div>
+                  <div class="acea-row">
+                    <div
+                        class="pictrue"
+                        v-for="(item, index) in formValidate.images"
+                        :key="index"
+                        draggable="true"
+                        @dragstart="handleDragStart($event, item)"
+                        @dragover.prevent="handleDragOver($event, item)"
+                        @dragenter="handleDragEnter($event, item)"
+                        @dragend="handleDragEnd($event, item)"
+                    >
+                      <img v-lazy="item" />
+                      <Button
+                          shape="circle"
+                          icon="md-close"
+                          @click.native="handleRemove(index)"
+                          class="btndel"
+                      ></Button>
+                    </div>
+                    <div
+                        v-if="formValidate.images.length < 10"
+                        class="upLoad acea-row row-center-wrapper"
+                        @click="modalPicTap('duo')"
+                    >
+                      <Icon
+                          type="ios-camera-outline"
+                          size="26"
+                          class="iconfonts"
+                      />
+                    </div>
+                  </div>
+                  <div class="tips">商品轮播图的第一个图为主图</div>
+                </FormItem>
+              </Col>
+              <Col span="24">
+                <Col v-bind="grid">
+                  <FormItem label="商品标题:" prop="title" label-for="title">
+                    <Input
+                        placeholder="请输入商品标题"
+                        element-id="title"
+                        v-model="formValidate.title"
+                    />
+                  </FormItem>
+                </Col>
+              </Col>
+              <Col span="24">
+                <FormItem label="用户兑换数量限制:" prop="num">
+                  <div class="acea-row row-middle">
+                    <InputNumber
+                        :min="1"
+                        :max="99999"
+                        placeholder="请输入数量限制"
+                        element-id="num"
+                        :precision="0"
+                        v-model="formValidate.num"
+                        class="perW20"
+                    />
+                  </div>
+                  <div class="tips">每个用户可购买该商品总数限制。例如设置为4,表示本活动,每个用户最多可兑换总数4个</div>
+                </FormItem>
+              </Col>
+              <Col span="24">
+                <FormItem label="单位:" prop="unit_name" label-for="unit_name">
+                  <Input
+                      placeholder="请输入单位"
+                      element-id="unit_name"
+                      v-model="formValidate.unit_name"
+                      class="perW20"
+                  />
+                </FormItem>
+              </Col>
+
+              <Col span="24">
+                <FormItem label="排序:">
+                  <InputNumber
+                      placeholder="请输入排序"
+                      element-id="sort"
+                      :precision="0"
+                      v-model="formValidate.sort"
+                      class="perW10"
+                  />
+                </FormItem>
+              </Col>
+              <Col span="24">
+                <FormItem label="上架状态:" props="is_show" label-for="status">
+                  <RadioGroup
+                      element-id="is_show"
+                      v-model="formValidate.is_show"
+                  >
+                    <Radio :label="1" class="radio">开启</Radio>
+                    <Radio :label="0">关闭</Radio>
+                  </RadioGroup>
+                </FormItem>
+              </Col>
+              <Col v-bind="grid2">
+                <FormItem
+                    label="热门推荐:"
+                    props="is_host"
+                    label-for="is_host"
+                >
+                  <RadioGroup
+                      element-id="is_host"
+                      v-model="formValidate.is_host"
+                  >
+                    <Radio :label="1" class="radio">开启</Radio>
+                    <Radio :label="0">关闭</Radio>
+                  </RadioGroup>
+                  <div class="tips">
+                    开启后将会在移动端积分商城主页中显示
+                    <Poptip placement="bottom" trigger="hover" width="256" transfer padding="8px">
+                      <a>查看示例</a>
+                      <div class="exampleImg" slot="content">
+                        <img :src="`${baseURL}/statics/system/storeProductIntegral.png`" alt=""/>
+                      </div>
+                    </Poptip>
+                  </div>
+                </FormItem>
+              </Col>
+              <Col span="24">
+                <FormItem label="规格选择:">
+                  <Table
+                      :data="specsData"
+                      :columns="columns"
+                      border
+                      class="mt25"
+                      highlight-row
+                      @on-selection-change="changeCheckbox"
+                  >
+                    <template slot-scope="{ row, index }" slot="pic">
+                      <div
+                          class="acea-row row-middle row-center-wrapper"
+                          @click="modalPicTap('dan', 'danTable', index)"
+                      >
+                        <div class="pictrue pictrueTab" v-if="row.pic">
+                          <img v-lazy="row.pic" />
+                        </div>
+                        <div
+                            class="upLoad pictrueTab acea-row row-center-wrapper"
+                            v-else
+                        >
+                          <Icon
+                              type="ios-camera-outline"
+                              size="21"
+                              class="iconfont"
+                          />
+                        </div>
+                      </div>
+                    </template>
+                  </Table>
+                </FormItem>
+              </Col>
+            </Col>
+            <Row v-show="current === 2">
+              <Col span="24">
+                <FormItem label="内容:">
+                  <WangEditor
+                      style="width: 90%"
+                      :content="description"
+                      @editorContent="getEditorContent"
+                  ></WangEditor>
+                </FormItem>
+              </Col>
+            </Row>
+            <Col span="24">
+              <!-- <FormItem>
+                <Button
+                  class="submission mr15"
+                  @click="step"
+                  v-show="current !== 0"
+                  :disabled="$route.params.id && current === 1"
+                  >上一步
+                </Button>
+                <Button
+                  :disabled="submitOpen && current === 2"
+                  type="primary"
+                  class="submission"
+                  @click="next('formValidate')"
+                  v-text="current === 2 ? '提交' : '下一步'"
+                ></Button>
+              </FormItem> -->
+            </Col>
+          </Form>
+          <Spin size="large" fix v-if="spinShow"></Spin>
+        </Col>
+      </Row>
+    </Card>
+    <Card :bordered="false" dis-hover class="fixed-card" :style="{left: `${!menuCollapse?'200px':isMobile?'0':'80px'}`}">
+      <Form>
+        <FormItem>
+          <Button
+              class="submission mr15"
+              @click="step"
+              v-show="current !== 0"
+              :disabled="$route.params.id && current === 1"
+          >上一步
+          </Button>
+          <Button
+              :disabled="submitOpen && current === 2"
+              type="primary"
+              class="submission"
+              @click="next('formValidate')"
+              v-text="current === 2 ? '提交' : '下一步'"
+          ></Button>
+        </FormItem>
+      </Form>
+    </Card>
+    <!-- 选择商品-->
+    <Modal
+        v-model="modals"
+        title="商品列表"
+        class="paymentFooter"
+        footerHide
+        scrollable
+        width="900"
+        @on-cancel="cancel"
+    >
+      <goods-list ref="goodslist" @getProductId="getProductId"></goods-list>
+    </Modal>
+    <!-- 上传图片-->
+    <Modal
+        v-model="modalPic"
+        width="960px"
+        scrollable
+        footer-hide
+        closable
+        title="上传商品图"
+        :mask-closable="false"
+        :z-index="1"
+    >
+      <uploadPictures
+          :isChoice="isChoice"
+          @getPic="getPic"
+          @getPicD="getPicD"
+          :gridBtn="gridBtn"
+          :gridPic="gridPic"
+          v-if="modalPic"
+      ></uploadPictures>
+    </Modal>
+  </div>
+</template>
+
+<script>
+import { mapState } from "vuex";
+import Setting from '@/setting';
+import goodsList from "@/components/goodsList/index";
+import WangEditor from "@/components/wangEditor/index.vue";
+import uploadPictures from "@/components/uploadPictures";
+import {
+  integralAddApi,
+  productAttrsApi,
+  integralInfoApi,
+} from "@/api/marketing";
+
+export default {
+  name: "storeIntegralCreate",
+  components: { goodsList, uploadPictures, WangEditor },
+  data() {
+    return {
+      roterPre: Setting.roterPre,
+      baseURL: Setting.apiBaseURL.replace(/adminapi/, ''),
+      submitOpen: false,
+      spinShow: false,
+      isChoice: "",
+      current: 0,
+      modalPic: false,
+      grid: {
+        xl: 12,
+        lg: 20,
+        md: 24,
+        sm: 24,
+        xs: 24,
+      },
+      grid2: {
+        xl: 8,
+        lg: 12,
+        md: 12,
+        sm: 24,
+        xs: 24,
+      },
+      gridPic: {
+        xl: 6,
+        lg: 8,
+        md: 12,
+        sm: 12,
+        xs: 12,
+      },
+      gridBtn: {
+        xl: 4,
+        lg: 8,
+        md: 8,
+        sm: 8,
+        xs: 8,
+      },
+      modals: false,
+      modal_loading: false,
+      images: [],
+      formValidate: {
+        images: [],
+        info: "",
+        title: "",
+        image: "",
+        unit_name: "",
+        price: 0,
+        ot_price: 0,
+        cost: 0,
+        sales: 0,
+        stock: 0,
+        sort: 0,
+        num: 1,
+        once_num: 1,
+        give_integral: 0,
+        postage: 0,
+        section_time: [],
+        is_postage: 0,
+        is_hot: 0,
+        status: 0,
+        description: "",
+        id: 0,
+        product_id: 0,
+        temp_id: "",
+        time_id: "",
+        attrs: [],
+        items: [],
+        integral:0
+      },
+      description:'',
+      templateList: [],
+      timeList: [],
+      columns: [],
+      specsData: [],
+      picTit: "",
+      tableIndex: 0,
+      ruleValidate: {
+        image: [{ required: true, message: "请选择主图", trigger: "change" }],
+        images: [
+          {
+            required: true,
+            type: "array",
+            message: "请选择主图",
+            trigger: "change",
+          },
+          {
+            type: "array",
+            min: 1,
+            message: "Choose two hobbies at best",
+            trigger: "change",
+          },
+        ],
+        title: [{ required: true, message: "请输入商品标题", trigger: "blur" }],
+        info: [
+          { required: true, message: "请输入积分活动简介", trigger: "blur" },
+        ],
+        unit_name: [{ required: true, message: "请输入单位", trigger: "blur" }],
+        ot_price: [
+          {
+            required: true,
+            type: "number",
+            message: "请输入原价",
+            trigger: "blur",
+          },
+        ],
+        cost: [
+          {
+            required: true,
+            type: "number",
+            message: "请输入成本价",
+            trigger: "blur",
+          },
+        ],
+        stock: [
+          {
+            required: true,
+            type: "number",
+            message: "请输入库存",
+            trigger: "blur",
+          },
+        ],
+        num: [
+          {
+            required: true,
+            type: "number",
+            message: "请输入兑换数量限制",
+            trigger: "blur",
+          },
+        ],
+        once_num: [
+          {
+            required: true,
+            type: "number",
+            message: "请输入单次兑换数量限制",
+            trigger: "blur",
+          },
+        ],
+      },
+      copy: 0,
+    };
+  },
+  computed: {
+    ...mapState("admin/layout", ["isMobile","menuCollapse"]),
+    labelWidth() {
+      return this.isMobile ? undefined : 135;
+    },
+    labelPosition() {
+      return this.isMobile ? "top" : "right";
+    },
+  },
+  mounted() {
+    if (this.$route.params.id) {
+      this.copy = this.$route.params.copy;
+      this.current = 1;
+      this.getInfo();
+    }
+  },
+  methods: {
+    getEditorContent(data) {
+      this.formValidate.description = data;
+    },
+    // 规格;
+    productAttrs(rows) {
+      let that = this;
+      productAttrsApi(rows.id, 4)
+          .then((res) => {
+            let data = res.data.info;
+            let selection = {
+              type: "selection",
+              width: 60,
+              align: "center",
+            };
+            that.specsData = data.attrs;
+            that.specsData.forEach(function (item, index) {
+              that.$set(that.specsData[index], "id", index);
+            });
+            that.formValidate.items = data.items;
+            that.columns = data.header;
+            that.columns.unshift(selection);
+            that.inputChange(data);
+          })
+          .catch((res) => {
+            that.$Message.error(res.msg);
+          });
+    },
+    inputChange(data) {
+      let that = this;
+      let $index = [];
+      data.header.forEach(function (item, index) {
+        if (item.type === 1) {
+          $index.push({ index: index, key: item.key, title: item.title });
+        }
+      });
+      $index.forEach(function (item, index) {
+        let title = item.title;
+        let key = item.key;
+        let row = {
+          title: title,
+          key: key,
+          align: "center",
+          minWidth: 120,
+          render: (h, params) => {
+            return h("div", [
+              h("InputNumber", {
+                props: {
+                  min: 0,
+                  max: 99999,
+                  value: key === "price" ? params.row.price : key === "integral"? params.row.integral : params.row.quota,
+                },
+                on: {
+                  "on-change": (e) => {
+                    key === "price" ? (params.row.price = e) : key === "integral" ? (params.row.integral = e) : (params.row.quota = e);
+                    that.specsData[params.index] = params.row;
+                    if (
+                        !!that.formValidate.attrs &&
+                        that.formValidate.attrs.length
+                    ) {
+                      that.formValidate.attrs.forEach((v, index) => {
+                        if (v.id === params.row.id) {
+                          that.formValidate.attrs.splice(index, 1, params.row);
+                        }
+                      });
+                    }
+                  },
+                },
+              }),
+            ]);
+          },
+        };
+        that.columns.splice(item.index, 1, row);
+      });
+    },
+    // 多选
+    changeCheckbox(selection) {
+      this.formValidate.attrs = selection;
+    },
+    // 表单验证
+    validate(prop, status, error) {
+      if (status === false) {
+        this.$Message.error(error);
+      }
+    },
+    // 商品id
+    getProductId(row) {
+      this.modal_loading = false;
+      this.modals = false;
+      setTimeout(() => {
+        this.formValidate = {
+          images: row.slider_image,
+          info: row.store_info,
+          title: row.store_name,
+          image: row.image,
+          unit_name: row.unit_name,
+          price: 0, // 不取商品中的原价
+          integral:0,
+          ot_price: row.ot_price,
+          cost: row.cost,
+          sales: row.sales,
+          stock: row.stock,
+          sort: row.sort,
+          num: 1,
+          once_num: 1,
+          give_integral: row.give_integral,
+          postage: row.postage,
+          section_time: [],
+          is_postage: row.is_postage,
+          is_host: 0,
+          is_show: 1,
+          description: row.description,
+          id: 0,
+          product_id: row.id,
+          temp_id: row.temp_id,
+        };
+        this.description = row.description
+        this.productAttrs(row);
+        this.$refs.goodslist.productRow = null;
+      }, 500);
+    },
+
+    cancel() {
+      this.modals = false;
+    },
+    // 具体日期
+    onchangeTime(e) {
+      this.formValidate.section_time = e;
+    },
+    // 详情
+    getInfo() {
+      this.spinShow = true;
+      integralInfoApi(this.$route.params.id)
+          .then(async (res) => {
+            let that = this;
+            let info = res.data.info;
+            let selection = {
+              type: "selection",
+              width: 60,
+              align: "center",
+            };
+            this.formValidate = info;
+            this.description = info.description;
+            this.$set(this.formValidate, "items", info.attrs.items);
+            this.columns = info.attrs.header;
+            this.columns.unshift(selection);
+            this.specsData = info.attrs.value;
+            that.specsData.forEach(function (item, index) {
+              that.$set(that.specsData[index], "id", index);
+            });
+            let data = info.attrs;
+            let attr = [];
+            for (let index in info.attrs.value) {
+              if (info.attrs.value[index]._checked) {
+                attr.push(info.attrs.value[index]);
+              }
+            }
+            that.formValidate.attrs = attr;
+            that.inputChange(data);
+            this.spinShow = false;
+          })
+          .catch((res) => {
+            this.spinShow = false;
+            this.$Message.error(res.msg);
+          });
+    },
+    // 下一步
+    next(name) {
+      let that = this;
+      if (this.current === 2) {
+        this.$refs[name].validate((valid) => {
+          if (valid) {
+            if (this.copy == 1) this.formValidate.copy = 1;
+            this.formValidate.id = Number(this.$route.params.id) || 0;
+            this.submitOpen = true;
+            integralAddApi(this.formValidate)
+                .then(async (res) => {
+                  this.submitOpen = false;
+                  this.$Message.success(res.msg);
+                  setTimeout(() => {
+                    this.$router.push({
+                      path: this.roterPre + "/marketing/store_integral/index",
+                    });
+                  }, 500);
+                })
+                .catch((res) => {
+                  this.submitOpen = false;
+                  this.$Message.error(res.msg);
+                });
+          } else {
+            return false;
+          }
+        });
+      } else if (this.current === 1) {
+        this.$refs[name].validate((valid) => {
+          if (valid) {
+            if (!that.formValidate.attrs) {
+              return that.$Message.error("请选择属性规格");
+            } else {
+              for (let index in that.formValidate.attrs) {
+                if (that.formValidate.attrs[index].quota <= 0) {
+                  return that.$Message.error("兑换次数必须大于0");
+                }
+                if(that.formValidate.attrs[index].price<=0 && that.formValidate.attrs[index].integral<=0){
+                  return that.$Message.error("兑换积分与兑换金额不能同时为0");
+                }
+              }
+            }
+            this.current += 1;
+          } else {
+            return this.$Message.warning("请完善商品信息");
+          }
+        });
+      } else {
+        if (this.formValidate.image) {
+          this.current += 1;
+        } else {
+          this.$Message.warning("请选择商品");
+        }
+      }
+    },
+    // 上一步
+    step() {
+      this.current--;
+    },
+    // 内容
+    getContent(val) {
+      this.formValidate.description = val;
+    },
+    // 点击商品图
+    modalPicTap(tit, picTit, index) {
+      this.modalPic = true;
+      this.isChoice = tit === "dan" ? "单选" : "多选";
+      this.picTit = picTit;
+      this.tableIndex = index;
+    },
+    // 获取单张图片信息
+    getPic(pc) {
+      switch (this.picTit) {
+        case "danFrom":
+          this.formValidate.image = pc.att_dir;
+          break;
+          // case 'danTable':
+          //     this.specsData[this.tableIndex].pic = pc.att_dir;
+          //     break;
+        default:
+          if (!!this.formValidate.attrs && this.formValidate.attrs.length) {
+            this.$set(this.specsData[this.tableIndex], "_checked", true);
+          }
+          this.specsData[this.tableIndex].pic = pc.att_dir;
+      }
+      this.modalPic = false;
+    },
+    // 获取多张图信息
+    getPicD(pc) {
+      this.images = pc;
+      this.images.map((item) => {
+        this.formValidate.images.push(item.att_dir);
+        this.formValidate.images = this.formValidate.images.splice(0, 10);
+      });
+      this.modalPic = false;
+    },
+    handleRemove(i) {
+      this.images.splice(i, 1);
+      this.formValidate.images.splice(i, 1);
+    },
+    // 选择商品
+    changeGoods() {
+      this.modals = true;
+    }, // 移动
+    handleDragStart(e, item) {
+      this.dragging = item;
+    },
+    handleDragEnd(e, item) {
+      this.dragging = null;
+    },
+    // 首先把div变成可以放置的元素,即重写dragenter/dragover
+    handleDragOver(e) {
+      e.dataTransfer.dropEffect = "move"; // e.dataTransfer.dropEffect="move";//在dragenter中针对放置目标来设置!
+    },
+    handleDragEnter(e, item) {
+      e.dataTransfer.effectAllowed = "move"; // 为需要移动的元素设置dragstart事件
+      if (item === this.dragging) {
+        return;
+      }
+      const newItems = [...this.formValidate.images];
+      const src = newItems.indexOf(this.dragging);
+      const dst = newItems.indexOf(item);
+      newItems.splice(dst, 0, ...newItems.splice(src, 1));
+      this.formValidate.images = newItems;
+    },
+    // 添加自定义弹窗
+    addCustomDialog(editorId) {
+      window.UE.registerUI(
+          "test-dialog",
+          function (editor, uiName) {
+            // 创建 dialog
+            let dialog = new window.UE.ui.Dialog({
+              // 指定弹出层中页面的路径,这里只能支持页面,路径参考常见问题 2
+              iframeUrl: "/admin/widget.images/index.html?fodder=dialog",
+              // 需要指定当前的编辑器实例
+              editor: editor,
+              // 指定 dialog 的名字
+              name: uiName,
+              // dialog 的标题
+              title: "上传图片",
+              // 指定 dialog 的外围样式
+              cssRules: "width:1200px;height:500px;padding:20px;",
+            });
+            this.dialog = dialog;
+            // 参考上面的自定义按钮
+            var btn = new window.UE.ui.Button({
+              name: "dialog-button",
+              title: "上传图片",
+              cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -726px -77px;`,
+              onclick: function () {
+                // 渲染dialog
+                dialog.render();
+                dialog.open();
+              },
+            });
+            return btn;
+          },
+          37 /* 指定添加到工具栏上的那个位置,默认时追加到最后 */,
+          editorId /* 指定这个UI是哪个编辑器实例上的,默认是页面上所有的编辑器都会添加这个按钮 */
+      );
+    },
+  },
+};
+</script>
+
+<style scoped lang="stylus">
+.custom-label {
+  display: inline-flex;
+  line-height: 1.5;
+}
+
+.grey {
+  color: #999;
+}
+
+.maxW /deep/.ivu-select-dropdown {
+  max-width: 600px;
+}
+
+.tabBox_img {
+  width: 50px;
+  height: 50px;
+  margin: 0 auto;
+}
+
+.tabBox_img img {
+  width: 100%;
+  height: 100%;
+}
+
+.priceBox {
+  width: 100%;
+}
+
+.form {
+  .picBox {
+    display: inline-block;
+    cursor: pointer;
+  }
+
+  .pictrue {
+    width: 60px;
+    height: 60px;
+    border: 1px dotted rgba(0, 0, 0, 0.1);
+    margin-right: 15px;
+    display: inline-block;
+    position: relative;
+    cursor: pointer;
+
+    img {
+      width: 100%;
+      height: 100%;
+    }
+
+    .btndel {
+      position: absolute;
+      z-index: 9;
+      width: 20px !important;
+      height: 20px !important;
+      left: 46px;
+      top: -4px;
+    }
+  }
+
+  .upLoad {
+    width: 58px;
+    height: 58px;
+    line-height: 58px;
+    border: 1px dotted rgba(0, 0, 0, 0.1);
+    border-radius: 4px;
+    background: rgba(0, 0, 0, 0.02);
+    cursor: pointer;
+  }
+}
+.form-submit {
+  /deep/.ivu-card{
+    border-radius: 0;
+  }
+  margin-bottom: 79px;
+
+  .fixed-card {
+    position: fixed;
+    right: 0;
+    bottom: 0;
+    left: 200px;
+    z-index: 99;
+    box-shadow: 0 -1px 2px rgb(240, 240, 240);
+
+    /deep/ .ivu-card-body {
+      padding: 15px 16px 14px;
+    }
+
+    .ivu-form-item {
+      margin-bottom: 0;
+    }
+
+    /deep/ .ivu-form-item-content {
+      margin-right: 124px;
+      text-align: center;
+    }
+
+    .ivu-btn {
+      height: 36px;
+      padding: 0 20px;
+    }
+  }
+}
+</style>

+ 372 - 0
src/pages/erp/inventory/index.vue

@@ -0,0 +1,372 @@
+<template>
+  <!-- 营销-积分商品 -->
+  <div>
+    <Card :bordered="false" dis-hover class="ivu-mt" :padding= "0">
+      <div class="new_card_pd">
+        <!-- 查询条件 -->
+        <Form
+            ref="tableFrom"
+            inline
+            :model="tableFrom"
+            :label-width="labelWidth"
+            :label-position="labelPosition"
+            @submit.native.prevent
+        >
+          <FormItem label="创建时间:" label-for="user_time">
+            <!--<DatePicker clearable @on-change="onchangeTime" v-model="timeVal" :value="timeVal"  format="yyyy/MM/dd" type="daterange" placement="bottom-end" placeholder="选择时间" v-width="'100%'"></DatePicker>-->
+            <DatePicker
+                :editable="false"
+                @on-change="onchangeTime"
+                :value="timeVal"
+                format="yyyy/MM/dd"
+                type="datetimerange"
+                placement="bottom-start"
+                placeholder="自定义时间"
+                class="mr20 input-add"
+                :options="options"
+            ></DatePicker>
+          </FormItem>
+          <FormItem label="上架状态:">
+            <Select
+                placeholder="请选择"
+                clearable
+                class="input-add"
+                v-model="tableFrom.is_show"
+            >
+              <Option value="1">上架</Option>
+              <Option value="0">下架</Option>
+            </Select>
+          </FormItem>
+          <FormItem label="商品搜索:" label-for="store_name">
+            <Input
+                class="input-add mr14"
+                placeholder="请输入商品标题,ID"
+                v-model="tableFrom.store_name"
+            />
+            <Button type="primary" @click="tableSearchs()">查询</Button>
+          </FormItem>
+          <!-- <Button
+            v-auth="['marketing-store_seckill-create']"
+            type="primary"
+            icon="md-add"
+            @click="addMore"
+            class="mr10"
+            >批量添加积分商品</Button
+          > -->
+          <!--<Button v-auth="['export-storeSeckill']" class="export" icon="ios-share-outline" @click="exports">导出</Button>-->
+        </Form>
+      </div>
+    </Card>
+    <Card :bordered="false" dis-hover class="ivu-mt">
+      <!-- 操作 -->
+      <Button
+          v-auth="['marketing-store_seckill-create']"
+          type="primary"
+          @click="add"
+          class="mr10"
+      >添加积分商品</Button
+      >
+      <!-- 积分商品-表格 -->
+      <Table
+          :columns="columns1"
+          :data="tableList"
+          :loading="loading"
+          highlight-row
+          no-userFrom-text="暂无数据"
+          no-filtered-userFrom-text="暂无筛选结果"
+          class="ivu-mt"
+      >
+        <template slot-scope="{ row, index }" slot="image">
+          <viewer>
+            <div class="tabBox_img">
+              <img v-lazy="row.image" />
+            </div>
+          </viewer>
+        </template>
+        <template slot-scope="{ row, index }" slot="stop_time">
+          <span> {{ row.stop_time | formatDate }}</span>
+        </template>
+        <template slot-scope="{ row, index }" slot="is_show">
+          <i-switch
+              v-model="row.is_show"
+              :value="row.is_show"
+              :true-value="1"
+              :false-value="0"
+              @on-change="onchangeIsShow(row)"
+              size="large"
+          >
+            <span slot="open">上架</span>
+            <span slot="close">下架</span>
+          </i-switch>
+        </template>
+        <template slot-scope="{ row, index }" slot="action">
+          <!-- <a v-if="row.stop_status === 1" @click="copy(row)" >一键复制</a>
+                    <a v-else @click="edit(row)" >编辑</a> -->
+          <a @click="orderList(row)">兑换记录</a>
+          <Divider type="vertical" />
+          <a @click="edit(row)">编辑</a>
+          <Divider type="vertical" />
+          <a @click="copy(row)">复制</a>
+          <Divider type="vertical" />
+          <a @click="del(row, '删除积分商品', index)">删除</a>
+        </template>
+      </Table>
+      <div class="acea-row row-right page">
+        <Page
+            :total="total"
+            :current="tableFrom.page"
+            show-elevator
+            show-total
+            @on-change="pageChange"
+            :page-size="tableFrom.limit"
+        />
+      </div>
+    </Card>
+  </div>
+</template>
+
+<script>
+import { mapState } from "vuex";
+import {
+  integralProductListApi,
+  integralIsShowApi,
+  storeSeckillApi,
+} from "@/api/marketing";
+import { formatDate } from "@/utils/validate";
+import timeOptions from "@/utils/timeOptions";
+import Setting from "@/setting";
+export default {
+  name: "storeIntegral",
+  filters: {
+    formatDate(time) {
+      if (time !== 0) {
+        let date = new Date(time * 1000);
+        return formatDate(date, "yyyy-MM-dd");
+      }
+    },
+  },
+  data() {
+    return {
+      roterPre: Setting.roterPre,
+      loading: false,
+      options: timeOptions,
+      columns1: [
+        {
+          title: "ID",
+          key: "id",
+          width: 80,
+        },
+        {
+          title: "商品图片",
+          slot: "image",
+          minWidth: 90,
+        },
+        {
+          title: "商品标题",
+          key: "title",
+          minWidth: 130,
+        },
+        {
+          title: "兑换积分",
+          key: "integral",
+          minWidth: 100,
+        },
+        {
+          title: "兑换金额",
+          key: "price",
+          minWidth: 100,
+        },
+        {
+          title: "限量",
+          key: "quota_show",
+          minWidth: 130,
+        },
+        {
+          title: "限量剩余",
+          key: "quota",
+          minWidth: 130,
+        },
+        {
+          title: "创建时间",
+          key: "add_time",
+          minWidth: 130,
+        },
+        {
+          title: "排序",
+          key: "sort",
+          minWidth: 50,
+        },
+        {
+          title: "状态",
+          slot: "is_show",
+          minWidth: 100,
+        },
+        {
+          title: "操作",
+          slot: "action",
+          fixed: "right",
+          width: 200,
+        },
+      ],
+      tableList: [],
+      timeVal: [],
+      grid: {
+        xl: 7,
+        lg: 10,
+        md: 12,
+        sm: 24,
+        xs: 24,
+      },
+      tableFrom: {
+        integral_time: "",
+        is_show: "",
+        store_name: "",
+        page: 1,
+        limit: 15,
+      },
+      total: 0,
+    };
+  },
+  computed: {
+    ...mapState("admin/layout", ["isMobile"]),
+    labelWidth() {
+      return this.isMobile ? undefined : 96;
+    },
+    labelPosition() {
+      return this.isMobile ? "top" : "right";
+    },
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    // 添加
+    add() {
+      this.$router.push({ path: this.roterPre + "/marketing/store_integral/create" });
+    },
+    addMore() {
+      this.$router.push({
+        path: this.roterPre + "/marketing/store_integral/add_store_integral",
+      });
+    },
+    orderList(row) {
+      this.$router.push({
+        path: this.roterPre + "/marketing/store_integral/order_list",
+        query: {
+          product_id: row.id,
+        },
+      });
+    },
+    // 导出
+    exports() {
+      let formValidate = this.tableFrom;
+      let data = {
+        start_status: formValidate.start_status,
+        status: formValidate.status,
+        store_name: formValidate.store_name,
+      };
+      storeSeckillApi(data)
+          .then((res) => {
+            location.href = res.data[0];
+          })
+          .catch((res) => {
+            this.$Message.error(res.msg);
+          });
+    },
+    // 编辑
+    edit(row) {
+      this.$router.push({
+        path: this.roterPre + "/marketing/store_integral/create/" + row.id + "/0",
+      });
+    },
+    // 一键复制
+    copy(row) {
+      this.$router.push({
+        path: this.roterPre + "/marketing/store_integral/create/" + row.id + "/1",
+      });
+    },
+    // 删除
+    del(row, tit, num) {
+      let delfromData = {
+        title: tit,
+        num: num,
+        url: `marketing/integral/${row.id}`,
+        method: "DELETE",
+        ids: "",
+      };
+      this.$modalSure(delfromData)
+          .then((res) => {
+            this.$Message.success(res.msg);
+            this.tableList.splice(num, 1);
+            if (!this.tableList.length) {
+              this.tableFrom.page =
+                  this.tableFrom.page == 1 ? 1 : this.tableFrom.page - 1;
+            }
+            this.getList();
+          })
+          .catch((res) => {
+            this.$Message.error(res.msg);
+          });
+    },
+    // 列表
+    getList() {
+      this.loading = true;
+      this.tableFrom.start_status = this.tableFrom.start_status || "";
+      this.tableFrom.is_show = this.tableFrom.is_show || "";
+      integralProductListApi(this.tableFrom)
+          .then(async (res) => {
+            let data = res.data;
+            this.tableList = data.list;
+            this.total = res.data.count;
+            this.loading = false;
+          })
+          .catch((res) => {
+            this.loading = false;
+            this.$Message.error(res.msg);
+          });
+    },
+    pageChange(index) {
+      this.tableFrom.page = index;
+      this.getList();
+    },
+    // 表格搜索
+    tableSearchs() {
+      this.tableFrom.page = 1;
+      this.getList();
+    },
+    // 具体日期
+    onchangeTime(e) {
+      this.timeVal = e;
+      this.tableFrom.integral_time = this.timeVal[0] ? this.timeVal.join("-") : "";
+    },
+    // 修改是否显示
+    onchangeIsShow(row) {
+      let data = {
+        id: row.id,
+        is_show: row.is_show,
+      };
+      integralIsShowApi(data)
+          .then(async (res) => {
+            this.$Message.success(res.msg);
+          })
+          .catch((res) => {
+            this.$Message.error(res.msg);
+          });
+    },
+  },
+};
+</script>
+
+<style scoped lang="stylus">
+.tabBox_img {
+  width: 36px;
+  height: 36px;
+  border-radius: 4px;
+  cursor: pointer;
+
+  img {
+    width: 100%;
+    height: 100%;
+  }
+}
+</style>

+ 96 - 0
src/router/modules/erp.js

@@ -0,0 +1,96 @@
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team <admin@crmeb.com>
+// +----------------------------------------------------------------------
+import BasicLayout from '@/layouts/basic-layout';
+import Setting from "@/setting";
+const pre = 'erp_';
+
+export default {
+  path: `${Setting.roterPre}/erp`,
+	name: 'erp',
+	header: 'erp',
+	// redirect: {
+	// 	name: `${pre}statistics`
+	// },
+	component: BasicLayout,
+	children: [
+		{
+			path:'inventory',
+			name: `${pre}inventory`,
+			meta: {
+				auth: ['admin-erp-inventory'],
+				title: '库存管理'
+			},
+			component: () => import('@/pages/erp/inventory/index')
+		},
+		{
+			path: 'purchase',
+			name: `${pre}purchase`,
+			meta: {
+				auth: ['admin-erp-purchase'],
+				title: '采购'
+			},
+			component: () => import('@/pages/store/storeCategory/index')
+		},
+		{
+			path: 'goods',
+			name: `${pre}goods`,
+			meta: {
+				auth: ['admin-erp-goods'],
+				title: '要货'
+			},
+			component: () => import('@/pages/store/storeMenus/index')
+		},
+		{
+			path: 'product',
+			name: `${pre}product`,
+			meta: {
+				auth: ['admin-erp-product'],
+				title: '商品档案'
+			},
+			component: () => import('@/pages/store/cashierMenus/index')
+		},
+		{
+			path: 'batch',
+			name: `${pre}batch`,
+			meta: {
+				auth: ['admin-erp-batch'],
+				title: '商品批次'
+			},
+			component: () => import('@/pages/store/statistics/index')
+		},
+		{
+			path: 'warehouse',
+			name: `${pre}warehouse`,
+			meta: {
+				auth: ['admin-erp-warehouse'],
+				title: '仓库管理'
+			},
+			component: () => import('@/pages/store/storeList/index')
+		},
+		{
+			path: 'menus',
+			name: `${pre}menus`,
+			meta: {
+				auth: ['admin-erp-menus'],
+				title: '仓库菜单'
+			},
+			component: () => import('@/pages/store/order/index')
+		},
+		{
+			path: 'locator',
+			name: `${pre}locator`,
+			meta: {
+				auth: ['admin-erp-locator'],
+				title: '库位管理'
+			},
+			component: () => import('@/pages/store/capital/index')
+		}
+	]
+};

+ 3 - 1
src/router/routes.js

@@ -26,6 +26,7 @@ import statistic from './modules/statistic';
 import BasicLayout from '@/layouts/basic-layout';
 import frameOut from './modules/frameOut'
 import work from './modules/work'
+import erp from './modules/erp'
 import Setting from "@/setting";
 
 /**
@@ -204,7 +205,8 @@ const frameIn = [
     app,
     system,
     statistic,
-    work
+    work,
+	erp
 ];
 
 /**

+ 3 - 2
src/store/modules/admin/modules/menu.js

@@ -87,14 +87,15 @@ export default {
             const userInfo = rootState.admin.user.info;
             const access = userInfo.access;
             if (access && access.length) {
+				// console.log(11)
+				console.log(state.header);
                 return state.header.filter(item => {
                     let state = true;
                     if (item.auth && !includeArray(item.auth, access)) state = false;
                     return state;
                 });
-
-
             } else {
+				// console.log(22)
                 return state.header.filter(item => {
                     let state = true;
                     if (item.auth && item.auth.length) state = false;