shish před 1 rokem
rodič
revize
4f5df6de38
1 změnil soubory, kde provedl 104 přidání a 26 odebrání
  1. 104 26
      hdApp/src/admin/order/refund.vue

+ 104 - 26
hdApp/src/admin/order/refund.vue

@@ -17,13 +17,30 @@
 							</view>
 							</view>
 						</view>
 						</view>
 						<view class="refund-control">
 						<view class="refund-control">
-							<input 
-								class="refund-input-compact" 
-								type="number" 
-								placeholder="0" 
-								v-model="res.refundCount" 
-								placeholder-style="color:#ccc" />
-							<text class="unit-label">份</text>
+							<view class="refund-input-group">
+								<view class="input-item">
+									<text class="input-label">数量</text>
+									<input 
+										class="refund-input-compact" 
+										type="number" 
+										placeholder="0" 
+										v-model="res.refundCount" 
+										placeholder-style="color:#ccc"
+										@focus="clearRefundCount(res)" />
+									<text class="unit-label">份</text>
+								</view>
+								<view class="input-item">
+									<text class="input-label">单价</text>
+									<input 
+										class="refund-input-compact" 
+										type="digit" 
+										placeholder="0.00" 
+										v-model="res.perPrice" 
+										placeholder-style="color:#ccc"
+										@focus="clearPerPrice(res)" />
+									<text class="unit-label">元</text>
+								</view>
+							</view>
 						</view>
 						</view>
 					</view>
 					</view>
 				</template>
 				</template>
@@ -38,13 +55,30 @@
 							</view>
 							</view>
 						</view>
 						</view>
 						<view class="refund-control">
 						<view class="refund-control">
-							<input 
-								class="refund-input-compact" 
-								type="number" 
-								placeholder="0" 
-								v-model="res.refundCount" 
-								placeholder-style="color:#ccc" />
-							<text class="unit-label">{{res.unitName}}</text>
+							<view class="refund-input-group">
+								<view class="input-item">
+									<text class="input-label">数量</text>
+									<input 
+										class="refund-input-compact" 
+										type="number" 
+										placeholder="0" 
+										v-model="res.refundCount" 
+										placeholder-style="color:#ccc"
+										@focus="clearRefundCount(res)" />
+									<text class="unit-label">{{res.unitName}}</text>
+								</view>
+								<view class="input-item">
+									<text class="input-label">单价</text>
+									<input 
+										class="refund-input-compact" 
+										type="digit" 
+										placeholder="0.00" 
+										v-model="res.perPrice" 
+										placeholder-style="color:#ccc"
+										@focus="clearPerPrice(res)" />
+									<text class="unit-label">元</text>
+								</view>
+							</view>
 						</view>
 						</view>
 					</view>
 					</view>
 				</template>
 				</template>
@@ -80,7 +114,7 @@
 							v-model="refundMoney" 
 							v-model="refundMoney" 
 							placeholder="请输入退款金额"
 							placeholder="请输入退款金额"
 							placeholder-style="color:#999"
 							placeholder-style="color:#999"
-							@focus="refundMoney=''">
+							@focus="clearRefundMoney">
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
@@ -117,7 +151,8 @@
 					class="remark-textarea" 
 					class="remark-textarea" 
 					v-model="remark" 
 					v-model="remark" 
 					placeholder="选填"
 					placeholder="选填"
-					placeholder-style="color:#999" />
+					placeholder-style="color:#999"
+					@focus="clearRemark" />
 			</view>
 			</view>
 		</view>
 		</view>
 
 
