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
839e6449
Commit
839e6449
authored
Feb 13, 2023
by
HouTiZhuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
扫码搜书
parent
c8b8cc6b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
src/api/goods.js
+4
-0
src/utils/mayi.js
+35
-0
No files found.
src/api/goods.js
View file @
839e6449
...
@@ -4,6 +4,10 @@ export default {
...
@@ -4,6 +4,10 @@ export default {
queryProductInfo
(
data
)
{
queryProductInfo
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/product/query_product_info`
,
data
);
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/product/query_product_info`
,
data
);
},
},
// 扫码查询商品
selectProductInfoOnEs
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/product/select_product_info_on_es`
,
data
);
},
queryBriefProductInfo
(
data
)
{
queryBriefProductInfo
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/product/query_brief_product_info`
,
data
);
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/product/query_brief_product_info`
,
data
);
},
},
...
...
src/utils/mayi.js
View file @
839e6449
import
cart
from
"@/api/cart"
import
cart
from
"@/api/cart"
import
shop
from
"@/api/shop"
import
shop
from
"@/api/shop"
import
coupon
from
"@/api/coupon"
;
import
coupon
from
"@/api/coupon"
;
import
goods
from
'@/api/goods'
;
import
classificationApi
from
"@/api/classification"
;
import
classificationApi
from
"@/api/classification"
;
// 登录白名单 name
// 登录白名单 name
export
const
noLoginList
=
[
"index"
,
"media-video"
,
"goods-goodsInfo"
,
"goods-commodityMenu"
,
"goodsSearch-goodsSearch"
,
"contentSearch-contentSearch"
,
"chooseStores"
,
"activty-receivingGift"
,
"activty"
,
"login-register"
,
"login-phoneLogin"
,
"login-authInformation"
,
"login-forgetPassWord"
,
"login-accountLogin"
,
"login-wxRegister"
,
"pay-payList"
,
"comment-evaluateList"
,
"goods-commonProblemList"
,
"article-articlePage"
,
"article-articleList"
,
"goods-posters"
,
"liveBroadcast"
,
"liveBroadcast-list"
,
"personalCenter-coupon-getCoupon"
,
"buyerShow-showDetail"
,
"goods-addGoodsList"
,
"personalCenter-CDkey-exchange"
,
"giftCards-linkReceive"
,
"giftCoupon-preview"
,
"smartForm"
,
"shopCart-shareShopCart"
,
"groupBuying-beInvite"
,
"brandTopics"
,
"personalCenter-spokesmanCenter"
,
"personalCenter-spokesmanCenter-mine-spokesmanHomePage"
,
"liveBroadcast-lived"
,
"personalCenter-spokesmanCenter-mine-getBusinessCard"
,
"changeAdr"
];
export
const
noLoginList
=
[
"index"
,
"media-video"
,
"goods-goodsInfo"
,
"goods-commodityMenu"
,
"goodsSearch-goodsSearch"
,
"contentSearch-contentSearch"
,
"chooseStores"
,
"activty-receivingGift"
,
"activty"
,
"login-register"
,
"login-phoneLogin"
,
"login-authInformation"
,
"login-forgetPassWord"
,
"login-accountLogin"
,
"login-wxRegister"
,
"pay-payList"
,
"comment-evaluateList"
,
"goods-commonProblemList"
,
"article-articlePage"
,
"article-articleList"
,
"goods-posters"
,
"liveBroadcast"
,
"liveBroadcast-list"
,
"personalCenter-coupon-getCoupon"
,
"buyerShow-showDetail"
,
"goods-addGoodsList"
,
"personalCenter-CDkey-exchange"
,
"giftCards-linkReceive"
,
"giftCoupon-preview"
,
"smartForm"
,
"shopCart-shareShopCart"
,
"groupBuying-beInvite"
,
"brandTopics"
,
"personalCenter-spokesmanCenter"
,
"personalCenter-spokesmanCenter-mine-spokesmanHomePage"
,
"liveBroadcast-lived"
,
"personalCenter-spokesmanCenter-mine-getBusinessCard"
,
"changeAdr"
];
...
@@ -367,6 +368,10 @@ export function themeScanningCodeClick() {
...
@@ -367,6 +368,10 @@ export function themeScanningCodeClick() {
success
(
res
)
{
success
(
res
)
{
console
.
log
(
res
,
'-----scanCode-success'
)
console
.
log
(
res
,
'-----scanCode-success'
)
let
{
scanType
,
path
,
result
}
=
res
;
let
{
scanType
,
path
,
result
}
=
res
;
// 所有一维码类型
const
barCodeTypes
=
[
'AZTEC'
,
'CODABAR'
,
'CODE_39'
,
'CODE_93'
,
'CODE_128'
,
'EAN_8'
,
'EAN_13'
,
'ITF'
,
'MAXICODE'
,
'RSS_14'
,
'RSS_EXPANDED'
,
'UPC_A'
,
'UPC_E'
,
'UPC_EAN_EXTENSION'
,
'CODE_25'
];
if
(
scanType
==
'WX_CODE'
)
{
if
(
scanType
==
'WX_CODE'
)
{
// 微信二维码
// 微信二维码
$themeToLink
({
$themeToLink
({
...
@@ -390,6 +395,36 @@ export function themeScanningCodeClick() {
...
@@ -390,6 +395,36 @@ export function themeScanningCodeClick() {
link
:
'/contentSearch/contentSearch?placeHolderText='
+
result
link
:
'/contentSearch/contentSearch?placeHolderText='
+
result
})
})
}
}
}
else
if
(
barCodeTypes
.
includes
(
scanType
))
{
// 一维码类型
const
data
=
{
"searchWord"
:
result
,
"page"
:
1
,
"rows"
:
10
}
goods
.
selectProductInfoOnEs
(
data
).
then
(
response
=>
{
const
res
=
response
.
data
.
data
;
if
(
res
.
total
>
1
)
{
// 多个 SKU 跳转商品搜索结果页,搜索框显示扫码内容,页面自动展示搜索结果;
$themeToLink
({
type
:
1
,
link
:
`/goodsSearch/goodsSearch?placeHolderText=
${
result
}
&search_txt=
${
result
}
`
})
}
else
if
(
res
.
total
==
1
)
{
const
item
=
res
.
list
[
0
];
// 唯一 SKU 跳转商品详情
$themeToLink
({
type
:
1
,
link
:
`/goods/
${
item
.
productId
}
?terminalProductId=
${
item
.
terminalProductId
}
`
});
}
else
{
// 提示:对不起,无法正确识别该条形码。请直接联系导购员;
wx
.
showModal
({
content
:
'对不起 无法正确识别该条形码
\
n请直接联系导购员'
,
showCancel
:
false
});
}
}).
catch
(
console
.
log
);
}
}
},
},
fail
(
res
)
{
fail
(
res
)
{
...
...
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