shish 1 år sedan
förälder
incheckning
ff9058dd8f

+ 14 - 0
ghs/src/service/order/index.js

@@ -5,6 +5,20 @@ import { baseUrl } from '@/config/env';
 @Service('order')
 export class OrderService extends BaseService {
 
+	cancelBookOrder(data) {
+		return this.request({
+			url: '/cancel-book-order',
+			params: data
+		});
+	}
+
+	cancelOrder(data) {
+		return this.request({
+			url: '/cancel',
+			params: data
+		});
+	}
+
 	changeSendStaff(data) {
 		return this.request({
 			url: '/change-send-staff',

+ 24 - 1
ghs/src/views/order/add.vue

@@ -53,6 +53,16 @@
 
 			<template #slot-top-element>
 				<el-input v-model="name" placeholder="搜索客户" size="big" style="width:400px;" ref="customSearchRef" @input="changeText()"></el-input>
+
+				<el-popover style="margin-left:40px;" placement="top" width="160" ref="openCloseBookRef">
+					<p>确认{{ shopInfo.bookSn==0?'开启':'结束' }}?</p>
+					<div style="text-align: right; margin: 0">
+					<el-button size="mini" type="text" @click.stop="cancelBook">取消</el-button>
+					<el-button type="primary" size="mini" @click.stop="changeBook(shopInfo.bookSn)">确定</el-button>
+					</div>
+					<el-button slot="reference" type="primary">{{ shopInfo.bookSn==0?'开启预订':'结束预订' }}</el-button>
+				</el-popover>
+
 			</template>
 
 		</x-crud>
@@ -83,7 +93,8 @@ export default {
 			confirmMobile1:'',
 			addPop:false,
 			name:'',
-			fileUrl:''
+			fileUrl:'',
+			shopInfo:{}
 		};
 	},
 	computed: {
@@ -103,6 +114,17 @@ export default {
 	},
 	methods: {
 		...mapActions(['getLevel']),
+		cancelBook(){
+		this.$refs['openCloseBookRef'].doClose()
+		},
+		changeBook(bookSn){
+		this.$refs['openCloseBookRef'].doClose()
+		let status = bookSn == 0 ? 1 : 0
+		return this.$service.book.changeBook({status:status}).then((res) => {
+			this.$message.success('操作成功')
+			this.app.refresh({status:this.tabIndex,search:this.search})
+		})
+		},
 		fileUpSuccess(response){
 			if(response.code == 1){
 				this.$notify({ title: '提交成功', message: 'success', type: 'success'})
@@ -231,6 +253,7 @@ export default {
 				])
 				.on('refresh', async (params, { next }) => {
 					let result = await next(params)
+					this.shopInfo = result.shopInfo
 				})
 				.done();
 				app.refresh({ type: this.tabIndex,name:this.name })

+ 1 - 0
ghs/src/views/order/book.vue

@@ -29,6 +29,7 @@
           </div>
           <el-button slot="reference" type="primary">{{ shop.bookSn==0?'开启预订':'结束预订' }}</el-button>
         </el-popover>
+
         <el-button type="primary" size="mini" @click="myCgOrder()" style="margin-left:40px;">我的采购</el-button>
         <el-button type="primary" size="mini" @click="goCg" style="margin-left:40px;">去采购</el-button>
         <el-button type="primary" size="mini" @click="exportStockAssign()" style="margin-left:40px;">导出库存分配</el-button>

+ 19 - 8
ghs/src/views/order/list.vue

@@ -188,12 +188,6 @@
 					<el-dropdown-item command="batchAllDown">批量全下载</el-dropdown-item>
 				</el-dropdown-menu>
 				</el-dropdown>
-        <span style="margin-left:20px;font-size:22px;">
-          实际总和 ¥{{ totalActPrice }}
-        </span>
-        <span style="margin-left:20px;font-size:22px;">
-          退款总和 ¥{{ totalTkPrice }}
-        </span>
 			</template>
 
     </x-crud>
@@ -456,8 +450,25 @@ export default {
 
       }
       if(cmd == 'cancelCurrentOrder'){
-        this.$message.error('开发中')
-        return false
+        if(info.book == 1 && info.status == 2){
+          this.$confirm('确认取消?', '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => {
+            this.$service.order.cancelBookOrder({id:info.id}).then(res => {
+              this.$message.success('取消成功')
+              this.refreshData()
+			      })
+          })
+          return true
+        }
+        if(info.book == 0 && info.status == 1){
+          this.$confirm('确认取消?', '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => {
+            this.$service.order.cancelOrder({id:info.id}).then(res => {
+              this.$message.success('取消成功')
+              this.refreshData()
+			      })
+          })
+          return true
+        }
+        this.$message.error('不能取消')
       }
       if(cmd == 'refundShowRecord'){
         this.refundRecordData = info