谢杰标 3 anos atrás
pai
commit
70535efdf8

+ 19 - 2
src/api/resource/good.js

@@ -11,9 +11,9 @@ export function getSpecList(query) {
 
 
 // 新增或修改模板
-export function changeSpec(data, t) {
+export function changeSpec(data) {
     return request({
-        url: `/system/template/${t ? 'edit' : 'addSpec'}`,
+        url: `/system/template/${data.specTemplateId ? 'edit' : 'addSpec'}`,
         method: 'post',
         data
     })
@@ -43,4 +43,21 @@ export function relation(data, b) {
         method: 'post',
         data
     })
+}
+
+// 获得商品模板列表
+export function getGoodsSpecList(id) {
+    return request({
+        url: '/goods/spec/list/' + id,
+        method: 'get',
+    })
+}
+
+// 修改商品默认规格模板
+export function goodsUpdateSpec(data) {
+    return request({
+        url: `/goods/update/spec`,
+        method: 'post',
+        data
+    })
 }

+ 1 - 1
src/components/tableList.vue

@@ -100,7 +100,7 @@
         v-if="navText.choiceRadio"
         align="center"
         type="selection"
-        fixed="left"
+        :fixed="navText.radioFixed"
         width="55"
       >
         <template slot-scope="scope">

+ 11 - 0
src/views/Marketing/goods/commodityManageMent/add/index.vue

@@ -191,6 +191,7 @@ export default {
             new Error("商品有效期范围必须包含在学习服务期范围内,请重新调整")
           );
         }
+        return callback();
       } else {
         callback();
       }
@@ -608,6 +609,16 @@ export default {
         data.timeArrays[1],
         1
       );
+      if (data.serviceTimeType === 4) {
+        data.studyStartTime = this.$methodsTools.time10to13(
+          data.studyTimeArrays[0],
+          1
+        );
+        data.studyEndTime = this.$methodsTools.time10to13(
+          data.studyTimeArrays[1],
+          1
+        );
+      }
       //商品标准价格明细表
       data.standPriceJson = JSON.stringify(data.standPriceJson);
       //商品是否上架

+ 23 - 9
src/views/Marketing/goods/commodityManageMent/edit/index.vue

@@ -226,6 +226,7 @@ export default {
             new Error("商品有效期范围必须包含在学习服务期范围内,请重新调整")
           );
         }
+        return callback();
       } else {
         callback();
       }
@@ -824,6 +825,16 @@ export default {
         data.timeArrays[1],
         1
       );
+      if (data.serviceTimeType === 4) {
+        data.studyStartTime = this.$methodsTools.time10to13(
+          data.studyTimeArrays[0],
+          1
+        );
+        data.studyEndTime = this.$methodsTools.time10to13(
+          data.studyTimeArrays[1],
+          1
+        );
+      }
       //商品标准价格明细表
       data.standPriceJson = JSON.stringify(data.standPriceJson);
       //商品是否上架
@@ -977,7 +988,7 @@ export default {
               item.sort = Number(item.sort);
               return item;
             });
-            data.courseList = []
+            data.courseList = [];
           } else {
             data.courseList = this.$refs.courseContent.tableData.map((item) => {
               return {
@@ -985,19 +996,22 @@ export default {
                 sort: Number(item.sort),
               };
             });
-            data.menuList = []
+            data.menuList = [];
           }
         } else {
           data.courseList = [];
           data.menuList = [];
         }
