Просмотр исходного кода

开始做订单的发起售后

shish 1 год назад
Родитель
Сommit
a564269ad8

+ 333 - 0
ghs/src/views/order/components/begin-refund.vue

@@ -0,0 +1,333 @@
+<template>
+<div>
+	<el-drawer :visible.sync="showDtail" size="750px" custom-class="order-draw-wrap" direction="ltr">
+		<div class="order-manage-wrap" v-if="!$util.isEmpty(orderInfo)">
+			<div>
+				<div>
+					<div class="accounts-list">
+						退款方式
+						<div class="accounts-center">
+							<div v-if="refundType==1">
+								<el-button type="primary" @click="refundType=1">退货并退款</el-button>
+								<el-button  @click="refundType=2" style="margin-left:20px;">仅退款</el-button>
+							</div>
+							<div v-else>
+								<el-button @click="refundType=1">退货并退款</el-button>
+								<el-button type="primary" @click="refundType=2" style="margin-left:20px;">仅退款</el-button>
+							</div>
+						</div>
+					</div>
+				</div>
+				<div>
+					<div class="refund-item-list" v-if="refundType==1">
+						<div class="refund-label">选择花材</div>
+						<div>
+							<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>
+								</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>
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
+				<div class="accounts-list">
+					订单金额
+					<div class="accounts-center">
+						¥{{parseFloat(orderInfo.orderPrice)||0}}
+						<span style="margin-left:15px;font-size:18px;color:green;font-weight:bold;" v-if="Number(orderInfo.tkPrice)>0">已退¥{{orderInfo.tkPrice ? parseFloat(orderInfo.tkPrice) : 0}}</span>
+					</div>
+				</div>
+				<div class="accounts-list">
+					可退金额
+					<div class="accounts-center">¥{{ couldRefundPrice }}</div>
+				</div>
+				<div class="accounts-list">
+					预计退款
+					<div class="accounts-center">¥{{refundPrice}}</div>
+				</div>
+				<div class="accounts-list">
+					实际退款
+					<div class="accounts-center">
+						<el-input v-model="refundMoney" placeholder="输入金额" style="width:120px;"></el-input>
+					</div>
+				</div>
+				<div class="accounts-list">
+					备注内容
+					<div class="accounts-center">
+						<el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="remark"> </el-input>
+					</div>
+				</div>
+			</div>
+			<div style="margin-left:80px;margin-top:20px;">
+				<el-button @click="closeOpen" style="margin-left:120px;">取消</el-button>
+				<el-popconfirm title="确认退款?" @confirm="confirmRefund()" @onConfirm="confirmRefund()" style="margin-left:180px;">
+					<el-button type="primary" slot="reference">确认</el-button>
+				</el-popconfirm>
+			</div>
+		</div>
+	</el-drawer>
+</div>
+</template>
+<script>
+export default {
+	name: 'begin-refund',
+	props: {
+		currentRefundData: {
+			type: Object,
+			default: () => {}
+		}
+	},
+	data() {
+		return {
+			showDtail: false,
+			loading:true,
+			product:[],
+			refundMoney:0,
+			refundType:1,
+			remark:'',
+			orderInfo:{},
+			couldRefundPrice:0
+		}
+	},
+	computed: {
+		refundPrice(){
+			let price = 0
+			if(this.product){
+				for (const item of this.product) {
+					if(Number(item.refundCount)>0){
+						let currentPrice = Number(item.refundCount)*Number(item.bigPrice)
+						currentPrice.toFixed(2)
+						price = Number(price) + Number(currentPrice)
+						price.toFixed(2)
+					}
+				}
+			}
+			price = parseFloat(price.toFixed(2))
+			this.refundMoney = price
+			return price
+		}
+	},
+	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.couldRefundPrice = Number(data.orderPrice) - Number(data.tkPrice)
+				this.couldRefundPrice = this.couldRefundPrice.toFixed(2)
+				this.couldRefundPrice = parseFloat(this.couldRefundPrice)
+
+				this.product = data.itemInfo.map(ele=>{
+					return {...ele,refundCount:null}
+				})
+			})
+		},
+		closeOpen() {
+			this.showDtail = false;
+		}
+	}
+};
+</script>
+<style lang="scss">
+.order-draw-wrap {
+	.el-drawer__header {
+		margin-bottom: 2px;
+	}
+	.el-table__header-wrapper {
+		.el-table__header tr,
+		.el-table__header th {
+			background-color: #f7f7f7;
+		}
+	}
+}
+</style>
+<style lang="scss" scoped>
+.order-draw-wrap {
+	.title-status-wrap {
+		@include disFlex(center, flex-start);
+		.title-text {
+			margin-right: 200px;
+		}
+		.title-status {
+			color: red;
+			&.success {
+				color: green;
+			}
+		}
+	}
+}
+.order-manage-wrap {
+	height: calc(100vh - 64px);
+	overflow-y: auto;
+	padding-bottom: 20px;
+	.accounts-list{
+		width: 80%;
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		margin: 0 auto;
+		padding-bottom: 20px;
+		.accounts-center{
+		width: 80%;
+		}
+	}
+}
+.card-wrap {
+	margin: 20px;
+	.card-tit {
+		font-size: 16px;
+		margin-bottom: 8px;
+	}
+	.card-body {
+		border: 1px solid $borderColor;
+	}
+}
+::v-deep .el-input__inner {
+  padding:0;
+  text-align:center;
+}
+.stock-red{
+	color:red;
+	font-weight:bold;
+	::v-deep .el-input__inner {
+		border:2px solid red;
+	}
+}
+.cost-blue{
+	color:blue;
+	font-weight:bold;
+	::v-deep .el-input__inner {
+		border:2px solid blue;
+	}
+}
+.refund-item-list{
+	display: flex;
+	padding-bottom: 30px;
+	padding-top: 30px;
+	.refund-label{
+		width: 200px;
+		color:black;
+		font-size:16px;
+		text-align:center;
+	}
+	.list{
+		margin-bottom: 10px;
+		.list-title{
+			height: 20px;
+			padding-bottom:20px;
+			font-size:18px;
+			font-weight:bold;
+			.product-name{
+				overflow: hidden;
+				text-overflow:ellipsis;
+				white-space: nowrap;
+				width:160px;
+				height:30px;
+			}
+			.product-price{
+				overflow: hidden;
+				text-overflow:ellipsis;
+				white-space: nowrap;
+				width:130px;
+				margin-left:0px;
+				height:30px;
+			}
+			.product-num{
+				width:90px;
+				overflow: hidden;
+				text-overflow:ellipsis;
+				white-space: nowrap;
+				margin-left:0px;
+				height:30px;
+			}
+		}
+		.list-val{
+			input{
+				width:150px;
+				height:28px;
+				border: 1px solid #ddd;
+				text-align: center;
+				font-weight: normal;
+			}
+		}
+	}
+}
+</style>

