Merge branch 'test' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dwb
This commit is contained in:
commit
933d70445e
|
|
@ -5,9 +5,9 @@ ENV = 'development'
|
|||
# VUE_APP_BASE_API = 'http://192.168.2.42:8000'
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.133:8000'
|
||||
# 测试
|
||||
# VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
|
||||
VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
|
||||
#预发布
|
||||
VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn'
|
||||
# VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn'
|
||||
|
||||
# 生产
|
||||
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ ENV = 'production'
|
|||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
||||
# 测试
|
||||
# VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
|
||||
VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
|
||||
|
||||
# 生产
|
||||
VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
import request from "@/utils/request";
|
||||
// 会员积分
|
||||
|
||||
/**
|
||||
* 基本设置-获取店铺设置
|
||||
* @returns
|
||||
*/
|
||||
export function basicSettingGet() {
|
||||
let shopId = localStorage.getItem("shopId");
|
||||
return request({
|
||||
url: `/api/points/basic-setting/${shopId}`,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 基本设置-保存
|
||||
* @returns
|
||||
*/
|
||||
export function basicSettingPost(data) {
|
||||
return request({
|
||||
url: "/api/points/basic-setting",
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品设置-新增/编辑
|
||||
* @returns
|
||||
*/
|
||||
export function goodsSettingAdd(data) {
|
||||
return request({
|
||||
url: "/api/points/goods-setting",
|
||||
method: data.id ? "put" : "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品设置-删除
|
||||
* @returns
|
||||
*/
|
||||
export function goodsDelete(id) {
|
||||
return request({
|
||||
url: `/api/points/goods-setting/${id}`,
|
||||
method: "DELETE"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品设置-列表
|
||||
* @returns
|
||||
*/
|
||||
export function goodsSettingPage(params) {
|
||||
let shopId = localStorage.getItem("shopId");
|
||||
return request({
|
||||
url: `/api/points/goods-setting/page`,
|
||||
method: "get",
|
||||
params: {
|
||||
...params,
|
||||
shopId: shopId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 兑换记录-列表
|
||||
* @returns
|
||||
*/
|
||||
export function exchangeRecordPage(params) {
|
||||
let shopId = localStorage.getItem("shopId");
|
||||
return request({
|
||||
url: `/api/points/exchange-record/page`,
|
||||
method: "get",
|
||||
params: {
|
||||
...params,
|
||||
shopId: shopId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 兑换记录-统计
|
||||
* @returns
|
||||
*/
|
||||
export function exchangeRecordTotal(params) {
|
||||
let shopId = localStorage.getItem("shopId");
|
||||
return request({
|
||||
url: `/api/points/exchange-record/total`,
|
||||
method: "get",
|
||||
params: {
|
||||
...params,
|
||||
shopId: shopId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 兑换记录-核销
|
||||
* @returns
|
||||
*/
|
||||
export function recordCheckout(data) {
|
||||
return request({
|
||||
url: "/api/points/exchange-record/checkout",
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
|
|
@ -0,0 +1,305 @@
|
|||
<!-- 兑换记录 -->
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<el-form :model="query" inline label-position="left">
|
||||
<el-form-item>
|
||||
<el-input placeholder="订单编号/核销码" v-model="query.keywords" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="query.pickupMethod" placeholder="领取方式" style="width: 140px;">
|
||||
<el-option label="自取" value="self"></el-option>
|
||||
<el-option label="邮寄" value="post"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="query.status" placeholder="状态" style="width: 140px;">
|
||||
<el-option label="待自取" value="waiting"></el-option>
|
||||
<el-option label="已完成" value="done"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']"
|
||||
value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="queryHandle">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<div class="collect_wrap">
|
||||
<div class="item">
|
||||
<div class="icon_wrap" style="--bg-color:#ADDBBC">
|
||||
<i class="icon el-icon-s-goods"></i>
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="m">{{ countData.count }}</div>
|
||||
<div class="t">总订单数</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="icon_wrap" style="--bg-color:#8CC4FC">
|
||||
<i class="icon el-icon-s-goods"></i>
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="m">¥{{ countData.totalAmount }}</div>
|
||||
<div class="t">已支付金额</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading">
|
||||
<el-table-column label="订单编号" prop="orderNo"></el-table-column>
|
||||
<el-table-column label="用户名" prop="memberName">
|
||||
<template v-slot="scope">
|
||||
<div class="goods_info">
|
||||
<el-image :src="scope.row.avatarUrl" style="width:40px;height:40px;flex-shrink: 0;"
|
||||
:preview-src-list="avatarUrlList" />
|
||||
<span>{{ scope.row.memberName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品" prop="pointsGoodsName">
|
||||
<template v-slot="scope">
|
||||
<div class="goods_info">
|
||||
<el-image :src="scope.row.goodsImageUrl" style="width:40px;height:40px;flex-shrink: 0;"
|
||||
:preview-src-list="srcList" />
|
||||
<span>{{ scope.row.pointsGoodsName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="使用积分" prop="spendPoints"></el-table-column>
|
||||
<el-table-column label="支付金额" prop="extraPaymentAmount"></el-table-column>
|
||||
<el-table-column label="领取方式" prop="pickupMethod">
|
||||
<template v-slot="scope">
|
||||
<el-tag type="success" effect="plain" disable-transitions
|
||||
v-if="scope.row.pickupMethod == 'self'">自取</el-tag>
|
||||
<el-tag type="info" effect="plain" disable-transitions
|
||||
v-if="scope.row.pickupMethod == 'post'">邮寄
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-tag type="warning" disable-transitions v-if="scope.row.status == 'waiting'">待自取</el-tag>
|
||||
<el-tag type="success" disable-transitions v-if="scope.row.status == 'done'">已完成</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下单时间" prop="createTime"></el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" icon="el-icon-finished" disabled
|
||||
v-if="scope.row.status == 'done'">已完成</el-button>
|
||||
<template v-else>
|
||||
<el-popconfirm title="确定核销吗?" @confirm="confirmOrder(scope.row.couponCode)">
|
||||
<el-button type="text" icon="el-icon-finished" slot="reference">待核销</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" @size-change="handleSizeChange" :current-page="tableData.page"
|
||||
:page-size="tableData.size" @current-change="paginationChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { exchangeRecordPage, exchangeRecordTotal, recordCheckout } from '@/api/points.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
srcList: [],
|
||||
avatarUrlList: [],
|
||||
countData: {
|
||||
count: 0,
|
||||
totalAmount: 0
|
||||
},
|
||||
query: {
|
||||
keywords: '',
|
||||
beginDate: '',
|
||||
endDate: '',
|
||||
status: '',
|
||||
pickupMethod: '',
|
||||
createdAt: []
|
||||
},
|
||||
resetQuery: '',
|
||||
tableData: {
|
||||
list: [],
|
||||
page: 1,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetQuery = { ...this.query }
|
||||
this.getTableData()
|
||||
this.exchangeRecordTotal()
|
||||
},
|
||||
methods: {
|
||||
// 核销
|
||||
async confirmOrder(couponCode) {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
await recordCheckout({ couponCode: couponCode })
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '核销成功',
|
||||
type: 'success'
|
||||
})
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
this.tableData.loading = false
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 统计
|
||||
async exchangeRecordTotal() {
|
||||
try {
|
||||
const { count, totalAmount } = await exchangeRecordTotal({
|
||||
keywords: this.query.keywords,
|
||||
beginDate: this.query.createdAt[0] || '',
|
||||
endDate: this.query.createdAt[1] || '',
|
||||
status: this.query.status,
|
||||
pickupMethod: this.query.pickupMethod
|
||||
})
|
||||
this.countData.count = count
|
||||
this.countData.totalAmount = totalAmount
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 查询
|
||||
queryHandle() {
|
||||
this.getTableData()
|
||||
this.exchangeRecordTotal()
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.query = { ...this.resetQuery }
|
||||
this.page = 1
|
||||
this.size = 30
|
||||
this.getTableData()
|
||||
this.exchangeRecordTotal()
|
||||
},
|
||||
// 分页大小改变
|
||||
handleSizeChange(val) {
|
||||
this.tableData.size = val
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 获取表格数据
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await exchangeRecordPage({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
keywords: this.query.keywords,
|
||||
beginDate: this.query.createdAt[0] || '',
|
||||
endDate: this.query.createdAt[1] || '',
|
||||
status: this.query.status,
|
||||
pickupMethod: this.query.pickupMethod
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
// 预览图集合
|
||||
this.srcList = res.content.map(item => item.goodsImageUrl)
|
||||
// 头像预览图集合
|
||||
this.avatarUrlList = res.content.map(item => item.avatarUrl)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.goods_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.collect_wrap {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
|
||||
.item {
|
||||
width: 200px;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,290 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="140px" label-position="left">
|
||||
<el-form-item label="是否消费赠送积分">
|
||||
<el-switch v-model.trim="form.enableRewards" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="费赠送积分" prop="consumeAmount" v-if="form.enableRewards">
|
||||
<el-input v-model="form.consumeAmount" style="width: 250px;"
|
||||
@input="inputFilterInt($event, 'consumeAmount')">
|
||||
<template slot="prepend">每消费</template>
|
||||
<template slot="append">元赠送1积分</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="开启下单积分抵扣" style="margin-top: 50px;">
|
||||
<el-switch v-model.trim="form.enableDeduction" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<template v-if="form.enableDeduction">
|
||||
<el-form-item label="下单积分抵扣门槛" prop="minDeductionPoint">
|
||||
<el-input v-model="form.minDeductionPoint" style="width: 150px;"
|
||||
@input="inputFilterInt($event, 'minDeductionPoint')">
|
||||
<template slot="append">积分</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="下单最高抵扣比例" prop="maxDeductionRatio">
|
||||
<el-input v-model="form.maxDeductionRatio" style="width: 150px;"
|
||||
@input="inputFilterInt($event, 'maxDeductionRatio')">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="下单抵扣积分比例" prop="equivalentPoints">
|
||||
<el-input v-model="form.equivalentPoints" style="width: 220px;"
|
||||
@input="inputFilterInt($event, 'equivalentPoints')">
|
||||
<template slot="prepend">1元等于</template>
|
||||
<template slot="append">积分</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item label="开启积分商城" style="margin-top: 50px;">
|
||||
<el-switch v-model.trim="form.enablePointsMall" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="显示样式" v-if="form.enablePointsMall">
|
||||
<div class="style_wrap">
|
||||
<div class="item style1" :class="{ active: form.browseMode == 'list' }"
|
||||
@click="form.browseMode = 'list'">
|
||||
<div class="row">
|
||||
<div class="cover"></div>
|
||||
<div class="info">
|
||||
<div class="line"></div>
|
||||
<div class="line"></div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="cover"></div>
|
||||
<div class="info">
|
||||
<div class="line"></div>
|
||||
<div class="line"></div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item style2" :class="{ active: form.browseMode == 'grid' }"
|
||||
@click="form.browseMode = 'grid'">
|
||||
<div class="row">
|
||||
<div class="cover"></div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="cover"></div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="cover"></div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="cover"></div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">保存</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { basicSettingGet, basicSettingPost } from '@/api/points.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
form: {
|
||||
id: '',
|
||||
enableRewards: 1,
|
||||
consumeAmount: "",
|
||||
enableDeduction: 1,
|
||||
minDeductionPoint: "",
|
||||
maxDeductionRatio: "",
|
||||
equivalentPoints: "",
|
||||
enablePointsMall: 1,
|
||||
browseMode: 'list'
|
||||
},
|
||||
rules: {
|
||||
consumeAmount: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
minDeductionPoint: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
maxDeductionRatio: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
equivalentPoints: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.basicSettingGet()
|
||||
},
|
||||
methods: {
|
||||
// 过滤input只能输入整数
|
||||
inputFilterInt(e, key) {
|
||||
if (!e) return
|
||||
setTimeout(() => {
|
||||
this.form[key] = e.replace(/[^\d]/g, '')
|
||||
}, 50)
|
||||
},
|
||||
// 提交
|
||||
onSubmitHandle() {
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.loading = true
|
||||
this.form.shopId = localStorage.getItem('shopId')
|
||||
await basicSettingPost(this.form)
|
||||
this.loading = false
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `保存成功`,
|
||||
type: 'success'
|
||||
});
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取店铺设置
|
||||
async basicSettingGet() {
|
||||
try {
|
||||
const res = await basicSettingGet()
|
||||
if (res.id) {
|
||||
this.form = res
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.style_wrap {
|
||||
display: flex;
|
||||
width: 350px;
|
||||
gap: 50px;
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
$color: #3F9EFF;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: $color;
|
||||
}
|
||||
|
||||
.cover {
|
||||
background-color: $color;
|
||||
}
|
||||
|
||||
.line {
|
||||
background-color: #D9D9D9;
|
||||
}
|
||||
|
||||
&.style1 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
|
||||
.row {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
|
||||
.cover {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding-left: 10px;
|
||||
|
||||
.line {
|
||||
flex: 1;
|
||||
|
||||
&:nth-child(1) {
|
||||
width: 80%;
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
&:nth-child(3) {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.style2 {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-template-rows: repeat(2, 1fr);
|
||||
grid-column-gap: 10px;
|
||||
grid-row-gap: 10px;
|
||||
|
||||
.row:nth-child(1) {
|
||||
grid-area: 1 / 1 / 2 / 2;
|
||||
}
|
||||
|
||||
.row:nth-child(2) {
|
||||
grid-area: 1 / 2 / 2 / 3;
|
||||
}
|
||||
|
||||
.row:nth-child(3) {
|
||||
grid-area: 2 / 1 / 3 / 2;
|
||||
}
|
||||
|
||||
.row:nth-child(4) {
|
||||
grid-area: 2 / 2 / 3 / 3;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.cover {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.line {
|
||||
height: 4px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,247 @@
|
|||
<!-- 添加积分商品/优惠券 -->
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog :title="form.id ? '编辑商品' : '添加商品'" :visible.sync="dialogVisible" @close="reset">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
||||
<el-form-item label="奖品类型">
|
||||
<el-radio-group v-model="form.goodsCategory">
|
||||
<el-radio label="physical">实物商品</el-radio>
|
||||
<!-- <el-radio label="coupon">优惠券</el-radio> -->
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品图片" prop="goodsImageUrl">
|
||||
<div class="img_list">
|
||||
<div class="item" v-if="form.goodsImageUrl" @click="form.goodsImageUrl = ''">
|
||||
<el-image :src="form.goodsImageUrl" style="width: 100%;height: 100%" />
|
||||
<div class="del">删除</div>
|
||||
</div>
|
||||
<div class="item upload" @click="$refs.addImg.show()" v-else>
|
||||
<i class="icon el-icon-plus"></i>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称" prop="goodsName">
|
||||
<el-input v-model="form.goodsName" placeholder="请输入商品名称" style="width: 300px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="所需积分" prop="requiredPoints">
|
||||
<el-input v-model="form.requiredPoints" style="width: 130px;"
|
||||
@input="inputFilterInt($event, 'requiredPoints')">
|
||||
<template slot="append">积分</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="额外价格" prop="extraPrice">
|
||||
<el-input v-model="form.extraPrice" style="width: 130px;"
|
||||
@input="inputFilterFloat($event, 'extraPrice')">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-input-number v-model="form.quantity" :min="1"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序">
|
||||
<el-input-number v-model="form.sort" :min="0"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否上架">
|
||||
<el-switch v-model.trim="form.status" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<addImg ref="addImg" @successEvent="e => form.goodsImageUrl = e[0].url" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { goodsSettingAdd } from '@/api/points.js'
|
||||
import addImg from "@/views/product/components/addImages.vue";
|
||||
export default {
|
||||
components: {
|
||||
addImg
|
||||
},
|
||||
data() {
|
||||
const validateCoverImg = (rule, value, callback) => {
|
||||
if (!this.form.goodsImageUrl) {
|
||||
callback(new Error("请上传商品图片"));
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
form: {
|
||||
goodsCategory: 'physical',
|
||||
goodsName: '',
|
||||
goodsImageUrl: '',
|
||||
requiredPoints: '',
|
||||
extraPrice: 0,
|
||||
quantity: '',
|
||||
status: 1,
|
||||
sort: 0,
|
||||
goodsDescription: ''
|
||||
},
|
||||
resetForm: '',
|
||||
rules: {
|
||||
goodsName: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
goodsImageUrl: [
|
||||
{
|
||||
required: true,
|
||||
validator: validateCoverImg,
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
requiredPoints: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
extraPrice: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetForm = { ...this.form }
|
||||
},
|
||||
methods: {
|
||||
// 过滤input只能输入整数
|
||||
inputFilterInt(e, key) {
|
||||
if (!e) return
|
||||
setTimeout(() => {
|
||||
this.form[key] = e.replace(/[^\d]/g, '')
|
||||
}, 50)
|
||||
},
|
||||
// 过滤input只能输入数字,并且最多输入两位小数
|
||||
inputFilterFloat(value, key) {
|
||||
if (!value) return
|
||||
// 去除首位小数点
|
||||
if (value.startsWith('.')) {
|
||||
value = value.slice(1);
|
||||
}
|
||||
// 清除非数字和小数点(除了第一个小数点)
|
||||
value = value.replace(/[^\d.]/g, '');
|
||||
// 确保最多只有一个小数点
|
||||
if (value.split('.').length > 2) {
|
||||
value = value.split('.').slice(0, 2).join('.');
|
||||
}
|
||||
// 限制小数位数为两位
|
||||
if (value.split('.')[1] && value.split('.')[1].length > 2) {
|
||||
value = value.split('.')[0] + '.' + value.split('.')[1].slice(0, 2);
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.form[key] = value
|
||||
}, 50)
|
||||
},
|
||||
// 提交
|
||||
onSubmitHandle() {
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.loading = true
|
||||
this.form.shopId = localStorage.getItem('shopId')
|
||||
await goodsSettingAdd(this.form)
|
||||
this.loading = false
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `${this.form.id ? '编辑' : '添加'}成功`,
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('success')
|
||||
this.close()
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
reset() {
|
||||
this.form = { ...this.resetForm }
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
show(row) {
|
||||
if (row && row.id) {
|
||||
this.form = { ...row }
|
||||
}
|
||||
this.dialogVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.img_list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
|
||||
.item {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #F5F7FA;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
&.upload {
|
||||
border: 1px dashed #ddd;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
|
||||
.del {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.del {
|
||||
width: 100%;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
backdrop-filter: blur(3px);
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
transform: translateY(100%);
|
||||
transition: all .2s ease-in-out;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 20px;
|
||||
color: #ddd;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
<template>
|
||||
<div>
|
||||
<div><el-button type="primary" @click="$refs.ShopAdd.show()">添加商品</el-button></div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading">
|
||||
<el-table-column label="商品" prop="goodsName">
|
||||
<template v-slot="scope">
|
||||
<div class="goods_info">
|
||||
<el-image :src="scope.row.goodsImageUrl" style="width:40px;height:40px;flex-shrink: 0;"
|
||||
:preview-src-list="srcList" />
|
||||
<span>{{ scope.row.goodsName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所需积分" prop="requiredPoints"></el-table-column>
|
||||
<el-table-column label="额外价格「元」" prop="extraPrice"></el-table-column>
|
||||
<el-table-column label="累计兑换次数" prop="totalExchangeCount"></el-table-column>
|
||||
<el-table-column label="库存" prop="quantity"></el-table-column>
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-tag type="success" disable-transitions v-if="scope.row.status == 1">上架</el-tag>
|
||||
<el-tag type="danger" disable-transitions v-if="scope.row.status == 0">下架</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" icon="el-icon-edit" @click="editorHandle(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle(scope.row.id)">
|
||||
<el-button type="text" icon="el-icon-delete" slot="reference">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" @size-change="handleSizeChange" :current-page="tableData.page"
|
||||
:page-size="tableData.size" @current-change="paginationChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
<!-- 添加积分商品/积分 -->
|
||||
<ShopAdd ref="ShopAdd" @success="resetTable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ShopAdd from './shop_add.vue'
|
||||
import { goodsSettingPage, goodsDelete } from '@/api/points.js'
|
||||
export default {
|
||||
components: { ShopAdd },
|
||||
data() {
|
||||
return {
|
||||
srcList: [],
|
||||
tableData: {
|
||||
sort: 'createdAt,desc',
|
||||
list: [],
|
||||
page: 1,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
},
|
||||
methods: {
|
||||
// 编辑 预览
|
||||
editorHandle(row) {
|
||||
this.$refs.ShopAdd.show(row)
|
||||
},
|
||||
// 删除
|
||||
async delTableHandle(id) {
|
||||
try {
|
||||
await goodsDelete(id)
|
||||
this.$message.success('已删除')
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
resetTable() {
|
||||
this.tableData.page = 1
|
||||
this.tableData.size = 30
|
||||
this.getTableData()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.tableData.size = val
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 获取积分商品列表
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await goodsSettingPage({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
goodsName: '',
|
||||
goodsCategory: 'physical',
|
||||
status: ''
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
// 预览图集合
|
||||
this.srcList = res.content.map(item => item.goodsImageUrl)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.head-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.goods_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,3 +1,37 @@
|
|||
<template>
|
||||
<div>会员积分</div>
|
||||
</template>
|
||||
<div class="app-container">
|
||||
<el-tabs v-model="activeName" type="card">
|
||||
<el-tab-pane label="基本设置" name="1"></el-tab-pane>
|
||||
<el-tab-pane label="商品设置" name="2"></el-tab-pane>
|
||||
<el-tab-pane label="兑换记录" name="3"></el-tab-pane>
|
||||
</el-tabs>
|
||||
<Setting v-if="activeName == 1" />
|
||||
<ShopList v-if="activeName == 2" />
|
||||
<Record v-if="activeName == 3" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Setting from './components/member_points/setting.vue'
|
||||
import ShopList from './components/member_points/shop_list.vue'
|
||||
import Record from './components/member_points/record.vue'
|
||||
export default {
|
||||
name: "member_points",
|
||||
components: {
|
||||
Setting,
|
||||
ShopList,
|
||||
Record
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeName: '1'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
:deep(.el-tabs) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
<el-button type="primary" icon="el-icon-plus" @click="clickdialogframe('add')">添加</el-button>
|
||||
<el-button @click="$router.push({ name: 'operation_in' })">入库</el-button>
|
||||
<el-button @click="$router.push({ name: 'operation_out' })">出库</el-button>
|
||||
<el-button @click="$router.push({ name: 'cons_record' })">耗材记录</el-button>
|
||||
<!-- <el-button @click="$router.push({ name: 'cons_record' })">耗材记录</el-button> -->
|
||||
<el-button @click="$router.push({ name: 'type' })">分类管理</el-button>
|
||||
<el-button @click="$router.push({ name: 'supplier_manage' })">供应商管理</el-button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-drawer title="订单详情" size="50%" :visible.sync="drawer" direction="rtl" v-loading="loading">
|
||||
<el-drawer title="订单详情" size="50%" :visible.sync="drawer" direction="rtl" v-loading="loading" >
|
||||
<div class="header">
|
||||
<div class="title" style="text-align: center;">【收银订单】</div>
|
||||
<div class="container">
|
||||
|
|
@ -105,7 +105,12 @@
|
|||
<el-table-column label="商品">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
<el-image :src="scope.row.productImg" style="width: 40px;height: 40px;"></el-image>
|
||||
<el-image v-if="scope.row.productSkuId!='-999'" :src="scope.row.productImg" style="width: 40px;height: 40px;"></el-image>
|
||||
<div class="packeFee" v-else>
|
||||
<span>
|
||||
{{ scope.row.productName ||'客座费'}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="info">
|
||||
<span :class="[scope.row.isVip == 1 ? 'colorStyle' : '']">{{ scope.row.productName }}</span>
|
||||
<span style="color: #999;">{{
|
||||
|
|
@ -130,14 +135,18 @@
|
|||
¥{{ scope.row.priceAmount }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="操作">
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<template v-if="scope.row.status!='refund'">
|
||||
<el-button v-if="detail.status=='closed'||detail.status=='refund'" type="text" size="mini" @click="tuikuan(scope.row)"><span >退款</span></el-button>
|
||||
<template v-if="scope.row.status!='unpaid'">
|
||||
<el-button v-if="canTuikuan(scope.row)" type="text" size="mini" @click="tuikuan(scope.row)"><span >退款</span></el-button>
|
||||
<span class="color-999" v-else>已退款</span>
|
||||
</template>
|
||||
<template v-if="scope.row.status=='unpaid'">
|
||||
<el-button v-if="canTuicai(scope.row)" type="text" size="mini" @click="tuiCai(scope.row)"><span >退菜</span></el-button>
|
||||
<span class="color-999" v-else>已退菜</span>
|
||||
</template>
|
||||
<el-button v-if="detail.status=='unpaid'" type="text" size="mini" @click="tuiCai(scope.row)"><span >退菜</span></el-button>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- </el-tab-pane> -->
|
||||
|
|
@ -226,6 +235,7 @@ import returnMoney from "@/views/tool/Instead/components/return-money.vue";
|
|||
import {
|
||||
$returnCart,$returnOrder
|
||||
} from "@/api/table";
|
||||
import * as $util from '../order_goods_util.js'
|
||||
export default {
|
||||
components: { returnCart,returnMoney },
|
||||
|
||||
|
|
@ -270,7 +280,24 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
drawer:function(newval){
|
||||
if(!newval){
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
close(){
|
||||
console.log('drawer close')
|
||||
this.$emit('close');
|
||||
},
|
||||
canTuikuan(item){
|
||||
return $util.canTuiKuan(this.detail,item);
|
||||
},
|
||||
canTuicai(item){
|
||||
return $util.canTuicai(this.detail,item);
|
||||
},
|
||||
async refReturnMoneyConfirm(e){
|
||||
const res = await $returnOrder({
|
||||
...e,
|
||||
|
|
@ -280,6 +307,7 @@ export default {
|
|||
num:e.num
|
||||
}]
|
||||
});
|
||||
this.$message.success("退款成功");
|
||||
this.update();
|
||||
},
|
||||
update(){
|
||||
|
|
@ -288,9 +316,10 @@ export default {
|
|||
async refReturnCartConfirm(e){
|
||||
const res = await $returnCart({
|
||||
...e,
|
||||
cartId: this.selGoods.id,
|
||||
cartId: this.selGoods.cartId,
|
||||
tableId: this.detail.tableId,
|
||||
});
|
||||
this.$message.success("退菜成功");
|
||||
this.update();
|
||||
},
|
||||
tuikuan(item){
|
||||
|
|
@ -345,6 +374,18 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.packeFee{
|
||||
width: 40px;
|
||||
box-sizing: border-box;
|
||||
height: 40px;
|
||||
background: #3f9eff;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.shop_info {
|
||||
display: flex;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
export function canComputedPackFee(v) {
|
||||
return v.pack && v.status != 'return' && v.status != 'refund' && v.status != 'refunding'
|
||||
}
|
||||
export function returnCanComputedGoodsArr(arr) {
|
||||
return arr.filter(v=>canComputedPackFee(v))
|
||||
}
|
||||
export function returnPackFee(arr) {
|
||||
return arr.reduce((prve, cur) => {
|
||||
return prve + cur.packAmount
|
||||
}, 0).toFixed(2)
|
||||
}
|
||||
|
||||
export function canTuicai(orderInfo,item){
|
||||
return orderInfo.status=='unpaid'&&orderInfo.useType!='dine-in-before'&& item.status!='return'
|
||||
}
|
||||
export function canTuiKuan(orderInfo,item){
|
||||
return orderInfo.status!='unpaid'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding'
|
||||
}
|
||||
export function isTui(item){
|
||||
return item.status=='return'||item.status=='refund'||item.status=='refunding'
|
||||
}
|
||||
export function numSum(arr){
|
||||
const sum=arr.reduce((a,b)=>{
|
||||
return a+b*100
|
||||
},0)
|
||||
return (sum/100).toFixed(2)
|
||||
}
|
||||
|
|
@ -146,9 +146,12 @@
|
|||
{{ scope.row.createdAt | timeFilter }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100">
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" @click="$refs.orderDetail.show(scope.row)">详情</el-button>
|
||||
<div class="u-flex gap-10">
|
||||
<el-button type="text" @click="$refs.orderDetail.show(scope.row)">详情</el-button>
|
||||
<el-button v-if="scope.row.status == 'unpaid'" type="primary" size="mini" @click="payOrder(scope.row)">结账</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -158,7 +161,7 @@
|
|||
@current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
<orderDetail ref="orderDetail" />
|
||||
<orderDetail ref="orderDetail" @close="getTableData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -248,6 +251,21 @@ export default {
|
|||
|
||||
},
|
||||
methods: {
|
||||
//结账
|
||||
payOrder(order){
|
||||
console.log(order);
|
||||
this.$router.push({
|
||||
path: "/tool/Instead/index",
|
||||
query: {
|
||||
table_name: order.tableName,
|
||||
tableId: order.tableId,
|
||||
useType: order.useType,
|
||||
masterId: order.masterId,
|
||||
orderId: order.id,
|
||||
key:'isJieZhang'
|
||||
},
|
||||
});
|
||||
},
|
||||
// 获取订单汇总
|
||||
async payCount() {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<div class="head-container">
|
||||
<div class="header_wrap">
|
||||
<!-- <router-link :to="{ name: 'add_shop' }" > -->
|
||||
<el-button type="primary" icon="el-icon-plus" @click="toPath( '/product/add_shop')">添加商品</el-button>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="toPath('/product/add_shop')">添加商品</el-button>
|
||||
<!-- </router-link> -->
|
||||
<el-select v-model="tableData.sort" placeholder="排序" @change="getTableData">
|
||||
<el-option value="createdAt,desc" label="创建时间"></el-option>
|
||||
|
|
@ -139,7 +139,7 @@
|
|||
<div class="cons_wrap" v-if="scope.row.typeEnum">
|
||||
<div v-if="scope.row.conInfos && scope.row.conInfos.length">
|
||||
<el-button type="text" @click="showBindCons(scope.row)">
|
||||
{{ scope.row.conInfos | conInfosFilter }}
|
||||
<span class="cons_span">{{ scope.row.conInfos | conInfosFilter }}</span>
|
||||
<i class="el-icon-edit"></i>
|
||||
</el-button>
|
||||
</div>
|
||||
|
|
@ -189,7 +189,7 @@
|
|||
style="margin-left: 20px !important;">
|
||||
<el-button type="text" icon="el-icon-edit">编辑</el-button>
|
||||
</router-link> -->
|
||||
<el-button type="text" icon="el-icon-edit" @click="toPath( '/product/add_shop' ,scope.row )">编辑</el-button>
|
||||
<el-button type="text" icon="el-icon-edit" @click="toPath('/product/add_shop', scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
|
||||
slot="reference">删除</el-button>
|
||||
|
|
@ -316,14 +316,14 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
// 是否允许修改商品
|
||||
async toPath ( path , row) {
|
||||
async toPath(path, row) {
|
||||
let res = await hasPermission('允许修改商品');
|
||||
if ( !res) { return; }
|
||||
if (!res) { return; }
|
||||
let query = {};
|
||||
if ( row ) {
|
||||
if (row) {
|
||||
query.goods_id = row.id;
|
||||
}
|
||||
this.$router.push({path: path, query: query})
|
||||
this.$router.push({ path: path, query: query })
|
||||
},
|
||||
// 显示修改商品警告线
|
||||
showStockWarningHandle() {
|
||||
|
|
@ -384,13 +384,13 @@ export default {
|
|||
},
|
||||
async changeGrounding(event, row, key) {
|
||||
let text;
|
||||
if (key == 'grounding') { text = "允许上下架商品"}
|
||||
if (key == 'pauseSale') { text = "允许售罄商品"}
|
||||
if (key == 'grounding') { text = "允许上下架商品" }
|
||||
if (key == 'pauseSale') { text = "允许售罄商品" }
|
||||
let res = await hasPermission(text);
|
||||
if ( !res) {
|
||||
if (key == 'grounding') { row.isGrounding = (event == 0 ? 1 : 0);}
|
||||
if (key == 'pauseSale') { row.isPauseSale = (event == 0 ? 1 : 0);}
|
||||
return;
|
||||
if (!res) {
|
||||
if (key == 'grounding') { row.isGrounding = (event == 0 ? 1 : 0); }
|
||||
if (key == 'pauseSale') { row.isPauseSale = (event == 0 ? 1 : 0); }
|
||||
return;
|
||||
}
|
||||
this.editorForm.key = key
|
||||
this.editorForm.id = row.id
|
||||
|
|
@ -416,7 +416,7 @@ export default {
|
|||
// 修改库存
|
||||
async changePrice(type, row) {
|
||||
let res = await hasPermission('允许修改商品库存');
|
||||
if ( !res) { return; }
|
||||
if (!res) { return; }
|
||||
this.editorVisable = true
|
||||
this.editorForm.key = type
|
||||
this.editorForm.id = row.id
|
||||
|
|
@ -438,7 +438,7 @@ export default {
|
|||
// 显示绑定耗材
|
||||
async showBindCons(item) {
|
||||
let res = await hasPermission('允许修改商品');
|
||||
if ( !res) { return; }
|
||||
if (!res) { return; }
|
||||
// console.log(item);
|
||||
this.$refs.bindCons.show(item)
|
||||
},
|
||||
|
|
@ -563,7 +563,7 @@ export default {
|
|||
// 删除商品
|
||||
async delTableHandle(ids) {
|
||||
let res = await hasPermission('允许修改商品');
|
||||
if ( !res) { return; }
|
||||
if (!res) { return; }
|
||||
try {
|
||||
await tbProductDelete(ids)
|
||||
this.getTableData()
|
||||
|
|
@ -576,6 +576,10 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.cons_span {
|
||||
white-space: break-spaces;
|
||||
}
|
||||
|
||||
.header_wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
|||
|
|
@ -152,6 +152,24 @@
|
|||
<div class="shop_name">{{ shopName }}</div>
|
||||
<img class="content" src="@/assets/images/shop_editor_bg.png" alt="">
|
||||
</div>
|
||||
<div class="ticket_wrap" v-if="tableActive == 'ticket_logo'">
|
||||
<img class="logo" :src="selectItem.value">
|
||||
<img class="ewm" src="@/assets/images/1024.png">
|
||||
<div class="row">
|
||||
<span class="num">123</span>
|
||||
<span>座位号:#A9</span>
|
||||
</div>
|
||||
<div class="row">甜橙马黛茶</div>
|
||||
<div class="row">
|
||||
<span class="sku">加珍珠、加糖</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="b">2020-10-24 13:14:52</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="sku">建议尽快享用,风味更佳</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="editor_wrap">
|
||||
|
|
@ -272,11 +290,11 @@ export default {
|
|||
|
||||
.phone_wrap {
|
||||
width: 100%;
|
||||
height: 686px;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
|
||||
.index_bg {
|
||||
padding-bottom: 50px;
|
||||
.bg {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
|
|
@ -363,6 +381,7 @@ export default {
|
|||
.my_bg {
|
||||
background-color: #f5f5f5;
|
||||
height: 100%;
|
||||
padding-bottom: 50px;
|
||||
|
||||
.bg {
|
||||
width: 100%;
|
||||
|
|
@ -481,6 +500,7 @@ export default {
|
|||
height: 100%;
|
||||
background-color: #f5f5f5;
|
||||
padding: 10px;
|
||||
padding-bottom: 400px;
|
||||
|
||||
.card_wrap {
|
||||
background-color: #fff;
|
||||
|
|
@ -616,6 +636,46 @@ export default {
|
|||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.ticket_wrap {
|
||||
padding: 15px;
|
||||
position: relative;
|
||||
|
||||
.ewm {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 15px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 90px;
|
||||
height: 30px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.row {
|
||||
margin-top: 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.sku {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.b {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,16 @@
|
|||
<el-checkbox label="take-out">允许打包</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用会员价">
|
||||
<el-switch v-model.trim="form.isMemberPrice" :active-value="1" ::inactive-value="0"></el-switch>
|
||||
<!-- <div style="color: #999;">是否允许用户在小程序端支付订单</div> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="积分群体">
|
||||
<el-radio-group v-model="form.consumeColony">
|
||||
<el-radio label="all">所有</el-radio>
|
||||
<el-radio label="vip">仅针对会员</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="phone">
|
||||
<el-input v-model.trim="form.phone" placeholder="请输入联系电话" style="width: 500px;"></el-input>
|
||||
</el-form-item>
|
||||
|
|
@ -225,7 +235,8 @@ export default {
|
|||
formLoading: false,
|
||||
form: {
|
||||
eatModel: [],
|
||||
paymentQrcode: ''
|
||||
paymentQrcode: '',
|
||||
consumeColony: 'all'
|
||||
},
|
||||
rules: {
|
||||
shopName: [
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
}"
|
||||
>
|
||||
<span v-if="isSeatFee"> ¥{{ item.totalAmount }}</span>
|
||||
<span v-else> ¥{{ item.totalAmount }}</span>
|
||||
<span v-else> ¥{{ (item.salePrice*item.number+(item.packAmount||0)).toFixed(2) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ export default {
|
|||
}
|
||||
if (curretnMoney > money) {
|
||||
this.$message.error("实收金额不能大于总金额");
|
||||
this.form.curretnMoney = 0;
|
||||
this.form.curretnMoney = form.money;
|
||||
}
|
||||
this.form.reduceMoney = (money - this.form.curretnMoney).toFixed(2);
|
||||
this.form.discount =toFixedNoRounding( ((this.form.curretnMoney / money) * 100).toFixed(3) );
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ export default {
|
|||
<style lang="scss" scoped>
|
||||
::v-deep .number-box .el-input__inner {
|
||||
border: none;
|
||||
padding: 0 2px;
|
||||
text-align: center;
|
||||
}
|
||||
.icon-add {
|
||||
color: #1890ff;
|
||||
|
|
|
|||
|
|
@ -1,19 +1,32 @@
|
|||
<template>
|
||||
<el-dialog title="退菜" width="410px" :visible.sync="show" @close="reset" :modal="modal">
|
||||
<div class="flex u-row-between u-p-b-20 border-bottom">
|
||||
<span>退菜数量</span>
|
||||
<div class="u-flex">
|
||||
<number-box v-model="number" :min="1" :max="max"></number-box>
|
||||
<el-dialog
|
||||
title="退菜"
|
||||
width="410px"
|
||||
:visible.sync="show"
|
||||
@close="reset"
|
||||
:modal="modal"
|
||||
>
|
||||
<div class="u-p-b-16 border-bottom">
|
||||
<div class="flex u-row-between">
|
||||
<span>退菜数量</span>
|
||||
<div class="u-flex" v-if="!isSeatFee">
|
||||
<number-box v-model="number" :min="1" :max="max"></number-box>
|
||||
</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-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="u-flex u-flex-wrap tags">
|
||||
<div
|
||||
class="tag"
|
||||
v-for="(tag, index) in tags"
|
||||
|
|
@ -41,28 +54,23 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import numberBox from './number-box.vue';
|
||||
import numberBox from "./number-box.vue";
|
||||
import {returnIsSeatFee} from '../util.js'
|
||||
export default {
|
||||
components:{numberBox},
|
||||
props:{
|
||||
modal:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
components: { numberBox },
|
||||
props: {
|
||||
modal: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
goods:{
|
||||
type:Object,
|
||||
default:()=>{
|
||||
return{}
|
||||
}
|
||||
max: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
max:{
|
||||
type:Number,
|
||||
default:1
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
number:1,
|
||||
number: 1,
|
||||
isPrint: false,
|
||||
tagSel: -1,
|
||||
show: false,
|
||||
|
|
@ -72,17 +80,27 @@ export default {
|
|||
{ label: "等待时间过长", checked: false },
|
||||
],
|
||||
note: "",
|
||||
goods:{
|
||||
productId: -999
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
computed:{
|
||||
isSeatFee(){
|
||||
return returnIsSeatFee(this.goods)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeSel(item) {
|
||||
item.checked = !item.checked;
|
||||
},
|
||||
reset() {
|
||||
this.note = "";
|
||||
this.number=1;
|
||||
console.log(this.number)
|
||||
this.number = 1;
|
||||
this.tags.map(v=>{
|
||||
v.checked = false;
|
||||
})
|
||||
console.log(this.number);
|
||||
},
|
||||
delTag(index) {
|
||||
this.tags.splice(index, 1);
|
||||
|
|
@ -93,22 +111,30 @@ export default {
|
|||
}
|
||||
this.note = tag + "," + this.note;
|
||||
},
|
||||
open(note) {
|
||||
open(item) {
|
||||
this.goods = item?item:this.goods;
|
||||
this.show = true;
|
||||
this.number=1;
|
||||
if (item != "-999") {
|
||||
this.number = 1;
|
||||
} else {
|
||||
this.number = item.num;
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.show = false;
|
||||
this.number=1;
|
||||
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){
|
||||
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 this.$message.error("请输入退菜原因");
|
||||
}
|
||||
this.$emit("confirm", {note:note,num:this.number});
|
||||
this.$emit("confirm", { note: note, num: this.number });
|
||||
this.close();
|
||||
},
|
||||
},
|
||||
|
|
@ -120,6 +146,7 @@ export default {
|
|||
::v-deep .el-dialog__body {
|
||||
margin-bottom: 14px;
|
||||
margin-top: 14px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
::v-deep .el-tag {
|
||||
margin-top: 10px;
|
||||
|
|
|
|||
|
|
@ -46,11 +46,12 @@
|
|||
trigger="click"
|
||||
v-model="tableShow"
|
||||
>
|
||||
<el-input
|
||||
<el-input
|
||||
placeholder="请输入内容"
|
||||
prefix-icon="el-icon-search"
|
||||
v-model="tableSearchText"
|
||||
@input="searchInput">
|
||||
@input="searchInput"
|
||||
>
|
||||
</el-input>
|
||||
<div style="max-height: 398px; overflow-y: scroll" class="u-m-t-12">
|
||||
<div
|
||||
|
|
@ -233,7 +234,9 @@
|
|||
|
||||
<div class="u-flex">
|
||||
<div class="u-p-r-14 border-r u-m-r-14">
|
||||
<template v-if="!shopInfo.isTableFee">
|
||||
<template
|
||||
v-if="!shopInfo.isTableFee && key != 'isJieZhang'"
|
||||
>
|
||||
<div
|
||||
class="u-flex cur-pointer"
|
||||
@click="
|
||||
|
|
@ -404,7 +407,11 @@
|
|||
<div class="flex mt-14">
|
||||
<template v-if="table">
|
||||
<template v-if="!postPay">
|
||||
<template v-if="isCreateOrder">
|
||||
<template
|
||||
v-if="
|
||||
postPay && isCreateOrder && table && table.tableId
|
||||
"
|
||||
>
|
||||
<!-- <template v-if="false"> -->
|
||||
<button
|
||||
class="my-btn flex-1 default"
|
||||
|
|
@ -414,26 +421,28 @@
|
|||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button
|
||||
class="my-btn flex-1 primary"
|
||||
@click="scanPayClick"
|
||||
>
|
||||
<span>微信/支付宝</span>
|
||||
</button>
|
||||
<div style="width: 15px"></div>
|
||||
<button
|
||||
class="my-btn flex-1 primary"
|
||||
@click="cashPayClick"
|
||||
>
|
||||
<span>现金</span>
|
||||
</button>
|
||||
<div style="width: 15px"></div>
|
||||
<button
|
||||
class="my-btn flex-1 default"
|
||||
@click="morePayClick"
|
||||
>
|
||||
<span>更多支付</span>
|
||||
</button>
|
||||
<template v-if="key != 'isJieZhang'">
|
||||
<button
|
||||
class="my-btn flex-1 primary"
|
||||
@click="scanPayClick"
|
||||
>
|
||||
<span>微信/支付宝</span>
|
||||
</button>
|
||||
<div style="width: 15px"></div>
|
||||
<button
|
||||
class="my-btn flex-1 primary"
|
||||
@click="cashPayClick"
|
||||
>
|
||||
<span>现金</span>
|
||||
</button>
|
||||
<div style="width: 15px"></div>
|
||||
<button
|
||||
class="my-btn flex-1 default"
|
||||
@click="morePayClick"
|
||||
>
|
||||
<span>更多支付</span>
|
||||
</button>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
|
@ -590,7 +599,7 @@
|
|||
</div> -->
|
||||
<div
|
||||
class="btn"
|
||||
:class="{ disabled: order.selIndex < 0 }"
|
||||
:class="{ disabled: order.selIndex < 0 && key != 'isJieZhang' }"
|
||||
@click="refNoteShow(true)"
|
||||
>
|
||||
单品备注
|
||||
|
|
@ -1254,6 +1263,7 @@ import moneyKeyboard from "./components/money-keyboard.vue";
|
|||
import dayjs from "dayjs";
|
||||
import { tbShopInfo } from "@/api/user";
|
||||
import { hasPermission } from "@/utils/limits.js";
|
||||
import { tbOrderInfoDetail } from "@/api/order";
|
||||
|
||||
import {
|
||||
getGoodsLists,
|
||||
|
|
@ -1283,12 +1293,15 @@ import {
|
|||
isCanBuy,
|
||||
arrayContainsAll,
|
||||
generateCombinations,
|
||||
returnReverseVal,$strMatch,
|
||||
returnReverseVal,
|
||||
$strMatch,
|
||||
returnGiftArr,
|
||||
returnPackFee,
|
||||
formatOrderGoodsList,
|
||||
} from "./util.js";
|
||||
import { $status } from "@/utils/table.js";
|
||||
|
||||
let $originTableList=[]
|
||||
let $originTableList = [];
|
||||
export default {
|
||||
components: {
|
||||
returnCart,
|
||||
|
|
@ -1305,7 +1318,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
//台桌搜索文字
|
||||
tableSearchText:"",
|
||||
tableSearchText: "",
|
||||
//是否允许收款
|
||||
canShoukuan: false,
|
||||
//是否允许下单
|
||||
|
|
@ -1512,7 +1525,8 @@ export default {
|
|||
);
|
||||
},
|
||||
title() {
|
||||
return this.table ? "代客下单" + `(${this.table.name})` : "代客下单";
|
||||
// return this.table ? "代客下单" + `(${this.table.name})` : "代客下单";
|
||||
return '代客下单'
|
||||
},
|
||||
allGiftMoney() {
|
||||
const nowprice = this.order.list
|
||||
|
|
@ -1605,12 +1619,17 @@ export default {
|
|||
.reduce((a, b) => {
|
||||
return a + b.number * b.salePrice;
|
||||
}, 0);
|
||||
return (
|
||||
oldPrice +
|
||||
price +
|
||||
+this.order.packFee.totalAmount +
|
||||
|
||||
const nowPackFee = returnPackFee(this.order.list, false);
|
||||
const oldackFee = returnPackFee(this.order.old.list);
|
||||
const packFee = nowPackFee + oldackFee;
|
||||
const returnStatus = ["return", "refunding", "refund"];
|
||||
const seatFee =
|
||||
this.order.seatFee.totalAmount *
|
||||
(this.order.seatFee.status == "return" ? 0 : 1)
|
||||
(returnStatus.includes(this.order.seatFee.status) ? 0 : 1);
|
||||
return (
|
||||
(oldPrice + price + +packFee + seatFee) *
|
||||
this.createOrder.discount
|
||||
).toFixed(2);
|
||||
},
|
||||
allNumber() {
|
||||
|
|
@ -1687,8 +1706,22 @@ export default {
|
|||
// })
|
||||
}
|
||||
},
|
||||
table(oldval, newval) {
|
||||
this.onTableChange();
|
||||
table(newval, oldval) {
|
||||
this.setPostPay();
|
||||
this.setUseType();
|
||||
if(oldval.tableId&&newval.tableId){
|
||||
this.perpole = 1;
|
||||
this.isCreateOrder = false;
|
||||
}
|
||||
if(this.key=='isJieZhang'){
|
||||
this.isCreateOrder = false;
|
||||
this.key=''
|
||||
}
|
||||
if (newval && newval.tableId) {
|
||||
this.createOrder.data.amount = 0;
|
||||
this.createOrder.data.id = "";
|
||||
this.onTableChange();
|
||||
}
|
||||
},
|
||||
masterId: function (val) {
|
||||
console.log(val);
|
||||
|
|
@ -1699,15 +1732,15 @@ export default {
|
|||
}
|
||||
},
|
||||
"vipUser.id": async function (val) {
|
||||
if (!this.table.tableId) {
|
||||
return;
|
||||
}
|
||||
let masterId = this.order.masterId;
|
||||
if (!masterId) {
|
||||
const res = await this.getMasterId();
|
||||
masterId = res.masterId;
|
||||
}
|
||||
this.masterId = masterId;
|
||||
// if (!this.table.tableId) {
|
||||
// return;
|
||||
// }
|
||||
// let masterId = this.order.masterId;
|
||||
// if (!masterId) {
|
||||
// const res = await this.getMasterId();
|
||||
// masterId = res.masterId;
|
||||
// }
|
||||
// this.masterId = masterId;
|
||||
$setUser({
|
||||
tableId: this.table.tableId,
|
||||
masterId: this.masterId,
|
||||
|
|
@ -1826,13 +1859,15 @@ export default {
|
|||
// this.getCategory();
|
||||
// this.refToggle('refScanCode',true)
|
||||
// this.refToggle("refDiscount", true);
|
||||
console.log(this.$route.query.tableId);
|
||||
this.open(this.$route.query.tableId ? this.$route.query : "");
|
||||
// this.open(this.$route.query.tableId ? this.$route.query : "");
|
||||
this.open(this.$route.query);
|
||||
},
|
||||
methods: {
|
||||
searchInput(e){
|
||||
console.log(e)
|
||||
this.tableList=$originTableList.filter(v=>$strMatch(v.name,e.trim()))
|
||||
searchInput(e) {
|
||||
console.log(e);
|
||||
this.tableList = $originTableList.filter((v) =>
|
||||
$strMatch(v.name, e.trim())
|
||||
);
|
||||
},
|
||||
returnTableColor(key) {
|
||||
const item = $status[key];
|
||||
|
|
@ -1861,7 +1896,7 @@ export default {
|
|||
this.order.extra.selIndex = index;
|
||||
},
|
||||
async morePayClick() {
|
||||
if (this.order.list.length <= 0) {
|
||||
if (!this.createOrder.data.id && this.order.list.length <= 0) {
|
||||
return this.$message("请选择菜品");
|
||||
}
|
||||
const canJiesuan = await this.shoukuanClick();
|
||||
|
|
@ -1871,13 +1906,14 @@ export default {
|
|||
// if(this.isCreateOrder){
|
||||
// return
|
||||
// }
|
||||
const res = await this.returnCreateOrderData();
|
||||
await this.returnCreateOrderData();
|
||||
this.payBeforeClear();
|
||||
this.createOrder.data = res;
|
||||
this.order.payType = "";
|
||||
this.isCreateOrder = true;
|
||||
// this.order.payType = "";
|
||||
},
|
||||
async cashPayClick() {
|
||||
if (!this.createOrder.data.id && this.order.list.length <= 0) {
|
||||
return this.$message("没有要结算的订单或商品!");
|
||||
}
|
||||
const canJiesuan = await this.shoukuanClick();
|
||||
if (!canJiesuan) {
|
||||
return;
|
||||
|
|
@ -1892,6 +1928,13 @@ export default {
|
|||
});
|
||||
},
|
||||
async returnCreateOrderData() {
|
||||
if (this.key == "isJieZhang" || this.order.list.length <= 0) {
|
||||
//结账来的下单或者已经生成订单
|
||||
// this.order.old.list = formatOrderGoodsList(this.createOrder.data.detailList||[]);
|
||||
this.isCreateOrder = true;
|
||||
return this.createOrder.data;
|
||||
}
|
||||
this.order.list = [];
|
||||
const res = await $createOrder({
|
||||
masterId: this.order.masterId || this.masterId,
|
||||
vipUserId: this.vipUser.id,
|
||||
|
|
@ -1900,6 +1943,9 @@ export default {
|
|||
postPay: this.postPay,
|
||||
orderld: this.order.orderId,
|
||||
});
|
||||
this.isCreateOrder = true;
|
||||
this.order.old.list = formatOrderGoodsList(res.detailList || []);
|
||||
this.getOrderData({ orderId: res.id });
|
||||
this.createOrder.data = res;
|
||||
this.createOrder.discount = 1;
|
||||
// const lastItem = this.order.old.list[this.order.old.list.length - 1];
|
||||
|
|
@ -1908,27 +1954,21 @@ export default {
|
|||
// ...this.order.old.list,
|
||||
// { info: this.order.list, placeNum: nowPlaceNum + 1 },
|
||||
// ];
|
||||
this.order.list = [];
|
||||
this.order.old.list = [];
|
||||
console.log(this.order.old.list);
|
||||
return res;
|
||||
},
|
||||
async payBeforeClear() {
|
||||
this.getMasterId().then((res) => {
|
||||
this.masterId = res.masterId;
|
||||
});
|
||||
this.loading = false;
|
||||
this.order.list = [];
|
||||
this.order.query.page = 1;
|
||||
this.goods.total = 0;
|
||||
this.order.list = [];
|
||||
this.order.selIndex = -1;
|
||||
this.order.selPlaceNum = -1;
|
||||
this.order.selGoods = "";
|
||||
this.order.seatFee = { totalAmount: 0 }; //餐位费
|
||||
this.prveOrder.list = [];
|
||||
this.prveOrder.selIndex = -1;
|
||||
this.order.old.selIndex = -1;
|
||||
this.isCreateOrder = false;
|
||||
// this.isCreateOrder = false;
|
||||
this.createOrder.status = "";
|
||||
this.createOrder.code = "";
|
||||
this.note.content = "";
|
||||
|
|
@ -1942,7 +1982,6 @@ export default {
|
|||
this.key = "";
|
||||
this.order.orderId = "";
|
||||
this.perpole = "";
|
||||
// this.useTypes.sel = "dine-in";
|
||||
},
|
||||
async cachePay() {
|
||||
const canJiesuan = await this.shoukuanClick();
|
||||
|
|
@ -1954,12 +1993,14 @@ export default {
|
|||
this.pays();
|
||||
},
|
||||
async scanPayClick() {
|
||||
if (!this.createOrder.data.id && this.order.list.length <= 0) {
|
||||
return this.$message("没有要结算的订单或商品!");
|
||||
}
|
||||
const canJiesuan = await this.shoukuanClick();
|
||||
if (!canJiesuan) {
|
||||
return;
|
||||
}
|
||||
const order = await this.returnCreateOrderData();
|
||||
console.log(this.createOrder.data);
|
||||
this.order.payType = "scanCode";
|
||||
this.payTypeItemClick({ payType: "scanCode", order });
|
||||
this.payBeforeClear();
|
||||
|
|
@ -1999,6 +2040,8 @@ export default {
|
|||
//munchies 先付 restaurant 后付
|
||||
this.postPay = this.shopInfo.registerType == "munchies" ? false : true;
|
||||
}
|
||||
console.log('this.postPay')
|
||||
console.log(this.postPay)
|
||||
},
|
||||
//获取店铺信息
|
||||
async getShopInfo() {
|
||||
|
|
@ -2028,11 +2071,21 @@ export default {
|
|||
tableId: this.table.tableId,
|
||||
num: this.perpole,
|
||||
});
|
||||
this.order.seatFee = res;
|
||||
this.order.seatFee = res
|
||||
this.perpole = res.totalNumber || res.number;
|
||||
return res;
|
||||
},
|
||||
//台桌变化时重新获取取餐号、购物车数据,如果是正在结账状态,创建订单到待支付页面
|
||||
async onTableChange() {
|
||||
const perpole=this.perpole || ''
|
||||
const tableRes = await $returnTableDetail({
|
||||
tableId: this.table.tableId,
|
||||
});
|
||||
console.log(tableRes);
|
||||
const orderId=tableRes.orderId ||this.table.orderId
|
||||
if (orderId) {
|
||||
this.getOrderData({ orderId:orderId });
|
||||
}
|
||||
const res = await this.getMasterId();
|
||||
this.masterId = res.masterId;
|
||||
//空闲并且免餐位费设置默认就餐人数1
|
||||
|
|
@ -2041,7 +2094,6 @@ export default {
|
|||
this.table.status == "idle" &&
|
||||
!this.shopInfo.isTableFee
|
||||
) {
|
||||
this.perpole = 1;
|
||||
await this.changePerpole();
|
||||
}
|
||||
//设置就餐类型
|
||||
|
|
@ -2053,23 +2105,19 @@ export default {
|
|||
? item.useType
|
||||
: item.useType.replace(/-after|-before/g, "");
|
||||
}
|
||||
this.getCart();
|
||||
if (!orderId) {
|
||||
this.getCart();
|
||||
}
|
||||
this.getCacheOrder();
|
||||
console.log(this.isCreateOrder);
|
||||
this.perpole=perpole||this.perpole
|
||||
if (!this.shopInfo.isTableFee && this.table.tableId && this.perpole > 0) {
|
||||
//不免餐位费
|
||||
const seatFee = await $choseCount({
|
||||
masterId: this.masterId,
|
||||
tableId: this.table.tableId,
|
||||
num: res.seatFee ? res.seatFee.totalNumber : this.perpole,
|
||||
});
|
||||
console.log(seatFee);
|
||||
this.order.seatFee = seatFee;
|
||||
this.perpole = seatFee.totalNumber;
|
||||
}
|
||||
if (this.isCreateOrder) {
|
||||
this.toCreateOrder(true);
|
||||
await this.changePerpole();
|
||||
}
|
||||
// if (this.isCreateOrder) {
|
||||
// this.toCreateOrder(true);
|
||||
// }
|
||||
},
|
||||
// 获取台桌详情
|
||||
async getTableDetail() {
|
||||
|
|
@ -2099,15 +2147,17 @@ export default {
|
|||
},
|
||||
//退菜
|
||||
async refReturnCartConfirm(e) {
|
||||
console.log(this.order.selGoods);
|
||||
const res = await $returnCart({
|
||||
...e,
|
||||
cartId: this.order.selGoods.id,
|
||||
cartId: this.order.selGoods.cartId,
|
||||
tableId: this.table.tableId,
|
||||
});
|
||||
this.order.selGoods.status = "return";
|
||||
this.order.old.selIndex = -1;
|
||||
this.getCart();
|
||||
console.log(this.order.selGoods);
|
||||
// this.getCart();
|
||||
this.getOrderData();
|
||||
// console.log(this.order.selGoods);
|
||||
},
|
||||
|
||||
// 台桌列表
|
||||
|
|
@ -2120,16 +2170,16 @@ export default {
|
|||
this.tableList = content.filter(
|
||||
(v) => v.status != "closed" && v.status != "cleaning"
|
||||
);
|
||||
$originTableList=this.tableList
|
||||
$originTableList = this.tableList;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
async changeTable(item) {
|
||||
console.log(this.table);
|
||||
if (this.table || this.order.list.length <= 0) {
|
||||
this.table = item;
|
||||
this.tableShow = false;
|
||||
console.log(this.table);
|
||||
return;
|
||||
}
|
||||
if (item.status != "idle") {
|
||||
|
|
@ -2229,9 +2279,7 @@ export default {
|
|||
//判读单规格商品是否售尽
|
||||
isSellOut(item) {
|
||||
return (
|
||||
item.isPauseSale ||
|
||||
(item.typeEnum !== "sku" &&
|
||||
(item.isStock == 1 ? item.stockNumber <= 0 : false))
|
||||
item.isPauseSale || (item.isStock == 1 ? item.stockNumber <= 0 : false)
|
||||
);
|
||||
},
|
||||
toggleFullScreen() {
|
||||
|
|
@ -2414,18 +2462,10 @@ export default {
|
|||
this.toCreateOrder(isNowPay);
|
||||
},
|
||||
async toCreateOrder(isNowPay = false) {
|
||||
console.log(this.order);
|
||||
console.log(this.order.orderId);
|
||||
let res = "";
|
||||
try {
|
||||
if (!this.shopInfo.isTableFee) {
|
||||
const seatFee = await $choseCount({
|
||||
masterId: this.masterId,
|
||||
tableId: this.table.tableId,
|
||||
num: this.perpole,
|
||||
});
|
||||
this.order.seatFee = seatFee;
|
||||
this.order.seatFee = res;
|
||||
await this.changePerpole();
|
||||
}
|
||||
res = await $createOrder({
|
||||
masterId: this.order.masterId || this.masterId,
|
||||
|
|
@ -2435,17 +2475,16 @@ export default {
|
|||
postPay: this.postPay,
|
||||
orderld: this.order.orderId,
|
||||
});
|
||||
this.getOrderData({ orderId: res.id });
|
||||
} catch (error) {}
|
||||
if (!res) {
|
||||
this.createOrder.status = "success";
|
||||
return;
|
||||
}
|
||||
//后付款
|
||||
console.log(this.postPay);
|
||||
console.log(isNowPay);
|
||||
console.log(this.postPay && isNowPay);
|
||||
this.createOrder.status = "success";
|
||||
this.getCart();
|
||||
this.order.list=[];
|
||||
// this.getCart();
|
||||
if (this.postPay && !isNowPay) {
|
||||
this.$notify({
|
||||
title: "下单成功",
|
||||
|
|
@ -2453,7 +2492,6 @@ export default {
|
|||
});
|
||||
return this.close();
|
||||
}
|
||||
this.createOrder.data = res;
|
||||
if (!this.isPrverOrder) {
|
||||
const { masterId } = await this.getMasterId();
|
||||
this.masterId = masterId;
|
||||
|
|
@ -2481,7 +2519,7 @@ export default {
|
|||
//更新购物车商品数据
|
||||
updateOrder(par = {}) {
|
||||
let item = this.order.list[this.order.selIndex];
|
||||
console.log(item.specSnap);
|
||||
console.log(this.table);
|
||||
const { productId, skuId, isPack, isGift, number, id } = item;
|
||||
$updateCart({
|
||||
cartId: id,
|
||||
|
|
@ -2547,7 +2585,9 @@ export default {
|
|||
//右侧控制按钮点击事件
|
||||
orderBtnsClick(key) {
|
||||
const orderGoods = this.order.list[this.order.selIndex];
|
||||
this.createOrderClose();
|
||||
if (this.key != "isJieZhang" && this.postPay) {
|
||||
this.createOrderClose();
|
||||
}
|
||||
if (key === "sku") {
|
||||
this.selGoods.title = orderGoods.name;
|
||||
this.selGoods.isEdit = true;
|
||||
|
|
@ -2721,8 +2761,7 @@ export default {
|
|||
this.$nextTick(() => {
|
||||
this.getCacheOrder();
|
||||
});
|
||||
const masterIdRes = await this.getMasterId();
|
||||
this.masterId = masterIdRes.masterId;
|
||||
await this.getMasterId();
|
||||
},
|
||||
// 删除购物车商品
|
||||
removeCart() {
|
||||
|
|
@ -2949,6 +2988,7 @@ export default {
|
|||
}
|
||||
} else {
|
||||
//添加
|
||||
console.log(this.table)
|
||||
res = await addCart({
|
||||
masterId: this.masterId,
|
||||
vipUserId: this.vipUser.id,
|
||||
|
|
@ -3095,7 +3135,17 @@ export default {
|
|||
//设置购物车数据
|
||||
setCart(res) {
|
||||
console.log(res);
|
||||
this.order.seatFee = res.seatFee ? res.seatFee : this.order.seatFee;
|
||||
const { seatFee } = res;
|
||||
this.order.seatFee = seatFee
|
||||
? {
|
||||
...seatFee,
|
||||
totalNumber: seatFee.num||seatFee.number,
|
||||
num: seatFee.number,
|
||||
name: seatFee.name|| seatFee.productName,
|
||||
totalAmount: seatFee.priceAmount || seatFee.totalAmount,
|
||||
}
|
||||
: this.order.seatFee;
|
||||
console.log(this.order.seatFee);
|
||||
this.perpole = res.seatFee ? res.seatFee.totalNumber : 1;
|
||||
const nowCart = res.records.find((v) => v.placeNum == 0);
|
||||
// this.order.list = nowCart ? nowCart.info.filter(v=>v.isGift!=='true') : [];
|
||||
|
|
@ -3277,6 +3327,19 @@ export default {
|
|||
this.$goodsData = goods;
|
||||
},
|
||||
async open(params) {
|
||||
const item = {
|
||||
name: params.table_name,
|
||||
tableId: params.tableId,
|
||||
useType: params.useType,
|
||||
maxCapacity: params.maxCapacity * 1,
|
||||
masterId: params.masterId,
|
||||
orderId: params.orderId,
|
||||
},
|
||||
key = params.key,
|
||||
perpoleNumber = params.num || "";
|
||||
this.key = key;
|
||||
this.perpole = perpoleNumber;
|
||||
|
||||
const shopId = localStorage.getItem("shopId");
|
||||
const shopInfo = await tbShopInfo(shopId);
|
||||
for (let i in shopInfo.eatModel) {
|
||||
|
|
@ -3290,28 +3353,47 @@ export default {
|
|||
}
|
||||
}
|
||||
this.shopInfo = shopInfo;
|
||||
this.setPostPay();
|
||||
if (!params.masterId) {
|
||||
await this.getMasterId();
|
||||
this.getCart();
|
||||
} else {
|
||||
this.masterId = params.masterId;
|
||||
}
|
||||
if (key == "isJieZhang") {
|
||||
this.postPay = false;
|
||||
} else {
|
||||
this.setPostPay();
|
||||
}
|
||||
this.setUseType();
|
||||
this.getGoods();
|
||||
this.getCategory();
|
||||
this.getTable();
|
||||
console.log(params);
|
||||
const res = await this.getMasterId();
|
||||
console.log(res);
|
||||
if (!params) {
|
||||
//无台桌代客下单
|
||||
|
||||
if (key == "isJieZhang") {
|
||||
this.table = params.tableId ? { name: item.name } : "";
|
||||
if (params.orderId) {
|
||||
const orderRes = await this.getOrderData(params);
|
||||
if (orderRes.status != "unpaid") {
|
||||
this.$router.replace({ path: "/tool/Instead/index" });
|
||||
}
|
||||
}
|
||||
this.isCreateOrder = true;
|
||||
return;
|
||||
}
|
||||
const item = {
|
||||
name: params.table_name,
|
||||
tableId: params.tableId,
|
||||
useType: params.useType,
|
||||
maxCapacity: params.maxCapacity * 1,
|
||||
masterId: params.masterId,
|
||||
orderId: params.orderId,
|
||||
},
|
||||
key = params.key,
|
||||
perpoleNumber = params.num;
|
||||
if( key == "isPayOrder" ){
|
||||
this.isCreateOrder =true
|
||||
}
|
||||
if(params.orderId) {
|
||||
const orderRes = await this.getOrderData(params);
|
||||
}
|
||||
|
||||
// this.getCart();
|
||||
// this.getCacheOrder();
|
||||
// if (!params) {
|
||||
// //无台桌代客下单
|
||||
// return;
|
||||
// }
|
||||
//有台桌时的代客下单
|
||||
if (item && item.useType) {
|
||||
localStorage.setItem("useType", item.useType);
|
||||
|
|
@ -3320,17 +3402,71 @@ export default {
|
|||
? item.useType
|
||||
: item.useType.replace(/-after|-before/g, "");
|
||||
}
|
||||
this.key = key;
|
||||
this.isCreateOrder = this.key == "isPayOrder" ? true : false;
|
||||
this.perpole = perpoleNumber;
|
||||
this.table = item;
|
||||
this.masterId = item.masterId;
|
||||
|
||||
|
||||
this.table = params.tableId ? item : "";
|
||||
},
|
||||
async getOrderData(params) {
|
||||
const res = await tbOrderInfoDetail(
|
||||
params ? params.orderId : this.createOrder.data.id
|
||||
);
|
||||
if (res.status != "unpaid") {
|
||||
return res;
|
||||
}
|
||||
this.createOrder.data = res;
|
||||
this.order.packFee.totalAmount = res.seatInfo || { totalAmount: 0 };
|
||||
const goodsMap = {};
|
||||
for (let i in res.detailList) {
|
||||
const goods = res.detailList[i];
|
||||
if (goods.productId != "-999") {
|
||||
if (goodsMap.hasOwnProperty(goods.placeNum)) {
|
||||
goodsMap[goods.placeNum].push(goods);
|
||||
} else {
|
||||
goodsMap[goods.placeNum] = [goods];
|
||||
}
|
||||
}
|
||||
}
|
||||
this.order.seatFee = res.seatInfo
|
||||
? {
|
||||
...res.seatInfo,
|
||||
totalNumber: res.seatInfo.num,
|
||||
number: res.seatInfo.num,
|
||||
name: res.seatInfo.productName,
|
||||
totalAmount: res.seatInfo.priceAmount,
|
||||
}
|
||||
: {
|
||||
name: "客座费",
|
||||
number: res.seatCount || 0,
|
||||
totalNumber: res.seatCount || 0,
|
||||
totalAmount: res.seatAmount || 0,
|
||||
status: "",
|
||||
};
|
||||
this.order.old.list = Object.entries(goodsMap).map(([key, value]) => ({
|
||||
info: value.map((v) => {
|
||||
return {
|
||||
...v,
|
||||
coverImg: v.productImg,
|
||||
name: v.productName,
|
||||
specSnap: v.productSkuName,
|
||||
number: v.num,
|
||||
totalAmount: v.priceAmount,
|
||||
salePrice: v.price,
|
||||
isGift: v.gift ? "true" : "false",
|
||||
isPack: v.pack ? "true" : "false",
|
||||
};
|
||||
}),
|
||||
placeNum: key,
|
||||
}));
|
||||
console.log(this.order.old.list);
|
||||
return res;
|
||||
},
|
||||
close() {
|
||||
this.reset();
|
||||
if (this.table.tableId) {
|
||||
this.$router.replace({ path: "/tool/table_list" });
|
||||
} else {
|
||||
this.$router.go(0);
|
||||
this.$router.replace({ path: "/tool/Instead/index" });
|
||||
// this.$router.go(0);
|
||||
// this.reset();
|
||||
// this.$router.replace({ path: "/tool/Instead/index" });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,34 @@
|
|||
//计算打包费
|
||||
export function returnPackFee(arr, isOld = true) {
|
||||
if (isOld) {
|
||||
return arr.reduce((a, b) => {
|
||||
const bTotal = b.info
|
||||
.filter((v) => v.isGift !== "true" && v.status !== "return")
|
||||
.reduce((prve, cur) => {
|
||||
return prve + (cur.packFee || cur.packAmount||0);
|
||||
}, 0);
|
||||
return a + bTotal;
|
||||
}, 0);
|
||||
} else {
|
||||
return arr.filter(v => v.status !== 'return' && v.isGift !== 'true').reduce((a, b) => {
|
||||
return a + (b.packFee || b.packAmount||0);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
}
|
||||
//判断商品是否可以下单
|
||||
export function isCanBuy(skuGoods,goods) {
|
||||
if(goods.typeEnum=='normal'){
|
||||
export function isCanBuy(skuGoods, goods) {
|
||||
if (goods.typeEnum == 'normal') {
|
||||
//单规格
|
||||
return goods.isGrounding&&goods.isPauseSale==0&&(goods.isStock?goods.stockNumber>0:true);
|
||||
}else{
|
||||
return goods.isGrounding && goods.isPauseSale == 0 && (goods.isStock ? goods.stockNumber > 0 : true);
|
||||
} else {
|
||||
//多规格
|
||||
return goods.isGrounding&&goods.isPauseSale==0&&skuGoods.isGrounding&&skuGoods.isPauseSale==0&&(goods.isStock?goods.stockNumber>0:true);
|
||||
return goods.isGrounding && goods.isPauseSale == 0 && skuGoods.isGrounding && skuGoods.isPauseSale == 0 && (goods.isStock ? goods.stockNumber > 0 : true);
|
||||
|
||||
}
|
||||
}
|
||||
//字符匹配
|
||||
export function $strMatch(matchStr,str){
|
||||
export function $strMatch(matchStr, str) {
|
||||
return matchStr.toLowerCase().includes(str.toLowerCase())
|
||||
}
|
||||
|
||||
|
|
@ -59,15 +77,41 @@ export function returnReverseVal(val, isReturnString = true) {
|
|||
return reverseNewval;
|
||||
}
|
||||
|
||||
export function returnGiftArr(arr){
|
||||
let result=[]
|
||||
for(let i=0;i<arr.length;i++){
|
||||
const info=arr[i].info
|
||||
for(let j=0;j<info.length;j++){
|
||||
if(info[j].isGift==='true'){
|
||||
export function returnGiftArr(arr) {
|
||||
let result = []
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const info = arr[i].info
|
||||
for (let j = 0; j < info.length; j++) {
|
||||
if (info[j].isGift === 'true') {
|
||||
result.push(info[j])
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export function formatOrderGoodsList(arr){
|
||||
const goodsMap = {}
|
||||
for (let i in arr) {
|
||||
const goods = arr[i]
|
||||
if (goods.productName != '客座费') {
|
||||
if (goodsMap.hasOwnProperty(goods.placeNum)) {
|
||||
goodsMap[goods.placeNum||1].push(goods)
|
||||
} else {
|
||||
goodsMap[goods.placeNum||1] = [goods]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return Object.entries(goodsMap).map(([key, value]) => ({
|
||||
info: value,
|
||||
placeNum: key||1
|
||||
}))
|
||||
}
|
||||
|
||||
export function returnIsSeatFee(item){
|
||||
if(!item){
|
||||
return false
|
||||
}
|
||||
return item.productId=="-999"
|
||||
}
|
||||
Loading…
Reference in New Issue