Browse Source

预订优化

shish 1 year ago
parent
commit
e864abbe29

+ 21 - 35
ghs/src/components/item/cost-change.vue

@@ -1,21 +1,12 @@
 <template>
 	<div>
-		<el-drawer :visible.sync="showArea" size="55vw" :before-close="closeFn" @close="closeTrigger" custom-class="drawer-class" direction="ltr">
+		<el-drawer :visible.sync="showArea" size="55vw" :before-close="closeFn" @close="closeTrigger" custom-class="drawer-class" :direction="direction">
 			<div>
 				<div style="margin-left:2px;font-weight:bold;">
 					<el-date-picker v-model="currentDateList" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" @change="getSearchDate" value-format="yyyy-MM-dd"
 							end-placeholder="结束日期" :picker-options="pickerOptions" size="mini" style="margin-right:10px;">
 					</el-date-picker>
 
-					<el-select v-model="typeValue" placeholder="请选事项" size="mini" style="width:150px" :clearable="true" @change="changeType" @clear="clearType">
-						<el-option
-						v-for="item in options"
-						:key="item.value"
-						:label="item.label"
-						:value="item.value">
-						</el-option>
-					</el-select>
-
 					【{{ costData.name?costData.name:'' }}】成本变动
 				</div>
                 <x-crud @load="onLoad">
@@ -39,7 +30,6 @@ export default {
 	data() {
 		return {
 			options: [],
-			typeValue:'',
 			currentDateList:[],
 			showArea: false,
 			pickerOptions: {
@@ -72,38 +62,39 @@ export default {
 			startTime:'',
 			endTime:'',
 			searchTime:'',
+			direction:'ltr'
 		};
 	},
 	methods: {
-		clearType(){
-			this.typeValue = ''
-			this.goRefresh()
-		},
-		changeType(e){
-			this.goRefresh()
-		},
 		goRefresh(){
-			this.app.refresh({id:this.costData.id,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,recordType:this.typeValue})
+			this.app.refresh({id:this.costData.id,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime})
 		},
 		closeTrigger(){
 			this.$emit('searchFocus')
 		},
 		getSearchDate(){
 			if (this.$util.isEmpty(this.currentDateList)) {
-				this.searchTime = ''
-				this.startTime = ''
-				this.endTime = ''
+				this.resetSearch()
 			}else{
 				this.searchTime = 'custom'
 				this.startTime = this.currentDateList[0]
 				this.endTime = this.currentDateList[1]
 			}
-			this.app.refresh({id:this.costData.id,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,recordType:this.typeValue})
+			this.app.refresh({id:this.costData.id,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime})
+		},
+		resetSearch(){
+			this.searchTime = ''
+			this.startTime = ''
+			this.endTime = ''
 		},
 		init() {
 			this.showArea = true
+			if(this.costData.direction && !this.$util.isEmpty(this.costData.direction)){
+				this.direction = this.costData.direction
+			}
+			this.resetSearch()
 			if(this.app){
-				this.app.refresh({id:this.costData.id})
+				this.goRefresh()
 			}
 		},
 		closeFn() {
@@ -120,23 +111,18 @@ export default {
 						align: 'center',
 					},
 					{
-						label: '名称',
-						prop: 'relateName',
+						label: '操作',
+						prop: 'staffName',
 						align: 'center',
 					},
 					{
 						label: '事项',
-						prop: 'typeName',
-						align: 'center',
-					},
-					{
-						label: '变动',
-						prop: 'bigNumOrder',
+						prop: 'event',
 						align: 'center',
 					},
 					{
-						label: '剩余',
-						prop: 'bigNumStock',
+						label: '成本',
+						prop: 'cost',
 						align: 'center',
 					}
 				],
@@ -160,7 +146,7 @@ export default {
 				this.options = res.typeList
 			})
 			.done()
-			app.refresh({id:this.costData.id,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,recordType:this.typeValue})
+			app.refresh({id:this.costData.id,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime})
 		}
 	}
 };

+ 13 - 6
ghs/src/views/book/components/loan-item.vue → ghs/src/components/item/loan-item.vue

@@ -1,6 +1,6 @@
 <template>
 	<div>
-		<el-drawer :visible.sync="showArea" size="44vw" :before-close="closeFn" custom-class="drawer-class" direction="ltr">
+		<el-drawer :visible.sync="showArea" size="44vw" :before-close="closeFn" custom-class="drawer-class" :direction="direction">
 			<div>
                 <x-crud @load="onLoad">
 
