fix: 代码合并
This commit is contained in:
commit
b71ca19c0d
|
|
@ -7,6 +7,7 @@ const API = {
|
|||
return request({
|
||||
url: `${baseURL}/code?num=` + num,
|
||||
method: "post",
|
||||
responseType: 'blob'
|
||||
});
|
||||
},
|
||||
getList(data: getListRequest) {
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ const OrderApi = {
|
|||
params: params,
|
||||
});
|
||||
},
|
||||
// 订单全额退款 只传订单id
|
||||
// 订单退款 只传订单id
|
||||
refundOrder(data: refundOrderRequest) {
|
||||
return request<any>({
|
||||
url: `${baseURL}/refundOrder`,
|
||||
method: "post",
|
||||
params: data,
|
||||
data
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,100 @@
|
|||
import request from "@/utils/request";
|
||||
import { Order_BaseUrl } from "@/api/config";
|
||||
const baseURL = Order_BaseUrl + "/pay";
|
||||
const Api = {
|
||||
// h5支付
|
||||
|
||||
h5Pay(data: h5PayRequest) {
|
||||
return request<any>({
|
||||
url: `${baseURL}/h5Pay`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
},
|
||||
//反扫
|
||||
microPay(data: any) {
|
||||
return request<any>({
|
||||
url: `${baseURL}/microPay`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
},
|
||||
//现金支付
|
||||
cashPay(data: any) {
|
||||
return request<any>({
|
||||
url: `${baseURL}/cashPay`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export default Api;
|
||||
|
||||
export interface h5PayRequest {
|
||||
/**
|
||||
* 支付备注
|
||||
*/
|
||||
buyerRemark?: string;
|
||||
checkOrderPay?: CheckOrderPay;
|
||||
/**
|
||||
* 跳转地址
|
||||
*/
|
||||
returnUrl?: string;
|
||||
shopId: number;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* CheckOrderPay
|
||||
*/
|
||||
export interface CheckOrderPay {
|
||||
/**
|
||||
* 用户使用的卡券
|
||||
*/
|
||||
couponList?: number[];
|
||||
/**
|
||||
* 手动优惠金额
|
||||
*/
|
||||
discountAmount?: number;
|
||||
/**
|
||||
* 折扣比例(计算时 向上取整保留 两位小数)
|
||||
*/
|
||||
discountRatio?: number;
|
||||
/**
|
||||
* 满减优惠券抵扣金额
|
||||
*/
|
||||
fullCouponDiscountAmount?: number;
|
||||
/**
|
||||
* 订单金额
|
||||
*/
|
||||
orderAmount?: number;
|
||||
orderId: number;
|
||||
/**
|
||||
* 订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
*/
|
||||
originAmount?: number;
|
||||
/**
|
||||
* 积分抵扣金额(tb_points_basic_setting表)
|
||||
*/
|
||||
pointsDiscountAmount?: number;
|
||||
/**
|
||||
* 使用的积分数量 (扣除各类折扣 enable_deduction后使用)
|
||||
*/
|
||||
pointsNum?: number;
|
||||
/**
|
||||
* 商品优惠券抵扣金额
|
||||
*/
|
||||
productCouponDiscountAmount?: number;
|
||||
/**
|
||||
* 抹零金额 减免多少钱
|
||||
*/
|
||||
roundAmount?: number;
|
||||
/**
|
||||
* 用餐人数
|
||||
*/
|
||||
seatNum?: number;
|
||||
userId?: number;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import request from "@/utils/request";
|
||||
import { property } from "lodash";
|
||||
|
||||
const USER_BASE_URL = "/api/v1/users";
|
||||
|
||||
|
|
@ -237,6 +238,7 @@ export interface UserInfo {
|
|||
|
||||
/** 店铺logo */
|
||||
logo: string;
|
||||
[property: string]: any
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<!-- <LangSelect /> -->
|
||||
|
||||
<!-- 消息通知 -->
|
||||
<Notification />
|
||||
<!-- <Notification /> -->
|
||||
</template>
|
||||
|
||||
<!-- 用户头像(个人中心、注销登录等) -->
|
||||
|
|
|
|||
|
|
@ -639,7 +639,7 @@ export const constantRoutes: RouteRecordRaw[] = [
|
|||
{
|
||||
path: "index",
|
||||
component: () => import("@/views/mytemplate/index.vue"),
|
||||
name: "mytemplate",
|
||||
name: "mytemplateIndex",
|
||||
meta: {
|
||||
title: "我的模板",
|
||||
affix: false,
|
||||
|
|
|
|||
|
|
@ -1,20 +1,38 @@
|
|||
import { store } from "@/store";
|
||||
import WebSocketManager, { type ApifoxModel, msgType } from "@/utils/websocket";
|
||||
import orderApi from "@/api/order/order";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
|
||||
const shopUser = useUserStore();
|
||||
export interface CartsState {
|
||||
id: string | number;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
export const useCartsStore = defineStore("carts", () => {
|
||||
//选择用户
|
||||
const vipUser = ref<{ id?: string | number, isVip?: boolean }>({});
|
||||
function changeUser(user: any) {
|
||||
vipUser.value = user;
|
||||
}
|
||||
|
||||
|
||||
//是否启用会员价
|
||||
const useVipPrice = computed(() => {
|
||||
return shopUser.userInfo.isMemberPrice && vipUser.value.id && vipUser.value.isVip
|
||||
})
|
||||
|
||||
//台桌id
|
||||
const table_code = ref('');
|
||||
|
||||
|
||||
//当前购物车数据
|
||||
const list = useStorage<any[]>("carts", []);
|
||||
//历史订单数据
|
||||
const oldOrder = useStorage<any>("Instead_olold_order", {
|
||||
detailMap: [],
|
||||
originAmount: 0
|
||||
});
|
||||
|
||||
//代客下单页面商品缓存
|
||||
const goods = useStorage<any[]>("Instead_goods", []);
|
||||
//赠菜
|
||||
|
|
@ -22,8 +40,13 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
let goodsMap: { [key: string]: any } = useStorage('Instead_goods_map', {});
|
||||
//当前选中cart
|
||||
let selListIndex = ref(-1);
|
||||
|
||||
//当前选中商品是否是赠菜
|
||||
const isSelGift = ref(false);
|
||||
//当前选中是否是历史订单
|
||||
const isOldOrder = ref(false);
|
||||
//选中历史订单中的第几次下单
|
||||
const selPlaceNum = ref(-1);
|
||||
const defaultCart = {
|
||||
id: '',
|
||||
number: 0,
|
||||
|
|
@ -34,6 +57,9 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
})
|
||||
//当前购物车选中数据
|
||||
const selCart = computed(() => {
|
||||
if (isOldOrder.value && selPlaceNum.value >= 0) {
|
||||
return oldOrder.value.detailMap[selPlaceNum.value][selListIndex.value]
|
||||
}
|
||||
if (isSelGift.value) {
|
||||
return giftList.value[selListIndex.value] || defaultCart
|
||||
}
|
||||
|
|
@ -56,6 +82,29 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
return acc + cur.number * cur.salePrice
|
||||
}, 0)
|
||||
})
|
||||
//打包数量
|
||||
const packNum = computed(() => {
|
||||
const nowCartNumber = list.value.reduce((acc: number, cur: any) => {
|
||||
return acc + cur.pack_number * 1
|
||||
}, 0)
|
||||
const giftNumber = giftList.value.reduce((acc: number, cur: any) => {
|
||||
return acc + cur.pack_number * 1
|
||||
}, 0)
|
||||
return nowCartNumber + giftNumber
|
||||
})
|
||||
//打包费
|
||||
const packFee = computed(() => {
|
||||
const nowPackFee = list.value.reduce((acc: number, cur: any) => {
|
||||
return acc + (cur.packFee || 0) * cur.pack_number
|
||||
}, 0)
|
||||
const giftPackFee = giftList.value.reduce((acc: number, cur: any) => {
|
||||
return acc + (cur.packFee || 0) * cur.pack_number
|
||||
}, 0)
|
||||
return nowPackFee + giftPackFee
|
||||
})
|
||||
|
||||
|
||||
// 优惠
|
||||
const yiyouhui = computed(() => {
|
||||
const youhui = giftMoney.value
|
||||
if (youhui > 0) {
|
||||
|
|
@ -67,14 +116,11 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
//支付总价
|
||||
const payMoney = computed(() => {
|
||||
const money = list.value.reduce((acc: number, cur: any) => {
|
||||
if (cur.is_temporary) {
|
||||
//临时菜
|
||||
return acc + cur.number * (cur.discount_sale_amount)
|
||||
} else {
|
||||
return acc + cur.number * (cur.salePrice)
|
||||
}
|
||||
const memberPrice = cur.skuData ? (cur.skuData.memberPrice || cur.skuData.salePrice) : 0
|
||||
const price = (cur.discount_sale_amount * 1 || cur.salePrice || 0)
|
||||
return acc + cur.number * (useVipPrice.value ? memberPrice : price)
|
||||
}, 0)
|
||||
return money.toFixed(2)
|
||||
return (money + packFee.value).toFixed(2)
|
||||
})
|
||||
//总计数量
|
||||
const totalNumber = computed(() => {
|
||||
|
|
@ -102,6 +148,21 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
if (!cart.id) {
|
||||
return
|
||||
}
|
||||
if (cart.placeNum) {
|
||||
selPlaceNum.value = cart.placeNum
|
||||
isOldOrder.value = true
|
||||
console.log(oldOrder.value.detailMap[cart.placeNum])
|
||||
selListIndex.value = oldOrder.value.detailMap[cart.placeNum].findIndex((item: CartsState) => {
|
||||
return item.id == cart.id
|
||||
})
|
||||
return
|
||||
}
|
||||
if (cart.is_gift) {
|
||||
isSelGift.value = true
|
||||
} else {
|
||||
isSelGift.value = false
|
||||
}
|
||||
|
||||
if (cart.is_gift) {
|
||||
isSelGift.value = true
|
||||
selListIndex.value = giftList.value.findIndex((item: CartsState) => item.id === cart.id);
|
||||
|
|
@ -119,7 +180,8 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
is_temporary: 0,
|
||||
discount_sale_amount: 0,
|
||||
discount_sale_note: "",
|
||||
is_print: 0,
|
||||
is_print: 1,
|
||||
pro_group_info: '',
|
||||
is_wait_call: 0,
|
||||
product_name: "",
|
||||
remark: "",
|
||||
|
|
@ -156,6 +218,8 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
new_table_code: newVal,
|
||||
id: list.value[0].id
|
||||
});
|
||||
} else {
|
||||
table_code.value = `${newVal}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -176,9 +240,19 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
}
|
||||
sendMessage('edit', { ...cart, [key]: val });
|
||||
}
|
||||
|
||||
function clear() {
|
||||
sendMessage('cleanup', {});
|
||||
}
|
||||
function dataReset() {
|
||||
list.value = [];
|
||||
giftList.value = [];
|
||||
selListIndex.value = -1
|
||||
selPlaceNum.value = 1
|
||||
isOldOrder.value = false
|
||||
selListIndex.value = -1;
|
||||
isSelGift.value = false
|
||||
}
|
||||
|
||||
// 寻找套餐商品sku
|
||||
interface GroupSnap {
|
||||
|
|
@ -200,19 +274,25 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
return undefined
|
||||
}
|
||||
let skuData = undefined;
|
||||
if (goods.type == 'package') {
|
||||
//套餐商品
|
||||
const SnapSku = findInGroupSnapSku(goods.groupSnap, v.sku_id)
|
||||
skuData = { ...SnapSku, salePrice: SnapSku ? SnapSku.price : 0 }
|
||||
} else {
|
||||
skuData = goods?.skuList.find((sku: { id: string, salePrice: number }) => sku.id == v.sku_id);
|
||||
}
|
||||
skuData = goods?.skuList.find((sku: { id: string, salePrice: number }) => sku.id == v.sku_id);
|
||||
|
||||
// if (goods.type == 'package') {
|
||||
// //套餐商品
|
||||
// const SnapSku = findInGroupSnapSku(goods.groupSnap, v.sku_id)
|
||||
// skuData = { ...SnapSku, salePrice: SnapSku ? SnapSku.price : 0 }
|
||||
// } else {
|
||||
// skuData = goods?.skuList.find((sku: { id: string, salePrice: number }) => sku.id == v.sku_id);
|
||||
// }
|
||||
skuData = goods?.skuList.find((sku: { id: string, salePrice: number }) => sku.id == v.sku_id);
|
||||
|
||||
if (skuData) {
|
||||
return {
|
||||
salePrice: skuData ? skuData.salePrice : 0,
|
||||
memberPrice: skuData ? skuData.memberPrice : 0,
|
||||
coverImg: goods.coverImg,
|
||||
name: goods.name,
|
||||
specInfo: skuData.specInfo,
|
||||
packFee: goods.packFee || 0,
|
||||
skuData
|
||||
}
|
||||
} else {
|
||||
|
|
@ -220,10 +300,42 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
}
|
||||
}
|
||||
|
||||
function init(initParams: ApifoxModel, $goodsMap: any) {
|
||||
function returnDetailMap(data: any) {
|
||||
const newData: { [key: string]: any } = {}
|
||||
for (let i in data) {
|
||||
newData[i] = data[i].map((v: any) => {
|
||||
|
||||
const skuData = getProductDetails({ product_id: v.productId, sku_id: v.skuId })
|
||||
|
||||
return {
|
||||
...skuData,
|
||||
placeNum: v.placeNum,
|
||||
number: v.num,
|
||||
id: v.id
|
||||
}
|
||||
})
|
||||
}
|
||||
return newData
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param initParams 购物车初始化参数
|
||||
* @param $goodsMap 商品id对应的map
|
||||
* @param oldOrder 历史订单数据
|
||||
*/
|
||||
|
||||
function init(initParams: ApifoxModel, $goodsMap: any, $oldOrder: any) {
|
||||
// 商品id对应的数据map
|
||||
goodsMap = $goodsMap
|
||||
|
||||
oldOrder.value = {
|
||||
...$oldOrder,
|
||||
detailMap: returnDetailMap($oldOrder.detailMap)
|
||||
}
|
||||
console.log('initParams', initParams)
|
||||
|
||||
table_code.value = initParams && initParams.table_code ? initParams.table_code : '';
|
||||
|
||||
WebSocketManager.subscribeToTopic(initParams, (msg) => {
|
||||
console.log("收到消息:", msg);
|
||||
if (msg.hasOwnProperty('status') && msg.status != 1) {
|
||||
|
|
@ -236,11 +348,17 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
if (msg.data.table_code) {
|
||||
table_code.value = table_code.value ? table_code.value : msg.data.table_code
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 初始化
|
||||
if (msg.operate_type === "manage_init") {
|
||||
// 设置单价
|
||||
list.value = msg.data.filter((v: Record<string, any>) => {
|
||||
if (v.is_temporary) {
|
||||
return v
|
||||
}
|
||||
const skuData = getProductDetails({ product_id: v.product_id, sku_id: v.sku_id })
|
||||
if (skuData) {
|
||||
(Object.keys(skuData) as (keyof typeof skuData)[]).forEach((key) => {
|
||||
|
|
@ -253,6 +371,9 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
return !v.is_gift
|
||||
})
|
||||
giftList.value = msg.data.filter((v: Record<string, any>) => {
|
||||
if (v.is_temporary) {
|
||||
return v && v.is_gift
|
||||
}
|
||||
const skuData = getProductDetails({ product_id: v.product_id, sku_id: v.sku_id })
|
||||
if (skuData) {
|
||||
(Object.keys(skuData) as (keyof typeof skuData)[]).forEach((key) => {
|
||||
|
|
@ -335,13 +456,17 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
if (msg.operate_type === "manage_cleanup") {
|
||||
list.value = []
|
||||
giftList.value = []
|
||||
oldOrder.value = {
|
||||
detailMap: [],
|
||||
originAmount: 0
|
||||
}
|
||||
table_code.value = ''
|
||||
}
|
||||
console.log(list.value)
|
||||
});
|
||||
}
|
||||
|
||||
const delArr = ['skuData', 'coverImg', 'specInfo']
|
||||
const delArr = ['skuData', 'coverImg', 'specInfo', 'placeNum', 'update_time', 'create_time', 'packFee', 'memberPrice']
|
||||
function sendMessage(operate_type: msgType, message: any) {
|
||||
const msg = { ...message, operate_type: operate_type, table_code: table_code.value }
|
||||
if (operate_type == 'edit') {
|
||||
|
|
@ -349,9 +474,16 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
delete msg[delArr[i]]
|
||||
}
|
||||
}
|
||||
console.log('send msg', msg)
|
||||
WebSocketManager.sendMessage(msg);
|
||||
}
|
||||
return {
|
||||
dataReset,
|
||||
useVipPrice,
|
||||
changeUser,
|
||||
packNum, packFee,
|
||||
isOldOrder,
|
||||
oldOrder,
|
||||
isCanSelectGroup,
|
||||
goods,
|
||||
selGoods,
|
||||
|
|
|
|||
|
|
@ -31,9 +31,10 @@ service.interceptors.request.use(
|
|||
// 响应拦截器
|
||||
service.interceptors.response.use(
|
||||
(response: AxiosResponse) => {
|
||||
|
||||
// 如果响应是二进制流,则直接返回,用于下载文件、Excel 导出等
|
||||
if (response.config.responseType === "blob") {
|
||||
return response;
|
||||
return response.data;
|
||||
}
|
||||
|
||||
const { code, data, msg } = response.data;
|
||||
|
|
|
|||
|
|
@ -120,7 +120,15 @@ class WebSocketManager {
|
|||
...this.initParams,
|
||||
...message,
|
||||
})
|
||||
this.client.send(msg);
|
||||
try {
|
||||
this.client.send(msg);
|
||||
|
||||
} catch (error) {
|
||||
ElMessage.error('发送失败')
|
||||
this.disconnect()
|
||||
this.setupWebSocket();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
public canSendMessage() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,478 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-drawer title="订单详情" size="60%" v-model="drawer" direction="rtl" v-loading="loading">
|
||||
<div class="header">
|
||||
<div class="title" style="text-align: center">【收银订单】</div>
|
||||
<div class="container">
|
||||
<div class="info_content">
|
||||
<div class="item">
|
||||
<div class="label">会员信息</div>
|
||||
<div class="row">
|
||||
<div>会员昵称:-</div>
|
||||
<div>联系电话:-</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table">
|
||||
<div class="item">
|
||||
<div class="t">订单状态</div>
|
||||
<div class="b">
|
||||
<el-tag :type="detail.status == 'closed' ? 'success' : 'warning'">
|
||||
{{ statusFilter(detail.status) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="t">订单金额</div>
|
||||
<div class="b">¥{{ detail.orderAmount }}</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="t">订单类型</div>
|
||||
<div class="b">
|
||||
{{ sendTypeFilter(detail.sendType) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table">
|
||||
<div class="item">
|
||||
<div class="t">订单编号</div>
|
||||
<div class="b">
|
||||
{{ detail.orderNo }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="t">下单时间</div>
|
||||
<div class="b">{{ timeFilter(detail.createdAt) }}</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="t">支付时间</div>
|
||||
<div class="b">
|
||||
{{ timeFilter(detail.createdAt) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<!-- <el-tabs v-model="type" @tab-click="getTableData"> -->
|
||||
<!-- <el-tab-pane label="基本信息" name="1"> -->
|
||||
<div class="info_content">
|
||||
<!-- <div class="item">
|
||||
<div class="label">会员信息</div>
|
||||
<div class="row">
|
||||
<div>会员昵称:-</div>
|
||||
<div>联系电话:-</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="item">
|
||||
<div class="label">收款详情</div>
|
||||
<!-- <div class="row">
|
||||
<div>商品金额:¥{{ detail.productAmount }}</div>
|
||||
<div>打包费:{{ detail.packFee || "-" }}</div>
|
||||
</div> -->
|
||||
<div class="row">
|
||||
<div>打包费:{{ detail.packFee || "-" }}</div>
|
||||
<div>订单原价:¥{{ detail.originAmount }}</div>
|
||||
<div>优惠金额:¥{{ youHuiJinE }}</div>
|
||||
<div>
|
||||
实收金额:
|
||||
<span style="color: red">¥{{ detail.payAmount }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div>
|
||||
退款金额:¥{{ detail.refundAmount }}
|
||||
<span
|
||||
style="color: #ff9731; cursor: pointer"
|
||||
v-if="detail.isRefund"
|
||||
@click="type = '3'"
|
||||
>
|
||||
退款详情>
|
||||
</span>
|
||||
</div>
|
||||
<div>支付方式:{{ returnPayType(detail.payType) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div style="margin-bottom: 16px; font-size: 16px">商品信息</div>
|
||||
<template v-for="(item, index) in detail.detailMap" :key="index">
|
||||
<el-table :data="item">
|
||||
<el-table-column label="商品">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
<el-image
|
||||
v-if="scope.row.productSkuId != '-999'"
|
||||
:src="scope.row.productImg"
|
||||
style="width: 40px; height: 40px"
|
||||
></el-image>
|
||||
<div class="packeFee" v-else>
|
||||
<span>
|
||||
{{ scope.row.productName || "客座费" }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="info">
|
||||
<span :class="[scope.row.isVip == 1 ? 'colorStyle' : '']">
|
||||
{{ scope.row.productName }}
|
||||
</span>
|
||||
<span style="color: #999">{{ scope.row.productSkuName }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量">
|
||||
<template v-slot="scope">x{{ scope.row.num }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价">
|
||||
<template v-slot="scope">¥{{ scope.row.price }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="小计">
|
||||
<template v-slot="scope">¥{{ scope.row.payAmount }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<template v-if="detail.status != 'unpaid'">
|
||||
<el-button
|
||||
v-if="canTuikuan(scope.row)"
|
||||
link
|
||||
size="mini"
|
||||
@click="tuikuan(scope.row)"
|
||||
>
|
||||
<span>退款</span>
|
||||
</el-button>
|
||||
<span class="color-999" v-if="isTui(scope.row)">已退款</span>
|
||||
</template>
|
||||
<template v-if="detail.status == 'unpaid'">
|
||||
<el-button
|
||||
v-if="canTuicai(scope.row)"
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="tuiCai(scope.row)"
|
||||
>
|
||||
<span>退菜</span>
|
||||
</el-button>
|
||||
<span class="color-999" v-if="scope.row == 'return'">已退菜</span>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
<return-money
|
||||
:modal="false"
|
||||
ref="refReturnMoney"
|
||||
:max="selGoods.num"
|
||||
:goods="selGoods"
|
||||
@confirm="refReturnMoneyConfirm"
|
||||
></return-money>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import returnMoney from "./return-money.vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { returnOptionsLabel } from "../config/config";
|
||||
import * as $util from "../order_goods_util.js";
|
||||
import orderApi from "@/api/order/order";
|
||||
import orderEnum from "./orderEnum";
|
||||
import dayjs from "dayjs";
|
||||
export default {
|
||||
components: {
|
||||
returnMoney,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
orderEnum,
|
||||
drawer: false,
|
||||
type: "1",
|
||||
detail: "",
|
||||
loading: false,
|
||||
refoundList: [],
|
||||
selGoods: { num: 1 },
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
drawer: function (newval) {
|
||||
if (!newval) {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
vipDiscountAmount() {
|
||||
return 0;
|
||||
},
|
||||
youHuiJinE() {
|
||||
const n = 0;
|
||||
|
||||
return n;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
returnPayType(payType) {
|
||||
if (!payType) {
|
||||
return "";
|
||||
}
|
||||
console.log(payType.replace("_pay", ""));
|
||||
return returnOptionsLabel("payType", payType.replace("_pay", ""));
|
||||
},
|
||||
to2(n) {
|
||||
return Number(n).toFixed(2);
|
||||
},
|
||||
orderTypeFilter(t) {
|
||||
if (t) {
|
||||
return t && orderEnum.orderType.find((item) => item.key == t).label;
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
},
|
||||
sendTypeFilter(t) {
|
||||
if (t) {
|
||||
return orderEnum.sendType.find((item) => item.key == t).label;
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
},
|
||||
statusFilter(t) {
|
||||
return returnOptionsLabel("status", t);
|
||||
},
|
||||
timeFilter(t) {
|
||||
if (t) {
|
||||
return dayjs(t).format("YYYY-MM-DD HH:mm:ss");
|
||||
} else {
|
||||
return "-";
|
||||
}
|
||||
},
|
||||
isShowGoodsVipPrice(item) {
|
||||
return $util.isShowGoodsVipPrice(item);
|
||||
},
|
||||
isUseCalcPrice(item) {
|
||||
return $util.isUseCalcPrice(this.detail, item);
|
||||
},
|
||||
close() {
|
||||
console.log("drawer close");
|
||||
this.$emit("close");
|
||||
},
|
||||
isTui(item) {
|
||||
return $util.isTui(item);
|
||||
},
|
||||
canTuikuan(item) {
|
||||
return $util.canTuiKuan(this.detail, item);
|
||||
},
|
||||
canTuicai(item) {
|
||||
return $util.canTuicai(this.detail, item);
|
||||
},
|
||||
async refReturnMoneyConfirm(e) {
|
||||
const res = await orderApi.refundOrder({
|
||||
...e,
|
||||
orderId: this.detail.id,
|
||||
});
|
||||
ElMessage.success("退款成功");
|
||||
this.update();
|
||||
},
|
||||
update() {
|
||||
this.tbOrderInfoDetail(this.detail.id);
|
||||
},
|
||||
async refReturnCartConfirm(e) {
|
||||
const res = await $returnCart({
|
||||
...e,
|
||||
cartId: this.selGoods.cartId,
|
||||
tableId: this.detail.tableId,
|
||||
});
|
||||
ElMessage.success("退菜成功");
|
||||
this.update();
|
||||
},
|
||||
tuikuan(item) {
|
||||
this.selGoods = item;
|
||||
console.log(item);
|
||||
this.$refs.refReturnMoney.open({ ...item, priceAmount: item.canReturnAmount });
|
||||
},
|
||||
tuiCai(item) {
|
||||
this.selGoods = item;
|
||||
console.log(item);
|
||||
this.$refs.refReturnCart.open(item);
|
||||
},
|
||||
// 切换类型
|
||||
getTableData() {
|
||||
if (this.type == "3") {
|
||||
this.tbOrderInfoData();
|
||||
}
|
||||
},
|
||||
// 获取退单列表
|
||||
async tbOrderInfoData() {
|
||||
try {
|
||||
const res = await tbOrderInfoData({
|
||||
source: this.detail.id,
|
||||
page: 0,
|
||||
pageSize: 500,
|
||||
orderType: "0",
|
||||
});
|
||||
this.refoundList = res.content;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 获取订单详情
|
||||
async tbOrderInfoDetail(id) {
|
||||
try {
|
||||
this.loading = true;
|
||||
const res = await orderApi.getHistoryList({ orderId: id });
|
||||
this.detail = res;
|
||||
this.loading = false;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
show(obj) {
|
||||
this.drawer = true;
|
||||
this.type = "1";
|
||||
this.detail = "";
|
||||
this.tbOrderInfoDetail(obj.id);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.packeFee {
|
||||
width: 40px;
|
||||
box-sizing: border-box;
|
||||
height: 40px;
|
||||
background: #3f9eff;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.shop_info {
|
||||
display: flex;
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
padding: 0 20px 0;
|
||||
|
||||
.title {
|
||||
font-size: 20px;
|
||||
color: #ff9731;
|
||||
}
|
||||
|
||||
.table {
|
||||
display: flex;
|
||||
padding: 20px 0;
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
|
||||
.b {
|
||||
padding-top: 20px;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.line-th {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.container {
|
||||
padding: 0 20px;
|
||||
font-size: 14px;
|
||||
|
||||
.info_content {
|
||||
padding: 20px 0;
|
||||
|
||||
.item {
|
||||
border-bottom: 1px dashed #ececec;
|
||||
padding-bottom: 20px;
|
||||
|
||||
&:not(:first-child) {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.label {
|
||||
position: relative;
|
||||
padding-left: 20px;
|
||||
color: #333;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
width: 4px;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background-color: #1890ff;
|
||||
}
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
color: #555;
|
||||
padding-top: 20px;
|
||||
|
||||
div {
|
||||
width: 25%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.refund_wrap {
|
||||
.row {
|
||||
border-bottom: 1px dashed #ececec;
|
||||
padding-bottom: 20px;
|
||||
|
||||
&:not(:first-child) {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.time {
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.list {
|
||||
.list_row {
|
||||
display: flex;
|
||||
padding-top: 10px;
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
color: #555;
|
||||
|
||||
.name {
|
||||
margin-left: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.foot {
|
||||
color: #333;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.colorStyle {
|
||||
color: #ffc315;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -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: '退单'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,212 @@
|
|||
<template>
|
||||
<el-dialog title="退款" width="410px" v-model="show" @close="reset" :modal="modal">
|
||||
<div class="u-flex font-bold color-333">
|
||||
{{ goods.productName }}
|
||||
</div>
|
||||
<div class="u-flex color-999 u-m-t-4">
|
||||
{{ goods.productSkuName || "" }}
|
||||
</div>
|
||||
|
||||
<div class="u-p-b-16 border-bottom">
|
||||
<div class="flex u-row-between">
|
||||
<span>退款数量</span>
|
||||
<div class="u-flex">
|
||||
<el-input-number v-model="number" :min="min" :max="max"></el-input-number>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-font-12 color-999 u-m-t-8" v-if="isSeatFee">
|
||||
<div>
|
||||
<span class="color-red">*</span>
|
||||
<span>客座费只能全退</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-m-t-12 u-font-12 color-999">菜品已点数量 {{ max }} 份</div>
|
||||
<div class="u-flex u-m-t-12">
|
||||
<span>支付金额</span>
|
||||
<span class="">¥{{ goods.payAmount }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-t-12">
|
||||
<span>退款金额</span>
|
||||
<span class="color-red font-bold">¥{{ tuikuanJine }}</span>
|
||||
</div>
|
||||
<div class="u-p-b-16 border-bottom">
|
||||
<div class="flex">
|
||||
<span class="u-m-r-12">是否现金</span>
|
||||
<el-switch v-model="cash"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-m-t-26">
|
||||
<div>
|
||||
<span>退款原因</span>
|
||||
<span class="color-red">*</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="u-flex u-flex-wrap tags">
|
||||
<div
|
||||
class="tag"
|
||||
v-for="(tag, index) in tags"
|
||||
@click="changeSel(tag)"
|
||||
:key="index"
|
||||
:class="{ active: tag.checked }"
|
||||
>
|
||||
{{ tag.label }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-m-t-20">
|
||||
<el-input v-model="note" size="medium" placeholder="请输入自定义备注"></el-input>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div>
|
||||
<el-button size="medium" @click="close">取消</el-button>
|
||||
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
modal: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
max: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cash: false,
|
||||
isFloat: false,
|
||||
min: 0,
|
||||
number: 1,
|
||||
isPrint: false,
|
||||
tagSel: -1,
|
||||
show: false,
|
||||
tags: [
|
||||
{ label: "不想要了", checked: false },
|
||||
{ label: "食材不足", checked: false },
|
||||
{ label: "等待时间过长", checked: false },
|
||||
],
|
||||
note: "",
|
||||
goods: {
|
||||
productId: -999,
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
tuikuanJine() {
|
||||
const danjia = this.goods.price;
|
||||
return (danjia * this.number).toFixed(2);
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
to2(val) {
|
||||
return val.toFixed(2);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
changeSel(item) {
|
||||
item.checked = !item.checked;
|
||||
},
|
||||
reset() {
|
||||
this.note = "";
|
||||
this.number = 1;
|
||||
this.isFloat = false;
|
||||
},
|
||||
delTag(index) {
|
||||
this.tags.splice(index, 1);
|
||||
},
|
||||
addNote(tag) {
|
||||
if (this.note.length <= 0) {
|
||||
return (this.note = tag);
|
||||
}
|
||||
this.note = tag + "," + this.note;
|
||||
},
|
||||
open(item) {
|
||||
this.goods = item ? item : this.goods;
|
||||
console.log(item);
|
||||
if (item && item.isWeight) {
|
||||
//称重商品
|
||||
this.isFloat = true;
|
||||
this.number = item.num;
|
||||
}
|
||||
if (item && !item.isWeight) {
|
||||
if (item.productId != "-999") {
|
||||
this.number = 1;
|
||||
} else {
|
||||
this.number = item.num;
|
||||
}
|
||||
}
|
||||
|
||||
this.show = true;
|
||||
},
|
||||
close() {
|
||||
this.show = false;
|
||||
this.number = 1;
|
||||
},
|
||||
confirm() {
|
||||
const selTag = this.tags
|
||||
.filter((item) => item.checked)
|
||||
.map((item) => item.label)
|
||||
.join(",");
|
||||
const note = selTag + (this.note.length > 0 ? "," + this.note : "");
|
||||
console.log(note);
|
||||
if (!note) {
|
||||
return ElMessage.error("请输入退款原因");
|
||||
}
|
||||
this.$emit("confirm", {
|
||||
refundAmount: (this.goods.price * this.number).toFixed(2) * 1,
|
||||
cash: this.cash,
|
||||
refundReason: note,
|
||||
refundDetails: [
|
||||
{ id: this.goods.id, num: this.number, returnAmount: this.tuikuanJine * 1 },
|
||||
],
|
||||
});
|
||||
this.close();
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-tag {
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 5px;
|
||||
cursor: pointer;
|
||||
font-size: 15px;
|
||||
line-height: 35px;
|
||||
height: 35px;
|
||||
}
|
||||
.tags {
|
||||
.tag {
|
||||
margin: 10px 10px 0 0;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
padding: 10px 13px;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
cursor: pointer;
|
||||
&.active {
|
||||
color: #1890ff;
|
||||
background: #e8f4ff;
|
||||
border-color: #a3d3ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
::v-deep .number-box .el-input__inner::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
::v-deep .number-box .el-input__inner::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
</template>
|
||||
<template #operate="scope">
|
||||
<div>
|
||||
<el-button link>详情</el-button>
|
||||
<el-button @click="showdetail(scope.row)" link>详情</el-button>
|
||||
<el-button link v-if="scope.row.status == 'done'">开票</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.status == 'unpaid'"
|
||||
|
|
@ -101,11 +101,14 @@
|
|||
<!-- <Dict v-model="scope.formData[scope.prop]" code="gender" v-bind="scope.attrs" /> -->
|
||||
</template>
|
||||
</page-modal>
|
||||
|
||||
<orderDetail ref="refDetail"></orderDetail>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import orderApi, { type getListResponse } from "@/api/order/order";
|
||||
import orderDetail from "./components/detail.vue";
|
||||
import orderApi, { type getListResponse, OrderInfoVo } from "@/api/order/order";
|
||||
import type { IObject, IOperatData } from "@/components/CURD/types";
|
||||
import usePage from "@/components/CURD/usePage";
|
||||
import addModalConfig from "./config/add";
|
||||
|
|
@ -189,6 +192,11 @@ function toPayOrder(order: getListResponse) {
|
|||
},
|
||||
});
|
||||
}
|
||||
//详情
|
||||
const refDetail = ref();
|
||||
function showdetail(row: OrderInfoVo) {
|
||||
refDetail.value.show(row);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
export function canComputedPackFee(v) {
|
||||
return v.pack && v.status != "return" && v.status != "refund" && v.status != "refunding";
|
||||
}
|
||||
export function returnCanComputedGoodsArr(arr) {
|
||||
return arr.filter((v) => canComputedPackFee(v));
|
||||
}
|
||||
export function returnPackFee(arr) {
|
||||
return arr
|
||||
.reduce((prve, cur) => {
|
||||
return prve + cur.packAmount;
|
||||
}, 0)
|
||||
.toFixed(2);
|
||||
}
|
||||
|
||||
export function canTuicai(orderInfo, item) {
|
||||
return true;
|
||||
}
|
||||
export function canTuiKuan(orderInfo, item) {
|
||||
return orderInfo.status == "done" || orderInfo.status == "part-refund";
|
||||
}
|
||||
export function isTui(item) {
|
||||
return item.status == "return" || item.status == "refund" || item.status == "refunding";
|
||||
}
|
||||
export function numSum(arr) {
|
||||
const sum = arr.reduce((a, b) => {
|
||||
return a + b * 100;
|
||||
}, 0);
|
||||
return (sum / 100).toFixed(2);
|
||||
}
|
||||
//是否使用计算的会员价
|
||||
export function isUseCalcPrice(order, item) {
|
||||
console.log(order);
|
||||
if (order.fullCouponDiscountAmount > 0 || order.pointsDiscountAmount > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//商品列表是否展示会员价
|
||||
export function isShowGoodsVipPrice(item) {
|
||||
return item.isMember == 1 && item.memberPrice && item.memberPrice != item.price;
|
||||
}
|
||||
|
|
@ -0,0 +1,236 @@
|
|||
<template>
|
||||
<div class="flex order-item u-m-b-14 relative">
|
||||
<div class="flex u-col-center">
|
||||
<div class="img">
|
||||
<div class="isSeatFee img u-line-1 u-flex u-col-center u-row-center">
|
||||
<span>{{ name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 10px"></div>
|
||||
<div class="flex">
|
||||
<div class="order-number-box u-font-12">
|
||||
<div class="">X{{ number }}</div>
|
||||
</div>
|
||||
|
||||
<div class="color-333 total-price">
|
||||
<div>¥{{ to2(price) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
name: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
number: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
price: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
function to2(n) {
|
||||
return n.toFixed(2);
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.isSeatFee {
|
||||
background: #3f9eff;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.flex.order-item {
|
||||
padding: 4px;
|
||||
border-radius: 2px;
|
||||
display: flex;
|
||||
overflow: visible;
|
||||
cursor: pointer;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
transition: all 0.3s;
|
||||
|
||||
.status-box {
|
||||
width: 18px;
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
|
||||
> span {
|
||||
display: block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 4px 0 4px 0;
|
||||
font-size: 12px;
|
||||
line-height: 17px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.isWaitCall {
|
||||
background: #d3adf7;
|
||||
}
|
||||
|
||||
.pack {
|
||||
background: #35ac6a;
|
||||
.number {
|
||||
background: #f56c6c;
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
left: -7px;
|
||||
top: -7px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
text-align: center;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.da {
|
||||
background: #35ac6a;
|
||||
}
|
||||
|
||||
.tui {
|
||||
background: #ac4735;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background-color: rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.total-price {
|
||||
width: 94px;
|
||||
font-size: 16px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.good-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
min-width: 70px;
|
||||
|
||||
.specSnap {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.specSnapss {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
margin-top: 3px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
|
||||
.specSnap {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 13px;
|
||||
text-align: left;
|
||||
color: #212121;
|
||||
overflow: hidden;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 59px;
|
||||
height: 59px;
|
||||
position: relative;
|
||||
margin-right: 10px;
|
||||
|
||||
img {
|
||||
width: 59px;
|
||||
height: 59px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.note {
|
||||
max-width: 70%;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
text-align: left;
|
||||
color: #999;
|
||||
margin-top: 5px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.order-number-box {
|
||||
position: relative;
|
||||
|
||||
.absolute {
|
||||
width: 60px;
|
||||
height: 40px;
|
||||
right: -38px;
|
||||
top: -14px;
|
||||
position: absolute;
|
||||
|
||||
.order-input-number {
|
||||
position: absolute;
|
||||
right: -6px;
|
||||
top: 0;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
display: none;
|
||||
background-color: #fff;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
|
||||
padding: 9px 6px;
|
||||
background-color: #fff;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
&:hover .order-input-number {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.good_info_discount {
|
||||
height: 16px;
|
||||
padding: 0 3px;
|
||||
color: #ff3f3f;
|
||||
background-color: rgba(255, 63, 63, 0.1);
|
||||
border-radius: 2px;
|
||||
margin-left: 6px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
::v-deep .order-input-number .el-input__inner::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
::v-deep .order-input-number .el-input__inner::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -112,6 +112,10 @@
|
|||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
useVipPrice: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isShowVipPrice: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
|
@ -179,7 +183,14 @@ const vipAllPrice = computed(() => {
|
|||
return 0;
|
||||
});
|
||||
const allPrice = computed(() => {
|
||||
if (props.item.discount_sale_amount * 1 != 0) {
|
||||
if (props.useVipPrice) {
|
||||
const memberPrice = props.item.memberPrice || props.item.salePrice;
|
||||
return memberPrice * props.item.number;
|
||||
}
|
||||
if (
|
||||
props.item.hasOwnProperty("discount_sale_amount") &&
|
||||
props.item.discount_sale_amount * 1 != 0
|
||||
) {
|
||||
return props.item.number * props.item.discount_sale_amount;
|
||||
}
|
||||
return props.item.number * props.item.salePrice;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,30 @@
|
|||
<template>
|
||||
<div class="list">
|
||||
<div class="carts">
|
||||
<!-- 当前购物车 -->
|
||||
<div v-for="(item, index) in carts.list" :key="index">
|
||||
<carts-item
|
||||
:item="item"
|
||||
@changeNumber="changeNumber"
|
||||
:selCart="carts.selCart"
|
||||
@itemClick="itemClick(item)"
|
||||
@editNote="editNote"
|
||||
></carts-item>
|
||||
</div>
|
||||
<template v-if="carts.list && carts.list.length >= 1">
|
||||
<!-- 当前购物车 -->
|
||||
<div v-for="(item, index) in carts.list" :key="index">
|
||||
<carts-item
|
||||
:item="item"
|
||||
:useVipPrice="carts.useVipPrice"
|
||||
@changeNumber="changeNumber"
|
||||
:selCart="carts.selCart"
|
||||
@itemClick="itemClick(item)"
|
||||
@editNote="editNote"
|
||||
></carts-item>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 打包费 -->
|
||||
<template v-if="carts.packNum > 0">
|
||||
<div class="cart-title"><span>打包费</span></div>
|
||||
<extra-fee name="打包费" :number="carts.packNum" :price="carts.packFee"></extra-fee>
|
||||
</template>
|
||||
<!-- 餐位费 -->
|
||||
<template v-if="perpole >= 1">
|
||||
<div class="cart-title"><span>餐位费</span></div>
|
||||
<extra-fee name="餐位费" :number="perpole" :price="canWeiFee"></extra-fee>
|
||||
</template>
|
||||
|
||||
<!-- 赠菜 -->
|
||||
<div class="cart-title" v-if="carts.giftList.length > 0"><span>以下是优惠菜品</span></div>
|
||||
<div v-for="(item, index) in carts.giftList" :key="index">
|
||||
|
|
@ -22,8 +36,28 @@
|
|||
@editNote="editNote"
|
||||
></carts-item>
|
||||
</div>
|
||||
<el-empty :image-size="60" v-if="carts.isEmpty" description="点餐列表为空" />
|
||||
|
||||
<el-empty image-size="60" v-if="carts.isEmpty" description="点餐列表为空" />
|
||||
<!-- 历史订单 -->
|
||||
<template v-for="(item, index) in carts.oldOrder.detailMap" :key="index">
|
||||
<div class="cart-title">
|
||||
<span>第{{ index }}次下单</span>
|
||||
</div>
|
||||
|
||||
<div v-for="(detaiItem, index) in item" :key="index">
|
||||
<carts-item
|
||||
:canChangeNumber="false"
|
||||
isOld
|
||||
:item="detaiItem"
|
||||
@changeNumber="changeNumber"
|
||||
:selCart="carts.selCart"
|
||||
@itemClick="itemClick(detaiItem)"
|
||||
@editNote="editNote"
|
||||
></carts-item>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- <div class="color-666 u-font-14">订单备注:{{ "123" }}</div> -->
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="yiyouhui">{{ carts.yiyouhui }}</div>
|
||||
|
|
@ -31,17 +65,25 @@
|
|||
<el-link type="primary">打印制作单</el-link>
|
||||
<div>
|
||||
<span class="totalNumber">共{{ carts.totalNumber }}件</span>
|
||||
<span class="totalPrice">¥{{ carts.payMoney }}</span>
|
||||
<span class="totalPrice">¥{{ totalMoney }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" v-if="isXianFuKuan">
|
||||
<el-button type="primary" size="large" @click="createOrder">微信/支付宝</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder">现金</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder">更多支付</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder()">微信/支付宝</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder()">现金</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder()">更多支付</el-button>
|
||||
</div>
|
||||
<div class="btn-group" v-else>
|
||||
<el-button type="primary" size="large" @click="createOrder">仅下单</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder">去结账</el-button>
|
||||
<template v-if="!showOrder">
|
||||
<el-button type="primary" size="large" @click="createOrder('only-create')">
|
||||
仅下单
|
||||
</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder('to-pay')">去结账</el-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button type="default" size="large" @click="hideOrder()">加菜/返回</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder('to-pay')">立即支付</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -49,11 +91,39 @@
|
|||
|
||||
<script setup>
|
||||
import cartsItem from "./item.vue";
|
||||
import { useCartsStore } from "@/store/modules/carts";
|
||||
import extraFee from "./extra-fee.vue";
|
||||
|
||||
let isXianFuKuan = ref(true);
|
||||
import { useCartsStore } from "@/store/modules/carts";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
|
||||
const shopUser = useUserStore();
|
||||
const carts = useCartsStore();
|
||||
|
||||
const props = defineProps({
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
tableCode: "",
|
||||
};
|
||||
},
|
||||
},
|
||||
perpole: {
|
||||
type: [Number, String],
|
||||
default: 0,
|
||||
},
|
||||
showOrder: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
oldOrder: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
detailMap: [],
|
||||
};
|
||||
},
|
||||
},
|
||||
goodsList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
|
|
@ -63,36 +133,58 @@ const props = defineProps({
|
|||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(["editNote", "createOrder"]);
|
||||
let isXianFuKuan = computed(() => {
|
||||
if (!props.table.tableCode) {
|
||||
return true;
|
||||
}
|
||||
return shopUser.userInfo.registerType === "before" ? true : false;
|
||||
});
|
||||
const canWeiFee = computed(() => {
|
||||
if (shopUser.userInfo.isTableFee) {
|
||||
return 0;
|
||||
}
|
||||
if (props.perpole >= 1) {
|
||||
return props.perpole * shopUser.userInfo.tableFee;
|
||||
}
|
||||
});
|
||||
const emits = defineEmits(["editNote", "createOrder", "hideOrder"]);
|
||||
function editNote() {
|
||||
emits("editNote");
|
||||
}
|
||||
|
||||
function createOrder() {
|
||||
emits("createOrder");
|
||||
function hideOrder() {
|
||||
emits("hideOrder");
|
||||
}
|
||||
function createOrder(key) {
|
||||
emits("createOrder", key);
|
||||
}
|
||||
const selCartId = ref(null);
|
||||
|
||||
const carts = useCartsStore();
|
||||
watch(
|
||||
() => props.table.tableCode,
|
||||
(newval) => {
|
||||
init();
|
||||
}
|
||||
);
|
||||
|
||||
const goodsMap = {};
|
||||
watch(
|
||||
() => props.goodsMapisFinish,
|
||||
(newval) => {
|
||||
if (newval) {
|
||||
for (let goods of props.goodsList) {
|
||||
goodsMap[goods.id] = goods;
|
||||
}
|
||||
carts.init(
|
||||
{
|
||||
table_code: "",
|
||||
},
|
||||
goodsMap
|
||||
);
|
||||
init();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function init() {
|
||||
for (let goods of props.goodsList) {
|
||||
goodsMap[goods.id] = goods;
|
||||
}
|
||||
console.log(props.table);
|
||||
|
||||
carts.init({ table_code: props.table.tableCode }, goodsMap, props.oldOrder);
|
||||
}
|
||||
|
||||
function itemClick(item) {
|
||||
carts.changeSelCart(item);
|
||||
}
|
||||
|
|
@ -100,8 +192,15 @@ function itemClick(item) {
|
|||
function changeNumber(step, item) {
|
||||
carts.changeNumber(step * 1, item);
|
||||
}
|
||||
const totalMoney = computed(() => {
|
||||
console.log(carts.payMoney);
|
||||
console.log(carts.oldOrder.originAmount);
|
||||
|
||||
return (carts.payMoney * 1 + (carts.oldOrder.originAmount || 0) * 1).toFixed(2);
|
||||
});
|
||||
defineExpose({
|
||||
carts,
|
||||
init,
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ const carts = useCartsStore();
|
|||
const controls = ref([
|
||||
{ label: "规格", key: "", disabled: false, per: "sku" },
|
||||
{ label: "赠送", key: "is_gift", disabled: false, per: "cart" },
|
||||
{ label: "打包", key: "is_pack", disabled: false, per: "cart" },
|
||||
{ label: "打包", key: "is_pack", disabled: false, per: "pack" },
|
||||
{ label: "删除", key: "del", disabled: false, per: "del" },
|
||||
{ label: "存单", key: "", disabled: false, per: "save" },
|
||||
{ label: "取单", key: "", disabled: false },
|
||||
{ label: "单品备注", key: "one-note", disabled: false, per: "one-note" },
|
||||
{ label: "整单备注", key: "all-note", disabled: false, per: "all-note" },
|
||||
{ label: "退菜", key: "", disabled: false, per: "order" },
|
||||
{ label: "退菜", key: "return", disabled: false, per: "return" },
|
||||
{ label: "免厨打", key: "is_print", disabled: false, per: "cart" },
|
||||
{ label: "单品改价", key: "changePriceClick", disabled: false, per: "cart" },
|
||||
{ label: "等叫", key: "is_wait_call", disabled: false, per: "cart" },
|
||||
|
|
@ -49,6 +49,10 @@ function controlsClick(item) {
|
|||
carts.updateTag("is_gift", carts.selCart.is_gift ? 0 : 1);
|
||||
break;
|
||||
case "is_pack":
|
||||
if (carts.selCart.number * 1 == 1) {
|
||||
carts.updateTag("pack_number", carts.selCart.pack_number * 1 == 1 ? 0 : 1);
|
||||
return;
|
||||
}
|
||||
emits("packClick", carts.selCart.pack_number, carts.selCart.number);
|
||||
break;
|
||||
case "is_print":
|
||||
|
|
@ -71,6 +75,8 @@ function controlsClick(item) {
|
|||
break;
|
||||
case "all-wating":
|
||||
carts.allWating();
|
||||
case "return":
|
||||
emits("return", carts.selCart);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -79,10 +85,13 @@ const perList = computed(() => {
|
|||
return ["all-wating", "all-note"];
|
||||
}
|
||||
if (carts.isCanSelectGroup) {
|
||||
return ["all-wating", "all-note", "del"];
|
||||
return ["all-wating", "all-note", "del", "pack"];
|
||||
}
|
||||
if (carts.selCart.id) {
|
||||
return ["cart", "del", "save", "one-note", "all-note", "all-wating"];
|
||||
if (carts.isOldOrder) {
|
||||
return ["return"];
|
||||
}
|
||||
return ["cart", "del", "pack", "save", "one-note", "all-note", "all-wating"];
|
||||
}
|
||||
});
|
||||
const canEdit = computed(() => {
|
||||
|
|
@ -97,7 +106,7 @@ function returnLabel(item) {
|
|||
return carts.selCart.is_gift ? "取消赠送" : "赠送";
|
||||
}
|
||||
if (item.key == "is_pack") {
|
||||
return carts.selCart.is_pack ? "取消打包" : "打包";
|
||||
return carts.selCart.pack_number * 1 > 0 ? "取消打包" : "打包";
|
||||
}
|
||||
if (item.key == "is_print") {
|
||||
return carts.selCart.is_print ? "免厨打" : "打印";
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@
|
|||
</el-input>
|
||||
</el-form-item>
|
||||
<div class="u-flex u-row-center u-m-t-50">
|
||||
<el-button size="medium" @click="close">取消</el-button>
|
||||
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="confirm">确定</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
|
@ -137,10 +137,7 @@ export default {
|
|||
|
||||
confirm() {
|
||||
console.log(this.form.discount / 100);
|
||||
this.$emit("confirm", {
|
||||
discount: this.form.discount / 100,
|
||||
currentPrice: ((this.form.discount * this.form.money) / 100).toFixed(2),
|
||||
});
|
||||
this.$emit("confirm", this.form);
|
||||
this.close();
|
||||
},
|
||||
open(data) {
|
||||
|
|
|
|||
|
|
@ -2,16 +2,28 @@
|
|||
<div class="order-box">
|
||||
<div class="left">
|
||||
<div class="user bg-fff u-p-20">
|
||||
<div class="userinfo">
|
||||
<div class="userinfo" v-if="user.id" @click="chooseUser">
|
||||
<el-avatar class="avatar" :size="50" />
|
||||
<div class="u-m-l-12">
|
||||
<p>
|
||||
<span class="name u-font-16">hh</span>
|
||||
<span class="vip">VIP1</span>
|
||||
<span class="name u-font-16">{{ user.nickName }}</span>
|
||||
<span class="vip" v-if="user.isVip">>VIP{{ user.isVip }}</span>
|
||||
</p>
|
||||
<p class="u-font-14 color-666 u-m-t-10">
|
||||
<span class="money">余额:4.00</span>
|
||||
<span class="score u-m-l-10">积分:0</span>
|
||||
<span class="money">余额:{{ user.amount }}</span>
|
||||
<span class="score u-m-l-10">积分:{{ user.accountPoints }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="userinfo" v-else @click="chooseUser">
|
||||
<el-avatar class="avatar" :size="50" />
|
||||
<div class="u-m-l-12">
|
||||
<p>
|
||||
<span class="name u-font-16">服务员下单</span>
|
||||
</p>
|
||||
<p class="u-font-14 color-666 u-m-t-10">
|
||||
<span class="money">余额:</span>
|
||||
<span class="score u-m-l-10">积分:</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -32,7 +44,7 @@
|
|||
<span>积分不足或小于最低使用门槛1</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="u-flex u-col-center u-m-t-20">
|
||||
<div class="u-flex u-col-center u-m-t-20 no-wrap">
|
||||
<span class="u-font-14 font-bold u-m-r-20">团购代金券</span>
|
||||
<div class="u-flex my-select">
|
||||
<span class="u-m-r-10">代金券名称</span>
|
||||
|
|
@ -40,7 +52,7 @@
|
|||
</div>
|
||||
<svg-icon iconClass="scan" size="30" class="u-m-l-10 cur-pointer"></svg-icon>
|
||||
</div>
|
||||
<div class="u-flex u-col-center u-m-t-20">
|
||||
<div class="u-flex u-col-center u-m-t-20 no-wrap">
|
||||
<span class="u-font-14 font-bold u-m-r-20">优惠券</span>
|
||||
<div class="u-flex my-select">
|
||||
<span class="u-m-r-10">选择优惠券</span>
|
||||
|
|
@ -56,17 +68,17 @@
|
|||
<p class="u-font-16 font-bold u-m-r-20 font-bold">选择支付方式</p>
|
||||
<div class="u-m-t-20">
|
||||
<el-button
|
||||
v-for="(item, index) in payType.list"
|
||||
v-for="(item, index) in payTypes.list"
|
||||
:key="index"
|
||||
size="large"
|
||||
:type="index == payType.sel ? 'primary' : ''"
|
||||
:type="index == payTypes.sel ? 'primary' : ''"
|
||||
@click="changePayType(index)"
|
||||
>
|
||||
{{ item.label }}
|
||||
{{ item.payName }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="u-m-t-20">
|
||||
<el-button type="primary" size="large">立即支付</el-button>
|
||||
<el-button type="primary" size="large" @click="nowPayClick">立即支付</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -75,30 +87,30 @@
|
|||
<div class="order-info">
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">订单号:</span>
|
||||
<span class="u-m-l-10 value">202111111111111111</span>
|
||||
<span class="u-m-l-10 value">{{ orderInfo.orderNo }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">门店优惠</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
<span class="title">餐位费</span>
|
||||
<span class="u-m-l-10 value">{{ orderInfo.seatAmount }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">优惠券</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">积分抵扣</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">整单改价</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">餐位费/附加费</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
<span class="title">打包费</span>
|
||||
<span class="u-m-l-10 value">{{ orderInfo.packFee }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">总价</span>
|
||||
<span class="u-m-l-10 value">{{ orderInfo.orderAmount }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">优惠券</span>
|
||||
<span class="u-m-l-10 value">{{ coupDiscount }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">积分抵扣</span>
|
||||
<span class="u-m-l-10 value">{{ orderInfo.pointsDiscountAmount || 0 }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">整单改价</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
|
|
@ -107,33 +119,151 @@
|
|||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">应付金额</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
<span class="u-m-l-10 value">{{ payMoney }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 扫码 -->
|
||||
<scanPay ref="refScanPay" :order="orderInfo"></scanPay>
|
||||
<!-- 打折 -->
|
||||
<discount ref="refDiscount" @confirm="discountConfirm"></discount>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import payTypeApi from "@/api/account/payType";
|
||||
import payApi from "@/api/order/pay";
|
||||
import scanPay from "./scan-pay.vue";
|
||||
import discount from "./discount.vue";
|
||||
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
|
||||
//打折
|
||||
const refDiscount = ref();
|
||||
const checkOrderPay = reactive({
|
||||
discountAmount: 0, //手动优惠金额
|
||||
});
|
||||
function discountConfirm(e) {
|
||||
console.log(e);
|
||||
checkOrderPay.discountAmount = e.reduceMoney;
|
||||
}
|
||||
function discountShow(e) {
|
||||
refDiscount.value.open({
|
||||
amount: props.orderInfo.originAmount,
|
||||
});
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
user: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
orderInfo: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(["chooseUser", "paysuccess"]);
|
||||
function chooseUser() {
|
||||
emits("chooseUser");
|
||||
}
|
||||
const coupDiscount = computed(() => {
|
||||
const total =
|
||||
props.orderInfo.fullCouponDiscountAmount * 1 + props.orderInfo.productCouponDiscountAmount * 1;
|
||||
if (total <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return total.toFixed(2);
|
||||
});
|
||||
const score = ref({
|
||||
list: [],
|
||||
sel: 0,
|
||||
});
|
||||
const emits = defineEmits(["discountShow"]);
|
||||
function discountShow() {
|
||||
emits("discountShow");
|
||||
}
|
||||
const payType = reactive({
|
||||
list: [
|
||||
{ label: "现金", value: "" },
|
||||
{ label: "扫码支付", value: "" },
|
||||
{ label: "会员支付", value: "" },
|
||||
],
|
||||
|
||||
const payTypes = reactive({
|
||||
list: [],
|
||||
sel: 0,
|
||||
});
|
||||
|
||||
const refScanPay = ref();
|
||||
function changePayType(i) {
|
||||
payType.sel = i;
|
||||
if (payTypes.list[i].payType === "scanCode") {
|
||||
return refScanPay.value.open({
|
||||
money: props.orderInfo.orderAmount,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
checkOrderPay: {
|
||||
orderId: props.orderInfo.id,
|
||||
discountRatio: 1,
|
||||
orderAmount: props.orderInfo.orderAmount,
|
||||
seatNum: props.orderInfo.seatNum,
|
||||
originAmount: props.orderInfo.originAmount,
|
||||
discountAmount: props.orderInfo.discountAmount,
|
||||
productCouponDiscountAmount: props.orderInfo.productCouponDiscountAmount,
|
||||
orderAmount: props.orderInfo.orderAmount,
|
||||
roundAmount: props.orderInfo.roundAmount,
|
||||
pointsDiscountAmount: props.orderInfo.pointsDiscountAmount,
|
||||
pointsNum: props.orderInfo.pointsNum,
|
||||
fullCouponDiscountAmount: props.orderInfo.fullCouponDiscountAmount,
|
||||
},
|
||||
});
|
||||
}
|
||||
payTypes.sel = i;
|
||||
}
|
||||
async function getPaytype() {
|
||||
const res = await payTypeApi.getList();
|
||||
payTypes.list = res;
|
||||
}
|
||||
function nowPayClick() {
|
||||
const payType = payTypes.list[payTypes.sel].payType;
|
||||
console.log(payType);
|
||||
if (payType === "cash") {
|
||||
ElMessageBox.confirm("是否确认已现金收款:" + payMoney.value + "元", "快捷支付", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
payApi
|
||||
.cashPay({
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
checkOrderPay: {
|
||||
orderId: props.orderInfo.id,
|
||||
discountRatio: 1,
|
||||
orderAmount: props.orderInfo.orderAmount,
|
||||
seatNum: props.orderInfo.seatNum,
|
||||
originAmount: props.orderInfo.originAmount,
|
||||
discountAmount: props.orderInfo.discountAmount,
|
||||
productCouponDiscountAmount: props.orderInfo.productCouponDiscountAmount,
|
||||
orderAmount: props.orderInfo.orderAmount,
|
||||
roundAmount: props.orderInfo.roundAmount,
|
||||
pointsDiscountAmount: props.orderInfo.pointsDiscountAmount,
|
||||
pointsNum: props.orderInfo.pointsNum,
|
||||
fullCouponDiscountAmount: props.orderInfo.fullCouponDiscountAmount,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
ElMessage.success("支付成功");
|
||||
emits("paysuccess");
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const payMoney = computed(() => {
|
||||
if (!props.orderInfo.orderAmount) {
|
||||
return "";
|
||||
}
|
||||
return (props.orderInfo.orderAmount - checkOrderPay.discountAmount).toFixed(2);
|
||||
});
|
||||
onMounted(() => {
|
||||
getPaytype();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
@ -141,6 +271,7 @@ function changePayType(i) {
|
|||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
.vip {
|
||||
padding: 2px 5px;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
placeholder="请输入打包数量"
|
||||
></el-input-number>
|
||||
<template #footer>
|
||||
<el-button size="medium" @click="close">取消</el-button>
|
||||
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
|
||||
<el-button size="default" @click="close">取消</el-button>
|
||||
<el-button size="default" type="primary" @click="confirm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="">
|
||||
<div>单价</div>
|
||||
<div class="u-m-t-10">
|
||||
<el-tag type="primary" size="medium">¥{{ price }}/{{ item.unitName }}</el-tag>
|
||||
<el-tag type="primary">¥{{ price }}/{{ item.unitName }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -38,9 +38,7 @@
|
|||
<div class="price u-text-left w-full">¥ {{ allPrice }}</div>
|
||||
|
||||
<div class="confirm_btns u-flex u-m-t-20">
|
||||
<el-button style="width: 100%" type="primary" size="medium" @click="confirm">
|
||||
确定
|
||||
</el-button>
|
||||
<el-button style="width: 100%" type="primary" @click="confirm">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,229 @@
|
|||
<template>
|
||||
<el-dialog width="400px" :title="title" v-model="show" @close="reset">
|
||||
<div class="u-p-15">
|
||||
<div v-if="openSwitch">
|
||||
<el-button
|
||||
@click="changeKey('paysSel', index)"
|
||||
v-for="(item, index) in pays"
|
||||
:key="index"
|
||||
:type="paysSel == index ? 'primary' : ''"
|
||||
>
|
||||
{{ item.text }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="u-m-t-20">
|
||||
<el-alert :closable="false" v-if="tips" :title="tips" type="warning" show-icon></el-alert>
|
||||
</div>
|
||||
<div class="u-m-t-20">
|
||||
<template v-if="paysSel == 0">
|
||||
<el-form label-width="90px" label-position="left">
|
||||
<el-form-item label="应付金额">
|
||||
<el-input :value="form.money" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="付款码">
|
||||
<el-input
|
||||
v-model="form.code"
|
||||
@change="codeInputChange"
|
||||
placeholder="请扫码或者输入付款码"
|
||||
ref="refInputCode"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<div class="u-flex u-row-center u-m-t-50">
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="confirm">确定</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="u-text-center">
|
||||
<div class="u-flex u-row-center">
|
||||
<div class="codeImg">
|
||||
<canvas ref="canvas" id="QRCode_header"></canvas>
|
||||
</div>
|
||||
|
||||
<!-- <img :src="codeImg" class="codeImg" alt="" /> -->
|
||||
</div>
|
||||
<div class="color-333 u-font-20 u-m-t-20">{{ to2(price) }}元</div>
|
||||
<div class="color-aaa u-font-12 u-m-t-10">
|
||||
<i class="el-icon-loading"></i>
|
||||
<span>等待用户支付</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import QRCode from "qrcode";
|
||||
import orderApi from "@/api/order/order";
|
||||
import payApi from "@/api/order/pay";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
openSwitch: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
order: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: "支付",
|
||||
},
|
||||
price: {
|
||||
type: [String, Number],
|
||||
default: 0,
|
||||
},
|
||||
defaultTips: {
|
||||
type: String,
|
||||
default: "请使用扫码枪扫描付款码",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tips: "",
|
||||
paymentQrcode: "",
|
||||
paysSel: 0,
|
||||
form: {
|
||||
money: "",
|
||||
code: "",
|
||||
},
|
||||
codeImg:
|
||||
"https://zhyx.eingdong.com/qrcode/api.php?url=https%3A%2F%2Fzhyx.eingdong.com%2Fcopyright%2F%23%2Fpay%3Fid%3D139451580",
|
||||
pays: [
|
||||
{
|
||||
text: "主扫",
|
||||
},
|
||||
{
|
||||
text: "被扫",
|
||||
},
|
||||
],
|
||||
number: "0",
|
||||
show: false,
|
||||
timer: null,
|
||||
payPar: {},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
defaultTips(val) {
|
||||
this.tips = val;
|
||||
},
|
||||
price(val) {
|
||||
console.log(val);
|
||||
this.form.money = Number(val).toFixed(2);
|
||||
},
|
||||
paysSel(newval) {
|
||||
if (newval == 0) {
|
||||
this.clear();
|
||||
this.tips = "请使用扫码枪扫微信/支付宝收款码";
|
||||
this.$refs.refInputCode.focus();
|
||||
} else {
|
||||
this.getPayUrl();
|
||||
this.tips = "请用户使用微信/支付宝扫描付款码";
|
||||
// this.startGetOrderInfo();
|
||||
}
|
||||
},
|
||||
number(newval) {
|
||||
this.$emit("input", newval);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
to2(n) {
|
||||
return n.toFixed(2);
|
||||
},
|
||||
clear() {
|
||||
clearInterval(this.timer);
|
||||
},
|
||||
async getOrderDetail() {
|
||||
const res = await orderApi.getHistoryList({
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
orderId: this.order.id,
|
||||
});
|
||||
if (res.status == "closed") {
|
||||
this.clear();
|
||||
this.$emit("paySuccess");
|
||||
}
|
||||
},
|
||||
startGetOrderInfo() {
|
||||
clearInterval(this.timer);
|
||||
this.getOrderDetail();
|
||||
this.timer = setInterval(() => {
|
||||
this.getOrderDetail();
|
||||
}, 1000);
|
||||
},
|
||||
codeInputChange(e) {
|
||||
console.log(e);
|
||||
// this.$emit("confirm", this.form.code);
|
||||
},
|
||||
reset() {
|
||||
// this.form.money=''
|
||||
this.form.code = "";
|
||||
this.paysSel = 0;
|
||||
this.clear();
|
||||
},
|
||||
changeKey(key, val) {
|
||||
this[key] = val;
|
||||
},
|
||||
|
||||
confirm() {
|
||||
if (!this.form.code) {
|
||||
return this.$message.error("请输入或扫付款码");
|
||||
}
|
||||
this.close();
|
||||
this.$emit("confirm", this.form.code);
|
||||
},
|
||||
async getPayUrl() {
|
||||
const res = await payApi.microPay(this.payPar);
|
||||
console.log(res);
|
||||
this.paymentQrcode = res;
|
||||
this.$nextTick(() => {
|
||||
QRCode.toCanvas(
|
||||
this.$refs.canvas,
|
||||
this.paymentQrcode,
|
||||
{ width: 160, height: 160 },
|
||||
function (error) {
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
open(data) {
|
||||
this.show = true;
|
||||
this.form.money = Number(data.money).toFixed(2);
|
||||
this.payPar = data;
|
||||
if (this.openSwitch) {
|
||||
// this.getPayUrl();
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.refInputCode.focus();
|
||||
});
|
||||
},
|
||||
close() {
|
||||
this.show = false;
|
||||
},
|
||||
numberInput(val) {
|
||||
console.log(val);
|
||||
this.number = `${Number(val)}`;
|
||||
},
|
||||
keyboradConfirm() {
|
||||
this.$emit("confirm", this.number);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.number = `${this.value}`;
|
||||
this.tips = this.defaultTips;
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.codeImg {
|
||||
width: 164px;
|
||||
border: 1px solid rgb(220, 223, 230);
|
||||
height: 164px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -5,10 +5,10 @@
|
|||
<div class="left u-flex u-col-center">
|
||||
<span class="title">代客下单</span>
|
||||
<div class="u-m-l-20 flex">
|
||||
<div class="choose-user flex">
|
||||
<el-button type="primary" v-if="!user.id" @click="showChooseUser">选择用户</el-button>
|
||||
<div class="choose-user flex u-font-14" @click="showChooseUser">
|
||||
<el-button type="primary" v-if="!user.id">选择用户</el-button>
|
||||
|
||||
<div v-else class="flex cur-pointer" @click="refChooseUserOpen">
|
||||
<div v-else class="flex cur-pointer">
|
||||
<img
|
||||
v-if="user.headImg && user.headImg != 'null'"
|
||||
class="headimg"
|
||||
|
|
@ -97,19 +97,27 @@
|
|||
</div>
|
||||
<a @click="clearCarts" style="color: #1890ff">清空</a>
|
||||
</div>
|
||||
<!-- 购物车 -->
|
||||
<cartsList
|
||||
@editNote="showNote(true)"
|
||||
@createOrder="createOrder"
|
||||
@hideOrder="hideOrder"
|
||||
:showOrder="showOrder"
|
||||
:goodsMapisFinish="goodsMapisFinish"
|
||||
:goodsList="goods.list"
|
||||
:oldOrder="oldOrder"
|
||||
:perpole="perpole"
|
||||
:table="table"
|
||||
ref="refCart"
|
||||
></cartsList>
|
||||
</div>
|
||||
<div class="center">
|
||||
<!-- 购物车控制操作按钮 -->
|
||||
<Controls
|
||||
@noteClick="showNote"
|
||||
@packClick="showPack"
|
||||
@changePriceClick="showChangePrice"
|
||||
@return="showReturn"
|
||||
/>
|
||||
</div>
|
||||
<div class="right">
|
||||
|
|
@ -159,7 +167,14 @@
|
|||
</template>
|
||||
|
||||
<!-- 订单信息展示 -->
|
||||
<Order @discountShow="discountShow" v-else></Order>
|
||||
<Order
|
||||
:orderInfo="orderInfo"
|
||||
@chooseUser="showChooseUser"
|
||||
@paysuccess="refresh"
|
||||
:table="table"
|
||||
v-else
|
||||
:user="user"
|
||||
></Order>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -180,15 +195,13 @@
|
|||
<changeTaocan ref="refAddTaocan" @confirm="taocanConfirm"></changeTaocan>
|
||||
<!-- 选择用户 -->
|
||||
<chooseUser ref="refChooseUser" @chooseUser="chooseUserConfirm"></chooseUser>
|
||||
<!-- 打折 -->
|
||||
<discount ref="refDiscount" @confirm="discountConfirm"></discount>
|
||||
|
||||
<!-- 就餐人数 -->
|
||||
<dinerNumber ref="refDinerNumber" @confirm="dinerNumberConfirm"></dinerNumber>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import Controls from "./components/control.vue";
|
||||
import discount from "./components/discount.vue";
|
||||
import dinerNumber from "./components/diner-number.vue";
|
||||
import note from "./components/note.vue";
|
||||
import Order from "./components/order.vue";
|
||||
|
|
@ -206,11 +219,17 @@ import productApi from "@/api/product/index";
|
|||
import tableApi from "@/api/account/table";
|
||||
import $status from "@/views/tool/table/status.js";
|
||||
import orderApi from "@/api/order/order";
|
||||
|
||||
import { useCartsStore } from "@/store/modules/carts";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
const carts = useCartsStore();
|
||||
const shopUser = useUserStore();
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
//退菜
|
||||
function showReturn(cart) {
|
||||
console.log(cart);
|
||||
}
|
||||
|
||||
//就餐人数
|
||||
let perpole = ref("");
|
||||
|
|
@ -222,21 +241,13 @@ function showDinerNumber() {
|
|||
refDinerNumber.value.open(perpole.value);
|
||||
}
|
||||
|
||||
//打折
|
||||
const refDiscount = ref();
|
||||
function discountConfirm(e) {}
|
||||
function discountShow(e) {
|
||||
refDiscount.value.open({
|
||||
amount: 10,
|
||||
});
|
||||
}
|
||||
|
||||
//用户
|
||||
let user = ref({});
|
||||
const refChooseUser = ref();
|
||||
function chooseUserConfirm(e) {
|
||||
console.log(e);
|
||||
user.value = e;
|
||||
refCart.value.carts.changeUser(e);
|
||||
}
|
||||
function showChooseUser() {
|
||||
refChooseUser.value.open();
|
||||
|
|
@ -244,14 +255,20 @@ function showChooseUser() {
|
|||
|
||||
//订单
|
||||
const showOrder = ref(false);
|
||||
async function createOrder() {
|
||||
function hideOrder() {
|
||||
showOrder.value = false;
|
||||
}
|
||||
const oldOrder = ref({});
|
||||
|
||||
const orderInfo = ref({});
|
||||
async function createOrder(key) {
|
||||
console.log(refCart.value.carts.table_code);
|
||||
const res = await orderApi.add({
|
||||
orderId: "",
|
||||
shopId: "",
|
||||
userId: "",
|
||||
orderId: oldOrder.value.id || "",
|
||||
shopId: shopUser.userInfo.id,
|
||||
userId: user.value.userId,
|
||||
seatNum: 0,
|
||||
packFee: 0,
|
||||
packFee: refCart.value.carts.packFee * 1,
|
||||
originAmount: refCart.value.carts.payMoney * 1,
|
||||
tableCode: refCart.value.carts.table_code,
|
||||
dineMode: diners.sel == 0 ? "dine-in" : "take-out",
|
||||
|
|
@ -259,10 +276,24 @@ async function createOrder() {
|
|||
seatNum: perpole.value * 1,
|
||||
placeNum: 1,
|
||||
waitCall: false,
|
||||
vipPrice: false,
|
||||
vipPrice: user.value.id && user.value.isVip,
|
||||
});
|
||||
if (res) {
|
||||
refCart.value.carts.clear();
|
||||
if (key == "only-create") {
|
||||
router.replace(route.path);
|
||||
return;
|
||||
}
|
||||
if (key == "to-pay" && oldOrder.value.id) {
|
||||
// 获取历史订单数据
|
||||
const res = await orderApi.getHistoryList({
|
||||
orderId: oldOrder.value.id,
|
||||
});
|
||||
oldOrder.value = res;
|
||||
}
|
||||
orderInfo.value = res;
|
||||
showOrder.value = true;
|
||||
// oldOrder.value = res;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -274,6 +305,7 @@ function taocanConfirm(goods, pro_group_info) {
|
|||
product_id: goods.id,
|
||||
sku_id: goods.skuList[0].id,
|
||||
pro_group_info: JSON.stringify(pro_group_info),
|
||||
number: goods.skuList[0].suitNum,
|
||||
});
|
||||
}
|
||||
function taocanShow(item) {
|
||||
|
|
@ -302,19 +334,19 @@ const tableSearchText = ref("");
|
|||
const tableList = ref([]);
|
||||
function getTableList() {
|
||||
tableApi.getList({ page: 1, size: 999 }).then((res) => {
|
||||
tableList.value = res.records;
|
||||
tableList.value = res.records.filter((v) => v.tableCode);
|
||||
});
|
||||
}
|
||||
function getTableDetail(table_code) {
|
||||
tableApi.get(table_code);
|
||||
}
|
||||
function tablesearchInput() {}
|
||||
//返回台桌状态颜色
|
||||
//返回桌台状态颜色
|
||||
function returnTableColor(key) {
|
||||
const item = $status[key];
|
||||
return item ? item.type : "";
|
||||
}
|
||||
//返回台桌状态
|
||||
//返回桌台状态
|
||||
function returnTableLabel(key) {
|
||||
const item = $status[key];
|
||||
return item ? item.label : "";
|
||||
|
|
@ -322,6 +354,7 @@ function returnTableLabel(key) {
|
|||
function tableClick(item) {
|
||||
console.log(item);
|
||||
getTableDetail(item.tableCode);
|
||||
|
||||
table.value = item;
|
||||
refCart.value.carts.changeTable(item.tableCode);
|
||||
refTable.value.hide();
|
||||
|
|
@ -447,6 +480,13 @@ async function getGoods() {
|
|||
}
|
||||
|
||||
function goodsClick(item) {
|
||||
if (!goodsMapisFinish.value) {
|
||||
return ElMessage.error({
|
||||
message: "添加失败,socket未连接成功,请刷新再试",
|
||||
type: "error",
|
||||
duration: 2000,
|
||||
});
|
||||
}
|
||||
//单规格
|
||||
if (item.type == "single") {
|
||||
addCarts({
|
||||
|
|
@ -472,9 +512,9 @@ function goodsClick(item) {
|
|||
if (item.groupType == 0) {
|
||||
const sendmsg = {
|
||||
goods_type: "package",
|
||||
sku_id: item.groupSnap[0].goods[0].skuId,
|
||||
sku_id: item.skuList[0].id || -888,
|
||||
product_id: item.id,
|
||||
number: item.groupSnap[0].goods[0].number,
|
||||
number: item.skuList[0].suitNum || 1,
|
||||
};
|
||||
addCarts(sendmsg);
|
||||
// refCart.value.carts.cartsPush({
|
||||
|
|
@ -530,12 +570,37 @@ function init() {
|
|||
onMounted(async () => {
|
||||
const { id } = route.query;
|
||||
if (id) {
|
||||
orderApi.getHistoryList({
|
||||
// 获取历史订单数据
|
||||
const res = await orderApi.getHistoryList({
|
||||
orderId: id,
|
||||
});
|
||||
const noPayStatus = {
|
||||
cancelled: "订单已取消",
|
||||
done: "订单已关闭",
|
||||
};
|
||||
if (noPayStatus[res.status]) {
|
||||
ElMessage.error(noPayStatus[res.status]);
|
||||
refresh();
|
||||
return;
|
||||
}
|
||||
if (res.tableCode) {
|
||||
table.value = { tableCode: res.tableCode };
|
||||
}
|
||||
if (res) {
|
||||
oldOrder.value = res;
|
||||
orderInfo.value = res;
|
||||
showOrder.value = true;
|
||||
}
|
||||
//获取台桌数据
|
||||
if (res.tableCode) {
|
||||
}
|
||||
}
|
||||
init();
|
||||
});
|
||||
|
||||
function refresh() {
|
||||
router.go(0);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
@ -729,4 +794,11 @@ $pl: 30px;
|
|||
.choose-user {
|
||||
margin-right: 10px;
|
||||
}
|
||||
.headimg {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
display: block;
|
||||
border-radius: 2px;
|
||||
margin-right: 6px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -152,13 +152,13 @@ function onSubmitHandle() {
|
|||
let res = form.id ? await tableApi.edit(form) : await tableApi.add(form);
|
||||
console.log(res);
|
||||
emits("success", res);
|
||||
close();
|
||||
ElNotification({
|
||||
title: "成功",
|
||||
message: `${form.id ? "编辑" : "添加"}成功`,
|
||||
type: "success",
|
||||
});
|
||||
loading.value = false;
|
||||
close();
|
||||
} catch (error) {
|
||||
loading.value = false;
|
||||
console.log(error);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ export default {
|
|||
try {
|
||||
this.loading = true;
|
||||
const file = await TableApi.downloadTableCode(this.form.number);
|
||||
console.log(file);
|
||||
this.loading = false;
|
||||
this.dialogVisible = false;
|
||||
ElMessage.success("下载成功");
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@
|
|||
|
||||
<!-- 弹窗 -->
|
||||
<addEara ref="refAddEara" @success="areainit" />
|
||||
<addTable ref="refAddTable" @success="tableinit" />
|
||||
<addTable ref="refAddTable" @success="tableInit" />
|
||||
<!-- 下载桌台码 -->
|
||||
<downloadTableCode ref="refDownloadTableCode" />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import shopUserApi, { type addRequest } from "@/api/account/shopUser";
|
||||
import type { IModalConfig } from "@/components/CURD/types";
|
||||
|
||||
import dayjs from "dayjs";
|
||||
const modalConfig: IModalConfig<addRequest> = {
|
||||
pageName: "sys:user",
|
||||
dialog: {
|
||||
|
|
@ -16,6 +16,7 @@ const modalConfig: IModalConfig<addRequest> = {
|
|||
},
|
||||
beforeSubmit(data) {
|
||||
console.log("提交之前处理", data);
|
||||
data.birthDay = dayjs(data.birthDay).format("YYYY-MM-DD");
|
||||
},
|
||||
formItems: [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue