This commit is contained in:
duan
2024-09-18 09:05:21 +08:00
47 changed files with 2340 additions and 509 deletions

View File

@@ -1,16 +1,20 @@
{ // launch.json 配置了启动调试时相关设置configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ {
// launchtype项可配置值为local或remote, local代表前端连本地云函数remote代表前端连云端云函数 // launch.json 配置了启动调试时相关设置configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
"version": "0.0", // launchtype项可配置值为local或remote, local代表前端连本地云函数remote代表前端连云端云函数
"configurations": [{ "version" : "0.0",
"default" : "configurations" : [
{ {
"launchtype" : "local" "default" : {
}, "launchtype" : "local"
"mp-weixin" : },
{ "mp-weixin" : {
"launchtype" : "local" "launchtype" : "local"
}, },
"type" : "uniCloud" "type" : "uniCloud"
} },
{
"playground" : "custom",
"type" : "uni-app:app-android"
}
] ]
} }

84
commons/orderEnum.js Normal file
View File

@@ -0,0 +1,84 @@
export default {
status: [
{
key: 'unpaid',
label: '待支付'
},
{
key: 'unsend',
label: '待发货'
},
{
key: 'closed',
label: '订单完成'
},
{
key: 'send',
label: '已发'
},
{
key: 'refunding',
label: '申请退单'
},
{
key: 'refund',
label: '退单'
},
{
key: 'cancelled',
label: '取消订单'
},
{
key: 'merge',
label: '合台'
},
{
key: 'pending',
label: '挂单'
},
{
key: 'activate',
label: '激活'
},
{
key: 'paying',
label: '支付中'
}
],
sendType: [
{
key: 'post',
label: '快递'
},
{
key: 'takeaway',
label: '外卖'
},
{
key: 'takeself',
label: '自提'
},
{
key: 'table',
label: '堂食'
}
],
orderType: [
{
key: 'cash',
label: '收银'
},
{
key: 'miniapp',
label: '小程序'
},
{
key: 'offline',
label: '线下'
},
{
key: 'return',
label: '退单'
}
]
}

View File

@@ -1,30 +1,34 @@
export const $status = { export const $status = {
pending: { pending: {
label: "挂单中", label: "挂单中",
type: "#E6A23C", type: "#E6A23C",
}, },
using: { using: {
label: "开台中", label: "开台中",
type: "rgb(250,85,85)", type: "#fa5555",
}, },
paying: { paying: {
label: "结算中", label: "结算中",
type: "#E6A23C", type: "#E6A23C",
}, },
idle: { idle: {
label: "空闲", label: "空闲",
type: "#318AFE", type: "#3F9EFF",
}, },
subscribe: { subscribe: {
label: "预定", label: "预定",
type: "#E6A23C", type: "rgb(34, 191, 100)",
}, },
closed: { closed: {
label: "关台", label: "关台",
type: "#ddd", type: "rgb(221,221,221)",
}, },
cleaning: { // opening: {
label: "台桌清理中", // label: "开台中",
type: "#909399", // type: "#67C23A",
}, // },
cleaning: {
label: "待清台",
type: "#FAAD14",
}
} }

View File

