Commit 8b70f765 authored by zhanglw's avatar zhanglw

产品更新

parent c760d154
...@@ -110,6 +110,12 @@ export const HttpReq = { ...@@ -110,6 +110,12 @@ export const HttpReq = {
method: 'get' method: 'get'
}) })
}, },
checkEnterpriseName: function(params) {
return request({
url: '/api/bsw/product/checkEnterpriseName?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
// 添加产品详情 // 添加产品详情
addProduct: function(data) { addProduct: function(data) {
return request({ return request({
...@@ -120,6 +126,30 @@ export const HttpReq = { ...@@ -120,6 +126,30 @@ export const HttpReq = {
return res return res
}) })
}, },
// 更新产品详情
updateProductDetail: function(data) {
return request({
url: '/api/bsw/product/updateProductDetail',
method: 'put',
data: data
}).then((res) => {
return res
})
},
// 查询产品列表
queryProduct: function(params) {
return request({
url: '/api/bsw/product/queryProduct?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
// 查询产品详情
queryProductDetail: function(params) {
return request({
url: '/api/bsw/product/queryProductDetail?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
xxx: null xxx: null
} }
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column type="index" width="55" label="序号" :index="indexMethod" /> <el-table-column type="index" width="55" label="序号" :index="indexMethod" />
<el-table-column prop="userName" label="用户名" /> <el-table-column prop="userName" label="用户名" />
<el-table-column prop="registeredAddressProvince" label="区域" :formatter="(row, column, cellValue)=>{return dict.label.area_province[cellValue]}" /> <el-table-column prop="registeredAddressProvince" label="区域" :formatter="(row, col, val)=>{return dict.label.area_province[val]}" />
<el-table-column prop="enterpriseName" label="企业名称" /> <el-table-column prop="enterpriseName" label="企业名称" />
<el-table-column prop="enterpriseContactPerson" label="联系人" /> <el-table-column prop="enterpriseContactPerson" label="联系人" />
<el-table-column prop="enterpriseContactPersonPhone" label="联系电话" /> <el-table-column prop="enterpriseContactPersonPhone" label="联系电话" />
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
<!-- 表单渲染 --> <!-- 表单渲染 -->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="cancelView" :visible="visible" :title="title" width="1080px"> <el-dialog append-to-body :close-on-click-modal="false" :before-close="cancelView" :visible="visible" :title="title" width="1080px">
<el-form ref="formViewRef" :model="formData" :rules="rules" :status-icon="true" label-width="240px"> <el-form ref="formViewRef" :model="formData" :rules="rules" :status-icon="true" label-width="240px">
<el-form-item label="供应商名称:" class="form-cell" prop="customerName"> <el-form-item label="供应商名称:" class="form-cell" prop="enterpriseName">
<div class="cell-box"> <div class="cell-box">
<el-autocomplete <el-autocomplete
v-model="formData.customerName" v-model="formData.enterpriseName"
class="cell-input" class="cell-input"
:fetch-suggestions="querySearch" :fetch-suggestions="querySearch"
placeholder="请输入供应商名称" placeholder="请输入供应商名称"
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
</el-form-item> </el-form-item>
<el-form-item label="交易保障承诺:" class="form-cell" prop="letterOfCommitment"> <el-form-item label="交易保障承诺:" class="form-cell" prop="letterOfCommitment">
<div class="cell-box"> <div class="cell-box">
<el-checkbox v-model="formData.letterOfCommitment"><em>卖家承诺履约诈合规骗包赔,保障产品交易安全</em></el-checkbox> <el-checkbox v-model="formData.letterOfCommitment"><em>卖家承诺履约合规诈骗包赔,保障产品交易安全</em></el-checkbox>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -258,7 +258,7 @@ export default { ...@@ -258,7 +258,7 @@ export default {
dialogImageVisible: false, dialogImageVisible: false,
visible: false, visible: false,
tagTypes: ['', 'primary', 'success', 'warning', 'danger', 'info', 'info', 'info'], tagTypes: ['', 'primary', 'success', 'warning', 'danger', 'info', 'info', 'info'],
title: '产品信息详情', title: '添加产品信息详情',
productSubTypeOpts: [], productSubTypeOpts: [],
inputVisible: false, inputVisible: false,
inputValue: '', inputValue: '',
...@@ -266,9 +266,9 @@ export default { ...@@ -266,9 +266,9 @@ export default {
formData: { formData: {
productId: null, productId: null,
customerId: null, // 供应商id customerId: null, // 供应商id
customerName: '', // 供应商名称 enterpriseName: '', // 供应商名称
productName: '', // 产品名称 productName: '', // 产品名称
productType: null, // 产品大类 productType: '1', // 产品大类
productSubType: null, // 产品小类 productSubType: null, // 产品小类
minPrice: null, // 价格区间-小 minPrice: null, // 价格区间-小
maxPrice: null, // 价格区间-大 maxPrice: null, // 价格区间-大
...@@ -294,12 +294,12 @@ export default { ...@@ -294,12 +294,12 @@ export default {
rank: '1' // 产品品级 rank: '1' // 产品品级
}, },
rules: { rules: {
// customerName: { required: true, message: '请填写供应商名称', trigger: 'blur' },
// productName: { required: true, message: '请填写产品名称', trigger: 'blur' }, // productName: { required: true, message: '请填写产品名称', trigger: 'blur' },
// productType: { required: true, message: '请选择产品分类', trigger: 'blur' }, // productType: { required: true, message: '请选择产品分类', trigger: 'blur' },
// productPic: { required: true, message: '请上传产品图片', trigger: 'blur' }, // productPic: { required: true, message: '请上传产品图片', trigger: 'blur' },
// productDescribe: { required: true, message: '请填写产品概述', trigger: 'blur' }, // productDescribe: { required: true, message: '请填写产品概述', trigger: 'blur' },
// letterOfCommitment: { required: true, message: '请勾选交易保障承诺', trigger: 'blur' }, // letterOfCommitment: { required: true, message: '请勾选交易保障承诺', trigger: 'blur' },
enterpriseName: { validator: this.checkEnterpriseName, trigger: 'blur' },
minPrice: [ minPrice: [
// { required: true, message: '请填写产品价格区间下限', trigger: 'blur' }, // { required: true, message: '请填写产品价格区间下限', trigger: 'blur' },
{ validator: checkPrice, trigger: 'blur' } { validator: checkPrice, trigger: 'blur' }
...@@ -318,9 +318,22 @@ export default { ...@@ -318,9 +318,22 @@ export default {
]) ])
}, },
mounted() { mounted() {
this.productSubTypeOpts = this.dict['product_type_1']
}, },
methods: { methods: {
checkEnterpriseName(rule, value, callback) {
this.$nextTick(_ => {
HttpReq.backstageApi.checkEnterpriseName({
name: value, id: this.formData.customerId
}).then((res) => {
if (res.data) {
callback()
} else {
callback(new Error(res.msg))
}
})
})
},
querySearch(queryString, cb) { querySearch(queryString, cb) {
HttpReq.backstageApi.associateQueryEnterpriseName({ HttpReq.backstageApi.associateQueryEnterpriseName({
name: queryString name: queryString
...@@ -330,6 +343,9 @@ export default { ...@@ -330,6 +343,9 @@ export default {
}, },
handleSelect(item) { handleSelect(item) {
this.formData.customerId = item.id this.formData.customerId = item.id
this.$refs.formViewRef.validateField('enterpriseName', valid => {
return valid
})
}, },
handleClose(tag) { handleClose(tag) {
this.productFeature.splice(this.productFeature.indexOf(tag), 1) this.productFeature.splice(this.productFeature.indexOf(tag), 1)
...@@ -395,7 +411,7 @@ export default { ...@@ -395,7 +411,7 @@ export default {
this.$refs.uploadCom.clearFiles() this.$refs.uploadCom.clearFiles()
this.$refs.formViewRef.resetFields() this.$refs.formViewRef.resetFields()
this.editor.txt.clear() this.editor.txt.clear()
this.productSubTypeOpts = [] this.productSubTypeOpts = this.dict['product_type_1']
this.productFeature = [] this.productFeature = []
this.visible = false this.visible = false
}, },
......
This diff is collapsed.
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
<div class="app-container"> <div class="app-container">
<!--工具栏--> <!--工具栏-->
<div class="head-container"> <div class="head-container">
<el-input v-model="query.username" clearable placeholder="请输入产品ID" style="width:150px;" /> <el-input v-model="query.productId" clearable placeholder="请输入产品ID" style="width:150px;" />
<el-input v-model="query.username" clearable placeholder="请输入产品名称" style="width:280px;" /> <el-input v-model="query.productName" clearable placeholder="请输入产品名称" style="width:280px;" />
<el-select v-model="query.area" clearable placeholder="请选择分类" style="width: 150px"> <el-select v-model="query.productType" clearable placeholder="请选择分类" style="width: 150px">
<el-option v-for="item in dict.product_type" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in dict.product_type" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
<el-select v-model="query.status" clearable placeholder="请选择状态" style="width: 150px"> <el-select v-model="query.status" clearable placeholder="请选择状态" style="width: 150px">
<el-option v-for="item in dict.product_status" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in dict.product_status" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
<date-range-picker v-model="query.createTime" start-placeholder="最后维护开始日期" style="width: 320px" /> <date-range-picker v-model="query.updateTime" start-placeholder="最后维护开始日期" style="width: 320px" />
<el-button type="success" icon="el-icon-search" @click="toSearch">搜索</el-button> <el-button type="success" icon="el-icon-search" @click="toSearch">搜索</el-button>
<el-button type="warning" icon="el-icon-refresh" @click="clearLimit">重置</el-button> <el-button type="warning" icon="el-icon-refresh" @click="clearLimit">重置</el-button>
</div> </div>
...@@ -28,37 +28,42 @@ ...@@ -28,37 +28,42 @@
<el-table id="dataTable" ref="dataTable" v-loading="loading" :data="tableData" tooltip-effect="dark" style="width:auto;min-height: 70vh" @selection-change="handleSelectionChange"> <el-table id="dataTable" ref="dataTable" v-loading="loading" :data="tableData" tooltip-effect="dark" style="width:auto;min-height: 70vh" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column type="index" width="55" label="序号" :index="indexMethod" /> <el-table-column type="index" width="55" label="序号" :index="indexMethod" />
<el-table-column prop="username" label="产品ID" width="140" /> <el-table-column prop="productId" label="产品ID" width="100" />
<el-table-column prop="area" label="产品分类" /> <el-table-column prop="productType" label="产品分类" width="140" :formatter="(row, col, val)=>{return dict.label.product_type[val]}" />
<el-table-column prop="xxx" label="产品名称" /> <el-table-column prop="productName" label="产品名称" />
<el-table-column label="状态" width="100"> <el-table-column label="状态" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<div :style="'color:'+textColors[scope.row.status]">{{ dict.label.product_status[scope.row.status] }}</div> <div :style="'color:'+textColors[scope.row.status]">{{ dict.label.product_status[scope.row.status] }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="xxx" label="最后维护日期" align="center" width="100" /> <el-table-column prop="updateTime" label="最后维护日期" align="center" width="180" />
<el-table-column prop="xxx" label="操作" align="right" width="200"> <el-table-column label="操作" align="right" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip v-show="scope.row.status==3" content="审核"><el-button round plain type="warning" icon="el-icon-s-check" @click="toEdit(scope.row)" /></el-tooltip> <el-tooltip v-show="scope.row.status==3" content="审核"><el-button round plain type="warning" icon="el-icon-s-check" @click="toView(scope.row, true)" /></el-tooltip>
<el-tooltip v-show="scope.row.status==4" content="发布"><el-button round plain type="success" icon="el-icon-finished" @click="toEdit(scope.row)" /></el-tooltip> <el-tooltip v-show="scope.row.status==4" content="发布"><el-button round plain type="success" icon="el-icon-finished" @click="toEdit(scope.row)" /></el-tooltip>
<el-tooltip v-show="scope.row.status==5" content="下架"><el-button round plain type="danger" icon="el-icon-download" @click="toEdit(scope.row)" /></el-tooltip> <el-tooltip v-show="scope.row.status==5" content="下架"><el-button round plain type="danger" icon="el-icon-download" @click="toEdit(scope.row)" /></el-tooltip>
<el-tooltip v-show="scope.row.status>=4" content="编辑"><el-button round plain type="primary" icon="el-icon-edit-outline" @click="toEdit(scope.row)" /></el-tooltip> <el-tooltip v-show="scope.row.status>=4" content="编辑"><el-button round plain type="primary" icon="el-icon-edit-outline" @click="toEdit(scope.row)" /></el-tooltip>
<el-tooltip content="查看"><el-button round plain icon="el-icon-view" @click="toEdit(scope.row)" /></el-tooltip> <el-tooltip content="查看"><el-button round plain icon="el-icon-view" @click="toView(scope.row)" /></el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!--分页组件--> <!--分页组件-->
<el-pagination :total="total" :current-page="page" :page-size="pageSize" style="margin-top: 8px;" layout="total, prev, pager, next, sizes" @size-change="sizeChange" @current-change="pageChange" /> <el-pagination :total="total" :current-page="page" :page-size="pageSize" style="margin-top: 8px;" layout="total, prev, pager, next, sizes" @size-change="sizeChange" @current-change="pageChange" />
</div> </div>
<add-view ref="addView" /> <add-page ref="addPage" />
<edit-page ref="editPage" />
<view-page ref="viewPage" />
</div> </div>
</template> </template>
<script> <script>
import { HttpReq } from '@/api/common'
import DateRangePicker from '@/components/DateRangePicker' import DateRangePicker from '@/components/DateRangePicker'
import AddView from './add' import addPage from './add'
import editPage from './edit'
import viewPage from './view'
export default { export default {
components: { DateRangePicker, AddView }, components: { DateRangePicker, addPage, editPage, viewPage },
dicts: ['product_type', 'product_status'], dicts: ['product_type', 'product_status'],
data() { data() {
return { return {
...@@ -88,19 +93,18 @@ export default { ...@@ -88,19 +93,18 @@ export default {
this.multipleSelection = val this.multipleSelection = val
}, },
loadData() { loadData() {
var sort = 'id,desc' // 清除参数无值的情况
var param = { ...this.query } Object.keys(this.query).length !== 0 && Object.keys(this.query).forEach(item => {
param.page = this.page if (this.query[item] === null || this.query[item] === '') this.query[item] = undefined
param.pageSize = this.pageSize })
param.sort = sort HttpReq.backstageApi.queryProduct({
this.tableData = [ page: this.page - 1,
{ username: '张三', area: '火星', status: 2, enabled: false, xxx: '2023-05-09' }, pageSize: this.pageSize,
{ username: '张三', area: '火星', status: 3, enabled: false, xxx: '2023-05-09' }, ...this.query
{ username: '张三', area: '火星', status: 4, enabled: false, xxx: '2023-05-09' }, }).then((res) => {
{ username: '李四', area: '地球', status: 5, enabled: true, xxx: '2023-05-09' }, this.tableData = res.data.data
{ username: '张三', area: '火星', status: 6, enabled: false, xxx: '2023-05-09' } this.total = res.data.total
] })
this.total = 2
}, },
batchOperate(opt) { batchOperate(opt) {
if (!this.multipleSelection.length) { if (!this.multipleSelection.length) {
...@@ -127,10 +131,13 @@ export default { ...@@ -127,10 +131,13 @@ export default {
}) })
}, },
toAdd() { toAdd() {
this.$refs.addView.loadData() this.$refs.addPage.loadData()
}, },
toEdit(item) { toEdit(item) {
this.$refs.editPage.loadData(item.productId)
},
toView(item, isReview) {
this.$refs.viewPage.loadData(item.productId, isReview)
}, },
toSearch() { toSearch() {
this.page = 1 this.page = 1
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment