This commit is contained in:
duan
2024-10-09 14:13:14 +08:00
7 changed files with 271 additions and 116 deletions

View File

@@ -736,11 +736,11 @@ export function queryShopUserFlow(params) {
}
// 商品列表 V2
export function tbProductListV2(params) {
export function tbProductListV2(data) {
return request({
url: `/api/tbProduct/list/v2`,
method: "get",
params
method: "post",
data
});
}
@@ -770,3 +770,12 @@ export function tbProductStockDetailStock(data) {
data
});
}
// 商品库存记录列表
export function stockWarnLine(data) {
return request({
url: `/api/stock/warnLine`,
method: "PUT",
data
});
}

View File

@@ -2,7 +2,7 @@ module.exports = {
/**
* @description 网站标题
*/
title: '管理后台',
title: "管理后台",
/**
* @description 是否显示 tagsView
*/
@@ -22,7 +22,7 @@ module.exports = {
/**
* @description token key
*/
TokenKey: 'ELADMIN-TOEKN',
TokenKey: "ELADMIN-TOEKN",
/**
* @description 请求超时时间毫秒默认2分钟
*/
@@ -38,36 +38,37 @@ module.exports = {
/**
* 底部文字支持html语法
*/
footerTxt: '© 2018-2024 超掌柜科技 <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License 2.0</a>',
footerTxt:
'© 2018-2024 超掌柜科技 <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License 2.0</a>',
/**
* 备案号
*/
caseNumber: '陕ICP备2022008069号',
caseNumber: "陕ICP备2022008069号",
typeEnum: [
{
label: '计量商品',
intro: '单价购买',
typeEnum: 'normal'
label: "单规格",
intro: "单价购买",
typeEnum: "normal"
},
{
label: '多规格',
intro: '多种不同规格',
typeEnum: 'sku'
},
{
label: '套餐商品',
intro: '选职多种组合',
typeEnum: 'group'
},
{
label: '称重商品',
intro: '按重量售卖',
typeEnum: 'weight'
},
{
label: '时价商品',
intro: '收银端可更改价格',
typeEnum: 'currentPrice'
label: "多规格",
intro: "多种不同规格",
typeEnum: "sku"
}
// {
// label: '套餐商品',
// intro: '选职多种组合',
// typeEnum: 'group'
// },
// {
// label: '称重商品',
// intro: '按重量售卖',
// typeEnum: 'weight'
// },
// {
// label: '时价商品',
// intro: '收银端可更改价格',
// typeEnum: 'currentPrice'
// }
]
}
};

View File

@@ -1,7 +1,18 @@
<template>
<el-drawer title="订单详情" size="50%" :visible.sync="drawer" direction="rtl" v-loading="loading">
<div class="header">
<div class="title">收银订单</div>
<div class="title" style="text-align: center;">收银订单</div>
<div class="container">
<div class="info_content">
<div class="item">
<div class="label">会员信息</div>
<div class="row">
<div>会员昵称-</div>
<div>联系电话-</div>
</div>
</div>
</div>
</div>
<div class="table">
<div class="item">
<div class="t">订单状态</div>
@@ -16,61 +27,113 @@
<div class="b">{{ detail.orderAmount }}</div>
</div>
<div class="item">
<div class="t">订单时间</div>
<div class="t">订单类型</div>
<div class="b">
{{ detail.createdAt | timeFilter }}
{{ detail.sendType | sendTypeFilter }}
</div>
</div>
</div>
<div class="table">
<div class="item">
<div class="t">订单编号</div>
<div class="b">
{{ detail.orderNo }}
</div>
</div>
<div class="item">
<div class="t">下单时间</div>
<div class="b">{{ detail.createdAt | timeFilter }}</div>
</div>
<div class="item">
<div class="t">支付时间</div>
<div class="b">
{{ detail.createdAt | paidTime | timeFilter }}
</div>
</div>
</div>
</div>
<div class="container">
<el-tabs v-model="type" @tab-click="getTableData">
<el-tab-pane label="基本信息" name="1">
<div class="info_content">
<div class="item">
<div class="label">会员信息</div>
<div class="row">
<div>会员昵称-</div>
<div>联系电话-</div>
</div>
</div>
<div class="item">
<div class="label">收款详情</div>
<div class="row">
<!-- <div>商品金额{{ detail.productAmount }}</div> -->
<div>打包费{{ detail.packFee || "-" }}</div>
</div>
<div class="row">
<div>订单原价{{ detail.originAmount }}</div>
<div>优惠金额{{ detail.userCouponAmount || "-" }}</div>
<div>
实收金额<span style="color: red;">{{ detail.payAmount }}</span>
</div>
</div>
<div class="row">
<div>
退款金额{{ detail.refundAmount }}
<span style="color: #FF9731;cursor: pointer;" v-if="detail.isRefund" @click="type = '3'">退款详情></span>
</div>
<div>支付方式{{ detail.payType }}</div>
</div>
</div>
<div class="item">
<div class="label">订单信息</div>
<div class="row">
<div>订单编号{{ detail.orderNo }}</div>
<div>订单类型{{ detail.sendType | sendTypeFilter }}</div>
<div>创建时间{{ detail.createdAt | timeFilter }}</div>
</div>
<div class="row">
<div>设备名称-</div>
<div>支付时间{{ detail.paidTime | timeFilter }}</div>
<div>更新时间{{ detail.updatedAt | timeFilter }}</div>
</div>
<!-- <el-tabs v-model="type" @tab-click="getTableData"> -->
<!-- <el-tab-pane label="基本信息" name="1"> -->
<div class="info_content">
<!-- <div class="item">
<div class="label">会员信息</div>
<div class="row">
<div>会员昵称-</div>
<div>联系电话-</div>
</div>
</div> -->
<div class="item">
<div class="label">收款详情</div>
<!-- <div class="row">
<div>商品金额{{ detail.productAmount }}</div>
<div>打包费{{ detail.packFee || "-" }}</div>
</div> -->
<div class="row">
<div>打包费{{ detail.packFee || "-" }}</div>
<div>订单原价{{ detail.originAmount }}</div>
<div>优惠金额{{ detail.userCouponAmount || "-" }}</div>
<div>
实收金额<span style="color: red;">{{ detail.payAmount }}</span>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="商品信息" name="2">
<div class="row">
<div>
退款金额{{ detail.refundAmount }}
<span style="color: #FF9731;cursor: pointer;" v-if="detail.isRefund" @click="type = '3'">退款详情></span>
</div>
<div>支付方式{{ detail.payType }}</div>
</div>
</div>
<!-- <div class="item">
<div class="label">订单信息</div>
<div class="row">
<div>订单编号{{ detail.orderNo }}</div>
<div>订单类型{{ detail.sendType | sendTypeFilter }}</div>
<div>创建时间{{ detail.createdAt | timeFilter }}</div>
</div>
<div class="row">
<div>设备名称-</div>
<div>支付时间{{ detail.paidTime | timeFilter }}</div>
<div>更新时间{{ detail.updatedAt | timeFilter }}</div>
</div>
</div> -->
</div>
<div>
<div style="margin-bottom: 16px;font-size:16px;">商品信息</div>
<el-table :data="detail.detailList">
<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>
<div class="info">
<span :class="[scope.row.isVip == 1 ? 'colorStyle' : '']">{{ scope.row.productName }}</span>
<span style="color: #999;">{{
scope.row.productSkuName
}}</span>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="数量">
<template v-slot="scope">
x{{ scope.row.num }}
</template>
</el-table-column>
<el-table-column label="单价">
<template v-slot="scope">
{{ scope.row.price }}/
</template>
</el-table-column>
<el-table-column label="小计">
<template v-slot="scope">
{{ scope.row.priceAmount }}
</template>
</el-table-column>
</el-table>
</div>
<!-- </el-tab-pane> -->
<!-- <el-tab-pane label="商品信息" name="2">
<el-table :data="detail.detailList">
<el-table-column label="商品">
<template v-slot="scope">
@@ -101,7 +164,7 @@
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tab-pane>
<el-tab-pane label="退款详情" name="3" v-if="detail.isRefund">
<div class="refund_wrap">
<div class="row" v-for="item in refoundList" :key="item.id">
@@ -127,7 +190,8 @@
</div>
</div>
</el-tab-pane>
</el-tabs>
-->
<!-- </el-tabs> -->
</div>
</el-drawer>
</template>
@@ -294,7 +358,7 @@ export default {
padding-top: 20px;
div {
width: 33.333%;
width: 25%;
}
}
}

