Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-pay
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5cdc1189
authored
Nov 20, 2021
by
wangql
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
模块代码提交
1 parent
c8c25374
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
667 additions
and
15 deletions
src/api/modules/seckillActivity.js
src/views/seckillActivity/editActivity.vue
src/views/seckillActivity/index.vue
src/api/modules/seckillActivity.js
View file @
5cdc118
...
@@ -13,6 +13,29 @@ const getActivityPageApi = params => {
...
@@ -13,6 +13,29 @@ const getActivityPageApi = params => {
})
})
}
}
//创建/编辑活动
const
addOrUpdateActivityApi
=
params
=>
{
params
.
method
=
`
${
defaultPath
}
add.or.update`
return
http
({
url
:
'rop-scrm-shopmall/router'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
,
returnAll
:
true
})
}
//活动详情
const
getActivityDetailApi
=
params
=>
{
params
.
method
=
`
${
defaultPath
}
detail`
return
http
({
url
:
'rop-scrm-shopmall/router'
,
method
:
'GET'
,
data
:
params
,
sign
:
true
})
}
//开始/结束活动
//开始/结束活动
const
toggleStatusApi
=
params
=>
{
const
toggleStatusApi
=
params
=>
{
params
.
method
=
`
${
defaultPath
}
toggle.status`
params
.
method
=
`
${
defaultPath
}
toggle.status`
...
@@ -49,5 +72,16 @@ const topActivityApi = params => {
...
@@ -49,5 +72,16 @@ const topActivityApi = params => {
})
})
}
}
//分享
const
getSharedApi
=
params
=>
{
params
.
method
=
`
${
defaultPath
}
get.shared`
return
http
({
url
:
'rop-scrm-shopmall/router'
,
method
:
'GET'
,
data
:
params
,
sign
:
true
})
}
export
default
{
getActivityPageApi
,
toggleStatusApi
,
deleteActivityApi
,
topActivityApi
}
export
default
{
getActivityPageApi
,
toggleStatusApi
,
deleteActivityApi
,
topActivityApi
,
getSharedApi
,
addOrUpdateActivityApi
,
getActivityDetailApi
}
src/views/seckillActivity/editActivity.vue
0 → 100644
View file @
5cdc118
<!-- 编辑代金券 -->
<
template
>
<div
class=
"edit-share marketing"
>
<div
class=
"container edit-container"
>
<p
class=
"edit-title"
>
{{
title
}}
秒杀活动
</p>
<glsx-combi-form
class=
"edit-form-container"
ref=
"editFormRef"
labelWidth=
"140px"
:isBlock=
"true"
:formRef=
"editChildRef"
:formObj=
"editForm"
:formData=
"editFormData"
:formRules=
"editRule"
>
<template
slot=
"activityTimeHtml"
>
<el-form-item>
<el-date-picker
v-model=
"editForm.activityTime"
type=
"datetimerange"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
value-format=
"yyyy-MM-dd HH:mm:ss"
:picker-options=
"pickerOptions"
:disabled=
"isDisabled"
clearable
>
</el-date-picker>
</el-form-item>
</
template
>
<div
slot=
"goodsHtml"
>
<el-button
type=
"primary"
v-if=
"apear!='see'"
@
click=
"handleRelateProClose"
>
选择商品
</el-button>
<div
v-if=
"selectedProInfo.id && !specificationDetailList.length"
>
<p>
<!-- <img ng-src="{{selectPro.goodsImage}}" style="width: 50px;height:50px;"/> -->
<img
class=
"img-60"
:src=
"selectedProInfo.goodsImage"
/>
零售价 {{(selectedProInfo.retailPrice/100).toFixed(2)}}元
商品库存 {{selectedProInfo.goodsStock}}件
</p>
<el-form-item
label=
"设置秒杀价"
prop=
"activityPrice"
>
<el-input
v-model=
"editForm.activityPrice"
style=
"width: 150px"
:disabled=
"isDisabled"
><span
slot=
"append"
>
元
</span></el-input>
</el-form-item>
<el-form-item
label=
"活动库存"
prop=
"goodsStock"
>
<el-input
v-model=
"editForm.goodsStock"
style=
"width: 150px"
:disabled=
"isDisabled"
><span
slot=
"append"
>
件
</span></el-input>
</el-form-item>
</div>
<div
v-if=
"specificationDetailList.length"
class=
"flex"
style=
"margin-top: 20px;"
id=
"specificationDetailList"
>
<span
class=
"spesc-label"
:style=
"{ width: labelWidth }"
>
规格明细:
</span>
<div
style=
"width: calc(100% - 100px);"
>
<table
class=
"table-spesc"
>
<tbody>
<tr>
<td
:style=
"{ width: specsWidth }"
v-for=
"(subItem, subIndex) in specificationDetailList"
:key=
"subIndex"
>
{{ subItem.specificationName }}
</td>
<td
:style=
"{ width: specsWidth }"
>
零售价(元)
</td>
<td
:style=
"{ width: specsWidth }"
>
库存
</td>
<td
:style=
"{ width: specsWidth }"
>
设置秒杀价
</td>
<td
:style=
"{ width: specsWidth }"
>
活动库存
</td>
</tr>
</tbody>
</table>
<table
class=
"table-spesc"
style=
"max-height: 400px;"
>
<tbody>
<tr
style=
"border-bottom: 1px solid rgb(235, 235, 235);"
v-for=
"(item, index) in nameToValSpecsList"
:key=
"index"
>
<td
:style=
"{ width: specsWidth }"
v-for=
"(n, idx) in item.specsValueList"
:key=
"idx"
>
{{ n }}
</td>
<td
:style=
"{ width: specsWidth }"
>
{{ item.retailPrice }}元
</td>
<td
:style=
"{ width: specsWidth }"
>
{{ item.stock }}件
</td>
<!-- <td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" :class="{ 'border-red': (!(item.retailPrice + '') || +item.supplyPrice > +item.retailPrice) && submitted }" placeholder="零售价" v-model="item.retailPrice" @input.native="e => handleInput(e, index)">
<el-popover v-show="(!(item.retailPrice + '') || +item.supplyPrice > +item.retailPrice) && submitted" slot="suffix" placement="top" title="" width="90" trigger="hover" :content="!(item.retailPrice + '') ? '零售价是必填项' : '零售价要大于供货价'">
<i class="el-icon-warning color-red" slot="reference"></i>
</el-popover>
</el-input>
</td> -->
<td
:style=
"{ width: specsWidth }"
>
<el-input
:disabled=
"isDisabled"
placeholder=
"秒杀价"
v-model=
"item.activityPrice"
@
input=
"item.activityPrice = activityPrice_input($event,item.retailPrice)"
>
<!-- <span slot="append">元</span> -->
</el-input>
</td>
<td
:style=
"{ width: specsWidth }"
>
<el-input
:disabled=
"isDisabled"
placeholder=
"活动库存"
v-model=
"item.goodsStock"
@
input=
"item.goodsStock = goodsStock_input($event,item.stock)"
>
<!-- <span slot="append">件</span> -->
</el-input>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- <glsx-combi-form v-if="!specificationDetailList.length" class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsx-combi-form> -->
</div>
</glsx-combi-form>
</div>
<div
class=
"footer"
:style=
"{ left: footerLeft + 'px', width: footerWidth + 'px' }"
>
<el-button
type=
"primary"
v-if=
"apear!='see'"
@
click=
"handleConfirm"
>
确定
</el-button>
<el-button
type=
"default"
v-if=
"apear!='see'"
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
type=
"default"
v-if=
"apear=='see'"
@
click=
"handleCancel"
>
返回
</el-button>
</div>
<select-single-pro-dialog
v-if=
"isSingleSelectVisible"
:isSingleSelectVisible=
"isSingleSelectVisible"
:selectedProInfo=
"selectedProInfo"
@
handleSingleSelectConfirm=
"handleSingleSelectConfirm"
@
handleSingleSelectClose=
"handleSingleSelectClose"
></select-single-pro-dialog>
</div>
</template>
<
script
>
import
{
limitPrice
}
from
'@/common/constant'
export
default
{
name
:
'editActivity'
,
data
()
{
return
{
size
:
'small'
,
title
:
'创建'
,
titleObj
:
{
1
:
'创建秒杀活动'
,
2
:
'编辑秒杀活动'
},
footerLeft
:
'0'
,
footerWidth
:
'0'
,
editChildRef
:
'editChildRef'
,
pickerOptions
:
{
disabledDate
(
v
)
{
//禁用当前之前的日期
return
v
.
getTime
()
<
new
Date
().
getTime
()
-
86400000
;
}
},
routeInfo
:
{
// 1-新增;2-编辑;3-查看
addOrEdit
:
1
,
id
:
''
},
reg
:
{
priceReg
:
/^
\d[\d\.]
*$/
,
numReg
:
/^
[
1-9
]\d
*$/
},
apear
:
''
,
isDisabled
:
false
,
// 商品选择
isSingleSelectVisible
:
false
,
selectedProInfo
:
{},
specificationDetailList
:
[],
nameToValSpecsList
:
[],
activityInfo
:
{},
editForm
:
{
activityName
:
''
,
activityImg
:
''
,
promotion
:
''
,
activityTime
:
[],
activityPrice
:
''
,
goodsStock
:
''
},
//商品列表
tableParams
:
{
tableOption
:
true
,
tableColumns
:
[
{
label
:
'缩略图'
,
prop
:
'goodsImage'
,
addHtml
:
'goodsImage'
},
{
label
:
'商品名称'
,
prop
:
'goodsName'
},
{
label
:
'零售价(元)'
,
prop
:
'retailPrice'
}
]
},
searchProForm
:
{
name
:
''
},
selectedAllProList
:
[],
selectedProList
:
[],
editRule
:
{
activityName
:
[{
required
:
true
,
message
:
'请输入活动名称'
,
trigger
:
'change'
}],
activityImg
:
[{
required
:
true
,
message
:
'请选择活动宣传图'
,
trigger
:
'change'
}],
promotion
:
[{
required
:
true
,
message
:
'请输入活动宣传语'
,
trigger
:
'change'
}],
activityTime
:
[{
required
:
true
,
message
:
'活动时间不能为空'
,
trigger
:
'change'
}],
activityPrice
:
[{
required
:
true
,
message
:
'请设置秒杀价'
,
trigger
:
'change'
}],
goodsStock
:
[{
required
:
true
,
message
:
'请设置活动库存'
,
trigger
:
'change'
}],
},
editFormData
:
[
{
label
:
'活动名称'
,
name
:
'activityName'
,
width
:
'320px'
,
type
:
'input'
,
maxlength
:
20
,
},
{
label
:
'活动宣传图'
,
name
:
'activityImg'
,
type
:
'upload'
,
width
:
'320px'
,
limitSize
:
10
,
maxPhotoNum
:
1
,
handleUpload
:
(
e
,
file
,
targetItem
)
=>
{
const
imgFile
=
e
.
target
.
result
const
base64
=
file
.
name
.
split
(
'.'
)[
1
]
+
'@'
+
imgFile
.
split
(
','
)[
1
]
this
.
$apis
.
common
.
uploadImgApi
({
file
:
base64
,
fileType
:
'image'
}).
then
(
res
=>
{
console
.
log
(
res
)
this
.
editForm
[
targetItem
.
name
]
=
res
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validateField
(
targetItem
.
name
)
})
}
},
{
label
:
'活动宣传语'
,
name
:
'promotion'
,
width
:
'320px'
,
type
:
'input'
,
maxlength
:
20
},
{
label
:
'活动时间'
,
name
:
'activityTime'
,
addHtml
:
'activityTimeHtml'
},
{
label
:
'商品'
,
name
:
''
,
addHtml
:
'goodsHtml'
},
// {
// label: '面值',
// name: 'denomination',
// addHtml: 'denominationHtml'
// },
// {
// label: '库存',
// name: 'stock',
// width: '150px',
// type: 'input'
// },
// {
// label: '适用商品',
// name: 'goods',
// addHtml: 'goodsHtml'
// },
// {
// // label: '门店',
// name: '',
// addHtml: 'proTable'
// },
// {
// label: '使用说明',
// name: 'useDescription',
// addHtml: 'useDescriptionHtml'
// }
]
}
},
mounted
()
{
this
.
footerLeft
=
document
.
querySelector
(
'.base-container-right'
).
offsetLeft
this
.
footerWidth
=
document
.
documentElement
.
clientWidth
-
this
.
footerLeft
this
.
routeInfo
=
this
.
$route
.
params
// this.title = this.titleObj[this.routeInfo.addOrEdit]
this
.
routeInfo
.
addOrEdit
!=
1
?
this
.
getInfo
()
:
''
var
id
=
this
.
routeInfo
.
id
var
addOrEdit
=
this
.
routeInfo
.
addOrEdit
if
(
id
)
{
if
(
addOrEdit
==
3
){
this
.
apear
=
'see'
;
this
.
title
=
'查看'
;
this
.
isDisabled
=
true
this
.
editFormData
[
0
].
isDisabled
=
true
this
.
editFormData
[
1
].
isDisabled
=
true
this
.
editFormData
[
2
].
isDisabled
=
true
}
else
if
(
addOrEdit
==
2
){
this
.
apear
=
'edit'
;
this
.
title
=
'编辑'
;
}
}
else
{
this
.
apear
=
'add'
;
this
.
title
=
'创建'
;
}
},
watch
:
{
'editForm.activityPrice'
(
newValue
,
oldValue
){
this
.
editForm
.
activityPrice
=
limitPrice
(
newValue
,
oldValue
,
5
,
2
,
0
,
this
.
selectedProInfo
.
retailPrice
/
100
)
},
'editForm.goodsStock'
(
newValue
,
oldValue
){
this
.
editForm
.
goodsStock
=
limitPrice
(
newValue
,
oldValue
,
5
,
0
,
0
,
this
.
selectedProInfo
.
goodsStock
)
}
},
methods
:
{
limitPriceForInput
(
val
,
intergerDigit
,
pointDigit
,
minValue
,
maxValue
,
regRule
)
{
var
regRule
=
regRule
||
'priceReg'
// if (val && (minValue && (val < minValue)) || (maxValue && (val > maxValue))) {
// console.log('aaa');
// return maxValue ? maxValue : (minValue?minValue:'')
// }
if
(
val
&&
this
.
reg
[
regRule
].
test
(
val
+
''
))
{
maxValue
=
typeof
(
maxValue
)
==
'string'
?
parseFloat
(
maxValue
):
maxValue
minValue
=
typeof
(
minValue
)
==
'string'
?
parseFloat
(
minValue
):
minValue
if
(
val
&&
(
minValue
&&
(
val
<
minValue
))
||
(
maxValue
&&
(
val
>
maxValue
)))
{
return
maxValue
?
maxValue
:
(
minValue
?
minValue
:
''
)
}
if
((
/
\.
/
).
test
(
val
))
{
var
val
=
val
+
''
var
interger
=
val
.
split
(
'.'
)[
0
]
var
point
=
val
.
split
(
'.'
)[
1
]
var
intergerNum
=
interger
.
length
>
intergerDigit
?
val
.
split
(
'.'
)[
0
]
:
interger
var
pointNum
=
point
.
length
>
pointDigit
?
point
.
slice
(
0
,
pointDigit
)
:
point
val
=
pointDigit
?
intergerNum
+
'.'
+
pointNum
:
val
.
split
(
'.'
)[
0
]
}
else
{
val
=
val
.
length
>
intergerDigit
?
val
.
slice
(
0
,
intergerDigit
)
:
val
}
return
val
}
else
{
return
''
}
},
handleRelateProChange
(
val
)
{
this
.
editRule
.
goodsId
[
0
].
required
=
val
==
2
var
idx
=
this
.
editFormData
.
findIndex
(
item
=>
item
.
name
==
'goodsId'
)
this
.
editFormData
[
idx
].
isHide
=
val
!=
2
},
handleRelateProClose
(
targetItem
)
{
this
.
selectedProInfo
=
this
.
editForm
.
goodsId
?
{
id
:
this
.
editForm
.
goodsId
}
:
{}
this
.
handleSingleSelectClose
()
},
handleSingleSelectConfirm
(
selectedProInfo
)
{
// this.editForm.goodsId = selectedProInfo.id
// this.editForm.goodsName = selectedProInfo.goodsName
// this.editForm.goodsImage = selectedProInfo.goodsImage
this
.
handleSingleSelectClose
()
if
(
selectedProInfo
){
this
.
getGoodInfo
(
selectedProInfo
.
id
)
}
},
handleSingleSelectClose
()
{
this
.
isSingleSelectVisible
=
!
this
.
isSingleSelectVisible
},
getGoodInfo
(
id
)
{
this
.
$apis
.
proManage
.
getProInfoApi
({
id
:
id
}).
then
(
res
=>
{
// this.editForm = {
// ...res,
// retailPrice: '',
// supplyPrice: res.supplyPrice ? (res.supplyPrice / 100).toFixed(2) : ''
// }
// // 规格
// if (this.editForm.specificationList.length) {
// this.specificationDetailList = this.$common.utils.deepClone(this.editForm.specificationList)
// this.recoverySpec()
// // this.findSpeceMin()
// } else {
// // 零售价
// this.editForm.retailPrice = (res.retailPrice / 100).toFixed(2)
// }
// this.mainImgUrl = this.editForm.goodsDetailImageList[0].content
// this.moveNum = this.editForm.goodsDetailImageList.length > 4 ? this.editForm.goodsDetailImageList.length - 4 : 0
this
.
selectedProInfo
=
this
.
$common
.
utils
.
deepClone
(
res
)
console
.
log
(
this
.
selectedProInfo
);
if
(
this
.
selectedProInfo
.
specificationDetailList
.
length
)
{
// this.specificationDetailList = this.$common.utils.deepClone(res.specificationList)
this
.
specificationDetailList
=
this
.
selectedProInfo
.
specificationList
this
.
recoverySpec
()
}
else
{
this
.
nameToValSpecsList
=
[]
this
.
specificationDetailList
=
[]
}
})
},
// 规格值解构
changeSpecs
(
isRecovery
)
{
this
.
specsWidth
=
100
/
(
this
.
specificationDetailList
.
length
+
4
)
+
'%'
this
.
nameToValSpecsList
=
[]
var
markIdx
=
0
for
(
var
i
=
0
;
i
<
this
.
specificationDetailList
.
length
;
i
++
)
{
markIdx
=
0
for
(
var
j
=
0
;
j
<
this
.
specificationDetailList
[
i
].
specificationValueList
.
length
;
j
++
)
{
if
(
i
==
0
)
{
this
.
nameToValSpecsList
.
push
({
specsValueList
:
[
this
.
specificationDetailList
[
i
].
specificationValueList
[
j
].
specificationValue
],
retailPrice
:
''
,
stock
:
''
,
activityPrice
:
''
,
goodsStock
:
''
})
}
else
{
var
targetValLen
=
this
.
specificationDetailList
[
i
].
specificationValueList
.
length
var
loopNum
=
0
var
tempMarkIdx
=
0
if
(
j
==
0
&&
targetValLen
>
1
)
{
var
obj
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
nameToValSpecsList
))
this
.
nameToValSpecsList
=
[]
obj
.
forEach
((
item
,
index
)
=>
{
for
(
var
k
=
0
;
k
<
targetValLen
;
k
++
)
{
this
.
nameToValSpecsList
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
item
)))
}
})
}
loopNum
=
this
.
nameToValSpecsList
.
length
/
targetValLen
tempMarkIdx
=
markIdx
for
(
var
k
=
0
;
k
<
loopNum
;
k
++
)
{
this
.
nameToValSpecsList
[
tempMarkIdx
].
specsValueList
.
push
(
this
.
specificationDetailList
[
i
].
specificationValueList
[
j
].
specificationValue
)
tempMarkIdx
=
tempMarkIdx
+
targetValLen
}
markIdx
=
markIdx
+
1
}
}
}
if
(
isRecovery
)
{
this
.
nameToValSpecsList
.
forEach
((
item
,
index
)
=>
{
var
specificationObj
=
{}
item
.
specsValueList
.
forEach
((
subItem
,
subIndex
)
=>
{
specificationObj
[
this
.
specificationDetailList
[
subIndex
].
specificationName
]
=
subItem
})
item
.
specificationData
=
this
.
setLocaleCompare
(
specificationObj
)
for
(
var
i
=
0
;
i
<
this
.
selectedProInfo
.
specificationDetailList
.
length
;
i
++
)
{
var
temp
=
this
.
selectedProInfo
.
specificationDetailList
[
i
]
if
(
temp
.
specificationData
==
item
.
specificationData
)
{
item
.
retailPrice
=
(
temp
.
retailPrice
/
100
).
toFixed
(
2
)
item
.
stock
=
temp
.
stock
item
.
specificationKey
=
temp
.
specificationKey
// item.supplyPrice = this.editForm.supplyPrice
break
}
}
if
(
this
.
activityInfo
&&
this
.
activityInfo
.
specificationDetailWithGoodsList
){
for
(
var
i
=
0
;
i
<
this
.
activityInfo
.
specificationDetailWithGoodsList
.
length
;
i
++
)
{
var
temp
=
this
.
activityInfo
.
specificationDetailWithGoodsList
[
i
]
if
(
temp
.
specificationData
==
item
.
specificationData
)
{
item
.
activityPrice
=
(
temp
.
retailPrice
/
100
).
toFixed
(
2
)
item
.
goodsStock
=
temp
.
stock
break
}
}
}
})
}
// console.log(this.nameToValSpecsList);
},
setLocaleCompare
(
params
)
{
let
keys
=
[]
let
obj
=
[]
Object
.
keys
(
params
).
forEach
(
item
=>
{
keys
.
push
(
item
)
})
keys
.
sort
()
keys
.
forEach
(
item
=>
{
obj
.
push
([
item
,
params
[
item
]])
})
return
obj
.
join
(
'&'
).
replace
(
/,/g
,
'-'
)
},
// 恢复规格值
recoverySpec
()
{
this
.
changeSpecs
(
true
)
},
//规格-秒杀价输入控制
activityPrice_input
(
val
,
maxValue
)
{
return
this
.
limitPriceForInput
(
val
,
5
,
2
,
0
,
maxValue
)
},
//规格-活动库存输入控制
goodsStock_input
(
val
,
maxValue
)
{
return
this
.
limitPriceForInput
(
val
,
5
,
0
,
0
,
maxValue
)
},
getInfo
()
{
this
.
$apis
.
seckillActivity
.
getActivityDetailApi
({
id
:
this
.
routeInfo
.
id
}).
then
(
res
=>
{
var
info
=
res
var
form
=
this
.
editForm
this
.
activityInfo
=
info
form
.
activityName
=
info
.
activityName
form
.
activityImg
=
info
.
activityImg
form
.
promotion
=
info
.
promotion
form
.
activityTime
=
[
info
.
startTime
,
info
.
endTime
]
this
.
getGoodInfo
(
info
.
goodsId
)
if
(
info
.
activityPrice
!=
null
&&
info
.
goodsStock
!=
null
){
form
.
activityPrice
=
(
info
.
activityPrice
/
100
).
toFixed
(
2
)
form
.
goodsStock
=
info
.
goodsStock
}
})
},
validateRules
(){
if
(
this
.
specificationDetailList
.
length
){
this
.
editRule
.
activityPrice
[
0
].
required
=
false
this
.
editRule
.
goodsStock
[
0
].
required
=
false
}
else
{
this
.
editRule
.
activityPrice
[
0
].
required
=
true
this
.
editRule
.
goodsStock
[
0
].
required
=
true
}
},
getCouponInfoParams
()
{
var
_this
=
this
var
param
=
this
.
editForm
// param.activityPrice = (param.activityPrice*100).toFixed(2) //存的分,需乘100
param
.
activityPrice
=
param
.
activityPrice
*
100
//存的分,需乘100
if
(
this
.
routeInfo
.
id
){
param
.
id
=
this
.
routeInfo
.
id
}
console
.
log
(
this
.
routeInfo
);
const
d
=
param
.
activityTime
if
(
d
&&
d
.
length
>
0
)
{
param
.
startTime
=
d
[
0
];
param
.
endTime
=
d
[
1
];
}
param
.
goodsId
=
this
.
selectedProInfo
.
id
if
(
this
.
nameToValSpecsList
.
length
>
0
){
delete
param
.
activityPrice
delete
param
.
goodsStock
param
.
specificationDetailList
=
[]
this
.
nameToValSpecsList
.
forEach
(
function
(
item
)
{
var
obj
=
{
// retailPrice : (item.activityPrice*100).toFixed(0), //存的分,需乘100
retailPrice
:
item
.
activityPrice
*
100
,
//存的分,需乘100
stock
:
item
.
goodsStock
,
specificationData
:
item
.
specificationData
,
specificationKey
:
item
.
specificationKey
}
if
(
_this
.
routeInfo
.
id
){
obj
.
activityId
=
_this
.
routeInfo
.
id
}
param
.
specificationDetailList
.
push
(
obj
)
})
}
// console.log('aaaa');
// console.log(this.routeInfo);
return
param
;
},
handleConfirm
()
{
this
.
validateRules
()
var
flag
=
true
if
(
JSON
.
stringify
(
this
.
selectedProInfo
)
==
'{}'
){
this
.
$message
({
message
:
'未选择商品'
,
type
:
'error'
})
flag
=
false
}
if
(
this
.
nameToValSpecsList
&&
this
.
nameToValSpecsList
.
length
>
0
){
for
(
var
key
in
this
.
nameToValSpecsList
)
{
var
item
=
this
.
nameToValSpecsList
[
key
]
if
(
!
item
.
activityPrice
){
this
.
$message
({
message
:
'有未设置秒杀价的项'
,
type
:
'error'
})
flag
=
false
break
}
if
(
!
item
.
goodsStock
){
this
.
$message
({
message
:
'有未设置活动库存的项'
,
type
:
'error'
})
flag
=
false
break
}
}
}
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
!
flag
){
return
}
var
params
=
this
.
getCouponInfoParams
()
console
.
log
(
params
);
this
.
$apis
.
seckillActivity
.
addOrUpdateActivityApi
(
params
).
then
(
res
=>
{
this
.
$message
({
message
:
res
.
code
==
'0'
?
'操作成功'
:
'操作失败'
,
type
:
res
.
code
==
'0'
?
'success'
:
'error'
})
if
(
res
.
code
==
'0'
)
{
this
.
handleCancel
()
}
})
}
})
},
handleCancel
()
{
this
.
$router
.
push
({
path
:
'/seckillActivity/index'
})
}
}
}
</
script
>
<
style
scoped
>
/* 规格 */
.edit-product-dh
.spesc-label
{
padding
:
1px
10px
;
box-sizing
:
border-box
;
width
:
110px
;
color
:
#666
;
text-align
:
right
;
padding-right
:
12px
;
}
.edit-product-dh
.table-spesc
{
width
:
100%
;
text-align
:
center
;
margin-bottom
:
0
;
}
.edit-product-dh
.table-spesc
tbody
tr
{
border
:
1px
solid
#e7e7e7
;
}
.edit-product-dh
.table-spesc
tbody
td
{
display
:
inline-block
;
box-sizing
:
border-box
;
width
:
20%
;
border
:
none
;
padding
:
2px
6px
;
vertical-align
:
center
;
text-align
:
center
;
}
.edit-product-dh
.table-spesc
.el-input--small
.el-input__inner
{
text-align
:
center
!important
;
}
.edit-product-dh
.w-320
{
width
:
320px
;
}
.color-red
{
color
:
#eb4e4e
;
cursor
:
pointer
;
}
/* 规格 */
</
style
>
src/views/seckillActivity/index.vue
View file @
5cdc118
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<
template
>
<
template
>
<div
class=
"marketing pro-group"
>
<div
class=
"marketing pro-group"
>
<div
class=
"m-b-20"
>
<div
class=
"m-b-20"
>
<el-button
:size=
"size"
type=
"primary"
class=
"el-icon-plus"
@
click=
"add
CashCoupon
()"
>
新增秒杀活动
</el-button>
<el-button
:size=
"size"
type=
"primary"
class=
"el-icon-plus"
@
click=
"add
Activity
()"
>
新增秒杀活动
</el-button>
</div>
</div>
<div
class=
"container"
>
<div
class=
"container"
>
<div>
<div>
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
<el-button
v-if=
"scope.scope.activityStatus == '2' || scope.scope.activityStatus == '3'"
type=
"text"
@
click=
"handleEdit(3,scope.scope)"
>
查看
</el-button>
<el-button
v-if=
"scope.scope.activityStatus == '2' || scope.scope.activityStatus == '3'"
type=
"text"
@
click=
"handleEdit(3,scope.scope)"
>
查看
</el-button>
<el-button
v-if=
"scope.scope.activityStatus == '3'"
type=
"text"
@
click=
"del(scope.scope)"
>
删除
</el-button>
<el-button
v-if=
"scope.scope.activityStatus == '3'"
type=
"text"
@
click=
"del(scope.scope)"
>
删除
</el-button>
<el-button
type=
"text"
@
click=
"topping(scope.scope)"
>
置顶
</el-button>
<el-button
type=
"text"
@
click=
"topping(scope.scope)"
>
置顶
</el-button>
<el-button
v-if=
"scope.scope.activityStatus == '1' || scope.scope.activityStatus == '2'"
type=
"text"
@
click=
"
s
hare(scope.scope)"
>
分享
</el-button>
<el-button
v-if=
"scope.scope.activityStatus == '1' || scope.scope.activityStatus == '2'"
type=
"text"
@
click=
"
handleS
hare(scope.scope)"
>
分享
</el-button>
</div>
</div>
</GLTable>
</GLTable>
<!-- 表格区域 end -->
<!-- 表格区域 end -->
...
@@ -225,25 +225,18 @@ export default {
...
@@ -225,25 +225,18 @@ export default {
this
.
secondConfirm
(
'删除'
,
'确定删除此活动?'
,
'seckillActivity'
,
'deleteActivityApi'
,
params
)
this
.
secondConfirm
(
'删除'
,
'确定删除此活动?'
,
'seckillActivity'
,
'deleteActivityApi'
,
params
)
},
},
//新增
代金券
//新增
活动
add
CashCoupon
()
{
add
Activity
()
{
this
.
$router
.
push
(
'/
couponManage/editCashCoupon
/1'
)
this
.
$router
.
push
(
'/
seckillActivity/editActivity
/1'
)
},
},
// addOrEdit:1-新增;2-编辑;3-查看
// addOrEdit:1-新增;2-编辑;3-查看
handleEdit
(
addOrEdit
,
row
)
{
handleEdit
(
addOrEdit
,
row
)
{
var
goto
=
''
this
.
$router
.
push
(
'/seckillActivity/editActivity/'
+
addOrEdit
+
'/'
+
row
.
id
)
if
(
row
.
discountType
==
'3'
){
//代金券
goto
=
'/couponManage/editCashCoupon/'
}
else
if
(
row
.
discountType
==
'7'
){
//会员服务
goto
=
'/couponManage/editMemberService/'
}
console
.
log
(
goto
+
addOrEdit
+
'/'
+
row
.
id
);
this
.
$router
.
push
(
goto
+
addOrEdit
+
'/'
+
row
.
id
)
},
},
handleShare
(
row
)
{
handleShare
(
row
)
{
this
.
$apis
.
proManage
.
getProShare
Api
({
id
:
row
.
id
}).
then
(
res
=>
{
this
.
$apis
.
seckillActivity
.
getShared
Api
({
id
:
row
.
id
}).
then
(
res
=>
{
this
.
shareForm
=
res
this
.
shareForm
=
res
this
.
handleShareClose
()
this
.
handleShareClose
()
})
})
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment