detail.vue
7.17 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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!-- 采购上架详情 -->
<template>
<div class="purchase-grounding-detail purchase-grounding edit-box">
<div class="container edit-container">
<p class="edit-title">基础信息</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :pageThat="this" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="sourceStrSpan">{{ editForm['goodsSourceStr'] }}</div>
<div slot="groundingGoodsInfo">
<div class="goodsInfo-box">
<div class="item" v-for="(subItem, subIndex) in goodsDetailForm" :key="subIndex">
<div v-if="subItem.addHtml" class="item_box">
<div class="label">{{ (membraneTypeList.includes(editForm.groundingGoodsInfo['goodsType']) ? subItem.label + `(元)/卷` : (subItem.label + '(元)/件')) }}:</div>
<div class="value">{{ priceFilter(editForm.groundingGoodsInfo[subItem.value]) }}</div>
</div>
<div v-else class="item_box">
<div class="label">{{ subItem.label + ':' }}</div>
<div class="value">{{ editForm.groundingGoodsInfo[subItem.value] || '-' }}</div>
</div>
</div>
</div>
</div>
<div slot="purchasePriceSpan">{{ priceFilter(editForm['shopPurchasePrice']) }}</div>
</glsx-combi-form>
</div>
<div class="container edit-container">
<p class="edit-title">上架门店</p>
<glsx-combi-form class="edit-form-container" ref="editFormMerchantRef" :isEdit="isEdit" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="merchantEditFormData" :formRules="editRule">
<div slot="merchantTable" :style="{ width: `calc(100% - ${defaultLabelWidth} )` }">
<div class="table-title">
上架门店列表
</div>
<GLTable ref="warehousListRef" :hasPage="false" :tableParams="tableParams" :tableData="editForm.merchantList"></GLTable>
</div>
</glsx-combi-form>
</div>
<GLFooter>
<el-button type="primary" @click="cancelJump" size="medium" :loading="loading">返回</el-button>
</GLFooter>
</div>
</template>
<script>
import { goodsSourceOptions, membraneTypeList } from '@/utils/constants.js'
export default {
name: 'purchaseGroundingDetail',
data() {
return {
editChildRef: 'editChildRef',
routeInfo: {},
editForm: {
goodsSourceStr: '',
groundingGoodsInfo: {},
shopPurchasePrice: '',
merchantList: []
},
isEdit: true,
editRule: {
goodsSourceStr: [{ required: true, message: '请选择商品来源', trigger: 'change' }],
upgradeGoodsId: [{ required: true, message: '请选择上架商品', trigger: 'change' }],
shopPurchasePrice: [
{ required: true, message: '请输入门店采购价', trigger: 'blur' }
]
},
editFormData: [
{
label: '商品来源',
name: 'goodsSourceStr',
addHtml: 'sourceStrSpan'
},
{
label: '上架商品',
name: 'upgradeGoodsId',
addHtml: 'groundingGoodsInfo'
},
{
label: '门店采购价(元)/件',
name: 'shopPurchasePrice',
addHtml: 'purchasePriceSpan'
}
],
merchantEditFormData: [
{
addHtml: 'merchantTable'
}
],
// 门店表格
tableParams: {
tableColumns: [
{
label: '门店名称',
prop: 'merchantName'
},
{
label: '商户号',
prop: 'merchantId'
}
]
},
goodsDetailForm: [
{
label: '商品名称',
value: 'upgradeGoodsName',
},
{
label: '商品编码',
value: 'type'
},
{
label: '嘀加采购价',
addHtml: 'DJPurchasePrice',
value: 'purchasePrice'
},
{
label: '所属分类',
value: 'goodsTypeName'
},
{
label: '所属系列',
value: 'goodsName'
}
],
membraneTypeList // 膜类code集合
}
},
mounted() {
this.keyDown()
this.routeInfo = this.$route.query
this.getInfo()
},
methods: {
keyDown() {
document.onkeydown = function() {
var evt = window.event || arguments[0]
if (evt && evt.keyCode == 13) {
if (typeof evt.cancelBubble != 'undefined') evt.cancelBubble = true
if (typeof evt.stopPropagation == 'function') evt.stopPropagation()
return false
}
return true
}
},
priceFilter(num) {
var pow = Math.pow(10, 2)
if ((num ?? '') === '') return '-'
return (Math.round(num * pow) / pow).toFixed(2)
},
getInfo() {
let params = {
id: this.routeInfo?.id
}
this.$apis.grounding.getPurchaseGroundingDetail(params).then(res => {
res.goodsSourceStr = !((res.goodsSource ?? '') === '') ? goodsSourceOptions[res.goodsSource - 0]?.label : '-'
let index = this.editFormData.findIndex(val => val.name == 'shopPurchasePrice')
if (this.membraneTypeList?.includes(res?.goodsInfo?.goodsType)) { // 膜类商品 单位是卷
if(index > -1) this.editFormData[index].label = '门店采购价(元)/卷'
}
if (res?.goodsSource == 1) { // 自营
let index = this.goodsDetailForm.findIndex(val => val.value == 'purchasePrice')
if (index > -1) {
this.goodsDetailForm.splice(index, 1)
}
}
res.groundingGoodsInfo = {
...res.goodsInfo,
...res.upgradeGoods
}
this.editForm = res
})
},
cancelJump() {
this.$router.push({
path: '/purchaseGrounding/index'
})
}
}
}
</script>
<style scoped lang="scss">
.purchase-grounding{
.container{
padding: 0 0 20px;
background: #fff;
.edit-title {
font-size: 16px;
font-weight: 600;
height: 58px;
line-height: 58px;
border-bottom: 1px solid #e7eaec;
margin: 0 0;
padding: 0 0 0 20px;
}
.goodsInfo-box{
background: #F9F9F9;
display: flex;
flex-wrap: wrap;
padding: 15px 0;
.item{
flex: 0 0 33%;
.item_box{
display: flex;
align-items: start;
.label{
flex-shrink: 0;
color: #666666;
width: 150px;
text-align: right;
}
}
}
}
}
.edit-container{
margin-bottom: 16px;
}
.edit-form-container {
margin:20px 20px 0 0;
.table-title {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
}
}
.m-r-20 {
/deep/.glsx-combi-form-block{
color: #666666;
&:nth-child(1){
.el-form-item__content{
width: calc(100% - 154px);
}
}
}
}
}
.purchase-grounding.purchase-grounding-detail .select-merchant {
/* width: calc(98% - 140px); */
width: 98%;
}
.merchant-table {
margin: 0 20px;
}
</style>