Commit dd73a737 by zhangquan

详情编辑接口

1 parent 283aa717
......@@ -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 {
getGoodsListApi,
updateGoodsStatusApi,
delGoodsApi,
getCarlifeGoodsApi,
addGoodsApi
addGoodsApi,
getGoodsDetail
}
\ No newline at end of file
......@@ -126,7 +126,9 @@ export default {
created(){
this.formObj.id = this.$route.query.id || ''
this.getVideoList()
this.getCaseDetailApi()
if(this.formObj.id){
this.getCaseDetailApi()
}
},
methods:{
openBrandDialog(){
......
......@@ -2,7 +2,7 @@
<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">
<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 slot="goodsInfoSlot" class="goods-wrap">
<glsx-combi-form :isInline="false" ref="goodsInfoRef" labelWidth="154px" defaultWidth="432px" :formObj.sync="formObj" :formData="goodsFormData" :formRules="goodsRule">
......@@ -12,43 +12,43 @@
</glsx-combi-form>
</div>
<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="2">定金+尾款</el-radio>
</el-radio-group>
<div class="money-wrap" v-if="formObj.paymentType == 2">
<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 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">
<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 slot="retainagePriceSlot" slot-scope="scope">
{{ retainagePriceFn(scope.scope.activityPrice) }}
</div>
<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>
</GLTable>
</div>
<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="2">部分</el-radio>
</el-radio-group>
<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-item" v-for="item in vehicleSeriesRequestList" :key="item.vehicleSeriesId">{{ item.vehicleSeriesName }}</div>
</div>
</div>
</div>
<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>
</glsx-combi-form>
<GLFooter>
......@@ -56,7 +56,7 @@
<el-button type="primary" @click="handleSave">确定</el-button>
</GLFooter>
<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>
</div>
</template>
......@@ -77,10 +77,10 @@ export default {
},
data() {
return {
brandId:'',
goodsVisible: false,
carDialogVisible: false,
merchantDialogVisible: false,
disabled: false,
goodsInfo: {},
defaultProps:{
children: 'categoryName',
......@@ -115,11 +115,12 @@ export default {
type: 'showTxt'
},
],
dialogVisible: false,
formObj:{
smartcarlifeInfoId: '',
goodsName: '',
goodsImage: '',
minSellPrice: '',
retailPrice: '',
coverList: [],
paymentType: 1,
depositPrice: '',
......@@ -266,6 +267,13 @@ export default {
},
created(){
// 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:{
retainagePriceFn(price){
......@@ -273,12 +281,9 @@ export default {
if(!price){
return '待计算'
}else{
return price - depositPrice
return Number((price - depositPrice).toFixed(2))
}
},
openBrandDialog(){
this.dialogVisible = !this.dialogVisible
},
openGoodsDialog(){
this.goodsVisible = true
},
......@@ -343,18 +348,20 @@ export default {
delete obj.coverList
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 retainagePrice = activityPrice - price
activityPrice = activityPrice ? Number(Number(activityPrice*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 = {
merchantRequestList,
vehicleSeriesRequestList :this.vehicleSeriesRequestList,
...obj
}
if(this.routeInfo.id) params.id = this.routeInfo.id
return params
},
handleSave(){
......@@ -365,32 +372,46 @@ export default {
this.$apis.goods.addGoodsApi(params).then(res =>{
if(res) {
this.$message.success('新增成功')
this.handleCancel()
}
})
}
})
},
getCategory(){
handleCancel(){
this.$router.back()
},
getDetail(){
const params = {
pageSize: 1000,
pageNum: 1,
categoryType: 1
id: this.routeInfo.id
}
this.$apis.category.getCategoryListApi(params).then(res => {
if(res?.list?.length){
let list = res.list.filter(item => item.categoryLevel == 1).map(item => ({...item, childs: []}))
let level2List = res.list.filter(item => item.categoryLevel == 2)
level2List.forEach(item => {
const target = list.find(row => row.id == item.parentCategoryId)
if(target){
target['childs'].push(item)
this.$apis.goods.getGoodsDetail(params).then(res => {
if(res) {
console.log(res, 12355)
for(const key in this.formObj){
const formatAttr = ['depositPrice', 'minSellPrice', 'retailPrice']
if(formatAttr.includes(key)){
this.formObj[key] = res[key] ? Number(Number(res[key]/100).toFixed(2)) : 0
}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>
......
......@@ -36,7 +36,7 @@ export default {
},
model: {
prop: 'value', // 默认是value
event: 'change', // 默认是input
event: 'changeItem', // 默认是input
},
props: {
// defaultProps: {
......@@ -56,16 +56,30 @@ export default {
default: ()=>{
return []
}
},
curInfo: {
type: Object,
default: ()=>{
return {}
}
}
},
// watch: {
// value:{
// handler(nVal, oVal){
// console.log(nVal)
// },
// deep: true
// }
// },
watch: {
// value:{
// handler(nVal, oVal){
// const arr = this.listTree.flat(Infinity);
// console.log(arr,456)
// },
// deep: true
// },
'curInfo.id':{
handler(nVal, oVal){
this.curBrand = this.curInfo
},
deep: true
},
},
created(){
this.getCategory()
},
......@@ -115,7 +129,7 @@ export default {
if(e.level==2) {
this.curBrand = e.data
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 || {}})
}
}
......
......@@ -130,6 +130,7 @@ export default {
mounted() {
let clientHeight = document.documentElement.clientHeight
this.heightBox = clientHeight - 0.15 * clientHeight - 425
console.log(this.goodsInfo)
this.curInfo = this.goodsInfo || {}
this.getList()
},
......
......@@ -99,21 +99,21 @@ export default {
this.$emit('closeDialog')
},
setTableFinishFun() {
// this.copyList = [...this.selectedGoodsList, ...this[this.curType == 1 ? 'couponList' : 'directChargeList']]
// this.copyList.forEach(row => {
// this.$nextTick(() => {
// let idx = this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].data.findIndex(item => item.id == row.id)
// if (idx > -1) {
// try {
// 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)
// if (id > -1) this.copyList.splice(id, 1)
// } catch (err) {
// console.log(err)
// }
// }
// })
// })
this.copyList = [...this.selectedGoodsList, ...this[this.curType == 1 ? 'couponList' : 'directChargeList']]
this.copyList.forEach(row => {
this.$nextTick(() => {
let idx = this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].data.findIndex(item => item.id == row.id)
if (idx > -1) {
try {
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)
if (id > -1) this.copyList.splice(id, 1)
} catch (err) {
console.log(err)
}
}
})
})
}
}
}
......
<template>
<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">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="operate-wrap">
......@@ -65,7 +65,7 @@
fn: '查看'
},
listeners: {
click: row => this.addContent(row.scope, 1)
click: row => this.handleAdd(row.scope, 1)
}
},
{
......@@ -76,7 +76,7 @@
fn: '编辑'
},
listeners: {
click: row => this.addContent(row.scope, 1)
click: row => this.handleAdd(row.scope, 2)
}
},
{
......@@ -297,10 +297,19 @@
//接收到的数据为空
this.$refs.channelRef.data.length ? (this.$refs.channelRef.tableHeightValues = '') : this.$refs.channelRef.setTableHeightFun()
},
handleAdd(val={}){
this.$router.push({
path: `/goods/add?id=${val.id}&channelType=${val.channelType}&$title=频道设置`
})
handleAdd(row={},type){
const params = {
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!