first
This commit is contained in:
103
pagesCreateOrder/order-detail/components/list.vue
Normal file
103
pagesCreateOrder/order-detail/components/list.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length">
|
||||
<view class="u-font-32">
|
||||
<text>共</text>
|
||||
<text class="color-main font-bold"> {{goodsNumber}}</text>
|
||||
<text>份菜品</text>
|
||||
</view>
|
||||
<view class="u-m-t-20 list">
|
||||
<view class="item u-m-b-20" v-for="(item,index) in data" :key="index">
|
||||
<view class="u-flex u-col-top">
|
||||
<view>
|
||||
<image class="img" :src="item.coverImg" mode=""></image>
|
||||
</view>
|
||||
<view class="u-p-l-30 u-flex-1">
|
||||
<view class="u-flex u-row-between u-col-top">
|
||||
<view>{{item.name}}</view>
|
||||
<view class="u-text-right">
|
||||
<view>¥{{item.salePrice}}</view>
|
||||
<view class="u-m-t-10 u-font-24">X{{item.number}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-20">
|
||||
<my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button>
|
||||
<my-button :width="168" :height="60" plain shape="circle">退菜</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="bg-gray u-p-20 u-m-t-20 ">
|
||||
<view>备注</view>
|
||||
<view class="u-m-t-10">无</view>
|
||||
</view>
|
||||
<view class="u-m-t-40">
|
||||
<view class="u-flex u-row-between border-bottom u-p-b-20">
|
||||
<view class="tag no-pay">
|
||||
未支付
|
||||
</view>
|
||||
<view>
|
||||
<text>小计¥</text>
|
||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view></view>
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-30">
|
||||
<my-button type="cancel" :color="color.ColorMain">重新打印</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed
|
||||
} from 'vue';
|
||||
import color from '@/commons/color.js'
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
})
|
||||
const allPrice = computed(() => {
|
||||
return props.data.reduce((prve, cur) => {
|
||||
return prve + cur.salePrice * cur.number
|
||||
}, 0).toFixed(2)
|
||||
})
|
||||
|
||||
const goodsNumber = computed(() => {
|
||||
let result = 0
|
||||
result = props.data.reduce((prve, cur) => {
|
||||
return prve + cur.number
|
||||
}, 0)
|
||||
return result
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.img {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
}
|
||||
.border-bottom{
|
||||
border-color: rgb(240, 240, 240);
|
||||
}
|
||||
.tag {
|
||||
padding: 2rpx 8rpx;
|
||||
border-radius: 8rpx;
|
||||
|
||||
&.no-pay {
|
||||
background-color: rgb(170, 170, 170);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
63
pagesCreateOrder/order-detail/components/order.vue
Normal file
63
pagesCreateOrder/order-detail/components/order.vue
Normal file
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>订单状态</view>
|
||||
<view>{{returnStatus(data.status)}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>订单类型</view>
|
||||
<view>堂食</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>桌位号</view>
|
||||
<view>{{table.name}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>就餐人数</view>
|
||||
<view>1</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>支付方式</view>
|
||||
<view></view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>预约时间</view>
|
||||
<view></view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>下单时间</view>
|
||||
<view>2024-08-31 15:54:40</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>订单编号</view>
|
||||
<view>2024083115544056362</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>商家备注</view>
|
||||
<my-button plain shape="circle" :width="160" :height="60">编辑</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
table:{
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
})
|
||||
|
||||
const statusMap={
|
||||
unpaid:'未支付'
|
||||
}
|
||||
function returnStatus(status){
|
||||
return statusMap[status]||''
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
26
pagesCreateOrder/order-detail/components/step.vue
Normal file
26
pagesCreateOrder/order-detail/components/step.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
||||
<my-steps :dot="true" current="0" direction="column">
|
||||
<my-steps-item title="2024-09-02 09:19" :itemStyle="itemStyle" desc="[东风(id:124413)]使用代客下单提交。(未打印预结单)">
|
||||
</my-steps-item>
|
||||
<my-steps-item title="2024-09-02 09:19" desc="[东风(id:124413)]使用代客下单提交。(未打印预结单)">
|
||||
</my-steps-item>
|
||||
</my-steps>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive
|
||||
} from 'vue';
|
||||
import color from '@/commons/color.js'
|
||||
const itemStyle = reactive({
|
||||
color: 'rgb(255,0,0)'
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
40
pagesCreateOrder/order-detail/components/user.vue
Normal file
40
pagesCreateOrder/order-detail/components/user.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<view class="u-font-28 default-box-padding u-relative bg-fff border-r-12 u-overflow-hide">
|
||||
<view class="change u-absolute my-bg-main color-fff left-top" >切换</view>
|
||||
<view class="u-flex u-row-between u-m-t-20 border-bottom u-p-b-20">
|
||||
<view class="u-flex">
|
||||
<my-avatar :size="30"></my-avatar>
|
||||
<view class="color-666 u-m-l-30">未绑定手机号</view>
|
||||
</view>
|
||||
<view>
|
||||
<my-button :height="60" plain shape="circle">他的订单</my-button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-20 u-row-between">
|
||||
<view class="">
|
||||
<view class="font-bold">0.00</view>
|
||||
<view class="color-666 u-m-t-10">余额</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="font-bold">0.00</view>
|
||||
<view class="color-666 u-m-t-10">积分</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="font-bold">0.00</view>
|
||||
<view class="color-666 u-m-t-10">已消费</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.change{
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 0 0 16rpx 0;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
</style>
|
||||
125
pagesCreateOrder/order-detail/order-detail.vue
Normal file
125
pagesCreateOrder/order-detail/order-detail.vue
Normal file
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<view class="min-page bg-gray u-font-28 u-p-30">
|
||||
<user-vue></user-vue>
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
||||
<text class="color-666">桌位号:</text>
|
||||
<text class="font-bold">{{options.name}}</text>
|
||||
</view>
|
||||
<goods-list :data="orderDetail.goodsList"></goods-list>
|
||||
<order-vue :data="orderDetail.info" :table="options"></order-vue>
|
||||
<step-vue></step-vue>
|
||||
<view style="height: 200rpx;"></view>
|
||||
<view class="u-fixed bottom bg-fff ">
|
||||
<view class="u-flex u-abso">
|
||||
<view class="u-flex-1">
|
||||
<my-button @tap="diancan" color="#fff" bgColor="rgb(57,53,52)" borderRadius="100rpx 0 0 100rpx"
|
||||
shape="circle" plain type="primary">加菜</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button @tap="toPay" borderRadius="0 100rpx 100rpx 0" shape="circle"
|
||||
type="primary">结账</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import userVue from './components/user.vue';
|
||||
import orderVue from './components/order.vue';
|
||||
import goodsList from './components/list.vue';
|
||||
import stepVue from './components/step.vue';
|
||||
import go from '@/commons/utils/go.js'
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
onHide
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive
|
||||
} from 'vue';
|
||||
import OrderDetail from './page.js'
|
||||
const uiPage = new OrderDetail()
|
||||
setTimeout(() => {
|
||||
uiPage.setVal('user', {
|
||||
name: 1
|
||||
})
|
||||
}, 1500)
|
||||
|
||||
function diancan() {
|
||||
go.to('PAGES_CREATE_ORDER', {
|
||||
tableId: options.tableId,
|
||||
tableName: options.name
|
||||
})
|
||||
}
|
||||
|
||||
function toPay() {
|
||||
go.to('PAGES_CRESATE_ORDER_PAY', {
|
||||
...orderDetail.info,
|
||||
tableId: options.tableId,
|
||||
tableName: options.name,
|
||||
masterId: options.masterId,
|
||||
})
|
||||
}
|
||||
|
||||
const orderDetail = reactive({
|
||||
goodsList: [],
|
||||
info: {}
|
||||
})
|
||||
const options = reactive({})
|
||||
async function init() {
|
||||
const {
|
||||
masterId
|
||||
} = await Api.$getMasterId(options)
|
||||
console.log(masterId);
|
||||
options.masterId=masterId
|
||||
const {
|
||||
records
|
||||
} = await Api.getCart({
|
||||
...options,
|
||||
masterId
|
||||
})
|
||||
orderDetail.goodsList = records
|
||||
const info = await Api.$createOrder({
|
||||
masterId,
|
||||
vipUserId: '',
|
||||
tableId: options.tableId,
|
||||
note: '',
|
||||
postPay: true,
|
||||
orderld: ''
|
||||
})
|
||||
orderDetail.info = info
|
||||
}
|
||||
function watchEmit(){
|
||||
uni.$off('orderDetail:update')
|
||||
uni.$once('orderDetail:update',(newval)=>{
|
||||
console.log(newval);
|
||||
init()
|
||||
})
|
||||
}
|
||||
onShow(()=>{
|
||||
watchEmit()
|
||||
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt)
|
||||
console.log(options);
|
||||
init()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bottom {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 68rpx;
|
||||
|
||||
.u-abso {
|
||||
bottom: 84rpx;
|
||||
left: 28rpx;
|
||||
right: 28rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
23
pagesCreateOrder/order-detail/page.js
Normal file
23
pagesCreateOrder/order-detail/page.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import {
|
||||
reactive, ref
|
||||
} from 'vue';
|
||||
function isSameType(a, b) {
|
||||
return a instanceof b === true || b instanceof a === true;
|
||||
}
|
||||
class OrderDetail {
|
||||
constructor(data) {
|
||||
const user ={}
|
||||
const table = {}
|
||||
const goodsList =[]
|
||||
const orderInfo = {}
|
||||
this.data=reactive({
|
||||
user,table,goodsList,orderInfo
|
||||
})
|
||||
Object.assign(this, data)
|
||||
}
|
||||
setVal(key,val){
|
||||
this.data[key]=val
|
||||
}
|
||||
}
|
||||
|
||||
export default OrderDetail
|
||||
Reference in New Issue
Block a user