-        this.$api.obtainCourseSgoodsId(this.listData.goodsId).then((res) => {
-          if (res.rows.length === 1 && res.rows[0].courseShow === 0) {
-            data.courseId = res.rows[0].courseId;
-          }
-        }).finally(()=>{
-          resolve();
-        })
+        this.$api
+          .obtainCourseSgoodsId(this.listData.goodsId)
+          .then((res) => {
+            if (res.rows.length === 1 && res.rows[0].courseShow === 0) {
+              data.courseId = res.rows[0].courseId;
+            }
+          })
+          .finally(() => {
+            resolve();
+          });
       });
     },
     /**

+ 108 - 1
src/views/Marketing/goods/commodityManageMent/index.vue

@@ -15,10 +15,15 @@
       @addClick="addClick"
       :loading="loading"
       @editInfo="editInfo"
+      @openClassNum="openClassNum"
     >
       <template slot="btn" slot-scope="props">
         <el-button
-          v-if="props.scope.row.goodsType == 1 && props.scope.row.courseNum && props.scope.row.courseNum > 0"
+          v-if="
+            props.scope.row.goodsType == 1 &&
+            props.scope.row.courseNum &&
+            props.scope.row.courseNum > 0
+          "
           type="text"
           @click="setTeacher(props.scope.row)"
           >双师制设置</el-button
@@ -39,6 +44,34 @@
       @handleSizeChange="handleSizeChange"
       @handleCurrentChange="handleCurrentChange"
     />
+    <el-dialog
+      :visible.sync="dialogVisible"
+      width="1000px"
+      :show-close="false"
+      :close-on-click-modal="false"
+    >
+      <div slot="title" class="hearders">
+        <div class="leftTitle">关联商品规格</div>
+        <div class="rightBoxs">
+          <img
+            src="@/assets/images/Close@2x.png"
+            alt=""
+            @click="dialogVisible = false"
+          />
+        </div>
+      </div>
+      <table-list
+        :tableSets="dialogTableSet"
+        :tableData="dialogTableData"
+        :navText="dialogNavText"
+        :radio.sync="tableRadio"
+      >
+      </table-list>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="submit">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -46,6 +79,7 @@
 import searchBoxNew from "@/components/searchBoxNew";
 import tableList from "@/components/tableList";
 import pagination from "@/components/pagination";
+import { getGoodsSpecList, goodsUpdateSpec } from "@/api/resource/good";
 export default {
   name: "CommodityManageMent",
   components: { searchBoxNew, tableList, pagination },
@@ -198,6 +232,12 @@ export default {
           prop: "subjectNames",
           hidden: true,
         },
+        {
+          label: "关联商品规格",
+          prop: "specTemplateNumber",
+          hidden: true,
+          scope: "aboutClassNum",
+        },
         {
           label: "业务层次",
           prop1: "projectName",
@@ -283,6 +323,49 @@ export default {
       ],
       tableData: [], //表单数据
       total: 0, //一共多少条
+      dialogVisible: false,
+      dialogTableSet: [
+        {
+          label: "教育类型",
+          prop: "educationName",
+          hidden: true,
+        },
+        {
+          label: "业务层次",
+          prop: "businessName",
+          hidden: true,
+        },
+        {
+          label: "商品规格模板名称",
+          prop: "name",
+          hidden: true,
+        },
+        {
+          label: "商品规格数量",
+          prop: "specNumber",
+          hidden: true,
+        },
+      ],
+      dialogTableData: [{}],
+      dialogNavText: {
+        index: 0,
+        num: false,
+        border: true,
+        choice: false,
+        choiceRadio: true,
+        radioKey: "specTemplateId",
+        radioFixed: false,
+        addHide: !false,
+        tableHide: true,
+        dontNum: true,
+        headShow: false,
+        backFatherBtn: {
+          status: false,
+          title: "未定义",
+        },
+      },
+      tableRadio: "",
+      activeGoodsId: {},
     };
   },
   mounted() {
@@ -292,6 +375,15 @@ export default {
     this.search();
   },
   methods: {
+    openClassNum(id) {
+      this.activeGoodsId = id;
+      let { specTemplateId } = this.tableData.find((e) => e.goodsId == id);
+      this.tableRadio = specTemplateId || "";
+      getGoodsSpecList(id).then((res) => {
+        this.dialogTableData = res.data;
+      });
+      this.dialogVisible = true;
+    },
     editInfo(v) {
       this.addClick(v, 0);
     },
@@ -444,6 +536,21 @@ export default {
         this.search();
       });
     },
+    submit() {
+      if (!this.tableRadio) {
+        return this.$message({
+          message: "请选择关联商品规格",
+          type: "warning",
+        });
+      }
+      goodsUpdateSpec({
+        goodsId: this.activeGoodsId,
+        specTemplateId: this.tableRadio,
+      }).then((res) => {
+        this.dialogVisible = false;
+        this.search();
+      });
+    },
   },
 };
 </script>

+ 9 - 3
src/views/Marketing/goods/commodityManageMent/teacher/index.vue

@@ -39,7 +39,10 @@
           ref="resultData"
         >
           <el-form-item label="模板名称" prop="name">
-            <el-input v-model="resultData.name" placeholder="请输入别名"></el-input>
+            <el-input
+              v-model="resultData.name"
+              placeholder="请输入别名"
+            ></el-input>
           </el-form-item>
           <el-form-item label="关联课程" prop="majors">
             <el-button type="primary" size="small" @click="link"
@@ -61,7 +64,10 @@
               </el-table-column>
               <el-table-column prop="aliasName" label="别名(必填)" width="200">
                 <template slot-scope="scope">
-                  <el-input v-model="scope.row['aliasName']"></el-input>
+                  <el-input
+                    v-model="scope.row['aliasName']"
+                    :maxlength="10"
+                  ></el-input>
                 </template>
               </el-table-column>
               <el-table-column label="操作" width="108">
@@ -165,7 +171,7 @@ export default {
     },
     closeBZ() {
       this.dialogVisible = false;
-      this.search()
+      this.search();
     },
     link() {
       //打开关联课程组件

+ 7 - 1
src/views/Marketing/goods/spec/compoent/configTable.vue

@@ -17,7 +17,12 @@
         >
       </template>
     </table-list>
-    <el-dialog title="添加" :visible.sync="dialogTableVisible" width="1200px">
+    <el-dialog
+      title="添加"
+      :visible.sync="dialogTableVisible"
+      width="1200px"
+      :close-on-click-modal="false"
+    >
       <search-box-new
         ref="searchBox"
         :formData="formData"
@@ -253,6 +258,7 @@ export default {
         tableHide: choice,
         dontNum: true,
         headShow: false,
+        radioFixed: true,
         backFatherBtn: {
           status: false,
           title: "未定义",

+ 2 - 2
src/views/Marketing/goods/spec/specAdd.vue

@@ -93,7 +93,7 @@
 <script>
 import SpecBox from "./compoent/SpecBox.vue";
 import ConfigTable from "./compoent/configTable.vue";
-import { changeSpec } from "@/api/resource/good";
+import {changeSpec } from "@/api/resource/good";
 export default {
   data() {
     var checkList = (rule, value, callback) => {
@@ -158,7 +158,7 @@ export default {
     },
     submitForm() {
       this.checkSpecBox() &&
-        changeSpec(this.ruleForm, this.ruleForm.specTemplateId).then((res) => {
+        changeSpec(this.ruleForm).then((res) => {
           this.isNext = true;
           this.ruleForm.specTemplateId = res.data[0].specTemplateId;
           res.data.map((ele) => {

+ 1 - 1
src/views/Marketing/goods/spec/specEdit.vue

@@ -155,7 +155,7 @@ export default {
     },
     submitForm() {
       this.checkSpecBox() &&
-        changeSpec(this.ruleForm, true).then((res) => {
+        changeSpec(this.ruleForm).then((res) => {
           this.isNext = true;
           res.data.map((ele) => {
             ele.attrListVos.map((e, i) => {