Commit de6886d0eab26915744c5a43d51369f2d3a68d95

Authored by wangfan
1 parent a6fff603

快速预定

... ... @@ -239,6 +239,7 @@ image{
height: 22rpx;
background-image: url("http://qn.colorcun.com/custom/lite-yd/image/click.png");
background-size: 100%;
min-width: 12rpx;
}
.mask{
background-color: rgba(20,20,20,0.5);
... ...
// pack-cookbook/pages/cart.js
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
/**
* 页面的初始数据
*/
data: {
order:{},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
options:options,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.initOrder();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
initOrder(){
App.Advance.CreateOrder({
rid: this.data.options.rid,
identity:this.data.options.identity,
status:'0,1'
}).then(res => {
let cookbooklist={};
res.data.cookbooklist.forEach(ck=>{
if(!cookbooklist[ck.classid]){
cookbooklist[ck.classid]={'name':ck.class_name,list:[]}
}
cookbooklist[ck.classid].list.push(ck)
})
res.data.cookbooklist=cookbooklist;
this.setData({
order: res.data,
})
})
},
updateOrder(e){
let val=util.val(e).trim();
if(val>0){
App.Advance.SetOrderById({
orderid:this.data.options.oid,
pnum:val,
})
}
},
gotoRemark(){
wx.navigateTo({
url: util.http_build_query({...this.data.order},'./remark')
})
},
})
\ No newline at end of file
... ...
... ... @@ -4,17 +4,17 @@
</view>
<view class="page">
<view class="carts">
<view class="block">
<view class="title">123123</view>
<view class="block" wx:for="{{order.cookbooklist}}" wx:key="order.cookbooklist.key">
<view class="title">{{item.name}}</view>
<view class="cart-body">
<view class="cart-item flex-lr" wx:for="{{[1]}}" wx:key="item.key">
<view class="cart-item flex-lr" wx:for="{{item.list}}" wx:key="item.list.key">
<view class="icon">
<image src="{{}}"></image>
<image src="{{item.cookimg}}"></image>
</view>
<view class="name">范德萨范德萨发{{item}}</view>
<view class="price">¥125.00/份</view>
<view class="name">{{item.cookname}}</view>
<view class="price">¥{{item.price}}/{{item.cookunit}}</view>
<view class="opt">
{{item.num||10}}
{{item.num}}
</view>
</view>
</view>
... ... @@ -22,21 +22,25 @@
</view>
</view>
<view class="footer">
<view class="total">共计:¥88</view>
<view class="total">共计:¥{{order.price}}</view>
<view class="infos">
<view class="flex-lr item">
<view>人数:</view>
<view>
<input placeholder="请输入人数" type="number"/>
<input placeholder="请输入人数" type="number" value="{{order.pnum||''}}" bindinput="updateOrder"/>
</view>
</view>
<view class="flex-lr item">
<view>备注:</view>
<view class="flex-rr">
<view class="desc">口味、偏好等要求</view>
<view class="more"></view>
<formids bindclick="gotoRemark">
<view class="flex-lr item">
<view>备注:</view>
<view class="flex-rr" style="max-width: 80%;">
<view class="desc">{{order.remark||'口味、偏好等要求'}}</view>
<view class="more"></view>
</view>
</view>
</view>
</formids>
</view>
<view class="submit">确认下单</view>
<formids class="submit">
<view class="submit">确认下单</view>
</formids>
</view>
... ...
... ... @@ -47,6 +47,7 @@ page{
overflow: hidden;
max-width: 95%;
color: #999999;
line-height: 100rpx;
}
.footer .submit{
... ...
... ... @@ -37,7 +37,8 @@ Page({
initOrder(){
App.Advance.CreateOrder({
rid: this.data.options.rid,
identity:this.data.options.identity
identity:this.data.options.identity,
status:'0,1'
}).then(res => {
this.setData({
order: res.data,
... ... @@ -98,7 +99,9 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title:'邀你一起点菜',
}
},
formatCookList(list){
//原栏目下显示
... ... @@ -229,4 +232,13 @@ Page({
this.initOrder();
},100)
},
gotoCart(){
if(this.data.order.cookbooklist.length<1){
return util.toast('请添加菜品','none');
}
//购物车
wx.navigateTo({
url: util.http_build_query(this.data.options,'./cart')
})
},
})
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@
"cookClass": "../components/cook-class/cook-class",
"nav":"/components/nav/nav",
"cart":"../components/cart/cart",
"formids":"/components/formids/formids"
"formids":"/components/formids/formids",
"userinfo":"/components/userinfo/userinfo"
}
}
\ No newline at end of file
... ...
... ... @@ -29,12 +29,12 @@
</view>
</scroll-view>
<view class="white flex-lr bottom-view">
<view class="share flex-vc">
<button class="share flex-vc button-none" open-type="share">
<view class="icon">
<image src="http://qn.colorcun.com/custom/lite-yd-cook/image/share.png"></image>
</view>
<view class="text">一起点</view>
</view>
</button>
<view class="cart flex-ll" bindtap="dispalyCart">
<view class="icon">
<image src="http://qn.colorcun.com/custom/lite-yd-cook/image/cart.png"/>
... ... @@ -42,7 +42,7 @@
</view>
<view class="text Semibold">¥{{order.price}}</view>
</view>
<view class="place flex-vc">选好了</view>
<userinfo class="place flex-vc" binduserinfo="gotoCart">选好了</userinfo>
</view>
</view>
... ...
// pack-cookbook/pages/remark.js
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
/**
* 页面的初始数据
*/
data: {
tags:[
{id:11,name:'不要盐'},
{id:12,name:'不要糖'},
{id:13,name:'不要辣'},
{id:14,name:'不要酸'},
{id:15,name:'不要苦'},
],
remark:'',
},
/**
* 生命周期函数--监听页面加载
*/
orderid:'',
onLoad: function (options) {
this.orderid=options.id;
App.Orders.GetRemarkBySellerid({
sellerid:options.sellerid,
}).then(res=>{
let obj={
remark:options.remark,
}
//obj.tags=res.data;
if(options.remarkid){
let remarkid=options.remarkid.split(',')
res.data.forEach((t)=>{
if(remarkid._indexOf(t.id)>-1){
t.active=true
}
})
}
this.setData(obj)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
activeRemark(e){
let i=util.attr(e,'index');
let tags=this.data.tags;
tags[i].active=!tags[i].active;
console.log(i,tags);
let remark=this.data.remark;
remark=remark.replace(tags[i].name+'、','')
if(tags[i].active){
remark+=tags[i].name+'、'
}
this.setData({
remark:remark,
tags:tags,
})
},
inputRemark(e){
let remark=util.val(e).trim();
this.setData({
remark:remark,
})
},
submit(){
let remarkid=[];
let tags=this.data.tags;
tags.forEach(t=>{
if(t.active)
remarkid.push(t.id);
})
if(!this.data.remark){
return util.toast('请填写或选择备注信息','none')
}
App.Advance.SetOrderById({
orderid:this.orderid,
remark:this.data.remark,
remarkid:remarkid.toString(),
}).then(res=>{
wx.navigateBack();
})
}
})
\ No newline at end of file
... ...
<!--pack-cookbook/pages/remark.wxml-->
<nav id="nav" hasHome backgroundColor="#ffffff" color="#000000">添加备注</nav>
<view class="page">
<textarea class="textarea"></textarea>
<textarea class="textarea" bindinput="inputRemark" value="{{remark}}">
</textarea>
<view class="tip">快捷标签</view>
<view class="tags flex-ll" style="flex-wrap:wrap;">
<block wx:for="{{[1,2,3,4,5,6,7,8]}}">
<view class="tag active">大师傅</view>
<block wx:for="{{tags}}" wx:key="tags.key">
<view class="tag {{item.active?'active':''}}"
bindtap="activeRemark"
data-index="{{index}}">{{item.name}}</view>
</block>
</view>
<formids bindclick="submit">
<view class="submit">保存</view>
</formids>
</view>
\ No newline at end of file
... ...
// pack-cookbook/pages/success.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
options:options
})
this.initOrder()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
initOrder(){
App.Advance.CreateOrder({
rid: this.data.options.rid,
identity:this.data.options.identity
}).then(res => {
this.setData({
order: res.data,
})
})
},
})
\ No newline at end of file
... ...
<!--pack-cookbook/pages/success.wxml-->
<nav id="nav" hasHome backgroundColor="#ffffff" color="#000000">已点菜品</nav>
<view>
<view wx:if="{{options.hasSuccess==1}}">
<view class="pages flex-vc success">
<view class="icon">
<icon type="success" size="47" color="#C8B16D"/>
... ... @@ -65,7 +65,7 @@
</view>
</view>
<view style="height: 150rpx;width: 100%;"></view>
<view class="optx flex-vc">
<view class="optx flex-vc" wx:if="{{options.hasSuccess!=1}}">
<view class="opt-view flex-ll">
<view class="but editor">修改菜品</view>
<view class="but share">分享</view>
... ...
... ... @@ -30,7 +30,7 @@
"list": []
},
"miniprogram": {
"current": 25,
"current": 34,
"list": [
{
"id": 0,
... ... @@ -289,17 +289,17 @@
}
},
{
"id": -1,
"id": 34,
"name": "pack-cookbook/pages/cart",
"pathName": "pack-cookbook/pages/cart",
"query": "",
"query": "rid=1196&oid=2&identity=1",
"scene": "1001"
},
{
"id": -1,
"id": 35,
"name": "pack-cookbook/pages/success",
"pathName": "pack-cookbook/pages/success",
"query": "",
"query": "rid=1196&oid=2&identity=1&hasSuccess=1",
"scene": "1001"
},
{
... ...
... ... @@ -133,8 +133,10 @@ export default {
'App.Advance.SetOrderById':null,
//清空购物车
'App.Orders.ClearCookById': null,
//购物车
'App.Orders.GetOrderById': null,
//菜品备注tags
'App.Orders.GetRemarkBySellerid':{
cachetime: 300,
},
/**crm**/
'App.Reserve.Members':null,
... ...