谢杰标 пре 2 година
родитељ
комит
7dec358618

+ 8 - 0
src/api/goods/index.js

@@ -51,3 +51,11 @@ export function getCategoryDetail(id) {
     method: "get",
   });
 }
+// 批量删除分类
+export function mgoodscategorybatchdel(data) {
+  return request({
+    url: "/goods/category/batch/del",
+    method: "post",
+    data,
+  });
+}

BIN
src/assets/images/icon_cash.png


+ 2 - 2
src/components/searchBoxNew.vue

@@ -14,7 +14,7 @@
         >
           <!-- 自定义select -->
           <el-select
-            v-if="item.scope === 'store'"
+            v-if="item.scope === 'store' && isAdmin"
             v-model="formData[item.prop]"
             :placeholder="item.placeholder || '请选择所属店铺'"
             :size="size"
@@ -241,7 +241,7 @@ export default {
         return arrsy;
       };
     },
-    ...mapGetters(["storeList"]),
+    ...mapGetters(["storeList", "isAdmin"]),
   },
   watch: {},
   methods: {

+ 1 - 1
src/utils/auth.js

@@ -1,6 +1,6 @@
 import Cookies from 'js-cookie'
 
-const TokenKey = 'Admin-Token'
+const TokenKey = 'Menber-Token'
 
 export function getToken() {
   return Cookies.get(TokenKey)

+ 1 - 1
src/utils/request.js

@@ -30,7 +30,7 @@ service.interceptors.request.use(
       let { merId, storeId, tenantId } = store.state.permission.config;
       config.headers["TenantId"] = tenantId;
       config.headers["MerId"] = merId;
-      if (storeId) config.headers["StoreId"] = storeId;
+      // if (storeId) config.headers["StoreId"] = storeId;
     }
 
     // 转换时间戳

+ 61 - 27
src/views/components/index/payContain.vue

@@ -35,7 +35,6 @@
         />
       </div>
       <div class="discount fl">
-        <!-- <el-checkbox :checked="checked">折扣商品</el-checkbox> -->
         <img src="../../../assets//images//Controls_sel.png" alt="" />
         <span class="discount-text">折扣商品</span>
         <span class="mr">该商品最多可抵扣</span>
@@ -46,27 +45,33 @@
         />
         <span class="text-21f">(2000积分)</span>
       </div>
-      <div class="pay-bom-item c48">折扣金额:233元</div>
-      <div class="pay-bom-item c48">积分补差:233元</div>
-      <div class="pay-bom-item c48">
-        实付金额:<span class="money">¥2243.00</span>
-      </div>
-      <div class="pay-bom-item fl c48">
-        支付方式:
-        <div
-          class="wechart fl_c"
-          :class="{ actived: active == item.value }"
-          @click="active = item.value"
-          v-for="item in payType"
-          :key="item.value"
-        >
-          <img :src="item.src" alt="" />
-          <span>{{ item.lebel }}</span>
+      <div class="integral-box c48">
+        <div>可用积分:100积分(200.00元)</div>
+        <div>抵扣积分:100积分(200.00元)</div>
+        <div>积分补差:100积分(200.00元)</div>
+
+        <div class="c48">
+          优惠金额:<span class="discount-money">¥100.00</span>
+        </div>
+        <div class="c48">实付金额:<span class="money">¥2243.00</span></div>
+        <div class="fl c48">
+          支付方式:
+          <div
+            class="wechart fl_c"
+            :class="{ actived1: active == item.value }"
+            @click="active = item.value"
+            v-for="item in payType"
+            :key="item.value"
+          >
+            <img :src="item.src" alt="" />
+            <span>{{ item.lebel }}</span>
+          </div>
         </div>
       </div>
+      <div class="btn">
+        <el-button type="danger">立即收款</el-button>
+      </div>
     </div>
-
-    <el-button type="danger">立即收款</el-button>
   </container>
 </template>
 
@@ -98,9 +103,13 @@ export default {
         {
           lebel: "微信支付",
           value: 1,
-          src: require("../../../assets//images//icon_wechat.png"),
+          src: require("../../../assets/images/icon_wechat.png"),
+        },
+        {
+          lebel: "现金支付",
+          value: 2,
+          src: require("../../../assets/images/icon_cash.png"),
         },
-        { lebel: "现金支付", value: 2 },
       ],
       active: 1,
     };
@@ -223,14 +232,26 @@ export default {
       color: #eb5757;
     }
   }
