Commit b4a8d86e by wangzhihui

```

feat(api): 添加采购商品详情API接口

添加getAllocateGoodsDetail方法用于获取采购商品详情信息,
支持返回完整的商品数据供前端展示使用。

fix(components): 修复表格组件数值显示逻辑

修改StickyTable组件中的数值显示判断逻辑,确保数值为0时能正确显示,
避免因JavaScript假值判断导致的显示错误。

docs(router): 更新路由文件时间戳注释

更新routes.js文件的LastEditTime注释字段至最新编辑时间,
修正时间戳格式。

feat(router): 添加商品详情页面路由配置

新增商品详情页面的路由配置,设置页面元信息包括
keepAlive、标题、权限控制等属性。

feat(cannibalize): 优化调拨详情页库存显示逻辑

- 根据员工类型控制库存明细显示,仅在特定条件下展示
- 优化数值显示格式化逻辑,移除不必要的parseFloat转换
- 添加员工类型参数传递,完善页面跳转逻辑
- 修复数据为空时的显示问题

feat(purchase): 新增采购商品详情页面

创建新的采购商品详情页面,包含:
- 基本信息展示区域
- 库存明细列表及搜索功能
- 支持分页加载和下拉刷新
- 针对不同员工类型的显示控制

refactor(purchase): 优化采购列表页跳转逻辑

将原来的弹窗查看详情改为路由跳转到详情页面,
完善页面间参数传递和数据获取流程。
```
1 parent 77520988
...@@ -98,5 +98,13 @@ export default { ...@@ -98,5 +98,13 @@ export default {
data, data,
returnAll: true returnAll: true
}) })
} },
getAllocateGoodsDetail(data = {}) {
data.method = 'dj.api.smarcarlife.purchaseOrder.goods.h5.detail'
return window.$HTTP({
url,
data,
returnAll: true
})
},
} }
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<td v-for="(col, colIndex) in columns" :key="colIndex" :class="{ 'fixed-col': colIndex === 0 && fixedFirstColumn }" :style="getCellStyle(colIndex)"> <td v-for="(col, colIndex) in columns" :key="colIndex" :class="{ 'fixed-col': colIndex === 0 && fixedFirstColumn }" :style="getCellStyle(colIndex)">
<div class="cell-content"> <div class="cell-content">
<slot :name="col.prop" :row="row" :index="rowIndex"> <slot :name="col.prop" :row="row" :index="rowIndex">
{{ col.formatter ? col.formatter(row) : (row[col.prop] || '-') }} {{ col.formatter ? col.formatter(row) : ((row[col.prop] ||row[col.prop]===0) ? row[col.prop] : '-') }}
</slot> </slot>
</div> </div>
</td> </td>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 'wangzhihui' '1733904062@qq.com' * @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2025-11-18 14:23:31 * @Date: 2025-11-18 14:23:31
* @LastEditors: 'wangzhihui' '1733904062@qq.com' * @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2026-01-30 15:58:21 * @LastEditTime: 2026-02-06 16:38:29
* @FilePath: \wx-notification\src\router\routes.js * @FilePath: \wx-notification\src\router\routes.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%A * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%A
*/ */
...@@ -21,6 +21,16 @@ const pages = { ...@@ -21,6 +21,16 @@ const pages = {
backgroundColor: '#f7f8fa', backgroundColor: '#f7f8fa',
showAction: true showAction: true
} }
},
{
name: 'detail',
meta: {
keepAlive: true,
title: '商品详情',
noAuth: true,
backgroundColor: '#f7f8fa',
showAction: true
}
} }
], ],
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<span class="value" v-else>{{ orderInfo[item.value] || orderInfo[item.value] === 0 ? orderInfo[item.value] : '--' }}</span> <span class="value" v-else>{{ orderInfo[item.value] || orderInfo[item.value] === 0 ? orderInfo[item.value] : '--' }}</span>
</div> </div>
</div> </div>
<template v-if="staffType == 3">
<div class="title">库存明细</div> <div class="title">库存明细</div>
<div class="search-pop-input"> <div class="search-pop-input">
<van-field v-model="keyword" placeholder="查询门店库存明细" left-icon="https://img02.glsx.com.cn/weapp/resource/saas/scrm/search-icon.png" @input="onSearch" /> <van-field v-model="keyword" placeholder="查询门店库存明细" left-icon="https://img02.glsx.com.cn/weapp/resource/saas/scrm/search-icon.png" @input="onSearch" />
...@@ -19,19 +20,18 @@ ...@@ -19,19 +20,18 @@
<div class="list"> <div class="list">
<template v-for="(item, index) in StockList"> <template v-for="(item, index) in StockList">
<div class="item" :key="index"> <div class="item" :key="index">
<div class="name">{{item.merchantName}}</div> <div class="name">{{ item.merchantName }}</div>
<div class="line"> <div class="line">
<!-- [1, 4, 6, 12, 14] --> <!-- [1, 4, 6, 12, 14] -->
<div class="label">当前库存</div> <div class="label">当前库存</div>
<div class="value">{{item.stock || item.stock === 0 ? parseFloat(item.stock).toFixed(2) + ([1, 4, 6, 12, 14].includes(item.goodsType) ? '米' : '件') : '--'}}</div> <div class="value">{{ item.stock || item.stock === 0 ? item.stock + ([1, 4, 6, 12, 14].includes(item.goodsType) ? '米' : '件') : '--' }}</div>
</div> </div>
<div class="line"> <div class="line">
<div class="label">膜卷号</div> <div class="label">膜卷号</div>
<div class="value">{{item.filmRollNo||item.filmRollNo ===0?item.filmRollNo:'--'}}</div> <div class="value">{{ item.filmRollNo || item.filmRollNo === 0 ? item.filmRollNo : '--' }}</div>
</div> </div>
</div> </div>
</template> </template>
</div> </div>
</template> </template>
<div v-else class="no-data"> <div v-else class="no-data">
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
</div> </div>
</template> </template>
</scroll-view> </scroll-view>
</template>
</div> </div>
</template> </template>
<script> <script>
...@@ -48,6 +49,7 @@ import allocateApi from '@/api/allocate' ...@@ -48,6 +49,7 @@ import allocateApi from '@/api/allocate'
export default { export default {
data() { data() {
return { return {
staffType:this.$route.query.staffType,
page: { page: {
currentPage: 1, currentPage: 1,
pageSize: 10 pageSize: 10
...@@ -56,7 +58,7 @@ export default { ...@@ -56,7 +58,7 @@ export default {
StockList: [], StockList: [],
id: this.$route.query.id, id: this.$route.query.id,
orderInfo: {}, orderInfo: {},
keyword:'', keyword: '',
orderBasicInfoList: [ orderBasicInfoList: [
{ label: '商品名称', value: 'goodsName' }, { label: '商品名称', value: 'goodsName' },
{ label: '商品编码', value: 'productCode' }, { label: '商品编码', value: 'productCode' },
...@@ -65,21 +67,21 @@ export default { ...@@ -65,21 +67,21 @@ export default {
label: '调拨数量', label: '调拨数量',
value: 'allocateNumber', value: 'allocateNumber',
formatter: cellValue => { formatter: cellValue => {
return cellValue.allocateNumber || cellValue.allocateNumber == 0 ? parseFloat(cellValue.allocateNumber).toFixed(2) + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--' return cellValue.allocateNumber || cellValue.allocateNumber === 0 ? cellValue.allocateNumber + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--'
} }
}, },
{ {
label: '调入门店库存', label: '调入门店库存',
value: 'inStockQty', value: 'inStockQty',
formatter: cellValue => { formatter: cellValue => {
return cellValue.inStockQty || cellValue.inStockQty == 0 ? parseFloat(cellValue.inStockQty).toFixed(2) + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--' return cellValue.inStockQty || cellValue.inStockQty === 0 ? cellValue.inStockQty + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--'
} }
}, },
{ {
label: '调出门店库存', label: '调出门店库存',
value: 'outStockQty', value: 'outStockQty',
formatter: cellValue => { formatter: cellValue => {
return cellValue.outStockQty || cellValue.outStockQty == 0 ? parseFloat(cellValue.outStockQty).toFixed(2) + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--' return cellValue.outStockQty || cellValue.outStockQty === 0 ? cellValue.outStockQty + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--'
} }
}, },
{ label: '膜卷号', value: 'filmRollNo' } { label: '膜卷号', value: 'filmRollNo' }
...@@ -92,10 +94,9 @@ export default { ...@@ -92,10 +94,9 @@ export default {
methods: { methods: {
getAllocateGoodsDetail() { getAllocateGoodsDetail() {
allocateApi.getAllocateGoodsDetail({ id: this.id }).then(({ code, data, message }) => { allocateApi.getAllocateGoodsDetail({ id: this.id }).then(({ code, data, message }) => {
console.log(data, 'data')
if (code == 0) { if (code == 0) {
this.orderInfo = data this.orderInfo = data
this.getList() if (this.staffType == 3) this.getList()
} else { } else {
Notify(message) Notify(message)
} }
...@@ -103,7 +104,7 @@ export default { ...@@ -103,7 +104,7 @@ export default {
}, },
getList(keyword) { getList(keyword) {
let list = this.StockList let list = this.StockList
allocateApi.getAllocateGoodsStockDetail({ ...this.page, merchantName: keyword,upgradeGoodsld: this.orderInfo.goodsId}).then(({ code, data, message }) => { allocateApi.getAllocateGoodsStockDetail({ ...this.page, merchantName: keyword, upgradeGoodsld: this.orderInfo.goodsId }).then(({ code, data, message }) => {
this.hideLoading() this.hideLoading()
if (code == 0) { if (code == 0) {
this.StockList = [...list, ...data.list] this.StockList = [...list, ...data.list]
...@@ -207,8 +208,8 @@ export default { ...@@ -207,8 +208,8 @@ export default {
font-size: 14px; font-size: 14px;
} }
} }
.content{ .content {
height:calc(100% - 360px); height: calc(100% - 360px);
.no-data { .no-data {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
......
...@@ -101,7 +101,7 @@ export default { ...@@ -101,7 +101,7 @@ export default {
prop: 'allocateNumber', prop: 'allocateNumber',
width: '100px', width: '100px',
formatter: cellValue => { formatter: cellValue => {
return cellValue.allocateNumber || cellValue.allocateNumber === 0 ? parseFloat(cellValue.allocateNumber).toFixed(2) + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--' return cellValue.allocateNumber || cellValue.allocateNumber === 0 ? cellValue.allocateNumber + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--'
} }
}, },
{ {
...@@ -109,12 +109,12 @@ export default { ...@@ -109,12 +109,12 @@ export default {
prop: 'inStockQty', prop: 'inStockQty',
width: '120px', width: '120px',
formatter: cellValue => { formatter: cellValue => {
return cellValue.inStockQty || cellValue.inStockQty === 0 ? parseFloat(cellValue.inStockQty).toFixed(2) + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--' return cellValue.inStockQty || cellValue.inStockQty === 0 ? cellValue.inStockQty + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--'
} }
}, },
{ {
label: '调出门店库存', prop: 'outStockQty', width: '120px', formatter: cellValue => { label: '调出门店库存', prop: 'outStockQty', width: '120px', formatter: cellValue => {
return cellValue.outStockQty || cellValue.outStockQty === 0 ? parseFloat(cellValue.outStockQty).toFixed(2) + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--' return cellValue.outStockQty || cellValue.outStockQty === 0 ? cellValue.outStockQty + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--'
} }
}, },
{ {
...@@ -220,7 +220,8 @@ export default { ...@@ -220,7 +220,8 @@ export default {
this.$router.push({ this.$router.push({
path: '/cannibalize/detail', path: '/cannibalize/detail',
query: { query: {
id: row.id id: row.id,
staffType:this.staffType
} }
}) })
}, },
......
<!-- 商品详情 -->
<template>
<div class="detail-container">
<div class="info-section">
<div class="title">基本信息</div>
<div v-for="(item, index) in orderBasicInfoList" :key="index" class="info-item">
<span>{{ item.label }}</span>
<span class="value" v-if="item.formatter">{{ item.formatter(orderInfo) }}</span>
<span class="value" v-else>{{ orderInfo[item.value] || orderInfo[item.value] === 0 ? orderInfo[item.value] : '--' }}</span>
</div>
</div>
<template v-if="staffType == 3">
<div class="title">库存明细</div>
<div class="search-pop-input">
<van-field v-model="keyword" placeholder="查询门店库存明细" left-icon="https://img02.glsx.com.cn/weapp/resource/saas/scrm/search-icon.png" @input="onSearch" />
</div>
<scroll-view class="content" @ReachBottom="onReachBottom" ref="scrollView">
<template v-if="flag">
<template v-if="StockList.length">
<div class="list">
<template v-for="(item, index) in StockList">
<div class="item" :key="index">
<div class="name">{{ item.merchantName }}</div>
<div class="line">
<!-- [1, 4, 6, 12, 14] -->
<div class="label">当前库存</div>
<div class="value">{{ item.stock || item.stock === 0 ? item.stock + ([1, 4, 6, 12, 14].includes(item.goodsType) ? '米' : '件') : '--' }}</div>
</div>
<div class="line">
<div class="label">膜卷号</div>
<div class="value">{{ item.filmRollNo || item.filmRollNo === 0 ? item.filmRollNo : '--' }}</div>
</div>
</div>
</template>
</div>
</template>
<div v-else class="no-data">
<img src="@/assets/images/no-data.png" />
<span class="no-data-text">暂无数据</span>
</div>
</template>
</scroll-view>
</template>
</div>
</template>
<script>
import utils from '@/utils/util'
import purchaseApi from '@/api/purchase'
import allocateApi from '@/api/allocate'
export default {
data() {
return {
staffType:this.$route.query.staffType,
page: {
currentPage: 1,
pageSize: 10
},
flag: false,
StockList: [],
id: this.$route.query.id,
orderInfo: {},
keyword: '',
orderBasicInfoList: [
{
label: '商品名称',
value: 'upgradeGoodsName'
},
{ label: '商品编码', value: 'type', width: '100px' },
{ label: '规格', value: 'specificationData', width: '90px' },
{
label: '采购数量',
value: 'goodsNumber',
width: '100px',
formatter: row => {
const unit = row.conversionValue ? '卷' : '件'
return (row.goodsNumber || 0) + unit
}
},
{
label: '库存总量',
value: 'inventoryTotal',
width: '100px',
formatter: row => {
const total = (row.goodsNumber || 0) * (row.conversionValue || 1)
if (!row.conversionValue) {
return (row.goodsNumber || 0) + '件'
} else {
// 乘法可能存在精度问题,简单处理
return ((row.goodsNumber || 0) * row.conversionValue).toFixed(2) + '米'
}
}
},
{
label: '已发货数量',
value: 'purchaseNumber',
width: '100px',
formatter: row => {
const unit = row.conversionValue ? '卷' : '件'
return (row.purchaseNumber || 0) + unit
}
},
{
label: '单价',
value: 'upgradePurchasePrice',
width: '90px',
formatter: row => {
return '¥' + row.upgradePurchasePrice
}
},
{
label: '总价',
value: 'goodsTotalPrice',
width: '90px',
formatter: row => {
return '¥' + row.goodsTotalPrice
}
}
]
}
},
created() {
this.getAllocateGoodsDetail()
},
methods: {
getAllocateGoodsDetail() {
purchaseApi.getAllocateGoodsDetail({ id: this.id }).then(({ code, data, message }) => {
if (code == 0) {
this.orderInfo = data
if (this.staffType == 3) this.getList()
} else {
Notify(message)
}
})
},
getList(keyword) {
let list = this.StockList
allocateApi.getAllocateGoodsStockDetail({ ...this.page, merchantName: keyword, upgradeGoodsld: this.orderInfo.goodsId }).then(({ code, data, message }) => {
this.hideLoading()
if (code == 0) {
this.StockList = [...list, ...data.list]
if (this.page.currentPage > 1) this.$refs.scrollView.loading = false
if (data.list == 0 && this.flag) {
this.$refs.scrollView.finished = true
}
} else {
Notify(message)
}
this.flag = true
})
},
onReachBottom() {
console.log('触底')
this.page.currentPage++
this.getList()
},
onSearch(val) {
const debouncedSearch = utils.debounce(
val => {
this.StockList = []
this.page.currentPage = 1
this.getList(val)
},
200,
true
)
// 调用防抖函数
debouncedSearch(val)
},
handleSearch(val) {}
}
}
</script>
<style lang="scss" scoped>
.detail-container {
padding: 12px 10px;
.info-section {
padding: 16px 16px 6px;
border-radius: 8px;
font-size: 14px;
background: #ffffff;
box-sizing: border-box;
margin-bottom: 12px;
}
.title {
color: #333333;
font-size: 15px;
margin-bottom: 10px;
position: relative;
font-weight: 600;
}
.info-item {
margin-bottom: 10px;
display: flex;
}
.info-item :nth-child(1) {
display: inline-block;
width: 88px;
color: #999999;
margin-right: 12px;
}
.info-item :nth-child(2) {
color: #292d33;
width: 223px;
white-space: wrap;
display: inline-block;
}
.search-pop-input {
margin: 8px 0;
position: relative;
z-index: 99;
width: 343px;
::v-deep(.van-cell) {
width: 100%;
height: 40px;
border-radius: 253px;
}
::v-deep(.van-field__left-icon) {
position: absolute;
width: 16px;
height: 16px;
margin: 4px 6px 8px 12px;
z-index: 999;
.van-icon {
color: #999ea8;
}
}
::v-deep(.van-field__body) {
position: absolute;
width: 343px;
border-radius: 16px;
left: 0;
}
::v-deep(.van-field__control) {
padding-left: 33px;
font-size: 14px;
}
}
.content {
height: calc(100% - 360px);
.no-data {
display: flex;
flex-direction: column;
align-items: center;
justify-items: center;
img {
width: 72px;
height: 72px;
}
.no-data-text {
color: #999ea8;
font-size: 12px;
}
}
}
.list {
.item {
padding: 16px;
border-radius: 8px;
background: #ffffff;
box-shadow: 0 0 10px 0 #bababa40;
.name {
color: #333333;
font-size: 15px;
font-weight: 600;
}
.line {
display: flex;
align-items: center;
margin-top: 10px;
.label {
width: 88px;
color: #999999;
font-size: 14px;
margin-right: 12px;
}
.value {
color: #333333;
font-size: 14px;
}
}
}
}
}
</style>
...@@ -299,9 +299,16 @@ export default { ...@@ -299,9 +299,16 @@ export default {
this.detailVisible = !this.detailVisible this.detailVisible = !this.detailVisible
}, },
handleProductClick(row) { handleProductClick(row) {
console.log(row) // console.log(row)
this.productInfo = row // this.productInfo = row
this.handleDetailCancel() // this.handleDetailCancel()
this.$router.push({
path: '/purchase/detail',
query: {
id: row.id,
staffType:this.staffType
}
})
}, },
//驳回 //驳回
handleReject() { handleReject() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!