Просмотр исходного кода

退款问题优化、1、零售采购时,碰到负库存提示 ​ 2、供货商库存不足也不能开单、修改图片,没有上传图片时会变空掉(同步零售端)、增加花材的上下架功能,下架后 开单页和采购页不再显示 零售和供货商同步修改

jiangfeng 5 лет назад
Родитель
Сommit
ac26d98df5

+ 19 - 5
ghs/src/views/item/list.vue

@@ -40,11 +40,9 @@
       </template>
 
       <template #slot-modify="{ scope }">
-				<el-button
-					type="text"
-					@click.native.stop="replaceBtnFn(scope.row.id)"
-					>修改</el-button
-				>
+				<el-button type="text" @click.native.stop="replaceBtnFn(scope.row.id,1)" >修改</el-button>
+				<el-button type="text" v-if="scope.row.delStatus==1" @click.native.stop="setStatusFun(scope.row.id,0)" >上架</el-button>
+				<el-button type="text" v-if="scope.row.delStatus==0" @click.native.stop="setStatusFun(scope.row.id,1)" >下架</el-button>
 			</template>
 
 		<template #table-header-cost>
@@ -94,6 +92,9 @@
 			<span v-if="!costWeight">{{ scope.row.weight }}</span>
 			<el-input style="width:50%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.weight" @blur="changeSort(scope.row, 'weight')"></el-input>
 		</template>
+		<template #table-column-delStatus="{scope}">
+			<span>{{ scope.row.delStatus==0?'上架':'下架' }}</span>
+		</template>
 
 
       <template #slot-add-goods-btn>
@@ -417,6 +418,14 @@ export default {
 			this.$refs['replaceForm'].resetFields();
 			this.addDialog = false;
 		},
