Commit 449025c4af5d3452e436f3a756c6b9ef0e6ea32a

Authored by vking
1 parent 31039a9f

fenli

... ... @@ -65,7 +65,8 @@
"pages/book/smsbatch/list",
"pages/book/smsbatch/result",
"pages/book/roomtype/roomtype",
"pages/book/b_reserve"
"pages/book/b_reserve",
"pages/book/common/newSellerLite"
]
}
],
... ...
var mta=require('mta-wechat-analysis')
var mta = require('mta-wechat-analysis')
var util = require('../../../utils/util.js')
var uri=require('../../../utils/uri.js')
var bookOrder=require('../../../utils/bookCommon.js')
var uri = require('../../../utils/uri.js')
var bookOrder = require('../../../utils/bookCommon.js')
import App from '../../../utils/api';
const {regeneratorRuntime} = global
Page({
data:{
isloading:false,
pagex:1,
pagey:10,
sort:null,
dateStr:'',
calendarMaskLoad:false,
calendarMask:false,
dayStyle:[
{ month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' },
{ month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' }
],
keywords:'',
sort:'',
form:{
time:-1,
},
timePickerArray:[
[],
[],
[],
],
speciallist:[],
ReservesCountMonth:[],
ReservesTotal:0,
timeStrLabel:bookOrder.timeStrLabel
data: {
isloading: false,
pagex: 1,
pagey: 10,
sort: null,
dateStr: '',
calendarMaskLoad: false,
calendarMask: false,
dayStyle: [
{month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5'},
{month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5'}
],
keywords: '',
sort: '',
form: {
time: -1,
},
sellerid:0,
indexOpt:null,
YYYY:'YYYY',
onLoad:async function(opt){
if(opt.rid){
this.reserveId=opt.rid
delete opt.rid
}
this.indexOpt=opt;
mta.Page.init({
"appID":"500667280",
"eventID":"500667287",
"statPullDownFresh":true,
"statShareApp":true,
"statReachBottom":true,
"lauchOpts":opt, //渠道分析
});
let d=new Date()/1000;
let dateStr=util.unixtoTime(d,'MM-DD DAY');
var radio=750/util.getsystem().windowWidth;
var contentHeight=util.getsystem().windowHeight-Math.ceil(120/radio)
if(opt.seller_id){
this.sellerid=opt.seller_id;
util.cache('sellerid',opt.seller_id)
util.cache('enter_params',opt)
App.Reserve.SellerInfo(opt)
}else{
this.sellerid=util.cache('sellerid');
}
//this.sellerid=opt.seller_id ? opt.seller_id : util.cache('sellerid');
let timePickerArray= await bookOrder.getDayTimeSpace();
let speciallist=[
{ date: util.unixtoTime(d,'YYYY-MM-DD'), background: '', text:'今 天' },
{ date: util.unixtoTime(d+86400,'YYYY-MM-DD'), background: '', text: '明 天' },
{ date: util.unixtoTime(d+86400*2,'YYYY-MM-DD'), background: '', text: '后 天' },
];
this.setData({
listHeight:contentHeight-Math.ceil(210/radio),
dateStr:dateStr,
timePickerArray: timePickerArray,
speciallist:speciallist,
})
//util.setBarTitle('预订本');
this.indexOpt=opt;
this.ReservesCountDay(util.unixtoTime(d,'YYYY-MM-DD'));
this.ReservesCountMonth(util.unixtoTime(d,'YYYY-MM'));
},
onShow:function(){
timePickerArray: [
[],
[],
[],
],
speciallist: [],
ReservesCountMonth: [],
ReservesTotal: 0,
timeStrLabel: bookOrder.timeStrLabel
},
sellerid: 0,
indexOpt: null,
YYYY: 'YYYY',
onLoad: async function (opt) {
if (opt.rid) {
this.reserveId = opt.rid
delete opt.rid
}
let enter_params=util.cache('enter_params')
if(enter_params && enter_params.hasNewLite){
opt.hasNewLite=1
}
this.indexOpt = opt;
mta.Page.init({
"appID": "500667280",
"eventID": "500667287",
"statPullDownFresh": true,
"statShareApp": true,
"statReachBottom": true,
"lauchOpts": opt, //渠道分析
});
let d = new Date() / 1000;
let dateStr = util.unixtoTime(d, 'MM-DD DAY');
var radio = 750 / util.getsystem().windowWidth;
var contentHeight = util.getsystem().windowHeight - Math.ceil(120 / radio)
if (opt.seller_id) {
this.sellerid = opt.seller_id;
util.cache('sellerid', opt.seller_id)
util.cache('enter_params', opt)
App.Reserve.SellerInfo(opt)
} else {
this.sellerid = util.cache('sellerid');
}
//this.sellerid=opt.seller_id ? opt.seller_id : util.cache('sellerid');
let timePickerArray = await bookOrder.getDayTimeSpace();
let speciallist = [
{date: util.unixtoTime(d, 'YYYY-MM-DD'), background: '', text: '今 天'},
{date: util.unixtoTime(d + 86400, 'YYYY-MM-DD'), background: '', text: '明 天'},
{date: util.unixtoTime(d + 86400 * 2, 'YYYY-MM-DD'), background: '', text: '后 天'},
];
this.setData({
listHeight: contentHeight - Math.ceil(210 / radio),
dateStr: dateStr,
timePickerArray: timePickerArray,
speciallist: speciallist,
})
//util.setBarTitle('预订本');
this.indexOpt = opt;
this.ReservesCountDay(util.unixtoTime(d, 'YYYY-MM-DD'));
this.ReservesCountMonth(util.unixtoTime(d, 'YYYY-MM'));
},
onShow: function () {
this.setData({
isloading: false,
})
this.getbooklist();
this.selectComponent('#nav').init();
setTimeout(() => {
this.setData({
isloading:false,
calendarMaskLoad: true,
})
this.getbooklist();
this.selectComponent('#nav').init();
setTimeout(()=>{
this.setData({
calendarMaskLoad:true,
})
let openid=getApp().openid;
if(openid && this.indexOpt.seller_id){
App.Reserve.SellerForOpenid({openid:openid,sedata:JSON.stringify(this.indexOpt)})
//客户经理=>人人都是客户经理
//if(this.indexOpt.manager_id){
App.Reserve.UpdateSellerUser({seat_openid:openid,kid:this.indexOpt.manager_id});
//}
}else{
console.log('index-opt',openid,this.indexOpt);
}
},1000);
if(this.reserveId){
let url='./b_detail?id='+this.reserveId
this.reserveId=''
return wx.navigateTo({
url:url
})
}
},
async getbooklist(isExport=false){
let time=0;
if(this.data.form.time<0){
let sid=await bookOrder.getTimeSpaceIndexData();
time=sid.timeIndex
}else{
time=this.data.form.time;
let openid = getApp().openid;
if (openid && this.indexOpt.seller_id) {
App.Reserve.SellerForOpenid({openid: openid, sedata: JSON.stringify(this.indexOpt)})
//客户经理=>人人都是客户经理
//if(this.indexOpt.manager_id){
App.Reserve.UpdateSellerUser({seat_openid: openid, kid: this.indexOpt.manager_id});
//}
} else {
console.log('index-opt', openid, this.indexOpt);
}
var formdata={};
if(this.data.sort!=''){
formdata.sort=this.data.sort
}
if(this.data.keywords!=''){
formdata.keywords=this.data.keywords
}
formdata.sid=this.sellerid;
formdata.x=1;
formdata.y=200;
let rdate=await bookOrder.getTimeSpace(this.data.dateStr,time,null,null,this.YYYY);
formdata.rdate=rdate;
if(isExport){
this.__exportFile(formdata);
}else{
var that=this;
App.Reserve.GetReserveList(formdata).then(function(json){
console.log(json)
if(json.ret==200){
that.setData({
isloading:true,
bookList:json.data.length==0 ? null : json.data,
form:{time:time},
})
that.boolists=that.selectAllComponents('.orderbook');
that.boolists.forEach(function(v,i){
v.changeitem();
})
}
}).catch(e=>{})
}
},
timeorder:function(){
if(this.data.sort==''){
this.data.sort=1;
}else{
this.data.sort='';
}
this.setData({
sort:this.data.sort
})
this.getbooklist();
},
searchinput:function(e){
this.data.keywords=e.detail.value;
this.setData({
keywords:this.data.keywords
})
if(e.detail.value==''){
this.getbooklist();
}, 1000);
if (!this.indexOpt.hasNewLite) {//没有登陆过新商户
let url = './common/newSellerLite'
return wx.redirectTo({
url: url
})
}
if (this.reserveId) {
let url = './b_detail?id=' + this.reserveId
this.reserveId = ''
return wx.navigateTo({
url: url
})
}
},
async getbooklist(isExport = false) {
let time = 0;
if (this.data.form.time < 0) {
let sid = await bookOrder.getTimeSpaceIndexData();
time = sid.timeIndex
} else {
time = this.data.form.time;
}
var formdata = {};
if (this.data.sort != '') {
formdata.sort = this.data.sort
}
if (this.data.keywords != '') {
formdata.keywords = this.data.keywords
}
formdata.sid = this.sellerid;
formdata.x = 1;
formdata.y = 200;
let rdate = await bookOrder.getTimeSpace(this.data.dateStr, time, null, null, this.YYYY);
formdata.rdate = rdate;
if (isExport) {
this.__exportFile(formdata);
} else {
var that = this;
App.Reserve.GetReserveList(formdata).then(function (json) {
console.log(json)
if (json.ret == 200) {
that.setData({
isloading: true,
bookList: json.data.length == 0 ? null : json.data,
form: {time: time},
})
that.boolists = that.selectAllComponents('.orderbook');
that.boolists.forEach(function (v, i) {
v.changeitem();
})
}
},
calendarShow(){
console.log('xxxxx')
this.setData({
calendarMask:true
})
console.log(this.data.calendarMask)
},
dateChange(event){
this.YYYY=event.detail.date.substr(0,4);
let cktime=util.timetouUnix(event.detail.date)
console.log('cktime',cktime,this.YYYY)
let clickDay = event.detail.date.substr(8,2);
let changeDay = `dayStyle[1].day`;
let changeBg = `dayStyle[1].background`;
this.setData({
dateStr:util.unixtoTime(cktime,'MM-DD `DAY/周WW`'),
[changeDay]: clickDay,
[changeBg]: "#84e7d0"
}).catch(e => {
})
}
},
timeorder: function () {
if (this.data.sort == '') {
this.data.sort = 1;
} else {
this.data.sort = '';
}
this.setData({
sort: this.data.sort
})
this.getbooklist();
},
searchinput: function (e) {
this.data.keywords = e.detail.value;
this.setData({
keywords: this.data.keywords
})
if (e.detail.value == '') {
this.getbooklist();
this.calendarClose();
this.ReservesCountDay(event.detail.date);
},
calendarClose(){
this.setData({
calendarMask:false
})
},
selectedValue:function (e) {
this.setData({
form:{time:e.currentTarget.dataset.value}
})
this.getbooklist();
},
searchbook:function(e){
console.log(this.data.form)
this.getbooklist();
},
__exportFile(formdata){
App.Reserve.ExportReserve(formdata).then(res=>{
let url=res.data;
if(!url){
return util.toast('没有预订数据','none')
}
},
calendarShow() {
console.log('xxxxx')
this.setData({
calendarMask: true
})
console.log(this.data.calendarMask)
},
dateChange(event) {
this.YYYY = event.detail.date.substr(0, 4);
let cktime = util.timetouUnix(event.detail.date)
console.log('cktime', cktime, this.YYYY)
let clickDay = event.detail.date.substr(8, 2);
let changeDay = `dayStyle[1].day`;
let changeBg = `dayStyle[1].background`;
this.setData({
dateStr: util.unixtoTime(cktime, 'MM-DD `DAY/周WW`'),
[changeDay]: clickDay,
[changeBg]: "#84e7d0"
})
this.getbooklist();
this.calendarClose();
this.ReservesCountDay(event.detail.date);
},
calendarClose() {
this.setData({
calendarMask: false
})
},
selectedValue: function (e) {
this.setData({
form: {time: e.currentTarget.dataset.value}
})
this.getbooklist();
},
searchbook: function (e) {
console.log(this.data.form)
this.getbooklist();
},
__exportFile(formdata) {
App.Reserve.ExportReserve(formdata).then(res => {
let url = res.data;
if (!url) {
return util.toast('没有预订数据', 'none')
}
wx.downloadFile({
url: url,
success: function(res) {
success: function (res) {
const filePath = res.tempFilePath;
console.log('filePath',filePath);
console.log('filePath', filePath);
wx.previewImage({
current: filePath,
urls: [filePath]
})
wx.saveImageToPhotosAlbum({
filePath:filePath,
fail (res) {
util.toast('保存失败','none')
filePath: filePath,
fail(res) {
util.toast('保存失败', 'none')
}
})
}
... ... @@ -234,51 +246,51 @@ Page({
});
},
exportFile(){
exportFile() {
this.getbooklist(true);
},
ReservesCountDay(day){
ReservesCountDay(day) {
App.Reserve.ReservesCountDay({
sid:this.sellerid,
day:day
}).then(res=>{
sid: this.sellerid,
day: day
}).then(res => {
let ReservesTotal=0;
let ReservesCountDay={};
if(res.ret==200){
ReservesCountDay=res.data;
Object.keys(res.data).forEach(k=>{
if(res.data[k]!=-1){
ReservesTotal+=parseInt(res.data[k])
let ReservesTotal = 0;
let ReservesCountDay = {};
if (res.ret == 200) {
ReservesCountDay = res.data;
Object.keys(res.data).forEach(k => {
if (res.data[k] != -1) {
ReservesTotal += parseInt(res.data[k])
}
})
}
this.setData({
ReservesTotal:ReservesTotal,
ReservesCountDay:ReservesCountDay,
ReservesTotal: ReservesTotal,
ReservesCountDay: ReservesCountDay,
})
})
},
ReservesCountMonth(month){
ReservesCountMonth(month) {
App.Reserve.ReservesCountMonth({
sid:this.sellerid,
month:month
}).then(res=>{
let ReservesCountMonth=[];
if(res.ret==200){
res.data.forEach(v=>{
ReservesCountMonth.push(v>=1?1:0)
sid: this.sellerid,
month: month
}).then(res => {
let ReservesCountMonth = [];
if (res.ret == 200) {
res.data.forEach(v => {
ReservesCountMonth.push(v >= 1 ? 1 : 0)
})
}
this.setData({
ReservesCountMonth:ReservesCountMonth,
ReservesCountMonth: ReservesCountMonth,
})
})
},
clickMonth(e){
this.ReservesCountMonth(e.detail.currentYear+'-'+e.detail.currentMonth);
clickMonth(e) {
this.ReservesCountMonth(e.detail.currentYear + '-' + e.detail.currentMonth);
},
gotoday(e){
this.ReservesCountMonth(e.detail.date.substr(0,7));
gotoday(e) {
this.ReservesCountMonth(e.detail.date.substr(0, 7));
}
})
\ No newline at end of file
... ...
// pack-book/pages/book/common/newSellerLite.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle":"black",
"usingComponents": {
"nav":"/components/nav/nav"
}
}
\ No newline at end of file
... ...
<!--pack-book/pages/book/common/newSellerLite.wxml-->
<nav>周到商户</nav>
<view class="pages flex-vc">
<view style="font-size: 20px; margin-top: 60px;">升级了商户,将获得如下收益</view>
<view>1. 稳定的商户服务</view>
<view>2. 独立私有商户服务</view>
<view>3. 更加精准化统计及营销策略</view>
<view style="font-size: 20px; margin-top: 60px;">你只需这样操作</view>
<view>1. 进入商户</view>
<view>2. 完成授权登录</view>
<view>3. 通过商户预定本回到预订安排</view>
<button style="margin-top: 100px; width: 90%"
type="primary" size="{{primarySize}}" loading="{{loading}}" plain="{{plain}}"
disabled="{{disabled}}" bindtap="primary"> 进入商户 </button>
</view>
... ...
/* pack-book/pages/book/common/newSellerLite.wxss */
\ No newline at end of file
... ...