Commit 806cc51e by chenwq

bug修复

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