Browse Source

add site manage

voice
刘嘉炜 4 years ago
parent
commit
571bd333a2
  1. 6
      src/js/api.js
  2. 198
      src/pages/site/manage/manage.vue
  3. BIN
      src/static/images/icon/arrow_c33.png
  4. 2
      src/subpackage/device/pages/coffee_test/coffee_test.vue

6
src/js/api.js

@ -51,6 +51,12 @@ API['employee'] = {
}
API['venue'] = {
venueTypes:`${ORIGIN}/stadium/venue/types`, // 场馆类型
venueList:`${ORIGIN}/stadium/book/list`, // 场地列表
}
export default { ORIGIN, API };

198
src/pages/site/manage/manage.vue

@ -1,66 +1,74 @@
<template>
<view class="site-manage">
<view class="sm-header">
<picker mode="selector" :range="storeList" range-key="name" @change="storePickerChange">
<view class="sh-address">
<text>欧轩智能场馆(羽毛球馆永泰店)</text>
<image></image>
<text>{{curStoreInfo.name || '-'}}</text>
<image mode="aspectFit" src="/static/images/icon/arrow_c33.png"></image>
</view>
</picker>
<view class="sh-type">
<picker>
<picker mode="selector" :range="typeList" range-key="name" @change="typePckerChange">
<view class="st-type">
<text>羽毛球</text>
<image></image>
<text>{{curTypeInfo.name || '-'}}</text>
<image mode="aspectFit" src="/static/images/icon/arrow_c33.png"></image>
</view>
</picker>
<view class="st-tip">可提前3个小时退</view>
<view class="st-tip">{{curTypeInfo.rule_text || '-'}}</view>
</view>
<picker>
<view class="sh-time">2020年5月16日2020年5月22日</view>
</picker>
</view>
<scroll-view class="sm-times" scroll-x>
<view :class="['st-item', i==1?'active':'']" v-for="i in 10" :key="i">
<view
v-for="(e,i) in dateList"
:key="i"
:class="['st-item', curDateInfo.dateStr===e.dateStr?'active':'']"
@click="dateChange(e)"
>
<view class="si-txt">
<view>今天</view>
<view>6月10日</view>
<view>{{e.dayStr || '-'}}</view>
<view>{{e.showDateStr || '-'}}</view>
</view>
</view>
</scroll-view>
<view class="sm-venue">
<view class="sv-time-interval">
<view class="sti-item"></view>
<view class="sti-item" v-for="i in 10" :key="i">{{i}}:00</view>
<view class="sti-item" v-for="(e,i) in venueList[0].items" :key="i">{{e.duration || '-'}}</view>
</view>
<scroll-view class="sti-venue-list" enable-flex scroll-x>
<view class="svl-list" v-for="i in 10" :key="i">
<view class="sl-item">1号馆</view>
<view class="sl-item" v-for="k in 10" :key="k">
<view class="svl-list" v-for="(e, i) in venueList" :key="i">
<view class="sl-item">{{e.name || '-'}}</view>
<view class="sl-item" v-for="(k,j) in e.items" :key="j" @click="venueSelect(i,j)">
<view
:class="[
k%2==0?'grey':
i%3==1?'green':
k%3==2?'black':''
k._isSelect?'green':
k.is_valid?'':'grey'
]"
>¥80</view>
>{{k.is_valid?`¥${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-selected-section">
<view class="sss-bar">
<view>已选择场次<text>4</text></view>
<view>清空</view>
<view @click="clearSelectedList">清空</view>
</view>
<scroll-view class="sss-list" scroll-y>
<view class="sl-item" v-for="i in 8" :key="i">
<view class="si-time">10:00-11:00</view>
<view class="si-name">4号馆</view>
<view class="sl-item" v-for="(e,i) in selectedVenueList" :key="i">
<view class="si-time">{{e.time || '-'}}</view>
<view class="si-name">{{e.parentObj.name || '-'}}</view>
</view>
</scroll-view>
</view>
<view class="sfb-tip-list">
</block>
<view class="sfb-tip-list" v-else>
<view class="stl-item" v-for="(e,i) in ['可预订','已售完','已占用','已选择']" :key="i">
<view></view>
<view>{{e}}</view>
@ -75,11 +83,155 @@
</template>
<script>
import { API } from '../../../js/api';
import { servers } from '../../../js/server';
import util from '../../../utils/util'
export default {
data(){
return {
storeList: [],
curStoreInfo: {},
typeList: [],
curTypeInfo: {},
venueList: [],
dateList: [],
curDateInfo: {},
selectedVenueList: [],
}
},
computed: {
},
async onLoad(){
try {
let _storeInfo = await this.getStoreList();
let _storeList = _storeInfo.list || [];
if(!_storeList.length)return util.showNone('没有店铺信息!');
this.storeList = _storeList ;
let _curStore = _storeList[0] || {};
this.curStoreInfo = _curStore;
let _typeInfo = await this.getClassify({ stadium_id: _curStore.id });
let _typeList = _typeInfo || [];
this.typeList = _typeList;
if(!_typeList.length)return util.showNone('没有球类信息!');
let _curType = _typeList[0];
this.curTypeInfo = _curType;
let _dateArr = this.getDateList({}) || [];
this.dateList = _dateArr;
this.curDateInfo = _dateArr[0] || {};
let _venueList = await this.getVenueList({
type_key: _curType.key,
stadium_id: _curStore.id,
date: _dateArr[0].dateStr,
})
if(!_venueList.length)return util.showNone('没有场地信息!')
this.venueList = _venueList || [];
console.log(_venueList)
console.log(this.getDateList({}))
return
}catch(err){
console.warn('加载失败----->', err)
}
},
methods: {
//
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() || [];
})
},
//
venueSelect(i,j){
let { venueList } = this;
let _venueList = venueList.slice();
let _curTarget = _venueList[i].items[j]
if(!_curTarget.is_valid)return;
_venueList[i].items[j]._isSelect = !_curTarget;
this.$nextTick(_=>{
this.$forceUpdate();
this.selectedVenueList = this.getSelectedVenues() || [];
})
},
//
getSelectedVenues(){
let { venueList } = this;
let _arr = [];
venueList.forEach((e,i)=>{
e.items.forEach((el,idx)=>{
let { items, ...parentObj } = e;
if(el._isSelect)_arr.push({ parentObj, ...el });
})
})
return _arr;
},
// tab
dateChange(e){
this.curDateInfo = e;
},
// 7
getDateList({ dateTimeStamp = new Date().getTime(), length = 7 }){
let _dayTimeStamp = 24*60*60*1000;
return new Array(length).fill(1).map((e,i)=>{
let _curStamp = dateTimeStamp + (i*_dayTimeStamp);
return {
showDateStr: util.formatDate({date: _curStamp, partition: 'zh'}).substr(5),
dateStr: util.formatDate({date: _curStamp}),
ZhDateStr: util.formatDate({date: _curStamp, partition: 'zh'}),
dayStr: util.get_zh_day(_curStamp),
}
})
},
//
storePickerChange(e){
let { storeList } = this;
this.curStoreInfo = storeList[e.detail.value];
console.log(e)
},
typePckerChange(e){
console.log(e)
let { typeList } = this;
this.curTypeInfo = typeList[e.detail.value];
},
toOrderConfirm(){
let { selectedVenueList } = this;
if(!selectedVenueList.length)return;
util.routeTo(`/pages/site/confirm/confirm`, 'nT');
},
//
getVenueList({type_key,stadium_id,date}){
return servers.get({
url: API.venue.venueList,
data: {stadium_id,type_key,date},
failMsg: '加载分类失败!'
})
},
//
getClassify({stadium_id}){
return servers.get({
url: API.venue.venueTypes,
data: {stadium_id},
failMsg: '加载分类失败!'
})
},
//
getStoreList(){
return servers.get({
url: API.stadiumList,
data: {},
failMsg: '加载店铺失败!'
})
}
}
}
@ -108,7 +260,6 @@ export default {
vertical-align: middle;
width: 24upx;
height: 24upx;
background-color: skyblue;
}
}
.sh-type{
@ -124,7 +275,6 @@ export default {
width: 24upx;
height: 24upx;
vertical-align: middle;
background-color: skyblue;
}
}
.st-tip{

BIN
src/static/images/icon/arrow_c33.png

After

Width: 24  |  Height: 24  |  Size: 599 B

2
src/subpackage/device/pages/coffee_test/coffee_test.vue

@ -84,7 +84,7 @@ export default {
let { curTestInfo, temperatureType, curStoreInfo } = this;
util.showLoad();
let deviceInfo = await deviceServer.get({
url: deviceApi.hardwareInfo + curTestInfo.stadium_hardware_id,
url: deviceApi.hardwareInfo + curTestInfo.outlet,
data: {},
failMsg: '获取设备信息失败!'
})

Loading…
Cancel
Save