Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-app-operator-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-app-operator-master
Commits
7125e0a9
Commit
7125e0a9
authored
Jun 10, 2023
by
邓春圆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品的阶梯价格,以及阶梯组件修改
parent
2ee96827
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
616 additions
and
27 deletions
+616
-27
packaging-type.vue
src/views/ecw/channel/componrnts/packaging-type.vue
+12
-9
edit.vue
src/views/ecw/channel/edit.vue
+7
-2
index.vue
src/views/ecw/product/index.vue
+82
-16
product-dialog.vue
src/views/ecw/product/product-dialog.vue
+515
-0
No files found.
src/views/ecw/channel/componrnts/packaging-type.vue
View file @
7125e0a9
<
template
>
<
template
>
<div>
<div>
<el-row
type=
"flex"
align=
"align"
:gutter=
"10"
>
<el-row
type=
"flex"
align=
"align"
:gutter=
"10"
>
<el-col
:span=
"
3
"
>
空运订单重量上限(kg)
</el-col>
<el-col
:span=
"
6
"
>
空运订单重量上限(kg)
</el-col>
<el-col
:span=
"6"
><el-input
v-model=
"value1.airWeightLimit"
></el-input></el-col>
<el-col
:span=
"6"
><el-input
v-model=
"value1.airWeightLimit"
></el-input></el-col>
<el-col
:span=
"6"
>
<el-col
:span=
"6"
>
<slot></slot>
<slot></slot>
</el-col>
</el-col>
</el-row>
</el-row>
<h1>
空运清关费
</h1>
<h1>
空运清关费
</h1>
<div
v-for=
"(item ,index) in value1
.channelPriceStepClearanceList
"
>
<div
v-for=
"(item ,index) in value1
[keyArr]
"
>
<el-row
:gutter=
"10"
>
<el-row
:gutter=
"10"
>
<el-col
:span=
"4"
>
<el-col
:span=
"4"
>
第
{{
index
+
1
}}
阶梯定价方案:
第
{{
index
+
1
}}
阶梯定价方案:
...
@@ -58,7 +58,11 @@ export default {
...
@@ -58,7 +58,11 @@ export default {
props
:{
props
:{
value
:{
value
:{
type
:
Object
,
type
:
Object
,
default
:()
=>
({
channelPriceStepClearanceList
:[]})
default
:()
=>
({})
},
keyArr
:{
type
:
String
,
default
:
'
channelPriceStepClearanceList
'
}
}
},
},
name
:
"
packaging-type
"
,
name
:
"
packaging-type
"
,
...
@@ -74,16 +78,14 @@ export default {
...
@@ -74,16 +78,14 @@ export default {
value1
:{
value1
:{
airWeightLimit
:
undefined
,
airWeightLimit
:
undefined
,
packagingTypes
:
undefined
,
packagingTypes
:
undefined
,
channelPriceStepClearanceList
:[],
},
},
}
}
},
},
mounted
()
{
mounted
()
{
this
.
value1
=
this
.
value
this
.
value1
=
this
.
value
console
.
log
(
this
.
value1
,
'
value1
'
)
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
if
(
this
.
value1
.
channelPriceStepClearanceList
.
length
===
0
){
if
(
this
.
value1
[
this
.
keyArr
]
&&
this
.
value1
[
this
.
keyArr
]
.
length
===
0
){
this
.
addInterval
()
this
.
addInterval
()
}
}
})
})
...
@@ -100,11 +102,12 @@ export default {
...
@@ -100,11 +102,12 @@ export default {
"
startNum
"
:
''
,
"
startNum
"
:
''
,
"
weightUnit
"
:
''
"
weightUnit
"
:
''
}
}
this
.
value1
.
channelPriceStepClearanceList
.
push
(
p
)
this
.
value1
[
this
.
keyArr
]
.
push
(
p
)
this
.
$forceUpdate
();
},
},
deleteFn
(
index
){
deleteFn
(
index
){
this
.
value1
.
channelPriceStepClearanceList
.
splice
(
index
,
1
)
this
.
value1
[
this
.
keyArr
].
splice
(
index
,
1
)
this
.
$forceUpdate
();
}
}
},
},
watch
:{
watch
:{
...
...
src/views/ecw/channel/edit.vue
View file @
7125e0a9
...
@@ -225,6 +225,9 @@ export default {
...
@@ -225,6 +225,9 @@ export default {
if
(
this
.
$route
.
query
.
id
)
{
if
(
this
.
$route
.
query
.
id
)
{
getChannel
(
this
.
$route
.
query
.
id
).
then
((
res
)
=>
{
getChannel
(
this
.
$route
.
query
.
id
).
then
((
res
)
=>
{
this
.
$set
(
this
,
'
form
'
,
{...
res
.
data
})
this
.
$set
(
this
,
'
form
'
,
{...
res
.
data
})
if
(
!
this
.
form
.
channelPackagingList
!==
null
){
this
.
form
.
channelPackagingList
=
[];
}
this
.
form
.
attrId
=
this
.
form
.
attrId
.
split
(
'
,
'
).
map
(
i
=>
+
i
)
this
.
form
.
attrId
=
this
.
form
.
attrId
.
split
(
'
,
'
).
map
(
i
=>
+
i
)
this
.
form
.
channelPackagingList
.
forEach
(
item
=>
{
this
.
form
.
channelPackagingList
.
forEach
(
item
=>
{
item
.
packagingTypes
=
item
.
packagingTypes
.
split
(
'
,
'
)
||
[]
item
.
packagingTypes
=
item
.
packagingTypes
.
split
(
'
,
'
)
||
[]
...
@@ -268,14 +271,16 @@ export default {
...
@@ -268,14 +271,16 @@ export default {
this
.
form
.
channelPackagingList
[
index
]
=
{
airWeightLimit
:
undefined
,
packagingTypes
:[],
channelPriceStepClearanceList
:[],}
this
.
form
.
channelPackagingList
[
index
]
=
{
airWeightLimit
:
undefined
,
packagingTypes
:[],
channelPriceStepClearanceList
:[],}
}
}
item
.
channelPriceStepClearanceList
.
forEach
((
itemm
,
indexx
)
=>
{
item
.
channelPriceStepClearanceList
.
forEach
((
itemm
,
indexx
)
=>
{
let
p
=
{
"
channelId
"
:
''
,
let
p
=
{
"
channelId
"
:
''
,
"
clearancePrice
"
:
''
,
"
clearancePrice
"
:
''
,
"
clearancePriceUnit
"
:
''
,
"
clearancePriceUnit
"
:
''
,
"
clearanceVolumeUnit
"
:
''
,
"
clearanceVolumeUnit
"
:
''
,
"
endNum
"
:
''
,
"
endNum
"
:
''
,
"
packagingId
"
:
''
,
"
packagingId
"
:
''
,
"
startNum
"
:
''
,
"
startNum
"
:
''
,
"
weightUnit
"
:
''
}
"
weightUnit
"
:
''
}
if
(
!
this
.
form
.
channelPackagingList
[
index
].
channelPriceStepClearanceList
[
indexx
]){
if
(
!
this
.
form
.
channelPackagingList
[
index
].
channelPriceStepClearanceList
[
indexx
]){
this
.
form
.
channelPackagingList
[
index
].
channelPriceStepClearanceList
[
indexx
]
=
p
;
this
.
form
.
channelPackagingList
[
index
].
channelPriceStepClearanceList
[
indexx
]
=
p
;
}
}
...
...
src/views/ecw/product/index.vue
View file @
7125e0a9
...
@@ -130,8 +130,8 @@
...
@@ -130,8 +130,8 @@
<pagination
v-show=
"total > 0"
:total=
"total"
:page.sync=
"queryParams.pageNo"
:limit.sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
<pagination
v-show=
"total > 0"
:total=
"total"
:page.sync=
"queryParams.pageNo"
:limit.sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
<!-- 对话框(添加 / 修改) -->
<!-- 对话框(添加 / 修改) -->
<el-dialog
:title=
"title"
:visible.sync=
"open"
width=
"
5
50px"
append-to-body
>
<el-dialog
:title=
"title"
:visible.sync=
"open"
width=
"
8
50px"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"110px"
>
<el-form
v-if=
"open"
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"110px"
>
<el-form-item
:label=
"$t('商品类型')"
prop=
"typeId"
>
<el-form-item
:label=
"$t('商品类型')"
prop=
"typeId"
>
<el-select
v-model=
"form.typeId"
:placeholder=
"$t('选择商品类型')"
clearable
>
<el-select
v-model=
"form.typeId"
:placeholder=
"$t('选择商品类型')"
clearable
>
<el-option
v-for=
"types in typeList"
:key=
"types.id"
:label=
"types.titleZh"
:value=
"types.id"
/>
<el-option
v-for=
"types in typeList"
:key=
"types.id"
:label=
"types.titleZh"
:value=
"types.id"
/>
...
@@ -148,15 +148,6 @@
...
@@ -148,15 +148,6 @@
<el-form-item
:label=
"$t('商品图片')"
prop=
"img"
>
<el-form-item
:label=
"$t('商品图片')"
prop=
"img"
>
<image-upload
v-model=
"form.imgs"
/>
<image-upload
v-model=
"form.imgs"
/>
<!-- <el-col :span="8">
<el-input v-model="form.imgs" :placeholder="$t('请上传图片')" disabled />
</el-col> -->
<!-- <el-upload action="#" :http-request="requestUpload" :show-file-list="false" :before-upload="beforeUpload">
<el-button size="small">{{ $t('上传图片') }}<i class="el-icon-upload el-icon--right"></i>
</el-button>
</el-upload> -->
</el-form-item>
</el-form-item>
<el-form-item
prop=
"auditStatus"
:label=
"$t('是否审核')"
>
<el-form-item
prop=
"auditStatus"
:label=
"$t('是否审核')"
>
...
@@ -224,9 +215,6 @@
...
@@ -224,9 +215,6 @@
</el-input>
</el-input>
</el-form-item>
</el-form-item>
<el-form-item
:label=
"$t('可参与优惠')"
>
<el-form-item
:label=
"$t('可参与优惠')"
>
<!-- <el-select multiple v-model="form.couponlds" size="5" style="min-width: 300px; border:1px solid #DCDFE6; border-radius:4px">-->
<!-- <el-option v-for="item in preferentialList" :value="item.couponId" :label="item.titleZh" :key="item.couponId" :disabled="item.mandatory">{{item.titleZh}}</el-option>-->
<!-- </el-select>-->
<div
style=
"width: 300px;height: 400px;border: 1px solid;overflow-y: auto"
>
<div
style=
"width: 300px;height: 400px;border: 1px solid;overflow-y: auto"
>
<div
@
click=
"selectMoveAbout(item)"
style=
"display: flex;justify-content: space-between; align-items: center;"
:style=
"{'cursor':item.mandatory ? 'no-drop' : 'pointer' }"
v-for=
"item in preferentialList"
:key=
"item.couponId"
>
<div
@
click=
"selectMoveAbout(item)"
style=
"display: flex;justify-content: space-between; align-items: center;"
:style=
"{'cursor':item.mandatory ? 'no-drop' : 'pointer' }"
v-for=
"item in preferentialList"
:key=
"item.couponId"
>
<div>
<div>
...
@@ -236,12 +224,26 @@
...
@@ -236,12 +224,26 @@
</div>
</div>
</div>
</div>
</el-form-item>
</el-form-item>
<packaging-type
key-arr=
"priceStepClearanceList"
v-model=
"form"
>
<el-button
@
click=
"visible = true; open = false;"
type=
"text"
>
选择空运模板
</el-button>
</packaging-type>
<p
v-if=
"lineNum"
>
<span>
复制模板线路价格:{{lineNum}}个
</span>
<span
style=
"color: #0a84ff;cursor: pointer;"
>
查看《#选择空运商品模板名称#》路线价格
</span>
</p>
</el-form>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
{{$t('确定')}}
</el-button>
<el-button
type=
"primary"
@
click=
"submitForm"
>
{{$t('确定')}}
</el-button>
<el-button
@
click=
"cancel"
>
{{$t('取消')}}
</el-button>
<el-button
@
click=
"cancel"
>
{{$t('取消')}}
</el-button>
</div>
</div>
</el-dialog>
</el-dialog>
<el-dialog
:visible.sync=
"visible"
>
<product-dialog
@
copyLine=
"copyLine"
></product-dialog>
</el-dialog>
</div>
</div>
</template>
</template>
...
@@ -261,14 +263,19 @@ import {DICT_TYPE, getDictDatas} from '@/utils/dict';
...
@@ -261,14 +263,19 @@ import {DICT_TYPE, getDictDatas} from '@/utils/dict';
import
{
AuditStatusEnum
,
CommonStatusEnum
}
from
'
@/utils/constants
'
;
import
{
AuditStatusEnum
,
CommonStatusEnum
}
from
'
@/utils/constants
'
;
import
{
uploadFile
}
from
"
@/api/infra/file
"
;
import
{
uploadFile
}
from
"
@/api/infra/file
"
;
import
ImageUpload
from
'
@/components/ImageUpload
'
import
ImageUpload
from
'
@/components/ImageUpload
'
import
PackagingType
from
"
@/views/ecw/channel/componrnts/packaging-type.vue
"
;
import
ProductDialog
from
"
@/views/ecw/product/product-dialog.vue
"
;
export
default
{
export
default
{
name
:
"
EcwProductIndex
"
,
name
:
"
EcwProductIndex
"
,
components
:
{
components
:
{
ProductDialog
,
PackagingType
,
ImageUpload
ImageUpload
},
},
data
()
{
data
()
{
return
{
return
{
visible
:
false
,
// 选中数组
// 选中数组
ids
:
[],
ids
:
[],
// 非单个禁用
// 非单个禁用
...
@@ -313,7 +320,9 @@ export default {
...
@@ -313,7 +320,9 @@ export default {
status
:
null
,
status
:
null
,
},
},
// 表单参数
// 表单参数
form
:
{},
form
:
{
},
// 表单校验
// 表单校验
rules
:
{
rules
:
{
typeId
:
[{
required
:
true
,
message
:
this
.
$t
(
"
商品类型不能为空
"
),
trigger
:
"
change
"
}],
typeId
:
[{
required
:
true
,
message
:
this
.
$t
(
"
商品类型不能为空
"
),
trigger
:
"
change
"
}],
...
@@ -335,7 +344,8 @@ export default {
...
@@ -335,7 +344,8 @@ export default {
packagingList
:
getDictDatas
(
DICT_TYPE
.
ECW_PACKAGING_TYPE
),
packagingList
:
getDictDatas
(
DICT_TYPE
.
ECW_PACKAGING_TYPE
),
locationList
:
getDictDatas
(
DICT_TYPE
.
ECW_CONTAINER_LOCATION
),
locationList
:
getDictDatas
(
DICT_TYPE
.
ECW_CONTAINER_LOCATION
),
preferentialList
:[],
preferentialList
:[],
exceptionProductId
:
0
//新增商品异常传的id
exceptionProductId
:
0
,
//新增商品异常传的id
lineNum
:
0
};
};
},
},
...
@@ -403,6 +413,51 @@ export default {
...
@@ -403,6 +413,51 @@ export default {
},
},
methods
:
{
methods
:
{
copyLine
(
val
,
bol
){
let
copy
=
()
=>
{
this
.
form
.
airWeightLimit
=
val
.
airWeightLimit
;
val
.
priceStepClearanceList
.
forEach
((
item
,
index
)
=>
{
if
(
this
.
form
.
priceStepClearanceList
[
index
]){
this
.
form
.
priceStepClearanceList
[
index
].
clearancePrice
=
item
.
clearancePrice
this
.
form
.
priceStepClearanceList
[
index
].
clearancePriceUnit
=
item
.
clearancePriceUnit
this
.
form
.
priceStepClearanceList
[
index
].
clearanceVolumeUnit
=
item
.
clearanceVolumeUnit
}
else
{
let
p
=
{
"
channelId
"
:
''
,
"
clearancePrice
"
:
item
.
clearancePrice
,
"
clearancePriceUnit
"
:
item
.
clearancePriceUnit
,
"
clearanceVolumeUnit
"
:
item
.
clearanceVolumeUnit
,
"
endNum
"
:
''
,
"
packagingId
"
:
''
,
"
startNum
"
:
''
,
"
weightUnit
"
:
''
}
this
.
form
.
priceStepClearanceList
.
push
(
p
)
}
})
}
this
.
visible
=
false
;
if
(
bol
){
this
.
$confirm
(
`请确认是否要将#
${
this
.
$l
(
val
,
'
title
'
)}
#的所有路线价格复制到当前商品#
${
this
.
$l
(
this
.
form
,
'
title
'
)}
#中?`
,
'
提示
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
}).
then
(()
=>
{
this
.
form
.
priceLineCount
=
val
.
id
;
this
.
lineNum
=
val
.
priceStepClearanceCount
;
this
.
form
.
priceLineCount
=
val
.
id
;
this
.
isCopyProductPriceTemplate
=
true
;
copy
()
this
.
open
=
true
;
}).
catch
(()
=>
{
this
.
open
=
true
;
});
}
else
{
this
.
open
=
true
;
copy
()
}
this
.
$forceUpdate
()
},
/** 获取产品属性列表 */
/** 获取产品属性列表 */
getAttrList
()
{
getAttrList
()
{
getProductAttrList
().
then
(
response
=>
{
getProductAttrList
().
then
(
response
=>
{
...
@@ -477,7 +532,12 @@ export default {
...
@@ -477,7 +532,12 @@ export default {
requirements
:
0
,
requirements
:
0
,
needBook
:
0
,
needBook
:
0
,
couponIds
:[],
couponIds
:[],
airWeightLimit
:
undefined
,
priceStepClearanceList
:[],
isCopyProductPriceTemplate
:
false
,
productTemplateId
:
undefined
,
};
};
this
.
lineNum
=
0
this
.
resetForm
(
"
form
"
);
this
.
resetForm
(
"
form
"
);
},
},
/** 搜索按钮操作 */
/** 搜索按钮操作 */
...
@@ -511,6 +571,7 @@ export default {
...
@@ -511,6 +571,7 @@ export default {
const
id
=
row
.
id
;
const
id
=
row
.
id
;
getProduct
(
id
).
then
(
response
=>
{
getProduct
(
id
).
then
(
response
=>
{
this
.
form
=
{...
response
.
data
,
couponIds
:[]};
this
.
form
=
{...
response
.
data
,
couponIds
:[]};
this
.
form
.
channelPriceStepClearanceList
=
this
.
form
.
priceStepClearanceList
;
let
attrArray
=
this
.
form
.
attrId
?
this
.
form
.
attrId
.
split
(
'
,
'
):[];
let
attrArray
=
this
.
form
.
attrId
?
this
.
form
.
attrId
.
split
(
'
,
'
):[];
for
(
let
index
in
attrArray
)
{
for
(
let
index
in
attrArray
)
{
let
value
=
attrArray
[
index
];
let
value
=
attrArray
[
index
];
...
@@ -540,9 +601,14 @@ export default {
...
@@ -540,9 +601,14 @@ export default {
this
.
form
.
attrId
=
this
.
form
.
attrArray
.
join
(
'
,
'
);
this
.
form
.
attrId
=
this
.
form
.
attrArray
.
join
(
'
,
'
);
// 修改的提交
// 修改的提交
if
(
this
.
form
.
id
!=
null
)
{
if
(
this
.
form
.
id
!=
null
)
{
this
.
form
.
priceStepClearanceList
.
forEach
(
i
=>
{
i
.
productId
=
this
.
form
.
id
})
if
(
this
.
exceptionProductId
){
if
(
this
.
exceptionProductId
){
this
.
form
.
productId
=
this
.
exceptionProductId
this
.
form
.
productId
=
this
.
exceptionProductId
this
.
form
.
status
=
0
this
.
form
.
status
=
0
}
else
{
this
.
form
.
productId
=
this
.
form
.
id
}
}
updateProduct
(
this
.
form
).
then
(
response
=>
{
updateProduct
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
this
.
$t
(
"
修改成功
"
));
this
.
$modal
.
msgSuccess
(
this
.
$t
(
"
修改成功
"
));
...
...
src/views/ecw/product/product-dialog.vue
0 → 100644
View file @
7125e0a9
<
template
>
<div
class=
"app-container"
>
<!-- 搜索工作栏 -->
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
:label=
"$t('商品编码')"
prop=
"productCode"
>
<el-input
v-model=
"queryParams.productCode"
:placeholder=
"$t('请输入商品编码')"
clearable
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item
:label=
"$t('海关编码')"
prop=
"customsCode"
>
<el-input
v-model=
"queryParams.customsCode"
:placeholder=
"$t('请输入海关编码')"
clearable
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item
:label=
"$t('商品名称')"
prop=
"titleZh"
>
<el-input
v-model=
"queryParams.titleZh"
:placeholder=
"$t('请输入商品名称')"
clearable
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item
:label=
"$t('商品类型')"
prop=
"attrId"
>
<el-select
v-model=
"queryParams.typeId"
:placeholder=
"$t('选择商品类型')"
clearable
>
<el-option
v-for=
"types in typeList"
:key=
"types.id"
:label=
"$l(types, 'title')"
:value=
"types.id"
/>
</el-select>
</el-form-item>
<el-form-item
:label=
"$t('商品特性')"
prop=
"attrId"
>
<el-select
v-model=
"queryParams.attrId"
:placeholder=
"$t('选择商品特性')"
clearable
>
<el-option
v-for=
"attr in attrList"
:key=
"attr.id"
:label=
"attr.attrName"
:value=
"attr.id"
/>
</el-select>
</el-form-item>
<!--
<el-form-item
:label=
"$t('审核状态')"
prop=
"auditStatus"
>
<el-select
v-model=
"queryParams.auditStatus"
:placeholder=
"$t('选择审核状态')"
clearable
>
<el-option
v-for=
"auditStatusItem in auditStatusDictDatas"
:key=
"auditStatusItem.id"
:label=
"auditStatusItem.label"
:value=
"auditStatusItem.value"
/>
</el-select>
</el-form-item>
<el-form-item
:label=
"$t('上架状态')"
prop=
"status"
>
<el-select
v-model=
"queryParams.status"
:placeholder=
"$t('选择上架状态')"
clearable
>
<el-option
v-for=
"statusItem in statusDictDatas"
:key=
"statusItem.id"
:label=
"statusItem.value == CommonStatusEnum.ENABLE ? '已上架' : '已下架'"
:value=
"statusItem.value"
/>
</el-select>
</el-form-item>
-->
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
@
click=
"handleQuery"
>
{{
$t
(
'
搜索
'
)
}}
</el-button>
<el-button
icon=
"el-icon-refresh"
@
click=
"resetQuery"
>
{{
$t
(
'
重置
'
)
}}
</el-button>
</el-form-item>
</el-form>
<!-- 列表 -->
<el-table
v-loading=
"loading"
:data=
"list"
>
<el-table-column
:label=
"$t('序号')"
align=
"center"
prop=
"id"
/>
<el-table-column
:label=
"$t('商品类型')"
align=
"center"
prop=
"typeId"
>
<template
slot-scope=
"scope"
>
<span>
{{
getTypeName
(
scope
.
row
.
typeId
)
}}
</span>
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('中文标题')"
align=
"center"
prop=
"titleZh"
/>
<el-table-column
:label=
"$t('英文标题')"
align=
"center"
prop=
"titleEn"
/>
<el-table-column
prop=
"airWeightLimit"
:label=
"$t('订单重量上限kg')"
></el-table-column>
<el-table-column
:label=
"$t('操作')"
align=
"center"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"scope"
>
<el-button
@
click=
"copyLine(scope.row , false)"
type=
"text"
>
仅复制商品
</el-button>
<el-button
@
click=
"copyLine(scope.row , true)"
type=
"text"
>
仅复制商品与线路价格
</el-button>
</
template
>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination
v-show=
"total > 0"
:total=
"total"
:page.sync=
"queryParams.pageNo"
:limit.sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
</div>
</template>
<
script
>
import
{
createProduct
,
deleteProduct
,
exportProductExcel
,
getProduct
,
getProductPage
,
product_coupon_newProd
,
updateProduct
}
from
"
@/api/ecw/product
"
;
import
{
getProductAttrList
}
from
"
@/api/ecw/productAttr
"
;
import
{
getProductTypeList
}
from
"
@/api/ecw/productType
"
;
import
{
DICT_TYPE
,
getDictDatas
}
from
'
@/utils/dict
'
;
import
{
AuditStatusEnum
,
CommonStatusEnum
}
from
'
@/utils/constants
'
;
import
{
uploadFile
}
from
"
@/api/infra/file
"
;
import
ImageUpload
from
'
@/components/ImageUpload
'
import
PackagingType
from
"
@/views/ecw/channel/componrnts/packaging-type.vue
"
;
export
default
{
name
:
"
product-dialog
"
,
components
:
{
PackagingType
,
ImageUpload
},
data
()
{
return
{
visible
:
false
,
// 选中数组
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
//特性列表
attrList
:
[],
//类型列表
typeList
:
[],
//材质列表
materialList
:
[],
//包装列表
packagingList
:
[],
//货柜位置
locationList
:
[],
// 遮罩层
loading
:
true
,
// 导出遮罩层
exportLoading
:
false
,
// 显示搜索条件
showSearch
:
true
,
// 总条数
total
:
0
,
// 产品列表
list
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
open
:
false
,
dateRangeCreateTime
:
[],
// 查询参数
queryParams
:
{
pageNo
:
1
,
pageSize
:
10
,
typeId
:
null
,
attrId
:
null
,
titleZh
:
null
,
titleEn
:
null
,
auditStatus
:
null
,
status
:
null
,
},
// 表单参数
form
:
{
},
// 表单校验
rules
:
{
typeId
:
[{
required
:
true
,
message
:
this
.
$t
(
"
商品类型不能为空
"
),
trigger
:
"
change
"
}],
attrArray
:
[{
required
:
true
,
message
:
this
.
$t
(
"
商品特性不能为空
"
),
trigger
:
"
change
"
}],
titleZh
:
[{
required
:
true
,
message
:
this
.
$t
(
"
中文标题不能为空
"
),
trigger
:
"
blur
"
}],
titleEn
:
[{
required
:
true
,
message
:
this
.
$t
(
"
英文标题不能为空
"
),
trigger
:
"
blur
"
}],
// materialType: [{ required: true, message: this.$t("商品材质不能为空"), trigger: "blur" }],
// packaging: [{ required: true, message: this.$t("包装要求不能为空"), trigger: "blur" }],
// containerLocation: [{ required: true, message: this.$t("默认货柜位置不能为空"), trigger: "blur" }],
// square: [{ required: true, message: this.$t("订单方数上线不能为空"), trigger: "blur" }],
// needBook: [{ required: true, message: this.$t("是否预约入仓不能为空"), trigger: "blur" }],
},
CommonStatusEnum
:
CommonStatusEnum
,
AuditStatusEnum
:
AuditStatusEnum
,
statusDictDatas
:
getDictDatas
(
DICT_TYPE
.
COMMON_STATUS
),
auditStatusDictDatas
:
getDictDatas
(
DICT_TYPE
.
AUDIT_STATUS
),
materialList
:
getDictDatas
(
DICT_TYPE
.
ECW_PRODUCT_MATERIAL
),
packagingList
:
getDictDatas
(
DICT_TYPE
.
ECW_PACKAGING_TYPE
),
locationList
:
getDictDatas
(
DICT_TYPE
.
ECW_CONTAINER_LOCATION
),
preferentialList
:[],
exceptionProductId
:
0
//新增商品异常传的id
};
},
computed
:
{
getTypeName
()
{
return
typeId
=>
{
for
(
let
index
in
this
.
typeList
)
{
let
typeItem
=
this
.
typeList
[
index
];
if
(
typeItem
.
id
==
typeId
)
{
return
this
.
$l
(
typeItem
,
'
title
'
);
}
}
}
},
getAttrName
()
{
return
attrIds
=>
{
let
productAttrArray
=
[];
let
attrArray
=
attrIds
.
split
(
'
,
'
);
for
(
let
attrIndex
in
attrArray
)
{
let
attrId
=
attrArray
[
attrIndex
];
for
(
let
index
in
this
.
attrList
)
{
let
attrItem
=
this
.
attrList
[
index
];
if
(
attrItem
.
id
==
attrId
)
{
productAttrArray
.
push
(
this
.
$l
(
attrItem
,
'
attrName
'
));
}
}
}
return
productAttrArray
.
join
(
'
,
'
);
}
},
firstImg
(){
return
imgString
=>
{
if
(
!
imgString
||
imgString
==
''
)
return
imgString
let
imgs
=
imgString
.
split
(
'
,
'
)
return
imgs
.
length
?
imgs
[
0
]
:
null
}
}
},
activated
(){
if
(
this
.
$route
.
query
.
typeId
!=
this
.
queryParams
.
typeId
){
this
.
queryParams
.
typeId
=
+
this
.
$route
.
query
.
typeId
||
null
}
//新增商品异常跳转商品修改
if
(
this
.
$route
.
query
.
prodId
){
this
.
exceptionProductId
=
this
.
$route
.
query
.
prodId
this
.
handleUpdate
({
id
:
this
.
$route
.
query
.
prodId
})
}
this
.
getList
()
},
created
()
{
//新增商品异常跳转商品修改
if
(
this
.
$route
.
query
.
prodId
){
this
.
exceptionProductId
=
this
.
$route
.
query
.
prodId
this
.
handleUpdate
({
id
:
this
.
$route
.
query
.
prodId
})
}
let
typeId
=
this
.
$route
.
query
.
typeId
;
if
(
typeId
)
{
this
.
queryParams
.
typeId
=
parseInt
(
typeId
);
}
this
.
getAttrList
();
this
.
getTypeList
();
this
.
getList
();
},
methods
:
{
copyLine
(
row
,
bol
){
this
.
$emit
(
'
copyLine
'
,
row
,
bol
)
},
/** 获取产品属性列表 */
getAttrList
()
{
getProductAttrList
().
then
(
response
=>
{
this
.
attrList
=
response
.
data
;
})
},
/** 获取产品类型列表 */
getTypeList
()
{
getProductTypeList
().
then
(
response
=>
{
this
.
typeList
=
response
.
data
;
})
},
/**跳转价格管理 */
toPriceManager
(
row
)
{
/* localStorage.setItem('product', JSON.stringify(row));
localStorage.setItem('typeList', JSON.stringify(this.typeList)); */
this
.
$router
.
push
({
name
:
'
ProductPrice
'
,
query
:
{
product_id
:
row
.
id
,
product_type
:
row
.
typeId
}
})
},
handleStatusChange
(
row
,
statusType
)
{
updateProduct
(
row
).
then
(()
=>
{
this
.
$modal
.
msgSuccess
(
this
.
$t
(
"
修改成功
"
));
}).
catch
(
function
()
{
if
(
statusType
==
'
status
'
)
{
row
.
status
=
row
.
status
===
CommonStatusEnum
.
ENABLE
?
CommonStatusEnum
.
DISABLE
:
CommonStatusEnum
.
ENABLE
;
}
else
{
row
.
auditStatus
=
row
.
auditStatus
===
AuditStatusEnum
.
PASS
?
AuditStatusEnum
.
NOT_PASS
:
AuditStatusEnum
.
PASS
;
}
});
},
/** 查询列表 */
getList
()
{
this
.
loading
=
true
;
// 处理查询参数
let
params
=
{
...
this
.
queryParams
};
params
.
filter
=
false
;
this
.
addBeginAndEndTime
(
params
,
this
.
dateRangeCreateTime
,
'
createTime
'
);
// 执行查询
params
.
status
=
0
;
getProductPage
(
params
).
then
(
response
=>
{
this
.
list
=
response
.
data
.
list
;
this
.
total
=
response
.
data
.
total
;
this
.
loading
=
false
;
});
},
/** 取消按钮 */
cancel
()
{
this
.
open
=
false
;
this
.
reset
();
},
/** 表单重置 */
reset
()
{
this
.
form
=
{
id
:
undefined
,
typeId
:
undefined
,
attrArray
:
undefined
,
attrId
:
undefined
,
titleZh
:
undefined
,
titleEn
:
undefined
,
auditStatus
:
undefined
,
status
:
undefined
,
requirements
:
0
,
needBook
:
0
,
couponIds
:[],
airWeightLimit
:
undefined
,
priceStepClearanceList
:[],
channelPriceStepClearanceList
:[],
};
this
.
resetForm
(
"
form
"
);
},
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNo
=
1
;
this
.
getList
();
},
/** 重置按钮操作 */
resetQuery
()
{
this
.
dateRangeCreateTime
=
[];
this
.
resetForm
(
"
queryForm
"
);
this
.
handleQuery
();
},
/** 新增按钮操作 */
handleAdd
()
{
this
.
reset
();
this
.
open
=
true
;
this
.
title
=
this
.
$t
(
"
添加商品
"
);
product_coupon_newProd
().
then
(
r
=>
{
this
.
preferentialList
=
r
.
data
this
.
form
.
couponIds
=
this
.
preferentialList
.
filter
(
i
=>
i
.
isDefault
).
map
(
i
=>
i
.
couponId
)
})
if
(
this
.
queryParams
.
typeId
)
{
this
.
form
.
typeId
=
this
.
queryParams
.
typeId
;
}
},
/** 修改按钮操作 */
handleUpdate
(
row
)
{
// this.reset();
console
.
log
(
row
);
const
id
=
row
.
id
;
getProduct
(
id
).
then
(
response
=>
{
this
.
form
=
{...
response
.
data
,
couponIds
:[]};
this
.
form
.
channelPriceStepClearanceList
=
this
.
form
.
priceStepClearanceList
;
let
attrArray
=
this
.
form
.
attrId
?
this
.
form
.
attrId
.
split
(
'
,
'
):[];
for
(
let
index
in
attrArray
)
{
let
value
=
attrArray
[
index
];
attrArray
[
index
]
=
parseInt
(
value
);
}
this
.
$nextTick
(()
=>
{
this
.
$set
(
this
.
form
,
'
attrArray
'
,
attrArray
)
})
this
.
open
=
true
;
this
.
title
=
this
.
$t
(
"
修改商品
"
);
product_coupon_newProd
({
prodId
:
id
}).
then
(
r
=>
{
this
.
preferentialList
=
r
.
data
this
.
form
.
couponIds
=
this
.
preferentialList
.
filter
(
i
=>
i
.
isDefault
).
map
(
i
=>
i
.
couponId
)
// this.reset()
})
});
},
/** 提交按钮 */
submitForm
()
{
console
.
log
(
this
.
form
);
this
.
$refs
[
"
form
"
].
validate
(
valid
=>
{
if
(
!
valid
)
{
return
;
}
this
.
form
.
priceStepClearanceList
=
this
.
form
.
channelPriceStepClearanceList
;
//商品特性转字符串
this
.
form
.
attrId
=
this
.
form
.
attrArray
.
join
(
'
,
'
);
// 修改的提交
if
(
this
.
form
.
id
!=
null
)
{
this
.
form
.
priceStepClearanceList
.
forEach
(
i
=>
{
i
.
productId
=
this
.
form
.
id
})
if
(
this
.
exceptionProductId
){
this
.
form
.
productId
=
this
.
exceptionProductId
this
.
form
.
status
=
0
}
else
{
this
.
form
.
productId
=
this
.
form
.
id
}
updateProduct
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
this
.
$t
(
"
修改成功
"
));
this
.
open
=
false
;
if
(
this
.
exceptionProductId
){
this
.
exceptionProductId
=
null
this
.
$router
.
replace
({
path
:
'
/product/product-list
'
})
}
this
.
getList
();
});
return
;
}
// 添加的提交
createProduct
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
this
.
$t
(
"
新增成功
"
));
this
.
open
=
false
;
this
.
getList
();
});
});
},
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
id
=
row
.
id
;
this
.
$modal
.
confirm
(
this
.
$t
(
'
是否确认删除商品编号为{id}的数据项?
'
,
{
id
})).
then
(
function
()
{
return
deleteProduct
(
id
);
}).
then
(()
=>
{
this
.
getList
();
this
.
$modal
.
msgSuccess
(
this
.
$t
(
"
删除成功
"
));
}).
catch
(()
=>
{
});
},
/** 导出按钮操作 */
handleExport
()
{
// 处理查询参数
let
params
=
{
...
this
.
queryParams
};
params
.
pageNo
=
undefined
;
params
.
pageSize
=
undefined
;
this
.
addBeginAndEndTime
(
params
,
this
.
dateRangeCreateTime
,
'
createTime
'
);
// 执行导出
this
.
$modal
.
confirm
(
this
.
$t
(
'
是否确认导出所有商品数据项?
'
)).
then
(()
=>
{
this
.
exportLoading
=
true
;
return
exportProductExcel
(
params
);
}).
then
(
response
=>
{
this
.
$download
.
excel
(
response
,
'
商品.xlsx
'
);
this
.
exportLoading
=
false
;
}).
catch
(()
=>
{
});
},
// 覆盖默认的上传行为
requestUpload
()
{
},
// 上传预处理
beforeUpload
(
file
)
{
if
(
file
.
type
.
indexOf
(
"
image/
"
)
==
-
1
)
{
this
.
$modal
.
msgError
(
this
.
$t
(
"
文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。
"
));
}
else
{
//上传
let
formData
=
new
FormData
();
formData
.
append
(
"
file
"
,
file
);
formData
.
append
(
"
path
"
,
this
.
uuid
());
uploadFile
(
formData
).
then
(
response
=>
{
this
.
$set
(
this
.
form
,
'
imgs
'
,
response
.
data
);
// this.form.img = response.data;
})
}
},
uuid
()
{
var
s
=
[];
var
hexDigits
=
"
0123456789abcdef
"
;
for
(
var
i
=
0
;
i
<
36
;
i
++
)
{
s
[
i
]
=
hexDigits
.
substr
(
Math
.
floor
(
Math
.
random
()
*
0x10
),
1
);
}
s
[
14
]
=
"
4
"
;
// bits 12-15 of the time_hi_and_version field to 0010
s
[
19
]
=
hexDigits
.
substr
((
s
[
19
]
&
0x3
)
|
0x8
,
1
);
// bits 6-7 of the clock_seq_hi_and_reserved to 01
s
[
8
]
=
s
[
13
]
=
s
[
18
]
=
s
[
23
]
=
"
-
"
;
var
uuid
=
s
.
join
(
""
);
return
uuid
;
},
// 批量设置商品属性
handleEdit
()
{
this
.
$router
.
push
({
path
:
"
product-attr/edit
"
,
query
:
{
ids
:
this
.
ids
}
});
},
selectMoveAbout
(
val
){
if
(
!
val
.
mandatory
){
let
index
=
this
.
form
.
couponIds
.
findIndex
(
i
=>
val
.
couponId
==
i
)
if
(
index
>=
0
){
this
.
$confirm
(
this
.
$t
(
`您确定要将商品从优惠活动
${
this
.
$l
(
val
,
'
title
'
)}
中移出吗?`
),
this
.
$t
(
'
提示
'
),
{
confirmButtonText
:
this
.
$t
(
'
确定
'
),
cancelButtonText
:
this
.
$t
(
'
取消
'
)
,
type
:
'
warning
'
}).
then
(()
=>
{
this
.
form
.
couponIds
.
splice
(
index
,
1
)
this
.
$forceUpdate
()
}).
catch
(()
=>
{
});
}
else
{
this
.
$confirm
(
this
.
$t
(
`您确定要将商品加入到优惠活动
${
this
.
$l
(
val
,
'
title
'
)}
中吗?`
),
this
.
$t
(
'
提示
'
),
{
confirmButtonText
:
this
.
$t
(
'
确定
'
),
cancelButtonText
:
this
.
$t
(
'
取消
'
)
,
type
:
'
warning
'
}).
then
(()
=>
{
this
.
form
.
couponIds
.
push
(
val
.
couponId
)
this
.
$forceUpdate
()
}).
catch
(()
=>
{
});
}
}
}
},
};
</
script
>
<
style
lang=
"scss"
scoped
>
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment