lex 1 yıl önce
ebeveyn
işleme
6d4aedfa1a

+ 1 - 1
src/views/businessManager/orderManager/financeManager-taoqi.vue

@@ -617,7 +617,7 @@
                       }}<span v-if="item.sn">({{ item.sn }})</span></span
                     >
                     <span style="float: right; color: #8492a6; font-size: 13px"
-                      >{{ item.groupPurchasePrice || 0 }}元</span
+                      >{{ item.discountPrice || 0 }}元</span
                     >
                   </el-option>
                 </el-select>

+ 1 - 1
src/views/businessManager/orderManager/financeManager.vue

@@ -659,7 +659,7 @@
                       }}<span v-if="item.sn">({{ item.sn }})</span></span
                     >
                     <span style="float: right; color: #8492a6; font-size: 13px"
-                      >{{ item.groupPurchasePrice || 0 }}元</span
+                      >{{ item.discountPrice || 0 }}元</span
                     >
                   </el-option>
                 </el-select>

+ 26 - 13
src/views/businessManager/shopManager/model/combinationProducts.vue

@@ -131,7 +131,7 @@
         prop="goodsCategoryId"
         :label-width="formLabelWidth"
       >
-        <el-cascader
+        <!-- <el-cascader
           v-model.trim="form.goodsCategoryId"
           style="width: 220px !important"
           placeholder="请选择商品分类"
@@ -139,7 +139,21 @@
           :options="categoryList"
           filterable
           :props="{ expandTrigger: 'hover' }"
-        ></el-cascader>
+        ></el-cascader> -->
+        <el-select
+          v-model.trim="form.goodsCategoryId"
+          clearable
+          style="width: 220px !important"
+          placeholder="请选择商品分类"
+          :disabled="addDisabled"
+        >
+          <el-option
+            v-for="(item, index) in categoryList"
+            :key="index"
+            :label="item.label"
+            :value="item.value"
+          ></el-option>
+        </el-select>
       </el-form-item>
       <el-form-item
         label="商品型号"
@@ -464,7 +478,6 @@
         :disabledIds="disabledIds"
         @close="recordStatus = false"
         @comfirm="onConfirm"
-        :categoryList="categoryList"
         :goodsBrand="goodsBrand"
       />
     </el-dialog>
@@ -540,6 +553,7 @@ export default {
         stockWarning: null,
         image: null,
         complementGoodsIdList: null,
+        groupGoods: 1, // 是否组合商品
         goodsList: [],
         brief: null,
         desc: null,
@@ -737,12 +751,12 @@ export default {
             form[i] = row[i];
           }
         }
-        if (row.goodsCategoryId) {
-          form.goodsCategoryId = this.formatParentId(
-            row.goodsCategoryId,
-            this.categoryList
-          );
-        }
+        // if (row.goodsCategoryId) {
+        //   form.goodsCategoryId = this.formatParentId(
+        //     row.goodsCategoryId,
+        //     this.categoryList
+        //   );
+        // }
         let ids = row.goodsSubList;
         let goodsList = [];
         ids.forEach(item => {
@@ -750,6 +764,7 @@ export default {
             name: item.mallGoodsName,
             goodsId: item.mallGoodsId,
             skuStockId: item.sku,
+            skuCode: item.skuCode,
             price: item.price,
             publishStatus: item.goodsStatus,
             productSn: item.productSn,
@@ -833,10 +848,6 @@ export default {
             }
           });
           form.goodsSubList = temps;
-          form.goodsCategoryId =
-            form.goodsCategoryId && form.goodsCategoryId.length > 0
-              ? form.goodsCategoryId[form.goodsCategoryId.length - 1]
-              : null;
           if (form.studentShowOrganId) {
             form.studentShowOrganId = form.studentShowOrganId.join(",");
           }
@@ -867,6 +878,8 @@ export default {
             return;
           }
           form.goodsList = null;
+          form.groupGoods = 1;
+          console.log(form, '1221')
           if (this.addType == "create" || this.addType == "copy") {
             if (this.form.id) {
               // 判断有没有Id,如果有则删除

+ 675 - 0
src/views/businessManager/shopManager/model/singleProducts.vue

@@ -0,0 +1,675 @@
+<template>
+  <div>
+    <el-button type="primary" @click="addGoodsList" style="margin-bottom: 20px"
+      >添加</el-button
+    >
+    <el-form :model="form" :rules="rules" ref="ruleForm" :inline="true">
+      <el-alert title="销售渠道" :closable="false" class="alert" type="info" />
+      <el-form-item
+        label="移动端可售分部"
+        prop="educationShowOrganId"
+        :label-width="formLabelWidth"
+      >
+        <select-all
+          v-model.trim="form.educationShowOrganId"
+          filterable
+          placeholder="移动端可售分部"
+          style="width: 300px !important"
+          multiple
+          clearable
+          :disabled="addDisabled"
+        >
+          <el-option
+            v-for="item in selects.branchs"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id.toString()"
+          ></el-option>
+        </select-all>
+      </el-form-item>
+      <el-form-item
+        label="课程收费乐团可售分部"
+        prop="courseFeeShowOrganId"
+        :label-width="formLabelWidth"
+      >
+        <select-all
+          v-model.trim="form.courseFeeShowOrganId"
+          filterable
+          placeholder="课程收费乐团可售分部"
+          style="width: 300px !important"
+          multiple
+          clearable
+          :disabled="addDisabled"
+        >
+          <el-option
+            v-for="item in selects.branchs"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id.toString()"
+          ></el-option>
+        </select-all>
+      </el-form-item>
+      <el-form-item
+        label="会员收费乐团可售分部"
+        prop="memberFeeShowOrganId"
+        :label-width="formLabelWidth"
+      >
+        <select-all
+          v-model.trim="form.memberFeeShowOrganId"
+          filterable
+          placeholder="请选择会员收费团可见分部"
+          style="width: 300px !important"
+          multiple
+          clearable
+          :disabled="addDisabled"
+        >
+          <el-option
+            v-for="item in selects.branchs"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id.toString()"
+          ></el-option>
+        </select-all>
+      </el-form-item>
+      <el-form-item
+        label="免费乐团可售分部"
+        prop="freeFeeShowOrganId"
+        :label-width="formLabelWidth"
+      >
+        <select-all
+          v-model.trim="form.freeFeeShowOrganId"
+          filterable
+          placeholder="请选择会员收费团可见分部"
+          style="width: 300px !important"
+          multiple
+          clearable
+          :disabled="addDisabled"
+        >
+          <el-option
+            v-for="item in selects.branchs"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id.toString()"
+          ></el-option>
+        </select-all>
+      </el-form-item>
+      <el-form-item
+        v-if="tenantId == 1"
+        label="乐器置换可售分部"
+        prop="replacementShowOrganId"
+        :label-width="formLabelWidth"
+      >
+        <select-all
+          v-model.trim="form.replacementShowOrganId"
+          filterable
+          placeholder="请选择乐器置换可售分部"
+          style="width: 300px !important"
+          multiple
+          clearable
+          :disabled="addDisabled"
+        >
+          <el-option
+            v-for="item in selects.branchs"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id.toString()"
+          ></el-option>
+        </select-all>
+      </el-form-item>
+
+      <el-table
+        :data="form.goodsList"
+        :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
+        style="width:100%!important"
+      >
+        <el-table-column align="center" prop="name" label="商品名称">
+          <template slot-scope="scope">
+            <tooltip :content="scope.row.name" />
+          </template>
+        </el-table-column>
+        <el-table-column align="center" prop="productSn" label="商品货号">
+        </el-table-column>
+        <el-table-column align="center" prop="bankName" label="品牌">
+        </el-table-column>
+        <el-table-column align="center" prop="skuCode" label="sku编号">
+        </el-table-column>
+        <el-table-column align="center" prop="marketPrice" label="市场价">
+          <template slot-scope="scope">
+            <el-form-item
+              :show-message="false"
+              class="tableItem"
+              :prop="'goodsList.' + scope.$index + '.marketPrice'"
+              :rules="[
+                {
+                  required: true,
+                  validator: validPrice,
+                  trigger: 'blur'
+                }
+              ]"
+            >
+              <el-input-number
+                style="width: 100%!important;"
+                class="number-input"
+                v-model="form.goodsList[scope.$index].marketPrice"
+                :controls="false"
+                :precision="0"
+                :min="0"
+                placeholder="请选择市场价"
+                :disabled="addDisabled"
+              />
+            </el-form-item>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" prop="discountPrice" label="零售价">
+          <template slot-scope="scope">
+            <el-form-item
+              :show-message="false"
+              class="tableItem"
+              :prop="'goodsList.' + scope.$index + '.discountPrice'"
+              :rules="[
+                {
+                  required: true,
+                  validator: validPrice,
+                  trigger: 'blur'
+                }
+              ]"
+            >
+              <el-input-number
+                style="width: 100%!important;"
+                class="number-input"
+                v-model="form.goodsList[scope.$index].discountPrice"
+                :controls="false"
+                :precision="0"
+                :min="0"
+                placeholder="请选择零售价"
+                :disabled="addDisabled"
+              />
+            </el-form-item>
+          </template>
+        </el-table-column>
+        <el-table-column
+          align="center"
+          prop="groupPurchasePrice"
+          label="团购价"
+        >
+          <template slot-scope="scope">
+            <el-form-item
+              :show-message="false"
+              class="tableItem"
+              :prop="'goodsList.' + scope.$index + '.groupPurchasePrice'"
+              :rules="[
+                {
+                  required: true,
+                  validator: validPrice,
+                  trigger: 'blur'
+                }
+              ]"
+            >
+              <el-input-number
+                style="width: 100%!important;"
+                class="number-input"
+                v-model="form.goodsList[scope.$index].groupPurchasePrice"
+                :controls="false"
+                :precision="0"
+                :min="0"
+                placeholder="请选择团购价"
+                :disabled="addDisabled"
+              />
+            </el-form-item>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" prop="type" label="商品类型">
+          <template slot-scope="scope">
+            <el-form-item
+              :show-message="false"
+              class="tableItem"
+              :prop="'goodsList.' + scope.$index + '.type'"
+              :rules="[
+                {
+                  required: true,
+                  message: '请选择商品类型',
+                  trigger: 'blur'
+                }
+              ]"
+            >
+              <el-cascader
+                v-model.trim="form.goodsList[scope.$index].type"
+                :options="categoryList"
+                placeholder="商品分类"
+                :props="{ checkStrictly: true, expandTrigger: 'hover' }"
+              ></el-cascader>
+            </el-form-item>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" prop="goodsCategoryId" label="商品分类">
+          <template slot-scope="scope">
+            <el-form-item
+              :show-message="false"
+              class="tableItem"
+              :prop="'goodsList.' + scope.$index + '.goodsCategoryId'"
+              :rules="[
+                {
+                  required: true,
+                  message: '请选择商品分类',
+                  trigger: 'blur'
+                }
+              ]"
+            >
+              <el-select
+                v-model.trim="form.goodsList[scope.$index].goodsCategoryId"
+                clearable
+                placeholder="商品分类"
+              >
+                <el-option
+                  v-for="(item, index) in goodsType"
+                  :key="index"
+                  :label="item.label"
+                  :value="item.value"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" prop="publishStatus" label="状态">
+          <template slot-scope="scope">
+            <el-tag :type="scope.row.publishStatus == 1 ? '' : 'danger'">
+              {{ scope.row.publishStatus ? "上架" : "下架" }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" prop="sn" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              type="text"
+              @click.prevent="removeGoodsList(scope.row)"
+              :disabled="addDisabled"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-form>
+    <span slot="footer" v-if="!addDisabled" class="dialog-footer">
+      <el-button @click="$listeners.close()">取 消</el-button>
+      <el-button @click="onShopSubmit('ruleForm')" type="primary"
+        >确 定</el-button
+      >
+    </span>
+
+    <el-dialog
+      title="添加子商品"
+      :visible.sync="recordStatus"
+      :close-on-click-modal="false"
+      width="1200px"
+      append-to-body
+      v-if="recordStatus"
+    >
+      <subShopGoods
+        :disabledIds="disabledIds"
+        @close="recordStatus = false"
+        @comfirm="onConfirm"
+        :categoryList="categoryList"
+        :goodsBrand="goodsBrand"
+      />
+    </el-dialog>
+  </div>
+</template>
+<script>
+import { goodsAdd, goodsUpdate, api_goodsGet } from "@/api/businessManager";
+import cleanDeep from "clean-deep";
+import subShopGoods from "./subShopGoods.vue";
+let validPrice = (rule, value, callback) => {
+  if ((value == "" && typeof value == "string") || value == null) {
+    callback(new Error("请输入金额"));
+  } else if (value < 0) {
+    callback(new Error("输入金额必须大于或等于0"));
+  } else if (value >= 100000) {
+    callback(new Error("输入金额必须小于100000"));
+  } else {
+    callback();
+  }
+};
+let validStock = (rule, value, callback) => {
+  if ((value == "" && typeof value == "string") || value == null) {
+    callback(new Error("请输入库存"));
+  } else if (value < 0) {
+    callback(new Error("库存数量必须大于或等于0"));
+  } else {
+    callback();
+  }
+};
+export default {
+  props: [
+    "activeRow",
+    "addType",
+    "addDisabled",
+    "categoryList",
+    "selectGoodsList",
+    "tenantId",
+    "goodsBrand",
+    "goodsType"
+  ],
+  components: {
+    subShopGoods
+  },
+  data() {
+    return {
+      formLabelWidth: "160px",
+      form: {
+        goodsList: [],
+        studentShowOrganId: null,
+        educationShowOrganId: null,
+        courseFeeShowOrganId: null,
+        memberFeeShowOrganId: null,
+        freeFeeShowOrganId: null,
+        replacementShowOrganId: null
+      },
+      goodsTree: [], // 选择商品列表
+      rules: {
+        // replacementShow: [
+        //   {
+        //     required: true,
+        //     message: "请选择是否参与置换",
+        //     trigger: "change"
+        //   }
+        // ],
+      },
+      goodsDetail: {},
+      recordStatus: false,
+      disabledIds: [] // 选中商品的编号
+    };
+  },
+  async mounted() {
+    if (this.addType !== "create") {
+      try {
+        const { data } = await api_goodsGet({ id: this.activeRow.id });
+        this.goodsDetail = data || {};
+        const row = this.goodsDetail;
+        let form = this.form;
+        for (let i in form) {
+          if (i === "brand") {
+            form[i] = Number(row[i]);
+          } else {
+            form[i] = row[i];
+          }
+        }
+        if (row.goodsCategoryId) {
+          form.goodsCategoryId = this.formatParentId(
+            row.goodsCategoryId,
+            this.categoryList
+          );
+        }
+        let ids = row.goodsSubList;
+        let goodsList = [];
+        ids.forEach(item => {
+          goodsList.push({
+            name: item.mallGoodsName,
+            goodsId: item.mallGoodsId,
+            skuStockId: item.sku,
+            price: item.price,
+            publishStatus: item.goodsStatus,
+            productSn: item.productSn,
+            goodsPrice: item.goodsPrice // 成本
+          });
+        });
+        form.goodsList = goodsList;
+        form.id = row.id;
+
+        if (row.studentShowOrganId) {
+          form.studentShowOrganId = row.studentShowOrganId.split(",");
+        }
+
+        if (row.educationShowOrganId) {
+          form.educationShowOrganId = row.educationShowOrganId.split(",");
+        }
+
+        if (row.courseFeeShowOrganId) {
+          form.courseFeeShowOrganId = row.courseFeeShowOrganId.split(",");
+        }
+
+        if (row.memberFeeShowOrganId) {
+          form.memberFeeShowOrganId = row.memberFeeShowOrganId.split(",");
+        }
+        if (row.freeFeeShowOrganId) {
+          form.freeFeeShowOrganId = row.freeFeeShowOrganId.split(",");
+        }
+
+        if (row.replacementShowOrganId) {
+          form.replacementShowOrganId = row.replacementShowOrganId.split(",");
+        }
+
+        if (row.organIdList) {
+          form.organIdList = row.organIdList.split(",");
+        }
+      } catch (e) {
+        //
+      }
+    }
+  },
+  methods: {
+    async __init() {
+      let params = {
+        delFlag: 0,
+        rows: 9999
+      };
+      try {
+        const { data } = await api_queryGoodsCategoryList(params);
+        const result = data || [];
+        let tempArray = [];
+        result.forEach(row => {
+          let children = [];
+          if (row.children && row.children.length > 0) {
+            row.children.forEach(child => {
+              children.push({
+                label: child.name,
+                value: child.id
+              });
+            });
+          }
+          tempArray.push({
+            label: row.name,
+            value: row.id,
+            children
+          });
+        });
+        this.categoryList = tempArray;
+      } catch {}
+
+    },
+    formatParentId(id, list, ids = []) {
+      for (const item of list) {
+        if (item.children) {
+          const cIds = this.formatParentId(id, item.children, [
+            ...ids,
+            item.value
+          ]);
+          if (cIds.includes(id)) {
+            return cIds;
+          }
+        }
+        if (item.value === id) {
+          return [...ids, id];
+        }
+      }
+      return ids;
+    },
+    onShopSubmit(formName) {
+      if (this.form.goodsList.length <= 0) {
+        this.$message.error("请至少添加一个子商品");
+        return;
+      }
+      this.$refs[formName].validate(valid => {
+        if (valid) {
+          let form = Object.assign({}, this.form);
+          let temps = [];
+          form.goodsList.forEach(item => {
+            if (item.skuStockId) {
+              temps.push({
+                mallGoodsId: item.goodsId,
+                sku: item.skuStockId,
+                goodsStatus: item.publishStatus,
+                goodsPrice: item.goodsPrice
+              });
+            }
+          });
+          form.goodsSubList = temps;
+          form.goodsCategoryId =
+            form.goodsCategoryId && form.goodsCategoryId.length > 0
+              ? form.goodsCategoryId[form.goodsCategoryId.length - 1]
+              : null;
+          if (form.studentShowOrganId) {
+            form.studentShowOrganId = form.studentShowOrganId.join(",");
+          }
+          if (form.educationShowOrganId) {
+            form.educationShowOrganId = form.educationShowOrganId.join(",");
+          }
+
+          if (form.courseFeeShowOrganId) {
+            form.courseFeeShowOrganId = form.courseFeeShowOrganId.join(",");
+          }
+          if (form.memberFeeShowOrganId) {
+            form.memberFeeShowOrganId = form.memberFeeShowOrganId.join(",");
+          }
+          if (form.freeFeeShowOrganId) {
+            form.freeFeeShowOrganId = form.freeFeeShowOrganId.join(",");
+          }
+          if (form.replacementShowOrganId) {
+            form.replacementShowOrganId = form.replacementShowOrganId.join(",");
+          }
+          if (
+            !form.studentShowOrganId &&
+            !form.educationShowOrganId &&
+            !form.courseFeeShowOrganId &&
+            !form.freeFeeShowOrganId &&
+            !form.replacementShowOrganId
+          ) {
+            this.$message.error("请至少选择一个可见分部");
+            return;
+          }
+          form.goodsList = null;
+          if (this.addType == "create" || this.addType == "copy") {
+            if (this.form.id) {
+              // 判断有没有Id,如果有则删除
+              delete this.form.id;
+            }
+            form.status = "NO"; // 默认上架
+            goodsAdd(cleanDeep(form)).then(res => {
+              this.messageTips("保存", res);
+            });
+          } else if (this.addType == "update") {
+            goodsUpdate(cleanDeep(form)).then(res => {
+              this.messageTips("保存", res);
+            });
+          }
+        } else {
+          this.$nextTick(() => {
+            let isError = document.getElementsByClassName("is-error");
+            isError[0].scrollIntoView({
+              block: "center",
+              behavior: "smooth"
+            });
+          });
+          return false;
+        }
+      });
+    },
+    messageTips(title, res) {
+      if (res.code == 200) {
+        this.$message.success(title + "成功");
+        this.$listeners.close();
+        this.$listeners.confirm();
+      } else {
+        this.$message.error(res.msg);
+      }
+    },
+    removeGoodsList(item) {
+      this.$confirm("是否删除该商品?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          const index = this.form.goodsList.indexOf(item);
+          if (index !== -1) {
+            this.form.goodsList.splice(index, 1);
+          }
+        })
+        .catch(() => {});
+    },
+    addGoodsList() {
+      const ids = [];
+      this.form.goodsList.forEach(goods => {
+        ids.push(goods.skuStockId);
+      });
+      this.disabledIds = ids;
+      this.recordStatus = true;
+    },
+    onFormClose(formName) {
+      // 关闭弹窗重置验证
+      this.$refs[formName].resetFields();
+    },
+    onConfirm(list) {
+      // 添加子商品
+      console.log(list);
+      const goodsList = [];
+      (list || []).forEach(item => {
+        const index = this.form.goodsList.findIndex(
+          goods => goods.skuStockId == item.skuStockId
+        );
+        if (index == -1) {
+          goodsList.push({
+            name: item.name,
+            goodsId: item.goodsId,
+            skuStockId: item.skuStockId,
+            skuCode: item.skuCode,
+            price: item.price,
+            publishStatus: item.publishStatus,
+            productSn: item.productSn,
+            goodsPrice: null // 成本
+          });
+        }
+      });
+      this.form.goodsList.push(...goodsList);
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+.alert {
+  margin-bottom: 16px;
+}
+.shopImage {
+  width: 60px;
+  height: 60px;
+}
+.shopDesc {
+  max-height: 70px;
+  overflow: hidden;
+}
+
+.el-select__tags .el-tag.el-tag--info.el-tag--small.el-tag--light {
+  max-width: 95px;
+}
+.hiddenStart {
+  ::v-deep .el-form-item__label:before {
+    content: "" !important;
+    position: absolute;
+    color: transparent;
+    margin-right: 4px;
+  }
+}
+
+.dialog-footer {
+  display: block;
+  text-align: right;
+}
+
+.number-input {
+  ::v-deep .el-input__inner {
+    text-align: left;
+  }
+}
+.tableItem {
+  margin-bottom: 0 !important;
+}
+</style>

+ 38 - 2
src/views/businessManager/shopManager/model/subShopGoods.vue

@@ -42,8 +42,9 @@
           v-model.trim="searchForm.productCategoryId"
           :options="categoryList"
           placeholder="商品分类"
-          :props="{ checkStrictly: true, expandTrigger: 'hover' }"
+          :props="{ expandTrigger: 'hover' }"
         ></el-cascader>
+        <!-- checkStrictly: true, -->
       </el-form-item>
       <el-form-item prop="brandId">
         <el-select
@@ -136,7 +137,10 @@
 
 <script>
 import pagination from "@/components/Pagination/index";
-import { api_queryGoodsSubByPage } from "@/api/businessManager";
+import {
+  api_queryGoodsSubByPage,
+  api_queryGoodsCategoryList
+} from "@/api/businessManager";
 export default {
   props: ["disabledIds", "categoryList", "goodsBrand"],
   components: {
@@ -165,15 +169,47 @@ export default {
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
+    this.__init();
     console.log(this.employeeInfoId);
     this.getList();
   },
   methods: {
+    async __init() {
+      let params = {
+        delFlag: 0,
+        rows: 9999
+      };
+      try {
+        const { data } = await api_queryGoodsCategoryList(params);
+        const result = data || [];
+        let tempArray = [];
+        result.forEach(row => {
+          let children = [];
+          if (row.children && row.children.length > 0) {
+            row.children.forEach(child => {
+              children.push({
+                label: child.name,
+                value: child.id
+              });
+            });
+          }
+          tempArray.push({
+            label: row.name,
+            value: row.id,
+            children
+          });
+        });
+        this.categoryList = tempArray;
+      } catch {}
+    },
     getList() {
       let params = Object.assign({}, this.searchForm);
       // params.organId = this.organId;
       params.rows = this.pageInfo.limit;
       params.page = this.pageInfo.page;
+      params.productCategoryId = params.productCategoryId
+        ? params.productCategoryId[params.productCategoryId.length - 1]
+        : null;
       api_queryGoodsSubByPage(params).then(res => {
         if (res.code == 200 && res.data) {
           this.tableList = res.data.rows;

+ 49 - 84
src/views/businessManager/shopManager/shopList.vue

@@ -5,13 +5,13 @@
       商品列表
     </h2>
     <div class="m-core">
-      <!-- <el-button
+      <el-button
         type="primary"
         @click="onShopOperation('create')"
         v-permission="'/shopOperation'"
         style="margin-bottom: 20px"
         >添加</el-button
-      > -->
+      >
       <!-- <el-upload
         v-permission="'import/goods'"
         style="display: inline-block; margin: 0 10px"
@@ -170,13 +170,13 @@
           </el-select>
         </el-form-item>
         <el-form-item prop="goodsCategoryId">
-          <el-cascader
+          <!-- <el-cascader
             v-model.trim="searchForm.goodsCategoryId"
             :options="categoryList"
             placeholder="商品分类"
             :props="{ checkStrictly: true, expandTrigger: 'hover' }"
-          ></el-cascader>
-          <!-- <el-select
+          ></el-cascader> -->
+          <el-select
             v-model.trim="searchForm.goodsCategoryId"
             clearable
             placeholder="商品分类"
@@ -187,7 +187,7 @@
               :label="item.label"
               :value="item.value"
             ></el-option>
-          </el-select> -->
+          </el-select>
         </el-form-item>
         <el-form-item prop="brandId">
           <el-select
@@ -343,7 +343,11 @@
               {{ scope.row.marketPrice | moneyFormat }}
             </template>
           </el-table-column>
-          <el-table-column align="center" prop="marketPrice" label="零售价(元)">
+          <el-table-column
+            align="center"
+            prop="discountPrice"
+            label="零售价(元)"
+          >
             <template slot-scope="scope">
               {{ scope.row.discountPrice | moneyFormat }}
             </template>
@@ -475,8 +479,7 @@
       :title="addString[addType] + '组合商品'"
       v-if="routeShopStatus"
       :visible.sync="routeShopStatus"
-      @close="onFormClose('ruleForm')"
-      width="1000px"
+      width="1200px"
     >
       <combinationProducts
         :activeRow="activeRow"
@@ -491,12 +494,33 @@
         @confirm="getList"
       />
     </el-dialog>
+
+    <el-dialog
+      :title="addString[addType] + '商品'"
+      v-if="singleShopStatus"
+      :visible.sync="singleShopStatus"
+      @close="onFormClose('ruleForm')"
+      width="1000px"
+    >
+      <singleProducts
+        :activeRow="activeRow"
+        :addType="addType"
+        :addDisabled="addDisabled"
+        :categoryList="categoryList"
+        :goodsBrand="goodsBrand"
+        :goodsType="goodsType"
+        :tenantId="tenantId"
+        @close="singleShopStatus = false"
+        @confirm="getList"
+      />
+    </el-dialog>
   </div>
 </template>
 <script>
 import pagination from "@/components/Pagination/index";
 import Upload from "@/components/Upload/index";
 import combinationProducts from "./model/combinationProducts.vue";
+import singleProducts from "./model/singleProducts.vue";
 import {
   categoryListTree,
   goodsQuery,
@@ -524,7 +548,8 @@ export default {
     pagination,
     Tooltip,
     Upload,
-    combinationProducts
+    combinationProducts,
+    singleProducts
   },
   name: "shopList",
   data() {
@@ -571,7 +596,7 @@ export default {
         total: 0, // 总条数
         page_size: [10, 20, 40, 50] // 选择限制显示条数
       },
-
+      singleShopStatus: false,
       routeShopStatus: false,
       addType: "create",
       addString: {
@@ -605,30 +630,23 @@ export default {
     /** 商品分类 */
     async getCategory() {
       let params = {
-        // delFlag: 0,
+        delFlag: 0,
         rows: 9999
       };
       try {
-        const { data } = await api_queryGoodsCategoryList(params);
-        const result = data || [];
-        let tempArray = [];
-        result.forEach(row => {
-          let children = [];
-          if (row.children && row.children.length > 0) {
-            row.children.forEach(child => {
-              children.push({
-                label: child.name,
-                value: child.id
+        categoryListTree(params).then(res => {
+          let result = res.data;
+          if (res.code == 200) {
+            let tempArray = [];
+            result.rows.forEach(row => {
+              tempArray.push({
+                label: row.name,
+                value: row.id
               });
             });
+            this.categoryList = tempArray;
           }
-          tempArray.push({
-            label: row.name,
-            value: row.id,
-            children
-          });
         });
-        this.categoryList = tempArray;
       } catch {}
     },
     /** 商品类型 */
@@ -725,13 +743,6 @@ export default {
       params.organId = this.organId;
       params.rows = this.pageInfo.limit;
       params.page = this.pageInfo.page;
-      params.goodsCategoryId =
-        this.searchForm.goodsCategoryId &&
-        this.searchForm.goodsCategoryId.length > 0
-          ? this.searchForm.goodsCategoryId[
-              this.searchForm.goodsCategoryId.length - 1
-            ]
-          : null;
       goodsQuery(params).then(res => {
         if (res.code == 200 && res.data) {
           this.tableList = res.data.rows;
@@ -791,28 +802,6 @@ export default {
     handleError(err, file, fileList) {
       load.endLoading();
     },
-    // onOrganChange(val) {
-    //   if (val && val.length > 0) {
-    //     // 获取所有商品
-    //     this.getAllGoodsList(val.join(","));
-    //   }
-    // },
-    // async onValidGoodsStatus() {
-    //   // 更新商品选择状态
-    //   await this.getAllGoodsList();
-    //   console.log(this.form.goodsList);
-    //   let goodsList = this.form.goodsList;
-    //   let tempIds = [];
-    //   goodsList.forEach(item => {
-    //     tempIds.push(item.id);
-    //   });
-    //   this.selectGoodsList.forEach(item => {
-    //     item.disabled = false;
-    //     if (tempIds.includes(item.id)) {
-    //       item.disabled = true;
-    //     }
-    //   });
-    // },
     onShopOperation(type, row) {
       //修改
       this.addType = type;
@@ -820,35 +809,11 @@ export default {
       // 判断是否是修改组合商品
       if (type == "update" || type == "look" || type == "copy") {
         this.activeRow = row;
-
-        this.routeShopStatus = true;
       }
+      // this.singleShopStatus = true;
+      this.routeShopStatus = true;
     },
-    // beforeUpload(file) {
-    //   // console.log(file.type)
-    //   // const isJPG = file.type === '.xlsx' || file.type === '.xls';
-    //   // // const isLt2M = file.size / 1024 / 1024 < 2;
-    //   // if (!isJPG) {
-    //   //   this.$message.error('上传头像图片只能是 JPG 格式!');
-    //   // }
-    //   // return isJPG;
-    //   // this.goodsLoading = true
-    //   load.startLoading();
-    // },
-    // handleSuccess(response, file, fileList) {
-    //   // 导入商品
-    //   // 报表导出
-    //   load.endLoading();
-    //   if (response.code == 200) {
-    //     this.$message.success("导入成功");
-    //     this.getList();
-    //   } else {
-    //     this.$message.error(response.msg);
-    //   }
-    // },
-    // handleError(err, file, fileList) {
-    //   load.endLoading();
-    // },
+
     onDownload() {
       window.location.href =
         "https://oss.dayaedu.com/template/%E7%BB%84%E5%90%88%E5%95%86%E5%93%81%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx";

+ 6 - 6
src/views/resetTeaming/goodsModal/addShopGoods.vue

@@ -10,16 +10,16 @@
       :model="searchForm"
       save-key="payGoodsInfo-shopGoods"
     >
-      <el-form-item prop="keyword">
+      <el-form-item prop="name">
         <el-input
-          v-model.trim="searchForm.keyword"
+          v-model.trim="searchForm.name"
           clearable
           placeholder="商品名称"
         ></el-input>
       </el-form-item>
-      <el-form-item prop="productSn">
+      <el-form-item prop="sn">
         <el-input
-          v-model.trim="searchForm.productSn"
+          v-model.trim="searchForm.sn"
           clearable
           placeholder="商品货号"
         ></el-input>
@@ -143,8 +143,8 @@ export default {
         page_size: [10, 20, 40, 50] // 选择限制显示条数
       },
       searchForm: {
-        keyword: null,
-        productSn: null,
+        name: null,
+        sn: null,
         publishStatus: null,
         productCategoryId: null,
         brandId: null,

+ 1 - 1
src/views/resetTeaming/goodsModal/payBackMoney.vue

@@ -96,7 +96,7 @@
           <i
             class="el-icon-delete delete"
             v-if="
-              !(form.musicGroupCalenderRefundPeriods.length <= 1) ||
+              !(form.musicGroupCalenderRefundPeriods.length <= 1) &&
                 !payschoolListStatus
             "
             @click="deteleRow(item, index)"

+ 2 - 2
src/views/resetTeaming/modals/review-detail.vue

@@ -393,10 +393,10 @@
       :closable="false"
       class="alert"
       type="info"
-      v-if="address.id"
+      v-if="address && address.id"
     >
     </el-alert>
-    <descriptions :column="2" v-if="address.id">
+    <descriptions :column="2" v-if="address && address.id">
       <descriptions-item label="收货人:">{{ address.name }}</descriptions-item>
       <descriptions-item label="手机号:">{{
         address.phone