Commit dd73a737 by zhangquan

详情编辑接口

1 parent 283aa717
...@@ -54,10 +54,22 @@ const addGoodsApi = params => { ...@@ -54,10 +54,22 @@ const addGoodsApi = params => {
} }
const getGoodsDetail = params => {
params.method = 'scrm.api.shopmall.goods.configuration.detail'
return http({
url,
method: 'post',
data: params,
sign: true
})
}
export default { export default {
getGoodsListApi, getGoodsListApi,
updateGoodsStatusApi, updateGoodsStatusApi,
delGoodsApi, delGoodsApi,
getCarlifeGoodsApi, getCarlifeGoodsApi,
addGoodsApi addGoodsApi,
getGoodsDetail
} }
\ No newline at end of file \ No newline at end of file
...@@ -126,7 +126,9 @@ export default { ...@@ -126,7 +126,9 @@ export default {
created(){ created(){
this.formObj.id = this.$route.query.id || '' this.formObj.id = this.$route.query.id || ''
this.getVideoList() this.getVideoList()
this.getCaseDetailApi() if(this.formObj.id){
this.getCaseDetailApi()
}
}, },
methods:{ methods:{
openBrandDialog(){ openBrandDialog(){
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="container"> <div class="container">
<glsx-combi-form :isInline="false" class="glsx-combi-form" ref="baseInfoRef" labelWidth="154px" defaultWidth="432px" :formObj.sync="formObj" :formData="formData" :formRules="myRule"> <glsx-combi-form :isInline="false" class="glsx-combi-form" ref="baseInfoRef" labelWidth="154px" defaultWidth="432px" :formObj.sync="formObj" :formData="formData" :formRules="myRule">
<div slot="selectGoodsSlot"> <div slot="selectGoodsSlot">
<el-button class="el-icon-plus" size="small" @click="openGoodsDialog">{{formObj.smartcarlifeInfoId ? '重新选择': '选择商品'}}</el-button> <el-button v-if="!disabled" class="el-icon-plus" size="small" @click="openGoodsDialog">{{formObj.smartcarlifeInfoId ? '重新选择': '选择商品'}}</el-button>
</div> </div>
<div slot="goodsInfoSlot" class="goods-wrap"> <div slot="goodsInfoSlot" class="goods-wrap">
<glsx-combi-form :isInline="false" ref="goodsInfoRef" labelWidth="154px" defaultWidth="432px" :formObj.sync="formObj" :formData="goodsFormData" :formRules="goodsRule"> <glsx-combi-form :isInline="false" ref="goodsInfoRef" labelWidth="154px" defaultWidth="432px" :formObj.sync="formObj" :formData="goodsFormData" :formRules="goodsRule">
...@@ -12,43 +12,43 @@ ...@@ -12,43 +12,43 @@
</glsx-combi-form> </glsx-combi-form>
</div> </div>
<div slot="paymentSlot"> <div slot="paymentSlot">
<el-radio-group v-model="formObj.paymentType"> <el-radio-group :disabled="disabled" v-model="formObj.paymentType">
<el-radio :label="1">全款</el-radio> <el-radio :label="1">全款</el-radio>
<el-radio :label="2">定金+尾款</el-radio> <el-radio :label="2">定金+尾款</el-radio>
</el-radio-group> </el-radio-group>
<div class="money-wrap" v-if="formObj.paymentType == 2"> <div class="money-wrap" v-if="formObj.paymentType == 2">
<label class="label" for="">定金金额/元:</label> <label class="label" for="">定金金额/元:</label>
<el-input v-model="formObj.depositPrice"></el-input> <el-input :disabled="disabled" v-model="formObj.depositPrice"></el-input>
</div> </div>
</div> </div>
<div slot="saleStoreSlot"> <div slot="saleStoreSlot">
<el-button class="el-icon-plus" size="small" @click="closeDialog">选择门店</el-button> <el-button v-if="!disabled" class="el-icon-plus" size="small" @click="closeDialog">选择门店</el-button>
<GLTable class="selected-table" :hasPage="false" ref="selectedRef" :tableParams="selectedtableParams" :tableData="merchantRequestList"> <GLTable class="selected-table" :hasPage="false" ref="selectedRef" :tableParams="selectedtableParams" :tableData="merchantRequestList">
<div slot="activityPriceSlot" slot-scope="scope"> <div slot="activityPriceSlot" slot-scope="scope">
<el-input placeholder="请输入" v-model="scope.scope.activityPrice" /> <el-input :disabled="disabled" placeholder="请输入" v-model="scope.scope.activityPrice" />
</div> </div>
<div slot="retainagePriceSlot" slot-scope="scope"> <div slot="retainagePriceSlot" slot-scope="scope">
{{ retainagePriceFn(scope.scope.activityPrice) }} {{ retainagePriceFn(scope.scope.activityPrice) }}
</div> </div>
<div slot="auth-button" slot-scope="scope"> <div slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleDel(scope.scope)">删除</el-button> <el-button v-if="!disabled" type="text" @click="handleDel(scope.scope)">删除</el-button>
</div> </div>
</GLTable> </GLTable>
</div> </div>
<div slot="carSeriesSlot"> <div slot="carSeriesSlot">
<el-radio-group v-model="formObj.vehicleSeriesType"> <el-radio-group :disabled="disabled" v-model="formObj.vehicleSeriesType">
<el-radio :label="1">全部</el-radio> <el-radio :label="1">全部</el-radio>
<el-radio :label="2">部分</el-radio> <el-radio :label="2">部分</el-radio>
</el-radio-group> </el-radio-group>
<div v-if="formObj.vehicleSeriesType == 2"> <div v-if="formObj.vehicleSeriesType == 2">
<el-button type="default" class="el-icon-plus" v-if="!isDisabled" @click="handleCarSeriesClose">选择车系</el-button> <el-button type="default" v-if="!disabled" class="el-icon-plus" @click="handleCarSeriesClose">选择车系</el-button>
<div class="car-series-wrap" v-if="vehicleSeriesRequestList && vehicleSeriesRequestList.length"> <div class="car-series-wrap" v-if="vehicleSeriesRequestList && vehicleSeriesRequestList.length">
<div class="car-series-item" v-for="item in vehicleSeriesRequestList" :key="item.vehicleSeriesId">{{ item.vehicleSeriesName }}</div> <div class="car-series-item" v-for="item in vehicleSeriesRequestList" :key="item.vehicleSeriesId">{{ item.vehicleSeriesName }}</div>
</div> </div>
</div> </div>
</div> </div>
<div slot="categorySlot"> <div slot="categorySlot">
<brandCascader :listTree="categoryData" :defaultProps="defaultProps" @clickItem="selectCategory" v-model="brandId" class="category-class"></brandCascader> <brandCascader :listTree="categoryData" :defaultProps="defaultProps" @clickItem="selectCategory" :curInfo="curCategoryInfo" class="category-class"></brandCascader>
</div> </div>
</glsx-combi-form> </glsx-combi-form>
<GLFooter> <GLFooter>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<el-button type="primary" @click="handleSave">确定</el-button> <el-button type="primary" @click="handleSave">确定</el-button>
</GLFooter> </GLFooter>
<selectCarDialog v-if="carDialogVisible" @handleClose="handleCarSeriesClose" @handleConfirm="handleConfirm" :dialogVisible="carDialogVisible"></selectCarDialog> <selectCarDialog v-if="carDialogVisible" @handleClose="handleCarSeriesClose" @handleConfirm="handleConfirm" :dialogVisible="carDialogVisible"></selectCarDialog>
<selectGoods :dialogVisible="goodsVisible" :goodsInfo="goodsInfo" @handleGoodsConfirm="handleGoodsConfirm" @handleGoodsClose="handleGoodsClose"></selectGoods> <selectGoods v-if="goodsVisible" :dialogVisible="goodsVisible" :goodsInfo="formObj" @handleGoodsConfirm="handleGoodsConfirm" @handleGoodsClose="handleGoodsClose"></selectGoods>
<selectMerchantDialog @confirmDialog="confirmDialog" @closeDialog="closeDialog" :selectedGoodsList="{}" v-if="merchantDialogVisible" :isVisible="merchantDialogVisible"></selectMerchantDialog> <selectMerchantDialog @confirmDialog="confirmDialog" @closeDialog="closeDialog" :selectedGoodsList="{}" v-if="merchantDialogVisible" :isVisible="merchantDialogVisible"></selectMerchantDialog>
</div> </div>
</template> </template>
...@@ -77,10 +77,10 @@ export default { ...@@ -77,10 +77,10 @@ export default {
}, },
data() { data() {
return { return {
brandId:'',
goodsVisible: false, goodsVisible: false,
carDialogVisible: false, carDialogVisible: false,
merchantDialogVisible: false, merchantDialogVisible: false,
disabled: false,
goodsInfo: {}, goodsInfo: {},
defaultProps:{ defaultProps:{
children: 'categoryName', children: 'categoryName',
...@@ -115,11 +115,12 @@ export default { ...@@ -115,11 +115,12 @@ export default {
type: 'showTxt' type: 'showTxt'
}, },
], ],
dialogVisible: false,
formObj:{ formObj:{
smartcarlifeInfoId: '', smartcarlifeInfoId: '',
goodsName: '', goodsName: '',
goodsImage: '', goodsImage: '',
minSellPrice: '',
retailPrice: '',
coverList: [], coverList: [],
paymentType: 1, paymentType: 1,
depositPrice: '', depositPrice: '',
...@@ -266,6 +267,13 @@ export default { ...@@ -266,6 +267,13 @@ export default {
}, },
created(){ created(){
// this.getCategory() // this.getCategory()
const urlParam = this.$route.params
this.routeInfo = JSON.parse(decodeURIComponent(urlParam.id))
const { id, type } = this.routeInfo
if(id){
this.disabled = type == 1
this.getDetail()
}
}, },
methods:{ methods:{
retainagePriceFn(price){ retainagePriceFn(price){
...@@ -273,12 +281,9 @@ export default { ...@@ -273,12 +281,9 @@ export default {
if(!price){ if(!price){
return '待计算' return '待计算'
}else{ }else{
return price - depositPrice return Number((price - depositPrice).toFixed(2))
} }
}, },
openBrandDialog(){
this.dialogVisible = !this.dialogVisible
},
openGoodsDialog(){ openGoodsDialog(){
this.goodsVisible = true this.goodsVisible = true
}, },
...@@ -343,18 +348,20 @@ export default { ...@@ -343,18 +348,20 @@ export default {
delete obj.coverList delete obj.coverList
let merchantRequestList = this.merchantRequestList.map(item => { let merchantRequestList = this.merchantRequestList.map(item => {
let { merchantNo: merchantId, merchantName, activityPrice } = item let { merchantNo, merchantId, merchantName, activityPrice } = item
merchantId = merchantNo || merchantId
let price = this.formObj.paymentType==1 ? 0 : this.formObj.depositPrice let price = this.formObj.paymentType==1 ? 0 : this.formObj.depositPrice
let retainagePrice = activityPrice - price let retainagePrice = activityPrice - price
activityPrice = activityPrice ? Number(Number(activityPrice*10*10).toFixed(0)) : 0 activityPrice = activityPrice ? Number(Number(activityPrice*10*10).toFixed(0)) : 0
retainagePrice = retainagePrice ? Number(Number(retainagePrice*10*10).toFixed(0)) : 0 retainagePrice = retainagePrice ? Number(Number(retainagePrice*10*10).toFixed(0)) : 0
return {merchantId, merchantName,activityPrice, retainagePrice} return {merchantId , merchantName,activityPrice, retainagePrice}
}) })
const params = { const params = {
merchantRequestList, merchantRequestList,
vehicleSeriesRequestList :this.vehicleSeriesRequestList, vehicleSeriesRequestList :this.vehicleSeriesRequestList,
...obj ...obj
} }
if(this.routeInfo.id) params.id = this.routeInfo.id
return params return params
}, },
handleSave(){ handleSave(){
...@@ -365,32 +372,46 @@ export default { ...@@ -365,32 +372,46 @@ export default {
this.$apis.goods.addGoodsApi(params).then(res =>{ this.$apis.goods.addGoodsApi(params).then(res =>{
if(res) { if(res) {
this.$message.success('新增成功') this.$message.success('新增成功')
this.handleCancel()
} }
}) })
} }
}) })
}, },
getCategory(){ handleCancel(){
this.$router.back()
},
getDetail(){
const params = { const params = {
pageSize: 1000, id: this.routeInfo.id
pageNum: 1,
categoryType: 1
} }
this.$apis.category.getCategoryListApi(params).then(res => { this.$apis.goods.getGoodsDetail(params).then(res => {
if(res?.list?.length){ if(res) {
let list = res.list.filter(item => item.categoryLevel == 1).map(item => ({...item, childs: []})) console.log(res, 12355)
let level2List = res.list.filter(item => item.categoryLevel == 2) for(const key in this.formObj){
level2List.forEach(item => { const formatAttr = ['depositPrice', 'minSellPrice', 'retailPrice']
const target = list.find(row => row.id == item.parentCategoryId) if(formatAttr.includes(key)){
if(target){ this.formObj[key] = res[key] ? Number(Number(res[key]/100).toFixed(2)) : 0
target['childs'].push(item) }else{
this.formObj[key] = res[key]
} }
}
this.curCategoryInfo = {
categoryName: res.associationClassifySecondName,
id: res.associationClassifySecondId
}
this.formObj.coverList = [res.goodsImage]
this.merchantRequestList = res.merchantList.map(item => {
let activityPrice = item.activityPrice ? Number(Number(item.activityPrice/100).toFixed(2)) : 0
return {...item, activityPrice}
})
this.vehicleSeriesRequestList = res.vehicleSeriesList.map(item => {
const {brandId, brandName, childBrandId,childBrandName , vehicleSeriesId, vehicleSeriesName } = item
return {brandId, brandName, childBrandId,childBrandName , vehicleSeriesId, vehicleSeriesName }
}) })
this.categoryData = list
console.log(this.categoryData)
} }
}) })
}, }
} }
} }
</script> </script>
......
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
}, },
model: { model: {
prop: 'value', // 默认是value prop: 'value', // 默认是value
event: 'change', // 默认是input event: 'changeItem', // 默认是input
}, },
props: { props: {
// defaultProps: { // defaultProps: {
...@@ -56,16 +56,30 @@ export default { ...@@ -56,16 +56,30 @@ export default {
default: ()=>{ default: ()=>{
return [] return []
} }
},
curInfo: {
type: Object,
default: ()=>{
return {}
}
} }
}, },
// watch: { watch: {
// value:{ // value:{
// handler(nVal, oVal){ // handler(nVal, oVal){
// console.log(nVal) // const arr = this.listTree.flat(Infinity);
// }, // console.log(arr,456)
// deep: true // },
// } // deep: true
// }, // },
'curInfo.id':{
handler(nVal, oVal){
this.curBrand = this.curInfo
},
deep: true
},
},
created(){ created(){
this.getCategory() this.getCategory()
}, },
...@@ -115,7 +129,7 @@ export default { ...@@ -115,7 +129,7 @@ export default {
if(e.level==2) { if(e.level==2) {
this.curBrand = e.data this.curBrand = e.data
this.brandTree = !this.brandTree this.brandTree = !this.brandTree
this.$emit('change', this.curBrand.id) this.$emit('changeItem', this.curBrand.id)
this.$emit('clickItem', {data: e.data, parent: e.parent?.data || {}}) this.$emit('clickItem', {data: e.data, parent: e.parent?.data || {}})
} }
} }
......
...@@ -130,6 +130,7 @@ export default { ...@@ -130,6 +130,7 @@ export default {
mounted() { mounted() {
let clientHeight = document.documentElement.clientHeight let clientHeight = document.documentElement.clientHeight
this.heightBox = clientHeight - 0.15 * clientHeight - 425 this.heightBox = clientHeight - 0.15 * clientHeight - 425
console.log(this.goodsInfo)
this.curInfo = this.goodsInfo || {} this.curInfo = this.goodsInfo || {}
this.getList() this.getList()
}, },
......
...@@ -99,21 +99,21 @@ export default { ...@@ -99,21 +99,21 @@ export default {
this.$emit('closeDialog') this.$emit('closeDialog')
}, },
setTableFinishFun() { setTableFinishFun() {
// this.copyList = [...this.selectedGoodsList, ...this[this.curType == 1 ? 'couponList' : 'directChargeList']] this.copyList = [...this.selectedGoodsList, ...this[this.curType == 1 ? 'couponList' : 'directChargeList']]
// this.copyList.forEach(row => { this.copyList.forEach(row => {
// this.$nextTick(() => { this.$nextTick(() => {
// let idx = this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].data.findIndex(item => item.id == row.id) let idx = this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].data.findIndex(item => item.id == row.id)
// if (idx > -1) { if (idx > -1) {
// try { try {
// this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].data[idx], true) this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].data[idx], true)
// let id = this.copyList.findIndex(item => item.id == row.id) let id = this.copyList.findIndex(item => item.id == row.id)
// if (id > -1) this.copyList.splice(id, 1) if (id > -1) this.copyList.splice(id, 1)
// } catch (err) { } catch (err) {
// console.log(err) console.log(err)
// } }
// } }
// }) })
// }) })
} }
} }
} }
......
<template> <template>
<div class="goods-list-cntr"> <div class="goods-list-cntr">
<GLTabs v-model="activeName" :tabPaneList="tabPaneList" @tab-click="handleClick"></GLTabs> <!-- <GLTabs v-model="activeName" :tabPaneList="tabPaneList" @tab-click="handleClick"></GLTabs> -->
<div class="table-wrap"> <div class="table-wrap">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm> <GLCombiForm ref="showSearch" :rowNumber="1" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="operate-wrap"> <div class="operate-wrap">
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
fn: '查看' fn: '查看'
}, },
listeners: { listeners: {
click: row => this.addContent(row.scope, 1) click: row => this.handleAdd(row.scope, 1)
} }
}, },
{ {
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
fn: '编辑' fn: '编辑'
}, },
listeners: { listeners: {
click: row => this.addContent(row.scope, 1) click: row => this.handleAdd(row.scope, 2)
} }
}, },
{ {
...@@ -297,10 +297,19 @@ ...@@ -297,10 +297,19 @@
//接收到的数据为空 //接收到的数据为空
this.$refs.channelRef.data.length ? (this.$refs.channelRef.tableHeightValues = '') : this.$refs.channelRef.setTableHeightFun() this.$refs.channelRef.data.length ? (this.$refs.channelRef.tableHeightValues = '') : this.$refs.channelRef.setTableHeightFun()
}, },
handleAdd(val={}){ handleAdd(row={},type){
this.$router.push({ const params = {
path: `/goods/add?id=${val.id}&channelType=${val.channelType}&$title=频道设置` id: row.id
}) }
let title = '新增商品'
if(type){
params.id = row.id
params.type = type
title = type == 1 ? '新增' : '查看'
}
const queryStr = encodeURIComponent(JSON.stringify(params))
this.$router.push({ path: `/goods/add/`+queryStr,query: { $title: title }})
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!