Commit 806cc51e by chenwq

bug修复

1 parent 54e12ab5
......@@ -4,16 +4,14 @@
<div class="edit-box ">
<div class="m-b-20 bgf">
<p class="edit-title">基础信息</p>
<el-form label-width="120px" :inline="true" class="context-wrap">
<el-row v-for="(item, index) in detailFormDataRow" :key="index">
<span v-for="(subItem, subIndex) in item.rowList" :key="subIndex">
<template v-if="detailForm[subItem.name] != '-'">
<el-form-item :label="subItem.label + ':'" class="row-item">
<span class="detail-txt ellipsis-1" :title="detailForm[subItem.name]">{{ detailForm[subItem.name] ? detailForm[subItem.name] + (subItem.suffix || '') : subItem.isNum ? '0' + (subItem.suffix || '') : '-' }}</span>
</el-form-item>
</template>
</span>
</el-row>
<el-form label-width="120px" :inline="true" class="context-wrap content" v-if="isShow">
<div v-for="(subItem, index) in detailFormData" :key="index" :class="[detailForm[subItem.name] != '-' ? 'w-30' : '']">
<template v-if="detailForm[subItem.name] != '-'">
<el-form-item :label="subItem.label + ':'" class="row-item">
<span class="detail-txt ellipsis-1" :title="detailForm[subItem.name]">{{ detailForm[subItem.name] === null ? '-' : detailForm[subItem.name] ? detailForm[subItem.name] + (subItem.suffix || '') : subItem.isNum ? '0' + (subItem.suffix || '') : '-' }}</span>
</el-form-item>
</template>
</div>
</el-form>
</div>
<div class="edit-container bgf">
......@@ -21,9 +19,6 @@
<GLTable ref="warehousListRef" class="context-wrap" :hasPage="false" :tableParams="tableParams" :tableData="detailForm.merchantList"></GLTable>
</div>
</div>
<!-- <GLFooter>
<el-button @click="handleCancel" size="medium">取消</el-button>
</GLFooter> -->
</div>
</template>
......@@ -35,6 +30,7 @@ export default {
size: 'small',
title: '查看商品',
editChildRef: 'editChildRef',
isShow: false,
routeInfo: {
orderCode: ''
},
......@@ -42,7 +38,6 @@ export default {
orderRefund: null,
orderGoods: [],
// 订单信息
detailFormDataRow: [],
detailFormData: [
{
label: '商品名称',
......@@ -97,10 +92,10 @@ export default {
label: '赠送成本',
name: 'giftCost',
isNum: true,
suffix: '米/车'
suffix: '元/车'
},
{
label: '产品成本/元',
label: '产品成本',
name: 'productCost',
isNum: true,
suffix: '元/件'
......@@ -117,7 +112,7 @@ export default {
suffix: '米'
},
{
label: '库存预警上限',
label: '库存上限预警',
name: 'warningValueMax',
isNum: true,
suffix: '米'
......@@ -139,10 +134,6 @@ export default {
}
},
created() {
this.formToRow('detailFormData')
},
mounted() {
this.setMinHeight('.edit-box')
this.routeInfo = this.$route.query
......@@ -150,26 +141,10 @@ export default {
},
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---')
},
getGoodsPosList() {
this.$apis.commodity.getGoodsPosList({}).then(res => {
this.goodsPosList = res
let obj = this.detailForm.posList.find(item => item.positionValue == this.detailForm.position)
let obj = this.goodsPosList.find(item => item.positionValue == this.detailForm.position)
this.detailForm.posTxt = obj ? obj.positionName : '-'
})
},
......@@ -184,29 +159,38 @@ export default {
},
getInfo() {
this.$apis.commodity.getGoodsDetail({ upgradeGoodsId: this.routeInfo.info.upgradeGoodsId }).then(res => {
this.detailForm = res
this.detailForm = {
...res,
posTxt: ''
}
let list = []
let baseLabelList = ['售价', '最低售价', '产品成本']
let unitLabelList = ['库存下限预警', '库存上限预警']
this.detailForm.baseProductFlag == 'Y' ? list.push('基础产品') : ''
this.detailForm.upgradeProductFlag == 'Y' ? list.push('升级产品') : ''
this.detailForm.typeTxt = list.join(',')
console.log(this.detailForm, '000')
this.changeFormAttr('detailFormDataRow', 'suffix', baseLabelList, this.detailForm.goodsTypeName == '自建商品-精品' ? '元/件' : '元/车')
this.changeFormAttr('editFdetailFormDataRowormData', 'suffix', unitLabelList, this.detailForm.goodsTypeName == '自建商品-精品' ? '件' : '米')
this.changeFormAttr('detailFormData', 'suffix', baseLabelList, this.detailForm.goodsTypeName == '自建商品-精品' ? '元/件' : '元/车')
this.changeFormAttr('detailFormData', 'suffix', unitLabelList, this.detailForm.goodsTypeName == '自建商品-精品' ? '件' : '米')
this.detailForm.convertedValueTxt = this.detailForm.convertedValue ? '1卷=' + this.detailForm.convertedValue + '米' : '-'
this.getGoodsPosList()
if (list.length != 2 && this.detailForm.baseProductFlag == 'Y') {
this.detailForm.sellPrice = '-'
this.detailForm.minSellPrice = '-'
this.detailForm.productCost = '-'
}
// if (this.detailForm.goodsCodeName != '太阳膜') {
// this.detailForm.warrantyPeriod = '-'
// this.detailForm.giftCost = '-'
// } else {
this.detailForm.warrantyPeriod = (this.detailForm.warrantyPeriod || 0) + '年'
// }
this.getGoodsPosList()
if (list.length != 2 && this.detailForm.upgradeProductFlag == 'Y') {
this.detailForm.giftCost = '-'
}
if (this.detailForm.goodsTypeName != '自建商品-太阳膜') {
this.detailForm.warrantyPeriod = '-'
this.detailForm.giftCost = '-'
this.detailForm.deductionStandard = '-'
this.detailForm.typeTxt = '-'
} else {
this.detailForm.warrantyPeriod = (this.detailForm.warrantyPeriod || 0) + '年'
}
// console.log(this.detailForm, '000')
this.isShow = true
})
},
handleCancel() {
......@@ -230,9 +214,17 @@ export default {
.marketing.order-detail .flex {
justify-content: flex-start;
}
.marketing.order-detail .row-item {
.order-detail .content {
display: flex;
flex-wrap: wrap;
}
.order-detail .w-30 {
width: 33%;
}
.marketing.order-detail .row-item {
display: inline-block;
/* width: 33%; */
}
.detail-txt {
display: inline-block;
width: 220px;
......
......@@ -183,6 +183,10 @@ export default {
this.handleCheckChange(res.upgradeProductFlag, 'upgradeProductFlag')
}
let baseLabelList = ['售价', '最低售价', '产品成本']
let unitLabelList = ['库存下限预警', '库存上限预警']
this.changeFormAttr('editFormData', 'append', baseLabelList, res.goodsTypeName == '自建商品-精品' ? '元/件' : '元/车')
this.changeFormAttr('editFormData', 'append', unitLabelList, res.goodsTypeName == '自建商品-精品' ? '件' : '米')
this.editForm = res
this.$nextTick(() => {
this.editStatus = false
......@@ -294,6 +298,23 @@ export default {
if (this.routeInfo.editType == 'edit') {
params.upgradeGoodsId = this.routeInfo.info.upgradeGoodsId
}
if (params.goodsTypeName != '自建商品-太阳膜') {
params.baseProductFlag = 'N'
params.upgradeProductFlag = 'N'
params.position = ''
params.deductionStandard = ''
params.giftCost = ''
params.warrantyPeriod = ''
} else if (params.upgradeProductFlag == 'N') {
params.sellPrice = ''
params.minSellPrice = ''
params.productCost = ''
} else if (params.baseProductFlag == 'N') {
params.giftCost = ''
}
if (params.goodsTypeName == '自建商品-精品') {
params.convertedValue = ''
}
console.log(params, '00000')
this.$apis.commodity.updateGoods(params).then(res => {
this.$message({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!