shish 5 anni fa
parent
commit
b78bb42f9b

+ 1 - 1
ghs/src/components/chat/index.vue

@@ -87,7 +87,7 @@
 			</div>
 		</el-dialog>
 
-        <el-button class="global_kd_button" type="primary" size="medium" @click="globalGoToKd()" icon="el-icon-edit" circle></el-button>
+        <!-- <el-button class="global_kd_button" type="primary" size="medium" @click="globalGoToKd()" icon="el-icon-edit" circle></el-button> -->
 
 	</div>
 </template>

+ 0 - 15
ghs/src/cool/components/upload/index.vue

@@ -41,7 +41,6 @@
 
 <script>
 import { mapGetters } from 'vuex';
-import { baseUrl } from '@/config/env';
 import { imgHostUrl } from '@/config/env';
 
 export default {
@@ -125,7 +124,6 @@ export default {
 				];
 			}
 		},
-
 		callback() {
 			this.ajSize();
 
@@ -137,7 +135,6 @@ export default {
 					.join(',')
 			);
 		},
-
 		ajSize() {
 			const { 'multiple-limit': multipleLimit = 1 } = this.props;
 
@@ -145,7 +142,6 @@ export default {
 				this.list.unshift({});
 			}
 		},
-
 		beforeUpload(file, item, index) {
 			this.index = index;
 			if (this.props && this.props['before-upload']) {
@@ -154,13 +150,8 @@ export default {
 
 			item.loading = true;
 		},
-
 		onSuccess(res, file) {
 
-			//暂时关闭图库上传 shish 2020.5.28
-			// this.$message.error('开发中...');
-			// return false;
-
 			let item = this.list[this.index];
 			const { url, smallUrl, shortUrl } = res;
 			const { multiple } = this.props;
@@ -171,7 +162,6 @@ export default {
 				if (item.url) {
 					item.url = shortUrl;
 				} else {
-					// item.url = smallUrl;
 					this.list.push({
 						url: shortUrl
 					});
@@ -191,7 +181,6 @@ export default {
 				this.props['on-success'](res, file);
 			}
 		},
-
 		onError(err, file, fileList) {
 			console.error('upload error', err);
 			this.$message.error('图片上传失败');
@@ -201,16 +190,12 @@ export default {
 				this.props['on-error'](err, file, fileList);
 			}
 		},
-
 		removeFile(i) {
 			this.list.splice(i, 1);
 			this.callback();
 		},
-
-		//
 		getFile(file, fileList) {
 			this.getBase64(file.raw).then(res => {
-				// this.list = res;
 				let host = null;
 				if (this.hostUrl) {
 					host = () => {

+ 158 - 101
ghs/src/views/item/list.vue

@@ -21,6 +21,11 @@
         <span>{{ scope.row.goodsName }}</span>
       </template>
 
+      <template #table-column-delStatus="{scope}">
+		<i class="el-icon-success" v-if="scope.row.delStatus == 0" style="color:#67C23A;font-size:19px;"></i>
+		<i class="el-icon-success" v-else style="color:#D1D1D1;font-size:19px;"></i>
+      </template>
+
       <template #table-column-unit="{scope}">
         <span>{{ scope.row.bigUnit }} / {{scope.row.smallUnit}}</span>
       </template>
@@ -36,6 +41,30 @@
           <el-button class="hide" v-else size="mini" @click="commitChange('price')" type="primary">完成</el-button>
         </div>
       </template>
+
+      <template #table-column-stockWarning="{scope}">
+        <span v-if="!stockWarningInput"><span>{{ scope.row.stockWarning}}</span></span>
+		<el-input style="width:80%;" ref="sort-input" focus size="mini" v-else placeholder="" v-model="scope.row.stockWarning" @blur="changeInputValue(scope.row, 'stockWarning')" ></el-input>
+      </template>
+      <template #table-header-stockWarning>
+        <div class="set-sort">
+          <span>库存预警</span>
+          <el-button v-if="!stockWarningInput" icon="el-icon-edit-outline" size="small" type="text" @click="showStockWarningInput" class="show"></el-button>
+          <el-button class="hide" v-else size="mini" @click="commitChange('stockWarning')" type="primary">完成</el-button>
+        </div>
+      </template>
+
+      <template #table-column-shelfLife="{scope}">
+        <span v-if="!shelfLifeInput"><span>{{ scope.row.shelfLife}}</span></span>
+		<el-input style="width:80%;" ref="sort-input" focus size="mini" v-else placeholder="" v-model="scope.row.shelfLife" @blur="changeInputValue(scope.row, 'shelfLife')" ></el-input>
+      </template>
+      <template #table-header-shelfLife>
+        <div class="set-sort">
+          <span>保质期(天)</span>
+          <el-button v-if="!shelfLifeInput" icon="el-icon-edit-outline" size="small" type="text" @click="showShelfLifeInputInput" class="show"></el-button>
+          <el-button class="hide" v-else size="mini" @click="commitChange('shelfLife')" type="primary">完成</el-button>
+        </div>
+      </template>
       
       <template #table-column-inTurn="{scope}">
         <span v-if="!sort.status">{{ scope.row.inTurn }}</span>
@@ -48,12 +77,7 @@
           <el-button v-if="!sort.status" icon="el-icon-edit-outline" size="small" type="text" @click="showInTurn" class="show"></el-button>
           <el-button class="hide" v-else size="mini" @click="commitChange('inTurn')" type="primary">完成</el-button>
         </div>
-      </template>
-
-	<template #table-column-prePrice="{scope}">
-		<span>{{ (scope.row.prePrice)}}</span>
-	</template>
-	  
+      </template> 
 
       <template #slot-modify="{ scope }">
 				<el-button type="text" @click.native.stop="replaceBtnFn(scope.row.id,1)" >修改</el-button>
@@ -63,7 +87,7 @@
 
 		<template #table-header-cost>
 			<div class="set-sort">
-				<span>每扎成本</span>
+				<span>每扎成本</span>
 				<el-button v-if="!costPrice" icon="el-icon-edit-outline" size="small" type="text" @click="showCost" class="show"></el-button>
 				<el-button class="hide" v-else size="mini" @click="commitChange('cost')" type="primary">完成</el-button>
 			</div>
@@ -108,9 +132,6 @@
 			<span v-if="!costWeight">{{ scope.row.weight }}</span>
 			<el-input style="width:80%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.weight" @blur="changeInputValue(scope.row, 'weight')"></el-input>
 		</template>
-		<template #table-column-delStatus="{scope}">
-			<span>{{ scope.row.delStatus==0?'上架':'下架' }}</span>
-		</template>
 
 
       <template #slot-add-goods-btn>
@@ -160,10 +181,10 @@
 						></el-input>
 					</el-form-item>
 
-          <el-form-item label="图片" prop="cover">
+		<el-form-item label="图片" prop="cover">
 						<cl-upload v-model="replaceForm.cover" :successFun="uploadSuccess"></cl-upload>
 						<p style="font-size: 14px; color: #cccccc">建议上传图片比例 400X400</p>
-					</el-form-item>
+		</el-form-item>
 
           <el-form-item label="分类" prop="classId">
 						<el-select
@@ -215,10 +236,10 @@
 						></el-input>
 					</el-form-item>
 
-          <el-form-item label="每扎成本" prop="cost">
+          <el-form-item label="每扎成本" prop="cost">
 						<el-input
 							v-model="replaceForm.cost"
-							placeholder="请输入成本"
+							placeholder="请输入成本"
 							size="small"
 						></el-input>
 					</el-form-item>
@@ -238,7 +259,7 @@
 				<el-button type="primary" size="small" @click="replaceConfirmFn">确认</el-button>
 			</div>
 		</el-dialog>
-		<!--//批量修改-->
+		<!--批量修改-->
 	  <el-dialog width="600px" title="批量修改" :visible.sync="dialogFormVisible">
 		  <div class="flex-center">
 			  <el-input placeholder="批量修改" v-model="batchAlter" autocomplete="off"></el-input>
@@ -248,11 +269,6 @@
 			  <el-input  placeholder="批量加价" v-model="batchAddPrice" autocomplete="off"></el-input>
 			  <el-button style="margin: 0 30px" type="primary" @click="batchAddPriceFun">确 定</el-button>
 		  </div>
-
-		  <!--<div slot="footer" class="dialog-footer">-->
-			  <!--<el-button @click="dialogFormVisible = false">取 消</el-button>-->
-			  <!--<el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>-->
-		  <!--</div>-->
 	  </el-dialog>
 
   </div>
@@ -288,6 +304,8 @@ export default {
       costPrice: false,
 	  costWeight: false,
 	  priceInput:false,
+	  shelfLifeInput:false,
+	  stockWarningInput:false,
       classId: 0,
       className:'',
       showItemModal: false,
@@ -367,14 +385,6 @@ export default {
     
   },
   methods: {
-    showCost() {
-		this.initData = []
-		this.costPrice = true
-		this.priceInput = false;
-		this.sort.status = false;
-		this.canAddRatio = false;
-		this.costWeight = false;
-    },
     selectItemFn (currentItem) {
 
       let item = currentItem.list
@@ -488,25 +498,25 @@ export default {
               prop: 'id',
               label: 'ID',
               align: 'center',
-              'min-width': 50
+              'min-width': 40
             },
 			{
 				prop: 'cover',
 				label: '图片',
 				align: 'center',
-				'min-width': 80,
+				'min-width': 60,
 			},
             {
               prop: 'name',
               label: '名称',
               align: 'center',
-              'min-width': 160
+              'min-width': 110
             },
             {
               prop: 'cost',
-              label: '每扎成本',
+              label: '每扎成本',
               align: 'center',
-              'min-width': 140
+              'min-width': 120
             },
             {
               prop: 'addPrice',
@@ -515,20 +525,32 @@ export default {
               'min-width': 150
             },
             {
-              prop: 'prePrice',
-              label: '价',
+              prop: 'price',
+              label: '价',
               align: 'center',
-              minWidth: 80
+              minWidth:110
             },
             {
-              prop: 'price',
-              label: '售价',
+              prop: 'stockWarning',
+              label: '库存预警',
               align: 'center',
-              minWidth:140
+              'min-width': 118
+            },
+			{
+              prop: 'delStatus',
+              label: '上架',
+              align: 'center',
+              minWidth: 60
             },
             {
-              prop: 'unit',
-              label: '大小单位',
+              prop: 'shelfLife',
+              label: '保质期',
+              align: 'center',
+              'min-width': 125
+            },
+            {
+              prop: 'className',
+              label: '分类',
               align: 'center',
               'min-width': 80
             },
@@ -548,25 +570,13 @@ export default {
               prop: 'inTurn',
               label: '排序',
               align: 'center',
-              minWidth: 130
+              minWidth: 120
             },
             {
-              prop: 'className',
-              label: '分类',
-              align: 'center',
-              'min-width': 70
-            },
-            {
-              prop: 'stockWarning',
-              label: '库存预警',
-              align: 'center',
-              'min-width': 75
-            },
-			{
-              prop: 'delStatus',
-              label: '状态',
+              prop: 'unit',
+              label: '大小单位',
               align: 'center',
-              minWidth: 70
+              'min-width': 80
             }
           ],
           op: {
@@ -610,33 +620,48 @@ export default {
       app.refresh({ showPage: 1, pageSize: 50, });
     },
     uploadSuccess() {
-			console.log(this.$refs['replaceForm'].validateField('cover'))
+			console.log('valid',this.$refs['replaceForm'].validateField('cover'))
 		},
     refresh (params) {
       this.app.refresh(params);
     },
+    showCost() {
+		this.initData = []
+		this.costPrice = true
+		this.priceInput = false;
+		this.shelfLifeInput = false;
+		this.stockWarningInput = false;
+		this.sort.status = false;
+		this.canAddRatio = false;
+		this.costWeight = false;
+    },
     showAddPrice(){
-      this.initData = []
-       this.canAddPrice = true;
-	   this.priceInput = false;
+    	this.initData = []
+    	this.canAddPrice = true;
+		this.priceInput = false;
+		this.shelfLifeInput = false;
+	   	this.stockWarningInput = false;
 		this.sort.status = false;
 		this.costPrice = false;
 		this.canAddRatio = false;
 		this.costWeight = false;
     },
     showAddRatio(){
-      this.initData = []
-       this.canAddRatio = true;
-	   this.priceInput = false;
+    	this.initData = []
+    	this.canAddRatio = true;
+		this.priceInput = false;
+	   	this.stockWarningInput = false;
 		this.sort.status = false;
+		this.shelfLifeInput = false;
 		this.costPrice = false;
 		this.canAddPrice = false;
 		this.costWeight = false;
     },
   	showWeight(){
-      this.initData = []
-       this.costWeight = true
-	   this.priceInput = false;
+		this.initData = []
+		this.costWeight = true
+		this.priceInput = false;
+		this.stockWarningInput = false;
 		this.sort.status = false;
 		this.costPrice = false;
 		this.canAddPrice = false;
@@ -646,6 +671,8 @@ export default {
       	this.initData = []
 		this.sort.status = true;
 		this.priceInput = false;
+		this.shelfLifeInput = false;
+		this.stockWarningInput = false;
 		this.costPrice = false;
 		this.canAddPrice = false;
 		this.canAddRatio = false;
@@ -654,6 +681,30 @@ export default {
 	showPriceInput(e){
       	this.initData = []
 		this.priceInput = true;
+		this.shelfLifeInput = false;
+		this.stockWarningInput = false;
+		this.sort.status = false;
+		this.costPrice = false;
+		this.canAddPrice = false;
+		this.canAddRatio = false;
+		this.costWeight = false;
+	},
+	showStockWarningInput(e){
+      	this.initData = []
+		this.shelfLifeInput = false;
+		this.priceInput = false;
+		this.stockWarningInput = true;
+		this.sort.status = false;
+		this.costPrice = false;
+		this.canAddPrice = false;
+		this.canAddRatio = false;
+		this.costWeight = false;
+	},
+	showShelfLifeInputInput(){
+      	this.initData = []
+		this.shelfLifeInput = true;
+		this.priceInput = false;
+		this.stockWarningInput = false;
 		this.sort.status = false;
 		this.costPrice = false;
 		this.canAddPrice = false;
@@ -680,13 +731,18 @@ export default {
 			case 'price':
 				this.priceInput = false;
 			break;
+			case 'stockWarning':
+				this.stockWarningInput = false;
+			break;
+			case  'shelfLife':
+				this.shelfLifeInput = false;
+			break;
 		}
 	},
 
     commitChange (type) {
 		
       if(this.$util.isEmpty(this.initData)){
-		 this.$message.error('没有修改');
 		 this.hiddenInput(type)
 		return false
 	  }
@@ -699,7 +755,7 @@ export default {
 
       this.dataList.form.data = JSON.stringify(this.initData)
       this.$service.product.productBatchUpdate(this.dataList.form).then(res => {
-        
+
 		loading.close();
 
 		this.hiddenInput(type)
@@ -712,7 +768,7 @@ export default {
     replaceBtnFn(id) {
 		this.getAllClass()
 		this.getAllUnit()
-      this.addDialog = true
+      	this.addDialog = true
 		this.currentItemId = id;
 		if(id==0){
 			this.replaceFormRules = {};
@@ -777,44 +833,41 @@ export default {
 				let index = this.itemClassList.findIndex((e) => e.id == res.classId)
 				this.replaceForm = res
 				this.replaceForm.className = this.itemClassList[index].name
-				console.log(this.replaceForm.cover)
-				if(this.replaceForm.cover.indexOf('http') != -1 && this.replaceForm.cover.indexOf('/uploads') != -1) {
-					let str = this.replaceForm.cover
-					let str1 = str.substring(0, str.indexOf("/uploads"));
-					this.replaceForm.cover = str.substring(str1.length+1, str.length);
-				}
+
+				this.replaceForm.cover = res.shortCover
+
 			})
 		}
 
     },
-	  //批量加价
-	  batchAddPriceFun(){
-    	if(this.batchAddPrice=='') return;
-		  this.dataList.form.type = 'addPrice'
-		  let data = this.$refs['xCrud'].table.data;
-			data.forEach((ele)=>{
-				let batchAddPrice = (Number(this.batchAddPrice) + Number(ele.addPrice)).toFixed(2)
-				ele.addPrice = batchAddPrice
-				this.initData.push({id:ele.id,addPrice:ele.addPrice})
-			})
-		  	this.dialogFormVisible = false;
-	  },
-	  //批量改价
-	  batchAlterFun(){
-		  if(this.batchAlter=='') return;
-		  this.dataList.form.type = 'addPrice'
-		  let data = this.$refs['xCrud'].table.data;
-		  data.forEach((ele)=>{
-			  ele.addPrice = this.batchAlter
-			  this.initData.push({id:ele.id,addPrice:this.batchAlter})
-		  })
-		  this.dialogFormVisible = false
-	  },
-	  changeAllSort(e){
+	//批量加价
+	batchAddPriceFun(){
+	if(this.batchAddPrice=='') return;
+		this.dataList.form.type = 'addPrice'
+		let data = this.$refs['xCrud'].table.data;
+		data.forEach((ele)=>{
+			let batchAddPrice = (Number(this.batchAddPrice) + Number(ele.addPrice)).toFixed(2)
+			ele.addPrice = batchAddPrice
+			this.initData.push({id:ele.id,addPrice:ele.addPrice})
+		})
+		this.dialogFormVisible = false;
+	},
+	//批量改价
+	batchAlterFun(){
+		if(this.batchAlter=='') return;
+		this.dataList.form.type = 'addPrice'
+		let data = this.$refs['xCrud'].table.data;
+		data.forEach((ele)=>{
+			ele.addPrice = this.batchAlter
+			this.initData.push({id:ele.id,addPrice:this.batchAlter})
+		})
+		this.dialogFormVisible = false
+	},
+	changeAllSort(e){
 		this.batchAlter='';
 		this.batchAddPrice='';
 		this.dialogFormVisible = true;
-	  },
+	},
 	changeInputValue (d, type) {
 		this.dataList.form.type = type
 		let obj = {
@@ -832,6 +885,10 @@ export default {
 			obj.ratio  = d.ratio
 		}else if(type == 'price') {
 			obj.price = d.price
+		}else if(type == 'stockWarning') {
+			obj.stockWarning = d.stockWarning
+		}else if(type == 'shelfLife') {
+			obj.shelfLife = d.shelfLife
 		}
 		this.initData.push(obj)
 	}

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

@@ -338,9 +338,7 @@
 			},
 			replaceConfirmFn() {
 				let replaceForm = this.$util.copyObject(this.replaceForm)
-				if(this.replaceForm.cover.substr(0,4).toLowerCase() == "http"){
-					replaceForm.cover = this.replaceForm.shortCover;
-				}
+				replaceForm.cover = this.replaceForm.shortCover;
 				this.$refs.replaceForm.validate((valid) => {
 					if(valid) {
 						this.$service.product.update(replaceForm).then(res => {