|
@@ -60,7 +60,7 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="operate-button-container" v-if="item.status>1">
|
|
|
- <el-button size="mini" @click="refund()" v-hasPermi="['his:storeOrder:afterSales']">申请退款</el-button>
|
|
|
+ <el-button size="mini" @click="chooseRefund()" v-hasPermi="['his:storeOrder:afterSales']">申请退款</el-button>
|
|
|
</div>
|
|
|
<div class="operate-button-container" v-if="item.prescribeId!=null&&item.prescribeId!=''" >
|
|
|
<el-button size="mini" @click="getPrescribeOrder()" >处方单</el-button>
|
|
@@ -125,7 +125,7 @@
|
|
|
<el-tooltip class="item" effect="dark" :content="showList ? '显示全部' : '隐藏'" placement="top" style="float: right;">
|
|
|
<el-button size="mini" circle icon="el-icon-search" @click="showListD()" />
|
|
|
</el-tooltip>
|
|
|
- <el-table border v-if="showProd!=null" :data="showProd" size="small" style="width: 100%;margin-top: 20px" >
|
|
|
+ <el-table border v-if="showProd!=null" :data="showProd" size="small" style="width: 100%;margin-top: 20px" >
|
|
|
<el-table-column label="商品图片" width="150" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<img :src="JSON.parse(scope.row.jsonInfo).image" style="height: 80px">
|
|
@@ -355,7 +355,7 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="物流代收金额">
|
|
|
- <el-input-number v-model="payRemain" :precision="2" :step="0.1"/>
|
|
|
+ <el-input-number v-model="payRemain" :precision="2" :step="0.1" :disabled="isUpdatePayRemain==0"/>
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="应付金额">
|
|
@@ -438,6 +438,71 @@
|
|
|
<prescribeDetails ref="prescribeDetails" />
|
|
|
</el-drawer>
|
|
|
|
|
|
+ <el-dialog
|
|
|
+ :title="refundDialog.title"
|
|
|
+ :visible.sync="refundDialog.open"
|
|
|
+ width="50%"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <el-table border v-if="refundShowProd!=null" :data="refundShowProd" ref="refundTable" size="small" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+
|
|
|
+ <el-table-column label="商品编码" width="110" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <p>{{ JSON.parse(scope.row.jsonInfo).barCode }}</p>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="商品名称" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <p>{{ JSON.parse(scope.row.jsonInfo).productName }}</p>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="原单价" width="100" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <p>¥{{JSON.parse(scope.row.jsonInfo).price.toFixed(2)}}</p>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="退款单价" width="200" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number
|
|
|
+ v-model="scope.row.money"
|
|
|
+ :precision="2"
|
|
|
+ :step="0.1"
|
|
|
+ :min="0"
|
|
|
+ :max="scope.row.price"
|
|
|
+ size="mini"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="退款数量" width="200" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number
|
|
|
+ v-model="scope.row.num"
|
|
|
+ :min="0"
|
|
|
+ :max="scope.row.originNum"
|
|
|
+ size="mini"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <div style="margin-top:10px;">
|
|
|
+ 合计退款金额:
|
|
|
+ <span style="color:red; font-weight:bold;">
|
|
|
+ ¥{{ refundForm.refundAmount ? refundForm.refundAmount.toFixed(2) : '0.00' }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitRefundForm">确 定</el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -458,6 +523,17 @@ import {getCitys} from "@/api/store/city";
|
|
|
components: { inquiryOrderDetails,packageOrderDetails,prescribeDetails ,msgDetails},
|
|
|
data() {
|
|
|
return {
|
|
|
+ isUpdateRefund:0, //是否支持修改退款金额 默认0不支持
|
|
|
+ isUpdatePayRemain:0, //是否支持修改物流代收金额 默认0不支持
|
|
|
+ refundShowProd:[],//原退款明细
|
|
|
+ refundForm:{
|
|
|
+ refundAmount:0
|
|
|
+ },
|
|
|
+ selectedRows:[],
|
|
|
+ refundDialog:{
|
|
|
+ title:"申请退款",
|
|
|
+ open:false,
|
|
|
+ },
|
|
|
payRemain: 0, // 物流代收金额,可改
|
|
|
payMoney: 0, // 实收金额,固定
|
|
|
expressDialog:{
|
|
@@ -468,7 +544,7 @@ import {getCitys} from "@/api/store/city";
|
|
|
title:"修改物流单号",
|
|
|
open:false,
|
|
|
},
|
|
|
- sourceOptions:[],
|
|
|
+ sourceOptions:[],
|
|
|
prescribeDialog:{
|
|
|
title:"处方单",
|
|
|
open:false,
|
|
@@ -640,6 +716,16 @@ import {getCitys} from "@/api/store/city";
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ updateRefund(row) {
|
|
|
+ // 默认退款金额 = 数量 × 单价
|
|
|
+ row.refundAmount = (row.num * row.money).toFixed(2);
|
|
|
+ },
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.refundForm.refundAmount = val
|
|
|
+ .reduce((sum, row) => sum + row.num * row.money, 0)
|
|
|
+ ;
|
|
|
+ this.selectedRows = val;
|
|
|
+ },
|
|
|
getCitys() {
|
|
|
return getCitys().then(res => {
|
|
|
this.citys = res.data || [];
|
|
@@ -956,7 +1042,71 @@ import {getCitys} from "@/api/store/city";
|
|
|
moneyCancel(){
|
|
|
this.money=null;
|
|
|
this.moneyVisible=false;
|
|
|
- },
|
|
|
+ },
|
|
|
+ chooseRefund(){
|
|
|
+ if(this.isUpdateRefund == 1){
|
|
|
+ this.refundShowProd = this.showProd.map(item => {
|
|
|
+ const info = JSON.parse(item.jsonInfo);
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ originNum: item.num, // 原始购买数量
|
|
|
+ num: item.num, // 可编辑的退款数量
|
|
|
+ price: info.price,
|
|
|
+ money: 0.00,
|
|
|
+ // refundAmount: (item.num * info.price).toFixed(2),
|
|
|
+ refundAmount: 0,
|
|
|
+ jsonInfo: item.jsonInfo
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.refundForm.refundAmount = 0
|
|
|
+ this.refundDialog.open = true
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // // 默认全选表格
|
|
|
+ // this.$refs.refundTable.toggleAllSelection();
|
|
|
+ // });
|
|
|
+ this.$alert('请先设置退款单价和退款数量,再选择商品', '提示');
|
|
|
+ } else {
|
|
|
+ this.refund(); //正常退款
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ submitRefundForm(){
|
|
|
+ if(this.refundForm.refundAmount<=0){
|
|
|
+ return this.$message("退款金额不能为0");
|
|
|
+ }
|
|
|
+ if(this.refundForm.refundAmount>this.item.payMoney){
|
|
|
+ return this.$message("退款金额不能大于实付金额" + this.item.payMoney + "元");
|
|
|
+ }
|
|
|
+ if(this.selectedRows.length==0){
|
|
|
+ return this.$message("请选择退款商品");
|
|
|
+ }
|
|
|
+ const refundList = this.selectedRows.map(row => ({
|
|
|
+ itemId: row.itemId,
|
|
|
+ num: row.num,
|
|
|
+ money:row.money
|
|
|
+ }))
|
|
|
+ const param = {
|
|
|
+ orderId:this.item.orderId,
|
|
|
+ refundList:refundList,
|
|
|
+ refundAmount:this.refundForm.refundAmount
|
|
|
+ }
|
|
|
+ console.log("申请退款数据", param);
|
|
|
+ this.$confirm('是否确认申请退款?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(function() {
|
|
|
+ return afterSales(param);
|
|
|
+ }).then(() => {
|
|
|
+ this.msgSuccess("操作成功");
|
|
|
+ getOrder(this.item.orderId).then(response => {
|
|
|
+ this.item = response.data;
|
|
|
+ this.getlogList(this.item.orderId);
|
|
|
+ this.$parent.$parent.getList();
|
|
|
+ this.refundDialog.open = false
|
|
|
+ });
|
|
|
+ }).catch(function() {});
|
|
|
+ },
|
|
|
refund(){
|
|
|
var that=this;
|
|
|
this.$confirm('是否确认申请退款?', "警告", {
|
|
@@ -1086,18 +1236,20 @@ import {getCitys} from "@/api/store/city";
|
|
|
this.storeName=storeName;
|
|
|
this.item=null;
|
|
|
this.tuiMoneyLogs=null;
|
|
|
- getOrder(orderId).then(response => {
|
|
|
- this.item = response.data;
|
|
|
- this.tuiMoneyLogs = response.tuiMoneyLogs;
|
|
|
- this.getlistOrderitem(orderId);
|
|
|
- this.getlogList(orderId);
|
|
|
- this.getPayment(orderId);
|
|
|
- this.msgForm.userId=response.data.userId;
|
|
|
- this.msgForm.followDoctorId=response.data.followDoctorId;
|
|
|
- if(this.item.orderType==2){
|
|
|
- this.getCount(this.item.prescribeId);
|
|
|
- }
|
|
|
- });
|
|
|
+ getOrder(orderId).then(response => {
|
|
|
+ this.item = response.data;
|
|
|
+ this.tuiMoneyLogs = response.tuiMoneyLogs;
|
|
|
+ this.getlistOrderitem(orderId);
|
|
|
+ this.getlogList(orderId);
|
|
|
+ this.getPayment(orderId);
|
|
|
+ this.msgForm.userId=response.data.userId;
|
|
|
+ this.msgForm.followDoctorId=response.data.followDoctorId;
|
|
|
+ if(this.item.orderType==2){
|
|
|
+ this.getCount(this.item.prescribeId);
|
|
|
+ }
|
|
|
+ this.isUpdateRefund = response.isUpdateRefund;
|
|
|
+ this.isUpdatePayRemain = response.isUpdatePayRemain
|
|
|
+ });
|
|
|
},
|
|
|
getCount(id){
|
|
|
getPrescribe(id).then(response => {
|