|
|
@@ -17,13 +17,30 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<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>
|
|
|
</template>
|
|
|
@@ -38,13 +55,30 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<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>
|
|
|
</template>
|
|
|
@@ -80,7 +114,7 @@
|
|
|
v-model="refundMoney"
|
|
|
placeholder="请输入退款金额"
|
|
|
placeholder-style="color:#999"
|
|
|
- @focus="refundMoney=''">
|
|
|
+ @focus="clearRefundMoney">
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -117,7 +151,8 @@
|
|
|
class="remark-textarea"
|
|
|
v-model="remark"
|
|
|
placeholder="选填"
|
|
|
- placeholder-style="color:#999" />
|
|
|
+ placeholder-style="color:#999"
|
|
|
+ @focus="clearRemark" />
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -147,7 +182,7 @@ export default {
|
|
|
goodsInfoList:[],
|
|
|
itemInfoList:[],
|
|
|
refundMoney:0,
|
|
|
- refundType:1,
|
|
|
+ refundType:0,
|
|
|
remark:'',
|
|
|
orderInfo:{},
|
|
|
coundRefundPrice:0
|
|
|
@@ -160,7 +195,7 @@ export default {
|
|
|
if(!this.$util.isEmpty(this.goodsInfoList)){
|
|
|
for (const item of this.goodsInfoList) {
|
|
|
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)
|
|
|
price = Number(price) + Number(currentPrice)
|
|
|
price.toFixed(2)
|
|
|
@@ -171,7 +206,7 @@ export default {
|
|
|
if(!this.$util.isEmpty(this.itemInfoList)){
|
|
|
for (const item of this.itemInfoList) {
|
|
|
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)
|
|
|
price = Number(price) + Number(currentPrice)
|
|
|
price.toFixed(2)
|
|
|
@@ -185,6 +220,18 @@ export default {
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ clearRefundCount(item) {
|
|
|
+ this.$set(item, 'refundCount', '');
|
|
|
+ },
|
|
|
+ clearPerPrice(item) {
|
|
|
+ this.$set(item, 'perPrice', '');
|
|
|
+ },
|
|
|
+ clearRefundMoney() {
|
|
|
+ this.refundMoney = '';
|
|
|
+ },
|
|
|
+ clearRemark() {
|
|
|
+ this.remark = '';
|
|
|
+ },
|
|
|
cancelRefund(){
|
|
|
uni.navigateBack({delta: 1});
|
|
|
},
|
|
|
@@ -206,7 +253,12 @@ export default {
|
|
|
return false
|
|
|
}
|
|
|
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
|
|
|
}
|
|
|
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){
|
|
|
return
|
|
|
}
|
|
|
- if(this.$util.isEmpty(selectProduct)&&this.refundType==1){
|
|
|
+ if(this.$util.isEmpty(selectProduct)){
|
|
|
uni.showToast({title:'请选择商品',icon:'none'})
|
|
|
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}
|
|
|
that.$util.confirmModal({content:'确认退款?'},() => {
|
|
|
uni.showLoading({mask:true})
|
|
|
@@ -255,10 +316,10 @@ export default {
|
|
|
this.coundRefundPrice = parseFloat(this.coundRefundPrice)
|
|
|
|
|
|
this.goodsInfoList = res.data.goodsInfoList.map(ele=>{
|
|
|
- return {...ele,refundCount:null}
|
|
|
+ return {...ele,refundCount:null,perPrice:''}
|
|
|
})
|
|
|
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 {
|
|
|
margin-top:15upx;
|
|
|
padding: 0 20upx 20upx;
|
|
|
- max-height: 60vh;
|
|
|
- overflow-y: auto;
|
|
|
}
|
|
|
|
|
|
.product-row {
|
|
|
@@ -396,6 +455,24 @@ export default {
|
|
|
align-items: center;
|
|
|
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 {
|
|
|
width: 100upx;
|
|
|
height: 60upx;
|
|
|
@@ -568,6 +645,7 @@ export default {
|
|
|
|
|
|
// 底部操作按钮
|
|
|
.bottom-actions {
|
|
|
+ z-index:9999;
|
|
|
position: fixed;
|
|
|
bottom: 0;
|
|
|
left: 0;
|