Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0a66a129
authored
Jun 03, 2024
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit
1 parent
0cb2063a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
22 deletions
api/module/boutique.js
pages/boutique/components/QrBox.vue
pages/boutique/components/Reception.vue
api/module/boutique.js
View file @
0a66a12
...
@@ -15,6 +15,8 @@ module.exports = {
...
@@ -15,6 +15,8 @@ module.exports = {
method
:
'dj.api.smartcarlife.merchantCoupon.pageForZYApp'
,
method
:
'dj.api.smartcarlife.merchantCoupon.pageForZYApp'
,
projectName
:
"boutique"
,
projectName
:
"boutique"
,
onlyUsable
:
true
,
onlyUsable
:
true
,
currentPage
:
1
,
pageSize
:
99999
,
...
data
,
...
data
,
},
false
,
'ip'
);
},
false
,
'ip'
);
},
},
...
...
pages/boutique/components/QrBox.vue
View file @
0a66a12
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<view
class=
"box"
>
<view
class=
"box"
>
<view
<view
class=
"icon-close-box flex"
class=
"icon-close-box flex"
@
click=
"
$refs.qr.close()
"
@
click=
"
close
"
>
>
<uni-icons
<uni-icons
class=
"icon-close"
class=
"icon-close"
...
...
pages/boutique/components/Reception.vue
View file @
0a66a12
...
@@ -107,7 +107,7 @@
...
@@ -107,7 +107,7 @@
<view
class=
"select-box"
>
<view
class=
"select-box"
>
<view
<view
class=
"select-item"
class=
"select-item"
:class=
"{ checked: couponId == item.id }"
:class=
"{ checked:
pageParams.
couponId == item.id }"
@
click=
"chooseCoupon(item)"
@
click=
"chooseCoupon(item)"
v-for=
"(item, index) in couponList"
v-for=
"(item, index) in couponList"
:key=
"index"
:key=
"index"
...
@@ -117,9 +117,9 @@
...
@@ -117,9 +117,9 @@
</view>
</view>
</MessageBox>
</MessageBox>
<qr-box
<qr-box
:url=
"QRURL"
:url=
"
pageParams.
QRURL"
ref=
"qrbox"
ref=
"qrbox"
:received=
"received"
:received=
"
pageParams.
received"
@
close=
"closeQr"
@
close=
"closeQr"
/>
/>
</view>
</view>
...
@@ -174,11 +174,13 @@ export default {
...
@@ -174,11 +174,13 @@ export default {
couponList
:
[],
couponList
:
[],
couponTypeName
:
''
,
couponTypeName
:
''
,
focusIndex
:
-
1
,
focusIndex
:
-
1
,
pageParams
:
{
qrTimer
:
null
,
received
:
false
,
couponId
:
''
,
couponId
:
''
,
carInfo
:
{},
carInfo
:
{},
QRURL
:
''
,
QRURL
:
''
,
received
:
false
,
}
qrTimer
:
null
}
}
},
},
watch
:
{
watch
:
{
...
@@ -190,6 +192,13 @@ export default {
...
@@ -190,6 +192,13 @@ export default {
},
},
show
(
n
)
{
show
(
n
)
{
if
(
n
&&
this
.
customerType
==
1
)
this
.
init
()
if
(
n
&&
this
.
customerType
==
1
)
this
.
init
()
},
watchStatus
:
{
immediate
:
true
,
handler
(
newval
)
{
this
.
pageParams
=
this
.
$options
.
data
.
call
(
this
).
pageParams
this
.
resetFocusIndex
()
}
}
}
},
},
computed
:
{
computed
:
{
...
@@ -203,8 +212,6 @@ export default {
...
@@ -203,8 +212,6 @@ export default {
methods
:
{
methods
:
{
init
()
{
init
()
{
this
.
qrTimer
=
null
this
.
resetFocusIndex
()
this
.
findCouponList
()
this
.
findCouponList
()
},
},
async
findCouponList
()
{
async
findCouponList
()
{
...
@@ -214,8 +221,26 @@ export default {
...
@@ -214,8 +221,26 @@ export default {
merchantIdList
:
[
shopMerchantId
]
merchantIdList
:
[
shopMerchantId
]
})
})
if
(
list
&&
list
.
length
)
{
if
(
list
&&
list
.
length
)
{
let
item
=
list
.
find
(
e
=>
e
.
couponType
==
1
)
let
couponTypeList
=
Array
.
from
(
new
Set
([...
list
.
map
((
e
)
=>
e
.
couponType
)]))
if
(
item
&&
!
this
.
couponId
)
this
.
chooseCoupon
(
item
)
let
arr
=
[]
couponTypeList
.
map
((
i
)
=>
{
let
item
=
[]
list
.
map
((
e
)
=>
{
if
(
i
==
e
.
couponType
)
item
.
push
(
e
)
})
arr
.
push
({
couponType
:
i
,
list
:
item
})
})
console
.
log
(
arr
)
let
item
=
list
.
find
(
e
=>
e
.
couponType
==
1
),
item2
=
list
.
find
(
e
=>
e
.
couponType
==
18
)
if
(
!
this
.
pageParams
.
couponId
)
{
if
(
item
)
this
.
chooseCoupon
(
item
)
//默认填入类型为「太阳膜」类型
else
if
(
item2
)
this
.
chooseCoupon
(
item
)
//次选填入「精品」类型
else
this
.
chooseCoupon
(
list
[
0
])
// 无此两种类型情况默认带入任意类型礼券
}
}
}
this
.
couponList
=
list
||
[]
this
.
couponList
=
list
||
[]
},
},
...
@@ -230,7 +255,7 @@ export default {
...
@@ -230,7 +255,7 @@ export default {
}
else
{
}
else
{
this
.
$refs
.
carBrandListVisible
.
close
()
this
.
$refs
.
carBrandListVisible
.
close
()
this
.
customerInfo
.
carModel
=
item
.
name
this
.
customerInfo
.
carModel
=
item
.
name
this
.
carInfo
=
item
this
.
pageParams
.
carInfo
=
item
}
}
this
.
resetFocusIndex
()
this
.
resetFocusIndex
()
this
.
$store
.
dispatch
(
'setCustomerInfo'
,
this
.
customerInfo
)
this
.
$store
.
dispatch
(
'setCustomerInfo'
,
this
.
customerInfo
)
...
@@ -247,7 +272,7 @@ export default {
...
@@ -247,7 +272,7 @@ export default {
this
.
closeQr
()
this
.
closeQr
()
},
},
chooseCoupon
(
item
)
{
chooseCoupon
(
item
)
{
this
.
couponId
=
item
.
id
this
.
pageParams
.
couponId
=
item
.
id
this
.
couponTypeName
=
item
.
couponTypeName
this
.
couponTypeName
=
item
.
couponTypeName
this
.
$refs
.
couponBoxVisible
.
close
()
this
.
$refs
.
couponBoxVisible
.
close
()
},
},
...
@@ -256,7 +281,7 @@ export default {
...
@@ -256,7 +281,7 @@ export default {
},
},
async
createCoupon
()
{
async
createCoupon
()
{
try
{
try
{
const
{
couponId
,
customerInfo
,
ca
rInfo
}
=
this
const
{
pageParams
:
{
couponId
,
carInfo
},
custome
rInfo
}
=
this
await
this
.
validate
()
await
this
.
validate
()
uni
.
showLoading
()
uni
.
showLoading
()
const
{
const
{
...
@@ -281,13 +306,12 @@ export default {
...
@@ -281,13 +306,12 @@ export default {
uni
.
hideLoading
()
uni
.
hideLoading
()
if
(
code
==
0
)
{
if
(
code
==
0
)
{
if
(
data
)
{
if
(
data
)
{
this
.
QRURL
=
data
this
.
pageParams
.
QRURL
=
data
this
.
checkCustomerReceivedStatus
(
dayjs
().
format
(
"YYYY-MM-DD HH:mm:ss"
))
this
.
checkCustomerReceivedStatus
(
dayjs
().
format
(
"YYYY-MM-DD HH:mm:ss"
))
this
.
$refs
.
qrbox
.
open
()
this
.
$refs
.
qrbox
.
open
()
}
}
else
throw
'生成小程序码失败,请重试!'
else
throw
'生成小程序码失败,请重试!'
}
else
throw
message
}
else
throw
message
console
.
log
(
data
)
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
uni
.
showToast
({
uni
.
showToast
({
...
@@ -298,7 +322,7 @@ export default {
...
@@ -298,7 +322,7 @@ export default {
},
},
async
validate
()
{
async
validate
()
{
const
{
customerName
,
phoneNumber
,
carModel
,
staffName
}
=
this
.
customerInfo
,
const
{
customerName
,
phoneNumber
,
carModel
,
staffName
}
=
this
.
customerInfo
,
{
couponId
}
=
this
{
couponId
}
=
this
.
pageParams
// 检查车主姓名
// 检查车主姓名
if
(
!
customerName
)
throw
'请输入车主姓名'
if
(
!
customerName
)
throw
'请输入车主姓名'
// 检查车主手机
// 检查车主手机
...
@@ -312,15 +336,16 @@ export default {
...
@@ -312,15 +336,16 @@ export default {
if
(
!
couponId
)
throw
'请选择礼券类型'
if
(
!
couponId
)
throw
'请选择礼券类型'
},
},
checkCustomerReceivedStatus
(
receiveCouponStartTime
)
{
checkCustomerReceivedStatus
(
receiveCouponStartTime
)
{
this
.
qrTimer
=
setInterval
(
async
()
=>
{
this
.
pageParams
.
received
=
false
const
{
couponId
,
customerInfo
}
=
this
,
this
.
pageParams
.
qrTimer
=
setInterval
(
async
()
=>
{
const
{
pageParams
:
{
couponId
},
customerInfo
}
=
this
,
res
=
await
uni
.
$api
.
boutiqueApi
.
findCustomerReceivedStatus
({
res
=
await
uni
.
$api
.
boutiqueApi
.
findCustomerReceivedStatus
({
merchantCouponId
:
couponId
,
merchantCouponId
:
couponId
,
customerPhone
:
customerInfo
.
phoneNumber
,
customerPhone
:
customerInfo
.
phoneNumber
,
receiveCouponStartTime
receiveCouponStartTime
})
})
if
(
res
.
total
)
{
if
(
res
.
total
)
{
this
.
received
=
true
this
.
pageParams
.
received
=
true
this
.
closeQr
()
this
.
closeQr
()
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
$refs
.
qrbox
.
close
()
this
.
$refs
.
qrbox
.
close
()
...
@@ -329,9 +354,8 @@ export default {
...
@@ -329,9 +354,8 @@ export default {
},
1
e3
)
},
1
e3
)
},
},
closeQr
()
{
closeQr
()
{
console
.
log
(
this
.
qrTimer
)
clearInterval
(
this
.
pageParams
.
qrTimer
)
clearInterval
(
this
.
qrTimer
)
this
.
pageParams
.
qrTimer
=
null
this
.
qrTimer
=
null
},
},
resetFocusIndex
()
{
resetFocusIndex
()
{
...
...
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