Browse Source

占用场地

voice
刘嘉炜 4 years ago
parent
commit
2ac259d5f2
  1. 6
      README.md
  2. 62
      src/js/api.js
  3. 85
      src/pages/site/confirm/confirm.vue
  4. 148
      src/pages/site/manage/manage.vue
  5. 97
      src/pages/site/order_list/order_list.vue
  6. 8
      src/store/index.js
  7. 5
      src/store/mutations.js

6
README.md

@ -30,6 +30,12 @@ npm run build:mp-weixin
### 配置
### 正式APPID
> wxf1294b279ad1b845
### 测试APPID
> wx7106e84614cf0060
### ipx 底部适配高度函数
```css

62
src/js/api.js

@ -2,35 +2,35 @@ export const ORIGIN = `http://testmanager.ouxuanzhineng.cn`; // 测试
// export const ORIGIN = `https://minimanage.ouxuanzhineng.cn`; // 正式
export const API = {
wechatMiniAppLoginAndSync:`${ORIGIN}/user/wechatMiniAppLoginAndSync`, // 小程序授权
brandInfo:`${ORIGIN}/stadium/brand/get`, // 品牌信息
assistantAuth:`${ORIGIN}/assistant/auth`, // 授权绑定 - 获取用户信息
calc:`${ORIGIN}/admin/assistant/calc`, // 首页 统计页面
stadiumList:`${ORIGIN}/stadium/list`, // 店铺列表
stadiumDetail:`${ORIGIN}/stadium/detail`, // A店铺管理-店铺列表-店铺详情
wechatMiniAppLoginAndSync: `${ORIGIN}/user/wechatMiniAppLoginAndSync`, // 小程序授权
brandInfo: `${ORIGIN}/stadium/brand/get`, // 品牌信息
assistantAuth: `${ORIGIN}/assistant/auth`, // 授权绑定 - 获取用户信息
calc: `${ORIGIN}/admin/assistant/calc`, // 首页 统计页面
stadiumList: `${ORIGIN}/stadium/list`, // 店铺列表
stadiumDetail: `${ORIGIN}/stadium/detail`, // A店铺管理-店铺列表-店铺详情
verifiedOrderList:`${ORIGIN}/admin/assistant/order/verified`, // 核销订单列表
verifiedOrderInfo:`${ORIGIN}/admin/stadium/order/get`, // 核销订单信息
verifiedOrder:`${ORIGIN}/admin/stadium/order/verify`, // 核销订单
verifiedOrderList: `${ORIGIN}/admin/assistant/order/verified`, // 核销订单列表
verifiedOrderInfo: `${ORIGIN}/admin/stadium/order/get`, // 核销订单信息
verifiedOrder: `${ORIGIN}/admin/stadium/order/verify`, // 核销订单
collectionRecord:`${ORIGIN}/admin/assistant/collection/record`, // 收款记录
collectionDetails:`${ORIGIN}/admin/assistant/collection/details`, // 收款记录-收款明细
collectionRecord: `${ORIGIN}/admin/assistant/collection/record`, // 收款记录
collectionDetails: `${ORIGIN}/admin/assistant/collection/details`, // 收款记录-收款明细
reservationOrder:`${ORIGIN}/admin/stadium/order/list`, // 预约订单
membershipOrder:`${ORIGIN}/admin/member_card/order/list`, // 会员卡订单
reservationOrder: `${ORIGIN}/admin/stadium/order/list`, // 预约订单
membershipOrder: `${ORIGIN}/admin/member_card/order/list`, // 会员卡订单
integralOrder:`${ORIGIN}/admin/shop/order/list`, // 积分商城订单
integralOrderSend:`${ORIGIN}/admin/shop/order/ship`, // 积分商城订单-发货
integralOrder: `${ORIGIN}/admin/shop/order/list`, // 积分商城订单
integralOrderSend: `${ORIGIN}/admin/shop/order/ship`, // 积分商城订单-发货
// 营业额统计
turnoverBrand:`${ORIGIN}/admin/assistant/turnover/brand/calc`, // 营业额记录-品牌
turnoverStadium:`${ORIGIN}/admin/assistant/turnover/brand/stadium/calc`, // 营业额记录-门店
turnoverBrand: `${ORIGIN}/admin/assistant/turnover/brand/calc`, // 营业额记录-品牌
turnoverStadium: `${ORIGIN}/admin/assistant/turnover/brand/stadium/calc`, // 营业额记录-门店
turnoverDay:`${ORIGIN}/admin/assistant/turnover/calc/day`, // 营业额记录-时间选择-天
turnoverMonth:`${ORIGIN}/admin/assistant/turnover/calc/month`, // 营业额记录-时间选择-月
turnoverYear:`${ORIGIN}/admin/assistant/turnover/calc/year`, // 营业额记录-时间选择-年
turnoverDay: `${ORIGIN}/admin/assistant/turnover/calc/day`, // 营业额记录-时间选择-天
turnoverMonth: `${ORIGIN}/admin/assistant/turnover/calc/month`, // 营业额记录-时间选择-月
turnoverYear: `${ORIGIN}/admin/assistant/turnover/calc/year`, // 营业额记录-时间选择-年
// 消息列表
@ -41,20 +41,22 @@ export const API = {
// 员工管理
API['employee'] = {
inviteCode:`${ORIGIN}/admin/assistant/qrcode/invite`, // 添加员工二维码
employeeAdd:`${ORIGIN}/assistant/employee/add`, // 添加员工-填写信息
employeeList:`${ORIGIN}/admin/assistant/employee/list`, // 员工列表
employeeDelete:`${ORIGIN}/admin/assistant/employee/delete`, // 移除员工
employeeGrant:`${ORIGIN}/admin/assistant/employee/grant`, // 员工授权/审核
adminReplace:`${ORIGIN}/admin/assistant/replace`, // 更换管理员
employeeUnreview:`${ORIGIN}/admin/assistant/employee/unreview`, // 未审核员工列表
inviteCode: `${ORIGIN}/admin/assistant/qrcode/invite`, // 添加员工二维码
employeeAdd: `${ORIGIN}/assistant/employee/add`, // 添加员工-填写信息
employeeList: `${ORIGIN}/admin/assistant/employee/list`, // 员工列表
employeeDelete: `${ORIGIN}/admin/assistant/employee/delete`, // 移除员工
employeeGrant: `${ORIGIN}/admin/assistant/employee/grant`, // 员工授权/审核
adminReplace: `${ORIGIN}/admin/assistant/replace`, // 更换管理员
employeeUnreview: `${ORIGIN}/admin/assistant/employee/unreview`, // 未审核员工列表
}
API['venue'] = {
venueTypes:`${ORIGIN}/stadium/venue/types`, // 场馆类型
venueList:`${ORIGIN}/stadium/book/list`, // 场地列表
venueTypes: `${ORIGIN}/stadium/venue/types`, // 场馆类型
venueList: `${ORIGIN}/stadium/book/list`, // 场地列表
venueTakeUp: `${ORIGIN}/admin/assistant/venue/takeUp`, // 商家助手-占用场地提交
takeUpList: `${ORIGIN}/admin/timeSelect/list/4`, // 商家助手-占用场地列表
setStatus: `${ORIGIN}/admin/timeSelect/setStatus`, // 商家助手-占用场地列表
}

85
src/pages/site/confirm/confirm.vue

@ -3,61 +3,120 @@
<view class="sc-section">
<view class="sc-address">
<view class="sa-name">
<image mode="aspectFit"></image>
<text>欧轩智能场馆(羽毛球馆永泰店)</text>
<image mode="aspectFit" :src="occupyInfo.storeInfo.logo || ''"></image>
<text>{{occupyInfo.storeInfo.name || '-'}}</text>
</view>
<view class="sa-detail">
<view>地址</view>
<view>深圳市南山区南山街道阳光棕榈社区桂庙路</view>
<view>{{occupyInfo.storeInfo.venue_addr || '-'}}</view>
</view>
</view>
<view class="sc-order-info">
<view class="soi-line">
<view>预定日期</view>
<view><view>羽毛球</view></view>
<view>预定项目</view>
<view><view>{{occupyInfo.typeInfo.name || '-'}}</view></view>
</view>
<view class="soi-line">
<view>预定日期</view>
<view><view>周五(05月17日)</view></view>
<view><view>{{occupyInfo.dateInfo.dayStr || '-'}}({{occupyInfo.dateInfo.showDateStr || '-'}})</view></view>
</view>
<view class="soi-line">
<view>预定场次</view>
<view>
<view>1号馆 10:00-11:00 (¥80)</view>
<view>1号馆 10:00-11:00 (¥80)</view>
<view>1号馆 10:00-11:00 (¥80)</view>
<block v-for="(e, i) in occupyInfo.venueList" :key="i">
<view>{{e.parentObj.name || '-'}} {{e.time || '-'}} (¥{{e.price || '-'}})</view>
</block>
</view>
</view>
</view>
<view class="sc-ipt">
<view class="si-price">
<view class="sp-tit">收取金额</view>
<view class="sp-frame"><input /></view>
<view class="sp-frame"><input v-model="ocPrice" type="number" /></view>
</view>
<view class="si-reason">
<view class="sr-tit">占用原因</view>
<view class="sr-frame">
<textarea placeholder="多行输入…"></textarea>
<textarea placeholder="多行输入…" v-model="ocReaon"></textarea>
</view>
</view>
</view>
</view>
<view class="sc-fixed-bot">
<view hover-class="hover-active">确定</view>
<view hover-class="hover-active" @click="confirmOccupy">确定</view>
</view>
</view>
</template>
<script>
import { mapState } from 'vuex';
import { API } from '../../../js/api';
import { servers } from '../../../js/server';
import util from '../../../utils/util';
export default {
data(){
return {
ocPrice: '',
ocReaon: ''
}
},
computed: {
...mapState([ 'occupyInfo' ]),
},
onLoad(){
console.log(this.occupyInfo)
},
methods: {
confirmOccupy: util.debounce(function(){
let { storeInfo, dateInfo, venueList, typeInfo } = this.occupyInfo;
let { ocPrice, ocReaon } = this;
console.log(ocPrice, ocReaon);
servers.post({
url: API.venue.venueTakeUp,
data: {
reason: ocReaon,
amount: +ocPrice,
group: storeInfo.id,
date: dateInfo.dateStr,
items: venueList.map(el=>{
return {
venue_id: el.parentObj.id,
venue_name: el.parentObj.name,
duration: el.time,
price: el.price
}
})
},
isDefaultGet: false
})
.then(res=>{
if(res.data.code == 0){
util.showNone(res.data.message || '操作成功!');
setTimeout(_=>{
util.routeTo();
util.previousPageFunction({
fnName: 'refreshVenues',
query: null
})
}, 1200)
}else{
util.showNone(res.data.message || '操作失败!');
}
})
}),
},
}
</script>
<style lang="scss">
@import "~style/public.scss";
.site-confirm{
padding-bottom: 138upx;
padding-bottom: calc( 138upx + constant(safe-area-inset-bottom)); /* 兼容 iOS < 11.2 */
padding-bottom: calc( 138upx + env(safe-area-inset-bottom)); /* 兼容 iOS >= 11.2 */
.sc-section{
background-color: #fff;
}

148
src/pages/site/manage/manage.vue

@ -16,8 +16,8 @@
</picker>
<view class="st-tip">{{curTypeInfo.rule_text || '-'}}</view>
</view>
<picker>
<view class="sh-time">2020年5月16日2020年5月22日</view>
<picker mode="date" @change="timeSlotChange">
<view class="sh-time" v-if="dateList.length>1">{{dateList[0].ZhDateStr || '-'}}{{dateList[dateList.length-1].ZhDateStr || '-'}}</view>
</picker>
</view>
<scroll-view class="sm-times" scroll-x>
@ -45,16 +45,22 @@
<view
:class="[
k._isSelect?'green':
k.is_valid?'':'grey'
k.is_take_up?'black':
!k.is_valid?'grey':''
]"
>{{k.is_valid?`¥${k.price || 0}`:'已售'}}</view>
>
{{
!k.is_valid?'已售':
k.is_take_up?'已占用':`¥${k.price || 0}`
}}
</view>
</view>
</view>
</scroll-view>
</view>
<view class="sm-fixd-bot">
<block v-if="selectedVenueList.length">
<view class="sfb-continuity-tip">9点至10点为连场预订,请谅解</view>
<!-- <view class="sfb-continuity-tip">9点至10点为连场预订,请谅解</view> -->
<view class="sfb-selected-section">
<view class="sss-bar">
<view>已选择场次<text>4</text></view>
@ -75,8 +81,10 @@
</view>
</view>
<view class="sfb-btn-bar">
<view class="sbb-price"><text>¥</text>0.00</view>
<view class="sbb-btn" hover-class="hover-active" @click="toOrderConfirm">请选择场地</view>
<view class="sbb-price"><text>¥</text>{{totalPrice || '0.00'}}</view>
<view class="sbb-btn" hover-class="hover-active" @click="toOrderConfirm">
{{selectedVenueList.length?'提交订单':'请选择场地'}}
</view>
</view>
</view>
</view>
@ -89,14 +97,15 @@ import util from '../../../utils/util'
export default {
data(){
return {
storeList: [],
curStoreInfo: {},
typeList: [],
curTypeInfo: {},
venueList: [],
dateList: [],
curDateInfo: {},
selectedVenueList: [],
storeList: [], //
curStoreInfo: {}, //
typeList: [], //
curTypeInfo: {}, //
venueList: [], //
dateList: [], //
curDateInfo: {}, //
selectedVenueList: [], //
totalPrice: 0,
}
},
computed: {
@ -104,6 +113,7 @@ export default {
},
async onLoad(){
try {
util.showLoad();
let _storeInfo = await this.getStoreList();
let _storeList = _storeInfo.list || [];
if(!_storeList.length)return util.showNone('没有店铺信息!');
@ -126,61 +136,112 @@ export default {
})
if(!_venueList.length)return util.showNone('没有场地信息!')
this.venueList = _venueList || [];
console.log(_venueList)
console.log(this.getDateList({}))
return
return util.hideLoad();
}catch(err){
util.hideLoad();
console.warn('加载失败----->', err)
}
},
methods: {
timeSlotChange(e){
console.log(e);
let _timestamp = new Date(e.detail.value.replace(/\-/g, '/')).getTime(); // 0
if(new Date().getTime() - _timestamp > 24*60*60*1000)return util.showNone('请选择正确时间!'); //
let _dateArr = this.getDateList({
dateTimeStamp: _timestamp,
}) || [];
this.dateList = _dateArr;
this.curDateInfo = _dateArr[0] || {};
console.log(_dateArr)
this.$nextTick(_=>this.refreshVenues());
},
//
async refreshVenues(){
let { curStoreInfo, curTypeInfo, curDateInfo } = this;
try{
util.showLoad();
this.venueList = [];
let _venueList = await this.getVenueList({
type_key: curTypeInfo.key || '',
stadium_id: curStoreInfo.id || '',
date: curDateInfo.dateStr || '',
})
if(!_venueList.length)return util.showNone('没有场地信息!');
this.venueList = _venueList || [];
this.$nextTick(_=>this.getSelectedVenues());
util.hideLoad();
}catch(err){
util.hideLoad();
}
},
//
clearSelectedList(){
let { venueList } = this;
let _venueList = venueList.slice();
_venueList.forEach(e=>{
e.items.forEach(el=>{
el._isSelect = false
})
})
this.venueList = _venueList;
this.$nextTick(_=>{
this.$forceUpdate();
this.selectedVenueList = this.getSelectedVenues() || [];
})
this.refreshVenues();
// this.$nextTick(_=>this.getSelectedVenues());
},
//
venueSelect(i,j){
let { venueList } = this;
let _venueList = venueList.slice();
let _curTarget = _venueList[i].items[j]
let _curTarget = { ..._venueList[i].items[j] };
if(!_curTarget.is_valid)return;
_venueList[i].items[j]._isSelect = !_curTarget;
if(_curTarget.is_take_up){
let _str = `操作人:${_curTarget.operator || '-'},收取金额: ${_curTarget.price || 0}\n原因: ${_curTarget.take_up_reason || '-'}`;
util.showNone(_str)
return
}
_venueList[i].items[j]._isSelect = !_curTarget._isSelect;
let _ctnList = []; // ,
// ,
_venueList[i].items = _venueList[i].items.map(e=>{
let _flag = e.time_arrow_id&& //
e.is_valid&& // false
e.time_arrow_id == _curTarget.time_arrow_id;
if(_flag)e._isSelect = !_curTarget._isSelect;
if(_flag&&!_curTarget._isSelect)_ctnList.push(e);
return e;
}) || [];
this.venueList = _venueList;
this.$nextTick(_=>{
if(_ctnList.length>1){
let _tipStr = `${_ctnList[0].duration}-${_ctnList[_ctnList.length-1].duration}为连场预订`
util.showModal({ title: '连场提示!', content: _tipStr });
}
this.$forceUpdate();
this.selectedVenueList = this.getSelectedVenues() || [];
this.getSelectedVenues();
})
},
//
getSelectedVenues(){
let { venueList } = this;
let _arr = [];
let _totalPrice = 0;
venueList.forEach((e,i)=>{
e.items.forEach((el,idx)=>{
let { items, ...parentObj } = e;
if(el._isSelect)_arr.push({ parentObj, ...el });
if(el._isSelect){
_totalPrice += +el.price;
_arr.push({ parentObj, ...el });
}
})
})
this.totalPrice = _totalPrice.toFixed(2);
this.selectedVenueList = _arr || [];
return _arr;
},
// tab
dateChange(e){
this.curDateInfo = e;
this.$nextTick(_=>this.refreshVenues());
},
// 7
getDateList({ dateTimeStamp = new Date().getTime(), length = 7 }){
getDateList({ dateTimeStamp = new Date().getTime(), length = 8 }){
let _dayTimeStamp = 24*60*60*1000;
return new Array(length).fill(1).map((e,i)=>{
let _curStamp = dateTimeStamp + (i*_dayTimeStamp);
@ -197,19 +258,28 @@ export default {
storePickerChange(e){
let { storeList } = this;
this.curStoreInfo = storeList[e.detail.value];
console.log(e)
this.$nextTick(_=>this.refreshVenues());
},
typePckerChange(e){
console.log(e)
let { typeList } = this;
this.curTypeInfo = typeList[e.detail.value];
this.$nextTick(_=>this.refreshVenues());
},
toOrderConfirm(){
let { selectedVenueList } = this;
let { curStoreInfo, curTypeInfo, curDateInfo, selectedVenueList } = this;
if(!selectedVenueList.length)return;
this.$store.commit('setOccupyInfo', {
storeInfo: curStoreInfo,
dateInfo: curDateInfo,
typeInfo: curTypeInfo,
venueList: selectedVenueList,
})
util.routeTo(`/pages/site/confirm/confirm`, 'nT');
},
//
//
getVenueList({type_key,stadium_id,date}){
return servers.get({
url: API.venue.venueList,

97
src/pages/site/order_list/order_list.vue

@ -1,6 +1,6 @@
<template>
<view class="site-order-list">
<view class="sol-bar">
<!-- <view class="sol-bar">
<picker>
<view class="sb-picker">
<input placeholder="请选择门店" disabled />
@ -8,52 +8,57 @@
</view>
</picker>
<view class="sb-icon"></view>
</view>
</view> -->
<view class="sol-list">
<view class="sl-item" v-for="i in 10" :key="i">
<view class="sl-item" v-for="(e, i) in occupyList" :key="i">
<view class="si-bar">
<view class="sa-address">
<image></image>
<text>欧轩智能场馆(羽毛球馆永泰店)</text>
<image mode="aspectFit" :src="e.extension.stadium.logo ||''"></image>
<text>{{e.extension.stadium.name || '-'}}</text>
</view>
<view class="sa-status">
{{
e.status == 1 ? '待使用':
e.status == 2 ? '已使用':
e.status == 0 ? '已取消': ''
}}
</view>
<view class="sa-status">待使用</view>
</view>
<view class="si-detail">
<view class="sd-line">
<view>占用编号:</view>
<view>
<view>20195171564566</view>
<view>{{e.time_arrow_id || '-'}}</view>
</view>
</view>
<view class="sd-line">
<view>项目:</view>
<view>
<view>20195171564566</view>
<view>{{e.extension.type_name || '-'}}</view>
</view>
</view>
<view class="sd-line">
<view>日期:</view>
<view>
<view>2020-10-10</view>
<view>{{e.extension.take_up_date || '-'}}</view>
</view>
</view>
<view class="sd-line">
<view>场次:</view>
<view>
<view>3号馆 10:00-11:00 (80)</view>
<view>3号馆 10:00-11:00 (80)</view>
<view>3号馆 10:00-11:00 (80)</view>
<view>3号馆 10:00-11:00 (80)</view>
<block v-for="(k,j) in e.extension.take_up_details.items" :key="j">
<view>{{k.venue_name ||'-'}} {{k.duration ||'-'}} ({{k.price ||'0'}})</view>
</block>
</view>
</view>
</view>
<view class="si-info">
<view class="si-line"><text>收取金额: </text>¥324</view>
<view class="si-line"><text>操作人: </text>¥324</view>
<view class="si-line"><text>占用原因: </text>¥324</view>
<view class="si-line"><text>收取金额: </text>¥{{e.extension.take_up_details.amount || '0'}}</view>
<view class="si-line"><text>操作人: </text>{{e.extension.take_up_operator || '-'}}</view>
<view class="si-line"><text>占用原因: </text>{{e.extension.take_up_reason || '-'}}</view>
</view>
<view class="si-btns">
<view hover-class="hover-active">取消占用</view>
<view class="si-btns" v-if="e.status == 1">
<view hover-class="hover-active" @click="cancelOccupy(e)">取消占用</view>
</view>
</view>
</view>
@ -64,13 +69,67 @@
</template>
<script>
import { API } from '../../../js/api'
import { servers } from '../../../js/server'
import util from '../../../utils/util'
export default {
data(){
return {
occupyList: [],
}
},
onLoad(){
},
onShow(){
this.getTakeUpList();
},
methods: {
cancelOccupy: util.debounce(function(e){
util.showLoad();
servers.get({
url: API.venue.setStatus,
data: {
id: e.id,
status: 0
},
isDefaultGet: false
})
.then(res=>{
util.hideLoad()
if(res.data.code == 0){
util.showNone(res.data.message || '操作成功!');
setTimeout(_=>{
this.occupyList = [];
this.getTakeUpList();
}, 1200);
}else{
util.showNone(res.data.message || '操作失败!');
}
})
.catch(util.hideLoad);
}, 300, 300),
getTakeUpList(){
util.showLoad();
servers.get({
url: API.venue.takeUpList,
data: {
group: '',
source: '商家助手',
status: ''
},
failMsg: '加载失败!'
})
.then(res=>{
util.hideLoad();
this.occupyList = res || [];
})
.catch(util.hideLoad)
},
toSiteManage(){
util.routeTo(`/pages/site/manage/manage`, 'nT');
}
}
},
}
</script>

8
src/store/index.js

@ -27,6 +27,14 @@ export default new Vuex.Store({
'1008': '查询核销',
'1009': '场地管理',
'1010': '设备管理',
},
// 场地占用提交页面信息
occupyInfo: {
storeInfo: {}, // 店铺信息
dateInfo: {}, // 时间信息
typeInfo: {}, // 球场类型
venueList: [], // 选择场地列表
}
},
mutations,

5
src/store/mutations.js

@ -7,4 +7,9 @@ export default {
// console.log(storeInfo,'-----')
state.brandInfo = brandInfo
},
// 场地占用信息
setOccupyInfo(state, _occupyInfo){
state.occupyInfo = _occupyInfo;
}
}
Loading…
Cancel
Save