-  .pay-bom-item {
-    margin-top: 24px;
+  .integral-box {
+    height: 100%;
+    padding-bottom: 16px;
+    div {
+      margin-top: 16px;
+    }
+    .discount-money {
+      color: #eb5757;
+      font-size: 14px;
+    }
     .money {
       font-weight: 800;
       color: #eb5757;
       font-size: 16px;
     }
+    .fl {
+      margin-top: 20px;
+    }
     .wechart {
+      margin-top: 0;
       margin-right: 20px;
       width: 160px;
       height: 55px;
@@ -241,8 +262,25 @@ export default {
       cursor: pointer;
       img {
         margin-right: 6px;
+        margin-top: 4px;
       }
     }
+    .actived1 {
+      border: 1px solid #fa821f;
+      background: #fffaf7;
+      color: #00908c;
+    }
+  }
+  .btn {
+    width: 382px;
+    height: 52px;
+    margin: 36px auto 0;
+    .el-button {
+      width: 100%;
+      height: 52px;
+      background: #fa821f;
+      border-radius: 8px;
+    }
   }
   input {
     background: #f6f7f9;
@@ -250,8 +288,4 @@ export default {
     outline: none;
   }
 }
-.el-button {
-  width: 180px;
-  height: 40px;
-}
 </style>

+ 25 - 28
src/views/goodsMag/classify.vue

@@ -19,16 +19,16 @@
       :navText="navText"
       rowKey="categoryId"
       :loading="loading"
-      @switchChange="() => {}"
+      @switchChange="editCategory"
     >
       <template slot="btn" slot-scope="props">
         <el-button type="text" @click="handelEdit(props.scope.row.categoryId)"
           >编辑</el-button
         >
-        <el-button type="text" @click="resetPass(props.scope.row.categoryId)"
+        <el-button type="text" @click="handelEdit(undefined, props.scope.row)"
           >添加</el-button
         >
-        <el-button type="text" @click="handelDel(props.scope.row.categoryId)"
+        <el-button type="text" @click="del(props.scope.row.categoryId)"
           >删除</el-button
         >
       </template>
@@ -42,6 +42,8 @@
     <class-set-dlg
       @search="search"
       :categoryId="categoryId"
+      :parentId="parentId"
+      :storeId="storeId"
       :dialogVisible.sync="dialogVisible"
     ></class-set-dlg>
   </container>
@@ -49,7 +51,11 @@
 
 <script>
 import ClassSetDlg from "./components/ClassSetDlg";
-import { goodscategorylist, editCategory } from "../../api/goods/index";
+import {
+  goodscategorylist,
+  editCategory,
+  mgoodscategorybatchdel,
+} from "../../api/goods/index";
 export default {
   name: "SaasMemberRecord",
 
@@ -94,12 +100,13 @@ export default {
           scope: "store",
         },
         {
-          prop: "name",
-          placeholder: "请输分类名称",
+          prop: "categoryName",
+          placeholder: "请输分类名称",
         },
       ],
       dialogVisible: false,
       categoryId: "",
+      parentId: "",
     };
   },
 
