【优化】优化售后模式及业务方式。

This commit is contained in:
jianweie code
2024-03-31 01:35:07 +08:00
parent 9d166633b6
commit 2b970bce3c
6 changed files with 489 additions and 372 deletions

View File

@@ -950,8 +950,17 @@ namespace CoreCms.Net.Services
if (item.status == (int)GlobalEnumVars.BillAftersalesStatus.WaitAudit) break;
}
}
//如果存在未处理的售后,就不能再次发起售后
if (order.aftersalesItem.Any() && order.aftersalesItem.Exists(p => p.status == (int)GlobalEnumVars.BillAftersalesStatus.WaitAudit))
{
order.addAftersalesStatus = false;
}
else
{
//把退款金额和退货商品查出来判断是否能进行售后
AfterSalesVal(order, aftersaleLevel);
}
//促销信息
if (!string.IsNullOrEmpty(order.promotionList))
{

View File

@@ -39,7 +39,20 @@
.goods-salesvolume { min-width: 50px; height: 15px; font-size: 12px; color: #999; display: inline-block; }
.list-box{
background-color: #fff;
margin-bottom: 5rpx;
}
.goods-flex{
display: flex;
align-items: center;
font-size: 12px;
color: #999;
background: #fff;
padding-left: 133px;
padding-bottom: 5px;
}
uni-checkbox.checkboxNo .uni-checkbox-input { background-color: #e1e1e1 !important; border-color: #e1e1e1 !important; }
.icon { width: 25px; height: 25px; /* #ifdef MP-ALIPAY */ background-size: 100% 100%; /* #endif */ }
.coreshop-tabbar-height { margin-top: 0px; }

View File

@@ -11,82 +11,29 @@
</view>
</u-navbar>
<view class="content">
<view class="coreshop-margin-10" v-if="showAlert">
<u-alert :title="alertTitle" type="warning" effect="dark" :closable="alertClosable" :description="alertDescription"></u-alert>
</view>
<view class="coreshop-solid-bottom coreshop-bg-white coreshop-font-lg coreshop-padding-15">
<uni-text class="coreshop-text-black">
<span>请选择退货商品和数量</span>
</uni-text>
<view class="coreshop-margin-5">
<u-alert type="warning" effect="dark" :description="alertDescription"></u-alert>
</view>
<form @submit="submit">
<view class="coreshop-tabbar-height">
<view class="img-list">
<checkbox-group class="cart-checkbox" @change="checkboxChange">
<view class="cart-checkbox-item" v-for="(item, key) in items" :key="key">
<label class="uni-list-cell uni-list-cell-pd">
<view class="cart-checkbox-c">
<checkbox :value='item.id' :checked="item.checked" color="#FF7159" v-if="item.disabled" :disabled="item.disabled" class="checkboxNo" />
<checkbox :value='item.id' :checked="item.checked" color="#FF7159" v-else />
</view>
<view class="img-list-item coreshop-flex coreshop-justify-between">
<u-avatar :src="item.imageUrl" mode="square" size="75" class="img-list-item-l"></u-avatar>
<view class="img-list-item-r">
<view class="list-goods-name">
{{item.name}}
</view>
<view class="goods-item-c coreshop-margin-top-10 coreshop-margin-bottom-10" v-if="item.addon">
<view class="goods-buy">
<!-- 商品规格 -->
<view class="goods-salesvolume coreshop-margin-right-10 ">
{{item.addon}}
</view>
</view>
</view>
<view class="goods-item-c">
<view class="goods-buy">
<!-- 商品规格 -->
<view class="goods-salesvolume coreshop-margin-right-10">
购买数{{item.nums}}
</view>
<view class="goods-salesvolume coreshop-margin-right-10">
发货数量{{item.sendNums}}
</view>
<view class="goods-salesvolume coreshop-margin-right-10" v-show="item.reshipNums!=0">
已退数量{{item.reshipNums}}
</view>
<view class="goods-salesvolume coreshop-margin-top-10 coreshop-margin-bottom-10" v-if="!item.disabled">
<label>您要退货数量</label>
<input type="number" v-model="item.sendNums - item.reshipNums" @focus="onFocus(item,key)" @blur="updateNum(item,key)" class="inputStyle" ref="input" @click.stop />
</view>
</view>
</view>
</view>
</view>
</label>
</view>
</checkbox-group>
</view>
<view class='coreshop-cell-group coreshop-margin-top-10 coreshop-margin-bottom-10'>
<view class='coreshop-cell-item'>
<view class='coreshop-cell-item-hd'>
<view class='coreshop-cell-hd-title'>是否收货</view>
<view class='coreshop-cell-hd-title'>售后模式</view>
</view>
<view class='coreshop-cell-item-ft'>
<view class="uni-form-item uni-column invoice-type">
<!-- #ifndef MP-ALIPAY -->
<radio-group class="uni-list" @change="radioChange">
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in typeList" :key="index">
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in typeList"
:key="index">
<view class="invoice-type-icon">
<radio class="a-radio radioNo" v-if="item.disabled" :id="item.name" :value="item.value" :checked="item.checked"
:disabled="item.disabled"></radio>
<radio class="a-radio radioNo" v-if="item.disabled" :id="item.name" :value="item.value" :checked="item.checked" :disabled="item.disabled"></radio>
<radio class="a-radio " v-else :id="item.name" :value="item.value" :checked="item.checked" :disabled="item.disabled"></radio>
</view>
<view class="invoice-type-c">
<label :for="item.name">
<text>{{item.name}}</text>
<text>{{ item.name }}</text>
</label>
</view>
</label>
@@ -94,13 +41,14 @@
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<radio-group class="uni-list" @change="radioChange">
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in typeListByAli" :key="index">
<label class="uni-list-cell uni-list-cell-pd"
v-for="(item, index) in typeListByAli" :key="index">
<view class="invoice-type-icon">
<radio class="a-radio" :id="item.name" :value="item.value" :checked="item.checked" :disabled="item.disabled"></radio>
</view>
<view class="invoice-type-c">
<label class="label-2-text" :for="item.name">
<text>{{item.name}}</text>
<text>{{ item.name }}</text>
</label>
</view>
</label>
@@ -109,6 +57,69 @@
</view>
</view>
</view>
</view>
<view class="img-list">
<view class="list-box" v-for="(item, key) in items" :key="key">
<checkbox-group class="cart-checkbox" @change="checkboxChange" :data-idx="key"
:data-itemid="item.id">
<view class="cart-checkbox-item">
<label class="uni-list-cell uni-list-cell-pd">
<view class="cart-checkbox-c">
<checkbox :value='item.id' :checked="item.checked" color="#FF7159"
v-if="item.disabled" :disabled="item.disabled" class="checkboxNo" />
<checkbox :value='item.id' :checked="item.checked" color="#FF7159" v-else />
</view>
<view class="img-list-item coreshop-flex coreshop-justify-between">
<u-avatar :src="item.imageUrl" mode="square" size="75"
class="img-list-item-l"></u-avatar>
<view class="img-list-item-r">
<view class="list-goods-name">
{{ item.name }}
</view>
<view
class="goods-item-c coreshop-margin-top-5 coreshop-margin-bottom-5"
v-if="item.addon">
<view class="goods-buy">
<!-- 商品规格 -->
<view class="goods-salesvolume coreshop-margin-right-10 ">
{{ item.addon }}
</view>
</view>
</view>
<view class="goods-item-c">
<view class="goods-buy">
<!-- 商品规格 -->
<view class="goods-salesvolume coreshop-margin-right-10">
购买数{{ item.nums }}
</view>
<view class="goods-salesvolume coreshop-margin-right-10">
发货数量{{ item.sendNums }}
</view>
<view class="goods-salesvolume coreshop-margin-right-10"
v-show="item.reshipNums != 0">
已退数量{{ item.reshipNums }}
</view>
<!-- <view
class="goods-salesvolume coreshop-margin-top-15 coreshop-margin-bottom-10"
v-if="!item.disabled">
<label>您要退货数量</label>
<input type="number" v-model="item.returnNums" @focus="onFocus(item,key)" @blur="updateNum(item,key)" class="inputStyle" ref="input" @click.stop />
</view> -->
</view>
</view>
</view>
</view>
</label>
</view>
</checkbox-group>
<view class="goods-flex" v-if="item.sendNums > 0">
<label>您要退货数量</label>
<u-number-box :button-size="25" :integer="true" v-model="item.returnNums" :disabledInput="true" :min="item.min" :max="item.max" @change="hanlderChangeReturnNums($event,key)"></u-number-box>
</view>
</view>
</view>
<view class='coreshop-cell-group coreshop-margin-top-10 coreshop-margin-bottom-10'>
<view class='coreshop-cell-item refund-price'>
<view class='coreshop-cell-item-hd'>
<view class='coreshop-cell-hd-title'>退款金额</view>
@@ -116,10 +127,9 @@
<view class='coreshop-cell-item-ft'>
<input type="digit" class='coreshop-cell-bd-input coreshop-text-red' v-model="refund" @focus="refundFocus" ref="refund"></input>
</view>
</view>
<view class=" coreshop-font-12 refund-tip">
可修改最多{{maxRefund}}含发货邮费{{costFreight}}
可修改最多{{ maxRefund }}含发货邮费{{ costFreight }}
</view>
</view>
<view class='coreshop-cell-group coreshop-margin-top-10 coreshop-margin-bottom-10'>
@@ -127,12 +137,15 @@
<view class='coreshop-cell-item-hd'>
<view class='coreshop-cell-hd-title'>上传凭证</view>
</view>
<view class='coreshop-cell-item-ft coreshop-margin-right-10'>{{images.length}}/{{imageMax}}</view>
<view class='coreshop-cell-item-ft coreshop-margin-right-10'>{{ images.length }}/{{ imageMax
}}
</view>
</view>
<view class="">
<view class="evaluate-c-b">
<view class="goods-img-item" v-for="(item, key) in images" :key="key">
<image class="del" src="/static/images/common/del.png" mode="" @click="delImage(item)"></image>
<image class="del" src="/static/images/common/del.png" mode=""
@click="delImage(item)"></image>
<image class="" :src="item" mode="" @click="clickImg(item)"></image>
</view>
<view class="upload-img" v-show="isImage" @click="upImage">
@@ -163,12 +176,12 @@
</template>
<script>
export default {
export default {
data() {
return {
typeList: [
{ value: '1', name: '未收到货', checked: true, disabled: false },
{ value: '2', name: '已收到货', checked: false, disabled: false },
{ value: '1', name: '仅退款', checked: true, disabled: false },
{ value: '2', name: '退货退款', checked: false, disabled: false },
],
typeListByAli: [
{ value: '1', name: '仅退款', checked: true, disabled: false },
@@ -190,23 +203,20 @@
checkedItems: [],//当前选中的商品
isFlag: true,
costFreight: 0,//运费
showAlert: false,
alertTitle: '提醒',
alertDescription: '',
alertClosable: true
alertDescription: '如果订单未发货,只需要勾选需要退款的产品即可,如果已经发货,可以设置需要退货的产品数量。',
}
},
computed: {
isImage() {
let num = this.imageMax - this.images.length;
if (num > 0) {
return true;
} else {
return false;
}
return num > 0;
},
},
methods: {
hanlderChangeReturnNums(e, index) {
this.items[index].returnNums = e.value;
this.getReturnData();
},
// 单选框点击切换
radioChange: function (evt) {
this.typeList.forEach(item => {
@@ -234,37 +244,40 @@
if (res.data.globalStatus != 1 && res.data.globalStatus != 6 && res.data.globalStatus != 7) {
//判断是已付款未发货,如果是,就禁用退货
let typeList = this.typeList;
if (res.data.globalStatus == 2) {
if (res.data.shipStatus != 2 && res.data.shipStatus != 3) {
typeList[1].disabled = true;
}
//设置已选中的商品
let nums = 0;
let returnNums = {}
let returnStatus
for (var i = 0; i < res.data.items.length; i++) {
if (res.data.items[i].nums >= res.data.items[i].reshipNums) {
returnNums = res.data.items[i].nums - res.data.items[i].reshipNums;
}
if (returnNums > 0) {
returnStatus = true
}
res.data.items[i].id = res.data.items[i].id.toString();
//this.itemIds = this.itemIds.concat({ id: res.data.items[i].id, nums: returnNums });
res.data.items[i].returnNums = returnNums
res.data.items[i].returnStatus = returnStatus
res.data.items[i].returnNums = 0
res.data.items[i].checked = false;
if (res.data.items[i].returnNums > 0) {
if ((res.data.items[i].nums - res.data.items[i].reshipNums) > 0) {
res.data.items[i].disabled = false;
} else {
res.data.items[i].disabled = true;
}
res.data.items[i].min = 0;
if (res.data.shipStatus == 1) { // 未发货
res.data.items[i].max = res.data.items[i].nums;
} else if (res.data.shipStatus == 2) { // 部分发货
//res.data.items[i].max = res.data.items[i].nums - res.data.items[i].sendNums - res.data.items[i].reshipNums;
res.data.items[i].max = res.data.items[i].sendNums - res.data.items[i].reshipNums;
} else { // 已发货 部分退货 已退货
res.data.items[i].max = res.data.items[i].sendNums - res.data.items[i].reshipNums;
}
}
this.items = res.data.items;
console.log(this.items);
this.refund = this.$common.formatMoney((res.data.orderAmount - res.data.refunded), 2, '');
// this.refund = this.$common.formatMoney((res.data.orderAmount - res.data.refunded), 2, '');
this.maxRefund = this.$common.formatMoney((res.data.orderAmount - res.data.refunded), 2, '');
this.costFreight = res.data.costFreight;//运费
this.refundShow = res.data.payedAmount - res.data.refunded;
@@ -280,24 +293,32 @@
//退货商品选择
checkboxChange(e) {
let nums = 0;
let id = 0;
this.itemIds = [];
for (var i = 0; i < e.detail.value.length; i++) {
let k = e.detail.value[i];
for (var j = 0; j < this.items.length; j++) {
if (this.items[j].id == k) {
if (this.items[j].nums > this.items[j].reshipNums) {
// nums = this.items[j].sendnums - this.items[j].reshipNums;
//nums = this.$refs.input[i].value
nums = this.items[j].returnNums;
id = parseInt(k);
this.itemIds = this.itemIds.concat({ id: id, nums: nums });
console.log(this.itemIds)
}
}
}
//let nums = 0;
//let id = 0;
//this.itemIds = [];
//for (var i = 0; i < e.detail.value.length; i++) {
// let k = e.detail.value[i];
// for (var j = 0; j < this.items.length; j++) {
// if (this.items[j].id == k) {
// if (this.items[j].nums > this.items[j].reshipNums) {
// // nums = this.items[j].sendnums - this.items[j].reshipNums;
// //nums = this.$refs.input[i].value
// nums = this.items[j].returnNums;
// id = parseInt(k);
// this.itemIds = this.itemIds.concat({ id: id, nums: nums });
// console.log(this.itemIds)
// }
// }
// }
//}
let id = e.target.dataset.itemid
let idx = this.checkedItems.findIndex(item => item == id)
if (idx >= 0) {
this.checkedItems.splice(idx, 1)
} else {
this.checkedItems.push(id);
}
this.getReturnData();
},
@@ -310,7 +331,6 @@
this.items[key].checked = true;
this.getReturnData();
console.log(this.checkedItems);
},
//处理退款金额光标事件
refundFocus(e) {
@@ -337,31 +357,103 @@
//计算要退货的商品数量
getReturnData() {
let nums = 0;
//this.itemIds = [];
for (var i = 0; i < this.checkedItems.length; i++) {
let k = this.checkedItems[i];
for (var j = 0; j < this.items.length; j++) {
if (this.items[j].id == k) {
if (this.items[j].nums >= this.items[j].reshipNums) {
nums = this.items[j].nums - this.items[j].reshipNums;
if (nums >= this.items[j].returnNums) {
nums = this.items[j].returnNums
//this.itemIds = this.itemIds.concat({ id: k, nums: nums });
this.itemIds.forEach((item, index, arr) => {
if (item.id == k) {
item.nums = nums;
}
// console.log(index + ":" + item)
})
//let nums = 0;
////this.itemIds = [];
//for (var i = 0; i < this.checkedItems.length; i++) {
// let k = this.checkedItems[i];
// for (var j = 0; j < this.items.length; j++) {
// if (this.items[j].id == k) {
// if (this.items[j].nums >= this.items[j].reshipNums) {
// nums = this.items[j].nums - this.items[j].reshipNums;
// if (nums >= this.items[j].returnNums) {
// nums = this.items[j].returnNums
// //this.itemIds = this.itemIds.concat({ id: k, nums: nums });
// this.itemIds.forEach((item, index, arr) => {
// if (item.id == k) {
// item.nums = nums;
// }
// // console.log(index + ":" + item)
// })
// } else {
// this.$u.toast("您填写的数量不对!")
// return;
// }
// }
// }
// }
//}
this.itemIds = [];
let total_refund = 0;//最退款金额
let checkNums = 0;
this.checkedItems.forEach((item) => {
let data = this.items.find((itemChid) => itemChid.id == item);
if (Object.keys(data).length) {
let returnNums = 0;
if (data.sendNums > 0) { // 如果是仅退款,退款数量应为购买数量
returnNums = data.returnNums;
} else {
this.$u.toast("您填写的数量不对!")
return;
}
returnNums = data.nums;
}
checkNums += returnNums;
this.itemIds.push({
id: data.id,
nums: returnNums,
sendNums:data.sendNums,
});
if (returnNums == (data.nums - data.reshipNums)) {
total_refund += (data.amount * 100 - data.reshipNums * data.price * 100) / 100;
} else {
total_refund += (data.price * returnNums * 100) / 100;
}
}
})
// for (var i = 0; i < this.checkedItems.length; i++) {
// let k = this.checkedItems[i];
// for (var j = 0; j < this.items.length; j++) {
// if (this.items[j].id == k) {
// if (this.items[j].nums >= this.items[j].reshipNums) {
// nums = this.items[j].nums - this.items[j].reshipNums;
// if (nums >= this.items[j].returnNums) {
// nums = this.items[j].returnNums
// checkNums += nums
// this.item_ids = this.item_ids.concat({ id: k, nums: nums });
// console.log('nums', nums, this.items[j], nums, (this.items[j].nums - this.items[j].reshipNums));
// if (nums == (this.items[j].nums - this.items[j].reshipNums)) {
// total_refund += (this.items[j].amount * 100 - this.items[j].reshipNums * this.items[j].price * 100) / 100;
// } else {
// total_refund += (this.items[j].price * nums * 100) / 100;
// }
// } else {
// this.$common.errorToShow("您填写的数量不对!")
// return;
// }
// }
// }
// }
// }
if (checkNums + this.reshipNumsAll == this.buyNums) {
if (this.reSult.costfreightstatus == 1) {
this.refund = total_refund.toFixed(2);
} else {
this.refund = (Number(total_refund) + Number(this.costfreight)).toFixed(2);
}
} else {
this.refund = total_refund.toFixed(2);
}
},
//提交
@@ -392,6 +484,11 @@
this.submitStatus = false;
return false;
}
_that.itemIds.forEach((item) => {
if (item.sendNums == 0) {
item.nums = 0
}
})
//组装数据,提交数据
let data = {
orderId: _that.orderId,
@@ -410,9 +507,7 @@
}
})
} else {
_that.showAlert = true;
_that.alertDescription = res.msg;
//_that.$u.toast(res.msg);
_that.$u.toast(res.msg);
}
});
},
@@ -454,9 +549,9 @@
this.getOrderInfo();
this.getReturnData()
}
}
}
</script>
<style lang="scss" scoped>
@import "submit.scss";
@import "submit.scss";
</style>

View File

@@ -21,7 +21,7 @@
<div class="layui-form-item">
<label class="layui-form-label">售后类型</label>
<div class="layui-input-inline layui-inline-3 layui-form-mid">
{{ d.params.data.type === 1 ? '未收到货':'已收到货' }}
{{ d.params.data.type === 1 ? '仅退款':'退款退货' }}
</div>
<label class="layui-form-label">状态</label>
<div class="layui-input-inline layui-inline-3 layui-form-mid">

View File

@@ -63,10 +63,10 @@
<div class="layui-form-mid">订单支付金额{{ d.params.data.order.payedAmount }},已退款金额{{ d.params.data.order.refunded }}</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">收货与否</label>
<label class="layui-form-label">售后类型</label>
<div class="layui-input-inline layui-inline-8">
<input name="type" value="1" title="未收到货" {{ d.params.data.type==1?'checked':'' }} type="radio">
<input name="type" value="2" title="已收到货" {{ d.params.data.type==2?'checked':'' }} type="radio">
<input name="type" value="1" title="仅退款" {{ d.params.data.type==1?'checked':'' }} type="radio">
<input name="type" value="2" title="退款退货" {{ d.params.data.type==2?'checked':'' }} type="radio">
</div>
</div>
<div class="layui-form-item">
@@ -86,7 +86,7 @@
<div class="layui-form-item">
<label class="layui-form-label">说明</label>
<div class="layui-input-block">
1. 选择未收到货是退未发货的商品选择已收到是退已发货的商品选择未收到货不会生成退货单选择已收到会生成退货单<span style="color:red;">未发货的商品和已发货的商品不能混合着退</span>。<br />
1. 选择仅退款是退未发货的商品选择退款退是退已发货的商品选择仅退款不会生成退货单选择退款退会生成退货单<span style="color:red;">未发货的商品和已发货的商品不能混合着退</span>。<br />
2. "售后数量"里的数字包含已提交的售后和审核通过的售后的商品数量后面如果有括号表示已发货的商品的退货数量
</div>
</div>

View File

@@ -34,9 +34,9 @@
<div class="layui-inline">
<div class="layui-input-inline">
<select name="type" lay-verify="">
<option value="">请选择商品状态</option>
<option value="1">未收到货</option>
<option value="2">已收到</option>
<option value="">请选择售后类型</option>
<option value="1">仅退款</option>
<option value="2">退款退</option>
</select>
</div>
</div>
@@ -128,11 +128,11 @@
{ field: 'aftersalesId', title: '售后单号', sort: false, width: 150 },
{ field: 'orderId', title: '订单号', sort: false, width: 150 },
{
field: 'type', title: '商品状态', sort: false, width: 105, templet: function (d) {
field: 'type', title: '售后类型', sort: false, width: 105, templet: function (d) {
if (d.type === 1) {
return "未收到货";
return "仅退款";
} else {
return "已收到货";
return "退款退货";
}
}
},