shish 5 лет назад
Родитель
Сommit
c9328443e8

+ 1 - 1
ghs/src/components/module/item-list-layer.vue

@@ -161,7 +161,7 @@ export default {
             },
             {
               prop: 'stockWarning',
-              label: '最低库存提醒',
+              label: '库存预警值',
               align: 'center'
             },
             {

+ 70 - 70
hd/src/components/module/item-list-layer.vue

@@ -1,32 +1,13 @@
 <template>
-  <el-dialog
-    title="选择花材"
-    :visible.sync="selDialog"
-    :close-on-click-modal="false"
-    :append-to-body="true"
-    @close="$emit('update:show', false)"
-    width="800px"
-  >
+  <el-dialog title="选择花材" :visible.sync="selDialog" :close-on-click-modal="false" :append-to-body="true" @close="$emit('update:show', false)" width="950px">
     <div class="recharge-modal-content">
-      <el-checkbox-group
-        v-model="checkList"
-        class="radio-wrap"
-      >
-        <x-crud
-          class="liu-crud-wrap"
-          @load="onLoad"
-        >
+      <el-checkbox-group v-model="checkList" class="radio-wrap">
+        <x-crud class="liu-crud-wrap" @load="onLoad">
+
           <template #table-column-radio="{scope}">
             <div>
-              <el-checkbox
-                v-if="scope.row.select == 2"
-                disabled
-                :label="scope.row"
-              >{{scope.row.id}}</el-checkbox>
-              <el-checkbox
-                v-else
-                :label="scope.row"
-              >{{scope.row.id}}</el-checkbox>
+              <el-checkbox v-if="scope.row.select == 2" disabled :label="scope.row" >{{scope.row.id}}</el-checkbox>
+              <el-checkbox v-else :label="scope.row">{{scope.row.id}}</el-checkbox>
             </div>
           </template>
 
@@ -36,56 +17,39 @@
           </template>
 
           <template #table-column-stockWarning="{scope}">
-            <el-input
-              v-model="scope.row.stockWarning"
-              placeholder="最低库存"
-              size="small"
-            ></el-input>
+            <el-input v-model="scope.row.stockWarning" placeholder="库存预警值" size="small"></el-input>
           </template>
 
           <template #table-column-cost="{scope}">
-            <el-input
-              v-model="scope.row.cost"
-              placeholder="成本价"
-              size="small"
-            ></el-input>
+            <el-input v-model="scope.row.cost" placeholder="成本价" size="small" ></el-input>
           </template>
 
           <template #table-column-addPrice="{scope}">
-            <el-input
-              v-model="scope.row.addPrice"
-              placeholder="加价"
-              size="small"
-            ></el-input>
+            <el-input v-model="scope.row.addPrice" placeholder="加价" size="small"></el-input>
           </template>
 
           <template #table-column-cover="{scope}">
             <div>
-              <cl-avatar
-                shape="square"
-                :size="40"
-                :src="scope.row.cover | default_avatar"
-                :style="{ margin: 'auto' }"
-              ></cl-avatar>
+              <cl-avatar shape="square" :size="40" :src="scope.row.cover | default_avatar" :style="{ margin: 'auto' }" ></cl-avatar>
             </div>
           </template>
+
         </x-crud>
       </el-checkbox-group>
+
+      <div>      
+        <el-select v-model="sonClassName" size="small" placeholder="请选择分类" @change="selClassFn">
+          <el-option v-for="(item, index) in itemClassList" :key="index" :value="item.name">{{ item.name }}</el-option>
+        </el-select>
+      </div>
+
     </div>
-    <div
-      slot="footer"
-      class="dialog-footer"
-    >
-      <el-button
-        size="small"
-        @click="resetForm"
-      >取 消</el-button>
-      <el-button
-        type="primary"
-        size="small"
-        @click="confirmFn"
-      >确定</el-button>
+
+    <div slot="footer" class="dialog-footer">
+      <el-button size="small" @click="resetForm" >取 消</el-button>
+      <el-button type="primary" size="small" @click="confirmFn">确定</el-button>
     </div>
+
   </el-dialog>
 </template>
 
@@ -97,9 +61,17 @@ export default {
       type: Boolean,
       default: false
     },
+    classId: {
+      type: Number,
+      default: 0
+    },
     multi: {
       type: Boolean,
       default: false
+    },
+    className:{
+      type: String,
+      default:''
     }
   },
   data () {
@@ -108,30 +80,55 @@ export default {
       ruleForm: {},
       checkList: [],
       list: [],
+      //分类列表
+			itemClassList: [],
+      sonClassId:0,
+      sonClassName:''
     };
   },
   computed: {
   },
   watch: {
     show () {
-      console.log(this.show)
       this.selDialog = this.show;
     }
   },
   created () { },
   methods: {
+    selClassFn(val){
+			let index = this.itemClassList.findIndex((e) => e.name == val)
+			this.sonClassId = this.itemClassList[index].id
+    },
+		getAllClass() {
+			if (!this.$util.isEmpty(this.itemClassList)) {
+				return this.itemClassList
+			}
+			this.$service.itemClass.getAllClass().then((res) => {
+				this.itemClassList = res.list
+			})
+		},
     confirmFn () {
-      if (this.checkList.length > 0) {
-        this.$emit('confirm', this.checkList);
-      } else {
-        this.$message.warning('请至少选择一项花材');
+      if (this.checkList.length == 0) {
+        this.$message.warning('请选择花材')
+        return false
       }
-
+      if(this.classId == 0){
+        this.$message.warning('请选择花材')
+        return false
+      }
+      this.$emit('confirm', {list:this.checkList,classId:this.sonClassId})
     },
     resetForm () {
       this.$emit('cancel');
     },
     onLoad ({ ctx, app }) {
+
+      this.sonClassId = this.classId
+      this.sonClassName = this.className
+
+      //分类列表
+      this.getAllClass()
+
       this.app = app;
 
       let getItemList = () => {
@@ -146,13 +143,13 @@ export default {
               prop: 'radio',
               label: '选择',
               align: 'center',
-              width: 120
+              width: 110
             },
             {
               prop: 'cover',
               label: '图片',
               align: 'center',
-              width: 130
+              width: 120
             },
             {
               prop: 'name',
@@ -161,7 +158,7 @@ export default {
             },
             {
               prop: 'stockWarning',
-              label: '最低库存提醒',
+              label: '库存预警值',
               align: 'center'
             },
             {
@@ -174,6 +171,11 @@ export default {
               label: '加价',
               align: 'center'
             },
+            {
+              prop: 'weight',
+              label: '重量',
+              align: 'center'
+            },
             {
               prop: 'select',
               label: '已添加',
@@ -182,8 +184,6 @@ export default {
           ],
           on: {
             'row-click': (row, column) => {
-              console.log(666666666666666)
-              console.log(row)
             }
           },
           // 操作列

+ 8 - 8
hd/src/mock/userInfo.js

@@ -331,25 +331,25 @@ let menu = {
 			keepAlive: 1
 		},
 		{
-			id: '412',
+			id: '415',
 			parentId: '4',
-			name: '花材分类',
+			name: '花材列表',
 			type: 1,
 			icon: 'icon-user',
 			orderNum: 4,
-			router: '/item-class/list',
-			viewPath: 'views/item-class/list.vue',
+			router: '/item/list',
+			viewPath: 'views/item/list.vue',
 			keepAlive: 1
 		},
 		{
-			id: '415',
+			id: '412',
 			parentId: '4',
-			name: '花材列表',
+			name: '花材分类',
 			type: 1,
 			icon: 'icon-user',
 			orderNum: 4,
-			router: '/item/list',
-			viewPath: 'views/item/list.vue',
+			router: '/item-class/list',
+			viewPath: 'views/item-class/list.vue',
 			keepAlive: 1
 		},
 		// 邀请有礼

+ 7 - 0
hd/src/service/item-class/index.js

@@ -23,5 +23,12 @@ export class ItemClassService extends BaseService {
 			params: data
 		});
 	}
+	getAllClass(data) {
+		return this.request({
+			url: '/list',
+			params: data
+		});
+	}
+	
 }
 export default new ItemClassService();

+ 1 - 1
hd/src/views/item-class/list.vue

@@ -190,7 +190,7 @@ export default {
 		getItemList(data) {
 			let query = {};
 			query.classId = data.id
-			query.name = data.name
+			query.className = data.name
 			this.$router.push({ path: '/item/list', query });
 		},
 		// x-crud 组件

+ 74 - 21
hd/src/views/item/list.vue

@@ -34,6 +34,31 @@
         <span>{{ scope.row.goodsName }}</span>
       </template>
 
+      <template #table-header-addPrice>
+        <div class="set-sort">
+          <span>每扎加价</span>
+          <el-button
+            v-if="!sort.status"
+            icon="el-icon-edit-outline"
+            size="small"
+            type="text"
+            @click="showSort"
+            class="show"
+          ></el-button>
+          <el-button
+            class="hide"
+            v-else
+            size="mini"
+            @click="hideSort"
+            type="primary"
+          >完成</el-button>
+        </div>
+      </template>
+
+      <template #table-column-unit="{scope}">
+        <span>{{ scope.row.bigUnit }} / {{scope.row.smallUnit}}</span>
+      </template>
+
       <template #table-column-inTurn="{scope}">
         <span v-if="!sort.status">{{ scope.row.inTurn }}</span>
         <el-input
@@ -70,17 +95,18 @@
       </template>
       <template
         #slot-add-goods-btn
-        v-if="showAddBtn"
       >
         <el-button
           type="primary"
           size="mini"
-          @click="add()"
+          @click="addFn()"
         >添加</el-button>
       </template>
     </x-crud>
     <item-list-layer
       :show.sync="showItemModal"
+      :classId.sync="classId"
+      :className.sync="className"
       @confirm="selGoodsConfirmFn"
       @cancel="showItemModal = false"
     ></item-list-layer>
@@ -113,19 +139,23 @@ export default {
         status: false
       },
       classId: 0,
-      showAddBtn: false,
+      className:'',
       showItemModal: false,
     };
   },
   computed: {
   },
   methods: {
-    selGoodsConfirmFn (item) {
+    selGoodsConfirmFn (itemVal) {
+
+      let item = itemVal.list
+      let classId = itemVal.classId
+
       let param = []
       item.forEach(value => {
         let newObj = {}
         newObj.itemId = value.id
-        newObj.classId = this.classId
+        newObj.classId = classId
         newObj.cost = value.cost
         newObj.addPrice = value.addPrice
         newObj.stockWarning = value.stockWarning
@@ -139,27 +169,26 @@ export default {
         this.$router.go(0)
       }).catch(err => { console.log(err) })
     },
-    add () {
+    addFn () {
       this.showItemModal = true
     },
     tabClick (tab, e) {
       this.app.refresh({ classId: this.classId });
     },
     onLoad ({ ctx, app }) {
-      this.app = app;
+
       if (this.$route.query.classId) {
-        this.classId = this.$route.query.classId
-        if (this.$route.query.name != '') {
-          this.tabsData[0].text = this.$route.query.name
-          this.$forceUpdate()
-          this.showAddBtn = true
-        }
-      } else {
-        this.showAddBtn = false
+        this.classId = Number(this.$route.query.classId)
+        this.className = this.$route.query.className
+        this.tabsData[0].text = this.className
+        
       }
+
+      this.app = app
+
       let getItem = () => {
         return this.$service.item.list({ classId: this.classId })
-      };
+      }
       ctx.service({
         page: getItem
       })
@@ -177,28 +206,52 @@ export default {
               'min-width': 180
             },
             {
-              prop: 'stockWarning',
-              label: '库存预警',
+              prop: 'classId',
+              label: '分类',
               align: 'center',
               'min-width': 100
             },
+            {
+              prop: 'stockWarning',
+              label: '库存预警值',
+              align: 'center',
+              'min-width': 90
+            },
             {
               prop: 'cost',
               label: '每扎成本价',
               align: 'center',
-              'min-width': 100
+              'min-width': 90
             },
             {
               prop: 'addPrice',
               label: '每扎加价',
               align: 'center',
+              'min-width': 150
+            },
+            {
+              prop: 'weight',
+              label: '重量',
+              align: 'center',
+              'min-width': 90
+            },
+            {
+              prop: 'unit',
+              label: '单位',
+              align: 'center',
               'min-width': 100
             },
+            {
+              prop: 'ratio',
+              label: '大小单位比',
+              align: 'center',
+              'min-width': 80
+            },
             {
               prop: 'inTurn',
               label: '排序',
               align: 'center',
-              minWidth: 100
+              minWidth: 120
             },
             {
               prop: 'addTime',
@@ -210,7 +263,7 @@ export default {
           op: {
             visible: true,
             props: {
-              width: 300,
+              width: 200,
               align: 'center',
               fixed: 'right',
               label: '操作'

+ 2 - 1
hd/vue.config.js

@@ -2,7 +2,8 @@ const path = require('path');
 
 const isProduction = process.env.NODE_ENV === 'production';
 
-const proxyTarget = 'https://api.shop.huaml.com';
+//http和https切换请修改这里,修改后需要重新运行npm run serve shish 2021.4.12
+const proxyTarget = 'http://api.shop.huaml.com';
 
 function resolve(dir) {
 	return path.join(__dirname, dir);

+ 10 - 10
pt/src/mock/userInfo.js

@@ -313,30 +313,30 @@ let menu = {
 			type: 0,
 			icon: 'icongongzuotai',
 			orderNum: 4,
-			router: '/item-class/list',
-			viewPath: 'views/item-class/list.vue',
+			router: '/item/list',
+			viewPath: 'views/item/list.vue',
 			keepAlive: 1
 		},
 		{
-			id: '805',
+			id: '810',
 			parentId: '8',
-			name: '花材分类',
+			name: '花材列表',
 			type: 1,
 			icon: 'icongongzuotai',
 			orderNum: 4,
-			router: '/item-class/list',
-			viewPath: 'views/item-class/list.vue',
+			router: '/item/list',
+			viewPath: 'views/item/list.vue',
 			keepAlive: 1
 		},
 		{
-			id: '810',
+			id: '805',
 			parentId: '8',
-			name: '花材列表',
+			name: '花材分类',
 			type: 1,
 			icon: 'icongongzuotai',
 			orderNum: 4,
-			router: '/item/list',
-			viewPath: 'views/item/list.vue',
+			router: '/item-class/list',
+			viewPath: 'views/item-class/list.vue',
 			keepAlive: 1
 		},
 		{

+ 1 - 1
pt/src/views/item/list.vue

@@ -419,7 +419,7 @@ export default {
 						},
 						{
 							prop: 'stockWarning',
-							label: '库存预警',
+							label: '库存预警',
 							align: 'center',
 							'min-width': 100,
 						},