Commit 745062f0c83809bd18f1e1fba97137acd5c8da25

Authored by wangfan
1 parent a36ce92e

快速预定

... ... @@ -249,4 +249,20 @@ image{
bottom: 0;
left: 0;
z-index: 9999;
}
.flex-tb{
display: flex;
display: -webkit-flex;
justify-content: space-between;
align-items:flex-start;
flex-direction: column ;
-webkit-flex-direction: column ;
}
.flex-bl{
display: flex;
display: -webkit-flex;
justify-content: flex-end;
align-items:flex-start;
flex-direction: column ;
-webkit-flex-direction: column ;
}
\ No newline at end of file
... ...
... ... @@ -3,115 +3,118 @@ import util from '../../../utils/util';
import App from '../../../utils/api';
const {regeneratorRuntime} = global
Component({
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
},
sellerid:{
type:Number
},
orderid:{
type:Number
},
fromSoucre:{
type:Number,
value:0
},
request_uri:{
type:Boolean,
value:false,
},
hasListModel:{
type:Boolean,
value:false,
},
identity:{
type:String,
value:'',
},
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
},
sellerid: {
type: Number
},
orderid: {
type: Number
},
fromSoucre: {
type: Number,
value: 0
},
request_uri: {
type: Boolean,
value: false,
},
hasListModel: {
type: Boolean,
value: false,
},
identity: {
type: String,
value: '',
},
},
/**
* 组件的初始数据
*/
data: {
item_clear_num:null,
hasIPhone:false,
labelIcon:{
'https://xt05.colorcun.com/uploads/label/lijie.png':'http://qn.colorcun.com/custom/lite-yd-cook/image/lijian.png',
},
/**
* 组件的初始数据
*/
data: {
item_clear_num: null,
hasIPhone: false,
labelIcon: {
'https://xt05.colorcun.com/uploads/label/lijie.png': '力荐',
'https://xt05.colorcun.com/uploads/label/tejia.png': '特价',
'https://xt05.colorcun.com/uploads/label/xinpin.png': '新品',
'https://xt05.colorcun.com/uploads/label/zhaopai.png': '招牌',
},
attached () {
console.log('food-card-ready',this.data.orderid,this.data.fromSoucre)
let item=this.data.item;
let item_clear_num;
if(typeof item.item_clear_num!='undefined'){
item_clear_num=item.item_clear_num;
}else{
item_clear_num=item.clear_num;
if(item.spec){
let clear_num=null;
item.spec.forEach(spec=>{
if(spec.clear_num==0){
clear_num=0;
}else{
clear_num=null;
}
})
if(clear_num==0){
item_clear_num=0;
}
}
},
attached () {
console.log('food-card-ready', this.data.orderid, this.data.fromSoucre)
let item = this.data.item;
let item_clear_num;
if (typeof item.item_clear_num != 'undefined') {
item_clear_num = item.item_clear_num;
} else {
item_clear_num = item.clear_num;
if (item.spec) {
let clear_num = null;
item.spec.forEach(spec => {
if (spec.clear_num == 0) {
clear_num = 0;
} else {
clear_num = null;
}
})
if (clear_num == 0) {
item_clear_num = 0;
}
}
}
this.setData({
item_clear_num:item_clear_num,
hasIPhone:getApp().system.model.indexOf('iPhone')>-1
});
},
detached(){
this.setData({
item_clear_num: item_clear_num,
hasIPhone: getApp().system.model.indexOf('iPhone') > -1
});
},
detached(){
},
/**
* 组件的方法列表
*/
methods: {
//规格 增加/减少 回调
foodSpecCallback(e){
let opt = e.detail;
console.log('foodSpecCallback', opt);
if (opt.type == 'specWin') {
return this.triggerEvent('foodCardCallback', opt);
}
let item = this.data.item;
let oldNum = (item.num || 0);
item.num = (item.num || 0) + opt.type;
let rotateFlag = (oldNum == 0 || item.num == 0);
console.log('num_rotate', rotateFlag);
this.setData({item: item, rotate_id: rotateFlag ? item.id : ''});
opt.num = item.num;
this.triggerEvent('foodCardCallback', opt);
},
/**
* 组件的方法列表
*/
methods: {
//规格 增加/减少 回调
foodSpecCallback(e){
let opt=e.detail;
console.log('foodSpecCallback',opt);
if(opt.type=='specWin'){
return this.triggerEvent('foodCardCallback',opt);
}
let item=this.data.item;
let oldNum=(item.num||0);
item.num=(item.num||0)+opt.type;
let rotateFlag=(oldNum==0 || item.num==0);
console.log('num_rotate',rotateFlag);
this.setData({item:item,rotate_id:rotateFlag?item.id:''});
opt.num=item.num;
this.triggerEvent('foodCardCallback',opt);
},
//清除订单下某菜品所有数量
delOrderCook:function(){
this.selectComponent("#foodSpecDel").clean();
},
//triggerAdd
triggerAdd(e){
console.log('triggerAdd',e)
if(this.data.item_clear_num==0) return;
this.selectComponent("#foodSpecAddOne").addCook();
},
//viewIMage
viewImage(){
wx.previewImage({
current: this.data.item.image, // 当前显示图片的http链接
urls: [this.data.item.image], // 需要预览的图片http链接列表
})
}
//清除订单下某菜品所有数量
delOrderCook: function () {
this.selectComponent("#foodSpecDel").clean();
},
//triggerAdd
triggerAdd(e){
console.log('triggerAdd', e)
if (this.data.item_clear_num == 0) return;
this.selectComponent("#foodSpecAddOne").addCook();
},
//viewIMage
viewImage(){
wx.previewImage({
current: this.data.item.image, // 当前显示图片的http链接
urls: [this.data.item.image], // 需要预览的图片http链接列表
})
}
}
})
... ...
<view class="flex-ll-top hasListModel" style="width:100%;">
<view class="flex-ll hasListModel" style="width:100%;">
<view class="avatar">
<image mode="aspectFill" lazy-load="true" src="{{item.image}}"/>
</view>
<view class="content">
<view class="content flex-tb">
<view class="name Semibold">
{{item.name}}
</view>
<view class="desc">
{{item.desc||''}}
</view>
<view class="label">
<view class="label flex-ll">
<block wx:if="{{item.labelList}}">
<view class="menu-ptop-mark">
<block wx:for="{{item.labelList}}" wx:for-item="son" wx:key="labelList-key">
<image class="labelListImg" src="{{labelIcon[son.icon]||son.icon}}" mode="aspectFit"></image>
</block>
</view>
<block wx:for="{{item.labelList}}" wx:for-item="son" wx:key="labelList-key">
<view class="labelListImg flex-vc" wx:if="{{labelIcon[son.icon]}}">{{labelIcon[son.icon]}}</view>
<image class="labelListImg" wx:else="" src="{{son.icon}}" mode="aspectFit"></image>
</block>
</block>
</view>
<view class="flex-lr price">
<view class="flex-ll">
<view class="rmb">¥</view>
<view class="money">{{item.spec[0].price>0 ? item.spec[0].price : item.price}}</view>
</view>
<view class="opt flex-ll">
<view class="price">
¥ {{item.spec[0].price>0 ? item.spec[0].price : item.price}}
<view class="opt flex-cc">
<block wx:if="{{item_clear_num==0}}">
<image
class="avater"
... ...
@import '../../app.wxss';
@import '/app.wxss';
.cookWapper{
border-radius:4px;
position: relative;
... ... @@ -94,22 +94,21 @@
}
.menu-ptop-mark{ width:100%; height: 13px; padding-top:0; display: flex}
.labelListImg{
width: 50rpx; height: 30rpx; margin-right: 10rpx;
}
.hasListModel{
/*列表模式*/
height: 160rpx;
padding: 20rpx 0;
}
.hasListModel .avatar{
width: 138rpx;
min-width: 138rpx;
height: 140rpx;
margin-right: 18rpx;
width: 160rpx;
min-width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
border-radius: 10rpx;
overflow: hidden;
background-color: #D8D8D8;
margin-top: 10rpx;
}
.hasListModel .avatar image{
width: 100%;
... ... @@ -120,18 +119,19 @@
.hasListModel .content{
overflow: hidden;
width: 100%;
height: 160rpx;
}
.hasListModel .name{
height: 42rpx;
line-height:42rpx;
height: 30rpx;
line-height:30rpx;
font-size: 30rpx;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
.hasListModel .desc{
height: 28rpx;
line-height:28rpx;
height: 20rpx;
line-height:20rpx;
font-size: 20rpx;
overflow: hidden;
text-overflow:ellipsis;
... ... @@ -141,36 +141,29 @@
.hasListModel .label{
height: 22rpx;
line-height:22rpx;
overflow: hidden;
margin-top: 12rpx;
margin-bottom: 4rpx;
font-size: 22rpx;
}
.hasListModel .label .menu-ptop-mark,.hasListModel .label .labelListImg{
height: 100%;
margin-right: 4rpx;
.labelListImg{
width: 50rpx;
height: 22rpx;
margin-right: 10rpx;
line-height: 22rpx;
font-size: 18rpx;
color:#FEFEFE;
background: linear-gradient(to right, #C8B16D, #ECD48B);
}
.hasListModel .price{
height: 40rpx;
overflow: hidden;
padding:0 10rpx;
line-height: 40rpx;
height: 28rpx;
font-size: 28rpx;
line-height: 28rpx;
position: relative;
width: 100%;
}
.hasListModel .price .flex-ll-bottom{
height: 40rpx;
}
.hasListModel .price .rmb{
/*line-height:26rpx;
height:26rpx;
font-size: 24rpx;*/
margin-right: 10rpx;
}
.hasListModel .price .money{
/*height: 30rpx;
font-size: 28rpx;
line-height:30rpx;*/
.hasListModel .price .opt{
position: absolute;
right:20rpx;
top:-12rpx;
}
.hasListModel .food-clear-content{
color:#DA331D;
background-color: #F4DCD9;
... ... @@ -206,4 +199,5 @@
padding: 0;
width: 50rpx;
overflow: hidden;
text-align: center;
}
... ...