+ 230 - 0
ghs/src/views/order/components/refund-record.vue

@@ -0,0 +1,230 @@
+<template>
+	<div>
+		<el-drawer :visible.sync="showArea" size="55vw" :before-close="closeFn" custom-class="drawer-class" direction="ltr">
+			<div>
+				<div style="margin-left:10px;font-weight:bold;">售后记录</div>
+                <x-crud @load="onLoad">
+					<template #table-column-status="{scope}">
+						{{ scope.row.status==0?'待审核':scope.row.status==1?'已通过':scope.row.status==2?'已驳回':'已取消' }}
+					</template>
+
+                    <template #slot-column-option="{scope}">
+                        <el-button @click.stop="getDetail(scope.row)" size="medium" type="primary">明细</el-button>
+                    </template>
+                </x-crud>
+			</div>
+
+            <div class="app-content" v-if="!$util.isEmpty(refundInfo)">
+                <div class="flex refund-item">
+                    <div class="refund-label">售后时间:</div>
+                    <div class="flex list" style="align-items: center;">
+                        <div class="flex" style="align-items: center;">{{refundInfo.addTime}}</div>
+                    </div>
+                </div>
+                <div class="flex refund-item">
+                    <div class="refund-label">售后单号:</div>
+                    <div class="flex list" style="align-items: center;">
+                        <div class="flex" style="align-items: center;">{{refundInfo.refundSn}}</div>
+                    </div>
+                </div>
+                <div class="flex refund-item">
+                    <div class="refund-label">售后方式:</div>
+                    <div class="flex list">
+                        <div class="flex" >{{refundType==1?'退货并退款':'只退款'}}</div>
+                    </div>
+                </div>
+                <div class="refund-item-list" v-if="refundType==1">
+                    <div class="refund-label">售后商品:</div>
+                    <div>
+                        <div class="list" v-for="(res,i) in product" :key="i">
+                        <div class="flex list-title" >
+                            {{res.name}} ¥{{res.unitPrice?parseFloat(res.unitPrice):0}}*{{res.num}}{{res.unitName}}=¥{{parseFloat(res.price)}}
+                        </div>
+                    </div>
+                    </div>
+                </div>
+                <div class="flex refund-item">
+                    <div class="refund-label">售后金额:</div>
+                    <div class="list">¥{{refundPrice}}</div>
+                </div>
+                <div class=" refund-item" v-if="!$util.isEmpty(remark)">
+                    <div class="refund-label" style="color:red;font-weight:bold;">备注信息:</div>
+                    <div class="list" style="color:red;font-weight:bold;">{{remark}}</div>
+                </div>
+            </div>
+
+		</el-drawer>
+	</div>
+</template>
+<script>
+export default {
+	name: 'refund-record',
+	props: {
+		currentData: {
+			type: Object,
+			default: () => {}
+		}
+	},
+	data() {
+		return {
+			showArea: false,
+			product:'',
+			refundPrice:0,
+			refundType:1,
+			remark:'',
+            refundInfo:{}
+		};
+	},
+	methods: {
+        getDetail(info){
+            this.$service.cgRefund.getRefundFullInfo({ id: info.id }).then(data => {
+                this.refundInfo = data.info
+				this.product = data.itemList||[];
+				this.refundType = data.info.refundType||0;
+				this.refundPrice = data.info.refundPrice?parseFloat(data.info.refundPrice):0
+				this.remark = data.info.remark?data.info.remark:''
+            })
+        },
+		init() {
+			this.showArea = true
+			if(this.app){
+				this.app.refresh({relateOrderSn:this.currentData.orderSn})
+			}
+		},
+		closeFn() {
+			this.showArea = false;
+		},
+		onLoad({ ctx, app }) {
+			this.app = app;
+			ctx.service(this.$service.cgRefund)
+			.set('table', {
+				columns: [
+					{
+						label: '日期',
+						prop: 'addTime',
+						align: 'center',
+					},
+					{
+						label: '单号',
+						prop: 'refundSn',
+						align: 'center',
+					},
+					{
+						label: '金额',
+						prop: 'refundPrice',
+						align: 'center',
+					},
+					{
+						label: '操作',
+						prop: 'shopAdminName',
+						align: 'center',
+					},
+					{
+						label: '状态',
+						prop: 'status',
+						align: 'center',
+					}
+				],
+				op: {
+					visible: true,
+					props: {
+						width: 160,
+						align: 'center',
+						fixed: 'right',
+						label: '操作'
+					},
+					layout:['slot-column-option']
+				}
+			})
+			.set('layout', [
+				[ 'data-table' ],
+				['flex1', 'pagination']
+			])
+			.done()
+			app.refresh({relateOrderSn:this.currentData.orderSn})
+		}
+	}
+};
+</script>
+<style lang="scss" scoped>
+.drawer-class{
+	height:100vh;
+}
+.app-content{
+    height: calc(100vh - 30px * 2);
+    padding: 30px;
+    margin-left:100px;
+    background: #FFFFFF;
+    .radioBtn{
+        width: 30px;
+        height: 30px;
+        margin-right: 10px;
+        border: 1px solid #ddd;
+        border-radius: 50%;
+        &.active{
+            position: relative;
+            border: 1px solid #3385ff;
+            &:after{
+                content: '';
+                position: absolute;
+                width: 18px;
+                height: 18px;
+                background: #3385ff;
+                border-radius: 50%;
+            }
+        }
+    }
+    .refund-item-list{
+        display: flex;
+        padding-bottom:0px;
+        .refund-label{
+            width:100px;
+        }
+        .list{
+            margin-bottom: 10px;
+            .list-title{
+                height: 0px;
+                padding-bottom: 20px;
+            }
+            .list-val{
+                input{
+                    width: 150px;
+                    border: 1px solid #ddd;
+                }
+                text{
+                    padding: 0 30px;
+                }
+            }
+        }
+    }
+    .refund-item{
+        display: flex;
+        padding:10px 0;
+        align-items: center;
+        .refund-label{
+            width:100px;
+        }
+        input{
+            border: 1px solid #ddd;
+        }
+        textarea{
+            width: calc(100% - 210px);
+            border: 1px solid #ddd;
+            height:150px;
+        }
+    }
+    .btn-box{
+        .btn{
+            width: 200px;
+            height: 60px;
+            border: 1px solid #666666;
+            border-radius: 10px;
+            &.active{
+                background: #3385ff;
+                color: #fff;
+                border: 1px solid #3385ff;
+            }
+        }
+    }
+}
+</style>