@@ -0,0 +1,30 @@
import dayjs from 'dayjs';
// 获取今天的开始和结束时间
export function getTodayTimestamps() {
const start = dayjs().startOf('day').format('YYYY-MM-DD HH:mm:ss');
const end = dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss');
return { start, end ,label:'今日'};
}
// 获取昨天的开始和结束时间
export function getYesterdayTimestamps() {
const start = dayjs().subtract(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss');
const end = dayjs().subtract(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss');
return { start, end ,label:'昨日'};
}
// 获取本周的开始和结束时间
export function getThisWeekTimestamps() {
const start = dayjs().startOf('week').format('YYYY-MM-DD HH:mm:ss');
const end = dayjs().endOf('week').format('YYYY-MM-DD HH:mm:ss');
return { start, end,label:'本周' };
}
// 获取本月的开始和结束时间
export function getThisMonthTimestamps() {
const start = dayjs().startOf('month').format('YYYY-MM-DD HH:mm:ss');
const end = dayjs().endOf('month').format('YYYY-MM-DD HH:mm:ss');
return { start, end ,label:'本月'};
}

View File

@@ -4,7 +4,7 @@
<slot name="title"> <slot name="title">
</slot> </slot>
<view class="item" @tap.stop="itemClick(index)" v-for="(item,index) in props.list" :key="index"> <view class="item" @tap.stop="itemClick(index)" v-for="(item,index) in props.list" :key="index">
<button class="bg-fff btn" hover-class="btn-hover-class">{{item}}</button> <button class="bg-fff btn" hover-class="btn-hover-class" :class="{'color-main':active==index}">{{item}}</button>
</view> </view>
<view class="bock-gary"></view> <view class="bock-gary"></view>
<view class="cancel-btn" @tap="close"> <view class="cancel-btn" @tap="close">
@@ -18,6 +18,11 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
const props=defineProps({ const props=defineProps({
//那个按钮文字高亮
active:{
type:Number,
default:-1
},
autoClose:{ autoClose:{
type:Boolean, type:Boolean,
default:true default:true

View File

@@ -138,6 +138,7 @@
function cancel() { function cancel() {
show.value = false show.value = false
emits('cancel') emits('cancel')
emits('close')
} }
function confirm() { function confirm() {

View File

@@ -216,4 +216,76 @@ export function $payOrder(data) {
...data ...data
} }
}); });
} }
//退单
export function $returnCart(data) {
return request({
url: '/api/place/returnCart',
method: "put",
data:{
shopId: uni.getStorageSync('shopId'),
...data
}
});
}
// 选择台桌
export function $choseTable(data) {
return request({
url: '/api/place/choseTable',
method: "put",
data:{
shopId: uni.getStorageSync('shopId'),
...data
}
});
}
// 用餐人数
export function $choseCount(data) {
return request({
url: '/api/place/choseCount',
method: "put",
data:{
shopId: uni.getStorageSync('shopId'),
...data
}
});
}
// 批量生成台桌
export function $fastCreateTable(data) {
return request({
url: '/api/tbShopTable/generate',
method: "post",
data:{
shopId: uni.getStorageSync('shopId'),
...data
}
});
}
//打印当前台桌订单
export function $printOrder(data) {
return request({
url: '/api/place/printOrder',
method: "post",
data:{
shopId: uni.getStorageSync('shopId'),
...data
}
});
}
//打印当前台桌菜品
export function $printDishes(data) {
return request({
url: '/api/place/printDishes',
method: "post",
data:{
shopId: uni.getStorageSync('shopId'),
...data
}
});
}

View File

@@ -23,10 +23,6 @@ const loadingShowTime = 200
function getHeader(){ function getHeader(){
const headerObject={} const headerObject={}
headerObject["Authorization"] = storageManage.token() headerObject["Authorization"] = storageManage.token()
headerObject["Content-Type"] = 'application/json'
headerObject["loginname"] = 'admin'
headerObject["token"] = 'eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyVHlwZSI6Ik1HIiwiZXhwIjoxNjkwMTgwNzE2LCJ1c2VySWQiOiIyNDQiLCJpYXQiOjE2ODg3MDk0ODcsImxvZ2luTmFtZSI6ImFkbWluIn0.lqxxvv2-FcecQngMBorz4MpkB3mIJQDG-IUULQyV-KQ'
headerObject["userId"] = '244'
return headerObject return headerObject
} }

93
http/yskApi/order.js Normal file
View File

@@ -0,0 +1,93 @@
import http from './http.js'
const request=http.request
/**
* 查询订单
* @param {*} data
* @returns
*/
export function tbOrderInfoData(data) {
return request({
url: "/api/tbOrderInfo/date",
method: "post",
data: {
shopId: uni.getStorageSync('shopId'),
...data
}
});
}
/**
* 导出数据
* @param {*} data
* @returns
*/
export function tbOrderInfoDownload(data) {
return request({
url: "/api/tbOrderInfo/download",
method: "post",
data: {
shopId: uni.getStorageSync('shopId'),
...data
},
responseType: "blob"
});
}
/**
* 通过Id查询订单
* @param {*} id
* @returns
*/
export function tbOrderInfoDetail(id) {
return request({
url: `/api/tbOrderInfo/${id}`,
method: "get"
});
}
/**
* 通过Id查询订单
* @param {*} createdAt
* @returns
*/
export function payCount(createdAt) {
console.log(createdAt);
return request({
url: `/api/tbOrderInfo/payCount`,
method: "post",
data: {
shopId: uni.getStorageSync('shopId'),
createdAt: createdAt
}
});
}
/**
* 订单列表
* @param {*} createdAt
* @returns
*/
export function tbGroupOrderInfo(params) {
return request({
url: `/api/tbGroupOrderInfo`,
method: "post",
data: {
shopId: uni.getStorageSync('shopId'),
...params
}
});
}
/**
* 退单
* @param {*} data
* @returns
*/
export function returnGpOrder(data) {
return request({
url: `/api/tbGroupOrderInfo/returnGpOrder`,
method: "post",
data
});
}

View File

@@ -10,4 +10,5 @@ import infoBox from '@/commons/utils/infoBox.js'
/* 台桌区域 */ /* 台桌区域 */
export const $tableArea=new $API('/api/tbShopArea',http.req) export const $tableArea=new $API('/api/tbShopArea',http.req)
/* 台桌 */ /* 台桌 */
export const $table=new $API('/api/tbShopTable',http.req) export const $table=new $API('/api/tbShopTable',http.req)

View File

@@ -1,6 +1,6 @@
{ {
"name" : "银收客", "name" : "银收客",
"appid" : "__UNI__9C51A5E", "appid" : "__UNI__66E7BD0",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : 100, "versionCode" : 100,
@@ -176,57 +176,56 @@
"unipush" : { "unipush" : {
"enable" : true "enable" : true
}, },
"devServer": { "devServer" : {
"disableHostCheck": true, "disableHostCheck" : true,
"proxy": { "proxy" : {
"/shopApi": { "/shopApi" : {
// 需要被代理的后台地址 // 需要被代理的后台地址
"target": "https://wxcashiertest.sxczgkj.cn/cashierService", "target" : "https://wxcashiertest.sxczgkj.cn/cashierService",
"changeOrigin": true, "changeOrigin" : true,
"secure": false, "secure" : false,
"pathRewrite": { "pathRewrite" : {
"^/shopApi": "" "^/shopApi" : ""
} }
}, },
"/mch": { "/mch" : {
// 需要被代理的后台地址 // 需要被代理的后台地址
"target": "https://b.rscygroup.com", "target" : "https://b.rscygroup.com",
"changeOrigin": true, "changeOrigin" : true,
"secure": false, "secure" : false,
"pathRewrite": { "pathRewrite" : {
"^/mch": "" "^/mch" : ""
} }
}, },
"/server1": { "/server1" : {
// 需要被代理的后台地址 // 需要被代理的后台地址
"target": "http://101.37.12.135:8080", "target" : "http://101.37.12.135:8080",
"changeOrigin": true, "changeOrigin" : true,
"secure": false, "secure" : false,
"pathRewrite": { "pathRewrite" : {
"^/server1": "" "^/server1" : ""
} }
}, },
"/server3": { "/server3" : {
// 需要被代理的后台地址 // 需要被代理的后台地址
"target": "http://101.37.12.135:8080", "target" : "http://101.37.12.135:8080",
"changeOrigin": true, "changeOrigin" : true,
"secure": false, "secure" : false,
"pathRewrite": { "pathRewrite" : {
"^/server3": "" "^/server3" : ""
} }
}, },
"/ysk": { "/ysk" : {
// 需要被代理的后台地址 // 需要被代理的后台地址
"target": "https://admintestpapi.sxczgkj.cn", "target" : "https://admintestpapi.sxczgkj.cn",
"changeOrigin": true, "changeOrigin" : true,
"secure": false, "secure" : false,
"pathRewrite": { "pathRewrite" : {
"/ysk": "" "/ysk" : ""
} }
} }
} }
}
}
}, },
"mp-alipay" : { "mp-alipay" : {
"appid" : "2021004128648214" "appid" : "2021004128648214"

View File

@@ -1,6 +1,6 @@
<template> <template>
<view class="u-p-30 safe-page"> <view class="u-p-30 safe-page">
<up-sticky v-if="option.type==='edit'" offset-top="20"> <up-sticky v-if="option.type==='edit'" offset-top="20" zIndex="99">
<myTabs :list="tabsList" @change="tabsChange"></myTabs> <myTabs :list="tabsList" @change="tabsChange"></myTabs>
</up-sticky> </up-sticky>

View File

@@ -0,0 +1,120 @@
<template>
<view>
<view class="category " :style="getCompouteStyle()">
<scroll-view scroll-y="true" :style="{height:props.height+'rpx'}">
<view class="list">
<view v-if="showAllText" class="font-bold item border-bottom u-font-28" @tap="cateClick({id:'',name:'全部分类'})">全部分类</view>
<view v-for="(item,index) in category.list" :key="index">
<view class="item font-bold border-bottom" @tap="cateClick(item)">
{{item.name}}
</view>
<view class="item border-bottom" @tap="cateClick(child)"
v-for="(child,childIndex) in item.childrenList"
:key="childIndex" >
<text>&nbsp;&nbsp;</text>
{{child.name}}
</view>
</view>
</view>
</scroll-view>
</view>
</view>
</template>
<script setup>
import {
ref, warn, watch, watchEffect,
onMounted,reactive
} from 'vue';
import {$tbShopCategory} from '@/http/yskApi/goods.js'
const emite=defineEmits(['cateClick','change'])
const props = defineProps({
showAllText:{
type:Boolean,
default:true
},
width: {
type: [Number, String],
default: 264
},
height: {
type: [Number, String],
default: 420
},
right: {
type: [Number, String],
default: 30
},
bottom: {
type: [Number, String],
default: 0
}
})
let show = ref(false)
watch(()=>show.value,(newval)=>{
emite('change',newval)
})
function open() {
show.value = true
}
function close() {
show.value = false
}
function toggle() {
show.value = !show.value
}
function cateClick(item){
emite('cateClick',item)
close()
}
function getCompouteStyle() {
return {
width: props.width + 'rpx',
height: props.height + 'rpx',
right: props.right + 'rpx',
bottom: props.bottom + 'rpx',
transform:`scaleY(${show.value?1:0})`
}
}
const category=reactive({
list:[],
categoryId:'',
categoryName:'',
})
onMounted(()=>{
$tbShopCategory({
page:0,size:200
}).then(res=>{
category.list=res.content
})
})
defineExpose({
open,
close,toggle
})
</script>
<style lang="scss" scoped>
.category {
background: #FFFFFF;
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
border-radius: 14rpx 14rpx 14rpx 14rpx;
position: fixed;
font-size: 24rpx;
color: #333;
.list{
box-sizing: border-box;
.item{
padding: 24rpx 24rpx 24rpx 48rpx;
}
}
}
</style>

View File

@@ -1,25 +1,5 @@
<template> <template>
<view> <up-picker :show="show" keyName="name" @confirm="confirm" :columns="category.list" @close="close" @cancel="close" :closeOnClickOverlay="true"></up-picker>
<view class="category " :style="getCompouteStyle()">
<scroll-view scroll-y="true" :style="{height:props.height+'rpx'}">
<view class="list">
<view v-if="showAllText" class="font-bold item border-bottom u-font-28" @tap="cateClick({id:'',name:'全部分类'})">全部分类</view>
<view v-for="(item,index) in category.list" :key="index">
<view class="item font-bold border-bottom" @tap="cateClick(item)">
{{item.name}}
</view>
<view class="item border-bottom" @tap="cateClick(child)"
v-for="(child,childIndex) in item.childrenList"
:key="childIndex" >
<text>&nbsp;&nbsp;</text>
{{child.name}}
</view>
</view>
</view>
</scroll-view>
</view>
</view>
</template> </template>
<script setup> <script setup>
@@ -28,7 +8,7 @@
onMounted,reactive onMounted,reactive
} from 'vue'; } from 'vue';
import {$tbShopCategory} from '@/http/yskApi/goods.js' import {$tbShopCategory} from '@/http/yskApi/goods.js'
const emite=defineEmits(['cateClick','change']) const emite=defineEmits(['change','update:isShow','confirm'])
const props = defineProps({ const props = defineProps({
showAllText:{ showAllText:{
type:Boolean, type:Boolean,
@@ -49,57 +29,63 @@
bottom: { bottom: {
type: [Number, String], type: [Number, String],
default: 0 default: 0
},
isShow:{
type:Boolean,
default:false
} }
}) })
let show = ref(false)
let show = ref(props.isShow)
watch(()=>show.value,(newval)=>{ watch(()=>show.value,(newval)=>{
emite('change',newval) emite('change',newval)
emite('update:isShow',newval)
})
watch(()=>props.isShow,(newval)=>{
console.log(newval);
show.value=newval
}) })
function open() { function confirm(e){
show.value = true console.log(e.value[0]);
show.value = false
emite('confirm',e.value[0])
} }
function close() { function close() {
console.log('close');
show.value = false show.value = false
} }
function toggle() {
show.value = !show.value
}
function cateClick(item){
emite('cateClick',item)
close()
}
function getCompouteStyle() {
return {
width: props.width + 'rpx',
height: props.height + 'rpx',
right: props.right + 'rpx',
bottom: props.bottom + 'rpx',
transform:`scaleY(${show.value?1:0})`
}
}
const category=reactive({ const category=reactive({
list:[], list:[],
categoryId:'',
categoryName:'',
}) })
onMounted(()=>{ onMounted(()=>{
$tbShopCategory({ $tbShopCategory({
page:0,size:200 page:0,size:200
}).then(res=>{ }).then(res=>{
category.list=res.content res.content.unshift({
name:'全部',
id:'',
childrenList:[]
})
category.list=[res.content.reduce((prve, cur) => {
prve.push(...[{
...cur,
name: '' + cur.name,
childrenList:undefined
}, ...cur.childrenList.map(v => {
return {
...v,
name: '' + v.name
}
})])
return prve
}, [])]
console.log(category.list);
}) })
}) })
defineExpose({
open,
close,toggle
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -3,12 +3,12 @@
<view class="u-flex control1" v-if="showControl1"> <view class="u-flex control1" v-if="showControl1">
<view class="btn" @click="changeShowControl1">批量管理</view> <view class="btn" @click="changeShowControl1">批量管理</view>
<view class="btn" @tap="go.to('PAGES_PRODUCT_ADD')">商品添加</view> <view class="btn" @tap="go.to('PAGES_PRODUCT_ADD')">商品添加</view>
<view class="color-999 btn u-flex u-row-center" @click="emitToggleCategory"> <!-- <view class="color-999 btn u-flex u-row-center" @click="emitToggleCategory">
<text class="u-m-r-10">{{categoryName||'选择分类'}}</text> <text class="u-m-r-10">{{categoryName||'选择分类'}}</text>
<view class="arrow-down" :class="{'up':categoryShow}"> <view class="arrow-down" :class="{'up':categoryShow}">
<uni-icons type="right" size="16" color="#999"></uni-icons> <uni-icons type="right" size="16" color="#999"></uni-icons>
</view> </view>
</view> </view> -->
</view> </view>
<view class="u-flex control2 u-row-between" v-else> <view class="u-flex control2 u-row-between" v-else>
<view class="u-flex btn"> <view class="u-flex btn">

View File

@@ -7,9 +7,9 @@
<text class="u-m-l-20">{{data.sort}}</text> <text class="u-m-l-20">{{data.sort}}</text>
</view> </view>
<view class="color-333 u-m-l-42 u-flex"> <view class="color-333 u-m-l-42 u-flex">
<text class="stock">库存</text> <up-icon name="edit-pen" :size="16" :color="ColorMain"></up-icon>
<text class="stock">库存:</text>
<text class="font-bold u-m-l-10">{{data.stockNumber}}</text> <text class="font-bold u-m-l-10">{{data.stockNumber}}</text>
<uni-icons type="right" size="16" color="#000"></uni-icons>
</view> </view>
</view> </view>
<text class="u-font-28 color-666" @click="changeClick">修改</text> <text class="u-font-28 color-666" @click="changeClick">修改</text>
@@ -24,16 +24,20 @@
</label> </label>
</view> </view>
<image :src="data.coverImg" lazy-load class="img"></image> <image :src="data.coverImg" lazy-load class="img"></image>
<view class="h-100 u-p-l-16 u-flex u-flex-col u-row-between"> <view class="h-100 u-p-l-16 u-flex-1 u-flex u-flex-col u-row-between">
<view class="color-333"> <text class="u-m-r-24">{{data.name}}</text><uni-tag size="small" type="primary" <view class="color-333 w-full u-flex u-row-between">
custom-style="background-color: #318AFE;" :text="data.typeEnum"></uni-tag></view> <view class="u-flex">
<text class="u-m-r-24">{{data.name}}</text><uni-tag size="small" type="primary"
custom-style="background-color: #318AFE;" :text="data.typeEnum"></uni-tag>
</view>
<view class="price">¥{{data.lowPrice}}</view>
</view>
<view class="price">¥{{data.lowPrice}}</view>
</view> </view>
</view> </view>
<view class="u-m-t-16 skus u-text-center" v-if="showDetail&&data.skuList.length>=2"> <view class="u-m-t-16 skus u-text-center" v-if="data.skuList.length>=2">
<view class="u-flex u-row-between font-bold"> <!-- <view class="u-flex u-row-between font-bold">
<view class="u-flex-1">商品信息</view> <view class="u-flex-1">商品信息</view>
<view class="u-flex-1">售价</view> <view class="u-flex-1">售价</view>
<view class="u-flex-1">库存</view> <view class="u-flex-1">库存</view>
@@ -44,30 +48,28 @@
<view class="price u-flex-1">¥{{data.lowPrice||0}}</view> <view class="price u-flex-1">¥{{data.lowPrice||0}}</view>
<view class=" u-flex-1">{{item.stockNumber||0}} {{data.unitName||''}}</view> <view class=" u-flex-1">{{item.stockNumber||0}} {{data.unitName||''}}</view>
</view> </view>
</view>
<!-- <view class="u-flex">
<view class="sku">做法</view>
<view class="u-flex u-flex-wrap u-flex-1 skds">
<view class="skd">
<view class="tag-primary tag">上架中</view>
</view>
<view class="skd">
<view class="tag-primary tag">上架中</view>
</view>
</view>
</view> --> </view> -->
<view class="u-flex u-flex-wrap skds">
<view class="skd" v-for="(item,index) in data.skuList" :key="index"><text>{{item.specSnap}}</text>
<view class="tag-primary tag">上架中</view>
</view>
</view>
</view> </view>
<view class="u-m-t-24 u-flex u-row-between"> <view class="u-m-t-24 u-flex u-row-between">
<view class="u-flex"> <view class="u-flex">
<view class="u-m-r-18 color-999">设置热门</view> <view class="u-flex">
<my-switch v-model="data.isHot" @change="isHotChange"></my-switch> <view class="u-m-r-18 color-999">售罄</view>
<!-- <view class="u-m-r-18 color-999">售罄</view> <my-switch v-model="data.isSellNoneChange" @change="isHotChange"></my-switch>
<my-switch v-model="isSellNone" @change="isSellNoneChange"></my-switch> --> </view>
<view class="u-flex u-m-l-30">
<view class="u-m-r-18 color-999">下架产品</view>
<my-switch v-model="data.isSellNoneChange" @change="isHotChange"></my-switch>
</view>
</view> </view>
<view class="u-flex"> <view class="u-flex">
<!-- <view class="btn-default btn" @tap="xiajia">下架商品</view> --> <!-- <view class="btn-default btn" @tap="xiajia">下架商品</view> -->
<view class="btn-default btn" @tap="del">删除</view> <!-- <view class="btn-default btn" @tap="del">删除</view> -->
<view class="btn-primary btn u-m-l-38" @click="toEdit">编辑</view> <view class="btn-primary btn u-m-l-38" @click="toEdit">编辑</view>
</view> </view>
</view> </view>
@@ -83,13 +85,15 @@
ref, ref,
watchEffect watchEffect
} from 'vue'; } from 'vue';
import {$goodsIsHot} from '@/http/yskApi/goods.js' import {
$goodsIsHot
} from '@/http/yskApi/goods.js'
import mySwitch from '@/components/my-components/my-switch.vue' import mySwitch from '@/components/my-components/my-switch.vue'
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import { import {
ColorMain ColorMain
} from '@/commons/color.js' } from '@/commons/color.js'
const emits = defineEmits(['radioClick', 'changeClick', 'xiajia','del']) const emits = defineEmits(['radioClick', 'changeClick', 'xiajia', 'del'])
const props = defineProps({ const props = defineProps({
index: { index: {
type: Number type: Number
@@ -110,19 +114,19 @@
} }
}) })
function isHotChange(e){ function isHotChange(e) {
$goodsIsHot({ $goodsIsHot({
id:props.data.id, id: props.data.id,
isHot:props.data.isHot isHot: props.data.isHot
}).then(res=>{ }).then(res => {
uni.showToast({ uni.showToast({
title:'修改成功', title: '修改成功',
icon:'none' icon: 'none'
}) })
}) })
} }
let isSellNone = ref(false) let isSellNone = ref(false)
isSellNone.value = props.isSellNone isSellNone.value = props.isSellNone
@@ -132,8 +136,8 @@
} }
let checked = ref(false) let checked = ref(false)
function radioClick() { function radioClick() {
console.log(props.index); console.log(props.index);
emits('radioClick', props.index) emits('radioClick', props.index)
@@ -146,7 +150,8 @@
function xiajia() { function xiajia() {
emits('xiajia', props.index) emits('xiajia', props.index)
} }
function del(){
function del() {
emits('del', props.index) emits('del', props.index)
} }
@@ -223,7 +228,7 @@
.skus { .skus {
background: #F9F9F9; background: #F9F9F9;
border-radius: 14rpx 14rpx 14rpx 14rpx; border-radius: 14rpx 14rpx 14rpx 14rpx;
padding: 28rpx 42rpx; padding: 20rpx;
.sku { .sku {
color: #000; color: #000;
@@ -236,12 +241,13 @@
} }
.skd { .skd {
padding: 14rpx 40rpx; padding: 14rpx 40rpx 14rpx 20rpx;
background: #F0F2F5; background: #F0F2F5;
border-radius: 4rpx; border-radius: 4rpx;
position: relative; position: relative;
color: #666; color: #666;
overflow: hidden; overflow: hidden;
margin-bottom: 10rpx;
.tag { .tag {
position: absolute; position: absolute;

View File

@@ -1,70 +1,63 @@
<template> <template>
<view class="safe-page"> <view class="safe-page">
<view class="bg-fff u-p-l-30 u-p-t-16 u-p-r-30 u-p-b-30"> <up-sticky>
<view class="myTabs "> <view class="bg-fff u-p-l-30 u-p-r-30 u-p-b-30">
<!-- <view class="myTabs ">
<myTabs :list="tabsList" @change="tabsChange"></myTabs> <myTabs :list="tabsList" @change="tabsChange"></myTabs>
</view> </view> -->
<view class="input-wrapper"> <view class="input-wrapper">
<view class="input-main"> <view class="input-main">
<uni-easyinput <view class="u-flex u-p-r-30 u-font-28" @click="onCategoryShowChange(true)">
clearable <text class="u-m-r-10 u-line-1" style="max-width: 100rpx;">{{pageData.categoryName||'分类' }}</text>
class='jeepay-search' :inputBorder="false" :placeholder="pageData.search.placeholder" <up-icon name="arrow-down" size="16"></up-icon>
v-model="pageData.query.name" @confirm="searchFunc"> </view>
<template #prefixIcon> <uni-easyinput clearable class='jeepay-search' :inputBorder="false"
<image src="@/static/iconImg/icon-search.svg" class="input-icon" /> :placeholder="pageData.search.placeholder" v-model="pageData.query.name"
</template> @confirm="searchFunc">
</uni-easyinput> <template #prefixIcon>
<button type="text" @click="searchFunc()">搜索</button> <image src="@/static/iconImg/icon-search.svg" class="input-icon" />
</view> </template>
</view> </uni-easyinput>
<view class="u-flex u-m-t-20 u-p-l-30 u-p-r-30 u-font-28 u-p-b-20 border-bottom"> <button type="text" @click="searchFunc()">搜索</button>
<view class="u-flex-1 tranistion u-text-center color-333"
:class="{'color-main':pageData.stateCurrent==index}" @tap="statesTableClick(index)"
v-for="(item,index) in statesTabsList" :key="index">
{{item}}
</view>
</view>
<view class="u-flex states1 u-row-between u-font-28">
<view class="u-flex">
<view class="u-p-l-16 item u-p-r-16 u-p-t-6 u-p-b-6 tranistion u-text-center color-333"
:class="{'active':pageData.stateCurrent1==index}" @tap="states1TableClick(index)"
v-for="(item,index) in states1TabsList" :key="index">
{{item}}
</view> </view>
</view> </view>
<view class="u-flex u-col-center" @click="go.to('PAGES_PRODUCT_SPECIF_TEMPLATE')"> <view class="u-flex states1 u-row-between u-font-28">
<image src="/pageProduct/static/images/icon-guige.svg" class="icon-guige" /> <view class="u-flex">
<text class="color-666 u-m-l-12 u-font-24">规格模版</text> <view class="u-p-l-16 item u-p-r-16 u-p-t-6 u-p-b-6 tranistion u-text-center color-333"
:class="{'active':pageData.stateCurrent==index}" @tap="statesTableClick(index)"
v-for="(item,index) in statesTabsList" :key="index">
{{item}}
</view>
</view>
<view class="u-flex u-col-center" @click="go.to('PAGES_PRODUCT_SPECIF_TEMPLATE')">
<image src="/pageProduct/static/images/icon-guige.svg" class="icon-guige" />
<text class="color-666 u-m-l-12 u-font-24">规格模版</text>
</view>
</view> </view>
</view> </view>
</up-sticky>
</view> <view class="goods-list u-p-30">
<view class="goods-list u-p-30" >
<template v-if="pageData.goodsList.length"> <template v-if="pageData.goodsList.length">
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index"> <view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
<my-goods @changeClick="goodsChangeClick" @radioClick="goodsRadioClick" :index="index" :data="item" <my-goods @changeClick="goodsChangeClick" @radioClick="goodsRadioClick" :index="index" :data="item"
@del="goodsDel" @del="goodsDel" :showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
</view> </view>
</template> </template>
<template v-if="pageData.hasAjax&&!pageData.goodsList.length"> <template v-if="pageData.hasAjax&&!pageData.goodsList.length">
<my-img-empty tips="未找到相关商品"></my-img-empty> <my-img-empty tips="未找到相关商品"></my-img-empty>
</template> </template>
<my-pagination :totalElements="pageData.totalElements" :size="pageData.query.size" @change="pageChange"></my-pagination> <my-pagination :totalElements="pageData.totalElements" :size="pageData.query.size"
@change="pageChange"></my-pagination>
<view style="height: 100rpx;"></view> <view style="height: 100rpx;"></view>
</view> </view>
<my-control ref="control" <my-control ref="control" :categoryShow="pageData.categoryShow" :categoryName="pageData.categoryName"
:categoryShow="pageData.categoryShow" @categoryChange="categoryIdChange" @offShelf="offShelf" @allCheckedChange="allCheckedChange"
:categoryName="pageData.categoryName"
@categoryChange="categoryIdChange"
@offShelf="offShelf" @allCheckedChange="allCheckedChange"
@controlChange="controlChange" @toggleCategory="toggleCategory" @controlChange="controlChange" @toggleCategory="toggleCategory"
:bottom="pageData.componentBottom"></my-control> :bottom="pageData.componentBottom"></my-control>
<my-category ref="category" <!-- <my-category ref="category" @change="onCategoryShowChange" @cateClick="cateClick"
@change="onCategoryShowChange" @cateClick="cateClick" :bottom="pageData.componentBottom+100"></my-category> :bottom="pageData.componentBottom+100"></my-category> -->
<!-- 下架弹窗 --> <!-- 下架弹窗 -->
<my-model :desc="pageData.modelDesc" ref="model" @confirm="modelConfirm"></my-model> <my-model :desc="pageData.modelDesc" ref="model" @confirm="modelConfirm"></my-model>
<!-- 商品库存修改弹窗 --> <!-- 商品库存修改弹窗 -->
@@ -80,7 +73,7 @@
<view class="u-flex u-m-t-32"> <view class="u-flex u-m-t-32">
<view class="">库存开关:</view> <view class="">库存开关:</view>
<view class="u-m-l-46 "> <view class="u-m-l-46 ">
<my-switch v-model="goodsStockData.isStock"></my-switch> <my-switch v-model="goodsStockData.isStock"></my-switch>
</view> </view>
</view> </view>
<!-- <view class="u-flex u-m-t-32"> <!-- <view class="u-flex u-m-t-32">
@@ -101,7 +94,7 @@
<my-switch v-model="goodsStockData.isGrounding"></my-switch> <my-switch v-model="goodsStockData.isGrounding"></my-switch>
</view> </view>
</view> --> </view> -->
<!-- <view class="u-m-t-24 u-m-t-32" v-if="goodsStockData.isStock"> <!-- <view class="u-m-t-24 u-m-t-32" v-if="goodsStockData.isStock">
<view class="">数量:</view> <view class="">数量:</view>
<view class="u-m-t-24"> <view class="u-m-t-24">
@@ -118,6 +111,9 @@
</view> </view>
</template> </template>
</my-model> </my-model>
<!-- 分类 -->
<my-category v-model:isShow="pageData.categoryShow" @confirm="setCategory"></my-category>
</view> </view>
</template> </template>
@@ -136,24 +132,21 @@
watch watch
} from 'vue'; } from 'vue';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import myTabs from '@/pageProduct/components/my-tabs.vue'
import myGoods from './components/goods.vue' import myGoods from './components/goods.vue'
import myControl from './components/control.vue' import myControl from './components/control.vue'
import myCategory from './components/category.vue' import myCategory from './components/category.vue'
import infoBox from "@/commons/utils/infoBox.js" import infoBox from "@/commons/utils/infoBox.js"
import myPagination from '@/components/my-components/my-pagination'
import myModel from "@/components/my-components/my-model.vue"
import myButton from "@/components/my-components/my-button.vue"
import mySwitch from "@/components/my-components/my-switch.vue"
import { import {
$tbProduct, $tbProduct,
$upProSort, $upProSort,
$updateProduct,$getProductDetail,$delProduct,$updateProductStatus $updateProduct,
$getProductDetail,
$delProduct,
$updateProductStatus
} from "@/http/yskApi/goods.js" } from "@/http/yskApi/goods.js"
const pageData = reactive({ const pageData = reactive({
modelDesc: '是否下架', modelDesc: '是否下架',
stateCurrent: 0, stateCurrent: 0,
stateCurrent1: 0,
componentBottom: 45, componentBottom: 45,
search: { search: {
value: '', value: '',
@@ -167,25 +160,29 @@
query: { query: {
page: 0, page: 0,
size: 10, size: 10,
categoryId:'', categoryId: '',
name:'' name: ''
}, },
category:'', category: '',
categoryShow:false, categoryShow: false,
categoryName:'', categoryName: '',
hasAjax:false hasAjax: false
}) })
function onCategoryShowChange(show){ watch(()=>pageData.query.categoryId,(newval)=>{
console.log(show);
pageData.categoryShow=show
}
function categoryIdChange(categoryId){
pageData.query.categoryId=categoryId
getGoodsList() getGoodsList()
})
function onCategoryShowChange(show) {
console.log(show);
pageData.categoryShow = show
} }
function setCategory(category){
pageData.query.categoryId = category.id
pageData.categoryName = category.name
}
function getGoodsList() { function getGoodsList() {
$tbProduct(pageData.query).then(res => { $tbProduct(pageData.query).then(res => {
pageData.hasAjax=true pageData.hasAjax = true
console.log(res); console.log(res);
pageData.goodsList = res.content.map(v => { pageData.goodsList = res.content.map(v => {
return { return {
@@ -203,8 +200,7 @@
}) })
const tabsList = ['简洁', '详情'] const tabsList = ['简洁', '详情']
const statesTabsList = ['在售中', '已下架'] const statesTabsList = ['全部', '已售罄','在售中', '已下架']
const states1TabsList = ['全部', '已售罄']
const control = ref(null) const control = ref(null)
const model = ref(null) const model = ref(null)
const goodsStockModel = ref(null) const goodsStockModel = ref(null)
@@ -213,9 +209,9 @@
return reactive({ return reactive({
sort: 0, sort: 0,
isStock: false, isStock: false,
isDistribute:false, isDistribute: false,
isPauseSale:false, isPauseSale: false,
isGrounding:false, isGrounding: false,
stockNumber: 0, stockNumber: 0,
}) })
} }
@@ -234,15 +230,15 @@
async function goodsStockModelSave() { async function goodsStockModelSave() {
const item = pageData.goodsList[pageData.selGoodsIndex] const item = pageData.goodsList[pageData.selGoodsIndex]
const goods =await $getProductDetail(item.id,false) const goods = await $getProductDetail(item.id, false)
$updateProduct({ $updateProduct({
...goods, ...goods,
sort:goodsStockData.sort, sort: goodsStockData.sort,
isStock:goodsStockData.isStock isStock: goodsStockData.isStock
}).then(res=>{ }).then(res => {
item.sort=goodsStockData.sort item.sort = goodsStockData.sort
item.isStock=goodsStockData.isStock item.isStock = goodsStockData.isStock
item.stockNumber=goodsStockData.stockNumber item.stockNumber = goodsStockData.stockNumber
goodsStockModelCancel() goodsStockModelCancel()
}) })
} }
@@ -253,38 +249,34 @@
function goodsChangeClick(index) { function goodsChangeClick(index) {
pageData.selGoodsIndex = index pageData.selGoodsIndex = index
const goods = pageData.goodsList[index] const goods = pageData.goodsList[index]
Object.assign(goodsStockData,goods) Object.assign(goodsStockData, goods)
goodsStockModel.value.open() goodsStockModel.value.open()
} }
//删除商品 //删除商品
function goodsDel(index){ function goodsDel(index) {
const goods = pageData.goodsList[index] const goods = pageData.goodsList[index]
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确认删除该商品', content: '确认删除该商品',
success: function (res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
$delProduct([goods.id]).then(res=>{ $delProduct([goods.id]).then(res => {
uni.showToast({ uni.showToast({
title:'删除成功', title: '删除成功',
icon:'none' icon: 'none'
}) })
pageData.goodsList.splice(index,1) pageData.goodsList.splice(index, 1)
}) })
} else if (res.cancel) { } else if (res.cancel) {}
}
} }
}); });
} }
function statesTableClick(index) { function statesTableClick(index) {
pageData.stateCurrent = index pageData.stateCurrent = index
} }
function states1TableClick(index) {
pageData.stateCurrent1 = index
}
let test = ref(false) let test = ref(false)
function tabsChange(i) { function tabsChange(i) {
@@ -292,7 +284,7 @@
pageData.showGoodsDetail = i ? true : false pageData.showGoodsDetail = i ? true : false
} }
//改变商品的选中状态 //改变商品的选中状态
function changeGoodsChecked(checked, index) { function changeGoodsChecked(checked, index) {
if (index !== undefined) { if (index !== undefined) {
@@ -379,9 +371,9 @@
function cateClick(cate) { function cateClick(cate) {
console.log(cate); console.log(cate);
pageData.query.categoryId=cate.id pageData.query.categoryId = cate.id
pageData.categoryName=cate.name pageData.categoryName = cate.name
pageData.category=cate pageData.category = cate
getGoodsList() getGoodsList()
} }
</script> </script>
@@ -491,7 +483,7 @@
.item { .item {
font-size: 24rpx; font-size: 24rpx;
color: #666; color: #666;
margin-right: 70rpx; margin-right: 30rpx;
background: #F4F4F4; background: #F4F4F4;
border-radius: 8rpx 8rpx 8rpx 8rpx; border-radius: 8rpx 8rpx 8rpx 8rpx;
} }

View File

@@ -108,7 +108,19 @@
</view> </view>
</uni-forms-item> </uni-forms-item>
</view> </view>
<view class="border-bottom u-p-b-10">
<uni-forms-item required label="" name="types">
<template #label>
<view class="u-text-left">
<text class="color-333 u-font-28">清台管理</text>
<!-- <text class="color-red">*</text> -->
</view>
</template>
<view class="u-flex-1">
<my-tabs @change="autoClearsChange" :list="autoClears.list" v-model="form.autoClear"></my-tabs>
</view>
</uni-forms-item>
</view>
<template v-if="tabs.sel==1"> <template v-if="tabs.sel==1">
<view class=" u-p-b-10"> <view class=" u-p-b-10">
<uni-forms-item required label="" > <uni-forms-item required label="" >
@@ -169,6 +181,13 @@
list:['低消','计时'], list:['低消','计时'],
sel:1 sel:1
}) })
//清台管理
const autoClears=reactive({
list:['手动清台','自动清台']
})
function autoClearsChange(i){
form.autoClearsChange=i
}
const status = reactive({ const status = reactive({
list:objToArrary($status), list:objToArrary($status),
sel: '', sel: '',

View File

@@ -2,50 +2,60 @@
<view class="item color-fff border-r-12" :class="[data.status]" @click="toOrderDetail"> <view class="item color-fff border-r-12" :class="[data.status]" @click="toOrderDetail">
<view class="my-bg-main" :style="{'background-color':returnStutasColor(data.status)}"> <view class="my-bg-main" :style="{'background-color':returnStutasColor(data.status)}">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="u-font-32 ">{{data.name}}</view> <view class="u-font-32">{{data.name}}</view>
<view class="u-flex" @tap.stop="more"> <view class="u-flex" @tap.stop="more">
<uni-icons type="more-filled" color="#fff" size="16"></uni-icons> <uni-icons type="more-filled" color="#fff" size="16"></uni-icons>
</view> </view>
</view> </view>
<view class="u-flex u-m-t-10 u-row-between"> <view class="u-flex u-m-t-10 u-row-between">
<view class="u-flex gap-10"> <view>{{areaMap[data.areaId]||'' }}</view>
<!-- <uni-tag text="计时" size="small" type="warning"></uni-tag> -->
<!-- <uni-tag text="可预约" size="small" type="primary"></uni-tag> -->
</view>
<view class="tag" :style="{color:returnStutasColor(data.status)}"> <view class="tag" :style="{color:returnStutasColor(data.status)}">
{{returnStutasText(data.status)}} {{returnStutasText(data.status)}}
</view> </view>
</view> </view>
</view> </view>
<view class="u-flex u-flex-col u-row-center u-col-center bg-fff"> <view class="u-flex u-flex-col u-row-center u-col-center bg-fff bottom">
<template v-if="data.status=='idle'"> <template v-if="data.status!='using'">
<view class="u-m-t-40 color-main u-font-32">{{returnStutasText(data.status)}}~</view> <view class=" u-font-32" :style="{color:returnStutasColor(data.status)}">
<view class="u-flex gap-10 u-m-t-20"> {{returnStutasText(data.status)}}~</view>
<uni-tag :text="data.type == 0 ? '低消' : '计时'" size="small" type="warning"></uni-tag>
<uni-tag :text="data.isPredate == 1 ? '可预约' : '不可预约'" size="small" type="primary"></uni-tag>
</view>
</template> </template>
<view class="u-m-t-40 w-full u-p-l-20 u-p-r-20 u-m-b-40"> <view class=" w-full u-p-l-16 u-p-r-16 u-p-t-16 u-font-24">
<template v-if="data.status=='idle'"> <template v-if="data.status=='using'">
<view class="u-flex u-row-center"> <view class="color-666 u-text-left u-p-b-20 border-bottom">
<my-button type="default" @click="diancan" :disabled="!data.tableId"> <view class=""><text>已点</text><text class="u-m-l-20 color-333">{{data.productNum||0}}</text>
<view class=" u-p-l-30 u-p-r-30" :class="{'color-333':data.tableId}">点餐</view> </view>
</my-button> <view class="u-m-t-10"><text>金额</text><text class="u-m-l-20 color-333">{{data.totalAmount||0}}
</text> </view>
<view class="u-m-t-10"><text>待结</text><text class="u-m-l-20 color-333">{{data.totalAmount||0}}
</text> </view>
</view>
<view class="u-flex u-row-between u-font-20 u-p-b-20 u-p-t-20">
<text class="color-333">开台时间</text>
<text class="color-666"> {{data.useTime}}</text>
</view> </view>
</template> </template>
<template v-else> <template v-else>
<view class="color-666 u-text-left u-p-b-20 border-bottom"> <view class="u-flex u-row-center u-m-t-16">
<view class=""><text>已点</text><text class="u-m-l-20 color-333">{{goodsNumber}}</text> </view> <template v-if="data.tableId">
<view class="u-m-t-10"><text>金额</text><text class="u-m-l-20 color-333">{{allPrice}} </text> </view> <template v-if="data.status=='idle' ">
<view class="u-m-t-10"><text>待结</text><text class="u-m-l-20 color-333">{{allPrice}} </text> </view> <my-button color="#333" :width="150" :height="56" type="default" @click="diancan">
</view> 选择
<view class="u-text-right u-p-20 color-666"> </my-button>
0人扫码 </template>
<template v-if="data.status=='cleaning' ">
<my-button color="#333" :width="150" :height="56" type="default" @click="qingtai">
清台
</my-button>
</template>
</template>
<my-button v-else :width="150" :height="56" type="default" disabled>
选择
</my-button>
</view> </view>
</template> </template>
</view> </view>
</view> </view>
</view> </view>
@@ -58,8 +68,16 @@
import { import {
$status $status
} from '@/commons/table-status.js' } from '@/commons/table-status.js'
import { computed, onMounted, ref } from 'vue'; import {
computed,
onMounted,
ref
} from 'vue';
import {
$table
} from '@/http/yskApi/table.js'
const status = $status const status = $status
const emits = defineEmits(['more','update'])
function returnStutasText(key) { function returnStutasText(key) {
const item = status[key] const item = status[key]
@@ -81,40 +99,28 @@
default: () => { default: () => {
return {} return {}
} }
},
areaMap: {
type: Object,
default: () => {}
} }
}) })
const goodsList=ref([]) const goodsList = ref([])
const allPrice = computed(() => { const allPrice = computed(() => {
return goodsList.value.reduce((prve,cur)=>{ return goodsList.value.reduce((prve, cur) => {
return prve+cur.salePrice*cur.number return prve + cur.salePrice * cur.number
},0).toFixed(2) }, 0).toFixed(2)
}) })
const goodsNumber = computed(() => { const goodsNumber = computed(() => {
let result = 0 let result = 0
result = goodsList.value.reduce((prve, cur) => { result = goodsList.value.reduce((prve, cur) => {
return prve + cur.number return prve + cur.number
}, 0) }, 0)
return result return result
}) })
async function init(){ onMounted(() => {})
if(props.data.tableId){
const {masterId}=await Api.$getMasterId({
tableId:props.data.tableId
})
const {records} = await Api.getCart({
tableId:props.data.tableId,
masterId
})
goodsList.value=records
}
}
onMounted(()=>{
init()
})
const emits = defineEmits(['more'])
function more() { function more() {
emits('more') emits('more')
@@ -128,13 +134,42 @@
} }
function toOrderDetail() { function toOrderDetail() {
if(props.data.status=='using'){ if (props.data.status == 'using') {
const {tableId,name,status,amount,areaId}=props.data const {
tableId,
name,
status,
amount,
areaId
} = props.data
go.to('PAGES_CRESATE_ORDER_DETAIL', { go.to('PAGES_CRESATE_ORDER_DETAIL', {
tableId,name,status,amount,areaId tableId,
name,
status,
amount,
areaId
}) })
} }
} }
function qingtai() {
const item=props.data
uni.showModal({
title: '提示',
content: '确定要清台:' + props.data.name + '',
success(res) {
if (res.confirm) {
$table.update({
...item,
status: "idle",
qrcode: item.tableId,
}).then(res=>{
emits('update')
})
}
}
})
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -149,6 +184,10 @@
box-shadow: 1px 1px 0 #eee; box-shadow: 1px 1px 0 #eee;
border-color: #eee; border-color: #eee;
.bottom {
min-height: 224rpx;
}
.my-bg-main { .my-bg-main {
padding: 32rpx 28rpx; padding: 32rpx 28rpx;

View File

@@ -23,7 +23,8 @@
<image src="@/static/iconImg/icon-search.svg" class="input-icon" /> <image src="@/static/iconImg/icon-search.svg" class="input-icon" />
<view class="u-flex-1 u-p-l-10"> <view class="u-flex-1 u-p-l-10">
<input v-model="search.keyword" @confirm="searchConfirm" type="text" <input v-model="search.keyword" @confirm="searchConfirm" type="text"
placeholder-style="font-size:28rpx;" placeholder="搜索" /></view> placeholder-style="font-size:28rpx;" placeholder="搜索" />
</view>
<view @tap.stop="hideSearch" v-if="search.show">取消</view> <view @tap.stop="hideSearch" v-if="search.show">取消</view>
</view> </view>
</view> </view>
@@ -59,14 +60,14 @@
<view class="u-m-t-30 u-flex u-flex-wrap u-row-between"> <view class="u-m-t-30 u-flex u-flex-wrap u-row-between">
<view class="u-m-b-30" v-for="(item,index) in tables.list" :key="index"> <view class="u-m-b-30" v-for="(item,index) in tables.list" :key="index">
<table-item @more="moreShow(item)" :data="item"></table-item> <table-item @update="getTable" :areaMap="areaMap" @more="moreShow(item)" :data="item"></table-item>
</view> </view>
<my-img-empty v-if="tables.hasAjax&&!tables.list.length" tips="未找到相关桌台"></my-img-empty> <my-img-empty v-if="tables.hasAjax&&!tables.list.length" tips="未找到相关桌台"></my-img-empty>
</view> </view>
</view> </view>
</view> </view>
<my-action-sheet @itemClick="actionSheetClick" ref="refMoreSheet" :list="actionSheet.list" <my-action-sheet :active="4" @itemClick="actionSheetClick" ref="refMoreSheet" :list="actionSheet.list"
:title="actionSheet.title"> :title="actionSheet.title">
<template #title> <template #title>
<view class="color-999 u-p-30 u-text-center border-bottom">桌号{{actionSheet.title}}</view> <view class="color-999 u-p-30 u-text-center border-bottom">桌号{{actionSheet.title}}</view>
@@ -100,6 +101,7 @@
import addTable from './components/add-table' import addTable from './components/add-table'
import myActionSheet from '@/components/my-components/my-action-sheet'; import myActionSheet from '@/components/my-components/my-action-sheet';
import tableItem from './components/table-item' import tableItem from './components/table-item'
import * as $fun from './util.js'
import { import {
ref, ref,
reactive, reactive,
@@ -108,7 +110,7 @@
} from 'vue'; } from 'vue';
const refMoreSheet = ref(null) const refMoreSheet = ref(null)
const actionSheet = reactive({ const actionSheet = reactive({
list: ['编辑', '历史订单'], list: ['结账', '清台','增减菜','换台','打印订单','历史订单'],
title: '', title: '',
selTable: '' selTable: ''
}) })
@@ -118,11 +120,27 @@
actionSheet.selTable = table actionSheet.selTable = table
refMoreSheet.value.open() refMoreSheet.value.open()
} }
function actionSheetClick(index) { async function actionSheetClick(index) {
console.log(index); console.log(index);
//编辑
// refTableShow()
if (index == 0) { if (index == 0) {
refTableShow() return
}
if (index == 1) {
return
}
if (index == 2) {
return
}
if (index == 3) {
return
}
if (index == 4) {
//打印订单
const res=await $fun.printOrder(actionSheet.selTable.tableId)
return
} }
} }
@@ -303,6 +321,7 @@
tables.list = content tables.list = content
tables.originList = content tables.originList = content
} }
const areaMap = ref({})
async function getArea() { async function getArea() {
const { const {
content content
@@ -311,6 +330,11 @@
size: 300 size: 300
}) })
tables.area.list = content tables.area.list = content
areaMap.value = content.reduce((prve, cur) => {
prve[cur.id] = cur.name
return prve
}, {})
console.log(areaMap);
} }
watch(() => tables.area.sel, (newval) => { watch(() => tables.area.sel, (newval) => {
console.log(newval); console.log(newval);
@@ -329,7 +353,7 @@
watch(() => times.active, (newval) => { watch(() => times.active, (newval) => {
setTimer() setTimer()
}) })
function tableUpdate() { function tableUpdate() {
query.page = 0 query.page = 0
@@ -352,7 +376,7 @@
watch(() => times.active, (newval) => { watch(() => times.active, (newval) => {
setTimer() setTimer()
}) })
onHide(()=>{ onHide(() => {
clearInterval(timer) clearInterval(timer)
}) })
onShow(opt => { onShow(opt => {

31
pageTable/index/util.js Normal file
View File

@@ -0,0 +1,31 @@
import * as Api from '@/http/yskApi/Instead.js'
import go from '@/commons/utils/go.js'
//打印订单
export function printOrder(tableId) {
return new Promise((resolve, reject) => {
uni.showModal({
title: '提示',
content: '确定要打印订单吗?',
success(res) {
if (res.confirm) {
Api.$printOrder({
tableId
}).then(res => {
resolve(res)
})
}
}
})
})
}
//去支付页面
export function toPay(options) {
go.to('PAGES_CRESATE_ORDER_PAY', {
tableId: options.tableId,
tableName: options.name,
masterId: options.masterId,
orderId: orderDetail.info.id,
discount: 1
})
}

View File

@@ -1201,6 +1201,27 @@
} }
] ]
}, },
{
"root": "pagesOrder",
"pages": [{
"pageId": "PAGES_ORDER_INDEX",
"path" : "index/index",
"style" :
{
"navigationBarTitleText" : "订单管理"
}
},
{
"pageId": "PAGES_ORDER_DETAIL",
"path" : "detail/detail",
"style" :
{
"navigationBarTitleText" : "订单详情"
}
}
]
},
{ {
"root": "pageCoupon", "root": "pageCoupon",
"pages": [{ "pages": [{

View File

@@ -81,6 +81,11 @@
icon: '/static/indexImg/icon-substitute-ordering.svg', icon: '/static/indexImg/icon-substitute-ordering.svg',
pageUrl: 'PAGES_CREATE_ORDER', pageUrl: 'PAGES_CREATE_ORDER',
}, },
{
title: '订单管理',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_ORDER_INDEX',
},
{ {
title: '打印机', title: '打印机',
icon: '/static/indexImg/icon-printer.svg', icon: '/static/indexImg/icon-printer.svg',

View File

@@ -40,14 +40,14 @@
<uni-forms-item name="code"> <uni-forms-item name="code">
<!-- 手机验证码 不限制数字还是本文 如果发送为文本则无需app升级 --> <!-- 手机验证码 不限制数字还是本文 如果发送为文本则无需app升级 -->
<view style="display: flex;"> <view style="display: flex;" class="u-flex u-flex-y-center">
<uni-easyinput class='jeepay-easyinput' :maxlength="6" placeholder="请输入验证码" <uni-easyinput class='jeepay-easyinput' :maxlength="6" placeholder="请输入验证码"
v-model="vdata.formData.code" :clearable="false"> v-model="vdata.formData.code" :clearable="false">
<template #prefixIcon> <template #prefixIcon>
<image src="@/static/login/icon-sms-code.svg" class="input-icon" /> <image src="@/static/login/icon-sms-code.svg" class="input-icon" />
</template> </template>
</uni-easyinput> </uni-easyinput>
<image :src="vdata.formData.img" class="u-m-t-20" <image :src="vdata.formData.img" class=" u-m-b-50"
style="width: 200rpx; height: 80rpx;margin-left: 10rpx;" @click="getCode" mode=""> style="width: 200rpx; height: 80rpx;margin-left: 10rpx;" @click="getCode" mode="">
</image> </image>
</view> </view>

View File

@@ -25,7 +25,8 @@
<view class="u-flex color-666"> <view class="u-flex color-666">
<radio-group @change="radioGroupChange"> <radio-group @change="radioGroupChange">
<label class="radio u-m-r-60" v-for="(item,index) in eatTypes.list" :key="index"> <label class="radio u-m-r-60" v-for="(item,index) in eatTypes.list" :key="index">
<radio :value="''+index" :checked="index === eatTypes.active" class="scale7 " /> <radio :value="''+item.value" :checked="item.value == eatTypes.active"
class="scale7 " />
<text>{{item.label}}</text> <text>{{item.label}}</text>
</label> </label>
</radio-group> </radio-group>
@@ -176,10 +177,10 @@
<view class="u-flex u-row-between u-m-t-30 u-p-b-34 border-bottom"> <view class="u-flex u-row-between u-m-t-30 u-p-b-34 border-bottom">
<view> <view>
<text v-if="eatTypes.active==1">包装费</text> <text v-if="eatTypes.active==2">包装费</text>
<text v-else>桌位费</text> <text v-else>桌位费</text>
</view> </view>
<view>0.00</view> <view>{{$seatFee.totalAmount||'0.00'}}</view>
</view> </view>
<view class="u-flex u-row-right u-m-t-38"> <view class="u-flex u-row-right u-m-t-38">
@@ -218,13 +219,15 @@
<script setup> <script setup>
import { import {
onLoad,onShow onLoad,
onShow
} from '@dcloudio/uni-app' } from '@dcloudio/uni-app'
import { import {
ref, ref,
onBeforeUnmount, onBeforeUnmount,
reactive, reactive,
computed computed,
watch
} from 'vue'; } from 'vue';
import myButton from '@/components/my-components/my-button' import myButton from '@/components/my-components/my-button'
import modelDiscount from './components/discount' import modelDiscount from './components/discount'
@@ -237,9 +240,11 @@
} from '@/commons/utils/format.js'; } from '@/commons/utils/format.js';
import color from '@/commons/color.js'; import color from '@/commons/color.js';
import * as Api from '@/http/yskApi/Instead.js' import * as Api from '@/http/yskApi/Instead.js'
import {getNowCart} from '@/pagesCreateOrder/util.js'
const models = new Map(); const models = new Map();
//备注 //备注
let note=ref('') let note = ref('')
function setModel(el) { function setModel(el) {
if (el && el.$attrs['name']) { if (el && el.$attrs['name']) {
models.set(el.$attrs['name'], el); models.set(el.$attrs['name'], el);
@@ -264,6 +269,18 @@
}), }),
defaultCateIndex: 1, defaultCateIndex: 1,
}) })
watch(() => userNumbers.defaultCateIndex, (newval) => {
updateChoseCount()
})
//更新就餐人数
async function updateChoseCount(){
await Api.$choseCount({
masterId: option.masterId,
tableId: option.tableId,
num: userNumbers.defaultCateIndex,
})
}
function userNumberChange(e) { function userNumberChange(e) {
userNumbers.defaultCateIndex = e.detail.value userNumbers.defaultCateIndex = e.detail.value
@@ -299,11 +316,11 @@
const eatTypes = reactive({ const eatTypes = reactive({
list: [{ list: [{
label: '堂食', label: '堂食',
value: '1' value: 1
}, },
{ {
label: '自取', label: '自取',
value: '2' value: 2
}, },
], ],
active: 1 active: 1
@@ -311,7 +328,6 @@
function radioGroupChange(e) { function radioGroupChange(e) {
eatTypes.active = e.detail.value eatTypes.active = e.detail.value
console.log(eatTypes.active);
} }
@@ -320,7 +336,7 @@
} }
function chooseTable() { function chooseTable() {
go.to('PAGES_CHOOSE_TABLE',{ go.to('PAGES_CHOOSE_TABLE', {
...table.value ...table.value
}) })
} }
@@ -336,6 +352,16 @@
}) })
} }
let table = ref(null) let table = ref(null)
//监听桌台改变
watch(() => table.value, (newval, oldval) => {
if (newval && oldval) {
Api.$choseTable({
orderId: 4462,
oldTableId: oldval.tableId,
newTableId: newval.tableId,
})
}
})
function watchChooseTable() { function watchChooseTable() {
uni.$off('choose-table') uni.$off('choose-table')
@@ -344,7 +370,7 @@
console.log(table.value); console.log(table.value);
}) })
} }
const option = reactive({ const option = reactive({
masterId: '', masterId: '',
tableId: "" tableId: ""
@@ -360,6 +386,11 @@
}, 0) }, 0)
return result return result
}) })
//餐位费
const $seatFee = reactive({
totalNumber: 0,
totalAmount: 0,
})
const allPrice = computed(() => { const allPrice = computed(() => {
return goods.list.reduce((prve, cur) => { return goods.list.reduce((prve, cur) => {
return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1) return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
@@ -380,43 +411,49 @@
masterId: option.masterId, masterId: option.masterId,
tableId: option.tableId tableId: option.tableId
}) { }) {
const res = await Api.getCart(par) const {
goods.list = res.records.map(item => { records,
return { seatFee
...item, } = await Api.getCart(par)
isPack: returnBoolean(item.isPack), goods.list =getNowCart(records)
isGift: returnBoolean(item.isGift) if(seatFee&&seatFee.totalNumber){
} userNumbers.defaultCateIndex = seatFee.totalNumber || 1
}) Object.assign($seatFee, seatFee)
}
console.log(goods.list); console.log(goods.list);
} }
// 创建订单 // 创建订单
async function createOrder(par = { async function createOrder(par = {
masterId: option.masterId, masterId: option.masterId,
vipUserId:user.value?user.value.id:'', vipUserId: user.value ? user.value.id : '',
note:note.value, note: note.value,
postPay:true, postPay: true,
orderId:'', orderId: '',
tableId: option.tableId tableId: option.tableId
}) { }) {
updateChoseCount()
const res = await Api.$createOrder(par) const res = await Api.$createOrder(par)
uni.showToast({ uni.showToast({
title:'提交成功', title: '提交成功',
icon:'none' icon: 'none'
}) })
setTimeout(()=>{ setTimeout(() => {
uni.navigateBack({delta:2}) uni.$emit('orderDetail:update')
},500) uni.navigateBack({
delta: 2
})
}, 500)
} }
onLoad((opt) => { onLoad((opt) => {
console.log(opt); console.log(opt);
Object.assign(option, opt) Object.assign(option, opt)
if(opt){ if (opt) {
table.value={ table.value = {
tableId:opt.tableId, tableId: opt.tableId,
name:opt.tableName name: opt.tableName
} }
} }
getCart() getCart()
@@ -424,11 +461,10 @@
onBeforeUnmount(() => { onBeforeUnmount(() => {
}) })
onShow(()=>{ onShow(() => {
watchChooseuser() watchChooseuser()
watchChooseTable() watchChooseTable()
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -24,7 +24,7 @@
<view class="search u-flex u-col-center "> <view class="search u-flex u-col-center ">
<view class="u-flex-1"> <view class="u-flex-1">
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索店内商品" @confirm="search" <uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索店内商品" @confirm="search"
:focus="true" v-model="searchValue"> v-model="searchValue">
</uni-search-bar> </uni-search-bar>
</view> </view>
<view class="u-flex"> <view class="u-flex">
@@ -70,18 +70,18 @@
</scroll-view> </scroll-view>
</view> </view>
<view class="bottom w-full"> <view class="bottom w-full">
<my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" <my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table"
:table="data.table" :data="cars" @clear="onClearCart"></my-car>
:data="cars" @clear="onClearCart"></my-car>
</view> </view>
<!-- 选择规格 --> <!-- 选择规格 -->
<guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel" :title="guigeModelData.title" <guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel"
:sku-map="guigeModelData.chooseGoods.skuMap" :skus="guigeModelData.chooseGoods.skus"></guige-model> :title="guigeModelData.title" :sku-map="guigeModelData.chooseGoods.skuMap"
<!-- 添加附加费 --> :skus="guigeModelData.chooseGoods.skus"></guige-model>
<my-surcharge @confirm="surchargeConfirm" ref="surcharge" title="添加附加费"></my-surcharge> <!-- 添加附加费 -->
<my-surcharge @confirm="surchargeConfirm" ref="surcharge" title="添加附加费"></my-surcharge>
</view> </view>
</template> </template>
<script setup> <script setup>
import _ from 'lodash'; import _ from 'lodash';
@@ -112,6 +112,7 @@
import myCar from './components/car' import myCar from './components/car'
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import infoBox from '@/commons/utils/infoBox.js'; import infoBox from '@/commons/utils/infoBox.js';
import {getNowCart} from '@/pagesCreateOrder/util.js'
const cars = reactive([]) const cars = reactive([])
const data = reactive({ const data = reactive({
scrollTop: 0, //tab标题的滚动条位置 scrollTop: 0, //tab标题的滚动条位置
@@ -302,9 +303,11 @@
data.masterId = masterId data.masterId = masterId
const cartRes = await getCart() const cartRes = await getCart()
cars.length = 0 cars.length = 0
for (let i in cartRes.records) { const cartArr =getNowCart(cartRes.records)
cars.push(cartRes.records[i]) for (let i in cartArr) {
cars.push(cartArr[i])
} }
const categoryRes = await getCategory() const categoryRes = await getCategory()
const category = categoryRes.content.reduce((prve, cur) => { const category = categoryRes.content.reduce((prve, cur) => {
prve.push({ prve.push({
@@ -329,7 +332,7 @@
// 监听选择用户事件 // 监听选择用户事件
const surcharge = ref(null) const surcharge = ref(null)
@@ -663,15 +666,15 @@
onReady(() => { onReady(() => {
getMenuItemTop() getMenuItemTop()
}) })
let isTabClickOver=true let isTabClickOver = true
// 点击左边的栏目切换 // 点击左边的栏目切换
async function swichMenu(index) { async function swichMenu(index) {
if (data.arr.length == 0) { if (data.arr.length == 0) {
await getMenuItemTop(); await getMenuItemTop();
} }
if (index == data.current) return; if (index == data.current) return;
isTabClickOver=false; isTabClickOver = false;
data.scrollRightTop = data.oldScrollTop; data.scrollRightTop = data.oldScrollTop;
nextTick(function() { nextTick(function() {
data.scrollRightTop = data.arr[index] + data.topZhanwei; data.scrollRightTop = data.arr[index] + data.topZhanwei;
@@ -717,12 +720,12 @@
}) })
} }
// 设置左边菜单的滚动状态 // 设置左边菜单的滚动状态
async function leftMenuStatus(index) { async function leftMenuStatus(index) {
if(!isTabClickOver){ if (!isTabClickOver) {
return return
} }
data.current = index; data.current = index;
@@ -755,9 +758,9 @@
}).exec() }).exec()
}) })
} }
// 右边菜单滚动 // 右边菜单滚动
async function rightScroll(e) { async function rightScroll(e) {
data.oldScrollTop = e.detail.scrollTop; data.oldScrollTop = e.detail.scrollTop;
@@ -777,16 +780,17 @@
let height2 = data.arr[i + 1]; let height2 = data.arr[i + 1];
// 如果不存在height2意味着数据循环已经到了最后一个设置左边菜单为最后一项即可 // 如果不存在height2意味着数据循环已经到了最后一个设置左边菜单为最后一项即可
if (!height2 || scrollHeight >= height1 && scrollHeight < height2) { if (!height2 || scrollHeight >= height1 && scrollHeight < height2) {
if(isTabClickOver){ if (isTabClickOver) {
leftMenuStatus(i); leftMenuStatus(i);
}else{ } else {
isTabClickOver=true isTabClickOver = true
} }
return; return;
} }
} }
}, 10) }, 10)
} }
function watchChooseuser() { function watchChooseuser() {
uni.$off('choose-user') uni.$off('choose-user')
uni.$on('choose-user', (user) => { uni.$on('choose-user', (user) => {
@@ -797,14 +801,13 @@
setUser() setUser()
}) })
} }
onBeforeUnmount(() => { onBeforeUnmount(() => {})
}) onShow(() => {
onShow(()=>{
watchChooseuser() watchChooseuser()
}) })
onLoad((opt) => { onLoad((opt) => {
console.log(opt) console.log(opt)
Object.assign(data.table,opt) Object.assign(data.table, opt)
if (!opt.tableId) { if (!opt.tableId) {
infoBox.showErrorToast('暂不支持不选择台桌下载,请从桌台点餐') infoBox.showErrorToast('暂不支持不选择台桌下载,请从桌台点餐')
return setTimeout(() => { return setTimeout(() => {
@@ -813,8 +816,6 @@
} }
init() init()
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -0,0 +1,36 @@
<template>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<view class="u-flex u-row-between">
<view class="font-bold">附加费</view>
<my-button plain shape="circle" :width="160" :height="56">退菜</my-button>
</view>
<view class="u-flex u-row-between u-m-t-20">
<view>{{data.name||'餐位费'}}</view>
<view>x{{data.number}}</view>
<view>{{data.number}}</view>
</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>

View File

@@ -1,37 +1,48 @@
<template> <template>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length"> <view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length">
<view class="u-font-32"> <view class="u-font-32 font-bold">
<text></text> <text></text>
<text class="color-main font-bold"> {{goodsNumber}}</text> <text class="color-main font-bold"> {{goodsNumber}}</text>
<text>份菜品</text> <text>份菜品</text>
</view> </view>
<view class="u-m-t-20 list"> <view class="u-m-b-20 u-m-t-20" v-for="(order,orderIndex) in data" :key="orderIndex">
<view class="item u-m-b-20" v-for="(item,index) in data" :key="index"> <view class="u-font-32"> {{ order.placeNum }}次下单
<view class="u-flex u-col-top"> </view>
<view> <view class="u-m-t-20 list">
<image class="img" :src="item.coverImg" mode=""></image> <view class="item u-m-b-20" v-for="(item,index) in order.info" :key="index">
</view> <view class="u-flex u-col-top">
<view class="u-p-l-30 u-flex-1"> <view>
<view class="u-flex u-row-between u-col-top"> <image class="img" :src="item.coverImg" mode=""></image>
<view>{{item.name}}</view> </view>
<view class="u-text-right"> <view class="u-p-l-30 u-flex-1">
<view>{{item.salePrice}}</view> <view class="u-flex u-row-between u-col-top">
<view class="u-m-t-10 u-font-24">X{{item.number}}</view>
<view class="u-flex">
<view class="tui" v-if="item.status=='return'">
已退
</view>
<view :class="{'line-th':item.status=='return'}">{{item.name}}</view>
</view>
<view class="u-text-right">
<view>{{item.salePrice}}</view>
<view v-if="item.status=='return'" class="line-th color-666 u-font-24">{{item.salePrice}}</view>
<view class="u-m-t-10 u-font-24">X{{item.number}}</view>
</view>
</view> </view>
</view> </view>
</view> </view>
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
<my-button :width="168" :height="60" plain shape="circle" @tap="tuicai(item,index)">退菜</my-button>
</view>
</view> </view>
<view class="u-flex u-row-right gap-20 u-m-t-20"> </view>
<my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> <view class="bg-gray u-p-20 u-m-t-20">
<my-button :width="168" :height="60" plain shape="circle">退菜</my-button> <view>备注</view>
</view> <view class="u-m-t-10"></view>
</view> </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-m-t-40">
<view class="u-flex u-row-between border-bottom u-p-b-20"> <view class="u-flex u-row-between border-bottom u-p-b-20">
<view class="tag no-pay"> <view class="tag no-pay">
@@ -47,11 +58,11 @@
<view></view> <view></view>
<view> <view>
<text>总计</text> <text>总计</text>
<text class="font-bold u-font-32">{{allPrice}}</text> <text class="font-bold u-font-32">{{seatFee*1+allPrice*1}}</text>
</view> </view>
</view> </view>
<view class="u-m-t-30"> <view class="u-m-t-30">
<my-button type="cancel" :color="color.ColorMain">重新打印</my-button> <my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
</view> </view>
</view> </view>
</view> </view>
@@ -62,25 +73,42 @@
computed computed
} from 'vue'; } from 'vue';
import color from '@/commons/color.js' import color from '@/commons/color.js'
const emits=defineEmits(['tuicai'])
function tuicai(item,index){
emits('tuicai',item,index)
}
const props = defineProps({ const props = defineProps({
data: { data: {
type: Array, type: Array,
default: () => [] default: () => []
},
seatFee:{
type:[String,Number],
default:0
} }
}) })
const allPrice = computed(() => { const allPrice = computed(() => {
return props.data.reduce((prve, cur) => { return props.data.reduce((prve, cur) => {
return prve + cur.salePrice * cur.number const curTotal=cur.info.filter(v=>v.isGift !== "true"&& v.status !== "return").reduce((a,b)=>{
return a+b.salePrice * b.number
},0)
return prve + curTotal
}, 0).toFixed(2) }, 0).toFixed(2)
}) })
const goodsNumber = computed(() => { const goodsNumber = computed(() => {
let result = 0 let result = 0
result = props.data.reduce((prve, cur) => { result = props.data.reduce((a, b) => {
return prve + cur.number const bTotal = b.info.reduce((prve, cur) => {
return prve + cur.number * 1;
}, 0);
return a + bTotal
}, 0) }, 0)
return result return result
}) })
function printOrder(){
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -88,9 +116,13 @@
width: 70rpx; width: 70rpx;
height: 70rpx; height: 70rpx;
} }
.border-bottom{
.border-bottom {
border-color: rgb(240, 240, 240); border-color: rgb(240, 240, 240);
} }
.line-th{
text-decoration: line-through;
}
.tag { .tag {
padding: 2rpx 8rpx; padding: 2rpx 8rpx;
border-radius: 8rpx; border-radius: 8rpx;
@@ -100,4 +132,13 @@
color: #fff; color: #fff;
} }
} }
.tui{
background-color: rgb(239, 239, 239);
border-radius: 4rpx;
margin-right: 6rpx;
color: #666;
padding: 0 4rpx;
font-size: 20rpx;
}
</style> </style>

View File

@@ -14,7 +14,7 @@
</view> </view>
<view class="u-flex u-row-between u-m-t-20"> <view class="u-flex u-row-between u-m-t-20">
<view>就餐人数</view> <view>就餐人数</view>
<view>1</view> <view>{{seatFee.totalNumber}}</view>
</view> </view>
<view class="u-flex u-row-between u-m-t-20"> <view class="u-flex u-row-between u-m-t-20">
<view>支付方式</view> <view>支付方式</view>
@@ -26,11 +26,11 @@
</view> </view>
<view class="u-flex u-row-between u-m-t-20"> <view class="u-flex u-row-between u-m-t-20">
<view>下单时间</view> <view>下单时间</view>
<view>2024-08-31 15:54:40</view> <view ><up-text v-if="data.createdAt" mode="date" :text="data.createdAt"></up-text></view>
</view> </view>
<view class="u-flex u-row-between u-m-t-20"> <view class="u-flex u-row-between u-m-t-20">
<view>订单编号</view> <view>订单编号</view>
<view>2024083115544056362</view> <view>{{data.orderNo}}</view>
</view> </view>
<view class="u-flex u-row-between u-m-t-20"> <view class="u-flex u-row-between u-m-t-20">
<view>商家备注</view> <view>商家备注</view>
@@ -40,6 +40,7 @@
</template> </template>
<script setup> <script setup>
import orderEnum from '@/commons/orderEnum.js'
const props = defineProps({ const props = defineProps({
data: { data: {
type: Object, type: Object,
@@ -48,14 +49,16 @@
table:{ table:{
type: Object, type: Object,
default: () => {} default: () => {}
},
seatFee:{
type: Object,
default: () => {totalNumber:0}
} }
}) })
const statusMap={
unpaid:'未支付'
}
function returnStatus(status){ function returnStatus(status){
return statusMap[status]||'' const item=orderEnum.status.find(v=>v.key==status)
return item?item.label:''
} }
</script> </script>

View File

@@ -0,0 +1,100 @@
<template>
<my-model title="退菜" ref="model" @close="onModelClose" @open="onModelOpen">
<template #desc>
<view class="u-p-30 u-text-left">
<view>
{{data.name}}
</view>
<view class="u-flex u-m-t-32">
<up-number-box :buttonSize="44" :inputWidth="220" v-model="number"></up-number-box>
</view>
<view class="u-m-t-32">
<view class="u-font-24">
<text class="color-999">退菜理由</text>
<text class="color-red">*</text>
</view>
<view class="u-flex u-flex-wrap u-m-t-24">
<view class="u-flex u-m-r-16 u-m-b-16" v-for="(item,index) in tags" :key="index">
<up-tag @click="changeTagSel(item)" :text="item.label" plain v-if="item.checked"> </up-tag>
<up-tag @click="changeTagSel(item)" borderColor="#E5E5E5" color="#999" :text="item.label" plain v-else> </up-tag>
</view>
</view>
<view class="u-m-t-24">
<up-input placeholder="备注"></up-input>
</view>
</view>
</view>
</template>
<template #btn>
<view class="u-p-t-18 u-p-l-30 u-p-r-30 u-p-b-30">
<my-button box-shadow shape="circle" @tap="confirm">确认退菜</my-button>
<view class="u-m-t-10">
<my-button @tap="toggleModelShow" shape="circle" bgColor="#fff" type="cancel" box-shadow>取消</my-button>
</view>
</view>
</template>
</my-model>
</template>
<script setup>
import {
ref,
watch
} from 'vue';
const props = defineProps({
data: {
type: Object,
default: () => {}
},
show: {
type: Boolean,
default: false
}
})
const emits = defineEmits(['update:show','confirm'])
let model = ref(null)
let modelShow = ref(props.show)
let number = ref(1)
const tags=ref([{label:"点错",checked:false},{label:"不想要了",checked:false} ,{label:"食材不足",checked:false} ,{label:"等待时间过长",checked:false}])
function changeTagSel(item){
item.checked=!item.checked
}
watch(() => props.show, (newval) => {
modelShow.value = newval
})
watch(() => modelShow.value, (newval) => {
emits('update:show', newval)
if (newval) {
open()
} else {
close()
}
})
function toggleModelShow(show){
modelShow.value=show?true:false
}
function onModelClose() {
modelShow.value = false
}
function onModelOpen() {
modelShow.value = true
}
function open() {
model.value.open()
}
function close() {
model.value.close()
}
function confirm(){
emits('confirm')
}
</script>
<style>
</style>

View File

@@ -5,8 +5,10 @@
<text class="color-666">桌位号</text> <text class="color-666">桌位号</text>
<text class="font-bold">{{options.name}}</text> <text class="font-bold">{{options.name}}</text>
</view> </view>
<goods-list :data="orderDetail.goodsList"></goods-list> <goods-list :data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount"
<order-vue :data="orderDetail.info" :table="options"></order-vue> @tuicai="onTuiCai"></goods-list>
<extra-vue :data="orderDetail.seatFee"></extra-vue>
<order-vue :data="orderDetail.info" :table="options" :seatFee="orderDetail.seatFee"></order-vue>
<step-vue></step-vue> <step-vue></step-vue>
<view style="height: 200rpx;"></view> <view style="height: 200rpx;"></view>
<view class="u-fixed bottom bg-fff "> <view class="u-fixed bottom bg-fff ">
@@ -21,6 +23,8 @@
</view> </view>
</view> </view>
</view> </view>
<tuicai-vue @confirm="tuicaiConfirm" v-model:show="tuicai.show" :data="tuicai.selGoods"></tuicai-vue>
</view> </view>
</template> </template>
@@ -30,6 +34,8 @@
import orderVue from './components/order.vue'; import orderVue from './components/order.vue';
import goodsList from './components/list.vue'; import goodsList from './components/list.vue';
import stepVue from './components/step.vue'; import stepVue from './components/step.vue';
import extraVue from './components/extra.vue';
import tuicaiVue from './components/tuicai.vue';
import go from '@/commons/utils/go.js' import go from '@/commons/utils/go.js'
import { import {
onLoad, onLoad,
@@ -40,6 +46,24 @@
reactive reactive
} from 'vue'; } from 'vue';
import OrderDetail from './page.js' import OrderDetail from './page.js'
const tuicai = reactive({
show: false,
selGoods: ''
})
function onTuiCai(goods, index) {
tuicai.show = true
tuicai.selGoods = goods
}
async function tuicaiConfirm() {
const res=await Api.$returnCart({
cartId: tuicai.selGoods.id,
tableId:options.tableId,
})
tuicai.selGoods.status='return'
tuicai.show = false
}
const uiPage = new OrderDetail() const uiPage = new OrderDetail()
setTimeout(() => { setTimeout(() => {
uiPage.setVal('user', { uiPage.setVal('user', {
@@ -50,22 +74,27 @@
function diancan() { function diancan() {
go.to('PAGES_CREATE_ORDER', { go.to('PAGES_CREATE_ORDER', {
tableId: options.tableId, tableId: options.tableId,
tableName: options.name tableName: options.name,
type: 'add'
}) })
} }
function toPay() { function toPay() {
go.to('PAGES_CRESATE_ORDER_PAY', { go.to('PAGES_CRESATE_ORDER_PAY', {
...orderDetail.info,
tableId: options.tableId, tableId: options.tableId,
tableName: options.name, tableName: options.name,
masterId: options.masterId, masterId: options.masterId,
orderId: orderDetail.info.id,
discount: 1
}) })
} }
const orderDetail = reactive({ const orderDetail = reactive({
goodsList: [], goodsList: [],
info: {} info: {},
seatFee: {
totalAmount: 0
}
}) })
const options = reactive({}) const options = reactive({})
async function init() { async function init() {
@@ -73,14 +102,16 @@
masterId masterId
} = await Api.$getMasterId(options) } = await Api.$getMasterId(options)
console.log(masterId); console.log(masterId);
options.masterId=masterId options.masterId = masterId
const { const {
records records,
seatFee
} = await Api.getCart({ } = await Api.getCart({
...options, ...options,
masterId masterId
}) })
orderDetail.goodsList = records orderDetail.goodsList = records
orderDetail.seatFee = seatFee
const info = await Api.$createOrder({ const info = await Api.$createOrder({
masterId, masterId,
vipUserId: '', vipUserId: '',
@@ -91,16 +122,16 @@
}) })
orderDetail.info = info orderDetail.info = info
} }
function watchEmit(){
function watchEmit() {
uni.$off('orderDetail:update') uni.$off('orderDetail:update')
uni.$once('orderDetail:update',(newval)=>{ uni.$once('orderDetail:update', (newval) => {
console.log(newval); console.log(newval);
init() init()
}) })
} }
onShow(()=>{ onShow(() => {
watchEmit() watchEmit()
}) })
onLoad((opt) => { onLoad((opt) => {
Object.assign(options, opt) Object.assign(options, opt)

View File

@@ -25,32 +25,49 @@
</view> </view>
</view> </view>
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 "> <view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
<my-tabs :list="pays.list"></my-tabs> <my-tabs :list="pays.list" v-model="pays.selIndex"></my-tabs>
<view class="list"> <template v-if="pays.selIndex==0">
<view class="item" @click="changePayType(index)" v-for="(item,index) in pays.payTypes.list" <view class="list">
:key="index"> <view class="item" @click="changePayType(index)" v-for="(item,index) in pays.payTypes.list"
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom"> :key="index">
<view class="u-flex"> <view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
<image class="icon" :src="item.icon" mode=""></image> <view class="u-flex">
<text class="u-m-l-10">{{item.payName}}</text> <image class="icon" :src="item.icon" mode=""></image>
</view> <text class="u-m-l-10">{{item.payName}}</text>
<view class="u-flex color-999 u-font-24"> </view>
<!-- <view class="u-m-r-20"> <view class="u-flex color-999 u-font-24">
<text>余额</text> <!-- <view class="u-m-r-20">
<text>0.00</text> <text>余额</text>
</view> --> <text>0.00</text>
<my-radio @click="changePayType(index)" :modelValue="index==pays.payTypes.selIndex"> </view> -->
</my-radio> <my-radio @click="changePayType(index)" :modelValue="index==pays.payTypes.selIndex">
</my-radio>
</view>
</view> </view>
</view> </view>
</view> </view>
</view> <view class="u-m-t-60 u-p-b-30">
<my-button @click="payOrder">确认付款</my-button>
</view>
</template>
<template v-else>
<view class="">
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信扫码</view>
<view class="u-flex u-row-center u-m-t-40">
<image style="width: 300rpx;height: 300rpx;" src="@/static/logo.png" mode=""></image>
</view>
</view>
</template>
</view> </view>
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card top border-r-12 ">
<view class="u-m-t-60 u-p-b-30">
<my-button @click="payOrder">确认付款</my-button>
</view> </view>
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
</view>
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="order.amount"></edit-discount> <edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="order.amount"></edit-discount>
</view> </view>
@@ -70,6 +87,7 @@
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue' import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
const pays = reactive({ const pays = reactive({
list: ['扫码收款', '二维码收款'], list: ['扫码收款', '二维码收款'],
selIndex: 0,
payTypes: { payTypes: {
list: [], list: [],
selIndex: 0 selIndex: 0
@@ -97,54 +115,70 @@
function changePayType(i) { function changePayType(i) {
pays.payTypes.selIndex = i pays.payTypes.selIndex = i
} }
//支付成功回调
function paySuccess(){
infoBox.showToast('支付成功')
setTimeout(() => {
// uni.$emit('orderDetail:update')
uni.navigateBack({delta:2})
}, 500)
}
async function payOrder() { async function payOrder() {
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
await Api.$payOrder({ await Api.$payOrder({
tableId: order.tableId, tableId: order.tableId,
masterId: order.masterId, masterId: order.masterId,
orderId: order.id, orderId: order.id||order.orderId,
payType, payType,
vipUserId: order.userId, vipUserId: order.userId,
discount: 1, discount: 1,
code: '' code: ''
}) })
infoBox.showToast('支付成功') paySuccess()
setTimeout(() => {
uni.$emit('orderDetail:update')
uni.navigateBack()
}, 500)
} }
onMounted(() => { onMounted(() => {
getPayType() getPayType()
}) })
const order = reactive({ const order = reactive({
amount: 0 amount: 0
}) })
function saoma(){
function saomaPay() {
const item = pays.payTypes.list[pays.payTypes.selIndex]
uni.scanCode({ uni.scanCode({
onlyFromCamera: true, onlyFromCamera: true,
success: function (res) { success:function (res) {
console.log('条码类型:' + res.scanType); console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result); console.log('条码内容:' + res.result);
Api.$payOrder({
"orderId": order.orderId, // 订单id
"payType": item.payType, //
"discount": order.discount,
"code": res.result
}).then(res=>{
console.log(res);
paySuccess()
})
} }
}); });
} }
watch(() => pays.payTypes.selIndex, (index) => { watch(() => pays.payTypes.selIndex, (newval) => {
const item = pays.payTypes.list[index] const item = pays.payTypes.list[newval]
if (item.payType == "vipPay") { if (item.payType == "vipPay") {
return return
} }
if (item.payType == "deposit") { if (item.payType == "deposit") {
//储值卡支付 //储值卡支付
return saoma() return saomaPay('deposit')
} }
if (item.payType == "scanCode") { if (item.payType == "scanCode") {
//扫码支付 //扫码支付
return saoma() return saomaPay('scanCode')
} }
}) })
onLoad((opt) => { onLoad((opt) => {
console.log(opt);
Object.assign(order, opt) Object.assign(order, opt)
}) })
</script> </script>

16
pagesCreateOrder/util.js Normal file
View File

@@ -0,0 +1,16 @@
import {
returnBoolean
} from '@/commons/utils/format.js';
// 返回购物车未下单的数据
export function getNowCart(records) {
const nowCart = records.find(v => v.placeNum == 0)
const Cart = nowCart ? nowCart.info : []
const result = Cart.map(item => {
return {
...item,
isPack: returnBoolean(item.isPack),
isGift: returnBoolean(item.isGift)
}
})
return result
}

View File

@@ -0,0 +1,36 @@
<template>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<view class="u-flex u-row-between">
<view class="font-bold">附加费</view>
<my-button plain shape="circle" :width="160" :height="56">退菜</my-button>
</view>
<view class="u-flex u-row-between u-m-t-20">
<view>{{data.name||'餐位费'}}</view>
<view>x{{data.number}}</view>
<view>{{data.number}}</view>
</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>

View File

@@ -0,0 +1,144 @@
<template>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length">
<view class="u-font-32 font-bold">
<text></text>
<text class="color-main font-bold"> {{goodsNumber}}</text>
<text>份菜品</text>
</view>
<view class="u-m-b-20 u-m-t-20" v-for="(order,orderIndex) in data" :key="orderIndex">
<view class="u-font-32"> {{ order.placeNum }}次下单
</view>
<view class="u-m-t-20 list">
<view class="item u-m-b-20" v-for="(item,index) in order.info" :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 class="u-flex">
<view class="tui" v-if="item.status=='return'">
已退
</view>
<view :class="{'line-th':item.status=='return'}">{{item.name}}</view>
</view>
<view class="u-text-right">
<view>{{item.salePrice}}</view>
<view v-if="item.status=='return'" class="line-th color-666 u-font-24">{{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" v-if="item.status!='return'">
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
<my-button :width="168" :height="60" plain shape="circle" @tap="tuicai(item,index)">退菜</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>
<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">{{seatFee*1+allPrice*1}}</text>
</view>
</view>
<view class="u-m-t-30">
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
</view>
</view>
</view>
</template>
<script setup>
import {
computed
} from 'vue';
import color from '@/commons/color.js'
const emits=defineEmits(['tuicai'])
function tuicai(item,index){
emits('tuicai',item,index)
}
const props = defineProps({
data: {
type: Array,
default: () => []
},
seatFee:{
type:[String,Number],
default:0
}
})
const allPrice = computed(() => {
return props.data.reduce((prve, cur) => {
const curTotal=cur.info.filter(v=>v.isGift !== "true"&& v.status !== "return").reduce((a,b)=>{
return a+b.salePrice * b.number
},0)
return prve + curTotal
}, 0).toFixed(2)
})
const goodsNumber = computed(() => {
let result = 0
result = props.data.reduce((a, b) => {
const bTotal = b.info.reduce((prve, cur) => {
return prve + cur.number * 1;
}, 0);
return a + bTotal
}, 0)
return result
})
function printOrder(){
}
</script>
<style lang="scss" scoped>
.img {
width: 70rpx;
height: 70rpx;
}
.border-bottom {
border-color: rgb(240, 240, 240);
}
.line-th{
text-decoration: line-through;
}
.tag {
padding: 2rpx 8rpx;
border-radius: 8rpx;
&.no-pay {
background-color: rgb(170, 170, 170);
color: #fff;
}
}
.tui{
background-color: rgb(239, 239, 239);
border-radius: 4rpx;
margin-right: 6rpx;
color: #666;
padding: 0 4rpx;
font-size: 20rpx;
}
</style>

View File

@@ -0,0 +1,66 @@
<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>{{seatFee.totalNumber}}</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 ><up-text v-if="data.createdAt" mode="date" :text="data.createdAt"></up-text></view>
</view>
<view class="u-flex u-row-between u-m-t-20">
<view>订单编号</view>
<view>{{data.orderNo}}</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>
import orderEnum from '@/commons/orderEnum.js'
const props = defineProps({
data: {
type: Object,
default: () => {}
},
table:{
type: Object,
default: () => {}
},
seatFee:{
type: Object,
default: () => {totalNumber:0}
}
})
function returnStatus(status){
const item=orderEnum.status.find(v=>v.key==status)
return item?item.label:''
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,26 @@
<template>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<up-steps :dot="true" current="0" direction="column">
<up-steps-item title="2024-09-02 09:19" :itemStyle="itemStyle" desc="[东风(id:124413)]使用代客下单提交。(未打印预结单)">
</up-steps-item>
<up-steps-item title="2024-09-02 09:19" desc="[东风(id:124413)]使用代客下单提交。(未打印预结单)">
</up-steps-item>
</up-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>

View File

@@ -0,0 +1,100 @@
<template>
<my-model title="退菜" ref="model" @close="onModelClose" @open="onModelOpen">
<template #desc>
<view class="u-p-30 u-text-left">
<view>
{{data.name}}
</view>
<view class="u-flex u-m-t-32">
<up-number-box :buttonSize="44" :inputWidth="220" v-model="number"></up-number-box>
</view>
<view class="u-m-t-32">
<view class="u-font-24">
<text class="color-999">退菜理由</text>
<text class="color-red">*</text>
</view>
<view class="u-flex u-flex-wrap u-m-t-24">
<view class="u-flex u-m-r-16 u-m-b-16" v-for="(item,index) in tags" :key="index">
<up-tag @click="changeTagSel(item)" :text="item.label" plain v-if="item.checked"> </up-tag>
<up-tag @click="changeTagSel(item)" borderColor="#E5E5E5" color="#999" :text="item.label" plain v-else> </up-tag>
</view>
</view>
<view class="u-m-t-24">
<up-input placeholder="备注"></up-input>
</view>
</view>
</view>
</template>
<template #btn>
<view class="u-p-t-18 u-p-l-30 u-p-r-30 u-p-b-30">
<my-button box-shadow shape="circle" @tap="confirm">确认退菜</my-button>
<view class="u-m-t-10">
<my-button @tap="toggleModelShow" shape="circle" bgColor="#fff" type="cancel" box-shadow>取消</my-button>
</view>
</view>
</template>
</my-model>
</template>
<script setup>
import {
ref,
watch
} from 'vue';
const props = defineProps({
data: {
type: Object,
default: () => {}
},
show: {
type: Boolean,
default: false
}
})
const emits = defineEmits(['update:show','confirm'])
let model = ref(null)
let modelShow = ref(props.show)
let number = ref(1)
const tags=ref([{label:"点错",checked:false},{label:"不想要了",checked:false} ,{label:"食材不足",checked:false} ,{label:"等待时间过长",checked:false}])
function changeTagSel(item){
item.checked=!item.checked
}
watch(() => props.show, (newval) => {
modelShow.value = newval
})
watch(() => modelShow.value, (newval) => {
emits('update:show', newval)
if (newval) {
open()
} else {
close()
}
})
function toggleModelShow(show){
modelShow.value=show?true:false
}
function onModelClose() {
modelShow.value = false
}
function onModelOpen() {
modelShow.value = true
}
function open() {
model.value.open()
}
function close() {
model.value.close()
}
function confirm(){
emits('confirm')
}
</script>
<style>
</style>

View 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">
<up-avatar :size="30"></up-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>

View File

@@ -0,0 +1,154 @@
<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" :seatFee="orderDetail.seatFee.totalAmount"
@tuicai="onTuiCai"></goods-list>
<extra-vue :data="orderDetail.seatFee"></extra-vue>
<order-vue :data="orderDetail.info" :table="options" :seatFee="orderDetail.seatFee"></order-vue>
<step-vue></step-vue>
<view style="height: 200rpx;"></view>
<view class="u-fixed bottom bg-fff ">
<view class="u-flex u-abso">
<template v-if="orderDetail.info.status=='unpaid'">
<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>
</template>
</view>
</view>
<tuicai-vue @confirm="tuicaiConfirm" v-model:show="tuicai.show" :data="tuicai.selGoods"></tuicai-vue>
</view>
</template>
<script setup>
import * as Api from '@/http/yskApi/Instead.js'
import * as orderApi from '@/http/yskApi/order.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 extraVue from './components/extra.vue';
import tuicaiVue from './components/tuicai.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 tuicai = reactive({
show: false,
selGoods: {}
})
function onTuiCai(goods, index) {
tuicai.show = true
tuicai.selGoods = goods
}
async function tuicaiConfirm() {
const res=await Api.$returnCart({
cartId: tuicai.selGoods.id,
tableId:options.tableId,
})
tuicai.selGoods.status='return'
tuicai.show = false
}
const uiPage = new OrderDetail()
setTimeout(() => {
uiPage.setVal('user', {
name: 1
})
}, 1500)
function diancan() {
go.to('PAGES_CREATE_ORDER', {
tableId: options.tableId,
tableName: options.name,
type: 'add'
})
}
function toPay() {
go.to('PAGES_CRESATE_ORDER_PAY', {
tableId: options.tableId,
tableName: options.name,
masterId: options.masterId,
orderId: orderDetail.info.id,
discount: 1
})
}
const orderDetail = reactive({
goodsList: [],
info: {},
seatFee: {
totalAmount: 0
}
})
const options = reactive({})
async function init() {
const res= await orderApi.tbOrderInfoDetail(options.id)
const masterId=res.masterId
options.masterId = res.masterId
if(res.status=='unpaid'){
const {
records,
seatFee
} = await Api.getCart({
masterId,
tableId:res.tableId
})
orderDetail.goodsList = records
orderDetail.seatFee = seatFee
}else{
orderDetail.goodsList = res.detailList
}
orderDetail.info = res
}
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
pagesOrder/detail/page.js Normal file
View 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

View File

@@ -0,0 +1,194 @@
<template>
<view>
<view class="u-flex bg-fff u-p-l-28 u-p-r-28 u-row-between">
<view class="u-rela time-item tranistion-2" @click="changeTimeDataSel(index)"
:class="{active:timeData.sel==index}" v-for="(item,index) in timeData.list" :key="index">
{{item.label}}
</view>
<view class="u-rela time-item tranistion-2" @click="changeTimeDataSel(-1)"
:class="{active:timeData.sel==-1}">自定义</view>
</view>
<view class="u-m-t-2 bg-fff u-col-center u-flex u-p-l-28 u-p-r-28 u-p-t-30 u-row-between">
<view class="status-item " @click="changeStatusSel(index)" :class="{active:statusData.sel==index}"
v-for="(item,index) in statusData.list" :key="index">
{{item.label}}
</view>
<view class="status-item u-flex" @click="moreShowOpen">
<image src="@/pagesOrder/static/image/icon-search.svg" style="width: 38rpx;height: 30rpx;" mode="">
</image>
</view>
</view>
<view class="u-p-l-28 u-flex u-p-r-28 u-p-t-10 bg-gray" v-if="time.length">
<view class="time-area u-font-24 color-main u-flex">
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="time[0]"></uni-dateformat>
<text class="u-p-l-10 u-p-r-10"></text>
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="time[1]"></uni-dateformat>
</view>
</view>
<my-date-pickerview @confirm="datePickerConfirm" ref="datePicker"></my-date-pickerview>
<!-- 更多状态选择筛选 -->
<up-popup :round="10" :show="statusData.moreShow" :closeable="true" @close="moreShowHide">
<view class="u-text-center font-bold u-font-32 u-p-t-30">选择状态</view>
<view style="height: 20rpx;"></view>
<view class="u-p-30 all-list u-flex u-flex-wrap gap-20">
<view class="all-list-item" :class="{active:statusItemIndex==statusData.allListSel}" @click="changeAllListSel(statusItemIndex)" v-for="(statusItem,statusItemIndex) in statusData.allList" :key="statusItemIndex">
{{statusItem.label}}
</view>
</view>
<view class="u-flex u-p-t-30 u-p-b-30 u-p-l-20 u-p-r-20 gap-20">
<up-button @click="moreShowHide">取消</up-button>
<up-button type="primary" @click="moreShowHide">确定</up-button>
</view>
</up-popup>
</view>
</template>
<script setup>
import orderEnum from '@/commons/orderEnum.js'
import * as $time from '@/commons/utils/dayjs-time.js';
import {
reactive,
ref,
watch
} from 'vue';
const props = defineProps({
time: {
type: Array,
default: () => []
},
status: {
type: [String, Number],
default: ''
}
})
let datePicker = ref(null)
const emits = defineEmits(['update:time', 'update:status'])
// 示例使用
const today = $time.getTodayTimestamps();
const yesterday = $time.getYesterdayTimestamps();
const thisWeek = $time.getThisWeekTimestamps();
const thisMonth = $time.getThisMonthTimestamps();
const timeData = reactive({
list: [today, yesterday, thisWeek, thisMonth],
sel: 0
})
function changeTimeDataSel(i) {
timeData.sel = i
if (i == -1) {
datePicker.value.open()
}
}
watch(() => timeData.sel, (newval) => {
const data = timeData.list[newval]
if (newval != -1) {
emits('update:time', [data.start, data.end])
}
})
const statusData = reactive({
allList: orderEnum.status,
moreShow:false,
allListSel: -1,
list: [{
label: '全部',
value: ''
},
{
label: '待完成',
value: ''
},
{
label: '待退款',
value: ''
},
{
label: '未支付',
value: 'unpaid'
},
{
label: '已退款',
value: ''
}
],
sel: 0
})
function moreShowHide(){
statusData.moreShow=false
}
function moreShowOpen(){
statusData.moreShow=true
}
function changeStatusSel(i) {
statusData.sel = i
}
function datePickerConfirm(e) {
console.log(e);
emits('update:time', [e.start, e.end])
}
function changeAllListSel(i){
statusData.allListSel=i
}
</script>
<style lang="scss" scoped>
.status-item {
color: #666;
transition: all .2s ease-in-out;
padding-bottom: 24rpx;
&.active {
color: $my-main-color;
}
}
.all-list-item{
text-align: center;
width: 156rpx;
white-space: nowrap;
color: #666;
padding: 10rpx 20rpx;
border-radius: 8rpx;
transition: all .2s ease-in-out;
border: 1px solid #eee;
&.active {
color: $my-main-color;
border-color: $my-main-color;
}
}
.time-item {
color: #666;
padding-bottom: 20rpx;
&::after {
content: '';
display: block;
position: absolute;
height: 4rpx;
left: 0;
right: 0;
bottom: 0;
border-radius: 4rpx 4rpx 4rpx 4rpx;
}
&.active {
color: $my-main-color;
// font-size: 32rpx;
transform: scale(1.1);
transform-origin: center;
font-weight: 700;
&::after {
background: #318AFE;
}
}
}
.time-area {
background: #E6F0FF;
border-radius: 100px;
padding: 10rpx 20rpx;
}
</style>

View File

@@ -0,0 +1,120 @@
<template>
<view class="bg-fff item" @click="toDetail">
<view class="u-flex u-p-b-22 border-bottom u-col-bottom u-row-between">
<view class="u-flex u-col-bottom">
<view class="u-font-40 color-333">{{data.tableName}}</view>
<view class="u-m-l-22">{{data.masterId}}</view>
</view>
<view class="u-flex">
<view>
<text :class="[data.status]">{{returnStatus(data.status)}}</text>
</view>
<view class="color-main u-m-l-24">
<text>
{{sendTypeFilter(data.sendType)}}
</text>
</view>
</view>
</view>
<view class="u-m-t-26">
<view class="u-flex u-col-bottom u-font-24 color-999">
<up-avatar :size="33"></up-avatar>
<view class="u-m-l-16">{{formatTime(data.createdAt)}}</view>
</view>
<view class="u-m-t-32">
<view class="u-font-32">1种商品共1件</view>
<view class="border-bottom u-p-b-32">
<view class="u-flex u-row-between u-m-t-24" v-for="(item,index) in data.detailList" :key="index">
<view>
<view class="color-666"> {{item.productName}}</view>
<view class="color-999 u-font-24 u-m-t-8">
{{item.productSkuName}}
</view>
</view>
<view class="u-flex">
<view>×1</view>
<view class="u-m-l-24">15.00</view>
</view>
</view>
</view>
</view>
<view class="u-flex u-row-between border-bottom u-m-t-32 u-p-b-32">
<view>订单备注</view>
<view>{{data.remark||'无'}}</view>
</view>
<view class="u-m-t-32">
<view class="u-flex u-row-right">
<text>小计</text>
<text class="font-bold u-font-32">{{data.orderAmount}}</text>
</view>
<view class="u-flex u-row-right u-m-t-24">
<view class="print">重新打印</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import dayjs from 'dayjs';
import orderEnum from '@/commons/orderEnum.js'
import go from '@/commons/utils/go.js'
const props = defineProps({
data: {
type: Object,
default: () => {}
},
index: {
type: [String, Number],
default: 0
}
})
function formatTime(time){
return dayjs(time).format('YYYY-MM-DD HH:mm:ss');
}
function returnStatus(status) {
const item = orderEnum.status.find(v => v.key == status)
return item ? item.label : ''
}
function sendTypeFilter(t) {
if (t) {
return orderEnum.sendType.find(item => item.key == t).label;
} else {
return t;
}
}
function toDetail(){
go.to('PAGES_ORDER_DETAIL',{
id:props.data.id
})
}
</script>
<style lang="scss" scoped>
.border-bottom {
border-bottom: 1rpx solid #E5E5E5;
}
.u-font-40 {
font-size: 40rpx;
}
.item {
padding: 16rpx 24rpx 32rpx 24rpx;
border-radius: 18rpx 18rpx 18rpx 18rpx;
margin-bottom: 32rpx;
}
.unpaid {
color: #FD7B49;
}
.print{
padding: 6rpx 14rpx 8rpx 18rpx;
border:1px solid $my-main-color;
color:$my-main-color;
font-size: 24rpx;
border-radius: 100rpx;
}
</style>

View File

@@ -0,0 +1,31 @@
<template>
<view class="list">
<view v-for="(item,index) in list" :key="index">
<order-item :data="item" :index="index"></order-item>
</view>
<view v-if="hasAjax&&!list.length">
<my-img-empty tips="亲,你还没有订单哦~"></my-img-empty>
</view>
</view>
</template>
<script setup>
import orderItem from './order-item.vue';
const props=defineProps({
list:{
type:Array,
default:()=>[]
},
hasAjax:{
type:Boolean,
default:false
}
})
</script>
<style lang="scss" scoped>
.list {
padding: 32rpx 28rpx;
}
</style>

View File

@@ -0,0 +1,65 @@
<template>
<view class="min-page bg-gray u-font-28">
<view class="top">
<view class="search bg-fff u-p-t-32 u-p-l-28 u-p-r-28 u-p-b-32">
<up-search v-bind="search" v-model="search.val"></up-search>
</view>
<filter-vue v-model:time="pageData.order.query.createdAt"></filter-vue>
</view>
<order-list :hasAjax="pageData.order.hasAjax" :list="pageData.order.list"></order-list>
</view>
</template>
<script setup>
import * as Api from '@/http/yskApi/order.js'
import filterVue from './compoents/filter.vue';
import orderList from './compoents/order-list.vue';
import {
reactive, watch
} from 'vue';
const search = reactive({
val: '',
placeholder: '搜索单号/昵称/姓名/手机号码/商品名称',
shape: 'square',
inputStyle: {
borderRadius: '12rpx'
},
actionStyle: {
textAlign: 'right'
}
})
const pageData = reactive({
order: {
list: [],
hasAjax:false,
query: {
createdAt: [],
id: "",
orderNo: "",
orderType: "0",
page: 0,
pageSize: 10,
payType: "",
productName: "",
status: ""
}
}
})
watch(()=>pageData.order.query.createdAt,(newval)=>{
init()
})
async function init() {
const {content}=await Api.tbOrderInfoData(pageData.order.query)
pageData.order.hasAjax=true
pageData.order.list=content
console.log(content);
}
init()
</script>
<style>
.top {
background-color: #E5E5E5;
}
</style>

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="19.091" height="15" viewBox="0 0 19.091 15"><defs><style>.a{fill:#318afe;}</style></defs><path class="a" d="M64.682,160H82.409a.682.682,0,1,1,0,1.364H64.682a.682.682,0,1,1,0-1.364Zm0,13.636H76.955a.682.682,0,0,1,0,1.364H64.682a.682.682,0,0,1,0-1.364ZM80.773,170.5l2.045,3.136a.682.682,0,1,1-1.091.818l-2.045-3.136a10.526,10.526,0,0,1-2.045.273,4.773,4.773,0,1,1,4.773-4.773A5.15,5.15,0,0,1,80.773,170.5Zm-3.136-.273a3.409,3.409,0,1,0-3.409-3.409A3.376,3.376,0,0,0,77.636,170.227Zm-12.955-3.409h5.455a.682.682,0,1,1,0,1.364H64.682a.682.682,0,0,1,0-1.364Z" transform="translate(-64 -160)"/></svg>

After

Width:  |  Height:  |  Size: 641 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="0 0 32 32"><defs><style>.a{fill:#80bcff;}.b{clip-path:url(#a);}.c{fill:#4c99fe;}.d{fill:#197dff;}</style><clipPath id="a"><rect class="a" width="32" height="32" transform="translate(121 613)"/></clipPath></defs><g class="b" transform="translate(-121 -613)"><path class="c" d="M157.133,65.1h-4.344a2.052,2.052,0,0,0-1.985-1.574h-2.153a1.807,1.807,0,0,0-3.349,0h-2.188a2.058,2.058,0,0,0-1.985,1.574h-4.344a2,2,0,0,0-1.985,2.053V89.246a2.023,2.023,0,0,0,1.985,2.053H157.1a2.088,2.088,0,0,0,2.085-2.053V67.155A2.034,2.034,0,0,0,157.133,65.1Zm-10.124.992a1.642,1.642,0,1,1-1.642,1.642A1.642,1.642,0,0,1,147.009,66.095Zm6.258,17a.76.76,0,0,1-.753.753H141.5a.76.76,0,0,1-.753-.753v-.685a.76.76,0,0,1,.753-.753h11.01a.76.76,0,0,1,.753.753Zm0-6.943a.76.76,0,0,1-.753.753H141.5a.76.76,0,0,1-.753-.753v-.685a.76.76,0,0,1,.753-.753h11.01a.76.76,0,0,1,.753.753Z" transform="translate(-11.01 550.904)"/><path class="c" d="M9.823,6.186a1.25,1.25,0,0,1,0-2.3.4.4,0,0,0,.228-.488,5.4,5.4,0,0,0-.264-.655.392.392,0,0,0-.5-.2A1.25,1.25,0,0,1,7.67.883.4.4,0,0,0,7.5.371,5.224,5.224,0,0,0,6.674.022.4.4,0,0,0,6.186.25a1.25,1.25,0,0,1-1.152.763A1.251,1.251,0,0,1,3.882.249.394.394,0,0,0,3.4.02a5.273,5.273,0,0,0-.767.319.4.4,0,0,0-.2.494A1.249,1.249,0,0,1,.824,2.447a.4.4,0,0,0-.493.2,5.077,5.077,0,0,0-.311.747.4.4,0,0,0,.228.491,1.25,1.25,0,0,1,.762,1.151A1.25,1.25,0,0,1,.248,6.186a.4.4,0,0,0-.228.491,5.223,5.223,0,0,0,.311.75.4.4,0,0,0,.493.2A1.249,1.249,0,0,1,2.433,9.24a.408.408,0,0,0,.211.5,5.192,5.192,0,0,0,.726.3.4.4,0,0,0,.506-.231,1.249,1.249,0,0,1,2.322,0,.4.4,0,0,0,.506.231,5.066,5.066,0,0,0,.528-.209.4.4,0,0,0,.219-.5A1.249,1.249,0,0,1,9.139,7.76a.4.4,0,0,0,.513-.166,5.211,5.211,0,0,0,.4-.916.4.4,0,0,0-.228-.492Zm-4.788.556a1.71,1.71,0,1,1,1.71-1.71A1.715,1.715,0,0,1,5.035,6.742Z" transform="translate(141.93 634.935)"/><path class="d" d="M18.394,28.9a5.28,5.28,0,0,1-.233-.59.4.4,0,0,1,.228-.49,1.25,1.25,0,0,0,0-2.3.4.4,0,0,1-.228-.491,5.157,5.157,0,0,1,.31-.747.4.4,0,0,1,.493-.2,1.25,1.25,0,0,0,1.608-1.614.4.4,0,0,1,.2-.5,5.323,5.323,0,0,1,.768-.319.393.393,0,0,1,.485.229,1.251,1.251,0,0,0,2.3,0,.41.41,0,0,1,.057-.095v3.668a1.71,1.71,0,1,0-.577,2.8A2.1,2.1,0,0,1,22.3,28.9Z" transform="translate(123.79 613.304)"/></g></svg>

After

Width:  |  Height:  |  Size: 2.3 KiB