预定餐1
This commit is contained in:
parent
aa45cb917b
commit
64c739bfb5
|
|
@ -1,17 +1,17 @@
|
|||
<template>
|
||||
<view>
|
||||
<div class="top-wrap">
|
||||
<div class="top-cont flex justify-between align-center">
|
||||
<div class="flex align-center">
|
||||
<view class="top-wrap">
|
||||
<view class="top-cont flex justify-between align-center">
|
||||
<view class="flex align-center">
|
||||
<u-icon name="../../static/images/time.png" size="16"></u-icon>
|
||||
<span style="margin-left: 5px">{{ newDate }}</span>
|
||||
</div>
|
||||
<!-- <div class="top-right-cont">
|
||||
</view>
|
||||
<!-- <view class="top-right-cont">
|
||||
<span class="right-item" :class="{ active: active == 1 }" @click="active = 1">自取</span>
|
||||
<span class="right-item" :class="{ active: active == 2 }" @click="active = 2">外卖</span>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="tab-navigation">
|
||||
<Tabs :tabList="tabList" @changeTab="changeTab" />
|
||||
</view>
|
||||
|
|
@ -26,11 +26,11 @@
|
|||
<scroll-view class="content-right" scroll-y="true">
|
||||
<view class="scroll-right-item" v-for="(item,index) in dishesList" :key="index">
|
||||
<view style="width: 100%;display: flex;align-items: center;">
|
||||
<view style="width: 30%;height: 100%;">
|
||||
<view style="width: 30%;height: 100%;" @click="goMenuDetail(item)">
|
||||
<image class="image" :src="item.dishesImgUrl"></image>
|
||||
</view>
|
||||
<view style="width: 65%;height: 100%; display: flex;position: relative;">
|
||||
<view class="center-cont">
|
||||
<view class="center-cont" @click="goMenuDetail(item)">
|
||||
<view class="meal-name" style="margin-bottom: 10rpx;font-weight: bold;">{{ item.dishesName }}</view>
|
||||
<view class="sale-num" style="margin-bottom: 10rpx;">月销 {{ item.monthlySales||0 }}</view>
|
||||
<view class="num-cont" style="margin-bottom: 10rpx;">
|
||||
|
|
@ -64,81 +64,84 @@
|
|||
</view>
|
||||
|
||||
<!-- 购物车 -->
|
||||
<div style="height: 60px"></div>
|
||||
<div class="shop-car">
|
||||
<div class="car-cont">
|
||||
<div class="flex align-center" @click="openCar">
|
||||
<view style="height: 60px"></view>
|
||||
<view class="shop-car">
|
||||
<view class="car-cont">
|
||||
<view class="flex align-center" @click="openCar">
|
||||
<u-icon name="../../static/images/shop-car.png" size="25"></u-icon>
|
||||
<span class="money">
|
||||
<span style="font-size: 11px">¥</span>
|
||||
{{ totalPrice }}
|
||||
</span>
|
||||
</div>
|
||||
</view>
|
||||
|
||||
<div>
|
||||
<view>
|
||||
<u-button shape="circle" color="#FF6816" style="width: 79px; height: 28px" @click="handleOrder">结算</u-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 购物车-pop -->
|
||||
<u-popup :show="showCar" position="bottom" :round="12" @close="showCar = false">
|
||||
<div class="popup-cont">
|
||||
<div class="flex justify-between align-center">
|
||||
<div style="font-weight: 500; font-size: 14px">已加购菜品</div>
|
||||
<div style="font-weight: 400; font-size: 12px; color: #ff6816" @click="showModal = true">清空</div>
|
||||
</div>
|
||||
<view class="popup-cont">
|
||||
<view class="flex justify-between align-center">
|
||||
<view style="font-weight: 500; font-size: 14px">已加购菜品</view>
|
||||
<view style="font-weight: 400; font-size: 12px; color: #ff6816" @click="showModal = true">清空</view>
|
||||
</view>
|
||||
|
||||
<div class="flex justify-between align-center" style="margin: 20.5px 0 12.5px">
|
||||
<div class="flex align-center">
|
||||
<view class="flex justify-between align-center" style="margin: 20.5px 0 12.5px">
|
||||
<view class="flex align-center">
|
||||
{{ canteenName }}/{{stallName}}
|
||||
<span class="name-type">{{ canteenType }}</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
</view>
|
||||
<view>
|
||||
{{ newDate2 }}
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<div class="list-wrap">
|
||||
<div class="cont-list" v-for="(food, foodIndex) in addFood">
|
||||
<div>
|
||||
<u-image :src="food.dishesImgUrl" showLoading width="80px" height="80px" />
|
||||
</div>
|
||||
|
||||
<div class="center-cont">
|
||||
<div class="meal-name">{{ food.dishesName }}</div>
|
||||
<div class="sale-num">月销 {{ food.monthlySales||0 }}</div>
|
||||
<div class="num-cont">
|
||||
<span style="margin-right: 5px">{{ '库存' + food.dishesDetailList[0].surplusNum }}</span>
|
||||
<span>{{ '限购' + food.dishesDetailList[0].restrictNum }}</span>
|
||||
</div>
|
||||
<div class="sale-price">
|
||||
<span style="font-size: 11px">¥</span>
|
||||
{{ (food.dishesDetailList[0].prefPrice/100).toFixed(2) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="right-cont">
|
||||
<div class="num-wrap">
|
||||
<u-icon
|
||||
v-if="food.num > 0"
|
||||
name="../../static/images/del.png"
|
||||
size="16"
|
||||
@click="handleFoodNum(1, food)"
|
||||
/>
|
||||
<span class="cont-num">{{ food.num || 0 }}</span>
|
||||
<u-icon
|
||||
:disabled="food.num < food.restrictNum"
|
||||
name="../../static/images/add2.png"
|
||||
size="16"
|
||||
@click="handleFoodNum(2, food)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<view class="list-wrap">
|
||||
<view class="cont-list" v-for="(food, foodIndex) in addFood">
|
||||
<u-swipe-action>
|
||||
<u-swipe-action-item :options="options" @click="delFood($event, food)">
|
||||
<view style="width: 100%;display: flex;height: auto;">
|
||||
<view>
|
||||
<u-image :src="food.dishesImgUrl" showLoading width="80px" height="80px" />
|
||||
</view>
|
||||
<view class="center-cont">
|
||||
<view class="meal-name">{{ food.dishesName }}</view>
|
||||
<view class="sale-num">月销 {{ food.monthlySales||0 }}</view>
|
||||
<view class="num-cont">
|
||||
<span style="margin-right: 5px">{{ '库存' + food.dishesDetailList[0].surplusNum }}</span>
|
||||
<span>{{ '限购' + food.dishesDetailList[0].restrictNum }}</span>
|
||||
</view>
|
||||
<view class="sale-price">
|
||||
<span style="font-size: 11px">¥</span>
|
||||
{{ (food.dishesDetailList[0].prefPrice/100).toFixed(2) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="right-cont">
|
||||
<view class="num-wrap">
|
||||
<u-icon
|
||||
v-if="food.num > 0"
|
||||
name="../../static/images/del.png"
|
||||
size="16"
|
||||
@click="handleFoodNum(1, food)"
|
||||
/>
|
||||
<span class="cont-num">{{ food.num || 0 }}</span>
|
||||
<u-icon
|
||||
:disabled="food.num < food.restrictNum"
|
||||
name="../../static/images/add2.png"
|
||||
size="16"
|
||||
@click="handleFoodNum(2, food)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-swipe-action-item>
|
||||
</u-swipe-action>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
<u-modal :show="showModal" showCancelButton title="提示" @cancel="showModal = false" @confirm="clearCar">
|
||||
|
|
@ -150,7 +153,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getlistReserveDateAPI,getAdvanceDetailListAPI,addAdvancehoppingCartAPI,updateAdvancehoppingCartAPI,getShoppingCartListAPI } from '@/api/advanceOrder/index.js'
|
||||
import { getlistReserveDateAPI,getAdvanceDetailListAPI,addAdvancehoppingCartAPI,updateAdvancehoppingCartAPI,clearAdvancehoppingCartAPI,getShoppingCartListAPI } from '@/api/advanceOrder/index.js'
|
||||
import Tabs from '@/pages/components/Tabs.vue'
|
||||
export default {
|
||||
components: { Tabs },
|
||||
|
|
@ -176,6 +179,13 @@ export default {
|
|||
showModal: false, // 清空购物车
|
||||
// 添加的菜品
|
||||
addFood: [],
|
||||
options: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#f56c6c'
|
||||
}
|
||||
}],
|
||||
|
||||
|
||||
current: 0,
|
||||
active: 1, // 1 自取 2 外卖
|
||||
|
|
@ -330,8 +340,10 @@ export default {
|
|||
this.recipeId=options.recipeId;
|
||||
//获取预定日期
|
||||
this.getReserveDate()
|
||||
//获取预定餐菜谱
|
||||
this.getMenuListData()
|
||||
setTimeout(()=>{
|
||||
//获取预定餐菜谱
|
||||
this.getMenuListData()
|
||||
},1000)
|
||||
},
|
||||
methods: {
|
||||
//获取预定日期
|
||||
|
|
@ -363,12 +375,12 @@ export default {
|
|||
let day = date.getDate().toString().padStart(2, '0')
|
||||
this.newDate2 = `${year}-${month}-${day}`
|
||||
},
|
||||
|
||||
|
||||
// 获取菜谱
|
||||
async getMenuListData() {
|
||||
let param = {
|
||||
"recipeId":this.recipeId,
|
||||
// "applyDate":this.newDate2
|
||||
// "applyDate":this.newDate2,
|
||||
"applyDate":"2024-11-11"
|
||||
}
|
||||
const res = await getAdvanceDetailListAPI(param)
|
||||
|
|
@ -441,6 +453,11 @@ export default {
|
|||
return '夜宵'
|
||||
}
|
||||
},
|
||||
goMenuDetail(item){
|
||||
uni.navigateTo({
|
||||
url: `/pages/weeklyMenu/menuDetail?params=${JSON.stringify(item)}`
|
||||
})
|
||||
},
|
||||
//获取预定购物车(订单)
|
||||
async getShoppingCartList(){
|
||||
let param = {
|
||||
|
|
@ -463,6 +480,42 @@ export default {
|
|||
if(food.baseDishesId==cartItem.goodsDishesId){
|
||||
// food.num = food.num+1
|
||||
this.$set(food, 'num', cartItem.quantity)
|
||||
let obj = {
|
||||
"canteenId":this.canteenId,
|
||||
"canteenName":this.canteenName,
|
||||
"costModelList":food.costModelList,
|
||||
"custId": uni.getStorageSync('custId'),
|
||||
"detailType": food.detailType,
|
||||
"extParam": null,
|
||||
"goodsDishesId": cartItem.goodsDishesId,
|
||||
"goodsDishesImgUrl": food.dishesImgUrl,
|
||||
"goodsDishesName": cartItem.goodsDishesName,
|
||||
"ifExpired": cartItem.ifExpired,
|
||||
"inventoryId": cartItem.inventoryId,
|
||||
"mealtimeName": cartItem.mealtimeName,
|
||||
"mealtimeType": cartItem.mealtimeType,
|
||||
"menuDetailId": cartItem.menuDetailId,
|
||||
"menuId": cartItem.menuId,
|
||||
// "orderDate": cartItem.orderDate,
|
||||
"orderDate": this.newDate2,
|
||||
"orderType": cartItem.orderType,
|
||||
"dishesDetailList":food.dishesDetailList,
|
||||
"prefPrice": food.dishesDetailList[0].prefPrice,
|
||||
"quantity": cartItem.quantity,
|
||||
"restrictNum": cartItem.restrictNum,
|
||||
"salePrice": cartItem.salePrice,
|
||||
"salesMode": cartItem.salesMode,
|
||||
"shoppingCartId": cartItem.shoppingCartId,
|
||||
"sizeJson": cartItem.sizeJson,
|
||||
"sizeName": cartItem.sizeName,
|
||||
"sizeType": cartItem.sizeType,
|
||||
"stallId": this.stallId,
|
||||
"stallName": this.stallName,
|
||||
"surplusNum": cartItem.surplusNum,
|
||||
"unitName": null,
|
||||
"weightUnit": null
|
||||
}
|
||||
this.$set(cartItem, 'orderDetailList', [obj])
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
@ -494,12 +547,43 @@ export default {
|
|||
}
|
||||
|
||||
},
|
||||
//删除按钮
|
||||
async delFood(e,item){
|
||||
console.log(e)
|
||||
console.log(item)
|
||||
console.log(this.shoppingCartList)
|
||||
let param = {
|
||||
"custId":uni.getStorageSync('custId'),
|
||||
"shoppingCartId":"",
|
||||
"quantity":0
|
||||
}
|
||||
this.shoppingCartList.forEach(cartItem=>{
|
||||
if(item.baseDishesId==cartItem.goodsDishesId){
|
||||
param.shoppingCartId=cartItem.shoppingCartId
|
||||
}
|
||||
})
|
||||
this.menuData.forEach(menuItem => {
|
||||
menuItem.typeList.forEach(detail => {
|
||||
detail.dishesList.forEach(food => {
|
||||
if(food.baseDishesId==item.baseDishesId){
|
||||
this.$set(food, 'num', 0)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
console.log(param)
|
||||
const res = await updateAdvancehoppingCartAPI(param)
|
||||
if(res.code==200){
|
||||
this.getShoppingCartList()
|
||||
}
|
||||
},
|
||||
|
||||
async addShopCart(item){
|
||||
console.log(item)
|
||||
let param = {
|
||||
"orderType": 2,
|
||||
// "orderDate":this.newDate2
|
||||
"orderDate":"2024-11-11",
|
||||
"orderDate":this.newDate2,
|
||||
// "orderDate":"2024-11-11",
|
||||
"mealtimeType":item.mealtimeType,
|
||||
"custId":uni.getStorageSync('custId'),
|
||||
"menuId":this.recipeId,
|
||||
|
|
@ -508,6 +592,7 @@ export default {
|
|||
"goodsDishesId":item.baseDishesId,
|
||||
"goodsDishesName":item.dishesName,
|
||||
"quantity":1,
|
||||
"prefPrice":item.prefPrice
|
||||
}
|
||||
const res = await addAdvancehoppingCartAPI(param)
|
||||
if(res.code==200){
|
||||
|
|
@ -542,7 +627,42 @@ export default {
|
|||
this.getShoppingCartList()
|
||||
}
|
||||
},
|
||||
// 打开购物车
|
||||
//购物车-清空按钮
|
||||
clearCar(){
|
||||
let arr = []
|
||||
this.shoppingCartList.forEach(cartItem=>{
|
||||
arr.push(cartItem.shoppingCartId)
|
||||
})
|
||||
try {
|
||||
let param = {
|
||||
"custId":uni.getStorageSync('custId'),
|
||||
"shoppingCartIds":arr,
|
||||
}
|
||||
console.log(param)
|
||||
clearAdvancehoppingCartAPI(param).then(res => {
|
||||
if(res.code==200){
|
||||
console.log(res)
|
||||
this.menuData.forEach(menuItem => {
|
||||
menuItem.typeList.forEach(detail => {
|
||||
detail.dishesList.forEach(food => {
|
||||
this.$set(food, 'num', 0)
|
||||
})
|
||||
})
|
||||
})
|
||||
this.getShoppingCartList()
|
||||
this.showModal = false
|
||||
}else{
|
||||
this.getShoppingCartList()
|
||||
this.showModal = false
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// 打开购物车
|
||||
openCar() {
|
||||
if (this.totalPrice == 0) return
|
||||
this.showCar = true
|
||||
|
|
@ -550,7 +670,7 @@ export default {
|
|||
// 计算总价格与添加的菜品-购物车-每次添加删减菜品都得计算
|
||||
handleTotalPrice() {
|
||||
let total = 0
|
||||
let addFood = []
|
||||
let addFood = []
|
||||
this.menuData.forEach(item => {
|
||||
item.typeList.forEach(detail => {
|
||||
detail.dishesList.forEach(food => {
|
||||
|
|
@ -561,42 +681,13 @@ export default {
|
|||
})
|
||||
})
|
||||
})
|
||||
this.totalPrice = total.toFixed(1)
|
||||
this.totalPrice = total.toFixed(2)
|
||||
this.addFood = addFood
|
||||
if (this.addFood.length == 0) this.showCar = false
|
||||
console.log('🚀 ~ handleTotalPrice ~ total', this.totalPrice)
|
||||
console.log('🚀 ~ handleTotalPrice ~ addFood', this.addFood)
|
||||
},
|
||||
//购物车-清空按钮
|
||||
clearCar(){
|
||||
this.shoppingCartList.forEach(cartItem=>{
|
||||
try {
|
||||
let param = {
|
||||
"custId":uni.getStorageSync('custId'),
|
||||
"shoppingCartId":cartItem.shoppingCartId,
|
||||
"quantity":0
|
||||
}
|
||||
console.log(param)
|
||||
updateAdvancehoppingCartAPI(param).then(res => {
|
||||
if(res.code==200){
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
})
|
||||
this.menuData.forEach(menuItem => {
|
||||
menuItem.typeList.forEach(detail => {
|
||||
detail.dishesList.forEach(food => {
|
||||
this.$set(food, 'num', 0)
|
||||
})
|
||||
})
|
||||
})
|
||||
this.getShoppingCartList()
|
||||
this.showModal = false
|
||||
},
|
||||
|
||||
// 订单结算
|
||||
handleOrder() {
|
||||
console.log('结算')
|
||||
|
|
@ -609,7 +700,7 @@ export default {
|
|||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/advanceOrder/orderDetails?canteenId=${this.canteenId}&stallId=${this.stallId}&canteenName=${this.canteenName}&stallName=${this.stallName}`
|
||||
url: `/pages/advanceOrder/orderDetails?carList=${JSON.stringify(this.shoppingCartList)}&canteenId=${this.canteenId}&stallId=${this.stallId}&canteenName=${this.canteenName}&stallName=${this.stallName}&totalPrice=${this.totalPrice}&orderDate=${this.newDate2}`
|
||||
})
|
||||
},
|
||||
//垂直定位锚点
|
||||
|
|
@ -787,9 +878,9 @@ page {
|
|||
}
|
||||
}
|
||||
.cont-list {
|
||||
display: flex;
|
||||
// display: flex;
|
||||
padding: 8px;
|
||||
position: relative;
|
||||
// position: relative;
|
||||
/* border-bottom: 1px solid #f0f0f0; */
|
||||
}
|
||||
.center-cont {
|
||||
|
|
|
|||
|
|
@ -22,22 +22,22 @@
|
|||
<div class="img-cont m-8">
|
||||
<div class="img-list m-8" v-for="(item, index) in shoppingCartList" :key="index">
|
||||
<div class="flex align-center">
|
||||
<u-image :src="item.goodsDishesImgUrl" width="80px" height="80px" />
|
||||
<u-image :src="item.orderDetailList[0].goodsDishesImgUrl" width="80px" height="80px" />
|
||||
<div class="name-num">
|
||||
<div style="margin-bottom: 10px">{{ item.goodsDishesName }}</div>
|
||||
<div>x{{ item.quantity }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>¥{{ (item.salePrice/100).toFixed(2) }}</div>
|
||||
<div>¥{{ (item.orderDetailList[0].dishesDetailList[0].prefPrice/100).toFixed(2) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between m-8 bt">
|
||||
配送费
|
||||
<div>{{ detailData.deliveryFee }}</div>
|
||||
<div>{{ detailData.deliveryFee||"免配送费" }}</div>
|
||||
</div>
|
||||
<div class="flex justify-between m-8 bt">
|
||||
包装费
|
||||
<div>{{ detailData.packingFee }}</div>
|
||||
<div>{{ detailData.packingFee||"免包装费" }}</div>
|
||||
</div>
|
||||
<div class="flex justify-between align-center m-8 bt">
|
||||
备注
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
<u-line />
|
||||
<div class="flex justify-between m-8 realAmount">
|
||||
小计
|
||||
<div>¥{{ detailData.realAmount || 12 }}</div>
|
||||
<div>¥{{ totalPrice }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="order">
|
||||
|
|
@ -69,12 +69,12 @@
|
|||
<div class="flex align-center">
|
||||
<span class="money">
|
||||
<span style="font-size: 13px">实付款¥</span>
|
||||
{{ detailData.totalPrice }}
|
||||
{{ totalPrice }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<u-button shape="circle" color="#FF6816" style="width: 79px; height: 28px" @click="handleOrder">
|
||||
<u-button shape="circle" color="#FF6816" style="width: 79px; height: 28px" @click="handleOrder(1)">
|
||||
结算
|
||||
</u-button>
|
||||
</div>
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getShoppingCartListAPI } from '@/api/advanceOrder/index.js'
|
||||
import { getListElectronMobileUsableAPI,addReserveMealApi } from '@/api/advanceOrder/index.js'
|
||||
export default {
|
||||
props: {},
|
||||
data() {
|
||||
|
|
@ -101,6 +101,8 @@ export default {
|
|||
canteenName:"",
|
||||
stallId:"",
|
||||
stallName:"",
|
||||
totalPrice:0,
|
||||
orderDate:"",
|
||||
shoppingCartList:[],
|
||||
// 详情页数据
|
||||
detailData: {
|
||||
|
|
@ -140,31 +142,268 @@ export default {
|
|||
this.canteenId = options.canteenId
|
||||
this.canteenName = options.canteenName
|
||||
this.stallId = options.stallId
|
||||
this.stallName = options.stallName
|
||||
this.getShoppingCartList()
|
||||
this.stallName = options.stallName
|
||||
this.totalPrice = Number(options.totalPrice).toFixed(2)
|
||||
this.orderDate = options.orderDate;
|
||||
this.shoppingCartList=JSON.parse(options.carList)
|
||||
console.log(this.shoppingCartList)
|
||||
this.getListElectronMobileUsable()
|
||||
},
|
||||
methods: {
|
||||
//获取预定购物车(订单)
|
||||
async getShoppingCartList(){
|
||||
//(获取餐卷)
|
||||
async getListElectronMobileUsable(){
|
||||
let param = {
|
||||
"custId":uni.getStorageSync('custId'),
|
||||
"canteenId":this.canteenId,
|
||||
"stallId":this.stallId,
|
||||
}
|
||||
const res = await getShoppingCartListAPI(param)
|
||||
console.log(res, '预订餐预定')
|
||||
if(res.code==200){
|
||||
this.shoppingCartList = res.data;
|
||||
console.log(this.shoppingCartList)
|
||||
}else{
|
||||
this.shoppingCartList = []
|
||||
"canteenIdSet":[this.canteenId],
|
||||
"shopstallIdSet":[this.stallId],
|
||||
"intervalIdSet":[this.shoppingCartList[0].mealtimeType]
|
||||
}
|
||||
const res = await getListElectronMobileUsableAPI(param)
|
||||
console.log(res, '获取餐卷')
|
||||
|
||||
},
|
||||
confirm(e) {
|
||||
console.log('🚀 ~ confirm ~ value:', e)
|
||||
this.showPicker = false
|
||||
this.detailData.orderState = e.value[0].label
|
||||
},
|
||||
getNowFormatDate() {
|
||||
let date = new Date()
|
||||
let year = date.getFullYear()
|
||||
let month = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||
let day = date.getDate().toString().padStart(2, '0')
|
||||
let hours = date.getHours().toString().padStart(2, '0');
|
||||
let minutes = date.getMinutes().toString().padStart(2, '0');
|
||||
let seconds = date.getSeconds().toString().padStart(2, '0');
|
||||
return `${year}-${month}-${day}`
|
||||
},
|
||||
async handleOrder(){
|
||||
let orderDetailList = []
|
||||
console.log(this.shoppingCartList)
|
||||
this.shoppingCartList.forEach(item=>{
|
||||
orderDetailList.push(item.orderDetailList[0])
|
||||
})
|
||||
let param={
|
||||
"amount": this.totalPrice*100,
|
||||
"couponId": "",
|
||||
"custId": uni.getStorageSync('custId'),
|
||||
"ifTrial": 1,
|
||||
"ordTime": this.getNowFormatDate(),
|
||||
// "ordTime": "2025-02-20 13:57:21",
|
||||
"payType": 1,
|
||||
"reserveMealList":[
|
||||
{
|
||||
"canteenId": this.canteenId,
|
||||
"canteenName": this.canteenName,
|
||||
"stallId": this.stallId,
|
||||
"stallName": this.stallName,
|
||||
"consigneeMobile": "yyvwjetYVxeP1VW3vTv7nQ==",
|
||||
"consigneeName": "dsf ",
|
||||
"costModelList": [
|
||||
{
|
||||
"deliveryAmount": null,
|
||||
"deliveryName": "自取堂食",
|
||||
"deliveryType": 1,
|
||||
"packingFee": null
|
||||
}
|
||||
],
|
||||
"counterId": "",
|
||||
"deliveryAddr": "自取堂食",
|
||||
"deliveryCosts": null,
|
||||
"deliveryFee": 0,
|
||||
"deliveryType": 1,
|
||||
"mealtimeName": this.shoppingCartList[0].mealtimeName,
|
||||
"mealtimeType": this.shoppingCartList[0].mealtimeType,
|
||||
"orderDate": this.orderDate,
|
||||
"orderDetailList": orderDetailList,
|
||||
"packingFee": null,
|
||||
"payableAmount": this.totalPrice*100,
|
||||
"payType": 1,
|
||||
"placeOrdMobile": "",
|
||||
"placeOrdName": "",
|
||||
"remark": this.detailData.remark,
|
||||
"sxresult":[],
|
||||
"takeList":[],
|
||||
}
|
||||
]
|
||||
}
|
||||
console.log(param)
|
||||
const res = await addReserveMealApi(param)
|
||||
console.log(res)
|
||||
if(res.code==200){
|
||||
if(res.data.code==10000){
|
||||
|
||||
setTimeout(()=>{
|
||||
// this.handleOrder2()
|
||||
},500)
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/advanceOrder/payResult?result=${JSON.stringify(res.data)}`
|
||||
// })
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
async handleOrder2(){
|
||||
let orderDetailList = []
|
||||
console.log(this.shoppingCartList)
|
||||
this.shoppingCartList.forEach(item=>{
|
||||
orderDetailList.push(item.orderDetailList[0])
|
||||
})
|
||||
let param={
|
||||
"amount": this.totalPrice*100,
|
||||
"couponId": "",
|
||||
"custId": uni.getStorageSync('custId'),
|
||||
"ifTrial": 1,
|
||||
"ordTime": this.getNowFormatDate(),
|
||||
// "ordTime": "2025-02-20 13:57:21",
|
||||
"payType": 1,
|
||||
"reserveMealList":[
|
||||
{
|
||||
"canteenId": this.canteenId,
|
||||
"canteenName": this.canteenName,
|
||||
"stallId": this.stallId,
|
||||
"stallName": this.stallName,
|
||||
"consigneeMobile": "yyvwjetYVxeP1VW3vTv7nQ==",
|
||||
"consigneeName": "dsf ",
|
||||
"costModelList": [
|
||||
{
|
||||
"deliveryAmount": null,
|
||||
"deliveryName": "自取堂食",
|
||||
"deliveryType": 1,
|
||||
"packingFee": null
|
||||
}
|
||||
],
|
||||
"counterId": "",
|
||||
"deliveryAddr": "自取堂食",
|
||||
"deliveryCosts": null,
|
||||
"deliveryFee": 0,
|
||||
"deliveryType": 1,
|
||||
"mealtimeName": this.shoppingCartList[0].mealtimeName,
|
||||
"mealtimeType": this.shoppingCartList[0].mealtimeType,
|
||||
"orderDate": this.orderDate,
|
||||
"orderDetailList": orderDetailList,
|
||||
"packingFee": null,
|
||||
"payableAmount": this.totalPrice*100,
|
||||
"payType": 1,
|
||||
"placeOrdMobile": "",
|
||||
"placeOrdName": "",
|
||||
"remark": this.detailData.remark,
|
||||
"sxresult":[],
|
||||
"takeList":[],
|
||||
}
|
||||
]
|
||||
}
|
||||
console.log(param)
|
||||
const res = await addReserveMealApi(param)
|
||||
console.log(res)
|
||||
if(res.code==200){
|
||||
if(res.data.code==10000){
|
||||
setTimeout(()=>{
|
||||
// this.handleOrder3()
|
||||
},500)
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/advanceOrder/payResult?result=${JSON.stringify(res.data)}`
|
||||
// })
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
async handleOrder3(){
|
||||
let orderDetailList = []
|
||||
console.log(this.shoppingCartList)
|
||||
this.shoppingCartList.forEach(item=>{
|
||||
orderDetailList.push(item.orderDetailList[0])
|
||||
})
|
||||
let param={
|
||||
"amount": this.totalPrice*100,
|
||||
"couponId": "",
|
||||
"custId": uni.getStorageSync('custId'),
|
||||
"ifTrial": 2,
|
||||
"ordTime": this.getNowFormatDate(),
|
||||
// "ordTime": "2025-02-20 13:57:21",
|
||||
"payType": 1,
|
||||
"reserveMealList":[
|
||||
{
|
||||
"canteenId": this.canteenId,
|
||||
"canteenName": this.canteenName,
|
||||
"stallId": this.stallId,
|
||||
"stallName": this.stallName,
|
||||
"consigneeMobile": "yyvwjetYVxeP1VW3vTv7nQ==",
|
||||
"consigneeName": "dsf ",
|
||||
"costModelList": [
|
||||
{
|
||||
"deliveryAmount": null,
|
||||
"deliveryName": "自取堂食",
|
||||
"deliveryType": 1,
|
||||
"packingFee": null
|
||||
}
|
||||
],
|
||||
"counterId": "",
|
||||
"deliveryAddr": "自取堂食",
|
||||
"deliveryCosts": null,
|
||||
"deliveryFee": 0,
|
||||
"deliveryType": 1,
|
||||
"mealtimeName": this.shoppingCartList[0].mealtimeName,
|
||||
"mealtimeType": this.shoppingCartList[0].mealtimeType,
|
||||
"orderDate": this.orderDate,
|
||||
"orderDetailList": orderDetailList,
|
||||
"packingFee": null,
|
||||
"payableAmount": this.totalPrice*100,
|
||||
"payType": 1,
|
||||
"placeOrdMobile": "",
|
||||
"placeOrdName": "",
|
||||
"remark": this.detailData.remark,
|
||||
"sxresult":[],
|
||||
"takeList":[],
|
||||
}
|
||||
]
|
||||
}
|
||||
console.log(param)
|
||||
const res = await addReserveMealApi(param)
|
||||
console.log(res)
|
||||
if(res.code==200){
|
||||
if(res.data.code==10000){
|
||||
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/advanceOrder/payResult?result=${JSON.stringify(res.data)}`
|
||||
// })
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,171 @@
|
|||
<template>
|
||||
<view>
|
||||
<div class="body"></div>
|
||||
<view style="width: 100%;height: 50vh;display: flex;flex-direction: column;align-items: center;">
|
||||
|
||||
<view style="margin-top: 20vh;display: flex;flex-direction: column;align-items: center;width: 100%;">
|
||||
<u-icon name="checkmark-circle-fill" size="64" color="#00aa00"></u-icon>
|
||||
<view style="color: 00aa00;font-size: 18px;margin-top: 40rpx;color: #00aa00;">支付成功</view>
|
||||
|
||||
<view style="font-size: 24px;width: 100%;text-align: center;margin: 20rpx;font-weight: bold;">¥{{(resultData.payAmount/100).toFixed(2)}}</view>
|
||||
|
||||
<view style="width: 80%;display: flex; justify-content: space-between;margin: 20rpx auto;">
|
||||
<view class="search-btn" @click="goIndex">返回首页</view>
|
||||
<view class="back-btn" @click="goDetail">查看订单</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view style="margin-top: 20vh;display: flex;flex-direction: column;align-items: center;width: 100%;" v-else>
|
||||
<u-icon name="error-circle-fill" size="64" color="#ff007f"></u-icon>
|
||||
<view style="color: 00aa00;font-size: 18px;margin-top: 40rpx;">支付失败</view>
|
||||
<view style="width: 80%;display: flex; justify-content: space-between;margin: 20rpx auto;">
|
||||
<view class="search-btn" @click="goBack">返回</view>
|
||||
<view class="back-btn" @click="goIndex">取消</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import { getRechargeResultApi,getRechargeQueryResultApi } from '../../api/index/index'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
resultData:{},
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
this.resultData = JSON.parse(option.result)
|
||||
this.$forceUpdate()
|
||||
console.log(this.resultData)
|
||||
console.log(this.resultData.orderList[0])
|
||||
|
||||
// this.resultData = {
|
||||
// "accBal": 1267,
|
||||
// "code": 10000,
|
||||
// "expireTime": null,
|
||||
// "extParam": null,
|
||||
// "goodIdSet": null,
|
||||
// "lessAmountForDelivery": 0,
|
||||
// "msg": "成功",
|
||||
// "orderAmountChangeList": [
|
||||
// ],
|
||||
// "orderList": [
|
||||
// {
|
||||
// "canteenId": "378928463446282240",
|
||||
// "canteenName": "宏源工业园",
|
||||
// "checkState": null,
|
||||
// "commentState": 2,
|
||||
// "couponAmount": 0,
|
||||
// "deductionType": 1,
|
||||
// "deliveryAmount": 0,
|
||||
// "discountsAmount": 0,
|
||||
// "dishesState": 1,
|
||||
// "expireTime": null,
|
||||
// "imgUrl": null,
|
||||
// "lessAmountForDelivery": null,
|
||||
// "machineName": null,
|
||||
// "machineNum": null,
|
||||
// "machineSn": null,
|
||||
// "macOrderId": "416036469958774785",
|
||||
// "mealCode": null,
|
||||
// "mealtimeName": "下午茶",
|
||||
// "mealtimeType": "3",
|
||||
// "needPayAmount": 70,
|
||||
// "orderDate": "2025-02-20",
|
||||
// "orderDetailList": [
|
||||
// {
|
||||
// "calcTotalAmount": 70,
|
||||
// "checkState": null,
|
||||
// "detailId": "416036470088798208",
|
||||
// "detailState": 1,
|
||||
// "detailType": 1,
|
||||
// "goodsDishesId": "385949065063436288",
|
||||
// "goodsDishesImgUrl": "http://sgwpdm.ah.sgcc.com.cn/canteen/lnyst/378915229716713472/dishes/8e3978b0f293495d91c12666633744a3.jpg",
|
||||
// "goodsDishesName": "萝卜包",
|
||||
// "goodsDishesTypeName": null,
|
||||
// "goodsRefundNum": 0,
|
||||
// "imageUrl": "http://sgwpdm.ah.sgcc.com.cn/canteen/lnyst/378915229716713472/dishes/8e3978b0f293495d91c12666633744a3.jpg",
|
||||
// "menuDetailId": "413945018588336132",
|
||||
// "orderId": "416036469958774786",
|
||||
// "prefPrice": 70,
|
||||
// "price": 70,
|
||||
// "quantity": 1,
|
||||
// "realAmount": 0,
|
||||
// "realPrice": 0.0,
|
||||
// "refundAmount": 0,
|
||||
// "salePrice": 70,
|
||||
// "salesMode": 1,
|
||||
// "shoppingCartId": "416036442989400064",
|
||||
// "tasteName": null,
|
||||
// "totalAmount": 70,
|
||||
// "unitName": null,
|
||||
// "weightUnit": 100
|
||||
// }
|
||||
// ],
|
||||
// "orderDetailSum": 1,
|
||||
// "orderId": "416036469958774786",
|
||||
// "orderRefundState": 1,
|
||||
// "orderState": 4,
|
||||
// "orderStateMixMobile": 22,
|
||||
// "orderTime": "2025-02-19 10:02:24",
|
||||
// "orderType": 2,
|
||||
// "packingAmount": 0,
|
||||
// "payableAmount": 70,
|
||||
// "payState": 1,
|
||||
// "payTime": null,
|
||||
// "payType": 1,
|
||||
// "plateNum": null,
|
||||
// "plateSerialNum": null,
|
||||
// "realAmount": 0,
|
||||
// "refundAmount": 0,
|
||||
// "refundTime": null,
|
||||
// "sourceType": 7,
|
||||
// "stallId": "379068538876334080",
|
||||
// "stallName": "外卖(提前一天预定,下午16:00截止订单;第二天下午16:30取货)"
|
||||
// }
|
||||
// ],
|
||||
// "payAmount": 70,
|
||||
// "payParamStr": null,
|
||||
// "redEnvelope": 0,
|
||||
// "subsidyBal": 0,
|
||||
// "tradeId": "416036469958774784",
|
||||
// "unpaidBalance": 0,
|
||||
// "walletBal": 1267,
|
||||
// }
|
||||
|
||||
},
|
||||
methods:{
|
||||
goIndex(){
|
||||
uni.switchTab({
|
||||
url: '/pages/index'
|
||||
})
|
||||
},
|
||||
goBack(){
|
||||
uni.navigateBack()
|
||||
},
|
||||
goDetail(){
|
||||
uni.navigateTo({
|
||||
url: `/pages/work/details?params=${JSON.stringify(this.resultData.orderList[0])}`
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.search-btn{
|
||||
width: 40%;background: #fff;
|
||||
height: 40px;line-height: 40px;
|
||||
text-align: center;color: #000;
|
||||
border-radius: 10rpx;margin-top: 40rpx;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
.back-btn{
|
||||
width: 40%;background: #ff6633;height: 40px;line-height: 40px;text-align: center;color: #fff;border-radius: 10rpx;margin-top: 40rpx;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
@ -31,41 +31,26 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getAdvanceOrderStallApi } from '@/api/advanceOrder/index.js'
|
||||
import { getAdvanceOrderStallApi,getlistReserveDateAPI } from '@/api/advanceOrder/index.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
orderDate:"",
|
||||
canteenId:"",
|
||||
canteenName:"",
|
||||
merchantList: [
|
||||
{
|
||||
id: 1,
|
||||
name: '宏雷大厨外卖',
|
||||
avatar: '/static/logo.png',
|
||||
monthlySales: 1984,
|
||||
businessHours: '00:00-23:59',
|
||||
isOpen: true
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '年货预订',
|
||||
avatar: '/static/logo.png',
|
||||
monthlySales: 2,
|
||||
businessHours: '00:00-14:59',
|
||||
isOpen: false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getAdvanceOrderStallList()
|
||||
onLoad() {
|
||||
this.getAdvanceOrderStallList()
|
||||
},
|
||||
methods: {
|
||||
methods: {
|
||||
async getAdvanceOrderStallList() {
|
||||
try {
|
||||
let param = {
|
||||
"custId":uni.getStorageSync('custId'),
|
||||
"applyDate":"2024-11-09"
|
||||
"applyDate":"2024-11-11"
|
||||
}
|
||||
const res = await getAdvanceOrderStallApi(param)
|
||||
console.log('🚀 ~ getList ~ res:', res)
|
||||
|
|
|
|||
Loading…
Reference in New Issue