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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
25 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 = {
method
:
'dj.api.smartcarlife.merchantCoupon.pageForZYApp'
,
projectName
:
"boutique"
,
onlyUsable
:
true
,
currentPage
:
1
,
pageSize
:
99999
,
...
data
,
},
false
,
'ip'
);
},
...
...
pages/boutique/components/QrBox.vue
View file @
0a66a12
...
...
@@ -9,7 +9,7 @@
<view
class=
"box"
>
<view
class=
"icon-close-box flex"
@
click=
"
$refs.qr.close()
"
@
click=
"
close
"
>
<uni-icons
class=
"icon-close"
...
...
pages/boutique/components/Reception.vue
View file @
0a66a12
...
...
@@ -107,7 +107,7 @@
<view
class=
"select-box"
>
<view
class=
"select-item"
:class=
"{ checked: couponId == item.id }"
:class=
"{ checked:
pageParams.
couponId == item.id }"
@
click=
"chooseCoupon(item)"
v-for=
"(item, index) in couponList"
:key=
"index"
...
...
@@ -117,9 +117,9 @@
</view>
</MessageBox>
<qr-box
:url=
"QRURL"
:url=
"
pageParams.
QRURL"
ref=
"qrbox"
:received=
"received"
:received=
"
pageParams.
received"
@
close=
"closeQr"
/>
</view>
...
...
@@ -174,11 +174,13 @@ export default {
couponList
:
[],
couponTypeName
:
''
,
focusIndex
:
-
1
,
couponId
:
''
,
carInfo
:
{},
QRURL
:
''
,
received
:
false
,
qrTimer
:
null
pageParams
:
{
qrTimer
:
null
,
received
:
false
,
couponId
:
''
,
carInfo
:
{},
QRURL
:
''
,
}
}
},
watch
:
{
...
...
@@ -190,6 +192,13 @@ export default {
},
show
(
n
)
{
if
(
n
&&
this
.
customerType
==
1
)
this
.
init
()
},
watchStatus
:
{
immediate
:
true
,
handler
(
newval
)
{
this
.
pageParams
=
this
.
$options
.
data
.
call
(
this
).
pageParams
this
.
resetFocusIndex
()
}
}
},
computed
:
{
...
...
@@ -203,8 +212,6 @@ export default {
methods
:
{
init
()
{
this
.
qrTimer
=
null
this
.
resetFocusIndex
()
this
.
findCouponList
()
},
async
findCouponList
()
{
...
...
@@ -214,8 +221,26 @@ export default {
merchantIdList
:
[
shopMerchantId
]
})
if
(
list
&&
list
.
length
)
{
let
item
=
list
.
find
(
e
=>
e
.
couponType
==
1
)
if
(
item
&&
!
this
.
couponId
)
this
.
chooseCoupon
(
item
)
let
couponTypeList
=
Array
.
from
(
new
Set
([...
list
.
map
((
e
)
=>
e
.
couponType
)]))
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
||
[]
},
...
...
@@ -230,7 +255,7 @@ export default {
}
else
{
this
.
$refs
.
carBrandListVisible
.
close
()
this
.
customerInfo
.
carModel
=
item
.
name
this
.
carInfo
=
item
this
.
pageParams
.
carInfo
=
item
}
this
.
resetFocusIndex
()
this
.
$store
.
dispatch
(
'setCustomerInfo'
,
this
.
customerInfo
)
...
...
@@ -247,7 +272,7 @@ export default {
this
.
closeQr
()
},
chooseCoupon
(
item
)
{
this
.
couponId
=
item
.
id
this
.
pageParams
.
couponId
=
item
.
id
this
.
couponTypeName
=
item
.
couponTypeName
this
.
$refs
.
couponBoxVisible
.
close
()
},
...
...
@@ -256,7 +281,7 @@ export default {
},
async
createCoupon
()
{
try
{
const
{
couponId
,
customerInfo
,
ca
rInfo
}
=
this
const
{
pageParams
:
{
couponId
,
carInfo
},
custome
rInfo
}
=
this
await
this
.
validate
()
uni
.
showLoading
()
const
{
...
...
@@ -281,13 +306,12 @@ export default {
uni
.
hideLoading
()
if
(
code
==
0
)
{
if
(
data
)
{
this
.
QRURL
=
data
this
.
pageParams
.
QRURL
=
data
this
.
checkCustomerReceivedStatus
(
dayjs
().
format
(
"YYYY-MM-DD HH:mm:ss"
))
this
.
$refs
.
qrbox
.
open
()
}
else
throw
'生成小程序码失败,请重试!'
}
else
throw
message
console
.
log
(
data
)
}
catch
(
error
)
{
console
.
log
(
error
)
uni
.
showToast
({
...
...
@@ -298,7 +322,7 @@ export default {
},
async
validate
()
{
const
{
customerName
,
phoneNumber
,
carModel
,
staffName
}
=
this
.
customerInfo
,
{
couponId
}
=
this
{
couponId
}
=
this
.
pageParams
// 检查车主姓名
if
(
!
customerName
)
throw
'请输入车主姓名'
// 检查车主手机
...
...
@@ -312,15 +336,16 @@ export default {
if
(
!
couponId
)
throw
'请选择礼券类型'
},
checkCustomerReceivedStatus
(
receiveCouponStartTime
)
{
this
.
qrTimer
=
setInterval
(
async
()
=>
{
const
{
couponId
,
customerInfo
}
=
this
,
this
.
pageParams
.
received
=
false
this
.
pageParams
.
qrTimer
=
setInterval
(
async
()
=>
{
const
{
pageParams
:
{
couponId
},
customerInfo
}
=
this
,
res
=
await
uni
.
$api
.
boutiqueApi
.
findCustomerReceivedStatus
({
merchantCouponId
:
couponId
,
customerPhone
:
customerInfo
.
phoneNumber
,
receiveCouponStartTime
})
if
(
res
.
total
)
{
this
.
received
=
true
this
.
pageParams
.
received
=
true
this
.
closeQr
()
setTimeout
(()
=>
{
this
.
$refs
.
qrbox
.
close
()
...
...
@@ -329,9 +354,8 @@ export default {
},
1
e3
)
},
closeQr
()
{
console
.
log
(
this
.
qrTimer
)
clearInterval
(
this
.
qrTimer
)
this
.
qrTimer
=
null
clearInterval
(
this
.
pageParams
.
qrTimer
)
this
.
pageParams
.
qrTimer
=
null
},
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