+ 41 - 12
ghs/src/views/order/list.vue

@@ -37,9 +37,8 @@
         </div>
       </template>
       
-
       <template #table-column-debt="{scope}">
-        <span style="color:red;font-weight:bold;font-size:13px;" v-if="scope.row.debt == 1">赊</span>
+        <span style="font-size:13px;" v-if="scope.row.debt == 1">是</span>
         <span v-else>-</span>
       </template>
 
@@ -70,16 +69,16 @@
       </template>
 
       <template #table-column-sameTimeIdsNum="{scope}">
-        <div v-if="scope.row.sameTimeIdsNum>1" style="font-weight:bold;font-size:14px;">{{ scope.row.sameTimeIdsNum }}</div>
+        <div v-if="scope.row.sameTimeIdsNum>1" style="font-size:14px;">{{ scope.row.sameTimeIdsNum }}</div>
         <div v-else>-</div>
       </template>
 
       <template #table-column-book="{scope}">
-        <span v-if="scope.row.book ==1" style="color:green;font-weight:bold;font-size:13px;">预</span>
+        <span v-if="scope.row.book ==1" style="font-size:13px;">是</span>
         <span v-else>-</span>
       </template>
       <template #table-column-sendTimeWant="{scope}">
-        <span v-if="scope.row.book ==1" style="color:green;font-weight:bold;font-size:13px;">{{scope.row.sendTimeWant?scope.row.sendTimeWant.substr(5,5):''}}</span>
+        <span v-if="scope.row.book ==1" style="font-size:13px;">{{scope.row.sendTimeWant?scope.row.sendTimeWant.substr(5,5):''}}</span>
         <span v-else>-</span>
       </template>
       