+    setStatusFun(id,type){
+      this.$service.product.update({id:id,delStatus:type}).then(res => {
+        console.log('res1111', res)
+        this.$message.success('操作成功!');
+        // this.addDialog = false
+        this.app.refresh()
+      }).catch(err => {})
+	},
     replaceConfirmFn() {
 		let replaceForm = this.$util.copyObject(this.replaceForm)
 		if(this.replaceForm.cover.substr(0,4).toLowerCase() == "http"){
@@ -529,6 +538,11 @@ export default {
               label: '创建时间',
               align: 'center',
               minWidth: 140
+            },{
+              prop: 'delStatus',
+              label: '状态',
+              align: 'center',
+              minWidth: 100
             }
           ],
           op: {

+ 8 - 0
ghsApp/src/components/module/app-commodity.vue

@@ -144,6 +144,13 @@ export default {
 			}
 		},
 		addEvents() {
+			const ratio = Number(this.info.ratio);
+			// if(this.offVerifyRepertory){	}
+				if (Number(this.bigCount) * ratio + Number(this.smallCount) >Number(this.info.bigNum) * ratio + Number(this.info.smallNum)) {
+					this.$msg("库存不足");
+					return
+				}
+
 			this.animationFun('add');
 			// let params = {
 			// 	...this.info,
@@ -172,6 +179,7 @@ export default {
 		},
 		customNum() {
 			// if(!this.info.bigCount){
+			if(this.info.stock<=0){uni.showToast({title:'库存不足',icon:'none'});return;}
 			if(!this.bigCount && !this.smallCount){
 				let params = {
 					...this.info,

+ 12 - 18
ghsApp/src/pagesOrder/refund.vue

@@ -3,6 +3,7 @@
 		height: calc(100vh - 30rpx * 2);
 		padding: 30rpx;
 		background: #FFFFFF;
+		font-size: 30rpx;
 		.radioBtn{
 			width: 30rpx;
 			height: 30rpx;
@@ -94,13 +95,14 @@
 					<view class="refund-label"><text>*</text>选择商品:</view>
 					<view>
 						<view class="list" v-for="(res,i) in product" :key="i">
-						<view class="flex list-title" @tap="selectProduct(i)">
-							<view class="flex-center radioBtn" :class="res.isActive?'active':''"></view>
+						<!--<view class="flex list-title" @tap="selectProduct(i)">-->
+						<view class="flex list-title" >
+							<!--<view class="flex-center radioBtn" :class="res.isActive?'active':''"></view>-->
 							{{res.name}} {{ `${res.bigNum}/${res.smallNum}` }} {{`¥${res.price}`}}
 						</view>
 						<view class="flex list-val">
-							<input type="number" @focus="isMonitor = true" @blur="inputFun" v-model="res.big"><text>扎</text>
-							<input type="number" @focus="isMonitor = true" @blur="inputFun" v-model="res.small"><text>支</text>
+							<input type="number" @blur="inputFun" v-model="res.big"><text>扎</text>
+							<input type="number" @blur="inputFun" v-model="res.small"><text>支</text>
 						</view>
 					</view>
 					</view>
@@ -113,7 +115,7 @@
 
 				<view class="flex refund-item">
 					<view class="refund-label"><text>*</text>退款金额:</view>
-					<input type="digit" @focus="isMonitor = false"   v-model="refundMoney">
+					<input type="digit" v-model="refundMoney">
 				</view>
 
 
@@ -162,26 +164,18 @@ export default {
 	},
 	computed:{
 		refundMoneyFun(){
-			if(!this.isMonitor){return;}
+			// if(!this.isMonitor){return;}
 			this.refundMoney = null;
 			if(!this.$util.isEmpty(this.product)){
 				this.product.forEach(ele=>{
-					// if(Number(ele.big)>Number(ele.bigNum)){
-					// 	uni.showToast({title:'不能大于商品数量',icon:'none'})
-					// 	ele.big = null;
-					// }
-					// if(Number(ele.small)>Number(ele.smallNum)){
-					// 	uni.showToast({title:'不能大于商品数量',icon:'none'})
-					// 	ele.small = null;
-					// }
 					let unitPrice = ele.unitPrice; //单价
 					let big = ele.big * unitPrice; //输入的扎
 					let ratio = ele.ratio==0?1:ele.ratio; //比例
 					let small = (ele.small/ratio * unitPrice).toFixed(2); //输入的支
 
-					if(ele.isActive){
+					// if(ele.isActive){}
 						this.refundMoney = (Number(this.refundMoney) + big + Number(small)).toFixed(2);
-					}
+
 				})
 			}
 
@@ -221,7 +215,7 @@ export default {
 
 		},
 		inputFun(e){
-			this.isMonitor = false
+			// this.isMonitor = false
 				this.product.forEach(ele=>{
 					if(Number(ele.big)>Number(ele.bigNum)){
 						uni.showToast({title:'不能大于商品数量',icon:'none'})
@@ -236,7 +230,7 @@ export default {
 
 		},
 		selectProduct(index){
-			this.isMonitor = true
+			// this.isMonitor = true
 			this.product[index].isActive = !this.product[index].isActive;
 		},
 		async init() {

+ 27 - 9
hd/src/views/item/list.vue

@@ -43,11 +43,10 @@
 			</template>
 
 			<template #slot-modify="{ scope }">
-				<el-button
-					type="text"
-					@click.native.stop="replaceBtnFn(scope.row.id)"
-				>修改</el-button
-				>
+				<el-button type="text" @click.native.stop="replaceBtnFn(scope.row.id)">修改</el-button>
+				<el-button type="text" v-if="scope.row.delStatus==1" @click.native.stop="setStatusFun(scope.row.id,0)" >上架</el-button>
+				<el-button type="text" v-if="scope.row.delStatus==0" @click.native.stop="setStatusFun(scope.row.id,1)" >下架</el-button>
+
 			</template>
 
 			<template #table-header-cost>
@@ -83,7 +82,9 @@
 				<span v-if="!costWeight">{{ scope.row.weight }}</span>
 				<el-input style="width:50%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.weight" @blur="changeSort(scope.row, 'weight')"></el-input>
 			</template>
-
+			<template #table-column-delStatus="{scope}">
+				<span>{{ scope.row.delStatus==0?'上架':'下架' }}</span>
+			</template>
 
 			<template #slot-add-goods-btn>
 				<el-button type="primary" size="mini" @click="addFn()">添加</el-button>
@@ -327,7 +328,19 @@
 				this.$refs['replaceForm'].resetFields();
 				this.addDialog = false;
 			},
+			setStatusFun(id,type){
+				this.$service.product.update({id:id,delStatus:type}).then(res => {
+					console.log('res1111', res)
+					this.$message.success('操作成功!');
+					// this.addDialog = false
+					this.app.refresh()
+				}).catch(err => {})
+			},
 			replaceConfirmFn() {
+				let replaceForm = this.$util.copyObject(this.replaceForm)
+				if(this.replaceForm.cover.substr(0,4).toLowerCase() == "http"){
+					replaceForm.cover = this.replaceForm.shortCover;
+				}
 				this.$refs.replaceForm.validate((valid) => {
 					if(valid) {
 						this.$service.product.update(this.replaceForm).then(res => {
@@ -405,7 +418,7 @@
 								prop: 'unit',
 								label: '大小单位',
 								align: 'center',
-								'min-width': 100
+								'min-width': 80
 							},
 							{
 								prop: 'ratio',
@@ -417,13 +430,18 @@
 								prop: 'inTurn',
 								label: '排序',
 								align: 'center',
-								minWidth: 120
+								minWidth: 100
 							},
 							{
 								prop: 'addTime',
 								label: '创建时间',
 								align: 'center',
-								minWidth: 180
+								minWidth: 140
+							},{
+								prop: 'delStatus',
+								label: '状态',
+								align: 'center',
+								minWidth: 100
 							}
 						],
 						op: {

+ 1 - 0
hdApp/src/components/module/app-commodity.vue

@@ -175,6 +175,7 @@ export default {
 
 		},
 		customNum() {
+			if(this.info.stock<=0){uni.showToast({title:'库存不足',icon:'none'});return;}
 			// if(!this.info.bigCount){
 			if(!this.bigCount && !this.smallCount){
 				let params = {