Commit e093fb40963a90f68b111b878bce8573abc8b9ff

Authored by wangfan
1 parent 6642a3b0

快速预定

... ... @@ -3,452 +3,453 @@ import util from '../../../utils/util';
import App from '../../../utils/api';
const {regeneratorRuntime} = global
Component({
/**
* 组件的属性列表
*/
properties: {
item:{
type:Object // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
},
type:{
type:String,
default:'+'
},
sellerid:{
type:Number
},
orderid:{
type:Number
},
fromSoucre:{
type:Number,
value:0
},
request_uri:{
type:Boolean,
value:false,
},
identity:{
type:String,
value:"",
}
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
},
/**
* 组件的初始数据
*/
data: {
hiddenFoodSpec:true,//加菜规格
hiddenFoodSpecReduce:true,//减菜规格
selectKind:[{title:'xxxxx'},{title:'yyyyy'}],
type: {
type: String,
default: '+'
},
ready () {
sellerid: {
type: Number
},
detached(){
orderid: {
type: Number
},
/**
* 组件的方法列表
*/
methods: {
init(){
console.log('food-spec init');
this.setData({
hiddenFoodSpec:false
})
},
//关闭规格框
close:function(){
this.setData({
hiddenFoodSpec:true,
hiddenFoodSpecReduce:true,
})
//关闭了规格窗口
this.triggerEvent('foodSpecCallback',{
type:'specWin',
value:'hide'
});
},
//构造KindMenu
initKindMenu(){
return new Promise((success,fail)=>{
let price=this.data.item.price;
let hasSpec = this.data.item.spec.length>0;
let hasPractice = this.data.item.practice.length>0;
if(hasSpec || hasPractice){
var specs = this.data.item.spec//规格
var practice = this.data.item.practice//做法
var kind = []
var foodMenu=[]
if(this.data.type=='-'){
if(specs){
specs.map(function(r,n){
if(r.id){//某规格卖光了 就不显示 && r.clear_num>1
kind.push({id:r.id,price:r.price,title:r.specs,iskind:false})
}
})
}
fromSoucre: {
type: Number,
value: 0
},
request_uri: {
type: Boolean,
value: false,
},
identity: {
type: String,
value: "",
}
if(practice) {
practice.map(function (r, n) {
if (r.id) {
foodMenu.push({id: r.id, price: r.price, title: r.name, iskind: false})
}
})
}
App.Advance.GetCookbookSelBySpecsId({
sellerid:this.data.sellerid,
orderid: this.data.orderid,
cookbookid: this.data.item.id,
status:this.data.fromSoucre!=''?2:'',//只查没有下单的
}).then(res=>{
this.setData({
selectKind:res.data[0],
hiddenFoodSpecReduce:false,
kind:kind?kind:'',
foodMenu:foodMenu,
})
})
}else{
specs.map(function(r,n){
if ((r.id && r.clear_num > 0) || r.clear_num==null){//某规格卖光了 就不显示 && r.clear_num>1
kind.push({id:r.id,price:r.price,title:r.specs,iskind:false})
}
})
if(kind.length>0){
kind[0].iskind=true;
var kindPrice=kind[0].price;
var specs_id=kind[0].id;
}
},
practice.map(function(r,n){
if(r.id){
foodMenu.push({id:r.id,price:price,title:r.name,iskind:false})
}
})
/**
* 组件的初始数据
*/
data: {
hiddenFoodSpec: true,//加菜规格
hiddenFoodSpecReduce: true,//减菜规格
selectKind: [{title: 'xxxxx'}, {title: 'yyyyy'}],
},
ready () {
if(foodMenu.length>0){
foodMenu[0].iskind=true;
var foodMenuPrice=foodMenu[0].price;
var practice_id=foodMenu[0].id;
}
App.Advance.GetCookbookSelBySpecsId({
sellerid:this.data.sellerid,
orderid: this.data.orderid,
cookbookid: this.data.item.id,
status:this.data.fromSoucre!=''?2:'',//只查没有下单的
}).then(res=>{
this.setData({
selectKind:res.data[0],
hiddenFoodSpec:false,
kind:kind,
foodMenu:foodMenu,
showSpecsPrice:false,
cookbook_name:this.data.item.name,
cookbook_id:this.data.item.id,
specs_id:specs_id ? specs_id :'',
practice_id:practice_id ? practice_id : '',
selectPrice:kindPrice>0 ? kindPrice : foodMenuPrice,
add_target:''
})
})
}
success();
}else{
fail();
}
});
},
//选择规格
kindSelect: function (e) {
var index = e.currentTarget.dataset.key
var specsid = e.currentTarget.id
var price = e.currentTarget.dataset.price
for (var i = 0; i < this.data.kind.length; i++) {
if (i == index) {
this.data.kind[i].iskind = true;
} else {
this.data.kind[i].iskind = false;
},
detached(){
},
/**
* 组件的方法列表
*/
methods: {
init(){
console.log('food-spec init');
this.setData({
hiddenFoodSpec: false
})
},
//关闭规格框
close: function () {
this.setData({
hiddenFoodSpec: true,
hiddenFoodSpecReduce: true,
})
//关闭了规格窗口
this.triggerEvent('foodSpecCallback', {
type: 'specWin',
value: 'hide'
});
},
//构造KindMenu
initKindMenu(){
return new Promise((success, fail) => {
let price = this.data.item.price;
let hasSpec = this.data.item.spec.length > 0;
let hasPractice = this.data.item.practice.length > 0;
if (hasSpec || hasPractice) {
var specs = this.data.item.spec//规格
var practice = this.data.item.practice//做法
var kind = []
var foodMenu = []
if (this.data.type == '-') {
if (specs) {
specs.map(function (r, n) {
if (r.id) {//某规格卖光了 就不显示 && r.clear_num>1
kind.push({id: r.id, price: r.price, title: r.specs, iskind: false})
}
})
}
var is_show = ''
if(this.data.foodMenu==''){
is_show=1
}else if(specsid && this.data.practice_id){
is_show=1
}
this.setData({
kind: this.data.kind,
selectPrice:price,
specs_id:specsid,
foodMenu:this.data.foodMenu?this.data.foodMenu:'',
showSpecsPrice:price?false:true,
showAdd:is_show?false:true//showAdd:specsid?false:true
});
},
//选择做法
menuSelect: function (e) {
var index = e.currentTarget.dataset.key
var practiceid = e.currentTarget.id
var price = e.currentTarget.dataset.price
for (var i = 0; i < this.data.foodMenu.length; i++) {
if (i == index) {
this.data.foodMenu[i].iskind = true;
} else {
this.data.foodMenu[i].iskind = false;
if (practice) {
practice.map(function (r, n) {
if (r.id) {
foodMenu.push({id: r.id, price: r.price, title: r.name, iskind: false})
}
})
}
var is_show = ''
if(this.data.kind==''){
is_show=1
}else if(this.data.specs_id && practiceid){
is_show=1
App.Advance.GetCookbookSelBySpecsId({
sellerid: this.data.sellerid,
orderid: this.data.orderid,
cookbookid: this.data.item.id,
status: this.data.fromSoucre != '' ? 2 : '',//只查没有下单的
}).then(res => {
this.setData({
selectKind: res.data[0],
hiddenFoodSpecReduce: false,
kind: kind ? kind : '',
foodMenu: foodMenu,
})
})
} else {
specs.map(function (r, n) {
if ((r.id && r.clear_num > 0) || r.clear_num == null) {//某规格卖光了 就不显示 && r.clear_num>1
kind.push({id: r.id, price: r.price, title: r.specs, iskind: false})
}
})
if (kind.length > 0) {
kind[0].iskind = true;
var kindPrice = kind[0].price;
var specs_id = kind[0].id;
}
this.setData({
foodMenu: this.data.foodMenu,
foodMenuPrice:price,
practice_id:practiceid,
showAdd:is_show?false:true
});
},
//加菜面板
addCook:function(e){
console.log('addCook',this.data.item,e);
var cookbookid = this.data.item.cookbookid
var price=this.data.item.price;
this.initKindMenu().then(res=>{
//打开了规格窗口
this.triggerEvent('foodSpecCallback',{
type:'specWin',
value:'show'
});
}).catch(res=>{
console.log('initKindMenu',res);
if( this.data.item.clear_num && this.data.item.clear_num>0
&& this.data.item.num+1 > this.data.item.clear_num){
wx.showToast({
title:'该菜品最多能点'+this.data.item.clear_num+'份',
duration:2000,
mask:true,
icon:'none'
});
return;
}
//通知
this.triggerEvent('foodSpecCallback',{
cookbookid:cookbookid,
type:1,
});
//this.matchArray(cookbookid,1,countTotal,countPirce)
App.Advance.AddCart({
orderid: this.data.orderid,
openid:util.cache('openid'),
cookbookid:cookbookid,
price: price,
source: 1,
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
fromSoucre:this.data.fromSoucre?this.data.fromSoucre:'',
identity:this.data.identity
});
});
},
//减菜面板
subtractCook(){
console.log('addFunction',this.data.item);
var cookbookid = this.data.item.cookbookid
var price=this.data.item.price;
this.initKindMenu().then(res=>{
//打开了规格窗口
this.triggerEvent('foodSpecCallback',{
type:'specWin',
value:'show'
});
}).catch(res=>{
//通知
this.triggerEvent('foodSpecCallback',{
cookbookid:cookbookid,
type:-1,
});
App.Advance.ReduceOrder({
orderid: this.data.orderid,
openid: getApp().openid,
cookbookid: cookbookid,
//specid: specid ? specid : '',
//practiceid: specid ? specid : '',
fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
status:this.data.fromSoucre!=''?2:'',//只查没有下单的
source: 2,
});
});
},
//减菜面板加菜按钮
add:function(e){
console.log('add',util.attr(e,'cookbookid'),e);
let index=util.attr(e,'index');
let selectKind=this.data.selectKind;
console.log('selectKind',selectKind,index);
let specs=this.data.item.spec;
let clear_num=null;
specs.forEach(spec=>{
if(spec.id==selectKind[index].specid){
clear_num=spec.clear_num;
}
practice.map(function (r, n) {
if (r.id) {
foodMenu.push({id: r.id, price: price, title: r.name, iskind: false})
}
})
if( clear_num && clear_num>0
&& selectKind[index].foodNum+1 > clear_num){
wx.showToast({
title:'该菜品最多能点'+clear_num+'份',
duration:2000,
mask:true,
icon:'none'
});
return;
if (foodMenu.length > 0) {
foodMenu[0].iskind = true;
var foodMenuPrice = foodMenu[0].price;
var practice_id = foodMenu[0].id;
}
App.Advance.GetCookbookSelBySpecsId({
sellerid: this.data.sellerid,
orderid: this.data.orderid,
cookbookid: this.data.item.id,
status: this.data.fromSoucre != '' ? 2 : '',//只查没有下单的
}).then(res => {
this.setData({
selectKind: res.data[0],
hiddenFoodSpec: false,
kind: kind,
foodMenu: foodMenu,
showSpecsPrice: false,
cookbook_name: this.data.item.name,
cookbook_id: this.data.item.id,
specs_id: specs_id ? specs_id : '',
practice_id: practice_id ? practice_id : '',
selectPrice: kindPrice > 0 ? kindPrice : foodMenuPrice,
add_target: ''
})
})
}
success();
} else {
fail();
}
});
},
//选择规格
kindSelect: function (e) {
var index = e.currentTarget.dataset.key
var specsid = e.currentTarget.id
var price = e.currentTarget.dataset.price
for (var i = 0; i < this.data.kind.length; i++) {
if (i == index) {
this.data.kind[i].iskind = true;
} else {
this.data.kind[i].iskind = false;
}
}
var is_show = ''
if (this.data.foodMenu == '') {
is_show = 1
} else if (specsid && this.data.practice_id) {
is_show = 1
}
this.setData({
kind: this.data.kind,
selectPrice: price,
specs_id: specsid,
foodMenu: this.data.foodMenu ? this.data.foodMenu : '',
showSpecsPrice: price ? false : true,
showAdd: is_show ? false : true//showAdd:specsid?false:true
});
},
//选择做法
menuSelect: function (e) {
var index = e.currentTarget.dataset.key
var practiceid = e.currentTarget.id
var price = e.currentTarget.dataset.price
for (var i = 0; i < this.data.foodMenu.length; i++) {
if (i == index) {
this.data.foodMenu[i].iskind = true;
} else {
this.data.foodMenu[i].iskind = false;
}
}
var is_show = ''
if (this.data.kind == '') {
is_show = 1
} else if (this.data.specs_id && practiceid) {
is_show = 1
}
this.setData({
foodMenu: this.data.foodMenu,
foodMenuPrice: price,
practice_id: practiceid,
showAdd: is_show ? false : true
});
},
//加菜面板
addCook: function (e) {
console.log('addCook', this.data.item, e);
var cookbookid = this.data.item.identity>=0?this.data.item.cookbookid:this.data.item.id
var price = this.data.item.price;
selectKind[index].foodNum=parseInt(selectKind[index].foodNum)+1;
this.setData({selectKind:selectKind});
this.formSubmit(e,true);
},
//减菜面板减菜按钮
reduce(e){
console.log('reduce',util.attr(e,'cookbookid'),e);
var cookbookid = util.attr(e,'cookbookid')
var specid = util.attr(e,'specid')
var practice_id = util.attr(e,'practiceid')
var price = util.attr(e,'price')
this.initKindMenu().then(res => {
//打开了规格窗口
this.triggerEvent('foodSpecCallback', {
type: 'specWin',
value: 'show'
});
}).catch(res => {
console.log('initKindMenu', res);
if (this.data.item.clear_num && this.data.item.clear_num > 0
&& this.data.item.num + 1 > this.data.item.clear_num) {
wx.showToast({
title: '该菜品最多能点' + this.data.item.clear_num + '份',
duration: 2000,
mask: true,
icon: 'none'
});
return;
}
//通知
this.triggerEvent('foodSpecCallback', {
cookbookid: cookbookid,
type: 1,
});
//this.matchArray(cookbookid,1,countTotal,countPirce)
App.Advance.AddCart({
orderid: this.data.orderid,
openid: util.cache('openid'),
cookbookid: cookbookid,
price: price,
source: 1,
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
identity: this.data.identity
});
});
},
//减菜面板
subtractCook(){
console.log('addFunction', this.data.item);
var cookbookid = this.data.item.identity>=0?this.data.item.cookbookid:this.data.item.id
var price = this.data.item.price;
this.initKindMenu().then(res => {
//打开了规格窗口
this.triggerEvent('foodSpecCallback', {
type: 'specWin',
value: 'show'
});
}).catch(res => {
//通知
this.triggerEvent('foodSpecCallback', {
cookbookid: cookbookid,
type: -1,
});
let index=util.attr(e,'index');
let selectKind=this.data.selectKind;
selectKind[index].foodNum-=1;
if(selectKind[index].foodNum<=0){
selectKind.splice(index,1);
}
this.setData({selectKind:selectKind});
if(selectKind.length<1){
this.close();
}
App.Advance.ReduceOrder({
orderid: this.data.orderid,
openid: getApp().openid,
cookbookid: cookbookid,
//specid: specid ? specid : '',
//practiceid: specid ? specid : '',
fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
status: this.data.fromSoucre != '' ? 2 : '',//只查没有下单的
source: 2,
});
});
},
//减菜面板加菜按钮
add: function (e) {
console.log('add', util.attr(e, 'cookbookid'), e);
let index = util.attr(e, 'index');
let selectKind = this.data.selectKind;
this.triggerEvent('foodSpecCallback',{
cookbookid:cookbookid,
type:-1
});
console.log('selectKind', selectKind, index);
let specs = this.data.item.spec;
let clear_num = null;
specs.forEach(spec => {
if (spec.id == selectKind[index].specid) {
clear_num = spec.clear_num;
}
})
if (clear_num && clear_num > 0
&& selectKind[index].foodNum + 1 > clear_num) {
wx.showToast({
title: '该菜品最多能点' + clear_num + '份',
duration: 2000,
mask: true,
icon: 'none'
});
return;
}
//执行删除操作
let params={
orderid: this.data.orderid,
openid: getApp().openid,
cookbookid: cookbookid,
fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
status:this.data.fromSoucre?2:'',//只查没有下单的
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
source: 2,
};
if(specid>0){
params.specid=specid;
}
if(practice_id>0){
params.practiceid=practice_id;
}
App.Advance.ReduceOrder(params);
},
/**
*
* @param e
* @param subtractCook 减菜面板
*/
formSubmit(e,subtractCook=false){
if(subtractCook){//减菜面板
var cookbookid = util.attr(e,'cookbookid')
var specid = util.attr(e,'specid')
var practice_id = util.attr(e,'practiceid')
var price = util.attr(e,'price')
}else{
var cookbookid = util.val(e,'cookbookid')
var specid = util.val(e,'specs_id')
var practice_id = util.val(e,'practice_id')
var price = util.val(e,'price')
if(this.data.selectPrice){
console.log(666666,this.data.selectPrice)
price=this.data.selectPrice
}else{
console.log('yyyyyy',this.data.foodMenuPrice)
price=this.data.foodMenuPrice
}
this.close();
}
console.log('formSubmit',specid,practice_id,price)
selectKind[index].foodNum = parseInt(selectKind[index].foodNum) + 1;
this.setData({selectKind: selectKind});
this.formSubmit(e, true);
},
//减菜面板减菜按钮
reduce(e){
console.log('reduce', util.attr(e, 'cookbookid'), e);
var cookbookid = util.attr(e, 'cookbookid')
var specid = util.attr(e, 'specid')
var practice_id = util.attr(e, 'practiceid')
var price = util.attr(e, 'price')
let index = util.attr(e, 'index');
let selectKind = this.data.selectKind;
selectKind[index].foodNum -= 1;
if (selectKind[index].foodNum <= 0) {
selectKind.splice(index, 1);
}
this.setData({selectKind: selectKind});
if (selectKind.length < 1) {
this.close();
}
let selectKindNum=0;
if(this.data.selectKind){
this.data.selectKind.forEach((kind)=>{
if(kind.specid==specid){
selectKindNum=kind.foodNum
}
})
}
console.log('selectKindNum',this.data.selectKind,selectKindNum);
if(selectKindNum>0){
let clear_num=null;
let specs=this.data.item.spec;
specs.forEach(spec=>{
if(spec.id==specid){
clear_num=spec.clear_num;
}
})
if( clear_num && clear_num>0
&& selectKindNum+1 > clear_num){
wx.showToast({
title:'该菜品最多能点'+clear_num+'份',
duration:2000,
mask:true,
icon:'none'
});
return;
}
}
this.triggerEvent('foodSpecCallback', {
cookbookid: cookbookid,
type: -1
});
//执行删除操作
let params = {
orderid: this.data.orderid,
openid: getApp().openid,
cookbookid: cookbookid,
fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
status: this.data.fromSoucre ? 2 : '',//只查没有下单的
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
source: 2,
};
if (specid > 0) {
params.specid = specid;
}
if (practice_id > 0) {
params.practiceid = practice_id;
}
App.Advance.ReduceOrder(params);
},
/**
*
* @param e
* @param subtractCook 减菜面板
*/
formSubmit(e, subtractCook = false){
if (subtractCook) {//减菜面板
var cookbookid = util.attr(e, 'cookbookid')
var specid = util.attr(e, 'specid')
var practice_id = util.attr(e, 'practiceid')
var price = util.attr(e, 'price')
} else {
var cookbookid = util.val(e, 'cookbookid')
var specid = util.val(e, 'specs_id')
var practice_id = util.val(e, 'practice_id')
var price = util.val(e, 'price')
if (this.data.selectPrice) {
console.log(666666, this.data.selectPrice)
price = this.data.selectPrice
} else {
console.log('yyyyyy', this.data.foodMenuPrice)
price = this.data.foodMenuPrice
}
this.close();
}
console.log('formSubmit', cookbookid,specid, practice_id, price)
//return;
this.triggerEvent('foodSpecCallback',{
cookbookid:cookbookid,
type:1
});
let param={
orderid: this.data.orderid,
openid:util.cache('openid'),
cookbookid:this.data.item.id,
price: price,
source: 1,
request_uri: this.data.request_uri==true?1:'',//服务员通过消息通知进来 又加菜的标识
fromSoucre:this.data.fromSoucre?this.data.fromSoucre:'',
identity:this.data.identity
}
if(specid>0){
param.specid=specid;
}
if(practice_id>0){
param.practiceid=practice_id;
}
App.Advance.AddCart(param);
},
//清除订单下某菜品所有数量
clean(){
let cookbookid=this.data.item.id
this.triggerEvent('foodSpecCallback',{
cookbookid:cookbookid,
type:this.data.item.num*-1
});
App.Advance.ClearCookById({
orderid: this.data.orderid,
sellerid: this.data.sellerid,
cookbookid:cookbookid
});
let selectKindNum = 0;
if (this.data.selectKind) {
this.data.selectKind.forEach((kind) => {
if (kind.specid == specid) {
selectKindNum = kind.foodNum
}
})
}
console.log('selectKindNum', this.data.selectKind, selectKindNum);
if (selectKindNum > 0) {
let clear_num = null;
let specs = this.data.item.spec;
specs.forEach(spec => {
if (spec.id == specid) {
clear_num = spec.clear_num;
}
})
if (clear_num && clear_num > 0
&& selectKindNum + 1 > clear_num) {
wx.showToast({
title: '该菜品最多能点' + clear_num + '份',
duration: 2000,
mask: true,
icon: 'none'
});
return;
}
}
this.triggerEvent('foodSpecCallback', {
cookbookid: cookbookid,
type: 1
});
let param = {
orderid: this.data.orderid,
openid: util.cache('openid'),
cookbookid: cookbookid,
price: price,
source: 1,
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
identity: this.data.identity
}
if (specid > 0) {
param.specid = specid;
}
if (practice_id > 0) {
param.practiceid = practice_id;
}
App.Advance.AddCart(param);
},
//清除订单下某菜品所有数量
clean(){
let cookbookid = this.data.item.id
this.triggerEvent('foodSpecCallback', {
cookbookid: cookbookid,
type: this.data.item.num * -1
});
App.Advance.ClearCookById({
orderid: this.data.orderid,
sellerid: this.data.sellerid,
cookbookid: cookbookid
});
}
}
})
... ...
... ... @@ -20,7 +20,7 @@
<block wx:if="{{foodMenu.length>0}}">
<view class="toast-content-kind" style="margin-bottom:{{kind.length==0 ? '235rpx' : '40rpx'}};">
<view class="toast-kind-title">做法</view>
<view class="toast-kind-menu">
<view class="toast-kind-menu flex-ll">
<view class="toast-kind-single {{item.iskind==true?'kind-active':''}}" wx:for="{{foodMenu}}" wx:key="foodmenu-key" data-key="{{index}}" id="{{item.id}}" data-price="{{item.price}}" bindtap='menuSelect'>{{item.title}}</view>
<input value="{{practice_id}}" name="practice_id" hidden="true"/>
</view>
... ...
... ... @@ -124,7 +124,7 @@ export default {
//菜品列表
'App.Advance.GetCookbookByClass': null,
//菜品规格
' App.Advance.GetCookbookSelBySpecsId': null,
'App.Advance.GetCookbookSelBySpecsId': null,
//添加到购物车
'App.Advance.AddCart': null,
//减菜
... ...
... ... @@ -440,7 +440,8 @@ module.exports = {
html=html.replace(/&quot;/ig,'');
return html;
},
val:function(e){
val:function(e,key=''){
if(key!='') return e.detail.value[key]||'';
return e.detail.value;
},
attr:function(e,key=''){
... ...