Merge branch 'ymf' of https://e.coding.net/g-cphe0354/cashier/cashier-web
This commit is contained in:
commit
bad3c20724
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
## 宝塔
|
||||
|
||||
101.37.12.135:19928/mianban
|
||||
<http://101.37.12.135:19928/>
|
||||
chaozg
|
||||
chaozg123
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,33 @@ const API = {
|
|||
data: data,
|
||||
});
|
||||
},
|
||||
// 店铺优惠券获取记录
|
||||
queryReceive(data: queryReceive) {
|
||||
return request({
|
||||
url: `${baseURL}/queryReceive`,
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
},
|
||||
}
|
||||
export default API;
|
||||
|
||||
export interface queryReceive {
|
||||
/**
|
||||
* 优惠券id
|
||||
*/
|
||||
couponId?: number;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
shopId?: number;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
status?: number;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
export interface getListRequest {
|
||||
status?: number;
|
||||
type?: number;
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ import request from "@/utils/request";
|
|||
import { Order_BaseUrl } from "@/api/config";
|
||||
const baseURL = Order_BaseUrl + "/admin/order";
|
||||
const OrderApi = {
|
||||
getList(data: getListRequest) {
|
||||
getList(params: getListRequest) {
|
||||
return request<any, getListResponse>({
|
||||
url: `${baseURL}`,
|
||||
method: "post",
|
||||
data
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
},
|
||||
add(data: addRequest) {
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@
|
|||
<script>
|
||||
import productApi from "@/api/product/index";
|
||||
import paoductCategoryApi from "@/api/product/productclassification";
|
||||
|
||||
import { ElMessage } from "element-plus";
|
||||
export default {
|
||||
props: {
|
||||
// 是否禁用分类
|
||||
|
|
@ -133,6 +133,10 @@ export default {
|
|||
// 确定选商品
|
||||
confirmHandle() {
|
||||
let res = this.$refs.table.selection;
|
||||
console.log(res);
|
||||
if (!res) {
|
||||
return ElMessage.error("请选择商品");
|
||||
}
|
||||
this.$emit("success", res);
|
||||
this.close();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -7,14 +7,19 @@ export interface CartsState {
|
|||
}
|
||||
|
||||
export const useCartsStore = defineStore("carts", () => {
|
||||
|
||||
|
||||
|
||||
//台桌id
|
||||
const table_code = ref('');
|
||||
|
||||
//当前购物车数据
|
||||
const list = useStorage<any[]>("carts", []);
|
||||
//代客下单页面商品缓存
|
||||
const goods = useStorage<any[]>("Instead_goods", []);
|
||||
//赠菜
|
||||
const giftList = useStorage<any[]>("giftList", []);
|
||||
let goodsMap: { [key: string]: any } = {};
|
||||
let goodsMap: { [key: string]: any } = useStorage('Instead_goods_map', {});
|
||||
//当前选中cart
|
||||
let selListIndex = ref(-1);
|
||||
//当前选中商品是否是赠菜
|
||||
|
|
@ -110,7 +115,6 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
|
||||
const basic_msg = {
|
||||
number: 1,
|
||||
is_pack: 0,
|
||||
is_gift: 0,
|
||||
is_temporary: 0,
|
||||
discount_sale_amount: 0,
|
||||
|
|
@ -161,10 +165,16 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
|
||||
function update(data: any) {
|
||||
console.log(data);
|
||||
if (data.number * 1 < data.skuData.suitNum * 1) {
|
||||
return sendMessage('del', data);
|
||||
}
|
||||
sendMessage('edit', data);
|
||||
}
|
||||
function updateTag(key: string, val: any, cart: CartsState) {
|
||||
sendMessage('edit', { ...cart || selCart.value, [key]: val });
|
||||
function updateTag(key: string, val: any, cart: CartsState = selCart.value) {
|
||||
if (cart.number * 1 < cart.skuData.suitNum * 1) {
|
||||
return sendMessage('del', cart);
|
||||
}
|
||||
sendMessage('edit', { ...cart, [key]: val });
|
||||
}
|
||||
function clear() {
|
||||
sendMessage('cleanup', {});
|
||||
|
|
@ -201,7 +211,9 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
return {
|
||||
salePrice: skuData ? skuData.salePrice : 0,
|
||||
coverImg: goods.coverImg,
|
||||
name: goods.name
|
||||
name: goods.name,
|
||||
specInfo: skuData.specInfo,
|
||||
skuData
|
||||
}
|
||||
} else {
|
||||
return undefined
|
||||
|
|
@ -252,7 +264,6 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
}
|
||||
return v.is_gift
|
||||
})
|
||||
console.log(giftList.value)
|
||||
}
|
||||
//广播
|
||||
if (msg.type === "bc") {
|
||||
|
|
@ -329,12 +340,20 @@ export const useCartsStore = defineStore("carts", () => {
|
|||
console.log(list.value)
|
||||
});
|
||||
}
|
||||
|
||||
const delArr = ['skuData', 'coverImg', 'specInfo']
|
||||
function sendMessage(operate_type: msgType, message: any) {
|
||||
const msg = { ...message, operate_type: operate_type, table_code: table_code.value }
|
||||
if (operate_type == 'edit') {
|
||||
for (let i in delArr) {
|
||||
delete msg[delArr[i]]
|
||||
}
|
||||
}
|
||||
WebSocketManager.sendMessage(msg);
|
||||
}
|
||||
return {
|
||||
isCanSelectGroup,
|
||||
goods,
|
||||
selGoods,
|
||||
cartsPush,
|
||||
table_code,
|
||||
|
|
|
|||
|
|
@ -71,10 +71,10 @@ class WebSocketManager {
|
|||
}
|
||||
this.connected = false;
|
||||
console.log("WebSocket 连接已断开");
|
||||
|
||||
};
|
||||
this.client.onerror = (error) => {
|
||||
console.error("WebSocket 发生错误:", error);
|
||||
|
||||
// ElNotification({
|
||||
// title: "提示",
|
||||
// message: "WebSocket 发生错误",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,476 @@
|
|||
<!-- eslint-disable vue/no-use-v-if-with-v-for -->
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="800px" @close="reset">
|
||||
<div class="app-container">
|
||||
<div class="tab">
|
||||
<div
|
||||
v-for="(item, index) in tabList"
|
||||
:key="index"
|
||||
class="tab_item"
|
||||
:class="{ active: form.type == item.type }"
|
||||
@click="tabClick(item)"
|
||||
>
|
||||
{{ item.name }}
|
||||
<span class="bor" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- 优惠券 -->
|
||||
<div class="content">
|
||||
<el-form
|
||||
ref="form"
|
||||
:inline="true"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="120px"
|
||||
label-position="left"
|
||||
>
|
||||
<el-form-item label="优惠券券名" prop="title" style="width: 100%">
|
||||
<el-input v-model="form.title" placeholder="" style="width: 289px" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type == 1" label="使用门槛" prop="fullAmount">
|
||||
<el-input
|
||||
v-model="form.fullAmount"
|
||||
oninput="value= value.replace(/[^\d|\.]/g, '')"
|
||||
placeholder=""
|
||||
style="width: 180px; margin-right: 66px"
|
||||
>
|
||||
<template #prepend>满</template>
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type == 1" label="" prop="discountAmount">
|
||||
<el-input
|
||||
v-model="form.discountAmount"
|
||||
oninput="value= value.replace(/[^\d|\.]/g, '')"
|
||||
placeholder=""
|
||||
style="width: 180px"
|
||||
>
|
||||
<template #prepend>减</template>
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="有效期类型" style="width: 100%">
|
||||
<el-radio-group v-model="form.validityType">
|
||||
<el-radio
|
||||
v-for="item in couponEnum.validityType"
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
>
|
||||
{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="form.validityType == 'fixed'"
|
||||
label="有效期(天)"
|
||||
prop="validDays"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-input v-model="form.validDays" placeholder="" style="width: 200px">
|
||||
<template #append>天</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
v-if="form.validityType == 'custom'"
|
||||
label="有效时间"
|
||||
prop="validEndTime"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-date-picker
|
||||
v-model="validityTime"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="YYYY-MM-dd HH:mm:ss"
|
||||
@change="validityChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="使用门槛" prop="daysToTakeEffect" style="width: 100%;">
|
||||
<el-input v-model="form.daysToTakeEffect" placeholder="" style="width: 200px;">
|
||||
<template #prepend>隔</template>
|
||||
<template #append>天生效</template>
|
||||
</el-input>
|
||||
<el-tooltip class="item" effect="dark" content="领取后0天后0点0分" placement="top-start">
|
||||
<i class="el-icon-question" />
|
||||
</el-tooltip>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="可用周期" prop="userDays" style="width: 100%">
|
||||
<el-checkbox-group v-model="form.userDays">
|
||||
<el-checkbox
|
||||
v-for="(city, index) in couponEnum.cycle"
|
||||
:key="index"
|
||||
:value="city.label"
|
||||
@change="userDayChagne"
|
||||
>
|
||||
{{ city.label }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="指定时间段" style="width: 100%">
|
||||
<el-radio-group v-model="form.useTimeType">
|
||||
<el-radio
|
||||
v-for="item in couponEnum.useTimeType"
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
>
|
||||
{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="form.useTimeType == 'custom'"
|
||||
label="指定时间段"
|
||||
prop="useEndTime"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-time-picker
|
||||
v-model="useTime"
|
||||
is-range
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
value-format="HH:mm"
|
||||
@change="useTimeChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="发放数量" prop="number" style="width: 100%">
|
||||
<el-input
|
||||
v-model="form.number"
|
||||
oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"
|
||||
placeholder=""
|
||||
style="width: 200px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="赠送商品" prop="products" v-if="form.type == 2">
|
||||
<div>
|
||||
<el-button type="primary" icon="plus" @click="$refs.refGoodsSelect.show()">
|
||||
添加
|
||||
</el-button>
|
||||
<div class="shop_list">
|
||||
<div class="item_wrap" v-if="form.proName">
|
||||
<div class="name">{{ form.proName }}</div>
|
||||
<div class="del" @click="delProduct">删除</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<GoodsSelect ref="refGoodsSelect" radio @success="slectShop" />
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import couponEnum from "../couponEnum";
|
||||
import couponApi from "@/api/account/coupon";
|
||||
import productApi from "@/api/product/index";
|
||||
import { ElNotification } from "element-plus";
|
||||
export default {
|
||||
data() {
|
||||
const validateProduct = (rule, value, callback) => {
|
||||
if (!this.form.proId) {
|
||||
callback(new Error("请选择商品"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
dialogVisible: false,
|
||||
dialogTitle: "",
|
||||
tabList: [
|
||||
{ name: "优惠券", type: 1 },
|
||||
{ name: "商品券", type: 2 },
|
||||
],
|
||||
tabActive: 1,
|
||||
couponEnum,
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
validityTime: "",
|
||||
useTime: ["06:00:00", "23:59:59"],
|
||||
form: {
|
||||
id: "",
|
||||
shopId: "",
|
||||
type: "1",
|
||||
title: "",
|
||||
fullAmount: null,
|
||||
discountAmount: null,
|
||||
validityType: "fixed",
|
||||
validStartTime: "",
|
||||
validEndTime: "",
|
||||
userDays: [],
|
||||
validDays: "",
|
||||
useTimeType: "all",
|
||||
useStartTime: "",
|
||||
useEndTime: "",
|
||||
proId: "",
|
||||
proName: "",
|
||||
number: "",
|
||||
},
|
||||
rules: {
|
||||
title: [
|
||||
{
|
||||
required: true,
|
||||
message: "填写券名",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
fullAmount: [
|
||||
{
|
||||
required: true,
|
||||
message: "填写满减金额",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
discountAmount: [
|
||||
{
|
||||
required: true,
|
||||
message: "填写满减金额",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
number: [
|
||||
{
|
||||
required: true,
|
||||
message: "填写发放数量",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
validDays: [
|
||||
{
|
||||
required: true,
|
||||
message: "填写有效天数",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
daysToTakeEffect: [
|
||||
{
|
||||
required: true,
|
||||
message: "填写生效天数",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
userDays: [
|
||||
{
|
||||
required: true,
|
||||
message: "选择可用周期",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
validEndTime: [
|
||||
{
|
||||
required: true,
|
||||
message: "选择有效时间段",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
useEndTime: [
|
||||
{
|
||||
required: true,
|
||||
message: "选择指定时间段",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
products: [
|
||||
{
|
||||
required: true,
|
||||
validator: validateProduct,
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
},
|
||||
resetForm: "",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
reset() {
|
||||
this.$refs.form.resetFields();
|
||||
this.form = this.resetForm;
|
||||
this.form.type = 1;
|
||||
},
|
||||
async open(data) {
|
||||
if (data && data.id) {
|
||||
this.dialogTitle = "修改优惠券";
|
||||
} else {
|
||||
this.dialogTitle = "新增优惠券";
|
||||
}
|
||||
this.dialogVisible = true;
|
||||
this.resetForm = { ...this.form };
|
||||
if (data) {
|
||||
this.form = { ...data, userDays: data.userDays.split(",") };
|
||||
if (data.proId) {
|
||||
productApi.getDetail(data.proId).then((res) => {});
|
||||
}
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
/**
|
||||
* 切换类型
|
||||
* @param item
|
||||
*/
|
||||
tabClick(item) {
|
||||
this.form = this.resetForm;
|
||||
this.form.number = "";
|
||||
this.form.type = item.type;
|
||||
this.$refs.form.resetFields();
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择可用周期
|
||||
*/
|
||||
userDayChagne(e) {
|
||||
console.log(this.form.userDays);
|
||||
},
|
||||
|
||||
/**
|
||||
* 有效期选择
|
||||
* @param e
|
||||
*/
|
||||
validityChange(e) {
|
||||
console.log(e);
|
||||
this.form.validStartTime = e[0];
|
||||
this.form.validEndTime = e[1];
|
||||
},
|
||||
|
||||
/**
|
||||
* 指定时间段选择
|
||||
* @param e
|
||||
*/
|
||||
useTimeChange(e) {
|
||||
this.form.useStartTime = e[0];
|
||||
this.form.useEndTime = e[1];
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择商品
|
||||
* @param res
|
||||
*/
|
||||
slectShop(res) {
|
||||
if (!res || res.length <= 0) {
|
||||
return;
|
||||
}
|
||||
console.log(res);
|
||||
this.form.proId = res[res.length - 1].id;
|
||||
this.form.proName = res[res.length - 1].name;
|
||||
},
|
||||
delProduct() {
|
||||
this.form.proId = "";
|
||||
this.form.proName = "";
|
||||
},
|
||||
/**
|
||||
* 判断是否存在重复商品
|
||||
* @param id
|
||||
*/
|
||||
checkShop(id) {
|
||||
let falg = false;
|
||||
this.form.products.map((item) => {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (item.id == id) {
|
||||
falg = true;
|
||||
}
|
||||
});
|
||||
return falg;
|
||||
},
|
||||
|
||||
/**
|
||||
* 提交
|
||||
*/
|
||||
onSubmitHandle() {
|
||||
console.log(this.form);
|
||||
this.$refs.form.validate(async (valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.loading = true;
|
||||
const submitdata = {
|
||||
...this.form,
|
||||
userDays: this.form.userDays.toString(),
|
||||
};
|
||||
const res = this.form.id
|
||||
? await couponApi.edit(submitdata)
|
||||
: await couponApi.add(submitdata);
|
||||
ElNotification({
|
||||
title: "成功",
|
||||
message: `${this.form.id ? "编辑" : "添加"}成功`,
|
||||
type: "success",
|
||||
});
|
||||
this.loading = false;
|
||||
this.close();
|
||||
this.$emit("success");
|
||||
} catch (error) {
|
||||
this.loading = false;
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.tab {
|
||||
display: flex;
|
||||
margin-bottom: 30px;
|
||||
padding-left: 10px;
|
||||
.tab_item {
|
||||
margin-right: 64px;
|
||||
font-weight: 400;
|
||||
font-size: 16px;
|
||||
color: #666666;
|
||||
cursor: pointer;
|
||||
.bor {
|
||||
display: block;
|
||||
width: 56px;
|
||||
height: 6px;
|
||||
background-color: transparent;
|
||||
border-radius: 3px 3px 3px 3px;
|
||||
margin: 5px auto 0;
|
||||
}
|
||||
}
|
||||
.active {
|
||||
color: #3f9eff;
|
||||
.bor {
|
||||
background-color: #3f9eff;
|
||||
}
|
||||
}
|
||||
}
|
||||
.content {
|
||||
font-weight: 400;
|
||||
font-size: 16px;
|
||||
color: #666666;
|
||||
}
|
||||
.shop_list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 15px;
|
||||
.item_wrap {
|
||||
$size: 80px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.name {
|
||||
width: $size;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.del {
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
color: #3f9eff;
|
||||
margin-left: 11px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-dialog title="领取详情" :visible.sync="dialogVisible" width="70%" @close="reset">
|
||||
<el-dialog title="领取详情" v-model="dialogVisible" width="70%" @close="reset">
|
||||
<div class="search">
|
||||
<el-form :model="query" inline label-position="left">
|
||||
<el-form-item>
|
||||
|
|
@ -88,14 +88,11 @@
|
|||
<el-table-column label="操作" width="150">
|
||||
<template v-slot="scope">
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||
<el-button
|
||||
slot="reference"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
style="color: #ff4d4f"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<template #reference>
|
||||
<el-button type="text" icon="el-icon-delete" style="color: #ff4d4f">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -162,8 +159,8 @@ export default {
|
|||
// console.log(this.couponId)
|
||||
|
||||
// eslint-disable-next-line no-unused-vars, prefer-const
|
||||
let res = await queryReceive({
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
let res = await couponApi.queryReceive({
|
||||
shopId: localStorage.getItem("shopId") * 1,
|
||||
couponId: this.query.couponId,
|
||||
value: this.query.value,
|
||||
status: this.query.status,
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@
|
|||
<!-- <el-button type="primary" icon="el-icon-plus" @click="$refs.addCoupon.show()">
|
||||
添加优惠券
|
||||
</el-button> -->
|
||||
<el-button type="primary" icon="plus" @click="$router.push({ name: 'add_coupon', query: { type: 1 } })">
|
||||
添加优惠券
|
||||
</el-button>
|
||||
<el-button type="primary" icon="plus" @click="toAdd()">添加优惠券</el-button>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table v-loading="tableData.loading" :data="tableData.data">
|
||||
|
|
@ -15,7 +13,8 @@
|
|||
<el-table-column label="使用门槛">
|
||||
<template v-slot="scope">
|
||||
{{
|
||||
`满${scope.row.fullAmount}${scope.row.discountAmount ? "减" + scope.row.discountAmount + "元" : ""
|
||||
`满${scope.row.fullAmount}${
|
||||
scope.row.discountAmount ? "减" + scope.row.discountAmount + "元" : ""
|
||||
}`
|
||||
}}
|
||||
</template>
|
||||
|
|
@ -37,7 +36,10 @@
|
|||
<div style="display: flex; align-items: center; justify-content: center">
|
||||
<div style="width: 30px">{{ scope.row.number - scope.row.leftNumber }}</div>
|
||||
<div style="margin: 0 10px">|</div>
|
||||
<div style="color: #3f9eff; cursor: pointer; flex-shrink: 0" @click="couponDetailsOpen(scope.row)">
|
||||
<div
|
||||
style="color: #3f9eff; cursor: pointer; flex-shrink: 0"
|
||||
@click="couponDetailsOpen(scope.row)"
|
||||
>
|
||||
详情
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -47,14 +49,7 @@
|
|||
<el-table-column label="剩余" prop="leftNumber" />
|
||||
<el-table-column label="操作" width="150">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" icon="el-icon-edit" @click="
|
||||
$router.push({
|
||||
name: 'add_coupon',
|
||||
query: { type: scope.row.type, id: scope.row.id },
|
||||
})
|
||||
">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button link icon="edit" type="primary" @click="toAdd(scope.row)">编辑</el-button>
|
||||
<!-- <el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||
<template #reference>
|
||||
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important">
|
||||
|
|
@ -67,21 +62,29 @@
|
|||
</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" />
|
||||
<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>
|
||||
<couponDetails ref="couponDetails" @success="resetHandle" />
|
||||
<couponAdd ref="couponAdd" @success="getTableData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import couponEnum from "./couponEnum";
|
||||
import couponDetails from "./components/coupon_details.vue";
|
||||
import couponAdd from "./components/add.vue";
|
||||
import couponApi from "@/api/account/coupon";
|
||||
|
||||
export default {
|
||||
// eslint-disable-next-line vue/no-unused-components
|
||||
components: { couponDetails },
|
||||
components: { couponDetails, couponAdd },
|
||||
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -99,6 +102,10 @@ export default {
|
|||
this.getTableData();
|
||||
},
|
||||
methods: {
|
||||
toAdd(data) {
|
||||
console.log(data);
|
||||
this.$refs.couponAdd.open(data);
|
||||
},
|
||||
typeFilter(value) {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
return couponEnum.type.find((item) => item.value == value).label;
|
||||
|
|
|
|||
|
|
@ -37,12 +37,30 @@ export const payTypeOptions: payTypeOptions[] = [
|
|||
value: "arrears",
|
||||
},
|
||||
];
|
||||
export type optionsType = "status";
|
||||
export const options: { [key in optionsType]: options[] } = {
|
||||
status: statusOptions,
|
||||
payType: payTypeOptions,
|
||||
platformType: [
|
||||
{ label: '微信小程序', value: 'wechat' },
|
||||
{ label: '网页后台管理端', value: 'WEB' },
|
||||
],
|
||||
sendType: [
|
||||
{ label: '快递', value: 'post' },
|
||||
{ label: '外卖', value: 'takeaway' },
|
||||
{ label: '自提', value: 'takeself' },
|
||||
{ label: '堂食', value: 'table' },
|
||||
],
|
||||
dineMode: [
|
||||
{ label: '堂食', value: 'dine-in' },
|
||||
{ label: '外带', value: 'take-out' },
|
||||
{ label: '外卖', value: 'take-away' },
|
||||
|
||||
]
|
||||
}
|
||||
export type optionsType = string;
|
||||
|
||||
export function returnOptions(type: optionsType) {
|
||||
if (type === "status") {
|
||||
return statusOptions;
|
||||
}
|
||||
return options[type];
|
||||
}
|
||||
|
||||
export function returnOptionsLabel(optionsType: optionsType, value: string | number) {
|
||||
|
|
@ -54,6 +72,7 @@ export function returnOptionsLabel(optionsType: optionsType, value: string | num
|
|||
return option ? option.label : "";
|
||||
}
|
||||
|
||||
|
||||
export interface options {
|
||||
label: string;
|
||||
value: string | number;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import OrderApi from "@/api/order/order";
|
||||
import type { editRequest } from "@/api/system/version";
|
||||
import type { IContentConfig } from "@/components/CURD/types";
|
||||
|
||||
import { returnOptionsLabel } from "./config";
|
||||
const contentConfig: IContentConfig = {
|
||||
pageName: "sys:user",
|
||||
table: {
|
||||
|
|
@ -11,7 +11,7 @@ const contentConfig: IContentConfig = {
|
|||
pagination: {
|
||||
background: true,
|
||||
layout: "prev,pager,next,jumper,total,sizes",
|
||||
pageSize: 20,
|
||||
pageSize: 10,
|
||||
pageSizes: [10, 20, 30, 50],
|
||||
},
|
||||
indexAction: function (params) {
|
||||
|
|
@ -27,31 +27,87 @@ const contentConfig: IContentConfig = {
|
|||
cols: [
|
||||
{ type: "selection", width: 50, align: "center" },
|
||||
// { label: "id", align: "center", prop: "id", width: 100, show: true },
|
||||
{
|
||||
label: "平台类型",
|
||||
align: "center",
|
||||
prop: "platformType",
|
||||
templet: "custom",
|
||||
slotName: "options",
|
||||
},
|
||||
{
|
||||
label: "订单号信息",
|
||||
align: "center",
|
||||
prop: "orderNo",
|
||||
},
|
||||
{
|
||||
label: "商品信息",
|
||||
align: "center",
|
||||
templet: 'custom',
|
||||
prop: 'goods',
|
||||
slotName: 'goods',
|
||||
width: 240,
|
||||
},
|
||||
{
|
||||
label: "台桌信息",
|
||||
align: "center",
|
||||
templet: 'custom',
|
||||
slotName: 'table',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
label: "订单原金额 不含折扣价格",
|
||||
align: "center",
|
||||
prop: "originAmount",
|
||||
width: 120,
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
label: "支付金额",
|
||||
align: "center",
|
||||
prop: "payAmount",
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
label: "订单金额 (扣除各类折扣)",
|
||||
align: "center",
|
||||
prop: "orderAmount",
|
||||
width: 120,
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
label: "用餐模式",
|
||||
align: "center",
|
||||
prop: "dineMode",
|
||||
width: 120,
|
||||
templet: "custom",
|
||||
slotName: "options",
|
||||
},
|
||||
|
||||
{
|
||||
label: "状态",
|
||||
align: "center",
|
||||
prop: "status",
|
||||
width: 120,
|
||||
templet: "custom",
|
||||
slotName: "state",
|
||||
},
|
||||
{
|
||||
label: "备注",
|
||||
align: "center",
|
||||
prop: "remark",
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
align: "center",
|
||||
prop: "createTime",
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
align: "center",
|
||||
fixed: "right",
|
||||
width: 280,
|
||||
templet: "tool",
|
||||
operat: [
|
||||
{
|
||||
icon: "Document",
|
||||
name: "detail",
|
||||
text: "详情",
|
||||
},
|
||||
{
|
||||
icon: "Printer",
|
||||
name: "printer",
|
||||
text: "开票",
|
||||
},
|
||||
],
|
||||
width: 150,
|
||||
templet: "custom",
|
||||
slotName: 'operate'
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,11 +25,39 @@
|
|||
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #goods="scope">
|
||||
<div class="goods_info">
|
||||
<div class="row" v-for="item in scope.row.goods" :key="item.id">
|
||||
<el-image :src="item.productImg" class="cover" lazy></el-image>
|
||||
<div class="info">
|
||||
<div class="name">
|
||||
<span :class="[item.isVip == 1 ? 'colorStyle' : '']">
|
||||
{{ item.productName }}
|
||||
</span>
|
||||
<span class="refund" v-if="item.refundNumber">(退 - {{ item.refundNumber }})</span>
|
||||
</div>
|
||||
<div class="sku">{{ item.productSkuName }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #table="scope">
|
||||
<div>
|
||||
<p>
|
||||
名称:
|
||||
<el-tag type="primary">{{ scope.row.tableName }}</el-tag>
|
||||
</p>
|
||||
<p v-if="scope.row.tableCode">编号:{{ scope.row.tableCode }}</p>
|
||||
</div>
|
||||
</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 #state="scope">
|
||||
<el-tag :type="returnStateType(scope.row[scope.prop])">
|
||||
{{ returnOptionsLabel(scope.prop, scope.row[scope.prop]) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #mobile="scope">
|
||||
<el-text>{{ scope.row[scope.prop] }}</el-text>
|
||||
|
|
@ -39,6 +67,19 @@
|
|||
style="margin-left: 2px"
|
||||
/>
|
||||
</template>
|
||||
<template #operate="scope">
|
||||
<div>
|
||||
<el-button link>详情</el-button>
|
||||
<el-button link v-if="scope.row.status == 'done'">开票</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.status == 'unpaid'"
|
||||
@click="toPayOrder(scope.row)"
|
||||
type="primary"
|
||||
>
|
||||
结账
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</page-content>
|
||||
|
||||
<!-- 新增 -->
|
||||
|
|
@ -64,9 +105,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import VersionApi from "@/api/system/version";
|
||||
import DeptAPI from "@/api/system/dept";
|
||||
import RoleAPI from "@/api/system/role";
|
||||
import orderApi, { type getListResponse } from "@/api/order/order";
|
||||
import type { IObject, IOperatData } from "@/components/CURD/types";
|
||||
import usePage from "@/components/CURD/usePage";
|
||||
import addModalConfig from "./config/add";
|
||||
|
|
@ -125,6 +164,177 @@ async function handleOperatClick(data: IOperatData) {
|
|||
}
|
||||
}
|
||||
|
||||
// 切换示例
|
||||
const isA = ref(true);
|
||||
function returnStateType(status: string) {
|
||||
if (status === "unpaid") {
|
||||
return "warning";
|
||||
}
|
||||
if (status === "done") {
|
||||
return "primary";
|
||||
}
|
||||
if (status === "cancelled") {
|
||||
return "info";
|
||||
}
|
||||
if (status === "refund") {
|
||||
return "danger";
|
||||
}
|
||||
}
|
||||
|
||||
const route = useRouter();
|
||||
// 结账
|
||||
function toPayOrder(order: getListResponse) {
|
||||
route.push({
|
||||
path: "/tool/index",
|
||||
query: {
|
||||
id: order.id,
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.collect_wrap {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #f5f5f5;
|
||||
padding: 20px;
|
||||
|
||||
.icon_wrap {
|
||||
$size: 34px;
|
||||
$border: 6px;
|
||||
width: $size;
|
||||
height: $size;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: var(--bg-color);
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
width: $size + $border;
|
||||
height: $size + $border;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: var(--bg-color);
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 10px;
|
||||
|
||||
.m {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.t {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
padding-top: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.refund {
|
||||
color: #ff9731;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.table_order_info {
|
||||
.order_no {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.type {
|
||||
color: #e6a23c;
|
||||
}
|
||||
}
|
||||
|
||||
.goods_info {
|
||||
.row {
|
||||
display: flex;
|
||||
|
||||
&:not(:first-child) {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.cover {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 10px;
|
||||
|
||||
.sku {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.colorStyle {
|
||||
color: #ffc315;
|
||||
}
|
||||
|
||||
.qrStyle {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba($color: #000000, $alpha: 0.7);
|
||||
position: fixed;
|
||||
z-index: 999999;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
||||
.box {
|
||||
width: 380px;
|
||||
height: 320px;
|
||||
position: absolute;
|
||||
background: #fff;
|
||||
top: 26%;
|
||||
left: 36%;
|
||||
padding: 18px;
|
||||
|
||||
> div:first-child {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
#canvas {
|
||||
margin-left: 49%;
|
||||
transform: translateX(-80px);
|
||||
}
|
||||
|
||||
> div:last-child {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="经营模式「单选」">
|
||||
<el-radio-group v-model="form.registerType">
|
||||
<el-radio value="munchies">快餐版(先支付后下单)</el-radio>
|
||||
<el-radio value="restaurant">餐饮版(先下单后支付)</el-radio>
|
||||
<el-radio value="before">快餐版(先支付后下单)</el-radio>
|
||||
<el-radio value="after">餐饮版(先下单后支付)</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="就餐模式「多选」">
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@
|
|||
</el-table-column>
|
||||
<el-table-column prop="registerType" label="类型">
|
||||
<template v-slot="scope">
|
||||
<span v-if="scope.row.registerType == 'munchies'">快餐版</span>
|
||||
<span v-if="scope.row.registerType == 'restaurant'">餐饮版</span>
|
||||
<span v-if="scope.row.registerType == 'before'">快餐版</span>
|
||||
<span v-if="scope.row.registerType == 'after'">餐饮版</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="address" label="商户号"></el-table-column>
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
<div v-if="item.typeEnum == 'weight'" class="specSnap">
|
||||
¥{{ currentPrice }}/{{ item.unit }}
|
||||
</div>
|
||||
<div v-if="item.specSnap" class="specSnap">
|
||||
{{ item.specSnap }}
|
||||
<div v-if="item.specInfo" class="specSnap">
|
||||
{{ item.specInfo }}
|
||||
</div>
|
||||
<div v-if="item.proGroupInfo" class="specSnapss">
|
||||
<span>{{ item.groupType == 0 ? "固定套餐" : "可选套餐" }}:</span>
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div style="width: 10px"></div>
|
||||
<div class="flex u-p-t-6">
|
||||
<div class="flex">
|
||||
<div class="order-number-box u-font-12">
|
||||
<div class="" v-if="isSeatFee">X{{ item.totalNumber }}</div>
|
||||
<div class="" v-else>X{{ item.number }}</div>
|
||||
|
|
|
|||
|
|
@ -206,6 +206,12 @@ import productApi from "@/api/product/index";
|
|||
import tableApi from "@/api/account/table";
|
||||
import $status from "@/views/tool/table/status.js";
|
||||
import orderApi from "@/api/order/order";
|
||||
|
||||
import { useCartsStore } from "@/store/modules/carts";
|
||||
const carts = useCartsStore();
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
//就餐人数
|
||||
let perpole = ref("");
|
||||
const refDinerNumber = ref();
|
||||
|
|
@ -246,11 +252,12 @@ async function createOrder() {
|
|||
userId: "",
|
||||
seatNum: 0,
|
||||
packFee: 0,
|
||||
originAmount: 29,
|
||||
originAmount: refCart.value.carts.payMoney * 1,
|
||||
tableCode: refCart.value.carts.table_code,
|
||||
dineMode: diners.sel == 0 ? "dine-in" : "take-out",
|
||||
remark: "",
|
||||
placeNum: "",
|
||||
seatNum: perpole.value * 1,
|
||||
placeNum: 1,
|
||||
waitCall: false,
|
||||
vipPrice: false,
|
||||
});
|
||||
|
|
@ -419,7 +426,7 @@ function getCategoryList() {
|
|||
const refSelSku = ref(null);
|
||||
|
||||
const goods = reactive({
|
||||
list: [],
|
||||
list: carts.goods,
|
||||
query: {
|
||||
categoryId: "",
|
||||
name: "",
|
||||
|
|
@ -435,6 +442,7 @@ async function getGoods() {
|
|||
...goods.query,
|
||||
});
|
||||
goods.list = res.records;
|
||||
refCart.value.carts.goods = goods.list;
|
||||
goodsMapisFinish.value = true;
|
||||
}
|
||||
|
||||
|
|
@ -488,17 +496,11 @@ function goodsClick(item) {
|
|||
// 多规格选择确认
|
||||
function skuSelConfirm(item) {
|
||||
console.log(item);
|
||||
const listItem = refCart.value.carts.list.find(
|
||||
(v) => v.product_id == item.product_id && v.sku_id == item.sku_id
|
||||
);
|
||||
if (listItem) {
|
||||
refCart.value.carts.update({ ...listItem, ...item });
|
||||
} else {
|
||||
addCarts(item);
|
||||
}
|
||||
addCarts(item);
|
||||
}
|
||||
|
||||
//购物车
|
||||
|
||||
const refCart = ref(null);
|
||||
function clearCarts() {
|
||||
ElMessageBox.alert("确定要清空点餐列表吗?", "提示", {
|
||||
|
|
@ -524,7 +526,16 @@ function init() {
|
|||
getCategoryList();
|
||||
getGoods();
|
||||
}
|
||||
init();
|
||||
|
||||
onMounted(async () => {
|
||||
const { id } = route.query;
|
||||
if (id) {
|
||||
orderApi.getHistoryList({
|
||||
orderId: id,
|
||||
});
|
||||
}
|
||||
init();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
Loading…
Reference in New Issue