Commit eabab85c4c17c609401a6713b8f3efa211e5b5e9

Authored by vking
1 parent 1f596c1f

online

... ... @@ -28,7 +28,8 @@
"pages/reserve/activity",
"pages/reserve/discount",
"pages/reserve/indexList",
"pages/reserve/share"
"pages/reserve/share",
"pages/reserve/submit"
],
"subpackages": [
{
... ...
// components/seller-card/seller-card.js
import util from '../../utils/util';
Component({
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
/**
* 组件的属性列表
*/
properties: {
seller:Object,
detail:{
type:Object,
value:{},
observer:function(){
console.log('observer',arguments);
this.init();
}
},
hasMaster:{ //预订人+手机
type:Boolean,
value:false
},
hasListShare:{ //首页列表的预订人+分享
type:Boolean,
value:false
},
hasShowStatus:{ //右上角显示状态
type:Boolean,
value:false
seller: Object,
detail: {
type: Object,
value: {},
observer: function () {
console.log('observer', arguments);
this.init();
}
},
hasMaster: { //预订人+手机
type: Boolean,
value: false
},
hasListShare: { //首页列表的预订人+分享
type: Boolean,
value: false
},
hasShowStatus: { //右上角显示状态
type: Boolean,
value: false
},
hasAddress: { //显示地址,默认显示
type: Boolean,
value: true
},
hasOnlineReserve:{ //是否为在线预订卡片
type: Boolean,
value: false
},
},
/**
* 组件的初始数据
*/
data: {
rdateStr:"",
tableSubInfo:"",
masterMan:"",
rdateStr: "",
tableSubInfo: "",
masterMan: "",
},
attached(){
attached() {
},
detached(){
},
detached() {
},
},
/**
* 组件的方法列表
*/
methods: {
init(){
if(this.data.detail && this.data.detail.ddate){
let masterMan=(this.data.detail.rname||'');
if(this.data.detail.phone){
masterMan+=' ('+
this.data.detail.phone
.replace(/([\d]{2}).*([\d]{4})/,function($0,$1,$2){
return $1+'*'+$2
})
+')';
}
let tableSubInfo=''
let tableFirst='';
if(this.data.detail.tableFirst){
tableSubInfo=(this.data.detail.tableFirst||'')+' '+(this.data.detail.tableSubInfo||'');
tableFirst=this.data.detail.tableFirst
}else{
tableFirst=this.data.detail.tables[0].name
tableSubInfo=this.data.detail.tables[0].name;
if(this.data.detail.tables.length>1){
tableSubInfo+=' 等'+(this.data.detail.tables.length)+'个'
+(this.data.detail.tables[0].tid==2?'包间':'');
tableFirst+='等';
}
}
let obj={
rdateStr:util.unixtoTime(this.data.detail.ddate,'MM月DD日 HH:II'),
tableSubInfo:tableSubInfo,
tableFirst:tableFirst,
masterMan:masterMan,
}
if(this.data.hasShowStatus){
let ns=new Date()/1000
obj.showStatusStr='已预订'
if(this.data.detail.status==4){
obj.showStatusStr='已取消'
}else if(this.data.detail.status>=2 || ns>this.data.detail.ddate){
obj.showStatusStr='已完成'
}
}
this.setData(obj)
init() {
if (this.data.detail && this.data.detail.ddate) {
let masterMan = (this.data.detail.rname || '');
if (this.data.detail.phone) {
masterMan += ' (' +
this.data.detail.phone
.replace(/([\d]{2}).*([\d]{4})/, function ($0, $1, $2) {
return $1 + '*' + $2
})
+ ')';
}
let tableSubInfo = ''
let tableFirst = '';
if (this.data.detail.tableFirst) {
tableSubInfo = (this.data.detail.tableFirst || '') + ' ' + (this.data.detail.tableSubInfo || '');
tableFirst = this.data.detail.tableFirst
} else {
tableFirst = this.data.detail.tables[0].name
tableSubInfo = this.data.detail.tables[0].name;
if (this.data.detail.tables.length > 1) {
tableSubInfo += ' 等' + (this.data.detail.tables.length) + '个'
+ (this.data.detail.tables[0].tid == 2 ? '包间' : '');
tableFirst += '等';
}
}
let obj = {
rdateStr: util.unixtoTime(this.data.detail.ddate, 'MM月DD日 HH:II'),
tableSubInfo: tableSubInfo,
tableFirst: tableFirst,
masterMan: masterMan,
}
if (this.data.hasShowStatus) {
let ns = new Date() / 1000
obj.showStatusStr = '已预订'
if (this.data.detail.status == 4) {
obj.showStatusStr = '已取消'
} else if (this.data.detail.status >= 2 || ns > this.data.detail.ddate) {
obj.showStatusStr = '已完成'
}
}
this.setData(obj)
}
},
lookLocation: function () {
//console.log(this.data.seller.lat,this.data.seller.long,this.data.detail.map_address)
wx.openLocation({
latitude: Number(this.data.seller.lat),
longitude: Number(this.data.seller.long),
scale: 17,
address: this.data.seller.map_address,
success: function (res) {
console.log(res)
}
})
},
lookLocation:function(){
//console.log(this.data.seller.lat,this.data.seller.long,this.data.detail.map_address)
wx.openLocation({
latitude:Number(this.data.seller.lat),
longitude:Number(this.data.seller.long),
scale:17,
address:this.data.seller.map_address,
success:function (res) {
console.log(res)
}
})
},
}
})
... ...
<!--components/seller-card/seller-card.wxml-->
<view class="card">
<view class="card {{hasOnlineReserve?'online':''}}">
<view class="seller flex-lr">
<view class="flex-ll">
<view class="avatar" wx:if="{{seller.seller_image}}">
<image src="{{seller.seller_image}}"></image>
</view>
<view class="name Medium">{{seller.sellername}}</view>
<view class="card-class name Medium">{{seller.sellername}}</view>
</view>
<view wx:if="{{hasShowStatus}}" style="font-size: 30rpx;">
{{showStatusStr}}
... ... @@ -25,7 +25,7 @@
<view class="value">{{tableFirst}}</view>
</view>
</view>
<view class="seller address flex-ll" catchtap="lookLocation">
<view class="seller address flex-ll" catchtap="lookLocation" wx:if="{{hasAddress}}">
<view class="gps-icon">
<image src="http://qn.colorcun.com/custom/lite-yd/image/gps-icon.png"></image>
</view>
... ...
... ... @@ -15,6 +15,7 @@
min-width: 60rpx;
border-radius: 50%;
margin-right: 20rpx;
overflow: hidden;
}
.seller .more{
width: 14rpx;
... ... @@ -31,7 +32,6 @@
font-size: 36rpx;
color:#AD7644;
}
.context{
background-color: #E6EBEE;
width: 100%;
... ... @@ -95,3 +95,13 @@
.opt{
padding-top: 0;
}
.online .seller .name{
color: #353535;
}
.online .context{
background-color: #F5F5F5;
}
.online .context .line{
background-color: #ECEBEB;
}
... ...
... ... @@ -83,5 +83,5 @@ Page({
user: this.user
})
}
}
},
})
\ No newline at end of file
... ...
// pages/reserve/submit.js
import util from '../../utils/util';
import App from '../../utils/api';
const _u = {
name: '',
sex: 1,
phone: '',
remark: '',
}
Page({
user: _u,
/**
* 页面的初始数据
*/
data: {
seller:null,
user:_u,
},
/**
* 生命周期函数--监听页面加载
*/
options:null,
onLoad: function (options) {
this.options=options
this.GetSellerDetail();
App.Customer.GetCustomerInfo().then(res=>{
this.user = res.data
this.setData({
user: res.data,
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
GetSellerDetail() {
let options = this.options
App.Customer.GetSellerDetail({
sid: options.sid,
}).then(res => {
if (res.ret == 200) {
let seller = res.data
this.setData({
seller: seller,
})
}
})
},
changeInput(e) {
let key = util.attr(e, 'key');
let val = ''
if (key == 'sex') {
val = util.attr(e, 'val');
} else {
val = util.val(e);
}
this.user[key] = val;
if (key == 'sex') {
this.setData({
user: this.user
})
}
},
saved() {
if(!this.user.name){
return util.toast('请填写姓名','none')
}
if(!this.user.phone){
return util.toast('请填写手机','none')
}
App.Customer.SetCustomerInfo({
...this.user
}).then(res=>{
App.Customer.GetCustomerInfo({},'clear')
wx.navigateBack()
})
},
})
\ No newline at end of file
... ...
{
"usingComponents": {
"nav":"/components/nav/nav",
"formids":"/components/formids/formids",
"card":"/components/seller-card/seller-card"
}
}
\ No newline at end of file
... ...
<!--pages/reserve/submit.wxml-->
<nav hasBack>预订详情</nav>
<view class="pages">
<card hasShowStatus hasAddress="{{false}}" hasOnlineReserve
seller="{{seller}}" detail="{{detail}}">
<view slot="opt" class="back flex-rr">
<formids
id="userinfo-share-{{detail.id}}"
binduserinfo="userinfo"
bindshare="share"
share="{{detail}}">
<view class="opt-button">修改</view>
</formids>
</view>
</card>
<view class="userinfo">
<view class="item flex-lr">
<view class="item-label">姓名</view>
<view class="Medium flex-rr">
<input class="name input" placeholder="请填写用餐人姓名"
bindinput="changeInput"
data-key="name"
value="{{user.name}}"
placeholder-class="input-pl" maxlength="4"/>
<view class="flex-rr switch">
<view
bindtap="changeInput"
data-key="sex"
data-val="1"
class="switch-item {{user.sex==1?'checked':''}}">先生</view>
<view
bindtap="changeInput"
data-key="sex"
data-val="2"
class="switch-item {{user.sex==2?'checked':''}}">女士</view>
<view
bindtap="changeInput"
data-key="sex"
data-val="3"
class="switch-item {{user.sex==3?'checked':''}}">公司</view>
</view>
</view>
</view>
<view class="item flex-lr">
<view class="item-label">手机</view>
<view class="Medium">
<input class="phone input" placeholder="请填写联系方式"
bindinput="changeInput"
data-key="phone"
type="number"
value="{{user.phone}}"
placeholder-class="input-pl"/>
</view>
</view>
<view class="item flex-lr">
<view class="item-label">备注</view>
<view class="Medium">
<input class="cusdem input" placeholder="您的特殊要求,我们会尽量安排(20字)"
bindinput="changeInput"
data-key="remark"
value="{{user.cusdem}}"
placeholder-class="input-pl" maxlength="20"/>
</view>
</view>
</view>
<formids bindclick="saved">
<view class="share-but">提交预订</view>
</formids>
</view>
... ...
/* pages/reserve/submit.wxss */
.pages{
padding: 30rpx;
width: calc(100% - 60rpx);
}
.back{
height: 120rpx;
line-height: 120rpx;
width: 100%;
}
.opt-button{
height: 40rpx;
width: 120rpx;
border: 2rpx solid #C0A369;
color: #C0A369;
text-align: center;
line-height: 40rpx;
font-size: 26rpx;
margin-right: 40rpx;
}
.userinfo{
font-size: 30rpx;
}
.item{
height: 124rpx;
line-height: 124rpx;
border-bottom: 2rpx solid #F5F5F5;
padding-top: 20rpx;
}
.item-label{
width: 100rpx;
min-width: 100rpx;
font-weight: bold;
}
.item view:last-child{
font-size: 34rpx;
}
.switch{
width: 252rpx;
height: 50rpx;
line-height: 50rpx;
border: 2rpx solid #C0A369;
margin-left: 16rpx;
font-size: 28rpx;
}
.Medium{
width: 100%;
}
.input{
width: 100%;
}
.switch .switch-item{
width: 84rpx;
height: 50rpx;
line-height: 50rpx;
text-align: center;
color: #C0A369;
border-right: 2rpx solid #C0A369;
}
.switch .switch-item:last-child{
border-width: 0;
}
.switch .checked{
background-color:#C0A369;
color: #FEFEFE;
}
.share-but{
color:#FEFEFE;
background: #262628;
width: 100%;
line-height: 80rpx;
font-size: 34rpx;
text-align: center;
margin-top: 160rpx;
}
.input-pl{
font-size: 28rpx;
}
\ No newline at end of file
... ...
... ... @@ -45,7 +45,7 @@
"list": []
},
"miniprogram": {
"current": 39,
"current": 55,
"list": [
{
"id": 0,
... ... @@ -455,6 +455,13 @@
"pathName": "pages/reserve/share",
"query": "id=1&act=quanzi",
"scene": null
},
{
"id": 55,
"name": "pages/reserve/submit",
"pathName": "pages/reserve/submit",
"query": "sid=1",
"scene": null
}
]
}
... ...