@@ -133,16 +140,18 @@ export default {
       this.search(2);
     },
     del(id) {
-      this.$confirm("确定删除吗?", "提示", {
+      this.$confirm("确定删除该分类吗?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       })
-        .then(() => {})
+        .then(() => {
+          this.editCategory(id, -1);
+        })
         .catch(() => {});
     },
-    editCategory() {
-      editStore({ storeId, status, merId: "1" }).then((res) => {
+    editCategory(categoryId, status) {
+      editCategory({ categoryId, status }).then((res) => {
         status == -1 && this.$message.success("删除成功");
         this.search();
       });
@@ -168,32 +177,20 @@ export default {
       })
         .then(() => {
           const ids = this.$refs.tableList.allCheckData.map(
-            (item) => item.moduleExamId
+            (item) => item.categoryId
           );
-          moduleVolumeBatchDel({
-            status: -1,
-            ids,
-          }).then((res) => {
+          mgoodscategorybatchdel(ids).then((res) => {
             this.$message.success("批量删除成功");
             this.$refs.tableList.clearMoreActive();
-            this.search(1);
+            this.search();
           });
         })
         .catch(() => {});
     },
-    statusChange(e, row) {
-      //   this.$api
-      //     .editmallstore({ storeId: row.storeId, status: e })
-      //     .then((res) => {
-      //       this.$message.success("操作成功");
-      //       row.status = e;
-      //     })
-      //     .catch(() => {
-      //       return (row.status = e ? 0 : 1);
-      //     });
-    },
-    handelEdit(categoryId) {
+    handelEdit(categoryId, data = {}) {
       this.categoryId = categoryId;
+      this.parentId = data.categoryId;
+      this.storeId = data.storeId;
       this.dialogVisible = true;
     },
   },

+ 21 - 2
src/views/goodsMag/components/ClassSetDlg.vue

@@ -21,6 +21,7 @@
           :style="{ width: '100%' }"
           v-model="form.storeId"
           placeholder="请选择所属店铺"
+          @change="form.parentId = ''"
         >
           <el-option
             v-for="item in storeList"
@@ -32,10 +33,14 @@
       </el-form-item>
       <el-form-item label="上级分类:" prop="parentId">
         <el-cascader
+          @change="changeCategory"
           :disabled="categoryId"
+          ref="cascader"
           placeholder="请选择上级分类"
           :options="computerTree(categorytreeList)"
           :show-all-levels="false"
+          clearable
+          filterable
           :props="{
             label: 'categoryName',
             value: 'categoryId',
@@ -79,6 +84,12 @@ export default {
     categoryId: {
       type: [Number, String],
     },
+    parentId: {
+      type: [Number, String],
+    },
+    storeId: {
+      type: [Number, String],
+    },
   },
   data() {
     return {
@@ -136,10 +147,10 @@ export default {
     resetForm() {
       this.form = {
         categoryId: undefined,
-        storeId: undefined,
+        storeId: this.storeId,
         status: 1,
         categoryName: undefined,
-        parentId: undefined,
+        parentId: this.parentId,
       };
       this.clearForm("form");
     },
@@ -175,6 +186,11 @@ export default {
         this.categorytreeList = res.data;
       });
     },
+    changeCategory(val) {
+      if (this.form.storeId) return;
+      let data = this.$refs["cascader"].getCheckedNodes()[0].data;
+      this.form.storeId = data.storeId
+    },
   },
   computed: {
     isShow: {
@@ -187,6 +203,9 @@ export default {
     },
     computerTree: function () {
       return function (rows) {
+        if (this.form.storeId) {
+          rows = rows.filter((e) => e.storeId === this.form.storeId);
+        }
         var array = [
           {
             categoryId: 0,

+ 110 - 87
src/views/goodsMag/components/GoodSetDlg.vue

@@ -3,7 +3,8 @@
     :title="form.id ? '编辑分类' : '添加分类'"
     :isShow.sync="isShow"
     @close="close"
-    :isShowFooter="false"
+    @open="open"
+    @submit="submitForm"
     width="680px"
   >
     <el-form
@@ -14,36 +15,76 @@
       :rules="rules"
       ref="form"
     >
-      <el-form-item label="商品分类:" prop="parent">
+      <el-form-item label="所属店铺:" prop="storeId">
+        <el-select
+          :disabled="goodsId"
+          :style="{ width: '100%' }"
+          v-model="form.storeId"
+          placeholder="请选择所属店铺"
+          @change="form.categoryIds = ''"
+        >
+          <el-option
+            v-for="item in storeList"
+            :key="item.storeId"
+            :label="item.storeName"
+            :value="item.storeId"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="商品分类:" prop="categoryIds">
         <el-cascader
-          :options="options"
-          :props="{ checkStrictly: true }"
-          v-model="form.parent"
+          @change="changeCategory"
+          :disabled="goodsId"
+          ref="cascader"
+          placeholder="请选择商品分类"
+          :options="computerTree(categorytreeList)"
+          :show-all-levels="false"
+          clearable
+          filterable
+          :props="{
+            label: 'categoryName',
+            value: 'categoryId',
+            checkStrictly: true,
+            emitPath: false,
+          }"
+          v-model="form.categoryIds"
         ></el-cascader>
       </el-form-item>
-      <el-form-item label="产品名称:" prop="userName">
-        <el-input v-model.Number="form.userName" placeholder="请输入产品名称">
+      <el-form-item label="产品名称:" prop="goodsName">
+        <el-input v-model.Number="form.goodsName" placeholder="请输入产品名称">
         </el-input>
       </el-form-item>
-      <el-form-item label="商品主图:" prop="userName">
-        <file-upload v-model="form.fileList" :limit="20"></file-upload>
+      <el-form-item label="商品主图:" prop="mainImg">
+        <file-upload v-model="form.mainImg" :limit="20"></file-upload>
       </el-form-item>
-      <el-form-item label="产品原价:" prop="userName">
-        <el-input v-model.Number="form.userName" placeholder="请输入产品原价">
+      <el-form-item label="产品原价:" prop="standPrice">
+        <el-input v-model.Number="form.standPrice" placeholder="请输入产品原价">
         </el-input>
       </el-form-item>
-      <el-form-item label="会员优惠价:" prop="userName">
-        <el-input v-model.Number="form.userName" placeholder="请输入会员优惠价">
+      <el-form-item label="会员优惠价:" prop="specialPrice">
+        <el-input
+          v-model.Number="form.specialPrice"
+          placeholder="请输入会员优惠价"
+        >
         </el-input>
       </el-form-item>
-      <el-form-item label="可抵扣积分:" prop="userName">
-        <el-input v-model.Number="form.userName" placeholder="请输入可抵扣积分">
+      <el-form-item label="可抵扣积分:">
+        <el-input
+          disable
+          v-model.Number="form.userName"
+          placeholder="请输入可抵扣积分"
+        >
         </el-input>
       </el-form-item>
-      <el-form-item label="产品详情" class="editor" prop="detail">
+      <el-form-item label="上架状态:" prop="status">
+        <el-radio-group v-model="form.status">
+          <el-radio :label="1">上架</el-radio
+          ><el-radio :label="0">下架</el-radio>
+        </el-radio-group>
+      </el-form-item>
+      <el-form-item label="产品详情" class="editor">
         <quill-editor
           class="ql-editor"
-          v-model="form.detail"
           ref="myQuillEditor"
           :options="editorOption"
           @change="onEditorChange($event)"
@@ -51,12 +92,6 @@
         </quill-editor>
       </el-form-item>
     </el-form>
-
-    <div class="btns clearfix">
-      <el-button @click="isShow = false">取消</el-button>
-      <el-button type="primary" @click="submitForm">上架</el-button>
-      <el-button type="info">保存</el-button>
-    </div>
   </Base-dialog>
 </template>
 
@@ -64,55 +99,37 @@
 import { mapGetters } from "vuex";
 import FileUpload from "../../../components/FileUpload/index.vue";
 import { quillEditor } from "vue-quill-editor";
+import { goodscategorytree } from "../../../api/goods/index";
 export default {
   props: {
     dialogVisible: {
       type: Boolean,
       default: false,
     },
+    goodsId: {
+      type: [Number, String],
+    },
   },
   data() {
     return {
       form: {},
       rules: {
-        name: [{ required: true, message: "请输入真实姓名", trigger: "blur" }],
-        parent: [
-          { required: true, message: "请选择启动状态", trigger: "change" },
+        goodsName: [
+          { required: true, message: "请输入商品名称", trigger: "blur" },
         ],
-        detail: [
-          { required: true, message: "请输入产品详情", trigger: "blur" },
+        standPrice: [
+          { required: true, message: "请输入商品原价", trigger: "blur" },
+        ],
+        specialPrice: [
+          { required: true, message: "请输入会员优惠价", trigger: "blur" },
+        ],
+        categoryIds: [
+          { required: true, message: "请选择商品分类", trigger: "change" },
+        ],
+        mainImg: [
+          { required: true, message: "请上传商品主图", trigger: "change" },
         ],
       },
-      options: [
-        {
-          value: "zhinan",
-          label: "指南",
-          children: [
-            {
-              value: "shejiyuanze",
-              label: "设计原则",
-              children: [
-                {
-                  value: "yizhi",
-                  label: "一致",
-                },
-                {
-                  value: "fankui",
-                  label: "反馈",
-                },
-                {
-                  value: "xiaolv",
-                  label: "效率",
-                },
-                {
-                  value: "kekong",
-                  label: "可控",
-                },
-              ],
-            },
-          ],
-        },
-      ],
       editorOption: {
         placeholder: "请输入产品详情",
         modules: {
@@ -146,21 +163,25 @@ export default {
           ],
         },
       },
+      categorytreeList: [],
     };
   },
   methods: {
+    open() {
+      this.resetForm();
+      this.goodscategorytree();
+      this.goodsId && this.getDatail();
+    },
     resetForm() {
       this.form = {
-        id: undefined,
-        name: undefined,
-        parent: undefined,
-        detail: undefined,
-        fileList: [
-          {
-            name: "info_2.png",
-            url: "https://file-dev.xyyxt.net/oss/images/avatar/20230525/1684981330568/1684981330570_622728660",
-          },
-        ],
+        storeId: undefined,
+        goodsId: undefined,
+        goodsName: undefined,
+        standPrice: undefined,
+        specialPrice: undefined,
+        categoryIds: undefined,
+        mainImg: [],
+        status: 1,
       };
       this.clearForm("form");
     },
@@ -184,7 +205,18 @@ export default {
       this.clearForm("form");
     },
     onEditorChange({ quill, html, text }) {
-      this.form.detail = html;
+      this.form.mobileDetailHtml = html;
+    },
+    goodscategorytree() {
+      goodscategorytree({ status: 1 }).then((res) => {
+        this.categorytreeList = res.data;
+      });
+    },
+    getDatail() {},
+    changeCategory(val) {
+      if (this.form.storeId) return;
+      let data = this.$refs["cascader"].getCheckedNodes()[0].data;
+      this.form.storeId = data.storeId;
     },
   },
   computed: {
@@ -196,31 +228,22 @@ export default {
         this.$emit("update:dialogVisible", false);
       },
     },
-    ...mapGetters(["roleList"]),
-  },
-  created() {},
-  components: { FileUpload, quillEditor },
-  watch: {
-    dialogVisible: {
-      handler(val) {
-        if (val) {
-          this.resetForm();
+    computerTree: function () {
+      return function (rows) {
+        if (this.form.storeId) {
+          rows = rows.filter((e) => e.storeId === this.form.storeId);
         }
-      },
-      immediate: true,
+        return rows;
+      };
     },
+    ...mapGetters(["roleList", "storeList"]),
   },
+  created() {},
+  components: { FileUpload, quillEditor },
 };
 </script>
 
 <style lang="scss" scoped>
-.btns {
-  .el-button {
-    margin-top: 30px;
-    float: right;
-    margin-left: 14px;
-  }
-}
 .ql-editor {
   width: 100%;
   margin-top: -20px;

+ 35 - 23
src/views/goodsMag/index.vue

@@ -21,16 +21,21 @@
       rowKey="id"
       :loading="loading"
     >
-      <template slot="status" slot-scope="props">
-        <el-switch
-          v-model="props.scope.row.status"
-          active-color="#13ce66"
-          inactive-color="#ff4949"
-          :active-value="1"
-          :inactive-value="0"
-          @change="statusChange($event, props.scope.row)"
+      <template slot="images" slot-scope="props">
+        <el-image
+          style="width: 100px; height: 70px"
+          :src="
+            $methodsTools.splitImgHost(
+              imgListComputer(props.scope.row.mainImg)[0]
+            )
+          "
+          :preview-src-list="
+            imgListComputer(props.scope.row.mainImg).map((i) =>
+              $methodsTools.splitImgHost(i)
+            )
+          "
         >
-        </el-switch>
+        </el-image>
       </template>
       <template slot="btn" slot-scope="props">
         <el-button type="text" @click="handelClick(2, props.scope.row.tpId)"
@@ -74,16 +79,18 @@ export default {
       formData: {},
       tableSet: [
         {
-          label: "商品名称",
-          prop: "tpName",
+          label: "所属店铺",
+          prop: "storeName",
         },
         {
-          label: "商品主题",
-          prop: "tpName",
+          label: "商品名称",
+          prop: "goodsName",
         },
         {
-          label: "创建时间",
-          prop: "tpName",
+          label: "商品主图",
+          prop: "mainImg",
+          scope: "solt",
+          soltName: "images",
         },
         {
           label: "可抵扣积分",
@@ -91,32 +98,37 @@ export default {
         },
         {
           label: "商品原价",
-          prop: "tpName",
+          prop: "standPrice",
         },
         {
           label: "会员优惠价",
-          prop: "tpName",
+          prop: "specialPrice",
         },
         {
           label: "上架状态",
-          prop: "tpName",
-          scope: "solt",
-          soltName: "status",
+          prop: "goodsStatus",
+          scope: "switch",
+          id: "categoryId",
         },
         {
           label: "录入时间",
-          prop: "tpName",
+          prop: "createTime",
+          scope: "aTimeList",
         },
       ],
       tableData: [{}],
       total: 0,
       formList: [
+        {
+          prop: "storeId",
+          scope: "store",
+        },
         {
           prop: "name",
-          placeholder: "请输分类名称",
+          placeholder: "请输如产品名称",
         },
       ],
-      dialogVisible: true,
+      dialogVisible: false,
     };
   },