فهرست منبع

商品管理修改

pengyh 1 سال پیش
والد
کامیت
e07192f448
3فایلهای تغییر یافته به همراه120 افزوده شده و 32 حذف شده
  1. 9 0
      src/api/goods.js
  2. 45 28
      src/views/mallManagement/goods/classify_index/index.vue
  3. 66 4
      src/views/mallManagement/goods/goods_add/index.vue

+ 9 - 0
src/api/goods.js

@@ -108,6 +108,15 @@ export function getFreightList(params) {
   })
 }
 
+// 获取品牌
+export function getBrand(params) {
+  return request({
+    url: '/brand/list',
+    method: 'get',
+    params
+  })
+}
+
 // 添加商品
 export function addGoods(params) {
   return request({

+ 45 - 28
src/views/mallManagement/goods/classify_index/index.vue

@@ -101,20 +101,20 @@
           <el-input type="text" placeholder="请输入二级分类名称" v-model="addChildForm.twoClassify" maxlength="10" show-word-limit style="width: 250px;"></el-input>
         </el-form-item>
 
-        <el-form-item label="工单大类" prop="orderType">
-          <el-select v-model="addChildForm.orderType" placeholder="请选择工单大类" style="width: 250px;" @change="changeOrderType()">
-            <el-option :label="item.name" :value="item.number" v-for="(item, index) in orderMainType" :key="index">
-              <span style="color: #8492a6">{{ item.number }}</span>
-              <span style="margin-left: 10px;">{{ item.name }}</span>
+        <el-form-item label="工单大类" prop="main">
+          <el-select v-model="addChildForm.main" value-key="categoryId" placeholder="请选择工单大类" style="width: 250px;" @change="changeOrderType">
+            <el-option :label="item.name" :value="item" v-for="(item, index) in orderMainType" :key="index">
+             <!-- <span style="color: #8492a6">{{ item.number }}</span>
+              <span style="margin-left: 10px;">{{ item.name }}</span> -->
             </el-option>
           </el-select>
         </el-form-item>
 
         <el-form-item label="工单小类" prop="smallType">
-          <el-select v-model="addChildForm.smallType" placeholder="请选择工单小类" style="width: 250px;" :disabled="!addChildForm.orderType">
-            <el-option :label="item.name" :value="item.id" v-for="(item, index) in orderSmallType" :key="index">
-              <span style="color: #8492a6">{{ item.id }}</span>
-              <span style="margin-left: 10px;">{{ item.name }}</span>
+          <el-select v-model="addChildForm.small" value-key="categoryId" placeholder="请选择工单小类" style="width: 250px;" :disabled="!addChildForm.main.name">
+            <el-option :label="item.name" :value="item" v-for="(item, index) in orderSmallType" :key="index">
+             <!-- <span style="color: #8492a6">{{ item.id }}</span>
+              <span style="margin-left: 10px;">{{ item.name }}</span> -->
             </el-option>
           </el-select>
         </el-form-item>
@@ -168,6 +168,7 @@
 import { getToken } from '@/utils/auth'
 import { getClassifyList, addClassify, editClassify, deleteClassify, getClassifyDetail, getSmallType } from '@/api/goods'
 import { ORDER_MAIN_TYPE } from "@/utils/select_data";
+import { getMainList } from "@/api/workOrder/settlementStandardInstall";
 
 export default {
   data() {
@@ -208,8 +209,8 @@ export default {
       addChildForm: {
         oneClassify: '',
         twoClassify: '',
-        orderType: '',
-        smallType: '',
+		main: {},
+        small: {},
         workOrderType: 'REPAIR',
         imgUrl: '',
         taxNumber: '',
@@ -234,7 +235,8 @@ export default {
 
       classifyList: [],
 
-      orderMainType: ORDER_MAIN_TYPE,
+      // orderMainType: ORDER_MAIN_TYPE,
+			orderMainType: [],
       orderSmallType: [],
 
     }
@@ -255,6 +257,12 @@ export default {
         this.dataList = res.data;
       })
     },
+		
+	getMainList(){
+		getMainList({type: 2}).then(res => {
+			this.orderMainType = res.data
+		})
+	},
 
     // 筛选后重新获取列表
     getListByScreen() {
@@ -318,9 +326,10 @@ export default {
     },
 
     // 改变大类
-    changeOrderType() {
-      this.addChildForm.smallType = '';
-      this.getSmallType();
+    changeOrderType(e) {
+		this.orderSmallType = e.children
+		this.addChildForm.small = {};
+		// this.getSmallType();
     },
 
     getSmallType() {
@@ -334,6 +343,7 @@ export default {
 
     // 打开 新增编辑 二级分类
     addOrEditChild(type, cid) {
+	  this.getMainList()
       this.addChildFormType = type;
       this.addChildFormVisible = true;
       getClassifyList({name: ''}).then(res => {
@@ -350,11 +360,16 @@ export default {
       if(type == 'edit') {
         this.editChildId = cid;
         getClassifyDetail({categoryId: cid}).then(res => {
+			this.orderMainType.forEach(item =>{
+				if(item.categoryId == res.data.mainNumber){
+					this.orderSmallType = item.children
+				}
+			})
           this.addChildForm = {
             oneClassify: res.data.parentId,
             twoClassify: res.data.name,
-            orderType: Number(res.data.mainNumber),
-            smallType: Number(res.data.smallNumber),
+            main: {name: res.data.mainName,categoryId: res.data.mainNumber},
+			small: {name: res.data.smallName,categoryId: res.data.smallNumber},
             workOrderType: res.data.workOrderType,
             imgUrl: res.data.imgUrl,
             taxNumber: res.data.taxNumber,
@@ -362,7 +377,7 @@ export default {
             status: res.data.status,
             sort: res.data.sortNum
           }
-          this.getSmallType();
+          // this.getSmallType();
         })
       }
     },
@@ -377,21 +392,21 @@ export default {
     submitAddChildForm() {
       this.$refs.addChildForm.validate((valid) => {
         if (valid) {
-          let index = this.$findElem(ORDER_MAIN_TYPE, 'number', this.addChildForm.orderType);
-          let mainName = index >= 0 ? ORDER_MAIN_TYPE[index].name : '';
+          // let index = this.$findElem(ORDER_MAIN_TYPE, 'number', this.addChildForm.orderType);
+          // let mainName = index >= 0 ? ORDER_MAIN_TYPE[index].name : '';
 
-          let index2 = this.$findElem(this.orderSmallType, 'id', this.addChildForm.smallType);
-          let smallName = index2 >= 0 ? this.orderSmallType[index2].name : '';
+          // let index2 = this.$findElem(this.orderSmallType, 'id', this.addChildForm.smallType);
+          // let smallName = index2 >= 0 ? this.orderSmallType[index2].name : '';
           
           let params = {}
           if(this.addChildFormType == 'edit') {
             params = {
                 categoryId: this.editChildId,
                 name: this.addChildForm.twoClassify,
-                mainNumber: this.addChildForm.orderType || '',
-                mainName: mainName,
-                smallNumber: this.addChildForm.smallType || '',
-                smallName: smallName,
+                mainNumber: this.addChildForm.main.categoryId || '',
+                mainName: this.addChildForm.main.name || '',
+                smallNumber: this.addChildForm.small.categoryId || '',
+                smallName: this.addChildForm.small.name,
                 workOrderType: this.addChildForm.workOrderType,
                 imgUrl: this.addChildForm.imgUrl,
                 taxNumber: this.addChildForm.taxNumber,
@@ -409,8 +424,10 @@ export default {
               children: [{
                 parentId: this.addChildForm.oneClassify,
                 name: this.addChildForm.twoClassify,
-                mainNumber: this.addChildForm.orderType || '',
-                mainName: mainName,
+                mainNumber: this.addChildForm.main.categoryId || '',
+                mainName: this.addChildForm.main.name || '',
+                smallNumber: this.addChildForm.small.categoryId || '',
+                smallName: this.addChildForm.small.name,
                 imgUrl: this.addChildForm.imgUrl,
                 taxNumber: this.addChildForm.taxNumber,
                 taxPercent: this.addChildForm.taxPercent,

+ 66 - 4
src/views/mallManagement/goods/goods_add/index.vue

@@ -12,7 +12,33 @@
     <!-- 第一步 -->
     <div class="form-container" v-show="step == 0">
       <div class="title">基础信息</div>
-      <el-form ref="step1Form" :model="step1Form" :rules="step1FormRules" label-width="110px">
+      <el-form ref="step1Form" :model="step1Form" :rules="step1FormRules" label-width="120px">
+		<el-form-item label="品牌:" prop="brand">
+			<el-select v-model="step1Form.brand" value-key="id" placeholder="请选择">
+			    <el-option
+			      v-for="item in brandList"
+			      :key="item.id"
+			      :label="item.brandName"
+			      :value="item">
+			    </el-option>
+			</el-select>
+		</el-form-item>
+		<el-form-item label="工单类型:" prop="orderSmallType">
+			<el-select v-model="step1Form.orderSmallType" placeholder="请选择">
+			    <el-option
+			      v-for="item in orderTypeList"
+			      :key="item.id"
+			      :label="item.orderSmallTypeText"
+			      :value="item.orderSmallTypeText">
+			    </el-option>
+			</el-select>
+		</el-form-item>
+		<el-form-item label="是否虚拟商品:" prop="isVr">
+			 <el-radio-group v-model="step1Form.isVr">
+			    <el-radio :label="true">是</el-radio>
+			    <el-radio :label="false">否</el-radio>
+			  </el-radio-group>
+		</el-form-item>
         <el-form-item label="商品名称:" prop="goodsName">
           <el-input v-model="step1Form.goodsName" placeholder="请输入商品名称" maxlength="200" show-word-limit></el-input>
         </el-form-item>
@@ -379,7 +405,8 @@
 
 <script>
 import { getToken } from '@/utils/auth'
-import { getClassifyList, getFreightList, addGoods, editGoods, getGoodsDetail, getModuleList, getMarketingList, getTagList } from '@/api/goods'
+import { getClassifyList, getFreightList, addGoods, editGoods, getGoodsDetail, getModuleList, getMarketingList, getTagList, getBrand } from '@/api/goods'
+import { getTypeList } from "@/api/workOrder/settlementStandardInstall";
 import { quillEditor } from 'vue-quill-editor'
 import 'quill/dist/quill.core.css'
 import 'quill/dist/quill.snow.css'
@@ -425,6 +452,9 @@ export default {
         marketing: '',
         attrs: [],
         tags: [],
+		isVr: false,
+		orderSmallType: '',
+		brand: {},
         // logoUrl: '',
         // showDate: [],
       },
@@ -440,13 +470,24 @@ export default {
         ],
         classify: [
           { required: true, message: '请选择商品分类', trigger: 'change' }
-        ]
+        ],
+		brand: [
+          { required: true, message: '请选择品牌', trigger: 'change' }
+        ],
+		orderSmallType: [
+		  { required: true, message: '请选择工单类型', trigger: 'change' }
+		],
+		isVr: [
+		  { required: true, message: '请选择是否虚拟商品', trigger: 'change' }
+		]
       },
       imagesList: [], // 图片墙展示列表
 
       classifyList: [],
       freightList: [],
       moduleList: [],
+			orderTypeList: [],
+			brandList: [],
 
       step2Form: {
         specType: true,
@@ -571,6 +612,8 @@ export default {
 
     this.getFreightList();
     this.getModuleList();
+	this.getTypeList()
+	this.getBrand()
 
     if (this.isEdit) {
       this.canCompute = false;
@@ -597,7 +640,18 @@ export default {
         })
       })
     },
-
+		
+		getTypeList(){
+			getTypeList({pageNum: 1,pageSize: -1,params: [{param: 'a.order_type',compare: '=',value: 'INSTALL'},{param: 'a.status',compare: '=',value: true}]}).then(res => {
+				this.orderTypeList = res.data.records
+			})
+		},
+	getBrand(){
+		getBrand().then(res => {
+			this.brandList = res.data
+		})
+	},
+		
     // getMarketingList() {
     //   let classifyList = this.classifyList;
     //   let categoryId = '';
@@ -679,6 +733,9 @@ export default {
           marketing: data.marketingId,
           attrs: data.tags,
           tags: data.tagsLabel,
+		  brand: {id: data.brandId,brandName: data.brandName},
+		  isVr: data.isVr,
+		  orderSmallType: data.orderSmallType
           // logoUrl: data.logo,
           // showDate: data.logoStartTime ? [data.logoStartTime.slice(0, 10), data.logoEndTime.slice(0, 10)] : [],
         }
@@ -961,6 +1018,11 @@ export default {
 
         templateId: this.step3Form.moduleId,
         content: this.step3Form.detailContent,
+		
+		isVr: this.step1Form.isVr,
+		orderSmallType: this.step1Form.orderSmallType,
+		brandId: this.step1Form.brand.id,
+		brandName: this.step1Form.brand.brandName,
       }
       console.log(params);