commodityDetail.vue
5.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<!-- 订单详情 -->
<template>
<div class="order-detail marketing">
<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>
</div>
<div class="edit-container bgf">
<p class="edit-title">使用门店</p>
<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>
<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: 'goodsCodeName'
},
{
label: '品牌方',
name: 'brandMerchantName'
},
{
label: '供应方',
name: 'supplierName'
},
{
label: '产品类型',
name: 'typeTxt'
},
// {
// label: '所属系列',
// name: 'goodsCode'
// },
{
label: '售价/元',
name: 'sellPrice',
isNum: true
},
{
label: '最低售价/元',
name: 'minSellPrice',
isNum: true
},
{
label: '赠送成本/元',
name: 'giftCost',
isNum: true
},
{
label: '产品成本/元',
name: 'productCost',
isNum: true
},
{
label: '库存下限预警',
name: 'warningValue',
isNum: true
},
{
label: '库存预警上限',
name: 'warningValueMax',
isNum: true
},
{
label: '质保年限',
name: 'warrantyPeriod',
isNum: true
}
],
// 门店表格
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(',')
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) + '年'
}
})
},
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;
}
.edit-title {
height: 56px;
background: #ffffff;
line-height: 56px;
border-bottom: 1px solid #f0f1f7;
padding-left: 20px;
}
.bgf {
background: #ffffff;
}
.context-wrap {
padding: 20px;
}
</style>