@@ -147,7 +182,7 @@ export default {
 			goodsInfoList:[],
 			goodsInfoList:[],
 			itemInfoList:[],
 			itemInfoList:[],
 			refundMoney:0,
 			refundMoney:0,
-			refundType:1,
+			refundType:0,
 			remark:'',
 			remark:'',
 			orderInfo:{},
 			orderInfo:{},
 			coundRefundPrice:0
 			coundRefundPrice:0
@@ -160,7 +195,7 @@ export default {
 			if(!this.$util.isEmpty(this.goodsInfoList)){
 			if(!this.$util.isEmpty(this.goodsInfoList)){
 				for (const item of this.goodsInfoList) {
 				for (const item of this.goodsInfoList) {
 					if(Number(item.refundCount)>0){
 					if(Number(item.refundCount)>0){
-						let currentPrice = Number(item.refundCount)*Number(item.unitPrice)
+						let currentPrice = Number(item.refundCount)*Number(item.perPrice || item.unitPrice)
 						currentPrice.toFixed(2)
 						currentPrice.toFixed(2)
 						price = Number(price) + Number(currentPrice)
 						price = Number(price) + Number(currentPrice)
 						price.toFixed(2)
 						price.toFixed(2)
@@ -171,7 +206,7 @@ export default {
 			if(!this.$util.isEmpty(this.itemInfoList)){
 			if(!this.$util.isEmpty(this.itemInfoList)){
 				for (const item of this.itemInfoList) {
 				for (const item of this.itemInfoList) {
 					if(Number(item.refundCount)>0){
 					if(Number(item.refundCount)>0){
-						let currentPrice = Number(item.refundCount)*Number(item.unitPrice)
+						let currentPrice = Number(item.refundCount)*Number(item.perPrice || item.unitPrice)
 						currentPrice.toFixed(2)
 						currentPrice.toFixed(2)
 						price = Number(price) + Number(currentPrice)
 						price = Number(price) + Number(currentPrice)
 						price.toFixed(2)
 						price.toFixed(2)
@@ -185,6 +220,18 @@ export default {
 	},
 	},
 
 
 	methods: {
 	methods: {
+		clearRefundCount(item) {
+			this.$set(item, 'refundCount', '');
+		},
+		clearPerPrice(item) {
+			this.$set(item, 'perPrice', '');
+		},
+		clearRefundMoney() {
+			this.refundMoney = '';
+		},
+		clearRemark() {
+			this.remark = '';
+		},
 		cancelRefund(){
 		cancelRefund(){
 			uni.navigateBack({delta: 1});
 			uni.navigateBack({delta: 1});
 		},
 		},
@@ -206,7 +253,12 @@ export default {
 						return false
 						return false
 					}
 					}
 					if(Number(ele.refundCount)>0){
 					if(Number(ele.refundCount)>0){
-						selectProduct.push({"productId":ele.goodsId,"num":ele.refundCount,"unitType":ele.unitType,unitName:ele.unitName,unitPrice:ele.unitPrice,property:0})
+						if(Number(ele.perPrice)>Number(ele.unitPrice)){
+							uni.showToast({title:ele.name+' 退款单价不能大于原价',icon:'none'})
+							hasError = true;
+							return false
+						}
+						selectProduct.push({"productId":ele.goodsId,"num":ele.refundCount,"unitType":ele.unitType,unitName:ele.unitName,unitPrice:ele.perPrice || ele.unitPrice,property:0})
 					}
 					}
 				})
 				})
 			}
 			}
@@ -224,17 +276,26 @@ export default {
 						return false
 						return false
 					}
 					}
 					if(Number(ele.refundCount)>0){
 					if(Number(ele.refundCount)>0){
-						selectProduct.push({"productId":ele.itemId,"num":ele.refundCount,"unitType":ele.unitType,unitName:ele.unitName,unitPrice:ele.unitPrice,property:1})
+						if(Number(ele.perPrice)>Number(ele.unitPrice)){
+							uni.showToast({title:ele.name+' 退款单价不能大于原价',icon:'none'})
+							hasError = true;
+							return false
+						}
+						selectProduct.push({"productId":ele.itemId,"num":ele.refundCount,"unitType":ele.unitType,unitName:ele.unitName,unitPrice:ele.perPrice || ele.unitPrice,property:1})
 					}
 					}
 				})
 				})
 			}
 			}
 			if(hasError){
 			if(hasError){
 				return
 				return
 			}
 			}
-			if(this.$util.isEmpty(selectProduct)&&this.refundType==1){
+			if(this.$util.isEmpty(selectProduct)){
 				uni.showToast({title:'请选择商品',icon:'none'})
 				uni.showToast({title:'请选择商品',icon:'none'})
 				return;
 				return;
 			}
 			}
+			if(this.refundType==0){
+				uni.showToast({title:'请选择库存退回还是不退回',icon:'none'})
+				return false
+			}
 			let refundParams = {product:JSON.stringify(selectProduct),id: this.option.id,price:this.refundMoney,remark:this.remark,refundType:this.refundType,getOriginalItem:1,version:2}
 			let refundParams = {product:JSON.stringify(selectProduct),id: this.option.id,price:this.refundMoney,remark:this.remark,refundType:this.refundType,getOriginalItem:1,version:2}
 			that.$util.confirmModal({content:'确认退款?'},() => {
 			that.$util.confirmModal({content:'确认退款?'},() => {
 				uni.showLoading({mask:true})
 				uni.showLoading({mask:true})
@@ -255,10 +316,10 @@ export default {
 			this.coundRefundPrice = parseFloat(this.coundRefundPrice)
 			this.coundRefundPrice = parseFloat(this.coundRefundPrice)
 
 
 			this.goodsInfoList = res.data.goodsInfoList.map(ele=>{
 			this.goodsInfoList = res.data.goodsInfoList.map(ele=>{
-				return {...ele,refundCount:null}
+				return {...ele,refundCount:null,perPrice:''}
 			})
 			})
 			this.itemInfoList = res.data.itemInfoList.map(ele=>{
 			this.itemInfoList = res.data.itemInfoList.map(ele=>{
-				return {...ele,refundCount:null}
+				return {...ele,refundCount:null,perPrice:''}
 			})
 			})
 		}
 		}
 	}
 	}
@@ -320,8 +381,6 @@ export default {
 .product-list-compact {
 .product-list-compact {
 	margin-top:15upx;
 	margin-top:15upx;
 	padding: 0 20upx 20upx;
 	padding: 0 20upx 20upx;
-	max-height: 60vh;
-	overflow-y: auto;
 }
 }
 
 
 .product-row {
 .product-row {
@@ -396,6 +455,24 @@ export default {
 	align-items: center;
 	align-items: center;
 	gap: 8upx;
 	gap: 8upx;
 	
 	
+	.refund-input-group {
+		display: flex;
+		flex-direction: column;
+		gap: 12upx;
+		
+		.input-item {
+			display: flex;
+			align-items: center;
+			gap: 8upx;
+			
+			.input-label {
+				font-size: 22upx;
+				color: #666;
+				min-width: 60upx;
+			}
+		}
+	}
+	
 	.refund-input-compact {
 	.refund-input-compact {
 		width: 100upx;
 		width: 100upx;
 		height: 60upx;
 		height: 60upx;
@@ -568,6 +645,7 @@ export default {
 
 
 // 底部操作按钮
 // 底部操作按钮
 .bottom-actions {
 .bottom-actions {
+	z-index:9999;
 	position: fixed;
 	position: fixed;
 	bottom: 0;
 	bottom: 0;
 	left: 0;
 	left: 0;