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
3c7e29ff
Commit
3c7e29ff
authored
Feb 14, 2020
by
程默
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'product_dev' of
http://code.mayi888.com/chengmo/mayi-mp-shop
into product_dev
parents
c457e8e2
2f6cb1db
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
13 deletions
+64
-13
src/api/shop.js
+9
-3
src/api/wxPay.js
+6
-4
src/pages/index/index.vue
+19
-0
src/pages/wxPay/index.vue
+18
-0
src/store/mutations.js
+5
-1
src/store/state.js
+7
-5
No files found.
src/api/shop.js
View file @
3c7e29ff
...
@@ -2,8 +2,13 @@ import {requestPOST,requestGET} from "@/utils/request.js";
...
@@ -2,8 +2,13 @@ import {requestPOST,requestGET} from "@/utils/request.js";
export
default
{
export
default
{
getShopInfo
(){
getShopInfo
()
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/get_shop_info`
)
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/get_shop_info`
);
}
},
getWxMiniSubscribeMessageConfig
()
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/getWxMiniSubscribeMessageConfig`
);
}
}
};
\ No newline at end of file
src/api/wxPay.js
View file @
3c7e29ff
...
@@ -2,9 +2,11 @@ import {requestPOST,requestPOST1} from "@/utils/request.js";
...
@@ -2,9 +2,11 @@ import {requestPOST,requestPOST1} from "@/utils/request.js";
export
default
{
export
default
{
to_wx_pay
(
options
)
{
to_wx_pay
(
options
)
{
return
requestPOST1
(
`
${
process
.
env
.
OLSHOP_URL
}
/pay/to_wx_pay`
,
options
)
return
requestPOST1
(
`
${
process
.
env
.
OLSHOP_URL
}
/pay/to_wx_pay`
,
options
);
},
},
cancelPayment
(
options
)
{
cancelPayment
(
options
)
{
return
requestPOST1
(
`
${
process
.
env
.
OLSHOP_URL
}
/pay/payment_cancel?orderSn=
${
options
}
`
)
return
requestPOST1
(
`
${
process
.
env
.
OLSHOP_URL
}
/pay/payment_cancel?orderSn=
${
options
}
`
);
}
}
}
};
\ No newline at end of file
\ No newline at end of file
src/pages/index/index.vue
View file @
3c7e29ff
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
<
script
>
<
script
>
import
spokesman
from
"@/api/spokesman.js"
;
import
spokesman
from
"@/api/spokesman.js"
;
import
shop
from
"@/api/shop.js"
;
import
{
serialize
,
getQueryVariable
,
DFSImg
}
from
"@/utils/index"
;
import
{
serialize
,
getQueryVariable
,
DFSImg
}
from
"@/utils/index"
;
export
default
{
export
default
{
data
()
{
data
()
{
...
@@ -153,6 +154,24 @@ export default {
...
@@ -153,6 +154,24 @@ export default {
// }
// }
// }
// }
// });
// });
// 获取小程序开启的订阅消息配置
shop
.
getWxMiniSubscribeMessageConfig
().
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
const
data
=
res
.
data
.
data
;
console
.
log
(
"wx mini subscribe message data: "
,
data
);
if
(
data
!=
null
)
{
const
subscribeMessageObj
=
{};
for
(
var
key
in
data
)
{
if
(
data
[
key
]
&&
data
[
key
].
template_id
)
{
subscribeMessageObj
[
key
]
=
data
[
key
].
template_id
;
}
}
this
.
$store
.
commit
(
"setSubscribeMessageObj"
,
subscribeMessageObj
);
}
}
});
},
},
checkLogin
()
{
checkLogin
()
{
let
getOpenid
=
wx
.
getStorageSync
(
"openid"
);
let
getOpenid
=
wx
.
getStorageSync
(
"openid"
);
...
...
src/pages/wxPay/index.vue
View file @
3c7e29ff
...
@@ -52,6 +52,24 @@ export default {
...
@@ -52,6 +52,24 @@ export default {
let
payData
=
JSON
.
parse
(
res
.
data
.
data
);
let
payData
=
JSON
.
parse
(
res
.
data
.
data
);
payData
.
success
=
res
=>
{
payData
.
success
=
res
=>
{
console
.
log
(
"支付成功"
,
res
,
this
.
options
);
console
.
log
(
"支付成功"
,
res
,
this
.
options
);
const
orderSn
=
this
.
options
.
orderSn
;
try
{
if
(
this
.
$store
.
state
.
subscribeMessageObj
&&
Object
.
keys
(
this
.
$store
.
state
.
subscribeMessageObj
).
length
>
0
)
{
// TODO 小程序订阅消息埋点
wx
.
requestSubscribeMessage
({
tmplIds
:
Object
.
values
(
this
.
$store
.
state
.
subscribeMessageObj
),
success
(
res
)
{
console
.
log
(
"message success response: "
,
res
);
},
fail
(
res
)
{
console
.
log
(
"message fail response: "
,
res
)
}
})
}
}
catch
(
err
)
{
console
.
error
(
"subscribeMessage-err"
,
err
);
}
this
.
message
=
"支付成功"
;
this
.
message
=
"支付成功"
;
if
(
!
this
.
options_isCard
){
if
(
!
this
.
options_isCard
){
let
query
=
{
let
query
=
{
...
...
src/store/mutations.js
View file @
3c7e29ff
...
@@ -3,6 +3,9 @@ const mutations = {
...
@@ -3,6 +3,9 @@ const mutations = {
for
(
let
[
key
,
val
]
of
Object
.
entries
(
obj
))
{
for
(
let
[
key
,
val
]
of
Object
.
entries
(
obj
))
{
state
[
key
]
=
val
;
state
[
key
]
=
val
;
}
}
},
setSubscribeMessageObj
(
state
,
subscribeMessageObj
)
{
state
.
subscribeMessageObj
=
subscribeMessageObj
;
}
}
}
}
;
export
default
mutations
export
default
mutations
\ No newline at end of file
src/store/state.js
View file @
3c7e29ff
const
state
=
{
const
state
=
{
spokesmanGroupId
:
""
,
spokesmanGroupId
:
""
,
spokesmanShopId
:
""
,
spokesmanShopId
:
""
,
spokesmanRelId
:
""
spokesmanRelId
:
""
,
}
subscribeMessageObj
:
{}
};
export
default
state
export
default
state
\ No newline at end of file
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