Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Y
ybf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
xulili
ybf
Commits
c91edc52
Commit
c91edc52
authored
5 years ago
by
xd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优惠券完成未测试
parent
b6e580da
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
262 additions
and
84 deletions
+262
-84
voucher.js
wx_application/src/api/sidebar/voucher.js
+17
-1
changeCounter.vue
wx_application/src/views/counter/changeCounter.vue
+2
-4
addCoupon.vue
wx_application/src/views/coupon/addCoupon.vue
+143
-50
detail.vue
wx_application/src/views/coupon/detail.vue
+39
-8
list.vue
wx_application/src/views/coupon/list.vue
+39
-12
index.vue
wx_application/src/views/mainSale/active/main/index.vue
+22
-9
No files found.
wx_application/src/api/sidebar/voucher.js
View file @
c91edc52
...
...
@@ -48,3 +48,19 @@ export function getMemberListByCode(params) {
params
})
}
// 添加优惠券
export
function
addCoupon
(
data
)
{
return
requestCF
({
url
:
'/admin/auth/coupon/newCoupon'
,
method
:
'post'
,
data
:
qs
.
stringify
(
data
)
})
}
// 获取优惠券列表
export
function
getCouponList
(
params
)
{
return
requestCF
({
url
:
'/admin/auth/coupon/getAllCouponsByOyStallCode'
,
method
:
'get'
,
params
})
}
This diff is collapsed.
Click to expand it.
wx_application/src/views/counter/changeCounter.vue
View file @
c91edc52
...
...
@@ -32,8 +32,6 @@ export default {
},
created
()
{
this
.
radio
=
sessionStorage
.
getItem
(
'oyStallCode'
)
console
.
log
(
sessionStorage
.
getItem
(
'oyStallCode'
),
'切换'
);
this
.
getList
()
},
methods
:
{
...
...
@@ -61,7 +59,7 @@ export default {
sessionStorage
.
setItem
(
"barName"
,
obj
.
name
)
}
}
}
;
}
</
script
>
<
style
scoped
>
...
...
This diff is collapsed.
Click to expand it.
wx_application/src/views/coupon/addCoupon.vue
View file @
c91edc52
...
...
@@ -18,18 +18,18 @@
<div
class=
"npbr"
>
<van-field
class=
"right"
v-model=
"
startTime1
"
v-model=
"
addForm.type
"
placeholder=
"选择优惠券类型"
readonly=
"readonly"
@
click=
"
start
Show = true"
@
click=
"
type
Show = true"
/>
<van-popup
v-model=
"
start
Show"
position=
"bottom"
:overlay=
"true"
>
<van-
datetime-
picker
v-model=
"startTime"
t
ype=
"date
"
@
cancel=
"startShow = false
"
@
c
onfirm=
"handleStartTim
e"
@
c
hange=
"startTimeChange
"
<van-popup
v-model=
"
type
Show"
position=
"bottom"
:overlay=
"true"
>
<van-picker
show-toolbar
t
itle=
"标题
"
:columns=
"typeList
"
@
c
ancel=
"typeShow = fals
e"
@
c
onfirm=
"onConfirm
"
/>
</van-popup>
</div>
...
...
@@ -37,12 +37,21 @@
</van-cell>
<van-cell
title=
"金额"
style=
"font-size:14px;"
>
<
template
slot=
"default"
>
<div
class=
"npbr"
>
<van-field
v-model=
"addForm.unit"
class=
"right noborder"
readonly
clickable
:value=
"addForm.unit"
placeholder=
"请输入金额"
class=
"right"
style=
"font-size:14px;"
@
touchstart
.
native
.
stop=
"unitShow = true"
/>
<van-number-keyboard
v-model=
"addForm.unit "
:show=
"unitShow"
@
blur=
"unitShow = false"
/>
</div>
</
template
>
</van-cell>
<van-cell
title=
"开始时间"
style=
"font-size:14px;"
>
...
...
@@ -50,7 +59,7 @@
<div
class=
"npbr"
>
<van-field
class=
"right"
v-model=
"
addForm.startTim
e"
v-model=
"
beginDat
e"
placeholder=
"选择开始时间"
readonly=
"readonly"
@
click=
"startShow = true"
...
...
@@ -72,7 +81,7 @@
<div
class=
"npbr"
>
<van-field
class=
"right"
v-model=
"
addForm.
endDate"
v-model=
"endDate"
placeholder=
"选择结束时间"
readonly=
"readonly"
@
click=
"endShow = true"
...
...
@@ -118,13 +127,13 @@
clickable
:value=
"addForm.limitOfUse"
placeholder=
"请输入总限制次数"
@
touchstart
.
native
.
stop=
"
s
how = true"
@
touchstart
.
native
.
stop=
"
allLimitS
how = true"
/>
<van-number-keyboard
v-model=
"addForm.limitOfUse"
:show=
"
s
how"
:show=
"
allLimitS
how"
:maxlength=
"6"
@
blur=
"
s
how = false"
@
blur=
"
allLimitS
how = false"
/>
</div>
</
template
>
...
...
@@ -133,7 +142,7 @@
<
template
slot=
"default"
>
<van-field
v-model=
"addForm.remind"
placeholder=
"请输入
使用说明
"
placeholder=
"请输入
总限制提示
"
class=
"right"
style=
"font-size:14px;"
/>
...
...
@@ -164,21 +173,37 @@
<van-cell-group
class=
"all"
>
<van-cell
title=
"销售金额"
style=
"font-size:14px;"
>
<
template
slot=
"default"
>
<div
class=
"npbr"
>
<van-field
v-model=
"addForm.salesAmount"
class=
"right noborder"
readonly
clickable
:value=
"addForm.salesAmount"
placeholder=
"请输入销售金额"
class=
"right"
style=
"font-size:14px;"
@
touchstart
.
native
.
stop=
"salesAmountShow = true"
/>
<van-number-keyboard
v-model=
"addForm.salesAmount "
:show=
"salesAmountShow"
@
blur=
"salesAmountShow = false"
/>
</div>
</
template
>
</van-cell>
<van-cell
title=
"用券金额"
style=
"font-size:14px;"
>
<
template
slot=
"default"
>
<van-field
v-model=
"addForm.usageMax
"
:value=
"addForm.usageAmount
"
placeholder=
"请输入用券金额"
class=
"right"
style=
"font-size:14px;"
@
touchstart
.
native
.
stop=
"usageAmountShow = true"
/>
<van-number-keyboard
v-model=
"addForm.usageAmount"
:show=
"usageAmountShow"
:maxlength=
"6"
@
blur=
"usageAmountShow = false"
/>
</
template
>
</van-cell>
...
...
@@ -193,9 +218,11 @@
</template>
<
script
>
import
{
addCoupon
}
from
"@/api/sidebar/voucher"
export
default
{
data
()
{
return
{
allLimitShow
:
false
,
show
:
false
,
show2
:
false
,
startTime
:
new
Date
(),
...
...
@@ -204,11 +231,17 @@ export default {
endTime1
:
""
,
startShow
:
false
,
endShow
:
false
,
typeShow
:
false
,
salesAmountShow
:
false
,
usageAmountShow
:
false
,
unitShow
:
false
,
beginDate
:
''
,
endDate
:
''
,
//
addForm
:
{
name
:
""
,
endD
ate
:
''
,
startDate
:
''
,
begin_d
ate
:
''
,
end_date
:
''
,
type
:
''
,
unit
:
''
,
instruction
:
''
,
...
...
@@ -217,48 +250,108 @@ export default {
remind
:
''
,
usageMax
:
''
,
salesAmount
:
''
,
usageMax
:
''
}
usageAmount
:
''
,
usageMax
:
''
,
deptId
:
''
},
typeList
:
[
'现金券'
]
};
},
mounted
()
{
this
.
addForm
.
deptId
=
sessionStorage
.
getItem
(
"oyStallCode"
)
// this.addForm.deptId = 3
},
methods
:
{
timeFormat
(
time
)
{
let
year
=
1900
+
time
.
getYear
();
let
month
=
"0"
+
(
time
.
getMonth
()
+
1
);
let
date
=
"0"
+
time
.
getDate
();
let
hour
=
time
.
getHours
()
let
minute
=
time
.
getMinutes
()
return
(
year
+
"-"
+
month
.
substring
(
month
.
length
-
2
,
month
.
length
)
+
"-"
+
date
.
substring
(
date
.
length
-
2
,
date
.
length
)
+
" "
year
+
"-"
+
month
.
substring
(
month
.
length
-
2
,
month
.
length
)
+
"-"
+
date
.
substring
(
date
.
length
-
2
,
date
.
length
)
);
},
startTimeChange
(
e
)
{
let
startTimeArr
=
e
.
getValues
();
this
.
addForm
.
startTime
=
`
${
startTimeArr
[
0
]}
-
${
startTimeArr
[
1
]}
-
${
startTimeArr
[
2
]}
`
;
console
.
log
(
startTimeArr
,
'startTimeArr'
)
this
.
addForm
.
begin_date
=
this
.
beginDate
=
`
${
startTimeArr
[
0
]}
-
${
startTimeArr
[
1
]}
-
${
startTimeArr
[
2
]}
`
},
handleStartTime
(
value
)
{
this
.
addForm
.
startTime
=
this
.
timeFormat
(
value
);
this
.
addForm
.
begin_date
=
this
.
beginDate
=
this
.
timeFormat
(
value
)
this
.
startShow
=
false
;
},
handleEndTime
(
value
)
{
this
.
addForm
.
endDate
=
this
.
timeFormat
(
value
);
this
.
addForm
.
end
_date
=
this
.
end
Date
=
this
.
timeFormat
(
value
);
this
.
endShow
=
false
;
},
endTimeChange
(
e
)
{
let
endTimeArr
=
e
.
getValues
();
this
.
addForm
.
endDate
=
`
${
endTimeArr
[
0
]}
-
${
endTimeArr
[
1
]}
-
${
endTimeArr
[
2
]}
`
;
let
endTimeArr
=
e
.
getValues
()
this
.
addForm
.
end_date
=
this
.
endDate
=
`
${
endTimeArr
[
0
]}
-
${
endTimeArr
[
1
]}
-
${
endTimeArr
[
2
]}
`
},
onConfirm
(
val
,
index
)
{
this
.
typeShow
=
false
this
.
addForm
.
type
=
val
},
handleCancel
()
{
this
.
$router
.
push
(
'coupon'
)
},
handleSave
()
{
if
(
!
this
.
addForm
.
name
){
this
.
$toast
(
"请输入优惠券名称"
)
return
false
}
if
(
!
this
.
addForm
.
type
){
this
.
$toast
(
"请输入优惠券类型"
)
return
false
}
if
(
!
this
.
addForm
.
unit
){
this
.
$toast
(
"请输入优惠券金额"
)
return
false
}
if
(
!
this
.
beginDate
){
this
.
$toast
(
"请输入开始时间"
)
return
false
}
if
(
!
this
.
endDate
){
this
.
$toast
(
"请输入结束时间"
)
return
false
}
if
(
!
this
.
addForm
.
couponId
){
this
.
$toast
(
"请输入优惠券ID"
)
return
false
}
if
(
!
this
.
addForm
.
limitOfUse
){
this
.
$toast
(
"请输入总限制次数"
)
return
false
}
},
mounted
()
{}
if
(
!
this
.
addForm
.
remind
){
this
.
$toast
(
"请输入限制提示"
)
return
false
}
if
(
!
this
.
addForm
.
usageMax
){
this
.
$toast
(
"请输入编码券使用上限"
)
return
false
}
if
(
!
this
.
addForm
.
salesAmount
){
this
.
$toast
(
"请输入销售金额"
)
return
false
}
if
(
!
this
.
addForm
.
usageAmount
){
this
.
$toast
(
"请输入用券金额"
)
return
false
}
addCoupon
(
this
.
addForm
).
then
(
res
=>
{
console
.
log
(
res
,
'res'
)
if
(
res
.
result
==
'success'
)
{
this
.
$router
.
push
(
'coupon'
)
}
})
}
}
};
</
script
>
<
style
></
style
>
...
...
@@ -282,7 +375,7 @@ export default {
display
:
none
!important
;
}
.creat
{
width
:
96
%
;
width
:
100
%
;
display
:
flex
;
height
:
40px
;
background
:
rgba
(
117
,
178
,
253
,
1
);
...
...
This diff is collapsed.
Click to expand it.
wx_application/src/views/coupon/detail.vue
View file @
c91edc52
...
...
@@ -6,12 +6,12 @@
<div
class=
"price"
>
¥
{{
form
.
unit
}}
</div>
</div>
<div
class=
"right"
>
<div>
满
{{
form
.
usageAmoun
t
}}
元可用
</div>
<div>
满
{{
form
.
salesUni
t
}}
元可用
</div>
<div>
<div>
有效期:
</div>
<div>
<span>
{{
form
.
begin
D
ate
}}
</span>
~
<span>
{{
form
.
end
D
ate
}}
</span>
<span>
{{
form
.
begin
_d
ate
}}
</span>
~
<span>
{{
form
.
end
_d
ate
}}
</span>
</div>
</div>
<div>
全店通用
</div>
...
...
@@ -19,24 +19,55 @@
<i></i>
</div>
<div
class=
"txt"
>
{{
form
.
type
}}
</div>
<div
class=
"txt"
>
此优惠券仅限于
<span>
{{
form
.
store
}}
</span>
使用
</div>
<div
class=
"txt"
>
此优惠券仅限于
<span>
{{
store
}}
</span>
使用
</div>
</div>
</div>
</
template
>
<
script
>
import
{
getCouponList
}
from
"@/api/sidebar/voucher"
export
default
{
data
()
{
return
{
form
:
{
store
:
'only'
,
unit
:
'100'
,
type
:
'老用户回馈券'
,
usageAmount
:
'500'
,
beginDate
:
'2020/2/3'
,
endDate
:
'2020/4/5'
begin_date
:
'2020/2/3'
,
end_date
:
'2020/4/5'
},
store
:
''
,
id
:
''
,
deptId
:
''
}
},
mounted
()
{
this
.
deptId
=
sessionStorage
.
getItem
(
'oyStallCode'
)
// this.deptId = 3
this
.
id
=
this
.
$route
.
query
.
id
console
.
log
(
this
.
id
);
this
.
getList
()
},
methods
:
{
getList
()
{
let
params
=
{
deptId
:
this
.
deptId
}
getCouponList
(
params
).
then
(
res
=>
{
res
.
data
.
forEach
(
item
=>
{
item
.
begin_date
=
item
.
begin_date
.
substr
(
0
,
4
)
+
'-'
+
item
.
begin_date
.
substr
(
4
,
2
)
+
'-'
+
item
.
begin_date
.
substr
(
6
,
2
)
item
.
end_date
=
item
.
end_date
.
substr
(
0
,
4
)
+
'-'
+
item
.
end_date
.
substr
(
4
,
2
)
+
'-'
+
item
.
end_date
.
substr
(
6
,
2
)
})
let
obj
=
res
.
data
.
find
(
x
=>
{
console
.
log
(
x
,
'x'
)
return
x
.
id
===
this
.
id
})
console
.
log
(
obj
,
'obj'
)
this
.
form
=
obj
this
.
store
=
sessionStorage
.
getItem
(
"barName"
)
})
},
}
}
</
script
>
...
...
This diff is collapsed.
Click to expand it.
wx_application/src/views/coupon/list.vue
View file @
c91edc52
<
template
>
<div
class=
"contain"
>
<div
class=
"box"
@
click=
"handleCoupon
"
>
<div
class=
"left"
>
<div
class=
"price"
>
¥
{{
for
m
.
unit
}}
</div>
<div
class=
"type"
>
{{
for
m
.
type
}}
</div>
<div
class=
"box"
v-for=
"(item,index) in list"
:key=
"index"
@
click=
"handleCoupon(item.id)
"
>
<div
class=
"left"
>
<div
class=
"price"
>
¥
{{
ite
m
.
unit
}}
</div>
<div
class=
"type"
>
{{
ite
m
.
type
}}
</div>
</div>
<div
class=
"right"
>
<div>
满
{{
form
.
usageAmoun
t
}}
元可用
</div>
<div>
满
{{
item
.
salesUni
t
}}
元可用
</div>
<div
class=
"time"
>
<div>
有效期:
</div>
<span>
{{
form
.
beginD
ate
}}
</span>
~
<span>
{{
form
.
endD
ate
}}
</span>
<span>
{{
item
.
begin_d
ate
}}
</span>
~
<span>
{{
item
.
end_d
ate
}}
</span>
</div>
</div>
</div>
...
...
@@ -19,6 +19,7 @@
</
template
>
<
script
>
import
{
getCouponList
}
from
"@/api/sidebar/voucher"
export
default
{
data
()
{
return
{
...
...
@@ -26,14 +27,38 @@ export default {
unit
:
'100'
,
type
:
'老用户回馈券'
,
usageAmount
:
'500'
,
beginDate
:
'2020/2/3'
,
endDate
:
'2020/4/5'
}
begin_date
:
'2020/2/3'
,
end_date
:
'2020/4/5'
},
deptId
:
''
,
list
:
[]
}
},
mounted
()
{
this
.
deptId
=
sessionStorage
.
getItem
(
'oyStallCode'
)
// this.deptId = 3
this
.
getList
()
},
methods
:
{
handleCoupon
()
{
this
.
$router
.
push
(
"yhqDetail"
)
getList
()
{
let
params
=
{
deptId
:
this
.
deptId
}
getCouponList
(
params
).
then
(
res
=>
{
this
.
list
=
res
.
data
res
.
data
.
forEach
(
item
=>
{
item
.
begin_date
=
item
.
begin_date
.
substr
(
0
,
4
)
+
'-'
+
item
.
begin_date
.
substr
(
4
,
2
)
+
'-'
+
item
.
begin_date
.
substr
(
6
,
2
)
item
.
end_date
=
item
.
end_date
.
substr
(
0
,
4
)
+
'-'
+
item
.
end_date
.
substr
(
4
,
2
)
+
'-'
+
item
.
end_date
.
substr
(
6
,
2
)
})
})
},
handleCoupon
(
id
)
{
this
.
$router
.
push
({
path
:
"yhqDetail"
,
query
:
{
id
:
id
}
})
},
handleAddCoupon
()
{
this
.
$router
.
push
(
"couponAdd"
)
...
...
@@ -46,6 +71,8 @@ export default {
.contain
{
background-color
:
rgb
(
237
,
239
,
243
);
height
:
100%
;
flex-direction
:
column
;
justify-content
:
flex-start
;
}
.left
,
.right
{
font-size
:
16px
;
...
...
This diff is collapsed.
Click to expand it.
wx_application/src/views/mainSale/active/main/index.vue
View file @
c91edc52
...
...
@@ -46,7 +46,7 @@
<img
class=
"menu-logo"
:src=
"test.menuInfo.icon['6']"
/>
<div
class=
"menu-text"
>
商品管理
</div>
</div>
<div
class=
"menu"
@
click=
"handleCoupon"
>
<div
class=
"menu"
@
click=
"handleCoupon"
v-if=
"flag == 1"
>
<img
class=
"menu-logo"
:src=
"test.menuInfo.icon['1']"
/>
<div
class=
"menu-text"
>
优惠券管理
</div>
</div>
...
...
@@ -115,7 +115,7 @@
<
script
>
import
axios
from
"axios"
;
import
{
getStoreDetail
,
getMemberListByCode
}
from
"@/api/sidebar/voucher"
;
import
{
getStoreDetail
,
getMemberListByCode
,
getDirector
}
from
"@/api/sidebar/voucher"
;
import
{
configWx
,
getUserInfo
}
from
"@/utils/aCommon"
;
import
{
getUserInfoByUserId
}
from
"@/api/sidebar/voucher"
;
import
{
log
}
from
'util'
;
...
...
@@ -208,8 +208,9 @@ export default {
userId
:
""
,
userInfoResOld
:
""
,
userInfoResNew
:
""
},
flag
:
1
}
};
},
created
()
{
this
.
checkNowMenuBar
()
...
...
@@ -232,19 +233,32 @@ export default {
if
(
sessionStorage
.
getItem
(
'allNewFans'
))
{
this
.
test
.
barInfo
.
allNewFans
=
sessionStorage
.
getItem
(
'allNewFans'
)
}
if
(
sessionStorage
.
getItem
(
'role'
))
{
this
.
flag
=
sessionStorage
.
getItem
(
'role'
)
}
}
else
{
// this.zReadyUserId()
this
.
zTestGetNowUrlInfo
()
}
},
methods
:
{
// 获取用户角色
getDirector
(
userId
)
{
getDirector
({
userId
}).
then
(
res
=>
{
if
(
res
.
data
==
true
)
{
this
.
flag
=
1
}
else
{
this
.
flag
=
2
}
sessionStorage
.
setItem
(
"role"
,
this
.
flag
)
})
},
// 获取用户信息
getUserInfo
()
{
let
headerData
=
{
agentId
:
"1000033"
,
corpId
:
"ww4df265003b43fa0d"
};
}
axios
({
url
:
"http://139.155.48.151:8085/workWx/auth/user/get?userId="
+
...
...
@@ -470,9 +484,7 @@ export default {
};
this
.
zcache
.
userInfoResOld
=
"PostData:"
+
JSON
.
stringify
(
postData
);
axios
({
url
:
"http://139.155.48.151:8085/workWx/auth/oauth2/getUserInfo?code="
+
this
.
zcache
.
code
,
url
:
"http://139.155.48.151:8085/workWx/auth/oauth2/getUserInfo?code="
+
this
.
zcache
.
code
,
method
:
"post"
,
headers
:
headerData
})
...
...
@@ -482,6 +494,7 @@ export default {
this
.
getUserFromId
(
this
.
zcache
.
userId
);
this
.
getUserInfo
();
this
.
getNewFans
()
this
.
getDirector
(
res
.
data
.
data
.
userId
)
})
.
catch
(
err
=>
{
console
.
log
(
err
);
...
...
This diff is collapsed.
Click to expand it.
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