Commit 3fcd83c5783f6f46890d9e605efe306b39cb8423

Authored by wangfan
1 parent ae8d53cc

manager-invitation

... ... @@ -33,9 +33,36 @@ Page({
this.pickerData=TP.pickerData();
let pd=TP.pickerData();
pd[2]=pd[2][this.data.pickerValue[1]];
if(options.rid){
}else{
App.Invitation.GetSellerList({
openid:getApp().openid
}).then(res=>{
if(res.data.length>0){
let defi=0;
for(let i=0;i<res.data.length;i++){
if(res.data[i].is_default==1){
defi=i;
break;
}
}
let sel=res.data[defi];
this.setData({
form:{
sid:sel.id,
name:sel.name,
addr:sel.address,
}
})
}
})
}
this.setData({
pickerData:pd,
tpl:this.tpl,
options:options,
})
},
... ... @@ -96,7 +123,8 @@ Page({
this.checkHasSubmit()
},
checkHasSubmit(){
let form=this.data.form
let form=this.data.form;
let flag=false;
if(
form.name
&& this.data.pickerValue[0]>-1
... ... @@ -104,14 +132,12 @@ Page({
&& form.addr
&& (!this.tpl.hasImage || (this.tpl.hasImage && form.image))//带图模板
){
this.setData({
hasSubmit:true
})
}else{
this.setData({
hasSubmit:false
})
flag=true;
}
this.setData({
hasSubmit:flag
})
return flag;
},
input(e){
let key=util.attr(e,'key');
... ... @@ -122,5 +148,38 @@ Page({
form:form,
})
this.checkHasSubmit()
}
},
getTimeStr(){
let d=new Date();
let y=d.getFullYear();
let md=this.data.pickerData[0][this.data.pickerValue[0]].substr(0,5);
let t=this.data.pickerData[2][this.data.pickerValue[2]];
return util.timetouUnix(y+'-'+md+' '+t+':00');
},
submit(){
if(!this.checkHasSubmit()){
return util.toast('请完善信息',none)
}
let opt=this.data.options
let param={
openid:getApp().openid,
template_id:opt.tplid,
sid:this.data.form.sid,
sname:this.data.form.name,
seller_address:this.data.form.addr,
room_name:this.data.form.room,
arrival_time:this.getTimeStr(),
}
if(opt.rid){
param.id=opt.rid
}
App.Invitation.SetInvitationInfo(param).then(res=>{
wx.redirectTo({
url:util.http_build_query({
rid:res.data.id,
...this.data.options,
},'./review')
})
})
},
})
\ No newline at end of file
... ...
... ... @@ -28,6 +28,25 @@ Page({
this.setData({
dots:dots,
})
App.Invitation.UserIdentity({
openid:getApp().openid
}).then(res=>{
if(res.ret==200){
if(res.data.identity==1){
// wx.reLaunch({
// url:'/pages/customer/index'
// })
// return;
}
if(res.data.identity==2){
wx.redirectTo({
url:'/pages/manager-invitation/review'
})
}
}else{
util.toast(res.msg)
}
})
},
/**
... ... @@ -79,8 +98,16 @@ Page({
},
userinfo(){
wx.redirectTo({
url:'./review'
});
let us=util.cache('userInfo');
App.Invitation.AddInvitationUser({
openid:getApp().openid,
avatar:us.avatarUrl,
nickname:us.nickName,
gender:us.gender,
}).then(res=>{
wx.redirectTo({
url:'./review'
});
})
},
})
\ No newline at end of file
... ...
... ... @@ -17,16 +17,52 @@ Page({
room:'天香阁',
date:util.unixtoTime(new Date()/1000,'YYYY/MM/DD 星期WW HH:II'),
addr:'粤江西路啤酒文化创意艺术区B09'
}
},
options:{},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let param={
options:options,
}
if(options.rid){
param.tpls=[TP.tpls(options.tplid)]
}
this.setData(param)
this.initData(options);
},
initData(options){
if(options.rid){
}else{
App.Invitation.GetSellerList({
openid:getApp().openid
}).then(res=>{
if(res.data.length>0){
let defi=0;
for(let i=0;i<res.data.length;i++){
if(res.data[i].is_default==1){
defi=i;
break;
}
}
let sel=res.data[defi];
this.setData({
seller:{
name:sel.name,
room:'',
date:util.unixtoTime(new Date()/1000,this.data.tpls[this.data.current].timeStr),
addr:sel.address
}
})
}
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
... ... @@ -102,8 +138,12 @@ Page({
})
},
goEditor(){
let param={
...this.data.options,
tplid:this.data.tpls[this.data.current].id,
}
wx.navigateTo({
url:'./editor?tplid='+this.data.tpls[this.data.current].id
url:util.http_build_query(param,'./editor')
})
},
})
\ No newline at end of file
... ...
... ... @@ -15,7 +15,7 @@
</swiper-item>
</block>
</swiper>
<view
<view wx:if="{{!options.rid}}"
class="flex-vc"
style="position:fixed;top:{{statusBarHeight}}px;left:0;height: {{titleBarHeight}}px; line-height: {{titleBarHeight}}px;">
<view class="tabs flex-ll">
... ... @@ -24,13 +24,13 @@
</block>
</view>
</view>
<view class="editor flex-vc" bindtap="goEditor">修改内容</view>
<view class="editor flex-vc" bindtap="goEditor" wx:if="{{!options.rid}}">修改内容</view>
<!--//商务-->
<template name="tpl-1">
<view class="flex-vc shangwu">
<view class="invit-logo">
<image src="http://qn.colorcun.com/custom/lite-yd-cook/image/detail_owner_invitation-1-1.png"></image>
<view class="quick-editor">修改内容</view>
<view class="quick-editor" wx:if="{{options.rid}}">修改内容</view>
</view>
<view class="seller flex-vc">
<view class="title">餐厅</view>
... ... @@ -45,7 +45,7 @@
{{addr}}第三方斯蒂芬
</view>
</view>
<userinfo-share class="button-none flex-vc" binduserinfo="setUserInfoSuccess">
<userinfo-share class="button-none flex-vc" binduserinfo="setUserInfoSuccess" wx:if="{{options.rid}}">
<view class="buts-share"></view>
</userinfo-share>
</view>
... ... @@ -58,7 +58,7 @@
<view class="flex-vc wenxin">
<view class="invit-logo">
<image src="http://qn.colorcun.com/manager-invitation/wx/%E6%B8%A9%E9%A6%A8-%E9%A2%84%E8%AE%A2%E5%AE%89%E6%8E%92.png"></image>
<view class="quick-editor">修改内容</view>
<view class="quick-editor" wx:if="{{options.rid}}">修改内容</view>
</view>
<view class="wenxin-mask">
<view class="wenxin-mask-bg"></view>
... ... @@ -74,7 +74,7 @@
{{addr}}
</view>
</view>
<userinfo-share class="button-none flex-vc" binduserinfo="setUserInfoSuccess">
<userinfo-share class="button-none flex-vc" binduserinfo="setUserInfoSuccess" wx:if="{{options.rid}}">
<view class="buts-share"></view>
</userinfo-share>
</view>
... ...
... ... @@ -85,6 +85,7 @@ image{
margin-bottom: 152rpx;
}
.wenxin {
margin-top: 60rpx;
}
.wenxin-top{
... ...
... ... @@ -31,7 +31,7 @@
"list": []
},
"miniprogram": {
"current": 44,
"current": 43,
"list": [
{
"id": 0,
... ... @@ -358,17 +358,17 @@
"scene": null
},
{
"id": -1,
"id": 43,
"name": "pages/manager-invitation/review",
"pathName": "pages/manager-invitation/review",
"query": "id=154",
"query": "rid=4&tplid=1",
"scene": null
},
{
"id": 44,
"name": "pages/manager-invitation/editor",
"pathName": "pages/manager-invitation/editor",
"query": "tplid=2",
"query": "tplid=1",
"scene": null
}
]
... ...
... ... @@ -178,4 +178,26 @@ export default {
//顾客收藏的店铺列表
'App.Customer.GetCollectionSellerList':null,
/**
* 邀请函
*/
//根据订座的openid 获取当前用户身份
'App.Invitation.UserIdentity':null,
//增加客户经理基本信息
'App.Invitation.AddInvitationUser':null,
//获取商家列表
'App.Invitation.GetSellerList':{
//cachetime: -1,
},
//编辑、增加商家信息
'App.Invitation.SetSellerInfo':null,
//修改、录入邀请函信息,同时生成对应的商家信息
'App.Invitation.SetInvitationInfo':{
silence: false,
},
}
\ No newline at end of file
... ...
... ... @@ -5,12 +5,14 @@ let tpls=[
code: 1,
name: '商务',
hasImage:false,
timeStr:'YYYY/MM/DD 星期WW HH:II',
},
{
id: 2,
code: 2,
name: '温馨',
hasImage:true,
timeStr:'YYYY年MM月DD日HH时II分',
},
];
module.exports ={
... ...