@@ -52,7 +52,8 @@ export default {
 	data() {
 		return {
 			showArea: false,
-            search:''
+            search:'',
+			direction:'ltr'
 		};
 	},
 	methods: {
@@ -66,6 +67,9 @@ export default {
             },650)
 		},
 		init() {
+			if (this.currentData.direction && !this.$util.isEmpty(this.currentData.direction)){
+				this.direction = this.currentData.direction
+			}
 			this.showArea = true
             this.search = ''
 			if(this.app){
@@ -87,10 +91,13 @@ export default {
             let params = {inId:this.currentData.itemId,outId:info.id,num:info.bigCount,bookItemCustomId:this.currentData.id}
             this.$confirm('确认借用?', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
                 this.$service.checkOrder.loan(params).then(res => {
-					that.$message.success('操作成功')
-					setTimeout(()=>{
-						this.showArea = false
-					},1300)
+					that.$message.success('借用成功')
+					if(this.currentData.orderId && Number(this.currentData.orderId)>0){
+						that.$emit('renewArrival',{id:this.currentData.orderId})
+					}else{
+						that.$emit('refreshData')
+					}
+					this.showArea = false
                 })
             })
         },

+ 1 - 1
ghs/src/cool/request/index.js

@@ -71,7 +71,7 @@ import orderItem from '@/service/order-item/index';
 import cgRefund from '@/service/cg-refund/index';
 import clear from '@/service/clear/index';
 import refund from '@/service/refund/index';
-import costChange from '@/service/refund/index';
+import costChange from '@/service/cost-change/index';
 
 export function SET_SERVICE({ store }) {
 	// const files = require.context('@/service/', true, /\.js$/);

+ 7 - 0
ghs/src/service/book-item-custom/index.js

@@ -2,6 +2,13 @@ import { BaseService, Service } from '@/cool';
 @Service('book-item-custom')
 export class BookItemCustomService extends BaseService {
 
+	getInfo(params) {
+		return this.request({
+			url: '/get-info',
+			params
+		});
+	}
+
 	batchGoOn(data) {
 		return this.request({
 			url: '/batch-go-on',

+ 6 - 3
ghs/src/views/book/itemCustom.vue

@@ -86,7 +86,7 @@
 		<book-road-record ref="bookRoadRecord" :currentData="bookRoadRecordData" />
 		<book-cg-record ref="bookCgRecord" :currentData="bookCgRecordData" />
 		<book-item-ghs ref="bookItemGhs" :currentData="bookItemGhsData" />
-		<loan-item ref="loanItem" :currentData="loanData" />
+		<loan-item ref="loanItemRef" :currentData="loanData" @refreshData="refreshData" />
 
 	</div>
 </template>
@@ -97,7 +97,7 @@ import bookOnRecord from './components/book-on-record';
 import bookCgRecord from './components/book-cg-record';
 import bookRoadRecord from './components/book-road-record';
 import bookItemGhs from './components/book-item-ghs';
-import loanItem from './components/loan-item';
+import loanItem from '@/components/item/loan-item';
 export default {
 	components: {
 		bookRecord,
@@ -138,6 +138,9 @@ export default {
 		};
 	},
 	methods: {
+		refreshData(){
+			this.app.refresh({itemId:this.itemId,customId:this.customId})
+		},
 		batchGoOn(){
 			let that = this
 			if (this.$util.isEmpty(this.selectedIds)) {
@@ -194,7 +197,7 @@ export default {
 		loanStock(info){
 			this.loanData = {customId:info.customId,customName:info.customName,id:info.id,itemName:info.name,itemId:info.itemId}
 			setTimeout(() => {
-				this.$refs.loanItem.init()
+				this.$refs.loanItemRef.init()
 			})
 		},
 		goOff(info){

+ 11 - 3
ghs/src/views/order/components/arrival.vue

@@ -1,6 +1,6 @@
 <template>
 	<div class="order-detail">
-		<el-drawer :visible.sync="showDtail" size="850px" :before-close="closeFn" custom-class="order-draw-wrap" direction="ltr">
+		<el-drawer :visible.sync="showDtail" size="900px" :before-close="closeFn" custom-class="order-draw-wrap" direction="ltr" @close="closeTrigger">
 			<div class="order-manage-wrap" v-if="!$util.isEmpty(detailInfo)">
 				<div class="card-wrap">
 					<div class="card-tit">
@@ -26,7 +26,7 @@
 							<el-table-column property="name" label="名称"></el-table-column>
 							<el-table-column label="成本">
 								<template slot-scope="scope">
-									<span style="cursor:pointer;" @click="getCostChange(scope.row)"></span>
+									<span style="cursor:pointer;" @click="getCostChange(scope.row)">
 									<i class="el-icon-s-order" style="color:#409eff;font-size:17px;cursor:pointer;" slot="reference"></i>
 									{{ scope.row.cost?parseFloat(scope.row.cost):0 }}
 									</span>
@@ -54,13 +54,15 @@
 								</template>
 							</el-table-column>
 
-							<el-table-column label="操作">
+							<el-table-column label="操作" width="200">
 								<template slot-scope="scope">
 
 									<el-popconfirm title="确认删除?" @confirm="confirmDel(scope.row)" @onConfirm="confirmDel(scope.row)">
 										<el-button size="small" type="primary" slot="reference">删除</el-button>
 									</el-popconfirm>
 
+									<el-button size="small" type="primary" style="margin-left:20px;" @click="openLoan(scope.row)">借库存</el-button>
+
 								</template>
 							</el-table-column>
 
@@ -166,6 +168,9 @@ export default {
 		}
 	},
 	methods: {
+		closeTrigger(){
+			this.$emit('searchFocus')
+		},
 		getCostChange(info){
 			this.$emit('getCostChange',info)
 		},
@@ -241,6 +246,9 @@ export default {
 				this.init()
 			})
 		},
+		openLoan(info){
+			this.$emit('openLoan',info,this.arrivalData.id)
+		},
 		addItme(){
 			this.$emit('addNewItem',this.arrivalData)
 		},

+ 4 - 1
ghs/src/views/order/components/begin-refund.vue

@@ -1,6 +1,6 @@
 <template>
 <div>
-	<el-drawer :visible.sync="showDtail" size="750px" custom-class="order-draw-wrap" direction="ltr">
+	<el-drawer :visible.sync="showDtail" size="750px" custom-class="order-draw-wrap" direction="ltr" @close="closeTrigger">
 		<div class="order-manage-wrap" v-if="!$util.isEmpty(orderInfo)">
 			<div>
 				<div>
@@ -185,6 +185,9 @@ export default {
 		}
 	},
 	methods: {
+		closeTrigger(){
+			this.$emit('searchFocus')
+		},
 		confirmRefund(){
 			let hasError = false
 			let product = []

+ 4 - 1
ghs/src/views/order/components/order-detail.vue

@@ -1,6 +1,6 @@
 <template>
 	<div class="order-detail">
-		<el-drawer :visible.sync="showOrderDetail" size="1000px" :before-close="closeFn" custom-class="order-draw-wrap" direction="ltr">
+		<el-drawer :visible.sync="showOrderDetail" size="1000px" :before-close="closeFn" custom-class="order-draw-wrap" direction="ltr" @close="closeTrigger">
 			<div class="order-manage-wrap" v-if="!$util.isEmpty(data)">
 				<div class="card-wrap" style="margin-top:0px;">
 					<div class="card-tit">备注</div>
@@ -61,6 +61,9 @@ export default {
 		};
 	},
 	methods: {
+		closeTrigger(){
+			this.$emit('searchFocus')
+		},
 		getStockDetail(info){
 			this.$emit('getStockDetail',info)
 		},

+ 4 - 1
ghs/src/views/order/components/refund-record.vue

@@ -1,6 +1,6 @@
 <template>
 	<div>
-		<el-drawer :visible.sync="showArea" size="50vw" :before-close="closeFn" custom-class="drawer-class" direction="ltr">
+		<el-drawer :visible.sync="showArea" size="50vw" :before-close="closeFn" custom-class="drawer-class" direction="ltr" @close="closeTrigger">
 			<div>
 				<div style="margin-left:10px;font-weight:bold;">售后记录</div>
                 <x-crud @load="onLoad">
@@ -126,6 +126,9 @@ export default {
 		};
 	},
 	methods: {
+		closeTrigger(){
+			this.$emit('searchFocus')
+		},
         reject(){
             this.$message.error('开发中')
         },

+ 1 - 1
ghs/src/views/order/components/simple-item.vue

@@ -89,7 +89,7 @@ export default {
 			let showUsePrice = Number(info.showUsePrice)>0 ? info.showUsePrice: 100
 			let data = [{id:info.id,bigCount:info.bigCount,price:showUsePrice}]
 			this.$service.orderItem.addItem({data:JSON.stringify(data),id:this.simpleData.id}).then(res => {
-				this.$notify({ title: '添加成功', message: '', type: 'success'})
+				that.$message.success('添加成功')
 				this.$emit('renewArrival',this.simpleData)
 				this.closeFn()
 			})

+ 33 - 7
ghs/src/views/order/list.vue

@@ -183,16 +183,21 @@
 
     <select-staff ref="selectStaffRef" @getStaff="getStaff" :staffData="staffData" />
 
-    <arrival ref="arrivalRef" :arrivalData="arrivalData" @addNewItem="addNewItem" @refreshData="refreshData" @getStockDetail="getStockDetail" @getCostChange="getCostChange" />
+    <arrival ref="arrivalRef" :arrivalData="arrivalData" @searchFocus="searchFocus" @addNewItem="addNewItem" @refreshData="refreshData" @getStockDetail="getStockDetail" @getCostChange="getCostChange" @openLoan="openLoan" />
 
     <simple-item ref="simpleItemRef" :simpleData="simpleData" @renewArrival="renewArrival" />
 
-    <order-detail ref="orderDetail" :orderOperate="optionData" @getStockDetail="getStockDetail" />
+    <order-detail ref="orderDetail" :orderOperate="optionData" @getStockDetail="getStockDetail" @searchFocus="searchFocus" />
 
     <sel-order ref="selOrder" :id="optionData.id" @song-success="onSongSuccess" />
 
     <stock-detail ref="stockDetail" :itemData="itemData" />
 
+    <begin-refund ref="beginRefundRef" :currentRefundData="currentRefundData" @searchFocus="searchFocus" />
+    <refund-record ref="refundRecordRef" :currentData="refundRecordData" @searchFocus="searchFocus" />
+	  <cost-change ref="costChangeRef" :costData="costData" @searchFocus="searchFocus" />
+    <loan-item ref="loanItemRef" :currentData="loanData" @renewArrival="renewArrival" />
+
     <div class="print-html-box">
       <table border="0" width="730" style="border:solid 1px #fff;border-collapse:collapse">
         <tr>
@@ -246,9 +251,6 @@
       </table>
     </div>
 
-    <begin-refund ref="beginRefundRef" :currentRefundData="currentRefundData" />
-    <refund-record ref="refundRecordRef" :currentData="refundRecordData" />
-
   </div>
 </template>
 
@@ -261,6 +263,8 @@ import arrival from './components/arrival';
 import simpleItem from './components/simple-item';
 import beginRefund from './components/begin-refund';
 import refundRecord from './components/refund-record';
+import costChange from '@/components/item/cost-change';
+import loanItem from '@/components/item/loan-item';
 import {hiprint, defaultElementTypeProvider} from 'vue-plugin-hiprint'
 export default {
   components: {
@@ -271,7 +275,9 @@ export default {
     beginRefund,
     refundRecord,
     selectStaff,
-    stockDetail
+    stockDetail,
+    costChange,
+    loanItem
   },
   data() {
     return {
@@ -306,6 +312,8 @@ export default {
       ],
       optionData: {},
       arrivalData:{},
+      costData:{},
+      loanData:{},
       simpleData:{},
       staffData:{title:'',changeType:'',obj:null},
       orderData:'',
@@ -378,6 +386,12 @@ export default {
 
 	},
   methods: {
+    searchFocus(){
+      let that = this
+      setTimeout(() => {
+        that.$refs.orderSearchRef.focus()	
+      },1000)
+    },
     getStaff(staff){
       let that = this
       if(this.staffData.changeType == 'changeSend'){
@@ -431,7 +445,19 @@ export default {
       })
     },
     getCostChange(info){
-
+      this.costData = {id:info.productId,name:info.name,direction:'rtl'}
+      setTimeout(() => {
+        this.$refs.costChangeRef.init()
+      })
+    },
+    openLoan(param,orderId){
+      this.$service.bookItemCustom.getInfo({orderId:orderId,productId:param.productId}).then(data=>{
+        let info = data.res
+        this.loanData = {customId:info.customId,customName:info.customName,id:info.id,itemName:info.name,itemId:info.itemId,direction:'rtl',orderId:orderId}
+        setTimeout(() => {
+          this.$refs.loanItemRef.init()
+        })
+      })
     },
     addNewItem(data){
       this.simpleData = data