Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
966fda91
Commit
966fda91
authored
Aug 08, 2022
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支付成功订阅消息
parent
08e039c9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
14 deletions
+90
-14
src/api/shop.js
+5
-0
src/components/paySuccess/paySuccessInfo.vue
+84
-3
src/pages/paySuccess/index.vue
+0
-11
src/pages/paySuccess/main.json
+1
-0
src/utils/themeModule.js
+0
-0
No files found.
src/api/shop.js
View file @
966fda91
...
@@ -10,6 +10,11 @@ export default {
...
@@ -10,6 +10,11 @@ export default {
`
${
process
.
env
.
OLSHOP_URL
}
/shop/getWxMiniSubscribeMessageConfig`
`
${
process
.
env
.
OLSHOP_URL
}
/shop/getWxMiniSubscribeMessageConfig`
);
);
},
},
addWxMiniSubscribeMessageRecord
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/addWxMiniSubscribeMessageRecord`
,
data
);
},
// 页面数据
// 页面数据
themePagesInfo
(
params
)
{
themePagesInfo
(
params
)
{
return
requestPOST
(
return
requestPOST
(
...
...
src/components/paySuccess/paySuccessInfo.vue
View file @
966fda91
...
@@ -40,6 +40,11 @@
...
@@ -40,6 +40,11 @@
</div>
</div>
</
template
>
</
template
>
</div>
</div>
<!-- 订阅消息 -->
<div
class=
"subscribe"
v-if=
"miniIdlist.length>0"
>
<p
class=
"info"
>
订阅消息及时获得物流信息及状态通知
</p>
<van-switch
:checked=
"checkedSubscribe"
@
change=
"changeCheckedSubscribe"
active-color=
"var(--minor-color)"
size=
"20"
/>
</div>
</div>
</div>
</div>
</div>
<div
class=
"line"
v-if=
"orderDetail.orderType == 5"
></div>
<div
class=
"line"
v-if=
"orderDetail.orderType == 5"
></div>
...
@@ -93,6 +98,7 @@
...
@@ -93,6 +98,7 @@
</template>
</template>
<
script
>
<
script
>
import
shop
from
"@/api/shop"
;
const
app
=
getApp
();
const
app
=
getApp
();
const
{
log
}
=
app
;
const
{
log
}
=
app
;
export
default
{
export
default
{
...
@@ -128,6 +134,13 @@ export default {
...
@@ -128,6 +134,13 @@ export default {
default
:
0
,
default
:
0
,
},
},
},
},
data
()
{
return
{
checkedSubscribe
:
false
,
// 订阅消息开关
miniMsgList
:
[],
miniIdlist
:
[],
}
},
computed
:
{
computed
:
{
icon
()
{
icon
()
{
return
this
.
datas
.
componentData
[
"icon"
]
||
'http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/83a4a0bc-37fc-411e-bc5c-6dd9c1b4a921.png'
;
return
this
.
datas
.
componentData
[
"icon"
]
||
'http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/83a4a0bc-37fc-411e-bc5c-6dd9c1b4a921.png'
;
...
@@ -170,8 +183,23 @@ export default {
...
@@ -170,8 +183,23 @@ export default {
},
},
onLoad
()
{
onLoad
()
{
console
.
log
(
"-----------------------info"
,
this
.
$store
.
state
.
spokemanInfo
)
console
.
log
(
"-----------------------info"
,
this
.
$store
.
state
.
spokemanInfo
)
this
.
checkedSubscribe
=
false
;
this
.
getWxMiniSubscribeMessageConfig
();
},
},
methods
:
{
methods
:
{
getWxMiniSubscribeMessageConfig
()
{
shop
.
getWxMiniSubscribeMessageConfig
().
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
const
data
=
res
.
data
.
data
;
log
.
info
(
"wx mini subscribe message data: "
,
data
);
console
.
log
(
data
.
miniMessageConfigResponseDTOList
,
'-------------data'
)
if
(
data
.
miniMessageConfigResponseDTOList
&&
data
.
miniMessageConfigResponseDTOList
.
length
>
0
)
{
this
.
miniMsgList
=
data
.
miniMessageConfigResponseDTOList
;
this
.
miniIdlist
=
this
.
miniMsgList
.
map
(
item
=>
item
.
priTmplId
);
}
}
});
},
toOrderDetail
()
{
toOrderDetail
()
{
if
(
!
this
.
render
)
return
;
if
(
!
this
.
render
)
return
;
console
.
log
(
"查看详情"
);
console
.
log
(
"查看详情"
);
...
@@ -180,6 +208,46 @@ export default {
...
@@ -180,6 +208,46 @@ export default {
url
,
url
,
});
});
},
},
changeCheckedSubscribe
(
val
)
{
console
.
log
(
val
,
'--------------'
)
this
.
checkedSubscribe
=
val
.
mp
.
detail
;
if
(
this
.
checkedSubscribe
)
{
this
.
toDingyue
();
}
},
toDingyue
()
{
let
_this
=
this
;
if
(
!
(
this
.
miniIdlist
&&
this
.
miniIdlist
.
length
>
0
))
{
return
;
}
wx
.
requestSubscribeMessage
({
tmplIds
:
_this
.
miniIdlist
,
success
(
res
)
{
log
.
info
(
"用户点击订阅"
,
res
)
let
showToast
=
false
;
console
.
log
(
res
,
"-------------res"
);
_this
.
miniIdlist
.
forEach
(
item
=>
{
if
(
res
[
item
]
==
"accept"
){
showToast
=
true
;
}
})
if
(
showToast
)
{
wx
.
showToast
({
title
:
"订阅成功"
,
icon
:
"none"
});
}
_this
.
miniMsgList
.
forEach
(
item
=>
{
let
query
=
{
openId
:
wx
.
getStorageSync
(
"openid"
),
eventName
:
item
.
title
,
eventType
:
item
.
definitionType
,
sendTemplateId
:
item
.
priTmplId
,
sendTemplateParams
:
item
.
content
,
extraParams
:
item
.
example
,
}
shop
.
addWxMiniSubscribeMessageRecord
(
query
).
then
()
})
},
});
},
toOrderList
()
{
toOrderList
()
{
let
url
=
`/pages/index/main?from=home&backpath=
${
encodeURIComponent
(
`/order/orderList`
)}
`
let
url
=
`/pages/index/main?from=home&backpath=
${
encodeURIComponent
(
`/order/orderList`
)}
`
wx
.
redirectTo
({
wx
.
redirectTo
({
...
@@ -272,7 +340,7 @@ export default {
...
@@ -272,7 +340,7 @@ export default {
margin-top
:
1px
;
margin-top
:
1px
;
overflow
:
hidden
;
overflow
:
hidden
;
.paySuccess_detail
{
.paySuccess_detail
{
padding
:
0
63
px
;
padding
:
0
30
px
;
.iconPay
{
.iconPay
{
margin
:
0
auto
;
margin
:
0
auto
;
border-radius
:
50%
;
border-radius
:
50%
;
...
@@ -327,9 +395,9 @@ export default {
...
@@ -327,9 +395,9 @@ export default {
}
}
.bottom
{
.bottom
{
margin-top
:
10px
;
margin-top
:
10px
;
justify-content
:
space-
around
;
justify-content
:
space-
between
;
/deep/.van-button
{
/deep/.van-button
{
width
:
1
18
px
;
width
:
1
40
px
;
height
:
35px
;
height
:
35px
;
color
:
#929292
;
color
:
#929292
;
line-height
:
35px
;
line-height
:
35px
;
...
@@ -342,6 +410,19 @@ export default {
...
@@ -342,6 +410,19 @@ export default {
color
:
#fff
;
color
:
#fff
;
}
}
}
}
.subscribe
{
padding
:
8px
18px
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
background
:
var
(
--main-color
);
margin-top
:
20px
;
border-radius
:
6px
;
p.info{
color
:
#fff
;
font-size
:
13px
;
}
}
}
}
}
}
...
...
src/pages/paySuccess/index.vue
View file @
966fda91
...
@@ -481,17 +481,6 @@ export default {
...
@@ -481,17 +481,6 @@ export default {
return
JSON
.
stringify
(
pageData
);
return
JSON
.
stringify
(
pageData
);
},
},
toDingyue
()
{
wx
.
requestSubscribeMessage
({
tmplIds
:
[
"cTgB0EMEibieOPU6HWPbmr3YCea7MZYCryxmi2_fS5o"
,
"pWi2-icKybK1fSSjRf-wrsQE1jmsuEp1QgPTAxn2nB0"
,
],
success
(
res
)
{
console
.
log
(
res
,
"-------------res"
);
},
});
},
},
},
};
};
</
script
>
</
script
>
...
...
src/pages/paySuccess/main.json
View file @
966fda91
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
"usingComponents"
:
{
"usingComponents"
:
{
"van-checkbox"
:
"/static/vant/checkbox/index"
,
"van-checkbox"
:
"/static/vant/checkbox/index"
,
"van-popup"
:
"/static/vant/popup/index"
,
"van-popup"
:
"/static/vant/popup/index"
,
"van-switch"
:
"/static/vant/switch/index"
,
"van-button"
:
"/static/vant/button/index"
,
"van-button"
:
"/static/vant/button/index"
,
"van-picker"
:
"/static/vant/picker/index"
,
"van-picker"
:
"/static/vant/picker/index"
,
"van-icon"
:
"/static/vant/icon/index"
,
"van-icon"
:
"/static/vant/icon/index"
,
...
...
src/utils/themeModule.js
View file @
966fda91
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