فهرست منبع

订单列表与售后

shish 1 سال پیش
والد
کامیت
3413a4a7d6
2فایلهای تغییر یافته به همراه32 افزوده شده و 78 حذف شده
  1. 7 0
      ghs/src/service/order/index.js
  2. 25 78
      ghs/src/views/order/components/begin-refund.vue

+ 7 - 0
ghs/src/service/order/index.js

@@ -20,6 +20,13 @@ export class OrderService extends BaseService {
 		});
 	}
 
+	detail(data) {
+		return this.request({
+			url: '/detail',
+			params: data
+		});
+	}
+
 	arrivalDetail(data) {
 		return this.request({
 			url: '/arrival-detail',

+ 25 - 78
ghs/src/views/order/components/begin-refund.vue

@@ -25,22 +25,13 @@
 							<div class="list" v-for="(res,i) in product" :key="i">
 								<div class="flex list-title">
 									<span class="product-name">{{res.name}}</span>
-									<span class="product-num">{{ `${parseFloat(res.itemNum)}` }}{{res.bigUnit}}</span>
-									<span class="product-price">{{`${parseFloat(res.bigPrice)}`}}元/{{res.bigUnit}}</span>
+									<span class="product-num">{{ `${parseFloat(res.xhNum)}` }}{{res.xhUnitName}}</span>
+									<span class="product-price">{{`${parseFloat(res.xhUnitPrice)}`}}元/{{res.xhUnitName}}</span>
 								</div>
 								<div class="flex list-val" style="font-size:18px;font-weight:bold;">
 									<input type="text" placeholder="退货数" v-model="res.refundCount" placeholder-style="color:#CCCCCC" />
-									<span style="margin-left:10px;">{{res.bigUnit}}</span>
-									<span style="color:green;margin-left:20px;">可退{{Number(res.itemNum)-Number(res.refundNum)}}{{res.bigUnit}}</span>
-								</div>
-								<div v-if="orderInfo.inBooking && orderInfo.inBooking == 1 && !$util.isEmpty(res.sendList)" style="border:1px solid #6795da;font-size:18px;margin:8px 0 5px 0;padding:5px 0 5px 0;">
-									<div v-for="(send,sendIndex) in res.sendList" style="padding:5px 5px 5px 8px;" :key="sendIndex">
-										<div>{{ send.customName }}({{ send.seatSn }})<span style="margin-left:20px;">上架数 {{ send.num }}{{res.bigUnit}}</span></div>
-										<div style="border-bottom:1px solid #77a977;padding-bottom:6px;padding-top:4px;display: flex;align-items: center;margin-top:3px;">
-											<input type="text" placeholder="下架数" v-model="send.currentRefundNum" placeholder-style="color:#CCCCCC" style="border: 2px solid #ddd;width:140px;font-size:18px;text-align:center;margin-right:10px;"/>
-											<span style="margin-left:10px;">可下架{{parseFloat((Number(send.num)-Number(send.outNum)).toFixed(2))}}{{res.bigUnit}}</span>
-										</div>
-									</div>
+									<span style="margin-left:10px;">{{res.xhUnitName}}</span>
+									<span style="color:green;margin-left:20px;">可退{{Number(res.xhNum)-Number(res.refundNum)}}{{res.xhUnitName}}</span>
 								</div>
 							</div>
 						</div>
@@ -100,9 +91,11 @@ export default {
 			product:[],
 			refundMoney:0,
 			refundType:1,
+			cause:0,
 			remark:'',
 			orderInfo:{},
-			couldRefundPrice:0
+			couldRefundPrice:0,
+			unClear:[]
 		}
 	},
 	computed: {
@@ -111,13 +104,19 @@ export default {
 			if(this.product){
 				for (const item of this.product) {
 					if(Number(item.refundCount)>0){
-						let currentPrice = Number(item.refundCount)*Number(item.bigPrice)
+						let currentPrice = Number(item.refundCount)*Number(item.xhUnitPrice)
 						currentPrice.toFixed(2)
 						price = Number(price) + Number(currentPrice)
 						price.toFixed(2)
 					}
 				}
 			}
+			if(Number(this.orderInfo.refundSendCostAmount)>0){
+				price = Number(this.orderInfo.refundSendCostAmount) + Number(price)
+			}
+			if(Number(this.orderInfo.refundPackCostAmount)>0){
+				price = Number(this.orderInfo.refundPackCostAmount) + Number(price)
+			}
 			price = parseFloat(price.toFixed(2))
 			this.refundMoney = price
 			return price
@@ -125,79 +124,27 @@ export default {
 	},
 	methods: {
 		confirmRefund(){
-			let hasError = false
-			let product = []
-			let that = this
-			let sendData = null
-			this.product.forEach(ele=>{
-				let currentRefundCont = ele.refundCount ? Number(ele.refundCount) :0
-				let currentNum = ele.itemNum ? Number(ele.itemNum) : 0
-				let hasRefundNum = ele.refundNum ? Number(ele.refundNum) : 0
-				let couldRefundNum = Number(currentNum) - Number(hasRefundNum)
-				if(Number(currentRefundCont) > Number(couldRefundNum)){
-					uni.showToast({title:ele.name+'超过可退数量',icon:'none'})
-					hasError = true;
-					return false
-				}
-				//货位的售后和下架
-				sendData = []
-				if(!this.$util.isEmpty(ele.sendList)){
-					ele.sendList.forEach(sendele=>{
-						if(sendele.currentRefundNum && parseFloat(sendele.currentRefundNum)>0){
-							sendData.push({id:sendele.id,refundNum:sendele.currentRefundNum})
-						}
-					})
-				}
-				if(Number(ele.refundCount)>0){
-					product.push({
-						productId:ele.productId,
-						num:ele.refundCount,
-						unitType:0,
-						unitName:ele.bigUnit,
-						unitPrice:ele.bigPrice,
-						sendRefund:sendData
-					})
-				}
-			})
-			if(hasError){
-				return
-			}
-			if(this.$util.isEmpty(product)&&this.refundType==1){
-				uni.showToast({title:'请选择花材',icon:'none'})
-				return;
-			}
-			let refundParams = {
-				id:this.orderInfo.id,
-				product:JSON.stringify(product),
-				price:this.refundMoney,
-				remark:this.remark,
-				refundType:this.refundType
-			};
-			this.$service.cgRefund.createOrder(refundParams).then(data => {
-				this.$message.success('操作成功')
-				this.closeOpen()
-			})
 		},
 		init() {
-
-			this.product = []
-			this.refundMoney = 0
-			this.refundType = 1
-			this.remark = '',
-			this.orderInfo = {}
-			this.couldRefundPrice = 0
-
 			this.showDtail = true
-			this.$service.purchaseOrder.detail({orderSn:this.currentRefundData.orderSn}).then(data => {
-				this.orderInfo = data
+			this.$service.order.detail({id:this.currentRefundData.id,getOriginalItem:1}).then(data => {
+				this.orderInfo = {...data,refundPackCostAmount:'',refundSendCostAmount:''}
 
 				this.couldRefundPrice = Number(data.orderPrice) - Number(data.tkPrice)
+
 				this.couldRefundPrice = this.couldRefundPrice.toFixed(2)
 				this.couldRefundPrice = parseFloat(this.couldRefundPrice)
 
-				this.product = data.itemInfo.map(ele=>{
+				this.product = data.product.map(ele=>{
 					return {...ele,refundCount:null}
 				})
+
+				let customId = data.customId ? data.customId : 0
+				if(Number(customId)>0){
+					getUnClear({customId:customId}).then(result=>{
+						this.unClear = result.info
+					})
+				}
 			})
 		},
 		closeOpen() {