View File

@@ -750,7 +750,8 @@ export default {
console.log(this.form.skuList)
const hasUndefined = this.form.skuList.some(obj => {
for (const key in obj) {
if (obj[key] === undefined) {
console.log(key, obj)
if (obj['salePrice'] === undefined || obj['memberPrice'] === undefined || obj['costPrice'] === undefined || obj['originPrice'] === undefined) {
return true; // 如果找到undefined立即停止搜索并返回true
}
}

View File

@@ -27,7 +27,7 @@
<el-radio :label="0">禁用</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="售卖时间管控" v-if="form.id">
<el-form-item label="售卖时间管控" >
<el-radio-group v-model="form.useTime">
<el-radio :label="1">启用</el-radio>
<el-radio :label="0">禁用</el-radio>
@@ -51,7 +51,7 @@
</el-form-item>
<el-form-item label="分组排序" v-if="form.id">
<el-form-item label="分组排序" >
<el-input-number v-model="form.sort" controls-position="right" :min="0"></el-input-number>
</el-form-item>

View File

@@ -42,6 +42,12 @@
import dayjs from 'dayjs'
import { tbProductStockDetailStock } from '@/api/shop.js'
export default {
props: {
query: {
type: Object,
default: {}
}
},
data() {
return {
dayjs,
@@ -77,7 +83,12 @@ export default {
page: this.tableData.page,
size: this.tableData.size,
shopId: localStorage.getItem('shopId'),
column: this.key
column: this.key,
productName: this.query.name,
categoryId: this.query.categoryId,
type: this.query.typeEnum,
startTime: this.query.createdAt[0] || '',
endTime: this.query.createdAt[1] || '',
})
this.tableData.loading = false
this.tableData.data = res.content

View File

@@ -1,26 +1,22 @@
<template>
<div class="app-container">
<div class="head-container">
<el-row :gutter="20">
<el-col :span="3">
<el-input v-model="query.name" size="small" clearable placeholder="请输入商品名称" style="width: 100%;"
class="filter-item" @keyup.enter.native="getTableData" />
</el-col>
<el-col :span="3">
<el-select v-model="query.categoryId" placeholder="请选择商品分类" style="width: 100%;">
<el-option :label="item.name" :value="item.id" v-for="item in categorys" :key="item.id" />
</el-select>
</el-col>
<el-col :span="3">
<el-select v-model="query.typeEnum" placeholder="请选择商品规格" style="width: 100%;">
<el-option :label="item.label" :value="item.typeEnum" v-for="item in typeEnums" :key="item.typeEnum" />
</el-select>
</el-col>
<el-col :span="6">
<el-button type="primary" @click="queryHandle">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</el-col>
</el-row>
<div class="flex">
<el-input v-model="query.name" size="small" clearable placeholder="请输入商品名称" @keyup.enter.native="getTableData"
style="width: 200px;" />
<el-select v-model="query.categoryId" placeholder="请选择商品分类">
<el-option :label="item.name" :value="item.id" v-for="item in categorys" :key="item.id" />
</el-select>
<el-select v-model="query.typeEnum" placeholder="请选择商品规格">
<el-option :label="item.label" :value="item.typeEnum" v-for="item in typeEnums" :key="item.typeEnum" />
</el-select>
<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-button type="primary" @click="queryHandle">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
<el-button @click="showStockWarningHandle">库存预警{{ warnLine }}</el-button>
</div>
</div>
<div class="head-container">
<div class="header_wrap">
@@ -42,7 +38,7 @@
<div class="info">
<div class="row">
<span>现有数量</span>
<span @click="showStockHistory('stockNumber')">{{ countInfo.stockNumber || 0 }}</span>
<span class="link" @click="showStockHistory('stockNumber')">{{ countInfo.stockNumber || 0 }}</span>
</div>
</div>
</div>
@@ -56,8 +52,15 @@
<span class="link" @click="showStockHistory('addCountNumber')">{{ countInfo.addCountNumber || 0 }}</span>
</div>
<div class="row">
<span>手动增加</span>
<span class="link" @click="showStockHistory('addNumber')">{{ countInfo.addNumber || 0 }}</span>
<div class="row">
<span>手动增加</span>
<span class="link" @click="showStockHistory('addNumber')">{{ countInfo.addNumber || 0 }}</span>
</div>
<div class="line"></div>
<div class="row">
<span>退货</span>
<span class="link" @click="showStockHistory('refundNumber')">{{ countInfo.refundNumber || 0 }}</span>
</div>
</div>
</div>
</div>
@@ -134,10 +137,12 @@
<template v-slot="scope">
<div class="cons_wrap" v-if="scope.row.typeEnum">
<div v-if="scope.row.conInfos && scope.row.conInfos.length">
<el-button type="text" v-for="item in scope.row.conInfos" :key="item.id"
@click="showBindCons(scope.row)">{{ item.conName }}</el-button>
<el-button type="text" @click="showBindCons(scope.row)">
{{ scope.row.conInfos | conInfosFilter }}
<i class="el-icon-edit"></i>
</el-button>
</div>
<el-button type="text" @click="showBindCons(scope.row)">
<el-button v-else type="text" @click="showBindCons(scope.row)">
绑定
<i class="el-icon-edit"></i>
</el-button>
@@ -202,7 +207,7 @@
<!-- 绑定耗材 -->
<BindCons ref="bindCons" @refundChange="refundChange" />
<!-- 商品库存记录 -->
<StockHistory ref="stockHistory" />
<StockHistory ref="stockHistory" :query="query" />
<!-- 编辑售价库存 -->
<el-dialog :title="editorEumn[editorForm.key]" :visible.sync="editorVisable" :show-close="false" width="300px">
<el-form :model="editorForm">
@@ -215,6 +220,18 @@
<el-button type="primary" :loading="editorFormLoading" @click="editorConfirmChange"> </el-button>
</span>
</el-dialog>
<!-- 库存预警值 -->
<el-dialog title="修改库存预警" :visible.sync="showStockWarning" :show-close="false" width="300px">
<el-form :model="editorForm">
<el-form-item label="库存预警">
<el-input-number v-model="warnLineValue" :min="0" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="showStockWarning = false"> </el-button>
<el-button type="primary" :loading="warnLineLoading" @click="stockWarnLineConfirm"> </el-button>
</span>
</el-dialog>
</div>
</template>
@@ -224,7 +241,7 @@ import dayjs from 'dayjs'
import settings from '@/settings'
import BindCons from './components/bindCons.vue'
import StockHistory from './components/stockHistory.vue'
import { tbProductListV2, tbShopCategoryGet, tbProductDelete, tbProductIsHot, upProSort, updateProductData, tbProductStockDetailStockCount } from '@/api/shop'
import { tbProductListV2, tbShopCategoryGet, tbProductDelete, tbProductIsHot, upProSort, updateProductData, tbProductStockDetailStockCount, stockWarnLine } from '@/api/shop'
export default {
components: {
BindCons,
@@ -237,7 +254,8 @@ export default {
productId: '',
name: '',
categoryId: '',
typeEnum: ''
typeEnum: '',
createdAt: []
},
categorys: [],
typeEnums: settings.typeEnum,
@@ -264,7 +282,17 @@ export default {
key: '',
value: ''
},
countInfo: {}
countInfo: {},
showStockWarning: false, // 显示库存预警值
warnLineLoading: false,
warnLine: 0,
warnLineValue: 0
}
},
filters: {
conInfosFilter(arr) {
let newarr = arr.map(item => item.conName)
return newarr.join('、')
}
},
async mounted() {
@@ -285,6 +313,29 @@ export default {
this.tbProductStockDetailStockCount()
},
methods: {
// 显示修改商品警告线
showStockWarningHandle() {
this.showStockWarning = true
this.warnLineValue = this.warnLine
},
// 修改商品警告线
async stockWarnLineConfirm() {
try {
this.warnLineLoading = true
const res = await stockWarnLine({
shopId: localStorage.getItem('shopId'),
warnLine: this.warnLineValue
})
this.warnLineLoading = false
this.showStockWarning = false
this.$message.success('修改成功')
this.getTableData()
} catch (error) {
this.warnLineLoading = false
console.log(error);
}
},
// 显示库存记录
showStockHistory(key) {
this.$refs.stockHistory.show(key)
@@ -293,7 +344,11 @@ export default {
async tbProductStockDetailStockCount() {
try {
const res = await tbProductStockDetailStockCount({
shopId: localStorage.getItem('shopId')
shopId: localStorage.getItem('shopId'),
productName: this.query.name,
categoryId: this.query.categoryId,
startTime: this.query.createdAt[0] || '',
endTime: this.query.createdAt[1] || ''
})
this.countInfo = res
} catch (error) {
@@ -366,6 +421,7 @@ export default {
queryHandle() {
localStorage.setItem('shopIndexQuery', JSON.stringify(this.query))
this.getTableData()
this.tbProductStockDetailStockCount()
},
//表格拖拽
tableDrag() {
@@ -410,9 +466,11 @@ export default {
this.query.categoryId = ''
this.query.typeEnum = ''
this.query.productId = ''
this.query.createdAt = []
this.tableData.page = 0
localStorage.setItem('shopIndexQuery', JSON.stringify(this.query))
this.getTableData()
this.tbProductStockDetailStockCount()
},
// 分页回调
paginationChange(e) {
@@ -437,9 +495,12 @@ export default {
id: this.query.productId,
type: this.query.typeEnum,
shopId: localStorage.getItem('shopId'),
sort: this.tableData.sort
sort: this.tableData.sort,
createdAt: this.query.createdAt
})
this.warnLine = res.warnLine
res.content.map(item => {
item.key = item.id
item.skuList.map(val => {
@@ -494,9 +555,17 @@ export default {
justify-content: space-between;
}
.flex {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.data_wrap {
display: flex;
justify-content: space-between;
padding: 0 60px;
.item {
display: flex;