Compare commits
2 Commits
969874408f
...
c75a5314f9
| Author | SHA1 | Date |
|---|---|---|
|
|
c75a5314f9 | |
|
|
0719279d50 |
|
|
@ -9,7 +9,7 @@ module.exports = {
|
|||
// baseUrl: 'http://192.168.0.244:38380',//测试
|
||||
// baseUrl: 'http://sgwpdm.ah.sgcc.com.cn/canteen/dev-api',//测试d
|
||||
// baseUrl: 'http://192.168.0.176:58080',//测试
|
||||
// baseUrl: 'http://192.168.2.82:58080',//张天强
|
||||
// baseUrl: 'http://192.168.2.56:58080',//张天强
|
||||
// baseUrl: 'http://192.168.2.69:58080',//董高文
|
||||
// baseUrl: 'http://192.168.0.44:58080',//董高文
|
||||
// baseUrl: 'http://192.168.2.72:58080',//盛旭
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@
|
|||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"base-64": "^1.0.0",
|
||||
"compressorjs": "^1.2.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"image-compressor.js": "^1.1.4",
|
||||
"image-tools": "^1.4.0",
|
||||
"js-cookie": "^3.0.5",
|
||||
"sm-crypto": "^0.3.13"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
¥{{(menuData.dishesDetailList[0].prefPrice/100).toFixed(2)}}
|
||||
</view>
|
||||
|
||||
<view style="display: flex;align-items: center;" v-if="dashesData.surplusNum>0">
|
||||
<view style="display: flex;align-items: center;" v-if="dashesData.surplusNum>0&&dashesData.ifReserve">
|
||||
<u-icon
|
||||
v-if="dashesData.quantity>0"
|
||||
name="../../static/images/delete.png"
|
||||
|
|
@ -143,7 +143,7 @@
|
|||
</span>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<view v-if="dashesData.ifReserve">
|
||||
<u-button shape="circle" color="#FF6816" style="width: 79px; height: 28px" @click="handleOrder">结算</u-button>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -193,7 +193,7 @@
|
|||
{{ (food.prefPrice/100).toFixed(2) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="right-cont">
|
||||
<view class="right-cont" v-if="dashesData.ifReserve">
|
||||
<view class="num-wrap" v-if="food.isDfficacy==1">
|
||||
<view style="width: 40rpx;" @click="handleFoodNum(1, food)">
|
||||
<u-icon
|
||||
|
|
@ -261,7 +261,7 @@ export default {
|
|||
}
|
||||
}],
|
||||
canteenType: '自取',
|
||||
isHandle:false
|
||||
isHandle:false,
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
|
|
@ -269,10 +269,11 @@ export default {
|
|||
console.log(options)
|
||||
this.menuData = options
|
||||
this.newDate2 = this.menuData.orderDate
|
||||
this.getMenuListData()
|
||||
this.getMenudishesDetail()
|
||||
this.getMenuEvaluaorderList()
|
||||
this.getMenuEvaluaCount()
|
||||
this.getMenuListData()
|
||||
|
||||
},
|
||||
methods: {
|
||||
//获取菜品详情
|
||||
|
|
@ -307,6 +308,7 @@ export default {
|
|||
this.$set(this.dashesData, 'dishesPrice', this.dashesData.dishesDetailList[0].dishesPrice)
|
||||
this.$set(this.dashesData, 'prefPrice', this.dashesData.dishesDetailList[0].prefPrice)
|
||||
this.$set(this.dashesData, 'dishesId', this.dashesData.dishesDetailList[0].dishesId)
|
||||
this.$set(this.dashesData, 'ifReserve', true)
|
||||
this.$forceUpdate()
|
||||
}
|
||||
console.log(res,'获取菜品详情')
|
||||
|
|
@ -366,6 +368,20 @@ export default {
|
|||
this.$set(food, 'dishesPrice', food.dishesDetailList[0].dishesPrice)
|
||||
this.$set(food, 'prefPrice', food.dishesDetailList[0].prefPrice)
|
||||
this.$set(food, 'dishesId', food.dishesDetailList[0].dishesId)
|
||||
let currentDate = this.formatDate(new Date()); // 获取当前时间
|
||||
if(currentDate!=this.newDate2){
|
||||
let str = this.formatDate(new Date())+" "+food.reserveEndTime;
|
||||
// let str = this.formatDate(new Date())+" 14:00:00";
|
||||
console.log(str)
|
||||
let currentTime = new Date().getTime();
|
||||
let inputTime = new Date(str).getTime();
|
||||
if (currentTime < inputTime) {
|
||||
console.log("可以预定");
|
||||
} else {
|
||||
console.log("不可预定");
|
||||
this.$set(this.dashesData, 'ifReserve', false)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
@ -446,6 +462,7 @@ export default {
|
|||
this.$set(cartItem, 'restrictNum', food.dishesDetailList[0].restrictNum)
|
||||
this.$set(cartItem, 'prefPrice', food.dishesDetailList[0].prefPrice)
|
||||
|
||||
|
||||
if(cartItem.orderDate == this.newDate2){//存在且时间一致
|
||||
// this.$set(food, 'quantity', cartItem.quantity)
|
||||
this.$set(cartItem,'isDfficacy', 1) //有效
|
||||
|
|
@ -626,7 +643,15 @@ export default {
|
|||
url: `/pages/advanceOrder/orderDetails?carList=${JSON.stringify(arr)}&canteenId=${this.menuData.canteenId}&stallId=${this.menuData.stallId}&canteenName=${this.menuData.canteenName}&stallName=${this.menuData.stallName}&totalPrice=${this.totalPrice}&orderDate=${this.newDate2}`
|
||||
})
|
||||
},
|
||||
|
||||
//日期
|
||||
formatDate(date) {
|
||||
// 格式化为 YYYY-MM-DD
|
||||
date = new Date(date)
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
return `${year}-${month}-${day}`;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
<span style="font-size: 20rpx;color: #666;font-weight: 400;text-decoration: line-through;margin-left: 10rpx;">¥{{ (item.dishesDetailList[0].dishesPrice/100).toFixed(2) }}</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right-cont" v-if="item.surplusNum!=0">
|
||||
<view class="right-cont" v-if="item.surplusNum!=0&&item.ifReserve">
|
||||
<u-icon v-if="item.quantity > 0"
|
||||
name="../../static/images/delete.png"
|
||||
size="18"
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
</span>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<view v-if="ifReserve">
|
||||
<u-button shape="circle" color="#FF6816" style="width: 79px; height: 28px" @click="handleOrder">结算</u-button>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -136,7 +136,7 @@
|
|||
{{ (food.prefPrice/100).toFixed(2) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="right-cont">
|
||||
<view class="right-cont" v-if="food.ifReserve">
|
||||
<view class="num-wrap" v-if="food.isDfficacy==1">
|
||||
<view style="width: 40rpx;" @click="handleFoodNum(1, food)">
|
||||
<u-icon
|
||||
|
|
@ -217,7 +217,8 @@ export default {
|
|||
active: 1, // 1 自取 2 外卖
|
||||
// canteenName: '宏源工业园/本周菜谱',
|
||||
canteenType: '自取', // 1 自取 2 外卖
|
||||
isHandle:false
|
||||
isHandle:false,//重复点击校验
|
||||
ifReserve:true//是否在可预订时间范围内
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
|
|
@ -262,7 +263,6 @@ export default {
|
|||
this.newDate2 = this.daysList[index].paramDate
|
||||
this.getMenuListData()
|
||||
},
|
||||
// 获取当前时间
|
||||
getNowFormatDate(data) {
|
||||
let date = new Date(data)
|
||||
let year = date.getFullYear()
|
||||
|
|
@ -303,6 +303,22 @@ export default {
|
|||
this.$set(food, 'monthlySales', food.dishesDetailList[0].monthlySales)
|
||||
this.$set(food, 'goodProbability', food.dishesDetailList[0].goodProbability)
|
||||
this.$set(food, 'surplusNum', food.dishesDetailList[0].surplusNum)
|
||||
this.$set(food, 'ifReserve', true)
|
||||
let currentDate = this.formatDate(new Date()); // 获取当前时间
|
||||
if(currentDate!=this.newDate2){
|
||||
let str = this.formatDate(new Date())+" "+food.reserveEndTime;
|
||||
// let str = this.formatDate(new Date())+" 14:00:00";
|
||||
console.log(str)
|
||||
let currentTime = new Date().getTime();
|
||||
let inputTime = new Date(str).getTime();
|
||||
if (currentTime < inputTime) {
|
||||
console.log("可以预定");
|
||||
} else {
|
||||
console.log("不可预定");
|
||||
this.$set(food, 'ifReserve', false)
|
||||
this.$set(this, 'ifReserve', false)
|
||||
}
|
||||
}
|
||||
this.$set(food, 'restrictNum', food.dishesDetailList[0].restrictNum)
|
||||
this.$set(food, 'dishesPrice', food.dishesDetailList[0].dishesPrice)
|
||||
this.$set(food, 'prefPrice', food.dishesDetailList[0].prefPrice)
|
||||
|
|
@ -456,6 +472,17 @@ export default {
|
|||
this.$set(cartItem, 'surplusNum', food.dishesDetailList[0].surplusNum)
|
||||
this.$set(cartItem, 'restrictNum', food.dishesDetailList[0].restrictNum)
|
||||
this.$set(cartItem, 'prefPrice', food.dishesDetailList[0].prefPrice)
|
||||
this.$set(cartItem, 'ifReserve', true)
|
||||
let currentDate = this.formatDate(new Date()); // 获取当前时间
|
||||
if(currentDate!=this.newDate2){
|
||||
let str = this.formatDate(new Date())+" "+food.reserveEndTime;
|
||||
// let str = this.formatDate(new Date())+" 14:00:00";
|
||||
let currentTime = new Date().getTime();
|
||||
let inputTime = new Date(str).getTime();
|
||||
if (currentTime < inputTime) {} else {
|
||||
this.$set(cartItem, 'ifReserve', false)
|
||||
}
|
||||
}
|
||||
|
||||
if(cartItem.orderDate == this.newDate2){//存在且时间一致
|
||||
this.$set(food, 'quantity', cartItem.quantity)
|
||||
|
|
@ -630,7 +657,15 @@ export default {
|
|||
url: `/pages/advanceOrder/orderDetails?carList=${JSON.stringify(arr)}&canteenId=${this.canteenId}&stallId=${this.stallId}&canteenName=${this.canteenName}&stallName=${this.stallName}&totalPrice=${this.totalPrice}&orderDate=${this.newDate2}`
|
||||
})
|
||||
},
|
||||
|
||||
//日期
|
||||
formatDate(date) {
|
||||
// 格式化为 YYYY-MM-DD
|
||||
date = new Date(date)
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
return `${year}-${month}-${day}`;
|
||||
},
|
||||
//垂直定位锚点
|
||||
scrollToDetail(index) {
|
||||
console.log('?? ~ scrollToDetail ~ index', index)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<!-- 提示信息 -->
|
||||
<view class="tips">
|
||||
<text class="tip-item">·五官端正,面部无遮挡(请使用人脸照片)</text>
|
||||
<text class="tip-item">·不要带视频(如墨镜等)</text>
|
||||
<text class="tip-item">·不要带饰品(如墨镜等)</text>
|
||||
<text class="tip-item">·请在光线明亮的纯色背景下拍照(建议背景颜色为白色)</text>
|
||||
<text class="tip-item">·上传照片后需保存,保存失败照片将被清除</text>
|
||||
</view>
|
||||
|
|
@ -55,6 +55,8 @@
|
|||
import { queryFacePhotoApi,uploadPhotoGenCodeForAppApi } from '@/api/mine/index'
|
||||
import { uploadBase64 } from "@/api/upload"
|
||||
import { pathToBase64, base64ToPath } from 'image-tools';
|
||||
import Compressor from 'compressorjs';
|
||||
import ImageCompressor from 'image-compressor.js';
|
||||
import config from '@/config'
|
||||
import { showConfirm } from '@/utils/common'
|
||||
export default {
|
||||
|
|
@ -110,20 +112,27 @@
|
|||
},
|
||||
handleChooseImage() {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
count: 1,
|
||||
sizeType:["compressed"],
|
||||
success: resImage => {
|
||||
console.log(resImage)
|
||||
this.facePhotoUrl = resImage.tempFilePaths[0]
|
||||
this.imageUrl = resImage.tempFilePaths[0]
|
||||
this.imgToBase64(resImage.tempFilePaths[0]).then(base64 => {
|
||||
console.log(base64)
|
||||
this.base64=base64;
|
||||
this.uploadFaceImg()
|
||||
const tempFile = resImage.tempFiles[0];
|
||||
console.log(tempFile)
|
||||
this.compressFile(tempFile).then(res => {
|
||||
console.log(res)
|
||||
const url = URL.createObjectURL(res)
|
||||
this.imgToBase64(url).then(base64 => {
|
||||
console.log(base64)
|
||||
this.base64=base64;
|
||||
this.uploadFaceImg()
|
||||
})
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
handleUpload() {
|
||||
console.log(this.imageUrl)
|
||||
if (!this.agreed || !this.imageUrl) return
|
||||
|
|
@ -150,72 +159,56 @@
|
|||
});
|
||||
}
|
||||
// if(res)
|
||||
})
|
||||
|
||||
|
||||
// uni.showToast({
|
||||
// title: '上传成功',
|
||||
// icon: 'success',
|
||||
// duration: 2000,
|
||||
// success: () => {
|
||||
// setTimeout(() => {
|
||||
// this.goBack()
|
||||
// }, 2000)
|
||||
// }
|
||||
// })
|
||||
|
||||
// uni.uploadFile({
|
||||
// url: config.baseUrl + '/system/user/profile/avatar',
|
||||
// filePath: this.imageUrl,
|
||||
// name: 'avatarfile',
|
||||
// header: {
|
||||
// 'Authorization': 'Bearer ' + getToken()
|
||||
// },
|
||||
// success: (uploadFileRes) => {
|
||||
// console.log(uploadFileRes);
|
||||
// if(uploadFileRes.statusCode == 200) {
|
||||
// let reslut = JSON.parse(uploadFileRes.data)
|
||||
// console.log('reslut',reslut)
|
||||
// if(reslut.code == 200) {
|
||||
// uni.showToast({
|
||||
// title: '上传成功',
|
||||
// icon: 'success',
|
||||
// duration: 2000,
|
||||
// success: () => {
|
||||
// setTimeout(() => {
|
||||
// this.goBack()
|
||||
// }, 2000)
|
||||
// }
|
||||
// })
|
||||
// }else{
|
||||
// uni.showToast({ title: reslut.msg,icon: 'none' });
|
||||
// }
|
||||
// }else if(uploadFileRes.statusCode == 401) {
|
||||
// showConfirm("登录状态已过期,您可以继续留在该页面,或者重新登录?").then(res => {
|
||||
// if (res.confirm) {
|
||||
// uni.reLaunch({ url: '/pages/login/login' })
|
||||
// }
|
||||
// })
|
||||
// }else{
|
||||
// uni.showToast({ title: uploadFileRes.errMsg,icon: 'none' });
|
||||
// }
|
||||
// uni.hideLoading()
|
||||
// },
|
||||
// fail: (uploadFileErr) => {
|
||||
// let { message } = uploadFileErr
|
||||
// if (message == 'Network Error') {
|
||||
// message = '后端接口连接异常'
|
||||
// } else if (message.includes('timeout')) {
|
||||
// message = '系统接口请求超时'
|
||||
// } else if (message.includes('Request failed with status code')) {
|
||||
// message = '系统接口' + message.substr(message.length - 3) + '异常'
|
||||
// }
|
||||
// uni.showToast({ title: message,icon: 'none' });
|
||||
// uni.hideLoading()
|
||||
// }
|
||||
// });
|
||||
})
|
||||
},
|
||||
compressFile(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const options = {
|
||||
success(result) {
|
||||
// 将压缩后的 Blob 转换为 File 对象(如果组件支持Blob则不用这一步)
|
||||
const compressedFile = new File([result], file.name, {
|
||||
type: file.type,
|
||||
lastModified: Date.now(),
|
||||
});
|
||||
return resolve(compressedFile);
|
||||
},
|
||||
error(e) {
|
||||
return reject(e);
|
||||
},
|
||||
};
|
||||
// 1-3MB
|
||||
if (file.size > 0.5 * 1024 * 1024 && file.size <= 3 * 1024 * 1024) {
|
||||
options.quality = 0.3; // 压缩质量
|
||||
options.convertSize = false;//不进行图像尺寸的调整
|
||||
options.checkOrientation = false; // 图片翻转,默认为false
|
||||
}
|
||||
// 3-4MB
|
||||
if (file.size > 3 * 1024 * 1024 && file.size <= 4 * 1024 * 1024) {
|
||||
options.quality = 0.25; // 压缩质量
|
||||
options.convertSize = false;//不进行图像尺寸的调整
|
||||
options.checkOrientation = false; // 图片翻转,默认为false
|
||||
}
|
||||
// 5-6MB
|
||||
if (file.size > 5 * 1024 * 1024 && file.size <= 6 * 1024 * 1024) {
|
||||
options.quality = 0.2; // 压缩质量
|
||||
options.convertSize = false;//不进行图像尺寸的调整
|
||||
options.checkOrientation = false; // 图片翻转,默认为false
|
||||
}
|
||||
// 6-7MB
|
||||
if (file.size > 6 * 1024 * 1024 && file.size <= 7 * 1024 * 1024) {
|
||||
options.quality = 0.15; // 压缩质量
|
||||
options.convertSize = false;//不进行图像尺寸的调整
|
||||
options.checkOrientation = false; // 图片翻转,默认为false
|
||||
}
|
||||
// 7-9MB
|
||||
if (file.size > 7 * 1024 * 1024 && file.size <= 9 * 1024 * 1024) {
|
||||
options.quality = 0.1; // 压缩质量
|
||||
options.convertSize = false;//不进行图像尺寸的调整
|
||||
options.checkOrientation = false; // 图片翻转,默认为false
|
||||
}
|
||||
new ImageCompressor(file, options);
|
||||
});
|
||||
},
|
||||
|
||||
showAgreement() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/privacy-agreement/index'
|
||||
|
|
|
|||
|
|
@ -277,7 +277,15 @@ export default {
|
|||
// 立即充值按钮
|
||||
onRechargeNow() {
|
||||
console.log(this.rechargeAmount)
|
||||
this.chosenShow = true
|
||||
if(this.balanceInfo.accAllBal>300000){
|
||||
uni.showToast({
|
||||
title: "总余额大于3000元无法继续充值!",
|
||||
icon: 'none'
|
||||
})
|
||||
}else{
|
||||
this.chosenShow = true
|
||||
}
|
||||
|
||||
},
|
||||
goSubPage(){
|
||||
uni.navigateTo({
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<view class="work-container">
|
||||
<!-- 第一个条目 -->
|
||||
<view class="item" v-for="item in weekCookList" :key="item.recipeId" @click="goMenuList(item)">
|
||||
<image class="image" :src="item.canteenImgUrl"></image>
|
||||
<image class="image" :src="item.stallImgUrl"></image>
|
||||
<view class="content">
|
||||
<text class="title">本周菜谱</text>
|
||||
<text class="sub-title">食堂:{{ item.canteenName }}</text>
|
||||
|
|
|
|||
|
|
@ -223,8 +223,9 @@ export default {
|
|||
//退单
|
||||
refundOrder() {
|
||||
if(this.detailData.payState==3||this.detailData.payState==6){
|
||||
let hours = new Date().getHours();//拿到当前小时
|
||||
if(Number(hours)>13){
|
||||
let orderTime = this.detailData.orderDate+" 14:00:00" //
|
||||
let nowTime = new Date().getTime();//拿到当前时间
|
||||
if(nowTime>orderTime){
|
||||
uni.showToast({
|
||||
title: "14点以后无法退单!",
|
||||
icon: 'none'
|
||||
|
|
|
|||
Loading…
Reference in New Issue