货物包拆单预测
This commit is contained in:
39
src/api/lb-goods.js
Normal file
39
src/api/lb-goods.js
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getLbGoodsList(params) {
|
||||||
|
return request({
|
||||||
|
url: '/lbGoods/list',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getLbGoodsById(id) {
|
||||||
|
return request({
|
||||||
|
url: `/lbGoods/get/${id}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addLbGoods(data) {
|
||||||
|
return request({
|
||||||
|
url: '/lbGoods/add',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateLbGoods(data) {
|
||||||
|
return request({
|
||||||
|
url: '/lbGoods/update',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteLbGoods(id) {
|
||||||
|
return request({
|
||||||
|
url: `/lbGoods/delete/${id}`,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -429,10 +429,10 @@ export const constantRoutes = [
|
|||||||
meta: { title: '抵扣金管理', icon: 'el-icon-wallet' }
|
meta: { title: '抵扣金管理', icon: 'el-icon-wallet' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'package-predict',
|
path: 'goods-package-predict',
|
||||||
name: 'LbPackagePredict',
|
name: 'LbGoodsPackagePredict',
|
||||||
component: () => import('@/views/lb-business/package-predict/index'),
|
component: () => import('@/views/lb-business/goods-package-predict/index'),
|
||||||
meta: { title: '拆包预测', icon: 'el-icon-box' }
|
meta: { title: '货物包预测', icon: 'el-icon-box' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'order-add-stop',
|
path: 'order-add-stop',
|
||||||
|
|||||||
523
src/views/lb-business/goods-package-predict/index.vue
Normal file
523
src/views/lb-business/goods-package-predict/index.vue
Normal file
@@ -0,0 +1,523 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-card class="filter-container" shadow="never">
|
||||||
|
<el-form :model="queryParams" :inline="true" label-width="90px">
|
||||||
|
<el-form-item label="旧商品ID">
|
||||||
|
<el-input v-model="queryParams.oldId" clearable placeholder="旧商品ID" style="width: 140px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户ID">
|
||||||
|
<el-input v-model="queryParams.userId" clearable placeholder="所属用户ID" style="width: 140px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商品标题">
|
||||||
|
<el-input v-model="queryParams.title" clearable placeholder="商品标题" style="width: 160px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="卖家ID">
|
||||||
|
<el-input v-model="queryParams.sellerId" clearable placeholder="卖家用户ID" style="width: 140px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否展示">
|
||||||
|
<el-select v-model="queryParams.isShow" clearable placeholder="不限" style="width: 100px">
|
||||||
|
<el-option label="否" :value="0" />
|
||||||
|
<el-option label="是" :value="1" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态">
|
||||||
|
<el-input v-model="queryParams.status" clearable placeholder="状态" style="width: 100px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="createdAtRange"
|
||||||
|
type="datetimerange"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始"
|
||||||
|
end-placeholder="结束"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
:default-time="['00:00:00', '23:59:59']"
|
||||||
|
style="width: 360px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="更新时间">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="updatedAtRange"
|
||||||
|
type="datetimerange"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始"
|
||||||
|
end-placeholder="结束"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
:default-time="['00:00:00', '23:59:59']"
|
||||||
|
style="width: 360px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
||||||
|
<el-button icon="el-icon-delete" @click="resetQuery">清空</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="action-container" shadow="never">
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="table-container" shadow="never">
|
||||||
|
<el-table v-loading="loading" :data="list" style="width: 100%">
|
||||||
|
<el-table-column label="商品ID" prop="id" min-width="110" show-overflow-tooltip />
|
||||||
|
<el-table-column label="旧商品ID" prop="oldId" min-width="110" show-overflow-tooltip />
|
||||||
|
<el-table-column label="用户ID" prop="userId" min-width="100" show-overflow-tooltip />
|
||||||
|
<el-table-column label="商品标题" prop="title" min-width="160" show-overflow-tooltip />
|
||||||
|
<el-table-column label="图片" prop="image" min-width="120" show-overflow-tooltip />
|
||||||
|
<el-table-column label="单价" prop="price" min-width="90" align="right">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ formatAmount(scope.row.price) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="总金额" prop="totalMoney" min-width="90" align="right">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ formatAmount(scope.row.totalMoney) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="数量描述" prop="quantity" min-width="100" show-overflow-tooltip />
|
||||||
|
<el-table-column label="卖家ID" prop="sellerId" min-width="100" show-overflow-tooltip />
|
||||||
|
<el-table-column label="是否展示" width="90" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ formatYesNo(scope.row.isShow) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" prop="status" width="80" align="center" />
|
||||||
|
<el-table-column label="创建时间" prop="createdAt" min-width="160">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ formatDateTime(scope.row.createdAt) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="更新时间" prop="updatedAt" min-width="160">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ formatDateTime(scope.row.updatedAt) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" fixed="right" width="140">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
|
||||||
|
<el-button type="text" style="color:#F56C6C;" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<el-pagination
|
||||||
|
:current-page="queryParams.current"
|
||||||
|
:page-size="queryParams.size"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
:total="total"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
/>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="760px" @close="resetForm">
|
||||||
|
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="110px">
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="商品ID" prop="id">
|
||||||
|
<el-input v-model="form.id" :disabled="isEdit" placeholder="外部商品主键,新增时必填" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="旧商品ID" prop="oldId">
|
||||||
|
<el-input v-model="form.oldId" placeholder="旧商品ID" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="所属用户ID" prop="userId">
|
||||||
|
<el-input v-model="form.userId" placeholder="所属用户ID" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="卖家用户ID" prop="sellerId">
|
||||||
|
<el-input v-model="form.sellerId" placeholder="卖家用户ID" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-form-item label="商品标题" prop="title">
|
||||||
|
<el-input v-model="form.title" placeholder="请输入商品标题" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商品图片" prop="image">
|
||||||
|
<el-input v-model="form.image" placeholder="商品图片路径" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="单价" prop="price">
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.price"
|
||||||
|
:min="0"
|
||||||
|
:precision="2"
|
||||||
|
:step="0.01"
|
||||||
|
controls-position="right"
|
||||||
|
style="width: 100%"
|
||||||
|
placeholder="单价"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="总金额" prop="totalMoney">
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.totalMoney"
|
||||||
|
:min="0"
|
||||||
|
:precision="2"
|
||||||
|
:step="0.01"
|
||||||
|
controls-position="right"
|
||||||
|
style="width: 100%"
|
||||||
|
placeholder="总金额"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-form-item label="数量描述" prop="quantity">
|
||||||
|
<el-input v-model="form.quantity" placeholder="如:≈6盒" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="是否展示" prop="isShow">
|
||||||
|
<el-select v-model="form.isShow" clearable placeholder="是否展示" style="width: 100%">
|
||||||
|
<el-option label="否" :value="0" />
|
||||||
|
<el-option label="是" :value="1" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.status"
|
||||||
|
:controls="false"
|
||||||
|
style="width: 100%"
|
||||||
|
placeholder="状态"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">确定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
addLbGoods,
|
||||||
|
deleteLbGoods,
|
||||||
|
getLbGoodsList,
|
||||||
|
updateLbGoods
|
||||||
|
} from '@/api/lb-goods'
|
||||||
|
import { getBusinessHeaders } from '@/utils/business-headers'
|
||||||
|
|
||||||
|
function emptyForm() {
|
||||||
|
return {
|
||||||
|
id: '',
|
||||||
|
oldId: '',
|
||||||
|
userId: '',
|
||||||
|
title: '',
|
||||||
|
image: '',
|
||||||
|
price: undefined,
|
||||||
|
totalMoney: undefined,
|
||||||
|
quantity: '',
|
||||||
|
sellerId: '',
|
||||||
|
isShow: undefined,
|
||||||
|
status: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseOptionalLong(value) {
|
||||||
|
if (value === undefined || value === null || String(value).trim() === '') return undefined
|
||||||
|
const n = Number(String(value).trim())
|
||||||
|
return Number.isFinite(n) ? n : undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseOptionalInt(value) {
|
||||||
|
if (value === undefined || value === null || String(value).trim() === '') return undefined
|
||||||
|
const n = parseInt(String(value).trim(), 10)
|
||||||
|
return Number.isFinite(n) ? n : undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'LbGoodsPackagePredict',
|
||||||
|
data() {
|
||||||
|
const requireId = (rule, value, callback) => {
|
||||||
|
if (this.isEdit) {
|
||||||
|
callback()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (value === undefined || value === null || String(value).trim() === '') {
|
||||||
|
callback(new Error('请输入商品ID'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const n = Number(String(value).trim())
|
||||||
|
if (!Number.isFinite(n)) {
|
||||||
|
callback(new Error('商品ID需为数字'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
submitLoading: false,
|
||||||
|
list: [],
|
||||||
|
total: 0,
|
||||||
|
dialogVisible: false,
|
||||||
|
dialogTitle: '',
|
||||||
|
isEdit: false,
|
||||||
|
createdAtRange: null,
|
||||||
|
updatedAtRange: null,
|
||||||
|
queryParams: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
oldId: '',
|
||||||
|
userId: '',
|
||||||
|
title: '',
|
||||||
|
sellerId: '',
|
||||||
|
isShow: undefined,
|
||||||
|
status: ''
|
||||||
|
},
|
||||||
|
form: emptyForm(),
|
||||||
|
formRules: {
|
||||||
|
id: [{ validator: requireId, trigger: 'blur' }],
|
||||||
|
title: [{ required: true, message: '请输入商品标题', trigger: 'blur' }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetchList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getTenantIdFromBusinessHeaders() {
|
||||||
|
const headers = getBusinessHeaders()
|
||||||
|
const value = headers && headers['X-Tenant-Id']
|
||||||
|
return value ? String(value).trim() : ''
|
||||||
|
},
|
||||||
|
fetchList() {
|
||||||
|
this.loading = true
|
||||||
|
getLbGoodsList(this.buildListParams())
|
||||||
|
.then((res) => {
|
||||||
|
if (res && (res.code === 20000 || res.code === 200 || res.success === true)) {
|
||||||
|
this.list = Array.isArray(res.data) ? res.data : []
|
||||||
|
this.total = typeof res.total === 'number'
|
||||||
|
? res.total
|
||||||
|
: (res.page && typeof res.page.total === 'number' ? res.page.total : this.list.length)
|
||||||
|
} else {
|
||||||
|
this.list = []
|
||||||
|
this.total = 0
|
||||||
|
if (res && res.message) {
|
||||||
|
this.$message.error(res.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.list = []
|
||||||
|
this.total = 0
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
buildListParams() {
|
||||||
|
const params = {
|
||||||
|
current: this.queryParams.current,
|
||||||
|
size: this.queryParams.size,
|
||||||
|
oldId: parseOptionalLong(this.queryParams.oldId),
|
||||||
|
userId: parseOptionalLong(this.queryParams.userId),
|
||||||
|
title: this.queryParams.title || undefined,
|
||||||
|
sellerId: parseOptionalLong(this.queryParams.sellerId),
|
||||||
|
isShow: this.queryParams.isShow === 0 || this.queryParams.isShow === 1
|
||||||
|
? this.queryParams.isShow
|
||||||
|
: undefined,
|
||||||
|
status: parseOptionalInt(this.queryParams.status)
|
||||||
|
}
|
||||||
|
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||||
|
if (tenantId) params.tenantId = tenantId
|
||||||
|
if (Array.isArray(this.createdAtRange) && this.createdAtRange.length === 2) {
|
||||||
|
params.createdAtStart = this.createdAtRange[0]
|
||||||
|
params.createdAtEnd = this.createdAtRange[1]
|
||||||
|
}
|
||||||
|
if (Array.isArray(this.updatedAtRange) && this.updatedAtRange.length === 2) {
|
||||||
|
params.updatedAtStart = this.updatedAtRange[0]
|
||||||
|
params.updatedAtEnd = this.updatedAtRange[1]
|
||||||
|
}
|
||||||
|
Object.keys(params).forEach((key) => {
|
||||||
|
if (params[key] === undefined || params[key] === '') delete params[key]
|
||||||
|
})
|
||||||
|
return params
|
||||||
|
},
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.current = 1
|
||||||
|
this.fetchList()
|
||||||
|
},
|
||||||
|
resetQuery() {
|
||||||
|
this.queryParams = {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
oldId: '',
|
||||||
|
userId: '',
|
||||||
|
title: '',
|
||||||
|
sellerId: '',
|
||||||
|
isShow: undefined,
|
||||||
|
status: ''
|
||||||
|
}
|
||||||
|
this.createdAtRange = null
|
||||||
|
this.updatedAtRange = null
|
||||||
|
this.fetchList()
|
||||||
|
},
|
||||||
|
handleSizeChange(size) {
|
||||||
|
this.queryParams.size = size
|
||||||
|
this.fetchList()
|
||||||
|
},
|
||||||
|
handleCurrentChange(current) {
|
||||||
|
this.queryParams.current = current
|
||||||
|
this.fetchList()
|
||||||
|
},
|
||||||
|
rowToForm(row) {
|
||||||
|
const pickLong = (k) => (row[k] !== undefined && row[k] !== null ? String(row[k]) : '')
|
||||||
|
return {
|
||||||
|
id: pickLong('id'),
|
||||||
|
oldId: pickLong('oldId'),
|
||||||
|
userId: pickLong('userId'),
|
||||||
|
title: row.title || '',
|
||||||
|
image: row.image || '',
|
||||||
|
price: row.price === null || row.price === undefined ? undefined : Number(row.price),
|
||||||
|
totalMoney: row.totalMoney === null || row.totalMoney === undefined ? undefined : Number(row.totalMoney),
|
||||||
|
quantity: row.quantity || '',
|
||||||
|
sellerId: pickLong('sellerId'),
|
||||||
|
isShow: row.isShow !== undefined && row.isShow !== null ? row.isShow : undefined,
|
||||||
|
status: row.status !== undefined && row.status !== null ? row.status : undefined
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
this.dialogTitle = '新增货品'
|
||||||
|
this.isEdit = false
|
||||||
|
this.form = emptyForm()
|
||||||
|
this.dialogVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleEdit(row) {
|
||||||
|
this.dialogTitle = '编辑货品'
|
||||||
|
this.isEdit = true
|
||||||
|
this.form = this.rowToForm(row)
|
||||||
|
this.dialogVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDelete(row) {
|
||||||
|
this.$confirm('确定删除该货品吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => deleteLbGoods(row.id))
|
||||||
|
.then((res) => {
|
||||||
|
const isSuccess = res && (res.success === true || res.code === 200 || res.code === 20000)
|
||||||
|
if (!isSuccess) {
|
||||||
|
this.$message.error((res && res.message) || '删除失败')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$message.success((res && res.message) || '删除成功')
|
||||||
|
this.fetchList()
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
},
|
||||||
|
handleSubmit() {
|
||||||
|
this.$refs.dataForm.validate((valid) => {
|
||||||
|
if (!valid) return
|
||||||
|
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||||
|
if (!tenantId) {
|
||||||
|
this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const payload = { ...this.buildPayload(), tenantId }
|
||||||
|
this.submitLoading = true
|
||||||
|
const req = this.isEdit ? updateLbGoods(payload) : addLbGoods(payload)
|
||||||
|
req.then((res) => {
|
||||||
|
const isSuccess = res && (res.success === true || res.code === 200 || res.code === 20000)
|
||||||
|
if (!isSuccess) {
|
||||||
|
this.$message.error((res && res.message) || (this.isEdit ? '更新失败' : '新增失败'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$message.success((res && res.message) || (this.isEdit ? '更新成功' : '新增成功'))
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.fetchList()
|
||||||
|
}).finally(() => {
|
||||||
|
this.submitLoading = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
buildPayload() {
|
||||||
|
const payload = {
|
||||||
|
id: parseOptionalLong(this.form.id),
|
||||||
|
oldId: parseOptionalLong(this.form.oldId),
|
||||||
|
userId: parseOptionalLong(this.form.userId),
|
||||||
|
title: this.form.title || undefined,
|
||||||
|
image: this.form.image || undefined,
|
||||||
|
price: this.form.price,
|
||||||
|
totalMoney: this.form.totalMoney,
|
||||||
|
quantity: this.form.quantity || undefined,
|
||||||
|
sellerId: parseOptionalLong(this.form.sellerId),
|
||||||
|
isShow: this.form.isShow === 0 || this.form.isShow === 1 ? this.form.isShow : undefined,
|
||||||
|
status: this.form.status !== undefined && this.form.status !== null && this.form.status !== ''
|
||||||
|
? this.form.status
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
Object.keys(payload).forEach((key) => {
|
||||||
|
if (payload[key] === undefined || payload[key] === '') delete payload[key]
|
||||||
|
})
|
||||||
|
return payload
|
||||||
|
},
|
||||||
|
resetForm() {
|
||||||
|
this.$refs.dataForm && this.$refs.dataForm.resetFields()
|
||||||
|
this.form = emptyForm()
|
||||||
|
},
|
||||||
|
formatAmount(val) {
|
||||||
|
if (val === null || val === undefined || val === '') return '-'
|
||||||
|
const n = Number(val)
|
||||||
|
return Number.isNaN(n) ? String(val) : n.toFixed(2)
|
||||||
|
},
|
||||||
|
formatYesNo(value) {
|
||||||
|
if (value === 1) return '是'
|
||||||
|
if (value === 0) return '否'
|
||||||
|
return '-'
|
||||||
|
},
|
||||||
|
formatDateTime(dateTime) {
|
||||||
|
if (!dateTime) return '-'
|
||||||
|
const date = new Date(String(dateTime).replace('T', ' '))
|
||||||
|
if (Number.isNaN(date.getTime())) return String(dateTime)
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||||
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0')
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0')
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, '0')
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.app-container {
|
||||||
|
.filter-container {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-container {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-container {
|
||||||
|
.el-pagination {
|
||||||
|
margin-top: 20px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<el-card shadow="never">
|
|
||||||
<div class="placeholder-title">拆包预测</div>
|
|
||||||
<div class="placeholder-desc">
|
|
||||||
页面入口已创建,可在此按业务需求补充拆包预测相关功能。
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'LbPackagePredict'
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.placeholder-title {
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 600;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.placeholder-desc {
|
|
||||||
color: #606266;
|
|
||||||
line-height: 22px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -208,7 +208,6 @@
|
|||||||
</th>
|
</th>
|
||||||
<th>手机号</th>
|
<th>手机号</th>
|
||||||
<th>特权开通日期</th>
|
<th>特权开通日期</th>
|
||||||
<th>申请人特权</th>
|
|
||||||
<th>开通日期</th>
|
<th>开通日期</th>
|
||||||
<th>购买时间</th>
|
<th>购买时间</th>
|
||||||
<th>金额</th>
|
<th>金额</th>
|
||||||
@@ -267,7 +266,6 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>{{ row.applyPhone || '-' }}</td>
|
<td>{{ row.applyPhone || '-' }}</td>
|
||||||
<td>{{ formatTryDate(row.tryDate) }}</td>
|
<td>{{ formatTryDate(row.tryDate) }}</td>
|
||||||
<td>{{ formatApplicantPrivilege(row) }}</td>
|
|
||||||
<td>{{ formatOpenDate(row.applyDate) }}</td>
|
<td>{{ formatOpenDate(row.applyDate) }}</td>
|
||||||
<td>{{ formatLatestTradePayTime(row) }}</td>
|
<td>{{ formatLatestTradePayTime(row) }}</td>
|
||||||
<td>{{ formatLatestTradeTotalMoney(row) }}</td>
|
<td>{{ formatLatestTradeTotalMoney(row) }}</td>
|
||||||
@@ -905,9 +903,6 @@ export default {
|
|||||||
if (viptime == null || viptime === '') return '-'
|
if (viptime == null || viptime === '') return '-'
|
||||||
return this.formatOpenDate(viptime)
|
return this.formatOpenDate(viptime)
|
||||||
},
|
},
|
||||||
formatApplicantPrivilege(row) {
|
|
||||||
return this.formatUserPrivilege(row && row.applicantUser)
|
|
||||||
},
|
|
||||||
formatReferrerPrivilege(row) {
|
formatReferrerPrivilege(row) {
|
||||||
return this.formatUserPrivilege(row && row.referrerUser)
|
return this.formatUserPrivilege(row && row.referrerUser)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user