Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
zhwy
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f146ae1b
authored
Sep 26, 2023
by
匡雅琴
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
埋点处理
1 parent
32ed831d
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
92 additions
and
74 deletions
api/module/shopmall.js
app.js
packageStrategy/pages/strategyDetail/index.js
packageStrategy/pages/strategyDetail/index.wxml
packageStrategy/pages/strategyDetail/index.wxss
utils/cache/storage.js
utils/constants.js
utils/track/Track.js
api/module/shopmall.js
View file @
f146ae1
import
api
from
'../request/http'
import
api
from
"../request/http"
;
module
.
exports
=
{
module
.
exports
=
{
/** 分页查询商城专区的商品信息 */
/** 分页查询商城专区的商品信息 */
...
@@ -7,157 +7,159 @@ module.exports = {
...
@@ -7,157 +7,159 @@ module.exports = {
method
:
`scrm.api.shopmall.zoneInfo.weapp.goodsPage.HMD`
,
method
:
`scrm.api.shopmall.zoneInfo.weapp.goodsPage.HMD`
,
pageNum
:
1
,
pageNum
:
1
,
pageSize
:
999
,
pageSize
:
999
,
...
data
...
data
,
})
})
;
},
},
/** 添加购物车 */
/** 添加购物车 */
addShoppingcart
(
data
)
{
addShoppingcart
(
data
)
{
return
api
.
post
({
return
api
.
post
({
method
:
`scrm.api.shopmall.weapp.shoppingcart.add`
,
method
:
`scrm.api.shopmall.weapp.shoppingcart.add`
,
...
data
...
data
,
})
})
;
},
},
/** 购物车删除商品 */
/** 购物车删除商品 */
delShoppingcart
(
data
)
{
delShoppingcart
(
data
)
{
return
api
.
post
({
return
api
.
post
({
method
:
`scrm.api.shopmall.weapp.shoppingcart.delete`
,
method
:
`scrm.api.shopmall.weapp.shoppingcart.delete`
,
...
data
...
data
,
})
})
;
},
},
/** 分页获取购物车 */
/** 分页获取购物车 */
getShoppingcartList
(
data
)
{
getShoppingcartList
(
data
)
{
return
api
.
post
({
return
api
.
post
({
method
:
`scrm.api.shopmall.weapp.shoppingcart.list`
,
method
:
`scrm.api.shopmall.weapp.shoppingcart.list`
,
...
data
...
data
,
})
})
;
},
},
/** 购物车商品变更(比如修改数量) */
/** 购物车商品变更(比如修改数量) */
updateShoppingcart
(
data
)
{
updateShoppingcart
(
data
)
{
return
api
.
post
({
return
api
.
post
({
method
:
`scrm.api.shopmall.weapp.shoppingcart.update`
,
method
:
`scrm.api.shopmall.weapp.shoppingcart.update`
,
...
data
...
data
,
})
})
;
},
},
/** 领取确认订单最大优惠券 */
/** 领取确认订单最大优惠券 */
getMaxCoupon
(
orderGoods
)
{
getMaxCoupon
(
orderGoods
)
{
return
api
.
fetch
(
'scrm.api.shopmall.weapp.order.coupons.get.HMD'
,
{
return
api
.
fetch
(
"scrm.api.shopmall.weapp.order.coupons.get.HMD"
,
{
orderGoods
orderGoods
,
})
})
;
},
},
/**购物车结算 */
/**购物车结算 */
settlementShoppingcart
(
data
)
{
settlementShoppingcart
(
data
)
{
return
api
.
post
({
return
api
.
post
({
method
:
`scrm.api.shopmall.weapp.shoppingcart.settlement`
,
method
:
`scrm.api.shopmall.weapp.shoppingcart.settlement`
,
...
data
...
data
,
})
})
;
},
},
/** 创建订单(立即购买) */
/** 创建订单(立即购买) */
createOrder
(
data
)
{
createOrder
(
data
)
{
return
api
.
post
({
return
api
.
post
({
method
:
`scrm.api.shopmall.weapp.order.create`
,
method
:
`scrm.api.shopmall.weapp.order.create`
,
...
data
...
data
,
})
})
;
},
},
/**创建支付订单(去付款) */
/**创建支付订单(去付款) */
payOrder
(
data
)
{
payOrder
(
data
)
{
return
api
.
post
({
return
api
.
post
({
method
:
`scrm.api.shopmall.weapp.order.createPay`
,
method
:
`scrm.api.shopmall.weapp.order.createPay`
,
...
data
...
data
,
})
})
;
},
},
/**订单详情 */
/**订单详情 */
getOrderDetail
(
orderCode
)
{
getOrderDetail
(
orderCode
)
{
return
api
.
post
({
return
api
.
post
({
method
:
`scrm.api.shopmall.weapp.order.detail`
,
method
:
`scrm.api.shopmall.weapp.order.detail`
,
orderCode
orderCode
,
})
})
;
},
},
/**获取订单的售后详情 */
/**获取订单的售后详情 */
getOrderRefundDetail
(
orderCode
)
{
getOrderRefundDetail
(
orderCode
)
{
return
api
.
post
({
return
api
.
post
({
method
:
`scrm.api.shopmall.weapp.orderRefund.detail`
,
method
:
`scrm.api.shopmall.weapp.orderRefund.detail`
,
orderCode
orderCode
,
})
})
;
},
},
/**活动详情 */
/**活动详情 */
getActivityDetail
(
id
)
{
getActivityDetail
(
id
)
{
return
api
.
fetch
(
'scrm.api.shopmall.weapp.activity.detail'
,
{
return
api
.
fetch
(
"scrm.api.shopmall.weapp.activity.detail"
,
{
id
id
,
})
})
;
},
},
/** 根据商品ID获取商品 */
/** 根据商品ID获取商品 */
getGoodsDetail
(
id
)
{
getGoodsDetail
(
id
)
{
return
api
.
fetch
(
'scrm.api.shopmall.weapp.goods.getById.HMD'
,
{
return
api
.
fetch
(
"scrm.api.shopmall.weapp.goods.getById.HMD"
,
{
id
,
id
,
viewAmount
:
true
viewAmount
:
true
,
})
})
;
},
},
/** 获取商品关联优惠券列表 */
/** 获取商品关联优惠券列表 */
getGoodscouponList
(
data
)
{
getGoodscouponList
(
data
)
{
return
api
.
fetch
(
'scrm.api.coupon.seahorse.knife.goods.list'
,
data
)
return
api
.
fetch
(
"scrm.api.coupon.seahorse.knife.goods.list"
,
data
);
},
},
/** 领取商品详情优惠券 */
/** 领取商品详情优惠券 */
getCoupon
(
data
)
{
getCoupon
(
data
)
{
return
api
.
fetch
(
'scrm.api.coupon.customer.receive'
,
data
)
return
api
.
fetch
(
"scrm.api.coupon.customer.receive"
,
data
);
},
},
/**根据规格值组合获取规格组合库存及零售价 */
/**根据规格值组合获取规格组合库存及零售价 */
getGoodsSpecificationExtra
(
data
)
{
getGoodsSpecificationExtra
(
data
)
{
return
api
.
post
({
return
api
.
post
({
method
:
`scrm.api.shopmall.weapp.goods.getGoodsSpecificationExtra`
,
method
:
`scrm.api.shopmall.weapp.goods.getGoodsSpecificationExtra`
,
...
data
...
data
,
})
})
;
},
},
/** 小程序端根据优惠券id查询可使用商品列表(分页) */
/** 小程序端根据优惠券id查询可使用商品列表(分页) */
getCouponGoodsPage
(
data
)
{
getCouponGoodsPage
(
data
)
{
data
.
pageSize
=
8
data
.
pageSize
=
8
;
return
api
.
post
({
return
api
.
post
({
method
:
'scrm.app.shopmall.coupon.goods.page'
,
method
:
"scrm.app.shopmall.coupon.goods.page"
,
...
data
...
data
,
})
})
;
},
},
//取消付款
//取消付款
cancelPay
(
orderCode
)
{
cancelPay
(
orderCode
)
{
return
api
.
fetch
(
'scrm.api.shopmall.weapp.order.cancelPay'
,
{
return
api
.
fetch
(
"scrm.api.shopmall.weapp.order.cancelPay"
,
{
orderCode
orderCode
,
})
})
;
},
},
/** 申请售后 */
/** 申请售后 */
afterSale
(
data
)
{
afterSale
(
data
)
{
return
api
.
fetch
(
'scrm.api.shopmall.weapp.orderRefund.apply'
,
data
)
return
api
.
fetch
(
"scrm.api.shopmall.weapp.orderRefund.apply"
,
data
);
},
},
//申请售后待审核的订单取消售后
//申请售后待审核的订单取消售后
cancelOrder
(
orderCode
)
{
cancelOrder
(
orderCode
)
{
return
api
.
fetch
(
'scrm.api.shopmall.weapp.orderRefund.cancel'
,
{
return
api
.
fetch
(
"scrm.api.shopmall.weapp.orderRefund.cancel"
,
{
orderCode
orderCode
,
})
})
;
},
},
/** 为售后添加退货快递信息 */
/** 为售后添加退货快递信息 */
addDelivery
(
data
)
{
addDelivery
(
data
)
{
return
api
.
post
({
return
api
.
post
({
method
:
`scrm.api.shopmall.weapp.orderRefund.addDelivery`
,
method
:
`scrm.api.shopmall.weapp.orderRefund.addDelivery`
,
...
data
...
data
,
})
})
;
},
},
requestSubscribeMessage
()
{
requestSubscribeMessage
()
{
return
api
.
fetch
(
'scrm.api.shopmall.weapp.order.listSubscribeMsgTemplateIds'
)
return
api
.
fetch
(
"scrm.api.shopmall.weapp.order.listSubscribeMsgTemplateIds"
);
},
},
/** 确认收货 */
/** 确认收货 */
confirmReceipt
(
orderCode
)
{
confirmReceipt
(
orderCode
)
{
return
api
.
post
({
return
api
.
post
({
method
:
`scrm.api.shopmall.weapp.order.confirmReceipt`
,
method
:
`scrm.api.shopmall.weapp.order.confirmReceipt`
,
orderCode
orderCode
,
})
})
;
},
},
/**分类列表
/**分类列表
...
@@ -168,8 +170,8 @@ module.exports = {
...
@@ -168,8 +170,8 @@ module.exports = {
method
:
`scrm.api.shopmall.classify.page.curMerchant`
,
method
:
`scrm.api.shopmall.classify.page.curMerchant`
,
pageSize
:
9999
,
pageSize
:
9999
,
currentPage
:
1
,
currentPage
:
1
,
...
data
...
data
,
})
})
;
},
},
/**分类商品 */
/**分类商品 */
getMerchantClassifyGoods
(
data
)
{
getMerchantClassifyGoods
(
data
)
{
...
@@ -177,23 +179,23 @@ module.exports = {
...
@@ -177,23 +179,23 @@ module.exports = {
method
:
`scrm.api.shopmall.classify.getById`
,
method
:
`scrm.api.shopmall.classify.getById`
,
pageSize
:
10
,
pageSize
:
10
,
currentPage
:
1
,
currentPage
:
1
,
...
data
...
data
,
})
})
;
},
},
/** 获取活动分享链接 */
/** 获取活动分享链接 */
getActivitylink
(
id
)
{
getActivitylink
(
id
)
{
return
api
.
post
({
return
api
.
post
({
method
:
'scrm.api.shopmall.activity.get.shared'
,
method
:
"scrm.api.shopmall.activity.get.shared"
,
id
id
,
})
})
;
},
},
/** 获取商品分享链接 */
/** 获取商品分享链接 */
getGoodslink
(
id
)
{
getGoodslink
(
id
)
{
return
api
.
post
({
return
api
.
post
({
method
:
'scrm.api.shopmall.goods.get.shared'
,
method
:
"scrm.api.shopmall.goods.get.shared"
,
id
id
,
})
})
;
},
},
removeBuuCar
(
data
)
{
removeBuuCar
(
data
)
{
return
api
.
post
({
return
api
.
post
({
...
@@ -201,4 +203,12 @@ module.exports = {
...
@@ -201,4 +203,12 @@ module.exports = {
...
data
,
...
data
,
});
});
},
},
}
\ No newline at end of file
\ No newline at end of file
/**埋点接口 */
trackHttp
(
data
)
{
return
api
.
post
({
method
:
"entmicro.api.customercollect.reportCustomerList"
,
...
data
,
});
},
};
app.js
View file @
f146ae1
...
@@ -8,7 +8,7 @@ import { router } from "./router/index";
...
@@ -8,7 +8,7 @@ import { router } from "./router/index";
import
{
getUpdateManager
}
from
"./lib/index"
;
import
{
getUpdateManager
}
from
"./lib/index"
;
import
utils
from
"./utils/index"
;
import
utils
from
"./utils/index"
;
// 埋点 有需要再引入
// 埋点 有需要再引入
// import
'./utils/track/Track'
import
TRACK
from
'./utils/track/Track'
/**分享 */
/**分享 */
import
'~/utils/share'
import
'~/utils/share'
App
({
App
({
...
@@ -21,6 +21,7 @@ App({
...
@@ -21,6 +21,7 @@ App({
api
,
api
,
router
,
router
,
storage
:
new
utils
.
cache
.
Storage
(),
storage
:
new
utils
.
cache
.
Storage
(),
$Track
:
new
TRACK
(
options
)
};
};
// 存储设备信息
// 存储设备信息
console
.
log
(
wx
.
p
);
console
.
log
(
wx
.
p
);
...
...
packageStrategy/pages/strategyDetail/index.js
View file @
f146ae1
...
@@ -9,7 +9,7 @@ Page({
...
@@ -9,7 +9,7 @@ Page({
// 触发埋点
// 触发埋点
this
.
heartbeatFn
({
this
.
heartbeatFn
({
id
:
options
.
id
,
id
:
options
.
id
,
item_type
:
1
,
item_type
:
6
,
view
:
1
view
:
1
})
})
},
},
...
@@ -53,7 +53,7 @@ Page({
...
@@ -53,7 +53,7 @@ Page({
business_type
:
1
,
business_type
:
1
,
add_way
:
104
,
add_way
:
104
,
merchant_id
:
wx
.
p
.
storage
.
get
(
'srcm_shopmall_merchant_id'
),
merchant_id
:
wx
.
p
.
storage
.
get
(
'srcm_shopmall_merchant_id'
),
guest_no
:
wx
.
$Track
.
getGuestNo
(),
//游客ID,
guest_no
:
wx
.
p
.
$Track
.
getGuestNo
(),
//游客ID,
user_open_id
:
this
.
shareOpenId
||
''
user_open_id
:
this
.
shareOpenId
||
''
}
}
this
.
firstEnter
=
false
this
.
firstEnter
=
false
...
...
packageStrategy/pages/strategyDetail/index.wxml
View file @
f146ae1
<view class="strategy-detail-box">
<view class="strategy-detail-box">
<view class="strategy-detail-title">{{strategyDetailObj.strategyName}}</view>
<view class="strategy-detail-title">{{strategyDetailObj.strategyName}}</view>
<view class="strategy-detail-view">{{strategyDetailObj.viewAmount}}人浏览</view>
<view class="strategy-detail-view">{{strategyDetailObj.viewAmount
|| 0
}}人浏览</view>
<image webp src="{{
item
.strategyImg}}" class="strategy-img"></image>
<image webp src="{{
strategyDetailObj
.strategyImg}}" class="strategy-img"></image>
<mp-html content="{{strategyDetailObj.content}}"></mp-html>
<mp-html content="{{strategyDetailObj.content}}"></mp-html>
</view>
</view>
\ No newline at end of file
\ No newline at end of file
packageStrategy/pages/strategyDetail/index.wxss
View file @
f146ae1
.strategy-detail-box {
.strategy-detail-box {
height: 100vh;
height: 100vh;
background: #FFFFFF
;
background: #ffffff
;
padding: 30rpx 40rpx;
padding: 30rpx 40rpx;
box-sizing: border-box;
box-sizing: border-box;
}
}
.strategy-detail-title {
.strategy-detail-title {
font-weight: 600;
font-weight: 600;
font-size: 48rpx;
font-size: 48rpx;
color: #333333;
color: #333333;
letter-spacing: 2rpx;
letter-spacing: 2rpx;
}
}
.strategy-detail-view {
.strategy-detail-view {
font-weight: 400;
font-weight: 400;
font-size: 32rpx;
font-size: 32rpx;
color: #999999;
color: #999999;
margin-top: 24rpx;
}
}
.strategy-img {
.strategy-img {
width: 670rpx;
width: 670rpx;
height: 376rpx;
height: 376rpx;
border-radius: 16rpx;
border-radius: 16rpx;
padding: 42rpx 0;
-webkit-border-radius: 16rpx;
-webkit-border-radius: 16rpx;
-moz-border-radius: 16rpx;
-moz-border-radius: 16rpx;
-ms-border-radius: 16rpx;
-ms-border-radius: 16rpx;
...
...
utils/cache/storage.js
View file @
f146ae1
...
@@ -51,6 +51,7 @@ class Storage {
...
@@ -51,6 +51,7 @@ class Storage {
* @param {*} syncFlag | 同步状态,默认 false (异步),true 为同步
* @param {*} syncFlag | 同步状态,默认 false (异步),true 为同步
*/
*/
get
=
(
key
,
syncFlag
=
true
)
=>
{
get
=
(
key
,
syncFlag
=
true
)
=>
{
console
.
log
(
key
,
'===='
);
// 有值默认取key值
// 有值默认取key值
if
(
key
)
{
if
(
key
)
{
// 判断值是否是指定的对象值
// 判断值是否是指定的对象值
...
...
utils/constants.js
View file @
f146ae1
...
@@ -13,6 +13,9 @@ export const STORAGE_OBJECTkEY = {
...
@@ -13,6 +13,9 @@ export const STORAGE_OBJECTkEY = {
unauthorized
:
'unauthorized'
,
unauthorized
:
'unauthorized'
,
wx_user_info
:
'wx_user_info'
,
wx_user_info
:
'wx_user_info'
,
srcm_shopmall_brand_list
:
'srcm_shopmall_brand_list'
,
srcm_shopmall_brand_list
:
'srcm_shopmall_brand_list'
,
scrm_shopmall_staff_uuid
:
'scrm_shopmall_staff_uuid'
,
srcm_shopmall_merchant_id
:
'srcm_shopmall_merchant_id'
,
guest_no
:
'guest_no'
}
}
export
default
{
export
default
{
...
...
utils/track/Track.js
View file @
f146ae1
...
@@ -5,7 +5,8 @@ import mapApi from '../mapapi/mapapi'
...
@@ -5,7 +5,8 @@ import mapApi from '../mapapi/mapapi'
import
api
from
'~/api/request/http'
import
api
from
'~/api/request/http'
import
{
getUserInfo
}
from
'~/utils/cache/userInfo'
import
{
getUserInfo
}
from
'~/utils/cache/userInfo'
// 实例化对象存储
// 实例化对象存储
import
{
Storage
}
from
'~/utils/cache/storage'
// import { Storage } from '~/utils/cache/storage'
import
Storage
from
'~/utils/cache/storage'
const
$Storage
=
new
Storage
()
const
$Storage
=
new
Storage
()
let
TRACK_TIME
=
null
,
let
TRACK_TIME
=
null
,
...
@@ -188,4 +189,4 @@ class TRACK {
...
@@ -188,4 +189,4 @@ class TRACK {
}
}
}
}
wx
.
$Track
=
new
TRACK
()
export
default
TRACK
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