Commit 1bec4f9935326be18474e6669656a9116ffdc826

Authored by vking
1 parent 5a1608c0

chatbot & qiang

// components/reserve/room/qiang.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
display:false,
},
/**
* 组件的方法列表
*/
methods: {
show(params){
console.log('qiang.show',params)
this.setData({
display:true,
params:params,
})
},
hide(){
this.setData({
display:false,
})
},
}
})
... ...
{
"component": true,
"usingComponents": {
"chatbot":"/components/userinfo/chatbot"
}
}
\ No newline at end of file
... ...
<!--components/reserve/room/qiang.wxml-->
<view class="mask" bindtap="hide" wx:if="{{display}}">
<view class="dialog">
<view class="flex-lr header">
<view></view>
<view class="title Medium">温馨提示</view>
<view class="close-x"></view>
</view>
<view class="content flex-vc" catchtap="catchtap">
<view class="info">
<view>1、包间状态会实时更新,目前该类型包间紧张,需帮忙抢订;</view>
<view>2、周到安排拥有全市包间资源,可为您推荐更多优质餐厅。</view>
</view>
<chatbot params="{{params}}">
<view class="button flex-cc">帮我<view class="qiang"></view>订</view>
</chatbot>
</view>
</view>
</view>
... ...
/* components/reserve/room/qiang.wxss */
@import "../../../app.wxss";
.dialog{
position: fixed;
bottom: 0;
width: 100%;
background: #FFFFFF;
border-radius: 40rpx 40rpx 0rpx 0rpx;
}
.header{
width: calc(100% - 84rpx);
margin: 48rpx 42rpx 0;
}
.title{
height: 44rpx;
font-size: 32rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #353535;
line-height: 44rpx;
}
.button{
width: 336rpx;
height: 80rpx;
background: #242320;
font-size: 34rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
line-height: 80rpx;
text-align: center;
margin-top: 80rpx;
}
.content{
padding: 60rpx;
font-size: 32rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #353535;
line-height: 44rpx;
}
.qiang{
background-image: url("http://nosqn.colorcun.com/qiang2.png");
background-size: 100% 100%;
width: 48rpx;
height: 48rpx;
margin-right: 6rpx;
margin-left: 6rpx;
}
\ No newline at end of file
... ...
... ... @@ -68,6 +68,14 @@ Component({
if(this.data.usecondition=='custom'){
console.log('custom:true为点击了订满的包间类型',this.data.roomlist[_target.index].isorderFull==1 || this.data.roomlist[_target.index].isFull==1)
if(this.data.roomlist[_target.index].isorderFull==1 || this.data.roomlist[_target.index].isFull==1){
let obj={
act:'reserve',
seller:this.data.seller.sellername,
date:this.data.date,
section:this.data.section,
room:this.data.roomlist[_target.index].name
}
this.selectComponent('#qiang').show(obj);
}else{
console.log('执行了选中包间类型');
if((this.data.seletroomlist && this.data.seletroomlist.length<3) || !this.data.seletroomlist){
... ...
{
"component": true,
"usingComponents": {
"qiang":"./qiang"
}
}
\ No newline at end of file
... ...
<view class="room-list flex-rs">
<block wx:for="{{roomlist}}" wx:key="{{index}}">
<block wx:if="{{item.status==1}}">
<view class="room-item black-font {{(item.isFull && item.isFull==1) || (item.isorderFull && item.isorderFull==1) ? 'border-gray bg-gray' : 'border-yellow bg-yellow'}} flex-vl" style="justify-content:center;" data-id="{{item.id}}" data-index="{{index}}" data-selectnum="{{item.selectnum ? item.selectnum : 0}}" data-fid="{{item.fid ? item.fid : null}}" catchtap="selectroom">
<view class="room-item black-font {{((item.isFull && item.isFull==1) || (item.isorderFull && item.isorderFull==1)) && false ? 'border-gray bg-gray' : 'border-yellow bg-yellow'}} flex-vl" style="justify-content:center;" data-id="{{item.id}}" data-index="{{index}}" data-selectnum="{{item.selectnum ? item.selectnum : 0}}" data-fid="{{item.fid ? item.fid : null}}" catchtap="selectroom">
<view class="font30r font-bold" style="width:100%;padding-right:62rpx;box-sizing:border-box; block;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{{item.name}}</view>
<block wx:if="{{item.max && item.max!=0}}">
<view class="font24r room-more">最多可坐{{item.max}}人</view>
... ... @@ -20,12 +20,18 @@
<view class="room-full black-font font24r">订满</view>
</block>
</block>
<block wx:else>
<block wx:elif="{{false}}">
<block wx:if="{{(item.isFull && item.isFull==1) || (item.isorderFull && item.isorderFull==1)}}">
<view class="room-full black-font font24r">订满</view>
</block>
</block>
<block wx:else="">
<block wx:if="{{(item.isFull && item.isFull==1) || (item.isorderFull && item.isorderFull==1)}}">
<view class="room-full-qiang"></view>
</block>
</block>
</view>
</block>
</block>
</view>
\ No newline at end of file
</view>
<qiang id="qiang"></qiang>
\ No newline at end of file
... ...
... ... @@ -62,3 +62,12 @@
.room-select.gray{
background: #E0E0E0;
}
.room-full-qiang{
width: 56rpx;
height: 56rpx;
position: absolute;
right:0rpx;
bottom:0rpx;
background-size: 100% 100%;
background-image: url("http://nosqn.colorcun.com/qiang1.png");
}
\ No newline at end of file
... ...
// components/userinfo/chatbot.js
var plugin = requirePlugin("chatbot");
import util from '../../utils/util'
Component({
/**
* 组件的属性列表
*/
properties: {
params:Object,
},
/**
... ... @@ -28,7 +29,7 @@ Component({
openid: wechat.openid, // 小程序的openid,必填项
success: () => {
wx.navigateTo({
url: '/pages/me/chat'
url: util.http_build_query(this.data.params,'/pages/me/chat')
});
},
fail: (error) => {},
... ...
<!--pack-book/components/book/reserve/refuse.wxml-->
<wxs src="../../../../utils/util.wxs" module="util" />
<view class="mask" bindtap="hide" wx:if="{{true || display}}">
<view class="mask" bindtap="hide" wx:if="{{display}}">
<view class="dialog">
<view class="flex-lr header">
<view></view>
... ...
... ... @@ -73,7 +73,7 @@
width: 56rpx;
height: 56rpx;
background-size: 100% 100%;
background-color: #efefef;
background-image: url("http://nosqn.colorcun.com/qiang3.png");
margin-right: 10rpx;
}
.auto-info{
... ...
... ... @@ -94,7 +94,7 @@
</view>
<view class="flex-lr share-view-cookbook">
<chatbot class="share-but-view">
<view class="share-but flex-cc Medium">帮我<view class="qing"></view>订</view>
<view class="share-but flex-cc Medium">帮我<view class="qiang"></view>订</view>
</chatbot>
</view>
</block>
... ...
... ... @@ -336,7 +336,7 @@
margin-top: 60rpx;
}
.qing{
.qiang{
background-image: url("http://nosqn.colorcun.com/qiang2.png");
background-size: 100% 100%;
width: 48rpx;
... ...
... ... @@ -12,13 +12,15 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.options=options
console.log('chat.options',options)
var chat = plugin.getChatComponent();
chat.setTextToSpeech(false);
//chat.editFoucs(true);
return;
//return;
chat.send('人工服务')
setTimeout(()=>{
chat.send('maomao de mao')
chat.send(this.getMsg())
},300)
},
... ... @@ -49,5 +51,12 @@ Page({
onUnload: function () {
},
getMsg(){
switch (this.options.act){
//act: "reserve", seller: "陕西风味面馆", date: "2020-10-22", section: "night", room: "6人间"
case 'reserve'://预订的时候
return `预订:${this.options.seller}/${this.options.date} ${this.options.section}/${this.options.room}`
break;
}
}
})
\ No newline at end of file
... ...