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 ff97316b
authored
Nov 18, 2021
by
wangql
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交优惠券、秒杀活动代码
1 parent
c0ac3f38
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
900 additions
and
136 deletions
src/api/modules/couponManage.js
src/components/glsx-combi-form/index.vue
src/components/index.js
src/components/selectMutiProDialog/indexForCoupon.vue
src/views/couponManage/editCashCoupon.vue
src/views/couponManage/editDiscountCoupon.vue
src/views/couponManage/editExchangeCoupon.vue
src/views/couponManage/editMemberService.vue
src/views/couponManage/index.vue
src/api/modules/couponManage.js
View file @
ff97316
...
@@ -95,7 +95,7 @@ const updateCouponApi = params => {
...
@@ -95,7 +95,7 @@ const updateCouponApi = params => {
})
})
}
}
//获取
//获取
当前门店自己增加的所有商品
const
getAllGoodsApi
=
params
=>
{
const
getAllGoodsApi
=
params
=>
{
params
.
method
=
`scrm.api.shopmall.goods.page.curMerchant`
params
.
method
=
`scrm.api.shopmall.goods.page.curMerchant`
return
http
({
return
http
({
...
...
src/components/glsx-combi-form/index.vue
View file @
ff97316
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
</span>
</span>
<slot
v-if=
"item.addHtml"
:name=
"item.addHtml"
:scope=
"item"
></slot>
<slot
v-if=
"item.addHtml"
:name=
"item.addHtml"
:scope=
"item"
></slot>
<div
v-else-if=
"item.type === 'input'"
>
<div
v-else-if=
"item.type === 'input'"
>
<el-input
:placeholder=
"item.placeholder || '请输入' + item.label"
v-model
.
trim=
"formObj[item.name]"
:disabled=
"item.isDisabled"
:maxlength=
"item.maxlength"
:clearable=
"item.isClear || false"
:type=
"item.inputType || 'text'"
:rows=
"item.rows || 2"
:style=
"
{ width: item.width || 'auto' }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)"
@blur.native.capture="item.inputBlur"
>
<el-input
:placeholder=
"item.placeholder || '请输入' + item.label"
v-model
.
trim=
"formObj[item.name]"
:disabled=
"item.isDisabled"
:maxlength=
"item.maxlength"
:clearable=
"item.isClear || false"
:type=
"item.inputType || 'text'"
:rows=
"item.rows || 2"
:style=
"
{ width: item.width || 'auto' }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)" >
<span
v-if=
"item.prepend"
slot=
"prepend"
>
{{
item
.
prepend
}}
</span>
<span
v-if=
"item.prepend"
slot=
"prepend"
>
{{
item
.
prepend
}}
</span>
<span
v-if=
"item.append"
slot=
"append"
>
{{
item
.
append
}}
</span>
<span
v-if=
"item.append"
slot=
"append"
>
{{
item
.
append
}}
</span>
</el-input>
</el-input>
...
...
src/components/index.js
View file @
ff97316
...
@@ -13,9 +13,11 @@ import glsxDialog from '@/components/glsx-dialog/index.vue'
...
@@ -13,9 +13,11 @@ import glsxDialog from '@/components/glsx-dialog/index.vue'
import
selectMutiProDialog
from
'@/components/selectMutiProDialog/index.vue'
import
selectMutiProDialog
from
'@/components/selectMutiProDialog/index.vue'
import
selectSingleProDialog
from
'@/components/selectSingleProDialog/index.vue'
import
selectSingleProDialog
from
'@/components/selectSingleProDialog/index.vue'
import
relateStoreDialog
from
'@/components/relate-store-dialog'
import
relateStoreDialog
from
'@/components/relate-store-dialog'
import
selectMutiProForcouponDialog
from
'@/components/selectMutiProDialog/indexForCoupon.vue'
Vue
.
component
(
'glsx-combi-form'
,
glsxCombiForm
)
Vue
.
component
(
'glsx-combi-form'
,
glsxCombiForm
)
Vue
.
component
(
'glsx-dialog'
,
glsxDialog
)
Vue
.
component
(
'glsx-dialog'
,
glsxDialog
)
Vue
.
component
(
'select-muti-pro-dialog'
,
selectMutiProDialog
)
Vue
.
component
(
'select-muti-pro-dialog'
,
selectMutiProDialog
)
Vue
.
component
(
'select-single-pro-dialog'
,
selectSingleProDialog
)
Vue
.
component
(
'select-single-pro-dialog'
,
selectSingleProDialog
)
Vue
.
component
(
'relate-store-dialog'
,
relateStoreDialog
)
\ No newline at end of file
\ No newline at end of file
Vue
.
component
(
'relate-store-dialog'
,
relateStoreDialog
)
Vue
.
component
(
'select-muti-pro-forcoupon-dialog'
,
selectMutiProForcouponDialog
)
\ No newline at end of file
\ No newline at end of file
src/components/selectMutiProDialog/indexForCoupon.vue
0 → 100644
View file @
ff97316
<!-- 选择商品弹窗 -->
<
template
>
<glsx-dialog
class=
"muti-pro"
title=
"选择商品"
:isVisible
.
sync=
"isMutiSelectVisible"
width=
"70%"
@
confirmDialog=
"handleMutiSelectConfirm"
@
closeDialog=
"handleMutiSelectClose"
>
<el-form
:inline=
"true"
:model=
"searchProForm"
>
<el-form-item
label=
"商品名称:"
>
<el-input
:size=
"size"
v-model=
"searchProForm.name"
placeholder=
"请输入商品名称"
maxlength=
"20"
clearable
></el-input>
</el-form-item>
<el-form-item>
<el-button
:size=
"size"
type=
"primary"
@
click=
"handleConfigSearch"
>
查询
</el-button>
<el-button
:size=
"size"
@
click=
"handleConfigReset"
>
重置
</el-button>
</el-form-item>
</el-form>
<GLTable
ref=
"mutiProRef"
:tableData=
"productList"
:hasPage=
"false"
:tableParams=
"tableParams"
@
refreshTable=
"getList"
>
<span
slot=
"goodsImage"
slot-scope=
"scope"
>
<img
class=
"m-t-10 img-60"
:src=
"scope.scope.goodsImage"
/>
</span>
</GLTable>
</glsx-dialog>
</
template
>
<
script
>
// import { getGoodsList } from '@/api/modules/common'
import
glsxDialog
from
'@/components/glsx-dialog'
export
default
{
name
:
'selectMutiProForcouponDialog'
,
data
()
{
return
{
// 表格组件
// getListApi: this.$apis.common.getGoodsListApi,
productList
:
[],
// pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchProForm
:
{
name
:
''
},
// 表格参数
tableParams
:
{
listName
:
'list'
,
// 行数据的key
mutiSelectUniqueKey
:
'id'
,
// 多选ref的名称
mutiSelectName
:
'list'
,
tableColumns
:
[
{
label
:
'商品名称'
,
prop
:
'goodsName'
},
{
label
:
'缩略图'
,
prop
:
'goodsImage'
,
addHtml
:
'goodsImage'
},
{
label
:
'零售价(元)'
,
prop
:
'retailPrice'
},
{
label
:
'来源门店'
,
prop
:
'merchantName'
}
]
}
}
},
props
:
{
isMutiSelectVisible
:
{
type
:
Boolean
,
default
:
false
},
selectedProList
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
components
:
{
glsxDialog
},
mounted
()
{
this
.
getList
(
true
)
},
methods
:
{
getList
(
isMounted
=
false
)
{
var
params
=
{
goodsStatus
:
1
,
// goodsSource: 1,
// pageNum: isMounted ? 1 : this.$refs.mutiProRef.page.pageNum,
// pageSize: isMounted ? 10 : this.$refs.mutiProRef.page.pageSize
currentPage
:
1
,
pageNum
:
1
,
pageSize
:
100000
,
pageStart
:
0
,
goodsName
:
this
.
searchProForm
.
name
}
var
that
=
this
this
.
$apis
.
couponManage
.
getAllGoodsApi
(
params
).
then
(
res
=>
{
// console.log(res)
// this.productList = res
this
.
productList
=
res
.
list
// this.$refs.mutiProRef.tableTotal = res.total
this
.
productList
.
forEach
(
function
(
item
)
{
// item.saleAmount = item.goodsStatistics.saleAmount
// if (item.specificationDetailList.length > 1) {
// let retailPriceList = item.specificationDetailList.sort(function(a, b) {
// return a.retailPrice - b.retailPrice
// })
// let stockeList = item.specificationDetailList.sort(function(a, b) {
// return a.stock - b.stock
// })
// let minRatilPrice = retailPriceList[0].retailPrice / 100
// let maxRatilPrice = retailPriceList[retailPriceList.length - 1].retailPrice / 100
// let minStock = stockeList[0].stock
// let maxStock = stockeList[stockeList.length - 1].stock
// item.retailPrice = minRatilPrice == maxRatilPrice ? minRatilPrice.toFixed(2) : minRatilPrice.toFixed(2) + '-' + maxRatilPrice.toFixed(2)
// item.minRatilPrice = minRatilPrice.toFixed(2)
// item.goodsStock = minStock == maxStock ? minStock : minStock + '-' + maxStock
// } else if (item.specificationDetailList.length == 1) {
// item.retailPrice = (item.specificationDetailList[0].retailPrice / 100).toFixed(2)
// item.minRatilPrice = item.retailPrice
// item.goodsStock = item.specificationDetailList[0].stock
// } else {
// item.retailPrice = (item.retailPrice / 100).toFixed(2)
// item.minRatilPrice = item.retailPrice
// }
item
.
retailPrice
=
(
item
.
retailPrice
/
100
).
toFixed
(
2
)
})
this
.
recoverySelected
()
})
},
recoverySelected
()
{
if
(
this
.
selectedProList
.
length
)
{
this
.
selectedProList
.
forEach
(
row
=>
{
this
.
$refs
.
mutiProRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
toggleRowSelection
(
row
)
})
}
},
handleMutiSelectConfirm
()
{
var
selectedData
=
this
.
$refs
.
mutiProRef
.
mutiSelectArr
[
this
.
tableParams
.
mutiSelectName
]
console
.
log
(
selectedData
)
this
.
$emit
(
'handleMutiSelectConfirm'
,
selectedData
)
},
handleMutiSelectClose
()
{
this
.
$emit
(
'handleMutiSelectClose'
)
},
handleConfigSearch
(){
this
.
getList
(
true
)
},
handleConfigReset
(){
this
.
searchProForm
.
name
=
''
this
.
getList
(
true
)
},
}
}
</
script
>
<
style
>
.muti-pro
.m-t-10
{
margin-top
:
10px
;
}
</
style
>
src/views/couponManage/editCashCoupon.vue
View file @
ff97316
...
@@ -4,9 +4,9 @@
...
@@ -4,9 +4,9 @@
<div
class=
"container edit-container"
>
<div
class=
"container edit-container"
>
<p
class=
"edit-title"
>
{{
title
}}
代金券
</p>
<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"
>
<glsx-combi-form
class=
"edit-form-container"
ref=
"editFormRef"
labelWidth=
"140px"
:isBlock=
"true"
:formRef=
"editChildRef"
:formObj=
"editForm"
:formData=
"editFormData"
:formRules=
"editRule"
>
<template
slot=
"
ways
Html"
>
<template
slot=
"
useChannel
Html"
>
<el-radio
v-model=
"editForm.
way
"
label=
"1"
:disabled=
"apear!='couponAdd'"
>
线上商品
</el-radio>
<el-radio
v-model=
"editForm.
useChannel
"
label=
"1"
:disabled=
"apear!='couponAdd'"
>
线上商品
</el-radio>
<el-radio
v-model=
"editForm.
way"
label=
"2"
:disabled=
"apear!='couponAdd'"
@
change=
"clickWay
"
>
到店核销
</el-radio>
<el-radio
v-model=
"editForm.
useChannel"
label=
"2"
:disabled=
"apear!='couponAdd'"
@
change=
"clickUseChannel
"
>
到店核销
</el-radio>
</
template
>
</
template
>
<
template
slot=
"effectiveHtml"
>
<
template
slot=
"effectiveHtml"
>
<el-radio
v-model=
"editForm.effectiveType"
label=
"3"
:disabled=
"apear!='couponAdd'"
>
无有效期
</el-radio><br>
<el-radio
v-model=
"editForm.effectiveType"
label=
"3"
:disabled=
"apear!='couponAdd'"
>
无有效期
</el-radio><br>
...
@@ -17,8 +17,10 @@
...
@@ -17,8 +17,10 @@
type=
"daterange"
type=
"daterange"
range-separator=
"至"
range-separator=
"至"
start-placeholder=
"开始日期"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
:disabled=
"editForm.effectiveType != 2||apear!='couponAdd'"
>
end-placeholder=
"结束日期"
</el-date-picker>
value-format=
"yyyy-MM-dd"
:disabled=
"editForm.effectiveType != 2||apear!='couponAdd'"
clearable
>
</el-date-picker>
</el-form-item>
</el-form-item>
</el-radio><br>
</el-radio><br>
<el-radio
v-model=
"editForm.effectiveType"
label=
"1"
:disabled=
"apear!='couponAdd'"
>
<el-radio
v-model=
"editForm.effectiveType"
label=
"1"
:disabled=
"apear!='couponAdd'"
>
...
@@ -31,11 +33,11 @@
...
@@ -31,11 +33,11 @@
</el-form-item>
</el-form-item>
</el-radio>
</el-radio>
</
template
>
</
template
>
<
template
slot=
"
b
arriersHtml"
>
<
template
slot=
"
useB
arriersHtml"
>
<el-radio
v-model=
"editForm.
b
arriers"
label=
"1"
:disabled=
"apear!='couponAdd'"
>
无限制
</el-radio>
<el-radio
v-model=
"editForm.
useB
arriers"
label=
"1"
:disabled=
"apear!='couponAdd'"
>
无限制
</el-radio>
<el-radio
v-model=
"editForm.
barriers"
label=
"2"
:disabled=
"apear!='couponAdd' || editForm.way
== 2"
>
<el-radio
v-model=
"editForm.
useBarriers"
label=
"2"
:disabled=
"apear!='couponAdd' || editForm.useChannel
== 2"
>
<el-form-item
prop=
"full"
>
<el-form-item
prop=
"full"
>
订单满
<el-input
v-model=
"editForm.full"
placeholder=
"输入金额(元)"
style=
"width: 110px;"
:disabled=
"apear!='couponAdd'|| editForm.
b
arriers != 2"
/>
元可用
订单满
<el-input
v-model=
"editForm.full"
placeholder=
"输入金额(元)"
style=
"width: 110px;"
:disabled=
"apear!='couponAdd'|| editForm.
useB
arriers != 2"
/>
元可用
</el-form-item>
</el-form-item>
</el-radio>
</el-radio>
</
template
>
</
template
>
...
@@ -46,10 +48,21 @@
...
@@ -46,10 +48,21 @@
<span
style=
"color:red;margin-left:15px"
v-if=
"priceFlag"
>
存在零售价低于代金券的商品
</span>
<span
style=
"color:red;margin-left:15px"
v-if=
"priceFlag"
>
存在零售价低于代金券的商品
</span>
</
template
>
</
template
>
<
template
slot=
"goodsHtml"
>
<
template
slot=
"goodsHtml"
>
<el-radio
v-model=
"editForm.goods"
label=
"1"
:disabled=
"apear!='couponAdd'"
>
全部商品可用
</el-radio>
<el-radio
v-model=
"editForm.goods"
label=
"1"
v-if=
"apear=='couponAdd'"
>
全部商品可用
</el-radio>
<el-radio
v-model=
"editForm.goods"
label=
"2"
:disabled=
"apear!='couponAdd'"
>
指定商品可用
</el-radio><br>
<el-radio
v-model=
"editForm.goods"
label=
"2"
v-if=
"apear=='couponAdd'"
>
指定商品可用
<el-button
type=
"primary"
v-if=
"editForm.goods == 2"
@
click=
"chooseGoods"
>
选择商品
</el-button>
<el-button
type=
"primary"
v-if=
"editForm.goods == 2"
@
click=
"chooseGoods"
>
选择商品
</el-button>
</el-radio>
</
template
>
</
template
>
<div
slot=
"proTable"
class=
"select-pro"
>
<GLTable
v-show=
"editForm.goodsRefList.length"
:hasPage=
"false"
:tableParams=
"tableParams"
:tableData=
"editForm.goodsRefList"
>
<
template
slot=
"goodsImage"
slot-scope=
"scope"
>
<img
class=
"img-60"
:src=
"scope.scope.goodsImage"
/>
</
template
>
<span
slot=
"auth-button"
slot-scope=
"scope"
>
<el-button
type=
"text"
@
click=
"handleProDelete(scope)"
>
删除
</el-button>
</span>
</GLTable>
</div>
<
template
slot=
"useDescriptionHtml"
>
<
template
slot=
"useDescriptionHtml"
>
<el-input
type=
"textarea"
v-model=
"editForm.useDescription"
style=
"width: 308px"
:autosize=
"
{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" />
<el-input
type=
"textarea"
v-model=
"editForm.useDescription"
style=
"width: 308px"
:autosize=
"
{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" />
</
template
>
</
template
>
...
@@ -60,8 +73,8 @@
...
@@ -60,8 +73,8 @@
<el-button
type=
"default"
v-if=
"apear!='couponSee'"
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
type=
"default"
v-if=
"apear!='couponSee'"
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
type=
"default"
v-if=
"apear=='couponSee'"
@
click=
"handleCancel"
>
返回
</el-button>
<el-button
type=
"default"
v-if=
"apear=='couponSee'"
@
click=
"handleCancel"
>
返回
</el-button>
</div>
</div>
<select-muti-pro-dialog
v-if=
"isMutiSelectVisible"
:isMutiSelectVisible=
"isMutiSelectVisible"
:searchForm=
"searchProForm"
:selectedProList=
"selectedProList"
@
handleMutiSelectConfirm=
"handleMutiSelectConfirm"
@
handleMutiSelectClose=
"handleMutiSelectClose"
>
<select-muti-pro-
forcoupon-
dialog
v-if=
"isMutiSelectVisible"
:isMutiSelectVisible=
"isMutiSelectVisible"
:searchForm=
"searchProForm"
:selectedProList=
"selectedProList"
@
handleMutiSelectConfirm=
"handleMutiSelectConfirm"
@
handleMutiSelectClose=
"handleMutiSelectClose"
>
<
template
slot=
"search"
>
<
!-- <
template slot="search">
<div class="flex">
<div class="flex">
<el-form :inline="true" :model="searchProForm">
<el-form :inline="true" :model="searchProForm">
<el-form-item label="商品名称:">
<el-form-item label="商品名称:">
...
@@ -73,12 +86,13 @@
...
@@ -73,12 +86,13 @@
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</div>
</div>
</
template
>
</template>
-->
</select-muti-pro-dialog>
</select-muti-pro-
forcoupon-
dialog>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
{
limitPrice
}
from
'@/common/constant'
export
default
{
export
default
{
name
:
'editCashCoupon'
,
name
:
'editCashCoupon'
,
data
()
{
data
()
{
...
@@ -105,20 +119,43 @@ export default {
...
@@ -105,20 +119,43 @@ export default {
isMutiSelectVisible
:
false
,
isMutiSelectVisible
:
false
,
editForm
:
{
editForm
:
{
couponName
:
''
,
couponName
:
''
,
way
:
'1'
,
useChannel
:
'1'
,
effectiveType
:
'3'
,
effectiveType
:
'3'
,
barriers
:
'1'
,
effectiveDays
:
''
,
goods
:
'1'
useBarriers
:
'1'
,
goods
:
'1'
,
goodsRefList
:
[],
},
//商品列表
tableParams
:
{
tableOption
:
true
,
tableColumns
:
[
{
label
:
'缩略图'
,
prop
:
'goodsImage'
,
addHtml
:
'goodsImage'
},
{
label
:
'商品名称'
,
prop
:
'goodsName'
},
{
label
:
'零售价(元)'
,
prop
:
'retailPrice'
}
]
},
},
searchProForm
:
{
searchProForm
:
{
name
:
''
name
:
''
},
},
selectedAllProList
:
[],
selectedProList
:
[],
editRule
:
{
editRule
:
{
couponName
:
[{
required
:
true
,
message
:
'请输入优惠券名称'
,
trigger
:
'change'
}],
couponName
:
[{
required
:
true
,
message
:
'请输入优惠券名称'
,
trigger
:
'change'
}],
effectiveType
:
[{
required
:
true
,
message
:
'请选择有效期'
,
trigger
:
'change'
}],
effectiveType
:
[{
required
:
true
,
message
:
'请选择有效期'
,
trigger
:
'change'
}],
effectiveTime
:
[{
required
:
true
,
message
:
'有效期不能为空'
,
trigger
:
'change'
}],
effectiveTime
:
[{
required
:
true
,
message
:
'有效期不能为空'
,
trigger
:
'change'
}],
effectiveDays
:
[{
required
:
true
,
message
:
'有效天数不能为空'
,
trigger
:
'blur'
}],
effectiveDays
:
[{
required
:
true
,
message
:
'有效天数不能为空'
,
trigger
:
'blur'
}],
b
arriers
:
[{
required
:
true
,
message
:
'请选择使用限制'
,
trigger
:
'change'
}],
useB
arriers
:
[{
required
:
true
,
message
:
'请选择使用限制'
,
trigger
:
'change'
}],
full
:
[{
required
:
true
,
message
:
'门槛数值不能为空'
,
trigger
:
'blur'
}],
full
:
[{
required
:
true
,
message
:
'门槛数值不能为空'
,
trigger
:
'blur'
}],
denomination
:
[{
required
:
true
,
message
:
'面值不能为空'
,
trigger
:
'change'
}],
denomination
:
[{
required
:
true
,
message
:
'面值不能为空'
,
trigger
:
'change'
}],
stock
:
[{
required
:
true
,
message
:
'库存不能为空'
,
trigger
:
'change'
}],
stock
:
[{
required
:
true
,
message
:
'库存不能为空'
,
trigger
:
'change'
}],
...
@@ -135,8 +172,8 @@ export default {
...
@@ -135,8 +172,8 @@ export default {
},
},
{
{
label
:
'使用途径'
,
label
:
'使用途径'
,
name
:
'
ways
'
,
name
:
'
useChannel
'
,
addHtml
:
'
ways
Html'
addHtml
:
'
useChannel
Html'
},
},
{
{
label
:
'有效期'
,
label
:
'有效期'
,
...
@@ -145,8 +182,8 @@ export default {
...
@@ -145,8 +182,8 @@ export default {
},
},
{
{
label
:
'使用限制'
,
label
:
'使用限制'
,
name
:
'
b
arriers'
,
name
:
'
useB
arriers'
,
addHtml
:
'
b
arriersHtml'
addHtml
:
'
useB
arriersHtml'
},
},
// {
// {
// label: '面值',
// label: '面值',
...
@@ -180,6 +217,11 @@ export default {
...
@@ -180,6 +217,11 @@ export default {
addHtml
:
'goodsHtml'
addHtml
:
'goodsHtml'
},
},
{
{
// label: '门店',
name
:
''
,
addHtml
:
'proTable'
},
{
label
:
'使用说明'
,
label
:
'使用说明'
,
name
:
'useDescription'
,
name
:
'useDescription'
,
addHtml
:
'useDescriptionHtml'
addHtml
:
'useDescriptionHtml'
...
@@ -193,8 +235,8 @@ export default {
...
@@ -193,8 +235,8 @@ export default {
this
.
footerWidth
=
document
.
documentElement
.
clientWidth
-
this
.
footerLeft
this
.
footerWidth
=
document
.
documentElement
.
clientWidth
-
this
.
footerLeft
this
.
routeInfo
=
this
.
$route
.
params
this
.
routeInfo
=
this
.
$route
.
params
// this.title = this.titleObj[this.routeInfo.addOrEdit]
// this.title = this.titleObj[this.routeInfo.addOrEdit]
this
.
routeInfo
.
addOrEdit
!=
1
?
this
.
getInfo
()
:
''
this
.
getAllGoods
()
this
.
getAllGoods
()
this
.
routeInfo
.
addOrEdit
!=
1
?
this
.
getInfo
()
:
''
var
id
=
this
.
routeInfo
.
id
var
id
=
this
.
routeInfo
.
id
var
addOrEdit
=
this
.
routeInfo
.
addOrEdit
var
addOrEdit
=
this
.
routeInfo
.
addOrEdit
if
(
id
)
{
if
(
id
)
{
...
@@ -205,12 +247,43 @@ export default {
...
@@ -205,12 +247,43 @@ export default {
this
.
apear
=
'couponEdit'
;
this
.
apear
=
'couponEdit'
;
this
.
title
=
'编辑'
;
this
.
title
=
'编辑'
;
}
}
this
.
editFormData
[
0
].
isDisabled
=
true
this
.
editFormData
[
5
].
isDisabled
=
true
}
else
{
}
else
{
this
.
apear
=
'couponAdd'
;
this
.
apear
=
'couponAdd'
;
this
.
title
=
'创建'
;
this
.
title
=
'创建'
;
}
}
},
},
watch
:
{
'editForm.effectiveDays'
(
newValue
,
oldValue
){
this
.
editForm
.
effectiveDays
=
limitPrice
(
newValue
,
oldValue
,
3
,
0
)
},
'editForm.full'
(
newValue
,
oldValue
){
this
.
editForm
.
full
=
limitPrice
(
newValue
,
oldValue
,
5
,
2
)
},
'editForm.denomination'
(
newValue
,
oldValue
){
this
.
editForm
.
denomination
=
limitPrice
(
newValue
,
oldValue
,
3
,
0
,
0
,
100
)
},
'editForm.stock'
(
newValue
,
oldValue
){
this
.
editForm
.
stock
=
limitPrice
(
newValue
,
oldValue
,
6
,
0
,
1
)
}
// $scope.couponTime = ''
// $scope.$watch('effectiveTime', function(n, o) {
// if (n) {
// $scope.couponTime = setDateString(n.startDate, true) + '-' + setDateString(n.endDate, true)
// console.log($scope.couponTime)
// }
// })
// $scope.remarksView = []
// $scope.$watch('remarks', function(n, o) {
// console.log(n, o)
// if (n) {
// $scope.remarksView = n.split('\n')
// }
// })
},
methods
:
{
methods
:
{
getAllGoods
(
goodsName
){
getAllGoods
(
goodsName
){
...
@@ -227,6 +300,7 @@ export default {
...
@@ -227,6 +300,7 @@ export default {
}
}
this
.
$apis
.
couponManage
.
getAllGoodsApi
(
params
).
then
(
res
=>
{
this
.
$apis
.
couponManage
.
getAllGoodsApi
(
params
).
then
(
res
=>
{
const
goods
=
this
.
$common
.
utils
.
deepClone
(
res
.
list
)
const
goods
=
this
.
$common
.
utils
.
deepClone
(
res
.
list
)
this
.
selectedAllProList
=
goods
if
(
goods
&&
goods
.
length
>
0
){
if
(
goods
&&
goods
.
length
>
0
){
this
.
minPirce
=
goods
[
0
].
retailPrice
this
.
minPirce
=
goods
[
0
].
retailPrice
goods
.
forEach
((
item
,
index
)
=>
{
goods
.
forEach
((
item
,
index
)
=>
{
...
@@ -243,19 +317,20 @@ export default {
...
@@ -243,19 +317,20 @@ export default {
//选择商品
//选择商品
chooseGoods
(){
chooseGoods
(){
this
.
isMutiSelectVisible
=
!
this
.
isMutiSelectVisible
this
.
selectedProList
=
this
.
$common
.
utils
.
deepClone
(
this
.
editForm
.
goodsRefList
)
this
.
handleMutiSelectClose
()
},
},
handleConfigSearch
(){
//
handleConfigSearch(){
this
.
getAllGoods
(
this
.
searchProForm
.
name
)
//
this.getAllGoods(this.searchProForm.name)
},
//
},
handleConfigReset
(){
//
handleConfigReset(){
this
.
getAllGoods
()
//
this.getAllGoods()
},
//
},
handleMutiSelectConfirm
(
selectedData
)
{
handleMutiSelectConfirm
(
selectedData
)
{
//
this.editForm.goodsRefList = selectedData
this
.
editForm
.
goodsRefList
=
selectedData
this
.
handleMutiSelectClose
()
this
.
handleMutiSelectClose
()
},
},
...
@@ -263,6 +338,20 @@ export default {
...
@@ -263,6 +338,20 @@ export default {
this
.
isMutiSelectVisible
=
!
this
.
isMutiSelectVisible
this
.
isMutiSelectVisible
=
!
this
.
isMutiSelectVisible
},
},
handleProDelete
(
obj
)
{
this
.
$messageBox
.
confirm
(
'是否删除该商品?'
,
'删除'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'error'
,
callback
:
action
=>
{
if
(
action
==
'confirm'
)
{
var
idx
=
this
.
editForm
.
goodsRefList
.
findIndex
(
item
=>
item
.
id
==
obj
.
scope
.
id
)
this
.
editForm
.
goodsRefList
.
splice
(
idx
,
1
)
}
}
})
},
denominationBlur
(
event
){
denominationBlur
(
event
){
if
(
event
.
target
.
value
*
100
>
this
.
minPirce
){
if
(
event
.
target
.
value
*
100
>
this
.
minPirce
){
this
.
priceFlag
=
true
this
.
priceFlag
=
true
...
@@ -272,19 +361,33 @@ export default {
...
@@ -272,19 +361,33 @@ export default {
},
},
getInfo
()
{
getInfo
()
{
// this.$apis.zoneList.getZoneInfoApi({ id: this.routeInfo.id }).then(res => {
this
.
$apis
.
couponManage
.
getCouponDetailApi
({
couponId
:
this
.
routeInfo
.
id
}).
then
(
res
=>
{
// this.editForm.zoneName = res.zoneName
console
.
log
(
res
);
// this.editForm.zoneImg = res.zoneImg
this
.
editForm
=
this
.
$common
.
utils
.
deepClone
(
res
)
// this.editForm.merchantList = res.merchantRefList
this
.
editForm
.
useChannel
=
this
.
editForm
.
useChannel
+
''
// this.editForm.merchantList.forEach(item => {
this
.
editForm
.
effectiveType
=
this
.
editForm
.
effectiveType
+
''
// item.merchantNo = item.merchantId
this
.
editForm
.
useBarriers
=
this
.
editForm
.
useBarriers
+
''
// })
// })
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if
(
this
.
editForm
.
effectiveType
==
2
)
{
this
.
editForm
.
effectiveTime
=
[
this
.
editForm
.
effectiveStartTime
,
this
.
editForm
.
effectiveEndTime
]
}
this
.
editForm
.
goodsRefList
=
[]
if
(
this
.
editForm
.
goodsIds
&&
this
.
editForm
.
goodsIds
.
length
>
0
){
this
.
editForm
.
goodsIds
.
forEach
((
goodsId
,
index
)
=>
{
var
good
=
this
.
selectedAllProList
.
find
(
item
=>
item
.
id
==
goodsId
)
good
.
retailPrice
=
(
good
.
retailPrice
/
100
).
toFixed
(
2
)
this
.
editForm
.
goodsRefList
.
push
(
good
)
})
}
this
.
tableParams
.
tableOption
=
false
})
},
},
//选择到店核销使用限制默认无使用门槛
//选择到店核销使用限制默认无使用门槛
click
Way
(){
click
UseChannel
(){
this
.
editForm
.
b
arriers
=
'1'
this
.
editForm
.
useB
arriers
=
'1'
},
},
validateRules
(){
validateRules
(){
...
@@ -299,11 +402,16 @@ export default {
...
@@ -299,11 +402,16 @@ export default {
}
else
{
}
else
{
this
.
editRule
.
effectiveDays
[
0
].
required
=
false
this
.
editRule
.
effectiveDays
[
0
].
required
=
false
}
}
if
(
form
.
b
arriers
==
'2'
){
//判断 使用限制-订单满多少可用是否验证
if
(
form
.
useB
arriers
==
'2'
){
//判断 使用限制-订单满多少可用是否验证
this
.
editRule
.
full
[
0
].
required
=
true
this
.
editRule
.
full
[
0
].
required
=
true
}
else
{
}
else
{
this
.
editRule
.
full
[
0
].
required
=
false
this
.
editRule
.
full
[
0
].
required
=
false
}
}
if
(
this
.
apear
==
'couponAdd'
){
this
.
editRule
.
goods
[
0
].
required
=
true
}
else
{
this
.
editRule
.
goods
[
0
].
required
=
false
}
},
},
getCouponInfoParams
()
{
getCouponInfoParams
()
{
...
@@ -318,6 +426,8 @@ export default {
...
@@ -318,6 +426,8 @@ export default {
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj
.
discountType
=
'3'
;
obj
.
discountType
=
'3'
;
obj
.
useChannel
=
form
.
useChannel
//有效期
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj
.
effectiveType
=
form
.
effectiveType
obj
.
effectiveType
=
form
.
effectiveType
...
@@ -333,8 +443,8 @@ export default {
...
@@ -333,8 +443,8 @@ export default {
}
}
//使用限制 1:无限制 2:满减
//使用限制 1:无限制 2:满减
obj
.
useBarriers
=
form
.
b
arriers
obj
.
useBarriers
=
form
.
useB
arriers
if
(
form
.
b
arriers
==
2
)
{
if
(
form
.
useB
arriers
==
2
)
{
//满多少减
//满多少减
obj
.
full
=
form
.
full
;
obj
.
full
=
form
.
full
;
}
}
...
@@ -347,6 +457,13 @@ export default {
...
@@ -347,6 +457,13 @@ export default {
obj
.
useType
=
1
obj
.
useType
=
1
//有效期或者间隔天数使用次数
//有效期或者间隔天数使用次数
obj
.
useAmount
=
1
obj
.
useAmount
=
1
//适用商品
if
(
form
.
goods
==
1
){
//全部商品
obj
.
goodsIdList
=
this
.
selectedAllProList
.
length
?
this
.
selectedAllProList
.
map
(
item
=>
item
.
id
)
:
[]
}
else
{
//指定商品
obj
.
goodsIdList
=
form
.
goodsRefList
.
length
?
form
.
goodsRefList
.
map
(
item
=>
item
.
id
)
:
[]
}
}
}
//使用描述
//使用描述
obj
.
useDescription
=
form
.
useDescription
;
obj
.
useDescription
=
form
.
useDescription
;
...
@@ -357,23 +474,33 @@ export default {
...
@@ -357,23 +474,33 @@ export default {
this
.
validateRules
()
this
.
validateRules
()
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
if
(
this
.
priceFlag
){
//存在零售价低于代金券的商品
return
}
var
params
=
this
.
getCouponInfoParams
()
var
params
=
this
.
getCouponInfoParams
()
console
.
log
(
params
);
console
.
log
(
params
);
if
(
this
.
apear
==
'couponAdd'
&&
!
params
.
goodsIdList
.
length
){
this
.
$message
({
message
:
'未选择商品'
,
type
:
'error'
})
return
}
let
method
=
''
let
method
=
''
if
(
params
.
couponId
){
if
(
params
.
couponId
){
method
=
'updateCouponApi'
//后台修改优惠券
method
=
'updateCouponApi'
//后台修改优惠券
}
else
{
}
else
{
method
=
'createCouponApi'
//后台创建优惠券
method
=
'createCouponApi'
//后台创建优惠券
}
}
//
this.$apis.couponManage[method](params).then(res => {
this
.
$apis
.
couponManage
[
method
](
params
).
then
(
res
=>
{
//
this.$message({
this
.
$message
({
//
message: res.code == '0' ? '操作成功' : '操作失败',
message
:
res
.
code
==
'0'
?
'操作成功'
:
'操作失败'
,
//
type: res.code == '0' ? 'success' : 'error'
type
:
res
.
code
==
'0'
?
'success'
:
'error'
//
})
})
//
if (res.code == '0') {
if
(
res
.
code
==
'0'
)
{
//
this.handleCancel()
this
.
handleCancel
()
//
}
}
//
})
})
}
}
})
})
},
},
...
...
src/views/couponManage/editDiscountCoupon.vue
0 → 100644
View file @
ff97316
<!-- 编辑代金券 -->
<
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=
"effectiveHtml"
>
<el-radio
v-model=
"editForm.effectiveType"
label=
"2"
:disabled=
"apear!='couponAdd'"
>
<el-form-item
prop=
"effectiveTime"
>
<el-date-picker
v-model=
"editForm.effectiveTime"
type=
"daterange"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
value-format=
"yyyy-MM-dd"
:disabled=
"editForm.effectiveType != 2||apear!='couponAdd'"
clearable
>
</el-date-picker>
</el-form-item>
</el-radio><br>
<el-radio
v-model=
"editForm.effectiveType"
label=
"1"
:disabled=
"apear!='couponAdd'"
>
<el-form-item
prop=
"effectiveDays"
>
领取后
<el-input
v-model=
"editForm.effectiveDays"
style=
"width: 100px;"
:disabled=
"apear!='couponAdd'|| editForm.effectiveType != 1"
/>
天内有效
</el-form-item>
</el-radio>
</
template
>
<
template
slot=
"useDescriptionHtml"
>
<el-input
type=
"textarea"
v-model=
"editForm.useDescription"
style=
"width: 308px"
:autosize=
"
{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" />
</
template
>
</glsx-combi-form>
</div>
<div
class=
"footer"
:style=
"{ left: footerLeft + 'px', width: footerWidth + 'px' }"
>
<el-button
type=
"primary"
v-if=
"apear!='couponSee'"
@
click=
"handleConfirm"
>
确定
</el-button>
<el-button
type=
"default"
v-if=
"apear!='couponSee'"
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
type=
"default"
v-if=
"apear=='couponSee'"
@
click=
"handleCancel"
>
返回
</el-button>
</div>
</div>
</template>
<
script
>
import
{
limitPrice
}
from
'@/common/constant'
export
default
{
name
:
'editDiscountCoupon'
,
data
()
{
return
{
size
:
'small'
,
title
:
'创建'
,
titleObj
:
{
1
:
'创建晒单'
,
2
:
'编辑晒单'
},
footerLeft
:
'0'
,
footerWidth
:
'0'
,
editChildRef
:
'editChildRef'
,
// pickerOptions: {
// disabledDate(v) {//禁用当前之前的日期
// return v.getTime() < new Date().getTime() - 86400000;
// },
// disabledDate(time) {//禁用当前之后的日期
// return time.getTime() > Date.now() - 8.64e6
// }
// },
routeInfo
:
{
// 1-新增;2-编辑;3-查看
addOrEdit
:
1
,
id
:
''
},
apear
:
''
,
isDisabled
:
true
,
editForm
:
{
couponName
:
''
,
effectiveType
:
'2'
,
},
editRule
:
{
couponName
:
[{
required
:
true
,
message
:
'请输入优惠券名称'
,
trigger
:
'change'
}],
effectiveType
:
[{
required
:
true
,
message
:
'请选择有效期'
,
trigger
:
'change'
}],
effectiveTime
:
[{
required
:
true
,
message
:
'有效期不能为空'
,
trigger
:
'change'
}],
effectiveDays
:
[{
required
:
true
,
message
:
'有效天数不能为空'
,
trigger
:
'blur'
}],
useDescription
:
[{
required
:
true
,
message
:
'使用说明不能为空'
,
trigger
:
'change'
}],
stock
:
[{
required
:
true
,
message
:
'发放数量不能为空'
,
trigger
:
'change'
}],
},
editFormData
:
[
{
label
:
'优惠券名称'
,
name
:
'couponName'
,
width
:
'320px'
,
type
:
'input'
,
maxlength
:
20
},
{
label
:
'发放数量'
,
name
:
'stock'
,
width
:
'180px'
,
type
:
'input'
,
append
:
'张'
,
},
{
label
:
'有效期'
,
name
:
'effectiveType'
,
addHtml
:
'effectiveHtml'
},
{
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
=
'couponSee'
;
this
.
title
=
'查看'
;
}
else
if
(
addOrEdit
==
2
){
this
.
apear
=
'couponEdit'
;
this
.
title
=
'编辑'
;
}
this
.
isDisabled
=
true
this
.
editFormData
[
0
].
isDisabled
=
this
.
isDisabled
this
.
editFormData
[
1
].
isDisabled
=
this
.
isDisabled
}
else
{
this
.
apear
=
'couponAdd'
;
this
.
title
=
'创建'
;
this
.
isDisabled
=
false
}
},
watch
:
{
'editForm.effectiveDays'
(
newValue
,
oldValue
){
this
.
editForm
.
effectiveDays
=
limitPrice
(
newValue
,
oldValue
,
3
,
0
)
},
'editForm.stock'
(
newValue
,
oldValue
){
this
.
editForm
.
stock
=
limitPrice
(
newValue
,
oldValue
,
6
,
0
,
1
)
}
},
methods
:
{
getInfo
()
{
this
.
$apis
.
couponManage
.
getCouponDetailApi
({
couponId
:
this
.
routeInfo
.
id
}).
then
(
res
=>
{
console
.
log
(
res
);
this
.
editForm
=
this
.
$common
.
utils
.
deepClone
(
res
)
this
.
editForm
.
effectiveType
=
this
.
editForm
.
effectiveType
+
''
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if
(
this
.
editForm
.
effectiveType
==
2
)
{
this
.
editForm
.
effectiveTime
=
[
this
.
editForm
.
effectiveStartTime
,
this
.
editForm
.
effectiveEndTime
]
}
})
},
validateRules
(){
var
form
=
this
.
editForm
if
(
form
.
effectiveType
==
'2'
){
//判断 有效期-日期选择是否验证
this
.
editRule
.
effectiveTime
[
0
].
required
=
true
}
else
{
this
.
editRule
.
effectiveTime
[
0
].
required
=
false
}
if
(
form
.
effectiveType
==
'1'
){
//判断 有效期-有效天数是否验证
this
.
editRule
.
effectiveDays
[
0
].
required
=
true
}
else
{
this
.
editRule
.
effectiveDays
[
0
].
required
=
false
}
},
getCouponInfoParams
()
{
var
obj
=
{};
var
id
=
this
.
routeInfo
.
id
var
form
=
this
.
$common
.
utils
.
deepClone
(
this
.
editForm
)
if
(
id
)
{
obj
.
couponId
=
id
;
}
else
{
//编辑时只允许编辑使用说明
//优惠券名称
obj
.
couponName
=
form
.
couponName
;
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj
.
discountType
=
'2'
;
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj
.
effectiveType
=
form
.
effectiveType
if
(
form
.
effectiveType
==
1
)
{
//固定天数
obj
.
effectiveDays
=
form
.
effectiveDays
;
}
else
if
(
form
.
effectiveType
==
2
)
{
//时间段
const
d
=
form
.
effectiveTime
if
(
d
&&
d
.
length
>
0
)
{
obj
.
effectiveStartTime
=
d
[
0
]
+
' 00:00:00'
;
obj
.
effectiveEndTime
=
d
[
1
]
+
' 23:59:59'
;
}
}
//库存
obj
.
stock
=
form
.
stock
;
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj
.
useType
=
1
//有效期或者间隔天数使用次数
obj
.
useAmount
=
1
}
//使用描述
obj
.
useDescription
=
form
.
useDescription
;
return
obj
;
},
handleConfirm
()
{
this
.
validateRules
()
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
if
(
valid
)
{
var
params
=
this
.
getCouponInfoParams
()
console
.
log
(
params
);
let
method
=
''
if
(
params
.
couponId
){
method
=
'updateCouponApi'
//后台修改优惠券
}
else
{
method
=
'createCouponApi'
//后台创建优惠券
}
this
.
$apis
.
couponManage
[
method
](
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
:
'/couponManage/index'
})
}
}
}
</
script
>
<
style
scoped
></
style
>
src/views/couponManage/editExchangeCoupon.vue
0 → 100644
View file @
ff97316
<!-- 编辑代金券 -->
<
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=
"effectiveHtml"
>
<el-radio
v-model=
"editForm.effectiveType"
label=
"2"
:disabled=
"apear!='couponAdd'"
>
<el-form-item
prop=
"effectiveTime"
>
<el-date-picker
v-model=
"editForm.effectiveTime"
type=
"daterange"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
value-format=
"yyyy-MM-dd"
:disabled=
"editForm.effectiveType != 2||apear!='couponAdd'"
clearable
>
</el-date-picker>
</el-form-item>
</el-radio><br>
<el-radio
v-model=
"editForm.effectiveType"
label=
"1"
:disabled=
"apear!='couponAdd'"
>
<el-form-item
prop=
"effectiveDays"
>
领取后
<el-input
v-model=
"editForm.effectiveDays"
style=
"width: 100px;"
:disabled=
"apear!='couponAdd'|| editForm.effectiveType != 1"
/>
天内有效
</el-form-item>
</el-radio>
</
template
>
<
template
slot=
"useDescriptionHtml"
>
<el-input
type=
"textarea"
v-model=
"editForm.useDescription"
style=
"width: 308px"
:autosize=
"
{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" />
</
template
>
</glsx-combi-form>
</div>
<div
class=
"footer"
:style=
"{ left: footerLeft + 'px', width: footerWidth + 'px' }"
>
<el-button
type=
"primary"
v-if=
"apear!='couponSee'"
@
click=
"handleConfirm"
>
确定
</el-button>
<el-button
type=
"default"
v-if=
"apear!='couponSee'"
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
type=
"default"
v-if=
"apear=='couponSee'"
@
click=
"handleCancel"
>
返回
</el-button>
</div>
</div>
</template>
<
script
>
import
{
limitPrice
}
from
'@/common/constant'
export
default
{
name
:
'editDiscountCoupon'
,
data
()
{
return
{
size
:
'small'
,
title
:
'创建'
,
titleObj
:
{
1
:
'创建晒单'
,
2
:
'编辑晒单'
},
footerLeft
:
'0'
,
footerWidth
:
'0'
,
editChildRef
:
'editChildRef'
,
// pickerOptions: {
// disabledDate(v) {//禁用当前之前的日期
// return v.getTime() < new Date().getTime() - 86400000;
// },
// disabledDate(time) {//禁用当前之后的日期
// return time.getTime() > Date.now() - 8.64e6
// }
// },
routeInfo
:
{
// 1-新增;2-编辑;3-查看
addOrEdit
:
1
,
id
:
''
},
apear
:
''
,
isDisabled
:
true
,
editForm
:
{
couponName
:
''
,
effectiveType
:
'2'
,
},
editRule
:
{
couponName
:
[{
required
:
true
,
message
:
'请输入优惠券名称'
,
trigger
:
'change'
}],
effectiveType
:
[{
required
:
true
,
message
:
'请选择有效期'
,
trigger
:
'change'
}],
effectiveTime
:
[{
required
:
true
,
message
:
'有效期不能为空'
,
trigger
:
'change'
}],
effectiveDays
:
[{
required
:
true
,
message
:
'有效天数不能为空'
,
trigger
:
'blur'
}],
useDescription
:
[{
required
:
true
,
message
:
'使用说明不能为空'
,
trigger
:
'change'
}],
stock
:
[{
required
:
true
,
message
:
'发放数量不能为空'
,
trigger
:
'change'
}],
},
editFormData
:
[
{
label
:
'优惠券名称'
,
name
:
'couponName'
,
width
:
'320px'
,
type
:
'input'
,
maxlength
:
20
},
{
label
:
'发放数量'
,
name
:
'stock'
,
width
:
'180px'
,
type
:
'input'
,
append
:
'张'
,
},
{
label
:
'有效期'
,
name
:
'effectiveType'
,
addHtml
:
'effectiveHtml'
},
{
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
=
'couponSee'
;
this
.
title
=
'查看'
;
}
else
if
(
addOrEdit
==
2
){
this
.
apear
=
'couponEdit'
;
this
.
title
=
'编辑'
;
}
this
.
isDisabled
=
true
this
.
editFormData
[
0
].
isDisabled
=
this
.
isDisabled
this
.
editFormData
[
1
].
isDisabled
=
this
.
isDisabled
}
else
{
this
.
apear
=
'couponAdd'
;
this
.
title
=
'创建'
;
this
.
isDisabled
=
false
}
},
watch
:
{
'editForm.effectiveDays'
(
newValue
,
oldValue
){
this
.
editForm
.
effectiveDays
=
limitPrice
(
newValue
,
oldValue
,
3
,
0
)
},
'editForm.stock'
(
newValue
,
oldValue
){
this
.
editForm
.
stock
=
limitPrice
(
newValue
,
oldValue
,
6
,
0
,
1
)
}
},
methods
:
{
getInfo
()
{
this
.
$apis
.
couponManage
.
getCouponDetailApi
({
couponId
:
this
.
routeInfo
.
id
}).
then
(
res
=>
{
console
.
log
(
res
);
this
.
editForm
=
this
.
$common
.
utils
.
deepClone
(
res
)
this
.
editForm
.
effectiveType
=
this
.
editForm
.
effectiveType
+
''
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if
(
this
.
editForm
.
effectiveType
==
2
)
{
this
.
editForm
.
effectiveTime
=
[
this
.
editForm
.
effectiveStartTime
,
this
.
editForm
.
effectiveEndTime
]
}
})
},
validateRules
(){
var
form
=
this
.
editForm
if
(
form
.
effectiveType
==
'2'
){
//判断 有效期-日期选择是否验证
this
.
editRule
.
effectiveTime
[
0
].
required
=
true
}
else
{
this
.
editRule
.
effectiveTime
[
0
].
required
=
false
}
if
(
form
.
effectiveType
==
'1'
){
//判断 有效期-有效天数是否验证
this
.
editRule
.
effectiveDays
[
0
].
required
=
true
}
else
{
this
.
editRule
.
effectiveDays
[
0
].
required
=
false
}
},
getCouponInfoParams
()
{
var
obj
=
{};
var
id
=
this
.
routeInfo
.
id
var
form
=
this
.
$common
.
utils
.
deepClone
(
this
.
editForm
)
if
(
id
)
{
obj
.
couponId
=
id
;
}
else
{
//编辑时只允许编辑使用说明
//优惠券名称
obj
.
couponName
=
form
.
couponName
;
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj
.
discountType
=
'4'
;
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj
.
effectiveType
=
form
.
effectiveType
if
(
form
.
effectiveType
==
1
)
{
//固定天数
obj
.
effectiveDays
=
form
.
effectiveDays
;
}
else
if
(
form
.
effectiveType
==
2
)
{
//时间段
const
d
=
form
.
effectiveTime
if
(
d
&&
d
.
length
>
0
)
{
obj
.
effectiveStartTime
=
d
[
0
]
+
' 00:00:00'
;
obj
.
effectiveEndTime
=
d
[
1
]
+
' 23:59:59'
;
}
}
//库存
obj
.
stock
=
form
.
stock
;
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj
.
useType
=
1
//有效期或者间隔天数使用次数
obj
.
useAmount
=
1
}
//使用描述
obj
.
useDescription
=
form
.
useDescription
;
return
obj
;
},
handleConfirm
()
{
this
.
validateRules
()
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
if
(
valid
)
{
var
params
=
this
.
getCouponInfoParams
()
console
.
log
(
params
);
let
method
=
''
if
(
params
.
couponId
){
method
=
'updateCouponApi'
//后台修改优惠券
}
else
{
method
=
'createCouponApi'
//后台创建优惠券
}
this
.
$apis
.
couponManage
[
method
](
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
:
'/couponManage/index'
})
}
}
}
</
script
>
<
style
scoped
></
style
>
src/views/couponManage/editMemberService.vue
View file @
ff97316
...
@@ -58,6 +58,7 @@
...
@@ -58,6 +58,7 @@
</template>
</template>
<
script
>
<
script
>
import
{
limitPrice
}
from
'@/common/constant'
export
default
{
export
default
{
name
:
'editCashCoupon'
,
name
:
'editCashCoupon'
,
data
()
{
data
()
{
...
@@ -180,6 +181,30 @@ export default {
...
@@ -180,6 +181,30 @@ export default {
}
}
},
},
watch
:
{
'editForm.effectiveDays'
(
newValue
,
oldValue
){
this
.
editForm
.
effectiveDays
=
limitPrice
(
newValue
,
oldValue
,
3
,
0
)
},
'editForm.usageTimes'
(
newValue
,
oldValue
){
this
.
editForm
.
usageTimes
=
limitPrice
(
newValue
,
oldValue
,
3
,
0
)
},
'editForm.useLimitDays'
(
newValue
,
oldValue
){
this
.
editForm
.
useLimitDays
=
limitPrice
(
newValue
,
oldValue
,
4
,
0
)
},
'editForm.usageTimes2'
(
newValue
,
oldValue
){
this
.
editForm
.
usageTimes2
=
limitPrice
(
newValue
,
oldValue
,
3
,
0
)
},
'editForm.vipPrice'
(
newValue
,
oldValue
){
this
.
editForm
.
vipPrice
=
limitPrice
(
newValue
,
oldValue
,
5
,
2
)
},
'editForm.shopPrice'
(
newValue
,
oldValue
){
this
.
editForm
.
shopPrice
=
limitPrice
(
newValue
,
oldValue
,
5
,
2
)
},
'editForm.stock'
(
newValue
,
oldValue
){
this
.
editForm
.
stock
=
limitPrice
(
newValue
,
oldValue
,
6
,
0
,
1
)
}
},
methods
:
{
methods
:
{
getInfo
()
{
getInfo
()
{
this
.
$apis
.
couponManage
.
getCouponDetailApi
({
couponId
:
this
.
routeInfo
.
id
}).
then
(
res
=>
{
this
.
$apis
.
couponManage
.
getCouponDetailApi
({
couponId
:
this
.
routeInfo
.
id
}).
then
(
res
=>
{
...
...
src/views/couponManage/index.vue
View file @
ff97316
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
<div
class=
"m-b-20"
>
<div
class=
"m-b-20"
>
<el-button
:size=
"size"
type=
"primary"
class=
"el-icon-plus"
@
click=
"addCashCoupon()"
>
新建代金券
</el-button>
<el-button
:size=
"size"
type=
"primary"
class=
"el-icon-plus"
@
click=
"addCashCoupon()"
>
新建代金券
</el-button>
<el-button
:size=
"size"
type=
"primary"
class=
"el-icon-plus"
@
click=
"addService()"
>
新建会员服务
</el-button>
<el-button
:size=
"size"
type=
"primary"
class=
"el-icon-plus"
@
click=
"addService()"
>
新建会员服务
</el-button>
<el-button
:size=
"size"
type=
"primary"
class=
"el-icon-plus"
@
click=
"addService()"
>
新建折扣卷
</el-button>
<el-button
:size=
"size"
type=
"primary"
class=
"el-icon-plus"
@
click=
"addDiscountCoupon()"
>
新建折扣卷
</el-button>
<el-button
:size=
"size"
type=
"primary"
class=
"el-icon-plus"
@
click=
"addExchangeCoupon()"
>
新建兑换券
</el-button>
</div>
</div>
<div
class=
"container"
>
<div
class=
"container"
>
<div>
<div>
...
@@ -29,21 +30,10 @@
...
@@ -29,21 +30,10 @@
</GLTable>
</GLTable>
<!-- 表格区域 end -->
<!-- 表格区域 end -->
</div>
</div>
<!-- 下架 -->
<glsx-dialog
title=
"下架"
:isVisible
.
sync=
"isDownVisible"
@
confirmDialog=
"handleDownConfirm"
@
closeDialog=
"handleDownClose"
>
<el-form
ref=
"downRef"
label-width=
"100px"
:rules=
"downRules"
:model=
"downForm"
>
<el-form-item
label=
"下架备注"
prop=
"offReason"
>
<el-input
:size=
"size"
v-model=
"downForm.offReason"
placeholder=
"请输入下架备注"
maxlength=
"30"
></el-input>
</el-form-item>
</el-form>
</glsx-dialog>
<!-- 分享 -->
<share-dialog
:isShareVisible=
"isShareVisible"
:shareForm=
"shareForm"
@
handleShareClose=
"handleShareClose"
></share-dialog>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
shareDialog
from
'../productGroup/components/shareDialog'
export
default
{
export
default
{
name
:
'coupon'
,
name
:
'coupon'
,
data
()
{
data
()
{
...
@@ -131,13 +121,17 @@ export default {
...
@@ -131,13 +121,17 @@ export default {
label
:
'剩余'
,
label
:
'剩余'
,
prop
:
'residueAmount'
prop
:
'residueAmount'
},
},
// {
{
// label: '使用途径',
label
:
'使用途径'
,
// name: 'useChannel',
name
:
'useChannel'
,
// formatter: cellValue => {
formatter
:
cellValue
=>
{
// return this.baseData.useChannelList.find(item => item.confId == cellValue.useChannel).confName
var
useChannel
=
''
// }
if
(
cellValue
.
useChannel
){
// },
useChannel
=
this
.
baseData
.
useChannelList
.
find
(
item
=>
item
.
confId
==
cellValue
.
useChannel
).
confName
}
return
useChannel
}
},
{
{
label
:
'优惠券状态'
,
label
:
'优惠券状态'
,
name
:
'status'
,
name
:
'status'
,
...
@@ -150,9 +144,15 @@ export default {
...
@@ -150,9 +144,15 @@ export default {
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum'
,
totalCount
:
'total'
},
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum'
,
totalCount
:
'total'
},
baseData
:
{
baseData
:
{
discountTypeList
:
[{
discountTypeList
:
[{
confId
:
'2'
,
confName
:
'折扣卷'
},{
confId
:
'3'
,
confId
:
'3'
,
confName
:
'代金券'
confName
:
'代金券'
},
{
},
{
confId
:
'4'
,
confName
:
'兑换券'
},
{
confId
:
'7'
,
confId
:
'7'
,
confName
:
'会员服务'
confName
:
'会员服务'
}],
}],
...
@@ -178,7 +178,7 @@ export default {
...
@@ -178,7 +178,7 @@ export default {
},
},
components
:
{
components
:
{
shareDialog
},
},
mounted
()
{
mounted
()
{
...
@@ -264,75 +264,34 @@ export default {
...
@@ -264,75 +264,34 @@ export default {
this
.
$router
.
push
(
'/couponManage/editMemberService/1'
)
this
.
$router
.
push
(
'/couponManage/editMemberService/1'
)
},
},
//新增折扣卷
addDiscountCoupon
()
{
console
.
log
(
'新增折扣卷'
);
this
.
$router
.
push
(
'/couponManage/editDiscountCoupon/1'
)
},
//新增兑换卷
addExchangeCoupon
()
{
console
.
log
(
'新增兑换卷'
);
this
.
$router
.
push
(
'/couponManage/editExchangeCoupon/1'
)
},
// addOrEdit:1-新增;2-编辑;3-查看
// addOrEdit:1-新增;2-编辑;3-查看
handleEdit
(
addOrEdit
,
row
)
{
handleEdit
(
addOrEdit
,
row
)
{
var
goto
=
''
var
goto
=
''
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
if
(
row
.
discountType
==
'3'
){
//代金券
if
(
row
.
discountType
==
'3'
){
//代金券
goto
=
'/couponManage/editCashCoupon/'
goto
=
'/couponManage/editCashCoupon/'
}
else
if
(
row
.
discountType
==
'7'
){
//会员服务
}
else
if
(
row
.
discountType
==
'7'
){
//会员服务
goto
=
'/couponManage/editMemberService/'
goto
=
'/couponManage/editMemberService/'
}
else
if
(
row
.
discountType
==
'2'
){
//折扣卷
goto
=
'/couponManage/editDiscountCoupon/'
}
else
if
(
row
.
discountType
==
'4'
){
//兑换券
goto
=
'/couponManage/editExchangeCoupon/'
}
}
console
.
log
(
goto
+
addOrEdit
+
'/'
+
row
.
id
);
console
.
log
(
goto
+
addOrEdit
+
'/'
+
row
.
id
);
this
.
$router
.
push
(
goto
+
addOrEdit
+
'/'
+
row
.
id
)
this
.
$router
.
push
(
goto
+
addOrEdit
+
'/'
+
row
.
id
)
},
},
// 下架通知
handleDwonNotice
(
row
)
{
this
.
$alert
(
'你带货的'
+
row
.
goodsName
+
'商品现已下架,下架原因:'
+
row
.
offReason
,
'商品下架通知'
,
{
confirmButtonText
:
'确定'
,
callback
:
action
=>
{
}
})
},
handleUpOrDown
(
row
)
{
var
title
=
row
.
goodsStatus
==
0
?
'上架'
:
'下架'
this
.
secondConfirm
(
title
,
'是否确认'
+
title
+
'该商品?'
,
'proManage'
,
'updateStatusProApi'
,
{
id
:
row
.
id
,
goodsStatus
:
row
.
goodsStatus
==
0
?
1
:
0
})
},
// 取消带货
handleTakeGood
(
row
)
{
this
.
secondConfirm
(
'取消带货'
,
'是否确认取消带货该商品?'
,
'proManage'
,
'deleteTakeProApi'
,
{
id
:
row
.
id
})
},
dwonVisibleChange
()
{
this
.
$refs
.
downRef
&&
this
.
$refs
.
downRef
.
clearValidate
()
this
.
isDownVisible
=
!
this
.
isDownVisible
},
handleDownClose
()
{
this
.
dwonVisibleChange
()
this
.
downForm
=
{
id
:
''
,
offReason
:
''
,
goodsStatus
:
0
}
},
handleDownConfirm
()
{
this
.
$refs
.
downRef
.
validate
(
valid
=>
{
if
(
valid
)
{
this
.
$apis
.
proManage
.
updateStatusProApi
(
this
.
downForm
).
then
(
res
=>
{
this
.
$message
({
message
:
res
.
code
==
'0'
?
'操作成功'
:
res
.
message
,
type
:
res
.
code
==
'0'
?
'success'
:
'error'
})
if
(
res
.
code
==
'0'
)
{
this
.
handleDownClose
()
this
.
handleSearch
()
}
})
}
})
},
// 置顶
handleTop
(
row
)
{
this
.
secondConfirm
(
'置顶'
,
'是否确认置顶该商品?'
,
'proManage'
,
'topProApi'
,
{
id
:
row
.
id
})
},
handleShare
(
row
)
{
this
.
$apis
.
proManage
.
getProShareApi
({
id
:
row
.
id
}).
then
(
res
=>
{
this
.
shareForm
=
res
this
.
handleShareClose
()
})
},
handleShareClose
()
{
this
.
isShareVisible
=
!
this
.
isShareVisible
},
getOptionsList
(
formName
,
hasAll
=
true
,
refreshSigle
)
{
getOptionsList
(
formName
,
hasAll
=
true
,
refreshSigle
)
{
if
(
refreshSigle
)
{
if
(
refreshSigle
)
{
...
...
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