Merge branch 'ymf' of https://e.coding.net/g-cphe0354/cashier/cashier-web
This commit is contained in:
commit
8e52613f08
|
|
@ -55,11 +55,11 @@ const CommonApi = {
|
||||||
/**
|
/**
|
||||||
* 发送验证码
|
* 发送验证码
|
||||||
*/
|
*/
|
||||||
sms(data: smsRequest) {
|
sms(params: smsRequest) {
|
||||||
return request<any, smsResponse>({
|
return request<any, smsResponse>({
|
||||||
url: `${baseURL}/sms`,
|
url: `${baseURL}/sms`,
|
||||||
method: "post",
|
method: "get",
|
||||||
data: data,
|
params
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,24 @@ const API = {
|
||||||
data: data,
|
data: data,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 查找优惠券 生成订单后使用
|
||||||
|
findCoupon(params: findCouponRequest) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/findCoupon`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
}
|
}
|
||||||
export default API;
|
export default API;
|
||||||
|
export interface findCouponRequest {
|
||||||
|
/**
|
||||||
|
* 店铺用户Id
|
||||||
|
*/
|
||||||
|
shopUserId: number;
|
||||||
|
type?: number;
|
||||||
|
[property: string]: any;
|
||||||
|
}
|
||||||
export interface queryReceive {
|
export interface queryReceive {
|
||||||
/**
|
/**
|
||||||
* 优惠券id
|
* 优惠券id
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
import request from "@/utils/request";
|
||||||
|
import { Order_BaseUrl } from "@/api/config";
|
||||||
|
const baseURL = Order_BaseUrl + "/admin/order/credit/buyer";
|
||||||
|
const Api = {
|
||||||
|
getList(params: any) {
|
||||||
|
return request<any, any>({
|
||||||
|
url: `${baseURL}/page`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
get(params: any) {
|
||||||
|
return request<any, any>({
|
||||||
|
url: `${baseURL}`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
add(data: any) {
|
||||||
|
return request<any, any>({
|
||||||
|
url: `${baseURL}`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
});
|
||||||
|
},
|
||||||
|
edit(data: any) {
|
||||||
|
return request<any, any>({
|
||||||
|
url: `${baseURL}`,
|
||||||
|
method: "put",
|
||||||
|
data
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
delete(id: string | number) {
|
||||||
|
return request<any, any>({
|
||||||
|
url: `${baseURL}/` + id,
|
||||||
|
method: "delete",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 还款
|
||||||
|
|
||||||
|
repayment(data: any) {
|
||||||
|
return request<any, any>({
|
||||||
|
url: `${baseURL}/repayment`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Api;
|
||||||
|
|
||||||
|
|
@ -51,6 +51,14 @@ const Api = {
|
||||||
params
|
params
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
//挂账支付
|
||||||
|
creditPay(data: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/creditPay`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ export const constantRoutes: RouteRecordRaw[] = [
|
||||||
{
|
{
|
||||||
path: "credit",
|
path: "credit",
|
||||||
name: "creditStatistics",
|
name: "creditStatistics",
|
||||||
component: () => import("@/views/data/credit.vue"),
|
component: () => import("@/views/data/credit/index.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "挂账管理",
|
title: "挂账管理",
|
||||||
affix: false,
|
affix: false,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ export const useCartsStore = defineStore("carts", () => {
|
||||||
|
|
||||||
//是否启用会员价
|
//是否启用会员价
|
||||||
const useVipPrice = computed(() => {
|
const useVipPrice = computed(() => {
|
||||||
return shopUser.userInfo.isMemberPrice && vipUser.value.id && vipUser.value.isVip
|
return (shopUser.userInfo.isMemberPrice && vipUser.value.id && vipUser.value.isVip) ? true : false
|
||||||
})
|
})
|
||||||
|
|
||||||
//台桌id
|
//台桌id
|
||||||
|
|
@ -165,12 +165,14 @@ export const useCartsStore = defineStore("carts", () => {
|
||||||
const discount_sale_amount = cur.discount_sale_amount * 1 || 0
|
const discount_sale_amount = cur.discount_sale_amount * 1 || 0
|
||||||
const memberPrice = cur.skuData ? (cur.skuData.memberPrice || cur.skuData.salePrice) : 0
|
const memberPrice = cur.skuData ? (cur.skuData.memberPrice || cur.skuData.salePrice) : 0
|
||||||
const price = (discount_sale_amount || cur.salePrice || 0)
|
const price = (discount_sale_amount || cur.salePrice || 0)
|
||||||
return prve + cur.number * (discount_sale_amount || (useVipPrice.value ? memberPrice : price))
|
const number = (cur.number - cur.returnNum)
|
||||||
|
return prve + (number <= 0 ? 0 : number) * (discount_sale_amount || (useVipPrice.value ? memberPrice : price))
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
return total
|
return total
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
//支付总价
|
//支付总价
|
||||||
const payMoney = computed(() => {
|
const payMoney = computed(() => {
|
||||||
const money = list.value.reduce((acc: number, cur: any) => {
|
const money = list.value.reduce((acc: number, cur: any) => {
|
||||||
|
|
@ -181,6 +183,16 @@ export const useCartsStore = defineStore("carts", () => {
|
||||||
}, 0)
|
}, 0)
|
||||||
return (money + packFee.value + oldOrderMoney.value * 1).toFixed(2)
|
return (money + packFee.value + oldOrderMoney.value * 1).toFixed(2)
|
||||||
})
|
})
|
||||||
|
//只算商品的总价
|
||||||
|
const goodsTotal = computed(() => {
|
||||||
|
const money = list.value.reduce((acc: number, cur: any) => {
|
||||||
|
const discount_sale_amount = cur.discount_sale_amount * 1 || 0
|
||||||
|
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 * (discount_sale_amount || (useVipPrice.value ? memberPrice : price))
|
||||||
|
}, 0)
|
||||||
|
return (money + oldOrderMoney.value * 1).toFixed(2)
|
||||||
|
})
|
||||||
//总计数量
|
//总计数量
|
||||||
const totalNumber = computed(() => {
|
const totalNumber = computed(() => {
|
||||||
const cartNumber = list.value.reduce((acc: number, cur: any) => {
|
const cartNumber = list.value.reduce((acc: number, cur: any) => {
|
||||||
|
|
@ -380,8 +392,8 @@ export const useCartsStore = defineStore("carts", () => {
|
||||||
for (let i in data) {
|
for (let i in data) {
|
||||||
newData[i] = data[i].map((v: any) => {
|
newData[i] = data[i].map((v: any) => {
|
||||||
const skuData = getProductDetails({ product_id: v.productId, sku_id: v.skuId })
|
const skuData = getProductDetails({ product_id: v.productId, sku_id: v.skuId })
|
||||||
console.log(v)
|
|
||||||
return {
|
return {
|
||||||
|
...v,
|
||||||
...skuData,
|
...skuData,
|
||||||
placeNum: v.placeNum,
|
placeNum: v.placeNum,
|
||||||
number: v.num,
|
number: v.num,
|
||||||
|
|
@ -557,6 +569,7 @@ export const useCartsStore = defineStore("carts", () => {
|
||||||
WebSocketManager.sendMessage(msg);
|
WebSocketManager.sendMessage(msg);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
goodsTotal,
|
||||||
isLinkFinshed,
|
isLinkFinshed,
|
||||||
setOldOrder,
|
setOldOrder,
|
||||||
singleDiscount,
|
singleDiscount,
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,11 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
import Config from "@/settings";
|
import { getToken } from "@/utils/auth";
|
||||||
import Cookies from "js-cookie";
|
|
||||||
import { setToken } from "@/utils/globalCancelToken.js";
|
|
||||||
function getToken() {
|
|
||||||
return localStorage.getItem("bausertoken");
|
|
||||||
}
|
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
// baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/',
|
|
||||||
baseURL: "https://czgdoumei.sxczgkj.com/index.php/api/", // api 的 base_url
|
baseURL: "https://czgdoumei.sxczgkj.com/index.php/api/", // api 的 base_url
|
||||||
timeout: Config.timeout, // 请求超时时间
|
timeout: 1000 * 20, // 请求超时时间
|
||||||
});
|
});
|
||||||
|
|
||||||
// request拦截器
|
// request拦截器
|
||||||
|
|
@ -21,7 +16,6 @@ service.interceptors.request.use(
|
||||||
}
|
}
|
||||||
config.headers["Content-Type"] = "application/json";
|
config.headers["Content-Type"] = "application/json";
|
||||||
// 添加可取消请求配置
|
// 添加可取消请求配置
|
||||||
config.cancelToken = new axios.CancelToken((c) => setToken(c));
|
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class WebSocketManager {
|
||||||
private reconnectAttempts = 0;
|
private reconnectAttempts = 0;
|
||||||
private maxReconnectAttempts = 3; // 自定义最大重试次数
|
private maxReconnectAttempts = 3; // 自定义最大重试次数
|
||||||
private reconnectDelay = 5000; // 重试延迟(单位:毫秒)
|
private reconnectDelay = 5000; // 重试延迟(单位:毫秒)
|
||||||
|
private timer: any | null = null;
|
||||||
// 初始化 WebSocket 客户端
|
// 初始化 WebSocket 客户端
|
||||||
setupWebSocket() {
|
setupWebSocket() {
|
||||||
const endpoint = import.meta.env.VITE_APP_WS_ENDPOINT;
|
const endpoint = import.meta.env.VITE_APP_WS_ENDPOINT;
|
||||||
|
|
@ -60,8 +60,13 @@ class WebSocketManager {
|
||||||
console.log("WebSocket 连接已建立");
|
console.log("WebSocket 连接已建立");
|
||||||
// ElNotification.success('WebSocket 连接已建立')
|
// ElNotification.success('WebSocket 连接已建立')
|
||||||
this.sendMessage(this.initParams)
|
this.sendMessage(this.initParams)
|
||||||
|
clearTimeout(this.timer)
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
this.sendMessage({ "type": "ping_interval" })
|
||||||
|
}, 1000 * 10);
|
||||||
};
|
};
|
||||||
this.client.onclose = () => {
|
this.client.onclose = () => {
|
||||||
|
clearTimeout(this.timer)
|
||||||
if (!this.connected) {
|
if (!this.connected) {
|
||||||
// ElMessageBox.alert('WebSocket 连接已断开', 'Title', {
|
// ElMessageBox.alert('WebSocket 连接已断开', 'Title', {
|
||||||
// confirmButtonText: '立即重连',
|
// confirmButtonText: '立即重连',
|
||||||
|
|
@ -74,6 +79,7 @@ class WebSocketManager {
|
||||||
console.log("WebSocket 连接已断开");
|
console.log("WebSocket 连接已断开");
|
||||||
};
|
};
|
||||||
this.client.onerror = (error) => {
|
this.client.onerror = (error) => {
|
||||||
|
clearTimeout(this.timer)
|
||||||
console.error("WebSocket 发生错误:", error);
|
console.error("WebSocket 发生错误:", error);
|
||||||
// ElNotification({
|
// ElNotification({
|
||||||
// title: "提示",
|
// title: "提示",
|
||||||
|
|
|
||||||
|
|
@ -295,7 +295,25 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
reset() {
|
reset() {
|
||||||
this.$refs.form.resetFields();
|
this.$refs.form.resetFields();
|
||||||
this.form = this.resetForm;
|
this.form = {
|
||||||
|
id: "",
|
||||||
|
shopId: "",
|
||||||
|
type: "1",
|
||||||
|
title: "",
|
||||||
|
fullAmount: null,
|
||||||
|
discountAmount: null,
|
||||||
|
validityType: "fixed",
|
||||||
|
validStartTime: "",
|
||||||
|
validEndTime: "",
|
||||||
|
userDays: [],
|
||||||
|
validDays: "",
|
||||||
|
useTimeType: "all",
|
||||||
|
useStartTime: "",
|
||||||
|
useEndTime: "",
|
||||||
|
proId: "",
|
||||||
|
proName: "",
|
||||||
|
number: "",
|
||||||
|
};
|
||||||
this.form.type = 1;
|
this.form.type = 1;
|
||||||
},
|
},
|
||||||
async open(data) {
|
async open(data) {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<template>
|
|
||||||
<div></div>
|
|
||||||
</template>
|
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
import creditApi from "@/api/order/credit";
|
||||||
|
import { returnOptions } from "./config";
|
||||||
|
import type { IModalConfig } from "@/components/CURD/types";
|
||||||
|
|
||||||
|
const modalConfig: IModalConfig = {
|
||||||
|
pageName: "sys:user",
|
||||||
|
dialog: {
|
||||||
|
title: "创建挂账人",
|
||||||
|
width: 800,
|
||||||
|
draggable: true,
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
labelWidth: 140,
|
||||||
|
},
|
||||||
|
formAction: function (data) {
|
||||||
|
return creditApi.add({ ...data });
|
||||||
|
},
|
||||||
|
beforeSubmit(data) {
|
||||||
|
console.log("提交之前处理", data);
|
||||||
|
},
|
||||||
|
formItems: [
|
||||||
|
{
|
||||||
|
label: "状态",
|
||||||
|
prop: "status",
|
||||||
|
type: 'switch',
|
||||||
|
attrs: {
|
||||||
|
activeText: '开启',
|
||||||
|
inactiveText: '关闭',
|
||||||
|
activeValue: 1,
|
||||||
|
inactiveValue: 0
|
||||||
|
},
|
||||||
|
initialValue: 1
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: "挂账人",
|
||||||
|
prop: "debtor",
|
||||||
|
rules: [{ required: true, message: "请输入挂账人", trigger: "blur" }],
|
||||||
|
attrs: {
|
||||||
|
placeholder: "请输入挂账人",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "手机号",
|
||||||
|
prop: "mobile",
|
||||||
|
rules: [{ required: true, message: "请输入挂账人手机号", trigger: "blur" }],
|
||||||
|
attrs: {
|
||||||
|
placeholder: "请输入挂账人手机号",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "职务",
|
||||||
|
prop: "position",
|
||||||
|
rules: [{ required: false, message: "请输入挂账人职务", trigger: "blur" }],
|
||||||
|
attrs: {
|
||||||
|
placeholder: "请输入挂账人职务",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "挂账额度",
|
||||||
|
prop: "creditAmount",
|
||||||
|
type: "input-number",
|
||||||
|
rules: [{ required: true, message: "请输入挂账额度", trigger: "blur" }],
|
||||||
|
attrs: {
|
||||||
|
placeholder: "请输入挂账额度",
|
||||||
|
},
|
||||||
|
initialValue: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "还款方式",
|
||||||
|
prop: "repaymentMethod",
|
||||||
|
type: "radio-button",
|
||||||
|
options: returnOptions('repaymentMethod'),
|
||||||
|
initialValue: returnOptions('repaymentMethod')[0].value
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||||||
|
export default reactive(modalConfig);
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
const options: Record<string, { label: string; value: string; }[]> = {
|
||||||
|
repaymentMethod: [
|
||||||
|
{ label: '按总金额还款', value: "total" },
|
||||||
|
{ label: '按订单还款', value: "order" },
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
export function returnOptions(type: keyof typeof options) {
|
||||||
|
return options[type];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function returnOptionsLabel(optionsType: optionsType, value: string | number) {
|
||||||
|
const options = returnOptions(optionsType);
|
||||||
|
if (!options) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
const option = options.find((item) => item.value === value);
|
||||||
|
return option ? option.label : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface options {
|
||||||
|
label: string;
|
||||||
|
value: string | number;
|
||||||
|
[property: string]: any;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
import creditApi from "@/api/order/credit";
|
||||||
|
import type { IContentConfig } from "@/components/CURD/types";
|
||||||
|
|
||||||
|
const contentConfig: IContentConfig = {
|
||||||
|
pageName: "sys:user",
|
||||||
|
table: {
|
||||||
|
border: true,
|
||||||
|
highlightCurrentRow: true,
|
||||||
|
},
|
||||||
|
pagination: {
|
||||||
|
background: true,
|
||||||
|
layout: "prev,pager,next,jumper,total,sizes",
|
||||||
|
pageSize: 20,
|
||||||
|
pageSizes: [10, 20, 30, 50],
|
||||||
|
},
|
||||||
|
indexAction: function (params) {
|
||||||
|
return creditApi.getList(params);
|
||||||
|
},
|
||||||
|
deleteAction: creditApi.delete,
|
||||||
|
// modifyAction: function (data) {
|
||||||
|
// // return creditApi.edit(data);
|
||||||
|
// },
|
||||||
|
pk: "id",
|
||||||
|
toolbar: ["add"],
|
||||||
|
defaultToolbar: ["refresh", "filter", "search"],
|
||||||
|
cols: [
|
||||||
|
{
|
||||||
|
label: "挂账编码",
|
||||||
|
align: "center",
|
||||||
|
prop: "id",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "状态",
|
||||||
|
align: "center",
|
||||||
|
prop: "status",
|
||||||
|
templet: 'custom',
|
||||||
|
slotName: 'status',
|
||||||
|
width: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "挂账人",
|
||||||
|
align: "center",
|
||||||
|
prop: "debtor",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "手机号",
|
||||||
|
align: "center",
|
||||||
|
prop: "mobile",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "挂账额度(元)",
|
||||||
|
align: "center",
|
||||||
|
prop: "creditAmount",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "已挂账金额(元)",
|
||||||
|
align: "center",
|
||||||
|
prop: "owedAmount",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "剩余挂账额度(元)",
|
||||||
|
align: "center",
|
||||||
|
prop: "owedAmount",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "账户余额",
|
||||||
|
align: "center",
|
||||||
|
prop: "accountBalance",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "操作",
|
||||||
|
align: "center",
|
||||||
|
fixed: "right",
|
||||||
|
width: 300,
|
||||||
|
templet: "tool",
|
||||||
|
operat: [
|
||||||
|
{
|
||||||
|
text: "查看明细",
|
||||||
|
name: 'detail'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "编辑",
|
||||||
|
name: 'edit'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "还款",
|
||||||
|
name: 'huankuan'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "还款记录",
|
||||||
|
name: 'huankuan_detail'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "删除",
|
||||||
|
name: 'delete'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default contentConfig;
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
import creditApi from "@/api/order/credit";
|
||||||
|
import { returnOptions } from "./config";
|
||||||
|
import type { IModalConfig } from "@/components/CURD/types";
|
||||||
|
|
||||||
|
const modalConfig: IModalConfig = {
|
||||||
|
pageName: "sys:user",
|
||||||
|
dialog: {
|
||||||
|
title: "编辑挂账人",
|
||||||
|
width: 800,
|
||||||
|
draggable: true,
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
labelWidth: 140,
|
||||||
|
},
|
||||||
|
formAction: function (data) {
|
||||||
|
return creditApi.edit({ ...data });
|
||||||
|
},
|
||||||
|
beforeSubmit(data) {
|
||||||
|
console.log("提交之前处理", data);
|
||||||
|
},
|
||||||
|
formItems: [
|
||||||
|
{
|
||||||
|
label: "状态",
|
||||||
|
prop: "status",
|
||||||
|
type: 'switch',
|
||||||
|
attrs: {
|
||||||
|
activeText: '开启',
|
||||||
|
inactiveText: '关闭',
|
||||||
|
activeValue: 1,
|
||||||
|
inactiveValue: 0
|
||||||
|
},
|
||||||
|
initialValue: 1
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: "挂账人",
|
||||||
|
prop: "debtor",
|
||||||
|
rules: [{ required: true, message: "请输入挂账人", trigger: "blur" }],
|
||||||
|
attrs: {
|
||||||
|
placeholder: "请输入挂账人",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "手机号",
|
||||||
|
prop: "mobile",
|
||||||
|
rules: [{ required: true, message: "请输入挂账人手机号", trigger: "blur" }],
|
||||||
|
attrs: {
|
||||||
|
placeholder: "请输入挂账人手机号",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "职务",
|
||||||
|
prop: "position",
|
||||||
|
rules: [{ required: false, message: "请输入挂账人职务", trigger: "blur" }],
|
||||||
|
attrs: {
|
||||||
|
placeholder: "请输入挂账人职务",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "挂账额度",
|
||||||
|
prop: "creditAmount",
|
||||||
|
type: "input-number",
|
||||||
|
rules: [{ required: true, message: "请输入挂账额度", trigger: "blur" }],
|
||||||
|
attrs: {
|
||||||
|
placeholder: "请输入挂账额度",
|
||||||
|
},
|
||||||
|
initialValue: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "还款方式",
|
||||||
|
prop: "repaymentMethod",
|
||||||
|
type: "radio-button",
|
||||||
|
options: returnOptions('repaymentMethod'),
|
||||||
|
initialValue: returnOptions('repaymentMethod')[0].value
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||||||
|
export default reactive(modalConfig);
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
import type { ISearchConfig } from "@/components/CURD/types";
|
||||||
|
|
||||||
|
const searchConfig: ISearchConfig = {
|
||||||
|
pageName: "sys:user",
|
||||||
|
formItems: [
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "挂账人",
|
||||||
|
prop: "keywords",
|
||||||
|
attrs: {
|
||||||
|
placeholder: "请输入挂账人或手机号",
|
||||||
|
clearable: true,
|
||||||
|
style: {
|
||||||
|
width: "200px",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "select",
|
||||||
|
label: "还款状态",
|
||||||
|
prop: "repaymentStatus",
|
||||||
|
attrs: {
|
||||||
|
placeholder: "请选择还款状态",
|
||||||
|
clearable: true,
|
||||||
|
style: {
|
||||||
|
width: "200px",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
initialValue: '',
|
||||||
|
options: [
|
||||||
|
{ label: "未还款", value: 'unpaid' },
|
||||||
|
{ label: "部分还款", value: 'partial' },
|
||||||
|
{ label: "已还清", value: 'paid' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default searchConfig;
|
||||||
|
|
@ -0,0 +1,131 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!-- 列表 -->
|
||||||
|
<!-- 搜索 -->
|
||||||
|
<page-search
|
||||||
|
ref="searchRef"
|
||||||
|
:search-config="searchConfig"
|
||||||
|
@query-click="handleQueryClick"
|
||||||
|
@reset-click="handleResetClick"
|
||||||
|
/>
|
||||||
|
<!-- 列表 -->
|
||||||
|
<page-content
|
||||||
|
ref="contentRef"
|
||||||
|
:content-config="contentConfig"
|
||||||
|
@add-click="handleAddClick"
|
||||||
|
@edit-click="handleEditClick"
|
||||||
|
@export-click="handleExportClick"
|
||||||
|
@search-click="handleSearchClick"
|
||||||
|
@toolbar-click="handleToolbarClick"
|
||||||
|
@operat-click="handleOperatClick"
|
||||||
|
@filter-change="handleFilterChange"
|
||||||
|
>
|
||||||
|
<template #status="scope">
|
||||||
|
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
||||||
|
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
<template #options="scope">
|
||||||
|
{{ returnOptionsLabel(scope.prop, scope.row[scope.prop]) }}
|
||||||
|
</template>
|
||||||
|
<template #gender="scope">
|
||||||
|
<DictLabel v-model="scope.row[scope.prop]" code="gender" />
|
||||||
|
</template>
|
||||||
|
<template #mobile="scope">
|
||||||
|
<el-text>{{ scope.row[scope.prop] }}</el-text>
|
||||||
|
<copy-button
|
||||||
|
v-if="scope.row[scope.prop]"
|
||||||
|
:text="scope.row[scope.prop]"
|
||||||
|
style="margin-left: 2px"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</page-content>
|
||||||
|
|
||||||
|
<!-- 新增 -->
|
||||||
|
<page-modal
|
||||||
|
ref="addModalRef"
|
||||||
|
@form-data-change="handleFormDataChange"
|
||||||
|
:modal-config="addModalConfig"
|
||||||
|
@submit-click="handleSubmitClick"
|
||||||
|
>
|
||||||
|
<template #formFooter>
|
||||||
|
<el-form-item label="" label-width="140">
|
||||||
|
<p>一经创建无法更改还款方式</p>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
</page-modal>
|
||||||
|
|
||||||
|
<!-- 编辑 -->
|
||||||
|
<page-modal
|
||||||
|
ref="editModalRef"
|
||||||
|
:modal-config="editModalConfig"
|
||||||
|
@submit-click="handleSubmitClick"
|
||||||
|
></page-modal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import creditApi from "@/api/order/credit";
|
||||||
|
import type { IObject, IOperatData } from "@/components/CURD/types";
|
||||||
|
import usePage from "@/components/CURD/usePage";
|
||||||
|
import addModalConfig from "./config/add";
|
||||||
|
import contentConfig from "./config/content";
|
||||||
|
import editModalConfig from "./config/edit";
|
||||||
|
import searchConfig from "./config/search";
|
||||||
|
import { returnOptionsLabel } from "./config/config";
|
||||||
|
|
||||||
|
let version = ref<string | number>("");
|
||||||
|
function handleFormDataChange(type: string, value: string | number) {
|
||||||
|
version.value = value;
|
||||||
|
if (type === "version" && value !== "") {
|
||||||
|
addModalConfig.formItems[5].hidden = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (type === "version" && value == "") {
|
||||||
|
addModalConfig.formItems[5].hidden = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const refVersionFile = ref<any>();
|
||||||
|
const {
|
||||||
|
searchRef,
|
||||||
|
contentRef,
|
||||||
|
addModalRef,
|
||||||
|
editModalRef,
|
||||||
|
handleQueryClick,
|
||||||
|
handleResetClick,
|
||||||
|
// handleAddClick,
|
||||||
|
// handleEditClick,
|
||||||
|
handleSubmitClick,
|
||||||
|
handleExportClick,
|
||||||
|
handleSearchClick,
|
||||||
|
handleFilterChange,
|
||||||
|
} = usePage();
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
async function handleAddClick() {
|
||||||
|
addModalRef.value?.setModalVisible();
|
||||||
|
// addModalConfig.formItems[2]!.attrs!.data =
|
||||||
|
}
|
||||||
|
// 编辑
|
||||||
|
async function handleEditClick(row: IObject) {
|
||||||
|
editModalRef.value?.handleDisabled(false);
|
||||||
|
editModalRef.value?.setModalVisible();
|
||||||
|
// 根据id获取数据进行填充
|
||||||
|
// const data = await creditApi.getFormData(row.id);
|
||||||
|
console.log({ ...row });
|
||||||
|
editModalRef.value?.setFormData({ ...row, url: [row.url] });
|
||||||
|
}
|
||||||
|
1;
|
||||||
|
// 其他工具栏
|
||||||
|
function handleToolbarClick(name: string) {
|
||||||
|
console.log(name);
|
||||||
|
if (name === "custom1") {
|
||||||
|
ElMessage.success("点击了自定义1按钮");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 其他操作列
|
||||||
|
async function handleOperatClick(data: IOperatData) {
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -192,6 +192,7 @@ function handleLogin() {
|
||||||
.login(user)
|
.login(user)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
await userStore.getUserInfo();
|
await userStore.getUserInfo();
|
||||||
|
|
||||||
const { path, queryParams } = parseRedirect();
|
const { path, queryParams } = parseRedirect();
|
||||||
console.log(res, "Denglv返回");
|
console.log(res, "Denglv返回");
|
||||||
router.push({ path: path, query: queryParams });
|
router.push({ path: path, query: queryParams });
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
<div class="form">
|
<div class="form">
|
||||||
<div class="preview_wrap">
|
<div class="preview_wrap">
|
||||||
<div class="phone_wrap">
|
<div class="phone_wrap">
|
||||||
<div class="index_bg" v-if="tableActive == 'home'">
|
<div class="index_bg" v-if="tableActive == 'index_bg'">
|
||||||
<img class="bg" :src="selectItem.value" />
|
<img class="bg" :src="selectItem.value" />
|
||||||
<div class="menu_wrap">
|
<div class="menu_wrap">
|
||||||
<div class="menu_wrap_div">
|
<div class="menu_wrap_div">
|
||||||
|
|
@ -228,11 +228,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
import shopExtendApi from "@/api/account/shopExtend";
|
import shopExtendApi from "@/api/account/shopExtend";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tableActive: "home",
|
tableActive: "",
|
||||||
tableData: [],
|
tableData: [],
|
||||||
selectItem: {},
|
selectItem: {},
|
||||||
imageUrl: "",
|
imageUrl: "",
|
||||||
|
|
@ -248,7 +249,7 @@ export default {
|
||||||
...this.selectItem,
|
...this.selectItem,
|
||||||
autokey: this.selectItem.autoKey,
|
autokey: this.selectItem.autoKey,
|
||||||
});
|
});
|
||||||
this.$message({
|
ElMessage({
|
||||||
message: "编辑成功",
|
message: "编辑成功",
|
||||||
type: "success",
|
type: "success",
|
||||||
});
|
});
|
||||||
|
|
@ -269,7 +270,7 @@ export default {
|
||||||
try {
|
try {
|
||||||
let res = await shopExtendApi.get({});
|
let res = await shopExtendApi.get({});
|
||||||
this.tableData = res;
|
this.tableData = res;
|
||||||
console.log(this.tableData[0]);
|
this.tableActive = !this.tableActive ? res[0].autoKey : this.tableActive;
|
||||||
this.selectItemChange(this.tableActive);
|
this.selectItemChange(this.tableActive);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@
|
||||||
<div>打包费:{{ detail.packFee || "-" }}</div>
|
<div>打包费:{{ detail.packFee || "-" }}</div>
|
||||||
<div>订单原价:¥{{ detail.originAmount }}</div>
|
<div>订单原价:¥{{ detail.originAmount }}</div>
|
||||||
<div>优惠金额:¥{{ detail.discountAmount }}</div>
|
<div>优惠金额:¥{{ detail.discountAmount }}</div>
|
||||||
|
<div>积分抵扣:¥{{ detail.pointsDiscountAmount }}</div>
|
||||||
<div>
|
<div>
|
||||||
实收金额:
|
实收金额:
|
||||||
<span style="color: red">¥{{ detail.payAmount }}</span>
|
<span style="color: red">¥{{ detail.payAmount }}</span>
|
||||||
|
|
@ -104,23 +105,21 @@
|
||||||
<el-table
|
<el-table
|
||||||
:data="item"
|
:data="item"
|
||||||
:ref="'refTable' + index"
|
:ref="'refTable' + index"
|
||||||
@selection-change="selectionChange"
|
@select-all="tableSelectAll($event, index)"
|
||||||
@row-click="rowClick($event, index)"
|
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<!-- <el-table-column type="selection" width="55" /> -->
|
||||||
|
<el-table-column label="数量" type="selection">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-checkbox v-model="scope.row.checked" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="商品">
|
<el-table-column label="商品">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<div class="shop_info">
|
<div class="shop_info">
|
||||||
<el-image
|
<el-image
|
||||||
v-if="scope.row.productSkuId != '-999'"
|
|
||||||
:src="scope.row.productImg"
|
:src="scope.row.productImg"
|
||||||
style="width: 40px; height: 40px"
|
style="width: 40px; height: 40px"
|
||||||
></el-image>
|
></el-image>
|
||||||
<div class="packeFee" v-else>
|
|
||||||
<span>
|
|
||||||
{{ scope.row.productName || "客座费" }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<span :class="[scope.row.isVip == 1 ? 'colorStyle' : '']">
|
<span :class="[scope.row.isVip == 1 ? 'colorStyle' : '']">
|
||||||
{{ scope.row.productName }}
|
{{ scope.row.productName }}
|
||||||
|
|
@ -142,6 +141,22 @@
|
||||||
<el-table-column label="实付">
|
<el-table-column label="实付">
|
||||||
<template v-slot="scope">¥{{ scope.row.payAmount }}</template>
|
<template v-slot="scope">¥{{ scope.row.payAmount }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="可退款数量" align="center">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-input-number
|
||||||
|
v-if="scope.row.checked"
|
||||||
|
style="width: 120px"
|
||||||
|
v-model="scope.row.selNumber"
|
||||||
|
:max="scope.row.num - scope.row.refundNum"
|
||||||
|
></el-input-number>
|
||||||
|
<span class="" v-else>0</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="已退" width="100" align="center">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>{{ scope.row.refundNum }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="操作">
|
<el-table-column label="操作">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<template v-if="detail.status != 'unpaid'">
|
<template v-if="detail.status != 'unpaid'">
|
||||||
|
|
@ -153,7 +168,7 @@
|
||||||
>
|
>
|
||||||
<span>退款</span>
|
<span>退款</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
<span class="color-999" v-if="isTui(scope.row)">已退款</span>
|
<span class="color-999" v-if="scope.row.status == 'refund'">已退款</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="detail.status == 'unpaid'">
|
<template v-if="detail.status == 'unpaid'">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -170,7 +185,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</template>
|
</template>
|
||||||
<div class="u-p-20 u-flex u-row-right">
|
<div class="u-p-20 u-flex u-row-right" v-if="detail.status !== 'refund'">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-model="allSelected"
|
v-model="allSelected"
|
||||||
@change="allSelectedChange"
|
@change="allSelectedChange"
|
||||||
|
|
@ -253,6 +268,18 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
tableSelect(e) {
|
||||||
|
console.log(e);
|
||||||
|
},
|
||||||
|
tableSelectAll(e, index) {
|
||||||
|
const arr = this.detail.detailMap[index];
|
||||||
|
for (let i in arr) {
|
||||||
|
arr[i].checked = e.length ? true : false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tableSelectionChange(e) {
|
||||||
|
console.log(e);
|
||||||
|
},
|
||||||
rowClick(row, index) {
|
rowClick(row, index) {
|
||||||
this.$refs["refTable" + index][0].toggleRowSelection(row);
|
this.$refs["refTable" + index][0].toggleRowSelection(row);
|
||||||
},
|
},
|
||||||
|
|
@ -261,17 +288,14 @@ export default {
|
||||||
},
|
},
|
||||||
allSelectedChange(newval) {
|
allSelectedChange(newval) {
|
||||||
for (let i in this.detail.detailMap) {
|
for (let i in this.detail.detailMap) {
|
||||||
this.detail.detailMap[i].forEach((item) => {
|
for (let key in this.detail.detailMap[i]) {
|
||||||
if (newval) {
|
this.detail.detailMap[i][key].checked = newval;
|
||||||
this.$refs["refTable" + i][0].toggleRowSelection(item, true);
|
}
|
||||||
} else {
|
|
||||||
this.$refs["refTable" + i][0].toggleRowSelection(item, false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
this.user = "";
|
this.user = "";
|
||||||
|
this.allSelected = false;
|
||||||
},
|
},
|
||||||
returnPayType(payType) {
|
returnPayType(payType) {
|
||||||
if (!payType) {
|
if (!payType) {
|
||||||
|
|
@ -350,13 +374,17 @@ export default {
|
||||||
let arr = [];
|
let arr = [];
|
||||||
if (item === "all") {
|
if (item === "all") {
|
||||||
for (let i in this.detail.detailMap) {
|
for (let i in this.detail.detailMap) {
|
||||||
arr.push(...this.$refs["refTable" + i][0].getSelectionRows());
|
this.detail.detailMap[i].map((v) => {
|
||||||
|
if (v.checked) {
|
||||||
|
arr.push(v);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
arr = [item];
|
arr = [item];
|
||||||
}
|
}
|
||||||
if (arr.length == 0) {
|
if (arr.length == 0) {
|
||||||
return ElMessage.error("请选择要退款的商品");
|
return ElMessage.error("请选择要退款的商品和数量");
|
||||||
}
|
}
|
||||||
this.selGoods = item;
|
this.selGoods = item;
|
||||||
this.$refs.refReturnMoney.open(arr, this.detail);
|
this.$refs.refReturnMoney.open(arr, this.detail);
|
||||||
|
|
@ -366,26 +394,7 @@ export default {
|
||||||
console.log(item);
|
console.log(item);
|
||||||
this.$refs.refReturnCart.open(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) {
|
async tbOrderInfoDetail(id) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -396,7 +405,15 @@ export default {
|
||||||
this.user = res1;
|
this.user = res1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
for (let i in res.detailMap) {
|
||||||
|
res.detailMap[i] = res.detailMap[i].map((v) => {
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
checked: false,
|
||||||
|
selNumber: v.num - v.returnNum,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
this.detail = res;
|
this.detail = res;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,15 @@
|
||||||
<span class="">
|
<span class="">
|
||||||
{{ goods.productName }}
|
{{ goods.productName }}
|
||||||
</span>
|
</span>
|
||||||
<span class="color-999 u-m-l-10">x{{ goods.num || "" }}</span>
|
<span class="color-999 u-m-l-10">x{{ goods.selNumber || "" }}</span>
|
||||||
<span class="color-333 u-m-l-10 u-font-600">
|
<span class="color-333 u-m-l-10 u-font-600">
|
||||||
{{ goods.payAmount || "" }}
|
{{ (goods.selNumber * goods.unitPrice).toFixed(2) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-col-top u-m-t-22">
|
<div class="u-flex u-col-top u-m-t-22">
|
||||||
<h4span class="u-m-0">支付金额</h4span>
|
<span class="u-m-0">支付金额</span>
|
||||||
<div class="u-p-l-20">
|
<div class="u-p-l-20">
|
||||||
{{ detail.payAmount }}
|
{{ detail.payAmount }}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -32,26 +32,30 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="u-p-b-16 u-m-t-22">
|
<div class="u-p-b-16 u-m-t-22">
|
||||||
<div class="flex u-row-between">
|
<div class="flex u-row-between">
|
||||||
<span>线下收款</span>
|
<span class="color-red">退款金额</span>
|
||||||
<div class="u-flex u-flex-1 u-p-l-20">
|
<div class="u-flex u-flex-1 u-p-l-20">
|
||||||
<el-input type="number" v-model="number" :min="min" :max="max">
|
<el-input-number
|
||||||
<template #append>可退1元</template>
|
type="number"
|
||||||
</el-input>
|
v-model="number"
|
||||||
|
:min="min"
|
||||||
|
:max="canReturnMoney"
|
||||||
|
></el-input-number>
|
||||||
|
<span class="u-m-l-10">可退{{ canReturnMoney }}元</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-col-top u-m-t-22">
|
<div class="u-flex u-col-top u-m-t-22" v-if="detail.returnAmount * 1 > 0">
|
||||||
<span class="u-m-0">退款金额</span>
|
<span class="u-m-0">退款金额</span>
|
||||||
<div class="u-p-l-20">
|
<div class="u-p-l-20">
|
||||||
<span class="color-red">¥ {{ detail.discountAmount }}</span>
|
<span class="color-red">¥ {{ detail.returnAmount || 0 }}</span>
|
||||||
<span class="color-666 u-m-l-4">(退款商品金额:260.16)</span>
|
<!-- <span class="color-666 u-m-l-4">(退款商品金额)</span> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-col-top u-m-t-22">
|
<!-- <div class="u-flex u-col-top u-m-t-22">
|
||||||
<span class="u-m-0">退回优惠券</span>
|
<span class="u-m-0">退回优惠券</span>
|
||||||
<div class="u-p-l-20">
|
<div class="u-p-l-20">
|
||||||
<span class="color-666 u-m-l-4">该订单未使用优惠券</span>
|
<span class="color-666 u-m-l-4">该订单未使用优惠券</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="u-p-b-16 border-bottom">
|
<div class="u-p-b-16 border-bottom">
|
||||||
|
|
@ -130,6 +134,12 @@ export default {
|
||||||
const danjia = this.goods.price;
|
const danjia = this.goods.price;
|
||||||
return (danjia * this.number).toFixed(2);
|
return (danjia * this.number).toFixed(2);
|
||||||
},
|
},
|
||||||
|
canReturnMoney() {
|
||||||
|
if (!this.detail) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return this.detail.payAmount - this.detail.refundAmount;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
to2(val) {
|
to2(val) {
|
||||||
|
|
@ -155,6 +165,11 @@ export default {
|
||||||
this.note = tag + "," + this.note;
|
this.note = tag + "," + this.note;
|
||||||
},
|
},
|
||||||
open(goods, detailInfo) {
|
open(goods, detailInfo) {
|
||||||
|
const totalMoney = goods.reduce((prve, cur) => {
|
||||||
|
console.log(cur);
|
||||||
|
return prve + cur.unitPrice * cur.selNumber;
|
||||||
|
}, 0);
|
||||||
|
this.number = totalMoney.toFixed(2);
|
||||||
this.goodsList = goods;
|
this.goodsList = goods;
|
||||||
this.show = true;
|
this.show = true;
|
||||||
this.detail = detailInfo;
|
this.detail = detailInfo;
|
||||||
|
|
@ -174,12 +189,12 @@ export default {
|
||||||
return ElMessage.error("请输入退款原因");
|
return ElMessage.error("请输入退款原因");
|
||||||
}
|
}
|
||||||
this.$emit("confirm", {
|
this.$emit("confirm", {
|
||||||
refundAmount: (this.goods.price * this.number).toFixed(2) * 1,
|
refundAmount: this.number,
|
||||||
cash: this.cash,
|
cash: this.cash,
|
||||||
refundReason: note,
|
refundReason: note,
|
||||||
refundDetails: [
|
refundDetails: this.goodsList.map((v) => {
|
||||||
{ id: this.goods.id, num: this.number, returnAmount: this.tuikuanJine * 1 },
|
return { id: v.id, num: v.num };
|
||||||
],
|
}),
|
||||||
});
|
});
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export function canTuicai(orderInfo, item) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
export function canTuiKuan(orderInfo, item) {
|
export function canTuiKuan(orderInfo, item) {
|
||||||
return orderInfo.status == "done" || orderInfo.status == "part-refund";
|
return (orderInfo.status != "refund" && orderInfo.status != "unpaid") || item.status != "refund";
|
||||||
}
|
}
|
||||||
export function isTui(item) {
|
export function isTui(item) {
|
||||||
return item.status == "return" || item.status == "refund" || item.status == "refunding";
|
return item.status == "return" || item.status == "refund" || item.status == "refunding";
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,9 @@
|
||||||
<hr />
|
<hr />
|
||||||
<el-form ref="form" :model="form" label-width="120px" label-position="left">
|
<el-form ref="form" :model="form" label-width="120px" label-position="left">
|
||||||
<el-form-item label="校验安全密码">
|
<el-form-item label="校验安全密码">
|
||||||
<el-checkbox v-model="form.isReturn">退款</el-checkbox>
|
<el-checkbox v-model="form.isReturnPwd">退款</el-checkbox>
|
||||||
<el-checkbox v-model="form.isMemberIn">会员充值</el-checkbox>
|
<el-checkbox v-model="form.isMemberInPwd">会员充值</el-checkbox>
|
||||||
<el-checkbox v-model="form.isMemberReturn">会员退款</el-checkbox>
|
<el-checkbox v-model="form.isMemberReturnPwd">会员退款</el-checkbox>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="submitHandles">保存</el-button>
|
<el-button type="primary" @click="submitHandles">保存</el-button>
|
||||||
|
|
@ -43,6 +43,8 @@
|
||||||
<script>
|
<script>
|
||||||
import ShopApi from "@/api/account/shop";
|
import ShopApi from "@/api/account/shop";
|
||||||
|
|
||||||
|
import commonApi from "@/api/account/common";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -61,48 +63,48 @@ export default {
|
||||||
async getinfo() {
|
async getinfo() {
|
||||||
const res = await ShopApi.get();
|
const res = await ShopApi.get();
|
||||||
this.form = res;
|
this.form = res;
|
||||||
this.form.isReturn = this.form.isReturn == 1 ? true : false;
|
this.form.isReturnPwd = this.form.isReturnPwd == 1 ? true : false;
|
||||||
this.form.isMemberIn = this.form.isMemberIn == 1 ? true : false;
|
this.form.isMemberInPwd = this.form.isMemberInPwd == 1 ? true : false;
|
||||||
this.form.isMemberReturn = this.form.isMemberReturn == 1 ? true : false;
|
this.form.isMemberReturnPwd = this.form.isMemberReturnPwd == 1 ? true : false;
|
||||||
},
|
},
|
||||||
async submitHandle() {
|
async submitHandle() {
|
||||||
if (!this.form.prepareAmount) {
|
if (!this.form.prepareAmount) {
|
||||||
this.$message({
|
ElMessage({
|
||||||
message: "请输入验证码",
|
message: "请输入验证码",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.form.password) {
|
if (!this.form.password) {
|
||||||
this.$message({
|
ElMessage({
|
||||||
message: "请输入密码",
|
message: "请输入密码",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const res = await modfiyUserInfo({
|
const res = await ShopApi.edit({
|
||||||
|
id: this.form.id,
|
||||||
code: this.form.prepareAmount,
|
code: this.form.prepareAmount,
|
||||||
pwd: md5(this.form.password),
|
operationPwd: this.form.password,
|
||||||
});
|
});
|
||||||
console.log(222);
|
|
||||||
|
|
||||||
this.form.prepareAmount = "";
|
this.form.prepareAmount = "";
|
||||||
this.form.password = "******";
|
this.form.password = "******";
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
this.$message({
|
ElMessage({
|
||||||
message: "修改成功",
|
message: "修改成功",
|
||||||
type: "success",
|
type: "success",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async submitHandles() {
|
async submitHandles() {
|
||||||
const res = await tbShopInfoPUT({
|
const res = await ShopApi.edit({
|
||||||
// code: this.form.prepareAmount,
|
// code: this.form.prepareAmount,
|
||||||
// id: this.form.id,
|
// id: this.form.id,
|
||||||
// status:this.form.status,
|
// status:this.form.status,
|
||||||
...this.form,
|
...this.form,
|
||||||
isReturn: this.form.isReturn == true ? 1 : 0,
|
isReturnPwd: this.form.isReturnPwd == true ? 1 : 0,
|
||||||
isMemberIn: this.form.isMemberIn == true ? 1 : 0,
|
isMemberInPwd: this.form.isMemberInPwd == true ? 1 : 0,
|
||||||
isMemberReturn: this.form.isMemberReturn == true ? 1 : 0,
|
isMemberReturnPwd: this.form.isMemberReturnPwd == true ? 1 : 0,
|
||||||
});
|
});
|
||||||
this.$message({
|
ElMessage({
|
||||||
message: "修改成功",
|
message: "修改成功",
|
||||||
type: "success",
|
type: "success",
|
||||||
});
|
});
|
||||||
|
|
@ -112,8 +114,8 @@ export default {
|
||||||
this.disabled = false;
|
this.disabled = false;
|
||||||
},
|
},
|
||||||
async onSubmit() {
|
async onSubmit() {
|
||||||
const res = await sendMsg();
|
const res = await commonApi.sms({ type: "editShopInfoOpePwd" });
|
||||||
this.$message({
|
ElMessage({
|
||||||
message: "发送成功",
|
message: "发送成功",
|
||||||
type: "success",
|
type: "success",
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,10 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="da" v-if="item.is_print || item.is_print === null">打</span>
|
<span class="da" v-if="item.is_print || item.is_print === null">打</span>
|
||||||
<span class="isWaitCall" v-if="item.is_wait_call">等</span>
|
<span class="isWaitCall" v-if="item.is_wait_call">等</span>
|
||||||
<span class="tui" v-if="item.status === 'return'">退</span>
|
<span class="tui" v-if="item.returnNum">
|
||||||
|
退
|
||||||
|
<span class="number">{{ item.returnNum * 1 }}</span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex u-col-top">
|
<div class="flex u-col-top">
|
||||||
<div class="img">
|
<div class="img">
|
||||||
|
|
@ -350,7 +353,19 @@ onMounted(() => {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.tui {
|
||||||
|
.number {
|
||||||
|
background: #f56c6c;
|
||||||
|
color: #fff;
|
||||||
|
position: absolute;
|
||||||
|
left: -7px;
|
||||||
|
top: -7px;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
.da {
|
.da {
|
||||||
background: #35ac6a;
|
background: #35ac6a;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,175 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog title="选择挂账人" width="850px" v-model="show" top="20px">
|
||||||
|
<div class="app-container">
|
||||||
|
<div class="head-container filtration">
|
||||||
|
<div class="r">
|
||||||
|
<el-input
|
||||||
|
v-model="tableData.keywords"
|
||||||
|
placeholder="按挂账人或手机号"
|
||||||
|
style="width: 138px"
|
||||||
|
/>
|
||||||
|
<!-- <el-select
|
||||||
|
v-model="tableData.status"
|
||||||
|
placeholder="全部状态"
|
||||||
|
clearable
|
||||||
|
style="width: 123px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in options"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select> -->
|
||||||
|
<el-button type="primary" @click="getTableData()">查询</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="head-container content">
|
||||||
|
<el-table v-loading="tableData.loading" :data="tableData.data" @cell-click="cellClick">
|
||||||
|
<el-table-column label="ID" prop="id" />
|
||||||
|
|
||||||
|
<el-table-column label="挂账人" prop="debtor" />
|
||||||
|
<el-table-column label="手机号" prop="mobile" />
|
||||||
|
<el-table-column label="已挂账金额(元)" prop="owedAmount" />
|
||||||
|
<el-table-column label="可用挂账额度(元)" prop="remainingAmount" />
|
||||||
|
<el-table-column label="操作">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-button type="text" @click="cellClick(scope.row)">选择</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<div class="head-container">
|
||||||
|
<el-pagination
|
||||||
|
:total="tableData.total"
|
||||||
|
:current-page="tableData.page"
|
||||||
|
:page-size="tableData.size"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
@current-change="paginationChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import creditApi from "@/api/order/credit";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
show: false,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
value: "1",
|
||||||
|
label: "启用",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "0",
|
||||||
|
label: "停用",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
tableData: {
|
||||||
|
keywords: "",
|
||||||
|
status: "1",
|
||||||
|
data: [],
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
loading: false,
|
||||||
|
total: 0,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
// this.getTableData();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
cellClick(row) {
|
||||||
|
this.$emit("confirm", row);
|
||||||
|
this.show = false;
|
||||||
|
},
|
||||||
|
open() {
|
||||||
|
this.getTableData();
|
||||||
|
this.show = true;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取挂账人列表
|
||||||
|
*/
|
||||||
|
async getTableData() {
|
||||||
|
this.tableData.loading = true;
|
||||||
|
try {
|
||||||
|
const res = await creditApi.getList({
|
||||||
|
page: this.tableData.page,
|
||||||
|
size: this.tableData.size,
|
||||||
|
keywords: this.tableData.keywords,
|
||||||
|
status: this.tableData.status,
|
||||||
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
});
|
||||||
|
this.tableData.loading = false;
|
||||||
|
this.tableData.data = res.records;
|
||||||
|
this.tableData.total = res.totalRow * 1;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除挂账人
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
async delTableHandle(id) {
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
const res = await delCreditBuyer(id);
|
||||||
|
this.getTableData();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作
|
||||||
|
*/
|
||||||
|
openDialog(row, type) {
|
||||||
|
if (type === "add") {
|
||||||
|
this.$refs.creditAdd.show();
|
||||||
|
} else if (type === "edit") {
|
||||||
|
this.$refs.creditAdd.show(row);
|
||||||
|
} else if (type === "repayment" && row.repaymentMethod === "total") {
|
||||||
|
this.$refs.creditRepayment.show(row);
|
||||||
|
} else if (type === "rePaymentRecord") {
|
||||||
|
this.$refs.creditRepaymentRecord.show(row);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 重置查询
|
||||||
|
resetHandle() {
|
||||||
|
this.page = 1;
|
||||||
|
this.getTableData();
|
||||||
|
},
|
||||||
|
// 分页大小改变
|
||||||
|
sizeChange(e) {
|
||||||
|
this.tableData.size = e;
|
||||||
|
this.getTableData();
|
||||||
|
},
|
||||||
|
// 分页回调
|
||||||
|
paginationChange(e) {
|
||||||
|
this.tableData.page = e;
|
||||||
|
this.getTableData();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.title {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
.filtration {
|
||||||
|
overflow: hidden;
|
||||||
|
.l {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.r {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<div class="flex gap-20">
|
<div class="flex gap-20">
|
||||||
<el-button type="primary" @click="getTableData" size="medium">搜索</el-button>
|
<el-button type="primary" @click="getTableData">搜索</el-button>
|
||||||
<el-button @click="noChooseUser" size="medium">不选择用户</el-button>
|
<el-button @click="noChooseUser">不选择用户</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
|
|
||||||
<el-table-column label="操作" width="90" fixed="right">
|
<el-table-column label="操作" width="90" fixed="right">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-button type="primary" size="mini" @click="choose(scope.row)">选择</el-button>
|
<el-button type="primary" size="small" @click="choose(scope.row)">选择</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ const controls = ref([
|
||||||
{ label: "整单等叫", key: "", disabled: false, per: "all-wating" },
|
{ label: "整单等叫", key: "", disabled: false, per: "all-wating" },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const emits = defineEmits(["noteClick", "changePriceClick", "packClick"]);
|
const emits = defineEmits(["noteClick", "changePriceClick", "packClick", "return"]);
|
||||||
function controlsClick(item) {
|
function controlsClick(item) {
|
||||||
switch (item.key) {
|
switch (item.key) {
|
||||||
case "is_gift":
|
case "is_gift":
|
||||||
|
|
@ -99,7 +99,12 @@ const canEdit = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
function btnDisabled(item) {
|
function btnDisabled(item) {
|
||||||
return !perList.value.includes(item.per);
|
const canClick = perList.value.includes(item.per);
|
||||||
|
if (item.key == "return") {
|
||||||
|
return !canClick || carts.selCart.returnNum >= carts.selCart.number;
|
||||||
|
} else {
|
||||||
|
return !canClick;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function returnLabel(item) {
|
function returnLabel(item) {
|
||||||
if (item.key == "is_gift") {
|
if (item.key == "is_gift") {
|
||||||
|
|
|
||||||
|
|
@ -32,17 +32,37 @@
|
||||||
<div class="u-flex u-col-center u-m-t-10">
|
<div class="u-flex u-col-center u-m-t-10">
|
||||||
<span class="u-font-14 font-bold u-m-r-20">积分抵扣</span>
|
<span class="u-font-14 font-bold u-m-r-20">积分抵扣</span>
|
||||||
<el-radio-group v-model="score.sel" size="small" class="">
|
<el-radio-group v-model="score.sel" size="small" class="">
|
||||||
<el-radio :value="0">
|
<el-radio :value="-1">
|
||||||
|
<span class="u-font-14">不使用</span>
|
||||||
|
</el-radio>
|
||||||
|
<el-radio :value="0" :disabled="!pointsRes.usable">
|
||||||
<span class="u-font-14">全部抵扣</span>
|
<span class="u-font-14">全部抵扣</span>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
<el-radio :value="1">
|
<el-radio :value="1" :disabled="!pointsRes.usable">
|
||||||
<span class="u-font-14">部分抵扣</span>
|
<span class="u-font-14">部分抵扣</span>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
|
<el-input-number
|
||||||
|
class="u-m-l-10"
|
||||||
|
v-if="score.sel == 1"
|
||||||
|
v-model="usePointsNumber"
|
||||||
|
step-strictly
|
||||||
|
placeholder="请输入积分抵扣数量"
|
||||||
|
:min="pointsRes.minDeductionPoints"
|
||||||
|
:max="pointsRes.maxUsablePoints"
|
||||||
|
@change="pointsToMoney"
|
||||||
|
></el-input-number>
|
||||||
</div>
|
</div>
|
||||||
<p class="u-font-14 color-666 u-m-t-10">
|
<p
|
||||||
|
class="u-font-14 color-666 u-m-t-10"
|
||||||
|
v-if="pointsRes.unusableReason && !pointsRes.usable"
|
||||||
|
>
|
||||||
<span class="color-red">*</span>
|
<span class="color-red">*</span>
|
||||||
<span>积分不足或小于最低使用门槛1</span>
|
<span>{{ pointsRes.unusableReason }}</span>
|
||||||
|
</p>
|
||||||
|
<p class="u-font-14 color-666 u-m-t-10" v-else>
|
||||||
|
<span class="color-red">*</span>
|
||||||
|
<span>{{ pointsRes.equivalentPoints }}积分等于1元</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-col-center u-m-t-20 no-wrap">
|
<div class="u-flex u-col-center u-m-t-20 no-wrap">
|
||||||
|
|
@ -60,11 +80,58 @@
|
||||||
<el-icon><ArrowDown /></el-icon>
|
<el-icon><ArrowDown /></el-icon>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="u-m-t-20" v-if="quansSelArr.length > 0">
|
||||||
|
<div class="font-bold u-m-b-10">已选优惠券</div>
|
||||||
|
<el-table empty-text="未选择优惠券" :data="quansSelArr">
|
||||||
|
<el-table-column type="index" width="50" label="#"></el-table-column>
|
||||||
|
<el-table-column prop="name" label="券名称"></el-table-column>
|
||||||
|
<el-table-column label="券类型" width="80">
|
||||||
|
<template v-slot="scope">
|
||||||
|
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="商品信息" width="120">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<div class="u-flex" v-if="scope.row.type == 2">
|
||||||
|
<div class="u-flex">
|
||||||
|
<el-image
|
||||||
|
:src="scope.row.productImg"
|
||||||
|
fit="cover"
|
||||||
|
style="width: 40px; height: 40px"
|
||||||
|
:preview-src-list="[scope.row.productImg]"
|
||||||
|
></el-image>
|
||||||
|
</div>
|
||||||
|
<div class="u-p-l-10">
|
||||||
|
<div class="">{{ scope.row.productName }}</div>
|
||||||
|
<div class="">x{{ scope.row.num || "" }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="discountAmount" label="抵扣">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span class="color-red" v-if="scope.row.type == 1">
|
||||||
|
¥{{ scope.row.discountAmount }}
|
||||||
|
</span>
|
||||||
|
<span class="color-red" v-if="scope.row.type == 2">
|
||||||
|
¥{{ returnProDiscount(scope.row, scope.row.index) }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="useRestrictions" label="">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-button type="danger" size="small" @click="delQuan(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="u-m-t-30">
|
<div class="u-m-t-30">
|
||||||
<el-button size="large" @click="discountShow">整单打折/减免</el-button>
|
<el-button size="large" @click="discountShow">
|
||||||
|
{{ checkOrderPay.discount ? checkOrderPay.discount / 10 + "折" : "整单打折/减免" }}
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-m-t-30">
|
<div class="u-m-t-30">
|
||||||
<p class="u-font-16 font-bold u-m-r-20 font-bold u-flex">选择支付方式</p>
|
<p class="u-font-16 font-bold u-m-r-20 font-bold u-flex">选择支付方式</p>
|
||||||
|
|
@ -87,6 +154,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<h3>账单明细</h3>
|
<h3>账单明细</h3>
|
||||||
|
<p class="u-font-12 u-m-b-20">
|
||||||
|
<span class="color-red">*</span>
|
||||||
|
<span class="color-red">餐位费和打包费不参与折扣和满减</span>
|
||||||
|
</p>
|
||||||
<div class="order-info">
|
<div class="order-info">
|
||||||
<div class="u-flex u-m-b-10 u-row-between">
|
<div class="u-flex u-m-b-10 u-row-between">
|
||||||
<span class="title">订单号:</span>
|
<span class="title">订单号:</span>
|
||||||
|
|
@ -94,54 +165,69 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-m-b-10 u-row-between">
|
<div class="u-flex u-m-b-10 u-row-between">
|
||||||
<span class="title">餐位费</span>
|
<span class="title">餐位费</span>
|
||||||
<span class="u-m-l-10 value">¥{{ orderInfo.seatAmount }}</span>
|
<span class="u-m-l-10 value">¥{{ seatAmount }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-m-b-10 u-row-between">
|
<div class="u-flex u-m-b-10 u-row-between">
|
||||||
<span class="title">打包费</span>
|
<span class="title">打包费</span>
|
||||||
<span class="u-m-l-10 value">¥{{ orderInfo.packFee }}</span>
|
<span class="u-m-l-10 value">¥{{ carts.packFee }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-m-b-10 u-row-between">
|
<div class="u-flex u-m-b-10 u-row-between">
|
||||||
<span class="title">总价</span>
|
<span class="title">商品订单金额</span>
|
||||||
<span class="u-m-l-10 value">¥{{ carts.payMoney }}</span>
|
<span class="u-m-l-10 value">¥{{ carts.goodsTotal }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-m-b-10 u-row-between">
|
<div class="u-flex u-m-b-10 u-row-between">
|
||||||
<span class="title">优惠券</span>
|
<span class="title">商品优惠券</span>
|
||||||
<span class="u-m-l-10 value">¥{{ coupDiscount }}</span>
|
<span class="u-m-l-10 value">¥{{ productCouponDiscountAmount }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="u-flex u-m-b-10 u-row-between">
|
||||||
|
<span class="title">满减优惠券</span>
|
||||||
|
<span class="u-m-l-10 value">¥{{ fullCouponDiscountAmount }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="u-flex u-m-b-10 u-row-between">
|
||||||
|
<span class="title">整单改价</span>
|
||||||
|
<span class="u-m-l-10 value">-¥{{ discountAmount }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-m-b-10 u-row-between">
|
<div class="u-flex u-m-b-10 u-row-between">
|
||||||
<span class="title">积分抵扣</span>
|
<span class="title">积分抵扣</span>
|
||||||
<span class="u-m-l-10 value">-¥{{ orderInfo.pointsDiscountAmount || 0 }}</span>
|
<span class="u-m-l-10 value">-¥{{ pointsDiscountAmount }}</span>
|
||||||
</div>
|
|
||||||
<div class="u-flex u-m-b-10 u-row-between">
|
|
||||||
<span class="title">整单改价</span>
|
|
||||||
<span class="u-m-l-10 value">-¥{{ checkOrderPay.discountAmount || 0 }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-m-b-10 u-row-between">
|
<div class="u-flex u-m-b-10 u-row-between">
|
||||||
<span class="title">抹零</span>
|
<span class="title">抹零</span>
|
||||||
<span class="u-m-l-10 value">-¥{{ orderInfo.pointsDiscountAmount || 0 }}</span>
|
<span class="u-m-l-10 value">-¥{{ 0 }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-m-b-10 u-row-between">
|
<div class="u-flex u-m-b-10 u-row-between">
|
||||||
<span class="title">应付金额</span>
|
<span class="title">总价(商品订单金额-商品优惠券-满减券-整单改价-积分抵扣)</span>
|
||||||
|
<span class="u-m-l-10 value color-red">¥{{ totalMoney }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="u-flex u-m-b-10 u-row-between">
|
||||||
|
<span class="title">应付金额(总价+客座费+打包费)</span>
|
||||||
<span class="u-m-l-10 value price">¥{{ currentpayMoney }}</span>
|
<span class="u-m-l-10 value price">¥{{ currentpayMoney }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 扫码 -->
|
<!-- 扫码 -->
|
||||||
<scanPay
|
<scanPay ref="refScanPay" :order="orderInfo" @confirm="refScanPayConfirm"></scanPay>
|
||||||
ref="refScanPay"
|
|
||||||
:order="orderInfo"
|
|
||||||
@paySuccess="paySuccess"
|
|
||||||
@confirm="refScanPayConfirm"
|
|
||||||
></scanPay>
|
|
||||||
<!-- 打折 -->
|
<!-- 打折 -->
|
||||||
<discount ref="refDiscount" @confirm="discountConfirm"></discount>
|
<discount ref="refDiscount" @confirm="discountConfirm"></discount>
|
||||||
<!-- 优惠券 -->
|
<!-- 优惠券 -->
|
||||||
<popup-coupon ref="refCoupon" @confirm="refCouponConfirm"></popup-coupon>
|
<popup-coupon ref="refCoupon" :user="user" @confirm="refCouponConfirm"></popup-coupon>
|
||||||
|
<!-- 挂账 -->
|
||||||
|
<chooseGuaZahng
|
||||||
|
ref="refGuaZhang"
|
||||||
|
:payMoney="currentpayMoney"
|
||||||
|
@confirm="refGuaZhangConfirm"
|
||||||
|
></chooseGuaZahng>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import * as quanUtil from "../quan_util.js";
|
||||||
|
|
||||||
import { useCartsStore } from "@/store/modules/carts";
|
import { useCartsStore } from "@/store/modules/carts";
|
||||||
|
import { useUserStore } from "@/store/modules/user";
|
||||||
|
import chooseGuaZahng from "./popup-choose-guazhang.vue";
|
||||||
|
const shopUser = useUserStore();
|
||||||
const carts = useCartsStore();
|
const carts = useCartsStore();
|
||||||
|
|
||||||
import popupCoupon from "./popup-coupon.vue";
|
import popupCoupon from "./popup-coupon.vue";
|
||||||
|
|
@ -154,10 +240,56 @@ import discount from "./discount.vue";
|
||||||
import { ElLoading } from "element-plus";
|
import { ElLoading } from "element-plus";
|
||||||
import { ElMessage, ElMessageBox } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
|
|
||||||
|
//挂账
|
||||||
|
const refGuaZhang = ref();
|
||||||
|
function refGuaZhangConfirm(guazhangRen) {
|
||||||
|
payOrder("arrears", true, guazhangRen);
|
||||||
|
}
|
||||||
|
function refGuaZhangShow() {
|
||||||
|
refGuaZhang.value.open();
|
||||||
|
}
|
||||||
|
//商品列表
|
||||||
|
let goodsArr = [];
|
||||||
|
|
||||||
//优惠券
|
//优惠券
|
||||||
|
let $goodsPayPriceMap = {};
|
||||||
const refCoupon = ref();
|
const refCoupon = ref();
|
||||||
|
let quansSelArr = ref([]);
|
||||||
function openCoupon() {
|
function openCoupon() {
|
||||||
refCoupon.value.open();
|
refCoupon.value.open(carts.goodsTotal, props.orderInfo);
|
||||||
|
}
|
||||||
|
//返回商品券抵扣金额
|
||||||
|
function returnProDiscount(row) {
|
||||||
|
//相同商品抵扣券数组
|
||||||
|
const arr = quansSelArr.value.filter((v) => v.type == 2 && v.proId == row.proId);
|
||||||
|
console.log(arr);
|
||||||
|
const index = arr.findIndex((v) => v.id == row.id);
|
||||||
|
const item = goodsArr.find((v) => v.productId == row.proId);
|
||||||
|
if (index != -1) {
|
||||||
|
const n = quanUtil.returnProductCoupAllPrice(
|
||||||
|
$goodsPayPriceMap[row.proId],
|
||||||
|
index,
|
||||||
|
row.num,
|
||||||
|
props.user.id && props.user.isVip
|
||||||
|
);
|
||||||
|
return n.toFixed(2);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function refCouponConfirm(e, goodsPayPriceMap, goodsList) {
|
||||||
|
goodsArr = goodsList;
|
||||||
|
usePointsNumber.value = 0;
|
||||||
|
pointsDiscountAmount.value = 0;
|
||||||
|
score.sel = -1;
|
||||||
|
quansSelArr.value = e;
|
||||||
|
$goodsPayPriceMap = goodsPayPriceMap;
|
||||||
|
}
|
||||||
|
function delQuan(row) {
|
||||||
|
const index = quansSelArr.value.findIndex((v) => v.id == row.id);
|
||||||
|
if (index != -1) {
|
||||||
|
quansSelArr.value.splice(index, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function couponChange(data) {}
|
function couponChange(data) {}
|
||||||
|
|
||||||
|
|
@ -171,15 +303,14 @@ function discountConfirm(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
Object.assign(checkOrderPay, e);
|
Object.assign(checkOrderPay, e);
|
||||||
if (e.discount) {
|
if (e.discount) {
|
||||||
checkOrderPay.discountAmount =
|
checkOrderPay.discountAmount = carts.goodsTotal - (carts.goodsTotal * (100 - e.discount)) / 100;
|
||||||
carts.payMoney - (carts.payMoney * (e.discount / 100).toFixed(2)).toFixed(2);
|
|
||||||
} else {
|
} else {
|
||||||
checkOrderPay.discount = 0;
|
checkOrderPay.discount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function discountShow(e) {
|
function discountShow(e) {
|
||||||
refDiscount.value.open({
|
refDiscount.value.open({
|
||||||
amount: carts.payMoney,
|
amount: carts.goodsTotal - productCouponDiscountAmount.value,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -194,12 +325,24 @@ const props = defineProps({
|
||||||
return { id: "" };
|
return { id: "" };
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
perpole: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
orderInfo: {
|
orderInfo: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {},
|
default: () => {},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const seatAmount = computed(() => {
|
||||||
|
if (shopUser.userInfo.isTableFee) {
|
||||||
|
return "0.00";
|
||||||
|
}
|
||||||
|
if (props.perpole >= 1) {
|
||||||
|
return (props.perpole * shopUser.userInfo.tableFee).toFixed(2);
|
||||||
|
}
|
||||||
|
return "0.00";
|
||||||
|
});
|
||||||
watch(
|
watch(
|
||||||
() => props.user.id,
|
() => props.user.id,
|
||||||
(newval) => {
|
(newval) => {
|
||||||
|
|
@ -218,16 +361,45 @@ watch(
|
||||||
);
|
);
|
||||||
|
|
||||||
//002-获取订单可用积分及抵扣金额(支付页面使用)
|
//002-获取订单可用积分及抵扣金额(支付页面使用)
|
||||||
function pointsInit() {
|
const pointsRes = ref({ usable: true, maxUsablePoints: 0, minDeductionPoints: 0 });
|
||||||
if (!props.user.id) {
|
const usePointsNumber = ref(0);
|
||||||
|
const orderAmountOrderAmount = computed(() => {
|
||||||
|
return (carts.goodsTotal - checkOrderPay.discountAmount).toFixed(2);
|
||||||
|
});
|
||||||
|
const pointsDiscountAmount = ref(0);
|
||||||
|
watch(
|
||||||
|
() => orderAmountOrderAmount.value,
|
||||||
|
(newval) => {
|
||||||
|
pointsInit();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
async function pointsInit() {
|
||||||
|
if (!props.user.id || score.sel == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PointsApi.calcOrderUsablePoints({
|
const res = await PointsApi.calcOrderUsablePoints({
|
||||||
userId: props.user.id,
|
userId: props.user.id,
|
||||||
orderAmount: (carts.payMoney - checkOrderPay.discountAmount).toFixed(2),
|
orderAmount: currentpayMoney.value - pointsDiscountAmount.value,
|
||||||
});
|
});
|
||||||
|
pointsRes.value = res;
|
||||||
|
usePointsNumber.value = res.usable ? res.maxUsablePoints : 0;
|
||||||
|
if (res.usable) {
|
||||||
|
pointsToMoney();
|
||||||
|
} else {
|
||||||
|
score.sel = -1;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
// 根据积分计算可抵扣金额
|
||||||
|
async function pointsToMoney() {
|
||||||
|
const res = await PointsApi.calcPointsToMoney({
|
||||||
|
userId: props.user.id,
|
||||||
|
orderAmount: currentpayMoney.value - pointsDiscountAmount.value,
|
||||||
|
points: usePointsNumber.value,
|
||||||
|
});
|
||||||
|
pointsDiscountAmount.value = res;
|
||||||
}
|
}
|
||||||
|
|
||||||
const emits = defineEmits(["chooseUser", "paysuccess"]);
|
const emits = defineEmits(["chooseUser", "paysuccess"]);
|
||||||
function chooseUser() {
|
function chooseUser() {
|
||||||
emits("chooseUser");
|
emits("chooseUser");
|
||||||
|
|
@ -240,15 +412,27 @@ const coupDiscount = computed(() => {
|
||||||
}
|
}
|
||||||
return total.toFixed(2);
|
return total.toFixed(2);
|
||||||
});
|
});
|
||||||
const score = ref({
|
const score = reactive({
|
||||||
list: [],
|
list: [],
|
||||||
sel: 0,
|
sel: -1,
|
||||||
});
|
});
|
||||||
|
|
||||||
const payTypes = reactive({
|
const payTypes = reactive({
|
||||||
list: [],
|
list: [],
|
||||||
sel: 0,
|
sel: 0,
|
||||||
});
|
});
|
||||||
|
watch(
|
||||||
|
() => score.sel,
|
||||||
|
(newval) => {
|
||||||
|
console.log(newval);
|
||||||
|
if (newval == -1) {
|
||||||
|
usePointsNumber.value = 0;
|
||||||
|
pointsDiscountAmount.value = 0;
|
||||||
|
} else {
|
||||||
|
pointsInit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
function canUsePayType(item) {
|
function canUsePayType(item) {
|
||||||
if (currentpayMoney.value * 1 == 0) {
|
if (currentpayMoney.value * 1 == 0) {
|
||||||
return item.payType == "cash" ? false : true;
|
return item.payType == "cash" ? false : true;
|
||||||
|
|
@ -279,15 +463,17 @@ function returnPayParams() {
|
||||||
orderId: props.orderInfo.id,
|
orderId: props.orderInfo.id,
|
||||||
// discountRatio: (checkOrderPay.discount / 100).toFixed(2),
|
// discountRatio: (checkOrderPay.discount / 100).toFixed(2),
|
||||||
discountRatio: 0,
|
discountRatio: 0,
|
||||||
seatNum: props.orderInfo.seatNum,
|
seatNum: props.perpole * 1,
|
||||||
originAmount: carts.payMoney * 1,
|
originAmount: carts.payMoney * 1 - productCouponDiscountAmount.value + seatAmount.value * 1,
|
||||||
discountAmount: checkOrderPay.discountAmount * 1,
|
discountAmount: discountAmount.value,
|
||||||
productCouponDiscountAmount: props.orderInfo.productCouponDiscountAmount || 0,
|
productCouponDiscountAmount: productCouponDiscountAmount.value * 1,
|
||||||
orderAmount: currentpayMoney.value * 1,
|
orderAmount: currentpayMoney.value * 1,
|
||||||
roundAmount: props.orderInfo.roundAmount,
|
roundAmount: props.orderInfo.roundAmount,
|
||||||
pointsDiscountAmount: props.orderInfo.pointsDiscountAmount || 0,
|
pointsDiscountAmount: pointsDiscountAmount.value * 1,
|
||||||
pointsNum: props.orderInfo.pointsNum,
|
pointsNum: usePointsNumber.value * 1,
|
||||||
fullCouponDiscountAmount: props.orderInfo.fullCouponDiscountAmount || 0,
|
fullCouponDiscountAmount: fullCouponDiscountAmount.value * 1,
|
||||||
|
couponList: quansSelArr.value.map((v) => v.id),
|
||||||
|
userId: props.user.userId || "",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -303,11 +489,18 @@ function refScanPayOpen(payType) {
|
||||||
if (payType == "scanCode") {
|
if (payType == "scanCode") {
|
||||||
return refScanPay.value.open(returnPayParams(), "scanCode");
|
return refScanPay.value.open(returnPayParams(), "scanCode");
|
||||||
}
|
}
|
||||||
|
if (payType == "arrears") {
|
||||||
|
refGuaZhangShow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getPaytype() {
|
async function getPaytype() {
|
||||||
const res = await payTypeApi.getList();
|
const res = await payTypeApi.getList();
|
||||||
payTypes.list = res;
|
payTypes.list = res;
|
||||||
|
if (currentpayMoney.value * 1 <= 0) {
|
||||||
|
payTypes.sel = payTypes.list.findIndex((v) => v.payType == "cash");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function nowPayClick(payType) {
|
function nowPayClick(payType) {
|
||||||
payType = payType || payTypes.list[payTypes.sel].payType;
|
payType = payType || payTypes.list[payTypes.sel].payType;
|
||||||
|
|
@ -330,6 +523,7 @@ function nowPayClick(payType) {
|
||||||
payOrder(payType);
|
payOrder(payType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
refScanPayOpen(payType);
|
refScanPayOpen(payType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -342,7 +536,7 @@ function refScanPayConfirm($authCode, isScan) {
|
||||||
|
|
||||||
let payTimer = null;
|
let payTimer = null;
|
||||||
//是否是正扫
|
//是否是正扫
|
||||||
async function payOrder(payType, isScan) {
|
async function payOrder(payType, isScan, guazhangren) {
|
||||||
clearTimeout(payTimer);
|
clearTimeout(payTimer);
|
||||||
const loading = ElLoading.service({
|
const loading = ElLoading.service({
|
||||||
lock: true,
|
lock: true,
|
||||||
|
|
@ -374,6 +568,9 @@ async function payOrder(payType, isScan) {
|
||||||
shopUserId: props.user.id,
|
shopUserId: props.user.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (payType == "arrears") {
|
||||||
|
res = await payApi.creditPay({ ...returnPayParams(), creditBuyerId: guazhangren.id });
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
clearTimeout(payTimer);
|
clearTimeout(payTimer);
|
||||||
|
|
@ -387,13 +584,43 @@ async function payOrder(payType, isScan) {
|
||||||
loading.close();
|
loading.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//整单改价
|
||||||
|
const discountAmount = computed(() => {
|
||||||
|
const money = carts.goodsTotal - productCouponDiscountAmount.value;
|
||||||
|
if (checkOrderPay.discount) {
|
||||||
|
return ((money * (100 - checkOrderPay.discount)) / 100).toFixed(2);
|
||||||
|
}
|
||||||
|
return checkOrderPay.discountAmount;
|
||||||
|
});
|
||||||
|
//满减优惠券
|
||||||
|
const fullCouponDiscountAmount = computed(() => {
|
||||||
|
return quansSelArr.value
|
||||||
|
.reduce((pre, cur) => {
|
||||||
|
return pre + cur.discountAmount;
|
||||||
|
}, 0)
|
||||||
|
.toFixed(2);
|
||||||
|
});
|
||||||
|
//商品券抵扣金额
|
||||||
|
const productCouponDiscountAmount = computed(() => {
|
||||||
|
let index = -1;
|
||||||
|
return quansSelArr.value.reduce((pre, cur) => {
|
||||||
|
index++;
|
||||||
|
return pre + returnProDiscount(cur, index) * 1;
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
//除开客座费,打包费总金额
|
||||||
|
const totalMoney = computed(() => {
|
||||||
|
return (
|
||||||
|
carts.goodsTotal -
|
||||||
|
productCouponDiscountAmount.value -
|
||||||
|
discountAmount.value -
|
||||||
|
fullCouponDiscountAmount.value -
|
||||||
|
pointsDiscountAmount.value
|
||||||
|
).toFixed(2);
|
||||||
|
});
|
||||||
//应付金额
|
//应付金额
|
||||||
const currentpayMoney = computed(() => {
|
const currentpayMoney = computed(() => {
|
||||||
if (checkOrderPay.discount) {
|
return (totalMoney.value * 1 + carts.packFee * 1 + seatAmount.value * 1).toFixed(2);
|
||||||
return (carts.payMoney * (checkOrderPay.discount / 100)).toFixed(2);
|
|
||||||
}
|
|
||||||
return (carts.payMoney - checkOrderPay.discountAmount).toFixed(2);
|
|
||||||
});
|
});
|
||||||
watch(
|
watch(
|
||||||
() => currentpayMoney.value,
|
() => currentpayMoney.value,
|
||||||
|
|
@ -405,7 +632,6 @@ watch(
|
||||||
);
|
);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getPaytype();
|
getPaytype();
|
||||||
pointsInit();
|
|
||||||
});
|
});
|
||||||
defineExpose({
|
defineExpose({
|
||||||
nowPayClick,
|
nowPayClick,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,353 @@
|
||||||
|
<template>
|
||||||
|
<div class="select_desk">
|
||||||
|
<el-dialog width="410px" title="挂账" v-model="show" @close="reset">
|
||||||
|
<div class="guazhangren u-flex u-row-between" @click="guazhangShow">
|
||||||
|
<template v-if="guazhangRen">
|
||||||
|
<div>
|
||||||
|
<div class="name">{{ guazhangRen.debtor }}/{{ guazhangRen.position }}</div>
|
||||||
|
<div class="u-m-t-6">手机号:{{ guazhangRen.mobile }}</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="">可用额度</div>
|
||||||
|
<div class="u-m-t-6">{{ guazhangRen.remainingAmount }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div class="color-999">选择挂账人/单位</div>
|
||||||
|
<span class="el-icon-caret-bottom"></span>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<div class="select_desk_dialog u-p-b-20">
|
||||||
|
<div class="u-p-l-20 u-p-r-20 u-flex w-full u-relative box_status">
|
||||||
|
<div class="font-bold u-font-32">¥</div>
|
||||||
|
<el-input
|
||||||
|
placeholder="请输入挂账金额"
|
||||||
|
v-model="number"
|
||||||
|
@input="inputNumber"
|
||||||
|
@change="inputChange"
|
||||||
|
@focus="inputFocus"
|
||||||
|
@blur="inputBlur"
|
||||||
|
:type="focus ? 'number' : 'text'"
|
||||||
|
></el-input>
|
||||||
|
<div class="zhezhao"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="confirm_btns">
|
||||||
|
<el-button size="large" @click="close">取消</el-button>
|
||||||
|
<el-button type="primary" size="large" @click="confirm">确定</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<choose-guazhang ref="refChooseGuazhang" @confirm="chooseGuazhangConfirm"></choose-guazhang>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
import keyBoard from "./keyboard.vue";
|
||||||
|
import chooseGuazhang from "./choose-guazhang.vue";
|
||||||
|
export default {
|
||||||
|
components: { keyBoard, chooseGuazhang },
|
||||||
|
props: {
|
||||||
|
payMoney: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
guazhangRen: "",
|
||||||
|
number: "",
|
||||||
|
show: false,
|
||||||
|
hasOpen: false,
|
||||||
|
loading: false,
|
||||||
|
tips: "",
|
||||||
|
focus: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
number(newval) {
|
||||||
|
console.log(newval);
|
||||||
|
if (newval * 1 > this.payMoney * 1) {
|
||||||
|
this.number = this.payMoney;
|
||||||
|
this.number = newval;
|
||||||
|
}
|
||||||
|
if (newval * 1 > this.payMoney * 1) {
|
||||||
|
this.tips = "已超出未结账金额";
|
||||||
|
} else {
|
||||||
|
const shengyu = this.payMoney - this.number;
|
||||||
|
|
||||||
|
this.tips = shengyu > 0 ? "还需额外支付" + shengyu.toFixed(2) + "元" : "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
inputFocus() {
|
||||||
|
this.focus = true;
|
||||||
|
},
|
||||||
|
inputBlur() {
|
||||||
|
this.focus = false;
|
||||||
|
},
|
||||||
|
chooseGuazhangConfirm(e) {
|
||||||
|
this.guazhangRen = e;
|
||||||
|
},
|
||||||
|
guazhangShow() {
|
||||||
|
this.$refs.refChooseGuazhang.open();
|
||||||
|
},
|
||||||
|
|
||||||
|
inputNumber(e) {
|
||||||
|
console.log("inputNumber");
|
||||||
|
if (e * 1 > this.payMoney * 1) {
|
||||||
|
this.tips = "已超出未结账金额";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
inputChange(e) {
|
||||||
|
if (e * 1 > this.payMoney * 1) {
|
||||||
|
this.tips = "已超出未结账金额";
|
||||||
|
}
|
||||||
|
console.log(e);
|
||||||
|
},
|
||||||
|
clear(e) {
|
||||||
|
console.log(e);
|
||||||
|
this.number = "";
|
||||||
|
},
|
||||||
|
confirm() {
|
||||||
|
if (this.number * 1 > this.payMoney * 1) {
|
||||||
|
return ElMessage("已超出未结账金额");
|
||||||
|
}
|
||||||
|
if (this.number * 1 <= 0) {
|
||||||
|
return ElMessage("支付金额不正确");
|
||||||
|
}
|
||||||
|
if (!this.guazhangRen) {
|
||||||
|
return ElMessage("请选择挂账人");
|
||||||
|
}
|
||||||
|
this.$emit("confirm", this.guazhangRen, this.number);
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
open() {
|
||||||
|
console.log(this.payMoney);
|
||||||
|
this.number = this.payMoney * 1;
|
||||||
|
this.show = true;
|
||||||
|
this.tips = "还需额外支付" + this.payMoney + "元";
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
this.number = "";
|
||||||
|
this.guazhangRen = "";
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.show = false;
|
||||||
|
this.number = "";
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.el-button) {
|
||||||
|
padding: 12px 20px;
|
||||||
|
}
|
||||||
|
.box_status {
|
||||||
|
margin-bottom: 0;
|
||||||
|
margin-top: 30px;
|
||||||
|
width: 370px;
|
||||||
|
height: 58px;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #dcdfe6;
|
||||||
|
}
|
||||||
|
:deep(.el-input__wrapper) {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
:deep(.select_desk_dialog .el-input__inner) {
|
||||||
|
border: none;
|
||||||
|
font-size: 32px;
|
||||||
|
}
|
||||||
|
:deep(.el-input__inner::-webkit-inner-spin-button) {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
:deep(.el-input__inner::-webkit-outer-spin-button) {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
:deep(.el-button--success) {
|
||||||
|
border-color: #22bf64;
|
||||||
|
background-color: #22bf64;
|
||||||
|
}
|
||||||
|
.select_desk .btn {
|
||||||
|
height: 34px;
|
||||||
|
}
|
||||||
|
.tags {
|
||||||
|
font-size: 16px;
|
||||||
|
&.using {
|
||||||
|
color: rgb(234, 64, 37);
|
||||||
|
}
|
||||||
|
&.wait {
|
||||||
|
color: rgb(252, 236, 79);
|
||||||
|
}
|
||||||
|
&.idle {
|
||||||
|
color: rgb(137, 234, 71);
|
||||||
|
}
|
||||||
|
&.closed {
|
||||||
|
color: rgb(221, 221, 221);
|
||||||
|
filter: grayscale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
:deep(.inputs .el-input__inner) {
|
||||||
|
border-color: transparent !important;
|
||||||
|
color: rgba(0, 0, 0, 0.8);
|
||||||
|
letter-spacing: 1.25px;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
.select_desk .select_desk_dialog {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select_desk .select_desk_dialog .nav {
|
||||||
|
width: 286px;
|
||||||
|
height: 38px;
|
||||||
|
background: #dcf0e8;
|
||||||
|
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select_desk .select_desk_dialog .nav .li,
|
||||||
|
.select_desk .select_desk_dialog .nav {
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select_desk .select_desk_dialog .nav .li {
|
||||||
|
width: 140px;
|
||||||
|
height: 34px;
|
||||||
|
color: #0fc161;
|
||||||
|
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select_desk .select_desk_dialog .nav .lion {
|
||||||
|
background: #0fc161;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select_desk .select_desk_dialog .inputs {
|
||||||
|
width: 370px;
|
||||||
|
line-height: 54px;
|
||||||
|
margin-top: 24px;
|
||||||
|
height: 54px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #dcdfe6;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: rgba(0, 0, 0, 0.8);
|
||||||
|
letter-spacing: 1.25px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 20px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.zhezhao {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.select_desk .select_desk_dialog .inputs .close {
|
||||||
|
color: #aaa;
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
height: 30px;
|
||||||
|
width: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
top: 50%;
|
||||||
|
margin-top: -15px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.guazhangren {
|
||||||
|
padding: 12px 10px;
|
||||||
|
border: 1px solid #dcdfe6;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-top: 20px;
|
||||||
|
min-height: 58px;
|
||||||
|
color: #999;
|
||||||
|
cursor: pointer;
|
||||||
|
.name {
|
||||||
|
color: #3f9eff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.select_desk .select_desk_dialog .keyboard {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
flex-wrap: wrap;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border-right: 1px solid #dcdfe6;
|
||||||
|
border-bottom: 1px solid #dcdfe6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select_desk .select_desk_dialog .keyboard .li {
|
||||||
|
height: 60px;
|
||||||
|
width: 33.333%;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
align-items: center;
|
||||||
|
font-size: 24px;
|
||||||
|
color: #212121;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
user-select: none;
|
||||||
|
border-left: 1px solid #dcdfe6;
|
||||||
|
border-top: 1px solid #dcdfe6;
|
||||||
|
|
||||||
|
transition: all 0.1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select_desk .select_desk_dialog .keyboard .li:hover {
|
||||||
|
background: #dcdfe6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select_desk .select_desk_dialog .keyboard .li .icon {
|
||||||
|
font-size: 1.3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select_desk .select_desk_dialog .keyboard .confirm {
|
||||||
|
height: 140px;
|
||||||
|
background: #ff9f2e;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select_desk .select_desk_dialog .keyboard .confirm:hover {
|
||||||
|
background: #f88502;
|
||||||
|
}
|
||||||
|
|
||||||
|
.confirm_btns {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.confirm_btns .el-button {
|
||||||
|
width: 175px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -14,23 +14,23 @@
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
@change="fullReductionCouponClick(scope.row)"
|
@change="fullReductionCouponClick(scope.row)"
|
||||||
:value="scope.row.id == fullReductionCouponSel.id"
|
:model-value="scope.row.id == fullReductionCouponSel.id"
|
||||||
></el-checkbox>
|
></el-checkbox>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column type="index" label="#"></el-table-column>
|
<el-table-column type="index" label="#"></el-table-column>
|
||||||
<el-table-column prop="name" label="券名称"></el-table-column>
|
<el-table-column prop="name" label="券名称"></el-table-column>
|
||||||
<el-table-column label="券类型" width="80">
|
<!-- <el-table-column label="券类型" width="80">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column prop="discountAmount" label="抵扣">
|
<el-table-column prop="discountAmount" label="抵扣">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<span class="color-red">¥{{ scope.row.discountAmount }}</span>
|
<span class="color-red">¥{{ scope.row.discountAmount }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="discountAmount" label="限制" width="120">
|
<el-table-column prop="discountAmount" label="限制" width="180">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<div class="u-flex">
|
<div class="u-flex">
|
||||||
<span>支付满</span>
|
<span>支付满</span>
|
||||||
|
|
@ -52,31 +52,31 @@
|
||||||
:data="quans.productCoupon"
|
:data="quans.productCoupon"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
>
|
>
|
||||||
<el-table-column>
|
<el-table-column width="80">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
@change="productCouponClick(scope.row)"
|
@change="productCouponClick(scope.row)"
|
||||||
:value="scope.row.checked"
|
:model-value="scope.row.checked"
|
||||||
></el-checkbox>
|
></el-checkbox>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column type="index" width="50" label="#"></el-table-column>
|
<el-table-column type="index" width="50" label="#"></el-table-column>
|
||||||
<el-table-column prop="name" label="券名称"></el-table-column>
|
<el-table-column prop="name" label="券名称"></el-table-column>
|
||||||
|
|
||||||
<el-table-column label="商品信息" width="120">
|
<el-table-column label="商品信息" width="220">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<div class="u-flex">
|
<div class="u-flex">
|
||||||
<div class="u-flex">
|
<div class="u-flex">
|
||||||
<el-image
|
<el-image
|
||||||
:src="scope.row.productCover"
|
:src="scope.row.productImg"
|
||||||
fit="cover"
|
fit="cover"
|
||||||
style="width: 40px; height: 40px"
|
style="width: 40px; height: 40px"
|
||||||
:preview-src-list="[scope.row.productCover]"
|
:preview-src-list="[scope.row.productImg]"
|
||||||
></el-image>
|
></el-image>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-p-l-10">
|
<div class="u-p-l-10">
|
||||||
<div class="">{{ scope.row.productName }}</div>
|
<div class="">{{ scope.row.productName }}</div>
|
||||||
<div class="">x{{ scope.row.num || "" }}</div>
|
<div class="">x{{ scope.row.num || 1 }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -88,11 +88,11 @@
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column> -->
|
</el-table-column> -->
|
||||||
<el-table-column label="券类型">
|
<!-- <el-table-column label="券类型">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column prop="useRestrictions" label="描述"></el-table-column>
|
<el-table-column prop="useRestrictions" label="描述"></el-table-column>
|
||||||
<!-- <el-table-column prop="useRestrictions" label="是否可用">
|
<!-- <el-table-column prop="useRestrictions" label="是否可用">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
|
|
@ -117,15 +117,15 @@
|
||||||
<div class="u-flex" v-if="scope.row.type == 2">
|
<div class="u-flex" v-if="scope.row.type == 2">
|
||||||
<div class="u-flex">
|
<div class="u-flex">
|
||||||
<el-image
|
<el-image
|
||||||
:src="scope.row.productCover"
|
:src="scope.row.productImg"
|
||||||
fit="cover"
|
fit="cover"
|
||||||
style="width: 40px; height: 40px"
|
style="width: 40px; height: 40px"
|
||||||
:preview-src-list="[scope.row.productCover]"
|
:preview-src-list="[scope.row.productImg]"
|
||||||
></el-image>
|
></el-image>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-p-l-10">
|
<div class="u-p-l-10">
|
||||||
<div class="">{{ scope.row.productName }}</div>
|
<div class="">{{ scope.row.productName }}</div>
|
||||||
<div class="">x{{ scope.row.num || "" }}</div>
|
<div class="">x{{ scope.row.num || 1 }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -143,7 +143,7 @@
|
||||||
<el-table-column prop="useRestrictions" label="描述"></el-table-column>
|
<el-table-column prop="useRestrictions" label="描述"></el-table-column>
|
||||||
<el-table-column prop="useRestrictions" label="">
|
<el-table-column prop="useRestrictions" label="">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-button type="danger" size="mini" @click="delQuan(scope.row)">删除</el-button>
|
<el-button type="danger" size="small" @click="delQuan(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -166,14 +166,17 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-row-center u-m-t-50">
|
<div class="u-flex u-row-center u-m-t-50">
|
||||||
<el-button size="medium" @click="close">取消</el-button>
|
<el-button size="large" @click="close">取消</el-button>
|
||||||
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
|
<el-button size="large" type="primary" @click="confirm">确定</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import couponApi from "@/api/account/coupon";
|
||||||
|
import { ElMessageBox } from "element-plus";
|
||||||
|
import * as quanUtil from "../quan_util.js";
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
@ -183,7 +186,7 @@ const props = defineProps({
|
||||||
type: Array,
|
type: Array,
|
||||||
default: [],
|
default: [],
|
||||||
},
|
},
|
||||||
vipUser: {
|
user: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {
|
return {
|
||||||
|
|
@ -196,7 +199,6 @@ function tabClick() {}
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
discount: 1,
|
discount: 1,
|
||||||
orderPrice: 0,
|
|
||||||
fullReductionCouponSel: {
|
fullReductionCouponSel: {
|
||||||
id: "",
|
id: "",
|
||||||
},
|
},
|
||||||
|
|
@ -216,36 +218,210 @@ const state = reactive({
|
||||||
|
|
||||||
const {
|
const {
|
||||||
discount,
|
discount,
|
||||||
orderPrice,
|
|
||||||
fullReductionCouponSel,
|
fullReductionCouponSel,
|
||||||
quansSelArr,
|
quansSelArr,
|
||||||
quans,
|
quans,
|
||||||
currentRow,
|
currentRow,
|
||||||
multipleSelection,
|
multipleSelection,
|
||||||
fullReductionCouponSelId,
|
|
||||||
activeName,
|
activeName,
|
||||||
form,
|
form,
|
||||||
show,
|
show,
|
||||||
isSetProductCoup,
|
isSetProductCoup,
|
||||||
} = toRefs(state);
|
} = toRefs(state);
|
||||||
const AllCouponPrice = computed(() => {
|
|
||||||
return 0;
|
let orderPrice = ref(0);
|
||||||
});
|
let $originFullReductionCoupon = [];
|
||||||
const payPrice = computed(() => {
|
//可以抵扣的商品列表
|
||||||
return 0;
|
let canDikouGoodsArr = [];
|
||||||
});
|
//商品数量从0到n每一个对应的价格
|
||||||
function open() {
|
let $goodsPayPriceMap = {};
|
||||||
|
let goodsArr = [];
|
||||||
|
|
||||||
|
function open(money, orderInfo) {
|
||||||
|
let arr = [];
|
||||||
|
for (let i in orderInfo.detailMap) {
|
||||||
|
arr.push(...orderInfo.detailMap[i]);
|
||||||
|
}
|
||||||
|
goodsArr = arr;
|
||||||
|
$goodsPayPriceMap = quanUtil.returnGoodsPayPriceMap(goodsArr || []);
|
||||||
|
canDikouGoodsArr = quanUtil.returnNewGoodsList(goodsArr);
|
||||||
|
console.log(canDikouGoodsArr);
|
||||||
|
getcoup();
|
||||||
|
orderPrice.value = money;
|
||||||
show.value = true;
|
show.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getcoup() {
|
||||||
|
const res = await couponApi.findCoupon({ shopUserId: props.user.id });
|
||||||
|
quans.value.fullReductionCoupon = res.filter(
|
||||||
|
(v) => v.type == 1 && orderPrice.value * 1 >= v.fullAmount * 1
|
||||||
|
);
|
||||||
|
quans.value.productCoupon = res
|
||||||
|
.filter((v) => v.type == 2 && canDikouGoodsArr.find((goods) => v.proId == goods.productId))
|
||||||
|
.map((v) => {
|
||||||
|
const findGoods = goodsArr.find((goods) => goods.productId == v.proId);
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
productImg: findGoods ? findGoods.productImg : "",
|
||||||
|
productName: findGoods ? findGoods.productName : "",
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function fullReductionCouponClick(row) {
|
||||||
|
if (row.id == fullReductionCouponSel.value.id) {
|
||||||
|
fullReductionCouponSel.value = { id: "" };
|
||||||
|
quansSelArr.value.splice(0, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const dikouQuan = quansSelArr.value[0];
|
||||||
|
fullReductionCouponSel.value = row;
|
||||||
|
if (dikouQuan && dikouQuan.type == 1) {
|
||||||
|
quansSelArr.value[0] = row;
|
||||||
|
} else {
|
||||||
|
quansSelArr.value.unshift(row);
|
||||||
|
}
|
||||||
|
if (!fullReductionCouponSel.value.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const AllCouponPrice = computed(() => {
|
||||||
|
return quanUtil.returnCouponAllPrice(quansSelArr.value, canDikouGoodsArr, props.user);
|
||||||
|
});
|
||||||
|
|
||||||
|
const payPrice = computed(() => {
|
||||||
|
return (orderPrice.value - AllCouponPrice.value).toFixed(2);
|
||||||
|
});
|
||||||
|
function productCouponClick(item) {
|
||||||
|
if (!item.use) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const hasSelNum = quansSelArr.value
|
||||||
|
.filter((v) => v.type == 2 && v.proId == item.proId)
|
||||||
|
.reduce((a, b) => {
|
||||||
|
return a + (b.num || 1);
|
||||||
|
}, 0);
|
||||||
|
console.log($goodsPayPriceMap[item.proId]);
|
||||||
|
const maxSelNum = $goodsPayPriceMap[item.proId].length;
|
||||||
|
const coupMaxUseNum = Math.min(item.num || 1, maxSelNum - hasSelNum);
|
||||||
|
const canUseNum = Math.min(maxSelNum, coupMaxUseNum);
|
||||||
|
console.log("maxSelNum", maxSelNum);
|
||||||
|
console.log("coupMaxUseNum", coupMaxUseNum);
|
||||||
|
console.log("canUseNum", canUseNum);
|
||||||
|
if (!item.checked && canUseNum <= 0) {
|
||||||
|
return ElMessage.error("购物车该商品券可使用最大数量为" + maxSelNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fullReductionCouponSel.value.id && !item.checked) {
|
||||||
|
const goodsQuan = quans.value.productCoupon.filter((v) => v.checked);
|
||||||
|
const fullReductionCoupon = fullReductionCouponSel.value.id
|
||||||
|
? [fullReductionCouponSel.value]
|
||||||
|
: [];
|
||||||
|
|
||||||
|
let coupArr = [...goodsQuan, { ...item, num: canUseNum }];
|
||||||
|
const payPrice =
|
||||||
|
orderPrice.value - quanUtil.returnCouponAllPrice(coupArr, canDikouGoodsArr, props.user);
|
||||||
|
console.log(payPrice);
|
||||||
|
if (payPrice <= 0) {
|
||||||
|
return ElMessageBox.confirm(
|
||||||
|
"选择该商品券后支付金额将为0,继续选择将取消选择的满减券",
|
||||||
|
"提示",
|
||||||
|
{
|
||||||
|
confirmButtonText: "继续选择",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
fullReductionCouponSel.value = {
|
||||||
|
id: "",
|
||||||
|
};
|
||||||
|
quansSelArr.value.splice(0, 1);
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
if (fullReductionCouponSel.value.fullAmount > payPrice) {
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
"选择该商品券后将不满足选择抵扣券的最低满减需求,继续选择将取消选择的满减券",
|
||||||
|
"提示",
|
||||||
|
{
|
||||||
|
confirmButtonText: "继续选择",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
fullReductionCouponSel.value = {
|
||||||
|
id: "",
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
item.checked = false;
|
||||||
|
const index = quansSelArr.value.findIndex((v) => v.id == item.id);
|
||||||
|
quansSelArr.value.splice(index, 1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item.checked = !item.checked;
|
||||||
|
if (!item.checked) {
|
||||||
|
const index = quansSelArr.value.findIndex((v) => v.id == item.id);
|
||||||
|
quansSelArr.value.splice(index, 1);
|
||||||
|
} else {
|
||||||
|
quansSelArr.value.push({ ...item, num: canUseNum });
|
||||||
|
}
|
||||||
|
const CheckedArr = quans.value.productCoupon.filter((v) => v.checked);
|
||||||
|
if (CheckedArr.length <= 0) {
|
||||||
|
return quans.value.productCoupon.map((v) => {
|
||||||
|
v.use = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const noCheckedArr = quans.value.productCoupon.filter((v) => !v.checked);
|
||||||
|
noCheckedArr.map((v) => {
|
||||||
|
v.use = quanUtil.returnCoupCanUse(canDikouGoodsArr, v, CheckedArr);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//返回商品券抵扣金额
|
||||||
|
function returnProDiscount(row) {
|
||||||
|
//相同商品抵扣券数组
|
||||||
|
const arr = quansSelArr.value.filter((v) => v.type == 2 && v.proId == row.proId);
|
||||||
|
const index = arr.findIndex((v) => v.id == row.id);
|
||||||
|
const item = goodsArr.find((v) => v.productId == row.proId);
|
||||||
|
if (index != -1) {
|
||||||
|
const n = quanUtil.returnProductCoupAllPrice(
|
||||||
|
$goodsPayPriceMap[row.proId],
|
||||||
|
index,
|
||||||
|
row.num,
|
||||||
|
props.user.id && props.user.isVip
|
||||||
|
);
|
||||||
|
return n.toFixed(2);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//删除选中的优惠券
|
||||||
|
function delQuan(row) {
|
||||||
|
const index = quansSelArr.value.findIndex((item) => item.id == row.id);
|
||||||
|
if (row.type == 2 && index != -1) {
|
||||||
|
quansSelArr.value.splice(index, 1);
|
||||||
|
const proIndex = quans.value.productCoupon.findIndex((v) => v.id == row.id);
|
||||||
|
quans.value.productCoupon[proIndex].checked = false;
|
||||||
|
}
|
||||||
|
if (row.type == 1 && index != -1) {
|
||||||
|
fullReductionCouponSel.value = { id: "" };
|
||||||
|
quansSelArr.value.splice(0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
function close() {
|
function close() {
|
||||||
show.value = false;
|
show.value = false;
|
||||||
}
|
}
|
||||||
const emits = defineEmits(["confirm"]);
|
const emits = defineEmits(["confirm"]);
|
||||||
function confirm() {
|
function reset() {
|
||||||
emits("confirm");
|
quansSelArr.value = [];
|
||||||
|
fullReductionCouponSel.value = { id: "" };
|
||||||
|
}
|
||||||
|
function confirm() {
|
||||||
|
emits("confirm", [...quansSelArr.value], $goodsPayPriceMap, goodsArr);
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
function reset() {}
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
close,
|
close,
|
||||||
open,
|
open,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,196 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog title="退菜" width="410px" v-model="show" @close="reset" :modal="modal">
|
||||||
|
<div class="u-p-b-16">
|
||||||
|
<div class="flex u-row-between">
|
||||||
|
<span>菜品名称</span>
|
||||||
|
<div class="u-flex">
|
||||||
|
{{ goods.name || "" }}
|
||||||
|
</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-p-b-16 border-bottom">
|
||||||
|
<div class="flex u-row-between">
|
||||||
|
<span>退菜数量</span>
|
||||||
|
<div class="u-flex" v-if="!isSeatFee">
|
||||||
|
<el-input-number v-model="number" :min="1" step-strictly :max="max"></el-input-number>
|
||||||
|
</div>
|
||||||
|
<div class="u-flex" v-else>
|
||||||
|
{{ 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-10 u-font-12 color-999">菜品已点数量 {{ max }} 份</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" placeholder="请输入自定义备注"></el-input>
|
||||||
|
</div>
|
||||||
|
<div class="u-m-t-20">
|
||||||
|
<el-checkbox v-model="isPrint">打印退菜单</el-checkbox>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div>
|
||||||
|
<el-button @click="close">取消</el-button>
|
||||||
|
<el-button 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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
max: 1,
|
||||||
|
number: 1,
|
||||||
|
isPrint: false,
|
||||||
|
tagSel: -1,
|
||||||
|
show: false,
|
||||||
|
tags: [
|
||||||
|
{ label: "不想要了", checked: false },
|
||||||
|
{ label: "食材不足", checked: false },
|
||||||
|
{ label: "等待时间过长", checked: false },
|
||||||
|
],
|
||||||
|
note: "",
|
||||||
|
goods: {
|
||||||
|
productId: -999,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isSeatFee() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
changeSel(item) {
|
||||||
|
item.checked = !item.checked;
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
this.note = "";
|
||||||
|
this.number = 1;
|
||||||
|
this.tags.map((v) => {
|
||||||
|
v.checked = false;
|
||||||
|
});
|
||||||
|
console.log(this.number);
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
this.max = item.num - item.returnNum;
|
||||||
|
this.show = true;
|
||||||
|
if (item.productId != "-999") {
|
||||||
|
this.number = 1;
|
||||||
|
} else {
|
||||||
|
this.number = this.max;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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", {
|
||||||
|
refundReason: note,
|
||||||
|
refundAmount: 0,
|
||||||
|
refundDetails: [{ id: this.goods.id, num: this.number, returnAmount: 0 }],
|
||||||
|
});
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.el-dialog__body) {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
margin-top: 14px;
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
: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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
:deep(.number-box .el-input__inner::-webkit-inner-spin-button) {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
:deep(.number-box .el-input__inner::-webkit-outer-spin-button) {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -122,7 +122,7 @@
|
||||||
@noteClick="showNote"
|
@noteClick="showNote"
|
||||||
@packClick="showPack"
|
@packClick="showPack"
|
||||||
@changePriceClick="showChangePrice"
|
@changePriceClick="showChangePrice"
|
||||||
@return="showReturn"
|
@return="refReturnCartShow"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
|
|
@ -178,6 +178,7 @@
|
||||||
@chooseUser="showChooseUser"
|
@chooseUser="showChooseUser"
|
||||||
@paysuccess="refresh"
|
@paysuccess="refresh"
|
||||||
:table="table"
|
:table="table"
|
||||||
|
:perpole="perpole"
|
||||||
v-else
|
v-else
|
||||||
:user="user"
|
:user="user"
|
||||||
></Order>
|
></Order>
|
||||||
|
|
@ -204,6 +205,8 @@
|
||||||
|
|
||||||
<!-- 就餐人数 -->
|
<!-- 就餐人数 -->
|
||||||
<dinerNumber ref="refDinerNumber" @confirm="dinerNumberConfirm"></dinerNumber>
|
<dinerNumber ref="refDinerNumber" @confirm="dinerNumberConfirm"></dinerNumber>
|
||||||
|
<!-- 退菜 -->
|
||||||
|
<returnCart ref="refReturnCart" @confirm="refReturnCartConfirm"></returnCart>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|
@ -213,6 +216,7 @@ import note from "./components/note.vue";
|
||||||
import Order from "./components/order.vue";
|
import Order from "./components/order.vue";
|
||||||
import pack from "./components/pack.vue";
|
import pack from "./components/pack.vue";
|
||||||
import changePrice from "./components/popup-cart-changePrice.vue";
|
import changePrice from "./components/popup-cart-changePrice.vue";
|
||||||
|
import returnCart from "./components/return-cart.vue";
|
||||||
import chooseUser from "./components/choose-user.vue";
|
import chooseUser from "./components/choose-user.vue";
|
||||||
import changeWeight from "./components/popup-weight-goods.vue";
|
import changeWeight from "./components/popup-weight-goods.vue";
|
||||||
import changeTaocan from "./components/popup-taocan-goods.vue";
|
import changeTaocan from "./components/popup-taocan-goods.vue";
|
||||||
|
|
@ -229,20 +233,45 @@ import shopUserApi from "@/api/account/shopUser";
|
||||||
import { useCartsStore } from "@/store/modules/carts";
|
import { useCartsStore } from "@/store/modules/carts";
|
||||||
import { useUserStore } from "@/store/modules/user";
|
import { useUserStore } from "@/store/modules/user";
|
||||||
|
|
||||||
import { ElLoading } from "element-plus";
|
import { ElLoading, ElMessage } from "element-plus";
|
||||||
|
|
||||||
const carts = useCartsStore();
|
const carts = useCartsStore();
|
||||||
const shopUser = useUserStore();
|
const shopUser = useUserStore();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
//退菜
|
||||||
|
const refReturnCart = ref();
|
||||||
|
async function refReturnCartConfirm(e) {
|
||||||
|
console.log(e);
|
||||||
|
const res = await orderApi.refundOrder({
|
||||||
|
...e,
|
||||||
|
orderId: oldOrder.value.id,
|
||||||
|
});
|
||||||
|
ElMessage({
|
||||||
|
type: res ? "success" : "error",
|
||||||
|
text: res ? "退菜成功" : "操作失败",
|
||||||
|
});
|
||||||
|
if (res) {
|
||||||
|
// 获取历史订单数据
|
||||||
|
const res1 = await orderApi.getHistoryList({
|
||||||
|
orderId: oldOrder.value.id,
|
||||||
|
});
|
||||||
|
oldOrder.value = res1;
|
||||||
|
orderInfo.value = res1;
|
||||||
|
carts.setOldOrder(res1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function refReturnCartShow(e) {
|
||||||
|
const memberPrice = e.memberPrice || e.salePrice;
|
||||||
|
refReturnCart.value.open({
|
||||||
|
...e,
|
||||||
|
price: e.discount_sale_amount || (carts.useVipPrice ? memberPrice : e.salePrice),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//整单备注
|
//整单备注
|
||||||
const remark = ref("");
|
const remark = ref("");
|
||||||
//退菜
|
|
||||||
function showReturn(cart) {
|
|
||||||
console.log(cart);
|
|
||||||
}
|
|
||||||
|
|
||||||
//就餐人数
|
//就餐人数
|
||||||
let perpole = ref("");
|
let perpole = ref("");
|
||||||
|
|
@ -628,7 +657,8 @@ function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const { id } = route.query;
|
const { id, tableCode } = route.query;
|
||||||
|
console.log(id, tableCode);
|
||||||
if (id) {
|
if (id) {
|
||||||
// 获取历史订单数据
|
// 获取历史订单数据
|
||||||
const res = await orderApi.getHistoryList({
|
const res = await orderApi.getHistoryList({
|
||||||
|
|
@ -667,6 +697,10 @@ onMounted(async () => {
|
||||||
showOrder.value = true;
|
showOrder.value = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (tableCode) {
|
||||||
|
const tableRes = await tableApi.get({ tableCode: tableCode });
|
||||||
|
table.value = tableRes || {};
|
||||||
|
}
|
||||||
init();
|
init();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -723,7 +757,7 @@ $pl: 30px;
|
||||||
display: flex;
|
display: flex;
|
||||||
max-height: calc(100vh - 256px);
|
max-height: calc(100vh - 256px);
|
||||||
.left {
|
.left {
|
||||||
width: 350px;
|
width: 1;
|
||||||
padding-right: 14px;
|
padding-right: 14px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -736,7 +770,7 @@ $pl: 30px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.right {
|
.right {
|
||||||
flex: 1;
|
flex: 3;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
|
|
@ -886,4 +920,12 @@ $pl: 30px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
}
|
}
|
||||||
|
.vip {
|
||||||
|
padding: 2px 5px;
|
||||||
|
background: #f7793d;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-left: 10px;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -1,250 +1,247 @@
|
||||||
export function isTui(item) {
|
export function isTui(item) {
|
||||||
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
return item.status == "return" || item.status == "refund" || item.status == "refunding";
|
||||||
}
|
}
|
||||||
//是否使用会员价
|
//是否使用会员价
|
||||||
export function isUseVipPrice(vipUser,goods){
|
export function isUseVipPrice(vipUser, goods) {
|
||||||
return vipUser.id&&vipUser.isVip&&goods.isMember
|
return vipUser.id && vipUser.isVip;
|
||||||
}
|
}
|
||||||
|
|
||||||
//计算商品券优惠价格
|
//计算商品券优惠价格
|
||||||
export function returnProductCouponPrice(coup, goodsArr, vipUser) {
|
export function returnProductCouponPrice(coup, goodsArr, vipUser) {
|
||||||
const item = goodsArr.find(v => v.productId == coup.proId);
|
const item = goodsArr.find((v) => v.productId == coup.proId);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return 0
|
return 0;
|
||||||
}
|
}
|
||||||
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||||
const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
|
const price = item ? (isUseVipPrice(vipUser, item) ? memberPrice : item.price) : 0;
|
||||||
return price * coup.num
|
return price * coup.num;
|
||||||
|
|
||||||
}
|
}
|
||||||
//返回新的商品列表,过滤掉退菜的,退单的商品
|
//返回新的商品列表,过滤掉退菜的,退单的商品
|
||||||
export function returnNewGoodsList(arr) {
|
export function returnNewGoodsList(arr) {
|
||||||
let goodsMap = {}
|
let goodsMap = {};
|
||||||
return arr.filter(v => !isTui(v))
|
return arr.filter((v) => !isTui(v));
|
||||||
}
|
}
|
||||||
//根据当前购物车商品以及数量,已选券对应商品数量,判断该商品券是否可用
|
//根据当前购物车商品以及数量,已选券对应商品数量,判断该商品券是否可用
|
||||||
export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
|
export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
|
||||||
// if(!coup.use){
|
// if(!coup.use){
|
||||||
// return false
|
// return false
|
||||||
// }
|
// }
|
||||||
const findGoods = goodsArr.filter(v => v.productId == coup.proId)
|
const findGoods = goodsArr.filter((v) => v.productId == coup.proId);
|
||||||
if (!findGoods.length) {
|
if (!findGoods.length) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
const findGoodsTotalNumber = findGoods.reduce((prve, cur) => {
|
const findGoodsTotalNumber = findGoods.reduce((prve, cur) => {
|
||||||
return prve + cur.num * 1
|
return prve + cur.num * 1;
|
||||||
}, 0)
|
}, 0);
|
||||||
const selCoupNumber = selCoupArr.filter(v => v.proId == coup.proId).reduce((prve, cur) => {
|
const selCoupNumber = selCoupArr
|
||||||
return prve + cur.num * 1
|
.filter((v) => v.proId == coup.proId)
|
||||||
}, 0)
|
.reduce((prve, cur) => {
|
||||||
if (selCoupNumber >= findGoodsTotalNumber) {
|
return prve + cur.num * 1;
|
||||||
return false
|
}, 0);
|
||||||
}
|
if (selCoupNumber >= findGoodsTotalNumber) {
|
||||||
console.log(selCoupNumber,findGoodsTotalNumber);
|
return false;
|
||||||
return findGoodsTotalNumber < selCoupNumber ? false : true
|
}
|
||||||
|
return findGoodsTotalNumber < selCoupNumber ? false : true;
|
||||||
}
|
}
|
||||||
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
|
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
|
||||||
export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
|
export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
|
||||||
const newGoodsArr = returnNewGoodsList(goodsArr)
|
const newGoodsArr = returnNewGoodsList(goodsArr);
|
||||||
const item = newGoodsArr.find(v => v.productId == coup.proId);
|
const item = newGoodsArr.find((v) => v.productId == coup.proId);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return {
|
return {
|
||||||
...coup,
|
...coup,
|
||||||
discountAmount: 0,
|
discountAmount: 0,
|
||||||
use: false
|
use: false,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||||
const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
|
const price = item ? (isUseVipPrice(vipUser, item) ? memberPrice : item.price) : 0;
|
||||||
const discountAmount = (price * coup.num).toFixed(2)
|
const discountAmount = (price * coup.num).toFixed(2);
|
||||||
console.log(discountAmount);
|
// const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr))
|
||||||
|
// const canUse=discountAmount>0
|
||||||
// const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr))
|
const canUse = coup.use;
|
||||||
// const canUse=discountAmount>0
|
return {
|
||||||
const canUse=coup.use
|
...coup,
|
||||||
return {
|
discountAmount: discountAmount,
|
||||||
...coup,
|
use: canUse,
|
||||||
discountAmount: discountAmount,
|
};
|
||||||
use: canUse
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 根据购物车商品计算商品券抵扣价格以及是否满足可用需求
|
* 根据购物车商品计算商品券抵扣价格以及是否满足可用需求
|
||||||
* 1.商品券对应商品数量大于购物车对应商品数量不可用
|
* 1.商品券对应商品数量大于购物车对应商品数量不可用
|
||||||
* 2.未在购物车找到相关商品不可用
|
* 2.未在购物车找到相关商品不可用
|
||||||
* @param {*} coupArr
|
* @param {*} coupArr
|
||||||
* @param {*} goodsArr
|
* @param {*} goodsArr
|
||||||
* @param {*} vipUser
|
* @param {*} vipUser
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function returnProductAllCoup(coupArr, goodsArr, vipUser) {
|
export function returnProductAllCoup(coupArr, goodsArr, vipUser) {
|
||||||
return coupArr.map((v) => {
|
return coupArr.map((v) => {
|
||||||
return returnProductCoupon(v, goodsArr, vipUser)
|
return returnProductCoupon(v, goodsArr, vipUser);
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
//返回商品实际支付价格
|
//返回商品实际支付价格
|
||||||
export function returnProductPayPrice(goods,vipUser){
|
export function returnProductPayPrice(goods, vipUser) {
|
||||||
const memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
|
const memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
|
||||||
const price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.price;
|
const price = isUseVipPrice(vipUser, goods) ? memberPrice : goods.price;
|
||||||
return price
|
return price;
|
||||||
}
|
}
|
||||||
//返回商品券抵扣的商品价格
|
//返回商品券抵扣的商品价格
|
||||||
export function returnProductCoupAllPrice(productPriceArr,startIndex,num,isMember=true){
|
export function returnProductCoupAllPrice(productPriceArr, startIndex, num = 1, isVip = true) {
|
||||||
console.log(productPriceArr);
|
num = num || 1;
|
||||||
return productPriceArr.slice(startIndex,startIndex+num).reduce((prve,cur)=>{
|
return productPriceArr.slice(startIndex, startIndex + num).reduce((prve, cur) => {
|
||||||
let curPrice=0
|
let curPrice = 0;
|
||||||
if(typeof cur==='object'){
|
if (typeof cur === "object") {
|
||||||
curPrice=isMember?cur.memberPrice*1:cur.price
|
curPrice = isVip ? cur.memberPrice * 1 : cur.price;
|
||||||
}else{
|
} else {
|
||||||
curPrice=cur*1
|
curPrice = cur * 1;
|
||||||
}
|
}
|
||||||
return prve+curPrice
|
|
||||||
},0)
|
return prve + curPrice;
|
||||||
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//返回商品券可抵扣的商品数量
|
//返回商品券可抵扣的商品数量
|
||||||
export function returnProductCanUseNum(productPriceArr,startIndex,num){
|
export function returnProductCanUseNum(productPriceArr, startIndex, num) {
|
||||||
console.log(productPriceArr);
|
let n = 0;
|
||||||
console.log(num);
|
for (let i = 0; i < num; i++) {
|
||||||
let n=0;
|
if (productPriceArr[startIndex * 1 + i]) {
|
||||||
for(let i=0;i<num;i++){
|
n += 1;
|
||||||
if(productPriceArr[startIndex*1+i]){
|
} else {
|
||||||
n+=1
|
break;
|
||||||
console.log(n);
|
}
|
||||||
}else{
|
}
|
||||||
break
|
return n;
|
||||||
}
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//返回同类商品券在同类商品价格数组里的开始位置
|
//返回同类商品券在同类商品价格数组里的开始位置
|
||||||
export function returnProCoupStartIndex(coupArr,index){
|
export function returnProCoupStartIndex(coupArr, index) {
|
||||||
return coupArr.slice(0,index).reduce((prve,cur)=>{
|
return coupArr.slice(0, index).reduce((prve, cur) => {
|
||||||
return prve+cur.num*1
|
return prve + cur.num * 1;
|
||||||
},0)
|
}, 0);
|
||||||
}
|
}
|
||||||
//返回商品数量从0到n每一个对应的价格对照表
|
//返回商品数量从0到n每一个对应的价格对照表
|
||||||
export function returnGoodsPayPriceMap(goodsArr){
|
export function returnGoodsPayPriceMap(goodsArr) {
|
||||||
return goodsArr.reduce((prve,cur)=>{
|
return goodsArr.reduce((prve, cur) => {
|
||||||
if(!prve.hasOwnProperty(cur.productId)){
|
if (!prve.hasOwnProperty(cur.productId)) {
|
||||||
prve[cur.productId]=[]
|
prve[cur.productId] = [];
|
||||||
}
|
}
|
||||||
const arr=new Array(cur.num).fill(cur).map(v=>{
|
const arr = new Array(cur.num).fill(cur).map((v) => {
|
||||||
return {
|
return {
|
||||||
memberPrice:v.memberPrice?v.memberPrice:v.price,
|
memberPrice: v.memberPrice ? v.memberPrice : v.price,
|
||||||
price:v.price
|
price: v.price,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
prve[cur.productId].push(...arr)
|
prve[cur.productId].push(...arr);
|
||||||
return prve
|
return prve;
|
||||||
},{})
|
}, {});
|
||||||
}
|
}
|
||||||
//计算商品券总优惠价格
|
//计算商品券总优惠价格
|
||||||
export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
|
export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
|
||||||
if (coupArr.length == 0) {
|
if (coupArr.length == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//商品分组
|
//商品分组
|
||||||
const goodsMap={}
|
const goodsMap = {};
|
||||||
//商品数量从0到n每一个对应的价格
|
//商品数量从0到n每一个对应的价格
|
||||||
const goodsPayPriceMap={}
|
const goodsPayPriceMap = {};
|
||||||
//商品券分组
|
//商品券分组
|
||||||
let coupMap={}
|
let coupMap = {};
|
||||||
for(let i in coupArr){
|
for (let i in coupArr) {
|
||||||
const coup=coupArr[i]
|
const coup = coupArr[i];
|
||||||
if(coupMap.hasOwnProperty(coup.proId)){
|
if (coupMap.hasOwnProperty(coup.proId)) {
|
||||||
coupMap[coup.proId].push(coup)
|
coupMap[coup.proId].push(coup);
|
||||||
}else{
|
} else {
|
||||||
coupMap[coup.proId]=[coup]
|
coupMap[coup.proId] = [coup];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let total=0
|
let total = 0;
|
||||||
for(let key in coupMap){
|
for (let key in coupMap) {
|
||||||
const arr=coupMap[key]
|
const arr = coupMap[key];
|
||||||
for(let i in arr){
|
for (let i in arr) {
|
||||||
const coup=arr[i]
|
const coup = arr[i];
|
||||||
if(!goodsMap.hasOwnProperty(coup.proId)){
|
if (!goodsMap.hasOwnProperty(coup.proId)) {
|
||||||
goodsMap[coup.proId]=goodsArr.filter(v=>v.productId==coup.proId).map(v=>{
|
goodsMap[coup.proId] = goodsArr
|
||||||
return {
|
.filter((v) => v.productId == coup.proId)
|
||||||
...v,
|
.map((v) => {
|
||||||
payPrice:returnProductPayPrice(v,vipUser)
|
return {
|
||||||
}
|
...v,
|
||||||
}).sort((a,b)=>{
|
payPrice: returnProductPayPrice(v, vipUser),
|
||||||
const aPrice=a.payPrice
|
};
|
||||||
const bPrice=b.payPrice
|
})
|
||||||
return aPrice-bPrice
|
.sort((a, b) => {
|
||||||
})
|
const aPrice = a.payPrice;
|
||||||
goodsPayPriceMap[coup.proId]=goodsMap[coup.proId].reduce((prve,cur)=>{
|
const bPrice = b.payPrice;
|
||||||
const arr=new Array(cur.num).fill(cur.payPrice)
|
return aPrice - bPrice;
|
||||||
console.log(arr);
|
});
|
||||||
prve.push(...arr)
|
goodsPayPriceMap[coup.proId] = goodsMap[coup.proId].reduce((prve, cur) => {
|
||||||
return prve
|
const arr = new Array(cur.num).fill(cur.payPrice);
|
||||||
},[])
|
prve.push(...arr);
|
||||||
}
|
return prve;
|
||||||
const proCoupStartIndex=returnProCoupStartIndex(arr,i)
|
}, []);
|
||||||
console.log(proCoupStartIndex);
|
}
|
||||||
const coupNum=Math.min(goodsPayPriceMap[coup.proId].length,coup.num)
|
const proCoupStartIndex = returnProCoupStartIndex(arr, i);
|
||||||
console.log(coupNum);
|
const coupNum = Math.min(goodsPayPriceMap[coup.proId].length, coup.num);
|
||||||
total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coupNum)
|
total += returnProductCoupAllPrice(goodsPayPriceMap[coup.proId], proCoupStartIndex, coupNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return total.toFixed(2);
|
|
||||||
|
|
||||||
|
return total.toFixed(2);
|
||||||
}
|
}
|
||||||
//计算满减券总优惠价格
|
//计算满减券总优惠价格
|
||||||
export function returnFullReductionCouponAllPrice(coupArr) {
|
export function returnFullReductionCouponAllPrice(coupArr) {
|
||||||
if (coupArr.length == 0) {
|
if (coupArr.length == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return coupArr.filter(v => v.type == 1).reduce((a, b) => {
|
return coupArr
|
||||||
const price = b.discountAmount
|
.filter((v) => v.type == 1)
|
||||||
return a + price;
|
.reduce((a, b) => {
|
||||||
}, 0).toFixed(2);
|
const price = b.discountAmount;
|
||||||
|
return a + price;
|
||||||
|
}, 0)
|
||||||
|
.toFixed(2);
|
||||||
}
|
}
|
||||||
//计算优惠券总价格
|
//计算优惠券总价格
|
||||||
export function returnCouponAllPrice(coupArr, goodsArr, vipUser) {
|
export function returnCouponAllPrice(coupArr, goodsArr, vipUser) {
|
||||||
const poductAllprice = returnProductCouponAllPrice(coupArr, goodsArr, vipUser)
|
const poductAllprice = returnProductCouponAllPrice(coupArr, goodsArr, vipUser);
|
||||||
const pointAllPrice = returnFullReductionCouponAllPrice(coupArr)
|
const pointAllPrice = returnFullReductionCouponAllPrice(coupArr);
|
||||||
return (poductAllprice * 1 + pointAllPrice * 1).toFixed(2);
|
return (poductAllprice * 1 + pointAllPrice * 1).toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//返回当前满减券列表可用状态
|
//返回当前满减券列表可用状态
|
||||||
export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
|
export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
|
||||||
return coupArr.map(v => {
|
return coupArr
|
||||||
if (v.id == selCoup.id) {
|
.map((v) => {
|
||||||
return {...v,use:true}
|
if (v.id == selCoup.id) {
|
||||||
}
|
return { ...v, use: true };
|
||||||
const isfullAmount = payPrice*1 >= v.fullAmount * 1
|
}
|
||||||
if(payPrice<=0){
|
const isfullAmount = payPrice * 1 >= v.fullAmount * 1;
|
||||||
return {
|
if (payPrice <= 0) {
|
||||||
...v,
|
return {
|
||||||
use: false
|
...v,
|
||||||
}
|
use: false,
|
||||||
}
|
};
|
||||||
return {
|
}
|
||||||
...v,
|
return {
|
||||||
use: v.use && isfullAmount
|
...v,
|
||||||
}
|
use: v.use && isfullAmount,
|
||||||
}).filter(v => v.use)
|
};
|
||||||
|
})
|
||||||
|
.filter((v) => v.use);
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据商品数量还有商品券数量返回优惠券可以使用的数量数组
|
//根据商品数量还有商品券数量返回优惠券可以使用的数量数组
|
||||||
export function returnCanUseNumProductCoup(coupArr,){
|
export function returnCanUseNumProductCoup(coupArr) {
|
||||||
let productCoup = coupArr.filter(v => v.type == 2)
|
let productCoup = coupArr.filter((v) => v.type == 2);
|
||||||
//商品券分组
|
//商品券分组
|
||||||
let coupMap={}
|
let coupMap = {};
|
||||||
for(let i in productCoup){
|
for (let i in productCoup) {
|
||||||
const coup=productCoup[i]
|
const coup = productCoup[i];
|
||||||
if(coupMap.hasOwnProperty(coup.proId)){
|
if (coupMap.hasOwnProperty(coup.proId)) {
|
||||||
coupMap[coup.proId].push(coup)
|
coupMap[coup.proId].push(coup);
|
||||||
}else{
|
} else {
|
||||||
coupMap[coup.proId]=[coup]
|
coupMap[coup.proId] = [coup];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return arr
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
:disabled="!item.tableId || item.status === 'closed'"
|
:disabled="!item.tableCode || item.status === 'closed'"
|
||||||
@click="diancanShow(item)"
|
@click="diancanShow(item)"
|
||||||
>
|
>
|
||||||
点餐
|
点餐
|
||||||
|
|
@ -227,7 +227,7 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import status from "./status.js";
|
import status from "./status.js";
|
||||||
|
const router = useRouter();
|
||||||
import shopAreaApi from "@/api/account/shopArea";
|
import shopAreaApi from "@/api/account/shopArea";
|
||||||
import tableApi from "@/api/account/table";
|
import tableApi from "@/api/account/table";
|
||||||
import addEara from "./components/addEara.vue";
|
import addEara from "./components/addEara.vue";
|
||||||
|
|
@ -334,7 +334,18 @@ async function areainit() {
|
||||||
return prve;
|
return prve;
|
||||||
}, {});
|
}, {});
|
||||||
}
|
}
|
||||||
|
async function diancanShow(item, key) {
|
||||||
|
if (!key) {
|
||||||
|
router.push({ path: "/tool/index", query: { tableCode: item.tableCode } });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (key == "isAddGoods") {
|
||||||
|
router.push({ path: "/tool/index", query: { id: item.orderId } });
|
||||||
|
}
|
||||||
|
if (key == "isPayOrder") {
|
||||||
|
router.push({ path: "/tool/index", query: { id: item.orderId } });
|
||||||
|
}
|
||||||
|
}
|
||||||
const tabClick = (tab) => {
|
const tabClick = (tab) => {
|
||||||
console.log(tab);
|
console.log(tab);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue