Commit 1bec4f9935326be18474e6669656a9116ffdc826

Authored by vking
1 parent 5a1608c0

chatbot & qiang

  1 +// components/reserve/room/qiang.js
  2 +Component({
  3 + /**
  4 + * 组件的属性列表
  5 + */
  6 + properties: {
  7 +
  8 + },
  9 +
  10 + /**
  11 + * 组件的初始数据
  12 + */
  13 + data: {
  14 + display:false,
  15 + },
  16 +
  17 + /**
  18 + * 组件的方法列表
  19 + */
  20 + methods: {
  21 + show(params){
  22 + console.log('qiang.show',params)
  23 + this.setData({
  24 + display:true,
  25 + params:params,
  26 + })
  27 + },
  28 + hide(){
  29 + this.setData({
  30 + display:false,
  31 + })
  32 + },
  33 + }
  34 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {
  4 + "chatbot":"/components/userinfo/chatbot"
  5 + }
  6 +}
  1 +<!--components/reserve/room/qiang.wxml-->
  2 +<view class="mask" bindtap="hide" wx:if="{{display}}">
  3 + <view class="dialog">
  4 + <view class="flex-lr header">
  5 + <view></view>
  6 + <view class="title Medium">温馨提示</view>
  7 + <view class="close-x"></view>
  8 + </view>
  9 + <view class="content flex-vc" catchtap="catchtap">
  10 + <view class="info">
  11 + <view>1、包间状态会实时更新,目前该类型包间紧张,需帮忙抢订;</view>
  12 + <view>2、周到安排拥有全市包间资源,可为您推荐更多优质餐厅。</view>
  13 + </view>
  14 + <chatbot params="{{params}}">
  15 + <view class="button flex-cc">帮我<view class="qiang"></view>订</view>
  16 + </chatbot>
  17 + </view>
  18 + </view>
  19 +</view>
  1 +/* components/reserve/room/qiang.wxss */
  2 +@import "../../../app.wxss";
  3 +.dialog{
  4 + position: fixed;
  5 + bottom: 0;
  6 + width: 100%;
  7 + background: #FFFFFF;
  8 + border-radius: 40rpx 40rpx 0rpx 0rpx;
  9 +}
  10 +.header{
  11 + width: calc(100% - 84rpx);
  12 + margin: 48rpx 42rpx 0;
  13 +}
  14 +.title{
  15 + height: 44rpx;
  16 + font-size: 32rpx;
  17 + font-family: PingFangSC-Medium, PingFang SC;
  18 + font-weight: 500;
  19 + color: #353535;
  20 + line-height: 44rpx;
  21 +}
  22 +.button{
  23 + width: 336rpx;
  24 + height: 80rpx;
  25 + background: #242320;
  26 + font-size: 34rpx;
  27 + font-family: PingFangSC-Regular, PingFang SC;
  28 + font-weight: 400;
  29 + color: #FFFFFF;
  30 + line-height: 80rpx;
  31 + text-align: center;
  32 + margin-top: 80rpx;
  33 +}
  34 +.content{
  35 + padding: 60rpx;
  36 + font-size: 32rpx;
  37 + font-family: PingFangSC-Regular, PingFang SC;
  38 + font-weight: 400;
  39 + color: #353535;
  40 + line-height: 44rpx;
  41 +}
  42 +.qiang{
  43 + background-image: url("http://nosqn.colorcun.com/qiang2.png");
  44 + background-size: 100% 100%;
  45 + width: 48rpx;
  46 + height: 48rpx;
  47 + margin-right: 6rpx;
  48 + margin-left: 6rpx;
  49 +}
@@ -68,6 +68,14 @@ Component({ @@ -68,6 +68,14 @@ Component({
68 if(this.data.usecondition=='custom'){ 68 if(this.data.usecondition=='custom'){
69 console.log('custom:true为点击了订满的包间类型',this.data.roomlist[_target.index].isorderFull==1 || this.data.roomlist[_target.index].isFull==1) 69 console.log('custom:true为点击了订满的包间类型',this.data.roomlist[_target.index].isorderFull==1 || this.data.roomlist[_target.index].isFull==1)
70 if(this.data.roomlist[_target.index].isorderFull==1 || this.data.roomlist[_target.index].isFull==1){ 70 if(this.data.roomlist[_target.index].isorderFull==1 || this.data.roomlist[_target.index].isFull==1){
  71 + let obj={
  72 + act:'reserve',
  73 + seller:this.data.seller.sellername,
  74 + date:this.data.date,
  75 + section:this.data.section,
  76 + room:this.data.roomlist[_target.index].name
  77 + }
  78 + this.selectComponent('#qiang').show(obj);
71 }else{ 79 }else{
72 console.log('执行了选中包间类型'); 80 console.log('执行了选中包间类型');
73 if((this.data.seletroomlist && this.data.seletroomlist.length<3) || !this.data.seletroomlist){ 81 if((this.data.seletroomlist && this.data.seletroomlist.length<3) || !this.data.seletroomlist){
1 { 1 {
2 "component": true, 2 "component": true,
3 "usingComponents": { 3 "usingComponents": {
  4 + "qiang":"./qiang"
4 } 5 }
5 } 6 }
1 <view class="room-list flex-rs"> 1 <view class="room-list flex-rs">
2 <block wx:for="{{roomlist}}" wx:key="{{index}}"> 2 <block wx:for="{{roomlist}}" wx:key="{{index}}">
3 <block wx:if="{{item.status==1}}"> 3 <block wx:if="{{item.status==1}}">
4 - <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"> 4 + <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">
5 <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> 5 <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>
6 <block wx:if="{{item.max && item.max!=0}}"> 6 <block wx:if="{{item.max && item.max!=0}}">
7 <view class="font24r room-more">最多可坐{{item.max}}人</view> 7 <view class="font24r room-more">最多可坐{{item.max}}人</view>
@@ -20,12 +20,18 @@ @@ -20,12 +20,18 @@
20 <view class="room-full black-font font24r">订满</view> 20 <view class="room-full black-font font24r">订满</view>
21 </block> 21 </block>
22 </block> 22 </block>
23 - <block wx:else> 23 + <block wx:elif="{{false}}">
24 <block wx:if="{{(item.isFull && item.isFull==1) || (item.isorderFull && item.isorderFull==1)}}"> 24 <block wx:if="{{(item.isFull && item.isFull==1) || (item.isorderFull && item.isorderFull==1)}}">
25 <view class="room-full black-font font24r">订满</view> 25 <view class="room-full black-font font24r">订满</view>
26 </block> 26 </block>
27 </block> 27 </block>
  28 + <block wx:else="">
  29 + <block wx:if="{{(item.isFull && item.isFull==1) || (item.isorderFull && item.isorderFull==1)}}">
  30 + <view class="room-full-qiang"></view>
  31 + </block>
  32 + </block>
28 </view> 33 </view>
29 </block> 34 </block>
30 </block> 35 </block>
31 -</view>  
  36 +</view>
  37 +<qiang id="qiang"></qiang>
@@ -62,3 +62,12 @@ @@ -62,3 +62,12 @@
62 .room-select.gray{ 62 .room-select.gray{
63 background: #E0E0E0; 63 background: #E0E0E0;
64 } 64 }
  65 +.room-full-qiang{
  66 + width: 56rpx;
  67 + height: 56rpx;
  68 + position: absolute;
  69 + right:0rpx;
  70 + bottom:0rpx;
  71 + background-size: 100% 100%;
  72 + background-image: url("http://nosqn.colorcun.com/qiang1.png");
  73 +}
1 // components/userinfo/chatbot.js 1 // components/userinfo/chatbot.js
2 var plugin = requirePlugin("chatbot"); 2 var plugin = requirePlugin("chatbot");
  3 +import util from '../../utils/util'
3 Component({ 4 Component({
4 /** 5 /**
5 * 组件的属性列表 6 * 组件的属性列表
6 */ 7 */
7 properties: { 8 properties: {
8 - 9 + params:Object,
9 }, 10 },
10 11
11 /** 12 /**
@@ -28,7 +29,7 @@ Component({ @@ -28,7 +29,7 @@ Component({
28 openid: wechat.openid, // 小程序的openid,必填项 29 openid: wechat.openid, // 小程序的openid,必填项
29 success: () => { 30 success: () => {
30 wx.navigateTo({ 31 wx.navigateTo({
31 - url: '/pages/me/chat' 32 + url: util.http_build_query(this.data.params,'/pages/me/chat')
32 }); 33 });
33 }, 34 },
34 fail: (error) => {}, 35 fail: (error) => {},
1 <!--pack-book/components/book/reserve/refuse.wxml--> 1 <!--pack-book/components/book/reserve/refuse.wxml-->
2 <wxs src="../../../../utils/util.wxs" module="util" /> 2 <wxs src="../../../../utils/util.wxs" module="util" />
3 -<view class="mask" bindtap="hide" wx:if="{{true || display}}"> 3 +<view class="mask" bindtap="hide" wx:if="{{display}}">
4 <view class="dialog"> 4 <view class="dialog">
5 <view class="flex-lr header"> 5 <view class="flex-lr header">
6 <view></view> 6 <view></view>
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 width: 56rpx; 73 width: 56rpx;
74 height: 56rpx; 74 height: 56rpx;
75 background-size: 100% 100%; 75 background-size: 100% 100%;
76 - background-color: #efefef; 76 + background-image: url("http://nosqn.colorcun.com/qiang3.png");
77 margin-right: 10rpx; 77 margin-right: 10rpx;
78 } 78 }
79 .auto-info{ 79 .auto-info{
@@ -94,7 +94,7 @@ @@ -94,7 +94,7 @@
94 </view> 94 </view>
95 <view class="flex-lr share-view-cookbook"> 95 <view class="flex-lr share-view-cookbook">
96 <chatbot class="share-but-view"> 96 <chatbot class="share-but-view">
97 - <view class="share-but flex-cc Medium">帮我<view class="qing"></view>订</view> 97 + <view class="share-but flex-cc Medium">帮我<view class="qiang"></view>订</view>
98 </chatbot> 98 </chatbot>
99 </view> 99 </view>
100 </block> 100 </block>
@@ -336,7 +336,7 @@ @@ -336,7 +336,7 @@
336 336
337 margin-top: 60rpx; 337 margin-top: 60rpx;
338 } 338 }
339 -.qing{ 339 +.qiang{
340 background-image: url("http://nosqn.colorcun.com/qiang2.png"); 340 background-image: url("http://nosqn.colorcun.com/qiang2.png");
341 background-size: 100% 100%; 341 background-size: 100% 100%;
342 width: 48rpx; 342 width: 48rpx;
@@ -12,13 +12,15 @@ Page({ @@ -12,13 +12,15 @@ Page({
12 * 生命周期函数--监听页面加载 12 * 生命周期函数--监听页面加载
13 */ 13 */
14 onLoad: function (options) { 14 onLoad: function (options) {
  15 + this.options=options
  16 + console.log('chat.options',options)
15 var chat = plugin.getChatComponent(); 17 var chat = plugin.getChatComponent();
16 chat.setTextToSpeech(false); 18 chat.setTextToSpeech(false);
17 //chat.editFoucs(true); 19 //chat.editFoucs(true);
18 - return; 20 + //return;
19 chat.send('人工服务') 21 chat.send('人工服务')
20 setTimeout(()=>{ 22 setTimeout(()=>{
21 - chat.send('maomao de mao') 23 + chat.send(this.getMsg())
22 },300) 24 },300)
23 }, 25 },
24 26
@@ -49,5 +51,12 @@ Page({ @@ -49,5 +51,12 @@ Page({
49 onUnload: function () { 51 onUnload: function () {
50 52
51 }, 53 },
52 - 54 + getMsg(){
  55 + switch (this.options.act){
  56 + //act: "reserve", seller: "陕西风味面馆", date: "2020-10-22", section: "night", room: "6人间"
  57 + case 'reserve'://预订的时候
  58 + return `预订:${this.options.seller}/${this.options.date} ${this.options.section}/${this.options.room}`
  59 + break;
  60 + }
  61 + }
53 }) 62 })