@@ -108,7 +107,7 @@
         </template>
 
         <template v-if="scope.row.status == 4">
-          <el-button size="small" type="primary" @click="goRefund()">发起售后</el-button>
+          <el-button size="small" type="primary" @click="goRefund(scope.row)">发起售后</el-button>
         </template>
         <template v-else-if="scope.row.status == 1 || scope.row.status == 5">
           <el-button size="small">发起售后</el-button>
@@ -134,7 +133,14 @@
         <el-button @click.stop="allDown(scope.row)" size="small" type="primary" v-if="scope.row.status!=5 && scope.row.status!=1 && scope.row.sameTimeIdsNum>1">全下载</el-button>
         <el-button size="small" v-else>全下载</el-button>
 
-        <el-button size="small">取消</el-button>
+        <el-dropdown @command="doMore($event,scope.row)" style="margin-left:10px;">
+          <el-button type="primary" size="small" v-if="scope.row.status!=5 && scope.row.status!=1">更多<i class="el-icon-arrow-down el-icon--right"></i></el-button>
+          <el-button size="small" v-else>更多<i class="el-icon-arrow-down el-icon--right"></i></el-button>
+          <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item command="refundRecord">售后记录</el-dropdown-item>
+            <el-dropdown-item command="cancel">取消</el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
 
       </template>
 
@@ -223,6 +229,9 @@
       </table>
     </div>
 
+    <begin-refund ref="beginRefundRef" :currentRefundData="currentRefundData" />
+    <refund-record ref="refundRecordRef" :currentData="refundRecordData" />
+
   </div>
 </template>
 
@@ -231,13 +240,17 @@ import SelOrder from './components/sel-order';
 import OrderDetail from './components/order-detail';
 import arrival from './components/arrival';
 import simpleItem from './components/simple-item';
+import beginRefund from './components/begin-refund';
+import refundRecord from './components/refund-record';
 import {hiprint, defaultElementTypeProvider} from 'vue-plugin-hiprint'
 export default {
   components: {
     SelOrder,
     OrderDetail,
     arrival,
-    simpleItem
+    simpleItem,
+    beginRefund,
+    refundRecord
   },
   data() {
     return {
@@ -307,7 +320,9 @@ export default {
       startTime:'',
       endTime:'',
       searchTime:'',
-      name:''
+      name:'',
+      currentRefundData:{},
+      refundRecordData:{}
     };
   },
   created() {
@@ -332,8 +347,22 @@ export default {
   
 	},
   methods: {
-    goRefund(){
-      this.$message.error('开发中')
+    doMore(cmd,data){
+      if(cmd == 'cancel'){
+        //this.cancelOrder(data)
+      }
+      if(cmd == 'refundRecord'){
+        this.refundRecordData = data
+        setTimeout(() => {
+          this.$refs.refundRecordRef.init()
+        })
+      }
+    },
+    goRefund(data){
+      this.currentRefundData = data
+      setTimeout(() => {
+        this.$refs.beginRefundRef.init()
+      })
     },
     renewArrival(info){
       this.confirmArrival(info)
@@ -659,7 +688,7 @@ export default {
             op: {
               visible: true,
               props: {
-                width: 615,
+                width: 630,
                 align: 'center',
                 fixed: 'right',
                 label: '操作'