1 line
41 KiB
JavaScript
1 line
41 KiB
JavaScript
|
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-take-out2-take-out3"],{3550:function(t,i,e){"use strict";e.r(i);var a=e("35b4"),o=e.n(a);for(var n in a)"default"!==n&&function(t){e.d(i,t,(function(){return a[t]}))}(n);i["default"]=o.a},"35b4":function(t,i,e){"use strict";(function(t){var a=e("4ea4");e("99af"),e("a623"),e("4160"),e("a434"),e("a9e3"),e("d3b7"),e("ac1f"),e("25f0"),e("5319"),e("1276"),e("159b"),Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;var o=e("d24f"),n=e("fb8c"),f=a(e("28ef")),r=(a(e("474f")),a(e("bb31"))),d={data:function(){return{week:(new Date).getDay(),vbPicture:n.vbPicture,formatImgUrl:n.formatImgUrl,dataActive:0,chooseClassifyIndex:0,showAlert:!1,kinds:[],date:[],takeFoodPlace:["梨园","科技楼"],takeFoodPlaceIndex:0,foodList:[],chooseFoodList:[],foodListAll:{},userId:(0,n.getStorage)("userInfo").id,takeFoodTime:"",currentTabIndex:0,orderList:[],listInfo:[],page:1,pageSize:10,loadingType:0,contentText:{contentdown:"上拉加载更多",contentrefresh:"正在加载...",contentnomore:"没有更多数据了"},userInfo:(0,n.getStorage)("userInfo"),submitFlag:!0,remarks:""}},components:{contentNone:f.default,datetimePicker:r.default},computed:{totalPrice:function(){var t=this,i=0;return this.chooseFoodList.forEach((function(e,a){var o=t.accMul(e.price,e.buyNum);i+=o})),Math.floor(100*i)/100},totalNum:function(){var t=0;return this.chooseFoodList.forEach((function(i,e){t+=i.buyNum})),t}},onLoad:function(t){this.currentTabIndex=t.currentTabIndex||0,0==this.currentTabIndex?(this.chooseFoodList=[],this.getAttrTypes()):(this.page=1,this.loadingType=0,this.initData())},watch:{currentTabIndex:function(t,i){1==t?(this.page=1,this.loadingType=0,this.initData()):(this.chooseFoodList=[],this.getAttrTypes())}},onShow:function(){},methods:{accMul:function(t,i){var e=0,a=t.toString(),o=i.toString();try{e+=a.split(".")[1].length}catch(n){}try{e+=o.split(".")[1].length}catch(n){}return Number(a.replace(".",""))*Number(o.replace(".",""))/Math.pow(10,e)},choosePlace:function(t){this.takeFoodPlaceIndex=t},compareTime:function(t){var i=t+" 00:00:00";i=i.replace(/-/g,"/");var e=new Date(i).getTime(),a=(new Date).getTime();return e>a},getAttrTypes:function(){var t=this,i={method:o.getAttrTypesForFood,data:{userId:this.userId}};(0,n.callbackRequest)(i).then((function(i){1==i.data.returnCode&&(t.kinds=i.data.returnData||[],t.getList())}))},getList:function(){var t=this,i={method:o.commodityList,data:{userId:this.userId,attrType:this.kinds[this.chooseClassifyIndex].attr_name}};(0,n.callbackRequest)(i).then((function(i){if(1==i.data.returnCode){for(var e=i.data.returnData||[],a=0;a<t.chooseFoodList.length;a++)for(var o=0;o<e.length;o++)t.chooseFoodList[a].id==e[o].id&&(e[o].buyNum=t.chooseFoodList[a].buyNum);t.foodList=e}}))},kindClick:function(t){this.chooseClassifyIndex=t,this.getList()},switchTab:function(t){this.dataActive=t},addItem:function(i){if(0==this.chooseFoodList.length)return this.$set(i,"buyNum",1),this.chooseFoodList.push(i),!1;var e=this.chooseFoodList.every((function(t){return t.id!=i.id}));t.log(e),e?(this.$set(i,"buyNum",1),this.chooseFoodList.push(i)):i.buyNum++},removeItem:function(t){var i=this;t.buyNum--,0==t.buyNum&&this.chooseFoodList.forEach((function(e,a){e.id==t.id&&(i.chooseFoodList.splice(a,1),0==i.chooseFoodList.length&&(i.showAlert=!1))}))},submit:function(){var t=this;if(this.submitFlag){this.submitFlag=!1;var i=[];this.chooseFoodList.forEach((function(t,e){var a={goodsId:t.kinds_id,goodsNum:t.buyNum};i.push(a)}));var e={method:o.submitOrder,data:{userId:this.userId,diningRoomId:3,takeFoodTime:this.takeFoodTime,takeFoodPlace:this.takeFoodPlace[this.takeFoodPlaceIndex],orderDetails:i,remarks:this.remarks}};(0,n.callbackRequest)(e).then((function(i){1==i.data.returnCode?((0,n.alertTip)("预定成功"),setTimeout((function(){uni.redirectTo({url:"/pages/take-out2/take-out3?currentTabIndex=1"})}),1500)):(t.submitFlag=!0,(0,n.alertTip)(i.data.returnMsg))}))}},initData:function(){var t=this,i={method:o.myOrderList,data:{userId:this.userInfo.id,pageSize:this.page
|