Explorar o código

变更预订活动

shish %!s(int64=2) %!d(string=hai) anos
pai
achega
c87c6b16be
Modificáronse 2 ficheiros con 13 adicións e 29 borrados
  1. 11 27
      ghsApp/src/admin/order/statBook.vue
  2. 2 2
      ghsApp/src/api/book/index.js

+ 11 - 27
ghsApp/src/admin/order/statBook.vue

@@ -9,7 +9,8 @@
 		<view class="top-bar">
 			<DateSelect class="bar" top="0" @selectDateFn="selectDateFn" />
 			<button class="admin-button-com mini-btn blue" style="margin-left:30upx;" @click="printOrder()">打印</button>
-			<button class="admin-button-com mini-btn blue" style="margin-left:50upx;" @click="beginBook()">开启预订</button>
+			<button class="admin-button-com mini-btn blue" style="margin-left:50upx;" @click="modifyBook(0)" v-if="Number(bookSn)>0">结束预订</button>
+			<button class="admin-button-com mini-btn blue" style="margin-left:50upx;" @click="modifyBook(1)" v-else>开启预订</button>
 		</view>
 		<scroll-view scroll-y scroll-with-animation class="main-view">
 			<view class="space-view ex-table">
@@ -44,7 +45,7 @@
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import SelectList from "@/components/plugin/selectList";
 import { getStatBookProfit,getStatBookPrint } from "@/api/stat";
-import { openBook } from "@/api/book"
+import { changeBook } from "@/api/book"
 import { list } from "@/mixins";
 import ShopSelect from "@/components/module/shopSelect";
 import DateSelect from "@/components/module/dateSelect";
@@ -81,8 +82,8 @@ export default {
 				shopId: "",
 			},
 			profile:[],
-			storageData:[],
 			searchContent:'',
+			bookSn:0
 		};
 	},
 	onPullDownRefresh() {
@@ -98,10 +99,12 @@ export default {
 	},
 	methods: {
 		...mapActions(['setUserShopAll']),
-		beginBook(){
-			this.$util.confirmModal({content:'确认开启?'},() => {
-				openBook().then(res=>{
+		modifyBook(status){
+			let hint = status == 0 ?'确认结束?':'确认开启?'
+			this.$util.confirmModal({content:hint},() => {
+				changeBook({status:status}).then(res=>{
 					if(res.code == 1){
+						this.bookSn = res.data.bookSn
 						this.$msg(res.msg)
 					}
 				})
@@ -120,28 +123,10 @@ export default {
 		},
 		searchFn(e){
 			this.searchContent = e;
-			this.filterStat()
 		},
 		goDetail(item){
 			this.$util.pageTo({ url: "/admin/book/itemCustom"})
 		},
-		filterStat(){
-			let that = this
-			if(this.searchContent.length > 0){
-				that.profile = [];
-				that.storageData.forEach(obj => {
-					let hasName = obj.name && obj.name.indexOf(this.searchContent) >= 0;
-					let elePy = (obj.py && obj.py.toLocaleUpperCase()) || "";
-					let hasPy = elePy.indexOf(this.searchContent.toLocaleUpperCase()) >= 0;
-					if (hasName || hasPy) {
-						that.profile.push(obj)
-					}
-				})
-			}else{
-				that.profile = that.storageData
-			}
-		},
-		//选择分店
 		selectShopFn(val){
 			this.params.shopId = val.id;
 			this.init();
@@ -159,11 +144,10 @@ export default {
 			uni.showLoading()
 			getStatBookProfit(this.params).then(res => {
 				uni.hideLoading()
+				this.bookSn = res.data.shop && res.data.shop.bookSn ? res.data.shop.bookSn : 0
 				if (!this.$util.isEmpty(res.data.list)) {
-					that.storageData = res.data.list
-					that.filterStat()
+					that.profile = res.data.list
 				}else{
-					that.storageData=[]
 					that.profile = []
 				}
 			});

+ 2 - 2
ghsApp/src/api/book/index.js

@@ -24,6 +24,6 @@ export const closeBook = data => {
 	return https.get('/book/close-book', data)
 }
 
-export const openBook = data => {
-	return https.get('/book/open-book', data)
+export const changeBook = data => {
+	return https.get('/book/change-book', data)
 }