Commit b39c47b4 by chenwq

商品管理。详情

1 parent a85b6041
import { http } from '@/main'
const path = 'dj.api.'
const path2 = 'dj.smartcarlife.api.'
const getListApi = params => {
params.method = `scrm.api.shopmall.goods.page.curMerchant`
params.method = 'scrm.api.partner.goods.page'
return http({
url: 'rop-scrm-shopmall/router',
url: 'rop-scrm-partner/router',
method: 'GET',
data: params,
sign: true
......@@ -13,13 +10,67 @@ const getListApi = params => {
}
const getSimpleMerchantList = params => {
params.method = 'scrm.api.carlife.merchant.listWithPageSimpleByCurMerchant'
// params.method = 'scrm.api.carlife.merchant.listWithPageSimpleByCurMerchant'
params.method = 'scrm.api.partner.goods.merchant.page'
return http({
url: 'rop-scrm-carlife/router',
url: 'rop-scrm-partner/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getListApi, getSimpleMerchantList }
const getGoodsSeries = params => {
params.method = 'scrm.api.partner.goods.info.list'
return http({
url: 'rop-scrm-partner/router',
method: 'POST',
data: params,
sign: true
})
}
const updateGoods = params => {
params.method = 'scrm.api.partner.goods.insertOrUpdate'
return http({
url: 'rop-scrm-partner/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
const getGoodsDetail = params => {
params.method = 'scrm.api.partner.goods.getDetailById'
return http({
url: 'rop-scrm-partner/router',
method: 'POST',
data: params,
sign: true
})
}
const deleteGoods = params => {
params.method = 'scrm.api.partner.goods.deleteById'
return http({
url: 'rop-scrm-partner/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
const exportGoods = params => {
params.method = 'scrm.api.partner.goods.export'
return http({
url: 'rop-scrm-partner/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getListApi, getSimpleMerchantList, getGoodsSeries, updateGoods, getGoodsDetail, deleteGoods, exportGoods }
......@@ -2,11 +2,11 @@
function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, maxValue, regRule) {
/* eslint-disable */
var reg = {
priceReg: /^\d[\d\.]*$/,
numReg: /^[1-9]\d*$/,
zNumReg: /^\d*$/
}
/* eslint-enable */
priceReg: /^\d[\d\.]*$/,
numReg: /^[1-9]\d*$/,
zNumReg: /^\d*$/
}
/* eslint-enable */
regRule = regRule || 'priceReg'
if (newValue && ((minValue && newValue < minValue) || (maxValue && newValue > maxValue))) {
return oldValue || ''
......@@ -62,21 +62,22 @@ const deliveryTypeList = [
//会员中心得状态list
const statusList = [
// {
// confId: '',
// confName: '全部'
// },
{
confId: 1,
confName: '生效中'
},
{
confId: 2,
confName: '已失效'
}
]
//会员订单类型字典
const orderTypesList = [{
// {
// confId: '',
// confName: '全部'
// },
{
confId: 1,
confName: '生效中'
},
{
confId: 2,
confName: '已失效'
}
]
//会员订单类型字典
const orderTypesList = [
{
confId: 1,
confName: '套餐'
},
......@@ -110,9 +111,10 @@ const orderStatusList = [
{
confId: 6,
confName: '已退款'
},
}
]
const serviceStatusList = [{
const serviceStatusList = [
{
confId: 1,
confName: '未生效'
},
......@@ -126,7 +128,8 @@ const serviceStatusList = [{
}
]
const memberTypeList = [{
const memberTypeList = [
{
confId: 1,
confName: '正式会员'
},
......@@ -135,7 +138,8 @@ const memberTypeList = [{
confName: '试用会员'
}
]
const stateList = [{
const stateList = [
{
confId: 0,
confName: '待上架'
},
......@@ -146,18 +150,13 @@ const stateList = [{
{
confId: 2,
confName: '已下架'
},
}
]
export {
limitPrice,
orderManageStatusList,
orderSourceList,
deliveryTypeList,
statusList,
serviceStatusList,
memberTypeList,
stateList,
orderTypesList,
orderStatusList
}
\ No newline at end of file
function setMinHeight(calssName = '.edit-container') {
let height = document.querySelector('.header-wrap').clientHeight + 110 + 'px'
let minHeight = 'calc(100vh - ' + height + ')'
document.querySelector(calssName).style.minHeight = minHeight
}
export { limitPrice, orderManageStatusList, orderSourceList, deliveryTypeList, statusList, serviceStatusList, memberTypeList, stateList, orderTypesList, orderStatusList, setMinHeight }
......@@ -84,7 +84,7 @@ export default {
mounted() {
this.selectedData = this.storeSelected
this.selectedData.forEach(item => {
item.merchantNo = item.merchantId ? item.merchantId + '' : item.merchantNo
item.merchantId = item.merchantId ? item.merchantId + '' : item.merchantId
})
this.getSelectingList()
},
......@@ -95,9 +95,9 @@ export default {
return isSelect
},
recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantNo + '')
var exitIds = this.selectedData.map(item => item.merchantId + '')
this.selectingData.forEach(item => {
if (exitIds.includes(item.merchantNo + '')) {
if (exitIds.includes(item.merchantId + '')) {
this.$refs.seletingTable.toggleRowSelection(item, true)
} else {
this.$refs.seletingTable.toggleRowSelection(item, false)
......@@ -119,12 +119,12 @@ export default {
})
},
handleChange(selection, row) {
var addOrDelete = !!selection.find(item => +item.merchantNo === +row.merchantNo)
addOrDelete ? this.selectedData.push(row) : (this.selectedData = this.selectedData.filter(item => item.merchantNo !== row.merchantNo))
var addOrDelete = !!selection.find(item => +item.merchantId === +row.merchantId)
addOrDelete ? this.selectedData.push(row) : (this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId))
},
handleAll(selection) {
this.selectingData.forEach(item => {
let isExit = this.selectedData.findIndex(subItem => +subItem.merchantNo === +item.merchantNo)
let isExit = this.selectedData.findIndex(subItem => +subItem.merchantId === +item.merchantId)
var isServed = item.hasOwnProperty('beServed') ? item.beServed : false
if (selection.length && isExit === -1 && !isServed) {
this.selectedData.push(item)
......@@ -134,7 +134,7 @@ export default {
})
},
handleDelete(row) {
this.selectedData = this.selectedData.filter(item => +item.merchantNo !== +row.merchantNo)
this.selectedData = this.selectedData.filter(item => +item.merchantId !== +row.merchantId)
this.recoverySelection()
},
handleCurrentChange(val) {
......
......@@ -10,6 +10,7 @@
import Vue from 'vue'
import apis from './api'
import { optionalChaining } from './utils/chaining'
import { setMinHeight } from '@/common/constant'
import utils from './utils/index'
import './public-path'
import '@/assets/css/public.scss'
......@@ -23,6 +24,7 @@ Vue.prototype.$$ = optionalChaining
Vue.prototype.$utils = utils
Vue.prototype.size = 'small'
Vue.prototype.$EventBus = new Vue()
Vue.prototype.setMinHeight = setMinHeight
start()
export { bootstrap, mount, unmount } from '@/setup'
export const http = params => Vue.prototype.$http(params)
......
......@@ -71,25 +71,35 @@ function secondConfirm(that, title, txt, apiModule, apiName, apiParams, type = '
type,
callback: action => {
if (action == 'confirm') {
// that.$apis[apiModule][apiName](apiParams).then(res => {
// that.$message({
// message: res.code == '0' ? '操作成功' : res.message,
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// fn && fn()
// that.handleSearch()
// }
// })
that.$apis[apiModule][apiName](apiParams).then(res => {
that.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
that.handleSearch()
}
})
}
}
})
}
function aToExport(url) {
var a = document.createElement('a')
a.setAttribute('id', 'exportToExport')
a.setAttribute('href', url)
a.setAttribute('target', '_blank')
document.body.appendChild(a)
a.click()
}
export default {
debounce,
dateFormat,
checkPhone,
getOptionsList,
secondConfirm
secondConfirm,
aToExport
}
<!-- 订单详情 -->
<template>
<div class="order-detail marketing">
<div class="edit-box">
<div class="container m-b-20">
<p class="edit-title">基础信息</p>
<el-form label-width="100px" :inline="true">
<el-row v-for="(item, index) in detailFormDataRow" :key="index">
<el-form-item v-for="(subItem, subIndex) in item.rowList" :key="subIndex" :label="subItem.label" class="row-item">
<span class="detail-txt ellipsis-1" :title="detailForm[subItem.name]">{{ detailForm[subItem.name] ? detailForm[subItem.name] + (subItem.suffix || '') : '-' }}</span>
</el-form-item>
</el-row>
</el-form>
</div>
<div class="container edit-container">
<p class="edit-title">使用门店</p>
<GLTable ref="warehousListRef" :hasPage="false" :tableParams="tableParams" :tableData="detailForm.merchantList"></GLTable>
</div>
</div>
<GLFooter>
<el-button @click="handleCancel" size="medium">取消</el-button>
</GLFooter>
</div>
</template>
<script>
export default {
name: 'commodityDetail',
data() {
return {
size: 'small',
title: '查看商品',
editChildRef: 'editChildRef',
routeInfo: {
orderCode: ''
},
detailForm: {},
orderRefund: null,
orderGoods: [],
// 订单信息
detailFormDataRow: [],
detailFormData: [
{
label: '商品名称',
name: 'goodsName'
},
{
label: '商品编码',
name: 'type'
},
{
label: '所属系列',
name: 'goodsCode'
},
{
label: '产品类型',
name: 'typeTxt'
},
{
label: '所属系列',
name: 'goodsCode'
},
{
label: '售价/元',
name: 'sellPrice'
},
{
label: '最低售价/元',
name: 'minSellPrice'
},
{
label: '赠送成本/元',
name: 'giftCost'
},
{
label: '产品成本/元',
name: 'productCost'
},
{
label: '库存预警',
name: 'warningValue'
},
{
label: '质保年限',
name: 'warrantyPeriod',
suffix: '年'
}
],
// 门店表格
tableParams: {
tableColumns: [
{
label: '门店名称',
prop: 'merchantName'
},
{
label: '商户号',
prop: 'merchantId'
}
]
},
}
},
created() {
this.formToRow('detailFormData')
},
mounted() {
this.setMinHeight('.edit-box')
this.routeInfo = this.$route.query
this.getInfo()
},
methods: {
formToRow(formName, numOfRow = 3) {
var rowNum = Math.ceil(this[formName].length / numOfRow)
for (var i = 0; i < rowNum; i++) {
for (var j = 0; j < numOfRow; j++) {
if (j == 0) {
this[formName + 'Row'][i] = {
rowList: []
}
}
if (i * numOfRow + j < this[formName].length) {
this[formName + 'Row'][i].rowList.push(this[formName][i * numOfRow + j])
}
}
}
console.log(this.detailFormDataRow, 'detailFormDataRow---')
},
getInfo() {
this.$apis.commodity.getGoodsDetail({ upgradeGoodsId: this.routeInfo.info.upgradeGoodsId }).then(res => {
this.detailForm = res
let list = []
this.detailForm.baseProductFlag == 'Y' ? list.push('基础产品') : ''
this.detailForm.upgradeProductFlag == 'Y' ? list.push('升级产品') : ''
this.detailForm.typeTxt = list.join(',')
})
},
handleCancel() {
this.$router.push({
path: '/commodity/index'
})
}
}
}
</script>
<style>
.marketing.order-detail .el-form--inline .el-form-item {
margin: 0;
}
.marketing.order-detail .el-form--inline .el-form-item__content {
height: 30px;
}
.marketing.order-detail .form-img .el-form--inline .el-form-item__content {
height: auto !important;
}
.marketing.order-detail .flex {
justify-content: flex-start;
}
.marketing.order-detail .row-item {
width: 33%;
}
.detail-txt {
display: inline-block;
width: 220px;
}
.marketing.order-detail .show-table > tbody > tr > td {
text-align: center;
vertical-align: middle;
}
.marketing.order-detail .show-table td {
padding-right: 20px;
}
.order-detail .comment-img {
margin-top: 10px;
margin-right: 20px;
}
</style>
const statusList = [
{
confId: 0,
confValue: '待上架'
},
const typeList = [
{
confId: 1,
confValue: '在售'
confValue: '基础产品'
},
{
confId: 2,
confValue: '部分在售'
},
{
confId: 3,
confValue: '草稿'
confValue: '升级产品'
}
]
export default {
statusList
typeList
}
......@@ -9,7 +9,7 @@ const commodityObj = {
},
{
label: '商品编码',
name: 'goodsType',
name: 'type',
type: 'input',
isClear: true,
maxlength: 50
......@@ -19,102 +19,41 @@ const commodityObj = {
name: 'merchantIdList',
type: 'select',
optionList: [],
optionId: 'categoryType',
optionLabel: 'categoryName',
optionsName: 'productTypeList'
optionId: 'merchantId',
optionLabel: 'merchantName',
optionsName: 'merchantList'
},
{
label: '所属系列',
name: 'goodsSeries',
name: 'goodsCode',
type: 'select',
optionList: [],
optionId: 'categoryType',
optionLabel: 'categoryName',
optionId: 'goodsCode',
optionLabel: 'goodsName',
optionsName: 'goodsSeriesList'
},
{
label: '产品类型',
name: 'status',
name: 'goodsType',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confValue',
optionsName: 'statusList'
optionsName: 'typeList'
}
],
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: {
width: '170'
},
tableColumns: [
{
label: '商品名称',
prop: 'goodsName',
width: '200'
},
{
label: '商品编码',
prop: 'goodsType',
width: '110'
},
{
label: '所属系列',
prop: 'goodsSeries',
width: '100'
},
{
label: '产品类型',
prop: ''
},
{
label: '售价/元',
prop: 'sellPrice'
},
{
label: '最低售价/元',
prop: 'minSellPrice'
},
{
label: '赠送成本',
prop: 'giftCost'
},
{
label: '产品成本',
prop: 'productCost'
},
{
label: '使用门店',
prop: ''
},
{
label: '创建日期',
prop: 'createDateStr',
width: '155px'
}
// {
// label: '更新日期',
// prop: 'updatedDate',
// width: '155px'
// // formatter: cellValue => {
// // return cellValue.updatedDate ? Util.dateFormate(cellValue.updatedDate, 'YYYY-MM-DD HH:mm:ss') : ''
// // }
// }
]
}
]
}
const editCommodityObj = {
editRule: {
goodsName: [{ required: true, message: '请输入商品名称', trigger: 'change' }],
goodsSeries: [{ required: true, message: '请选择所属系列', trigger: 'change' }],
goodsCode: [{ required: true, message: '请选择所属系列', trigger: 'change' }],
sellPrice: [{ required: true, message: '请输入售价', trigger: 'change' }],
minSellPrice: [{ required: true, message: '请输入最低售价', trigger: 'change' }],
giftCost: [{ required: true, message: '请输入赠送成本', trigger: 'change' }],
productCost: [{ required: true, message: '请输入产品成本', trigger: 'change' }],
warningValue: [{ required: true, message: '请输入库存预警', trigger: 'change' }],
merchantList: [{ required: true, message: '请选择门店', trigger: 'change' }]
merchantList: [{ required: true, message: '请选择门店', trigger: 'change' }],
warrantyPeriod: [{ required: true, message: '请输入质保年限', trigger: 'change' }]
},
editFormData: [
{
......@@ -125,21 +64,22 @@ const editCommodityObj = {
},
{
label: '商品编码',
name: 'goodsType',
name: 'type',
type: 'input',
maxlength: 50
},
{
label: '所属系列',
name: 'goodsSeries',
name: 'goodsCode',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionId: 'goodsCode',
optionLabel: 'goodsName',
optionsName: 'goodsSeriesList',
changeAttr: function(val, targetItem, that) {
let labeList = ['产品类型']
that.changeFormAttr('editFormData', 'isHide', labeList, val != '1')
let txt = targetItem.optionList.find(k => k.goodsCode == val)?.goodsName || ''
that.changeFormAttr('editFormData', 'isHide', labeList, txt != '太阳膜')
if (val != '1') {
that.editForm.baseProductFlag = 'N'
that.editForm.upgradeProductFlag = 'Y'
......@@ -183,6 +123,11 @@ const editCommodityObj = {
label: '库存预警',
name: 'warningValue',
type: 'input'
},
{
label: '质保年限',
name: 'warrantyPeriod',
type: 'input'
}
],
......
......@@ -95,20 +95,7 @@ export default {
]
},
baseData: {
goodsSeriesList: [
{
confId: '1',
confName: '太阳膜'
},
{
confId: '2',
confName: '车衣'
},
{
confId: '3',
confName: '改色膜'
}
]
goodsSeriesList: []
}
}
},
......@@ -139,28 +126,40 @@ export default {
// 库存预警
'editForm.warningValue'(newValue, oldValue) {
this.editForm.warningValue = limitPrice(newValue, oldValue, 6, 2)
},
}
},
mounted() {
this.routeInfo = this.$route.query
this.routeInfo.editType != 'add' ? this.getInfo() : ''
this.$utils.getOptionsList(this, 'editFormData', false)
this.getGoodsSeries()
// this.changeFormAttr('editFormData', 'isHide', ['规格明细'], false)
},
methods: {
getInfo() {
// this.$apis.zoneList.getZoneInfoApi({ id: this.routeInfo.id }).then(res => {
// this.$nextTick(() => {
// this.editStatus = false
// })
// })
let params = {
upgradeGoodsId: this.routeInfo.info.upgradeGoodsId
}
console.log(params)
this.$apis.commodity.getGoodsDetail(params).then(res => {
this.editForm = res
this.$nextTick(() => {
this.editStatus = false
})
})
},
// 所属系列改变,清空值
// seriesClear() {
// this.editForm
// },
getGoodsSeries() {
this.$apis.commodity.getGoodsSeries({}).then(res => {
this.baseData.goodsSeriesList = res
this.$utils.getOptionsList(this, 'editFormData', false, 'goodsCode')
})
},
// 产品类型改变
handleCheckChange(val, attr) {
let baseAttrList = ['赠送成本/元']
......@@ -211,30 +210,21 @@ export default {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.$common.utils.deepClone(this.editForm)
console.log(params, 'params----')
// if (this.routeInfo.editType == 'edit') {
// params.id = this.routeInfo.id
// }
// params.merchantList = []
// // 专区类型(1发现频道,2商城专区)
// params.zoneType = '2'
// this.editForm.merchantList.forEach(item => {
// params.merchantList.push({
// merchantId: item.merchantNo,
// merchantName: item.merchantName,
// merchantAccountLevel: item.merchantAccountLevel
// })
// })
// // console.log(params)
// this.$apis.zoneList.insertZoneApi(params).then(res => {
// this.$message({
// message: res.code == '0' ? '操作成功' : '操作失败',
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// this.cancelJump()
// }
// })
params.merchantIdList = []
params.merchantIdList = params.merchantList.map(item => item.merchantId)
delete params.merchantList
if (this.routeInfo.editType == 'edit') {
params.upgradeGoodsId = this.routeInfo.info.upgradeGoodsId
}
this.$apis.commodity.updateGoods(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.cancelJump()
}
})
}
})
},
......
......@@ -3,11 +3,12 @@
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header">
<GLButton type="primary" size="small" @click="handleAdd" fn="新建">新增商品</GLButton>
<GLButton type="primary" size="small" @click="handleEdit('add')" fn="新增">新增商品</GLButton>
<el-button type="primary" size="small" @click="handleExport">导出</el-button>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="commofityRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<GLTable ref="commofityRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
</div>
......@@ -21,6 +22,7 @@
import url from '@/assets/empty.png'
import constData from './constant/data'
import baseList from './constant/baseList'
import * as dayjs from 'dayjs'
export default {
name: 'commodity',
data() {
......@@ -31,15 +33,79 @@ export default {
goodsName: '',
goodsCode: '',
merchantIdList: [],
goodsType: '',
baseProductFlag: 'N',
upgradeProductFlag: 'N'
type: '',
goodsType: ''
},
tableSearchForm: {},
searchFormData: constData.commodityObj.searchFormData,
// 表格
getListApi: this.$apis.commodity.getListApi,
tableParams: constData.commodityObj.tableParams,
// pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: {
width: '170'
},
tableColumns: [
{
label: '商品名称',
prop: 'goodsName',
width: '200'
},
{
label: '商品编码',
prop: 'type',
width: '110'
},
{
label: '所属系列',
prop: 'goodsCode',
width: '100'
},
{
label: '产品类型',
prop: 'baseProductFlag',
formatter: cellValue => {
let list = []
cellValue.baseProductFlag == 'Y' ? list.push('基础产品') : ''
cellValue.upgradeProductFlag == 'Y' ? list.push('升级产品') : ''
return list.join(',')
}
},
{
label: '售价/元',
prop: 'sellPrice'
},
{
label: '最低售价/元',
prop: 'minSellPrice'
},
{
label: '赠送成本',
prop: 'giftCost'
},
{
label: '产品成本',
prop: 'productCost'
},
{
label: '使用门店',
prop: '',
formatter: cellValue => {
return cellValue.merchantList?.map(item => item.merchantName).join(',')
}
},
{
label: '创建日期',
prop: 'createDate',
width: '155px',
formatter: cellValue => {
return cellValue.createdDate ? dayjs(cellValue.createdDate).format('YYYY-MM-DD') : ''
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格按钮
tableButtonList: [
{
......@@ -49,9 +115,6 @@ export default {
type: 'text',
fn: '查看'
},
// condition: row => {
// return row.goodsStatus
// },
listeners: {
click: row => this.handleEdit('detail', row)
}
......@@ -63,9 +126,6 @@ export default {
type: 'text',
fn: '编辑'
},
// condition: row => {
// return !row.goodsStatus
// },
listeners: {
click: row => this.handleEdit('edit', row)
}
......@@ -77,9 +137,6 @@ export default {
type: 'text',
fn: '删除'
},
// condition: row => {
// return !row.goodsStatus
// },
listeners: {
click: row => this.handleDelete(row)
}
......@@ -87,9 +144,10 @@ export default {
],
// 基本数据
baseData: {
productTypeList: [],
merchantList: [],
brandList: [],
statusList: baseList.statusList
typeList: baseList.typeList,
goodsSeriesList: []
},
imgVisible: false,
previewImgUrl: ''
......@@ -97,9 +155,29 @@ export default {
},
mounted() {
this.getGoodsSeries()
this.getMerchantList()
this.$utils.getOptionsList(this, 'searchFormData')
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
switch (params.goodsType) {
case 1:
params.baseProductFlag = 'Y'
break
case 2:
params.upgradeProductFlag = 'Y'
break
}
return params
},
beforeSearchFn() {
return new Promise(async (resolve, reject) => {
this.tableSearchForm = this.getParams()
resolve()
})
},
/**
* @param {Sting} editType add/edit/detail
* @param {Object} info
......@@ -116,15 +194,40 @@ export default {
$title: encodeURI(titleObj[editType])
}
this.$router.push({
path: '/commodity/editCommodity',
path: editType == 'detail' ? '/commodity/commodityDetail' : '/commodity/editCommodity',
query: params
})
},
getGoodsSeries() {
this.$apis.commodity.getGoodsSeries({}).then(res => {
this.baseData.goodsSeriesList = res
this.$utils.getOptionsList(this, 'searchFormData', true, 'goodsCode')
})
},
getMerchantList() {
let params = {
currentPage: 1,
pageSize: 99999
}
this.$apis.commodity.getSimpleMerchantList(params).then(res => {
this.baseData.merchantList = res.list
this.$utils.getOptionsList(this, 'searchFormData', true, 'merchantIdList')
})
},
// 删除
handleDelete(info) {
this.$utils.secondConfirm(this, '删除提示', '删除后不可恢复,是否确定删除?')
console.log(info)
this.$utils.secondConfirm(this, '删除提示', '删除后不可恢复,是否确定删除?', 'commodity', 'deleteGoods', { upgradeGoodsId: info.upgradeGoodsId })
},
// 导出
handleExport() {
let params = this.getParams()
this.$apis.commodity.exportGoods(params).then(res => {
this.$utils.aToExport(res.data)
})
},
handleSearch() {
......@@ -133,10 +236,11 @@ export default {
handleReset() {
this.searchForm = {
commodityCode: '',
baseGoodsName: '',
goodsType: '',
status: ''
goodsName: '',
goodsCode: '',
merchantIdList: [],
type: '',
goodsType: ''
}
this.handleSearch()
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!