|
|
@@ -8,14 +8,16 @@ Page({
|
|
|
cancelnum:1,
|
|
|
canceldata:{},
|
|
|
cancelitem:{},
|
|
|
- oncancel:false
|
|
|
+ oncancel:false,
|
|
|
+ mealInfo:{}
|
|
|
},
|
|
|
onShow:function(){
|
|
|
console.log('onshow == canteen')
|
|
|
this.setData({
|
|
|
detail: {}
|
|
|
})
|
|
|
- this.getList()
|
|
|
+ this.getList();
|
|
|
+ this.getMealInfo();
|
|
|
},
|
|
|
// onLoad: function (options) {
|
|
|
|
|
|
@@ -55,6 +57,20 @@ Page({
|
|
|
}
|
|
|
_request.$get(url, params, success)
|
|
|
},
|
|
|
+ getMealInfo () {
|
|
|
+ var that = this
|
|
|
+ var url = 'newapi:food/get-meal-info'
|
|
|
+ var params = {
|
|
|
+ }
|
|
|
+ var success = function (res) {
|
|
|
+ var data = res.data.data
|
|
|
+ console.log('mealinfo',data);
|
|
|
+ that.setData({
|
|
|
+ mealInfo: data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ _request.$get(url, params, success)
|
|
|
+ },
|
|
|
showCancelm(e){
|
|
|
var that = this
|
|
|
var selectdata = e.currentTarget.dataset.data;
|
|
|
@@ -193,60 +209,72 @@ Page({
|
|
|
onlyFromCamera: true,
|
|
|
success (res) {
|
|
|
if(res.errMsg == "scanCode:ok"){
|
|
|
- let link = res.result.split(':')[1];
|
|
|
- var url = 'newapi:'+link;
|
|
|
- var params = {
|
|
|
- }
|
|
|
- var success = function (res) {
|
|
|
- console.log('用餐提醒',res);
|
|
|
- if(res.data.code != 0){
|
|
|
- wx.showToast({
|
|
|
- title: res.data.msg,
|
|
|
- icon: 'none',
|
|
|
- duration: 2000
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- let data = res.data.data;
|
|
|
- let can = '';
|
|
|
- if(data.type == 1) can = "早餐";
|
|
|
- if(data.type == 2) can = "中餐";
|
|
|
- if(data.type == 3) can = "晚餐";
|
|
|
- wx.showModal({
|
|
|
- title: "用餐提醒",
|
|
|
- content: `当前用餐日期${data['foodDate']} [${can}] 数量 ${data['nums']},是否确定用餐?`,
|
|
|
- success: function(res) {
|
|
|
- if (res.confirm) {
|
|
|
- var url = 'newapi:food/comfirm-get-food'
|
|
|
- var params = {
|
|
|
+ console.log('scanres',res);
|
|
|
+ // if(res.path == '/pages/canteen/dining/dining'){
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/canteen/dining/dining'
|
|
|
+ })
|
|
|
+ // }else{
|
|
|
+ // wx.showToast({
|
|
|
+ // title: '扫描失败',
|
|
|
+ // icon: 'error',
|
|
|
+ // duration: 2000
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // let link = res.result.split(':')[1];
|
|
|
+ // var url = 'newapi:'+link;
|
|
|
+ // var params = {
|
|
|
+ // }
|
|
|
+ // var success = function (res) {
|
|
|
+ // console.log('用餐提醒',res);
|
|
|
+ // if(res.data.code != 0){
|
|
|
+ // wx.showToast({
|
|
|
+ // title: res.data.msg,
|
|
|
+ // icon: 'none',
|
|
|
+ // duration: 2000
|
|
|
+ // });
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // let data = res.data.data;
|
|
|
+ // let can = '';
|
|
|
+ // if(data.type == 1) can = "早餐";
|
|
|
+ // if(data.type == 2) can = "中餐";
|
|
|
+ // if(data.type == 3) can = "晚餐";
|
|
|
+ // wx.showModal({
|
|
|
+ // title: "用餐提醒",
|
|
|
+ // content: `当前用餐日期${data['foodDate']} [${can}] 数量 ${data['nums']},是否确定用餐?`,
|
|
|
+ // success: function(res) {
|
|
|
+ // if (res.confirm) {
|
|
|
+ // var url = 'newapi:food/comfirm-get-food'
|
|
|
+ // var params = {
|
|
|
|
|
|
- }
|
|
|
- var success = function (res) {
|
|
|
- var result = res.data
|
|
|
- if(result.code == 0){
|
|
|
- wx.showToast({
|
|
|
- title: '成功,用餐愉快',
|
|
|
- icon: 'success',
|
|
|
- duration: 3000
|
|
|
- });
|
|
|
- that.onShow();
|
|
|
- return;
|
|
|
- }else{
|
|
|
- wx.showToast({
|
|
|
- title: result.msg,
|
|
|
- icon: 'error',
|
|
|
- duration: 3000
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- _request.$get(url, params, success)
|
|
|
- } else if (res.cancel) {
|
|
|
+ // }
|
|
|
+ // var success = function (res) {
|
|
|
+ // var result = res.data
|
|
|
+ // if(result.code == 0){
|
|
|
+ // wx.showToast({
|
|
|
+ // title: '成功,用餐愉快',
|
|
|
+ // icon: 'success',
|
|
|
+ // duration: 3000
|
|
|
+ // });
|
|
|
+ // that.onShow();
|
|
|
+ // return;
|
|
|
+ // }else{
|
|
|
+ // wx.showToast({
|
|
|
+ // title: result.msg,
|
|
|
+ // icon: 'error',
|
|
|
+ // duration: 3000
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // _request.$get(url, params, success)
|
|
|
+ // } else if (res.cancel) {
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- _request.$get(url, params, success)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // _request.$get(url, params, success)
|
|
|
}else{
|
|
|
wx.showToast({
|
|
|
title: '扫描失败',
|
|
|
@@ -262,6 +290,11 @@ Page({
|
|
|
url: '/pages/canteen/order/order'
|
|
|
})
|
|
|
},
|
|
|
+ toDining() {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/canteen/dining/dining'
|
|
|
+ })
|
|
|
+ },
|
|
|
toRecharge() {
|
|
|
// if(this.data.info.user.tel == ''){//未绑定手机号
|
|
|
// wx.navigateTo({
|