Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
points-mall
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 d06bfbad
authored
Aug 20, 2025
by
zhangxw
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
登录修改
1 parent
b466f6fb
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
365 additions
and
234 deletions
components/Sku/index.js
components/Sku/index.scss
components/Sku/index.wxml
components/goods/goods.json
components/goods/goods.wxml
packageIndex/pages/goodsDetail/index.js
packageIndex/pages/goodsDetail/index.wxml
pages/Login/Login.js
pages/loading/loading.js
pages/tab/index/index.js
router/router.config.js
utils/constants.js
components/Sku/index.js
View file @
d06bfba
// import { shopmallApi } from '~/api/api'
// import USERAPI from "~/api/usersApi/index";
import
NP
from
'number-precision'
import
cartApi
from
'~/api/module/cart.js'
Component
({
/**
* 组件的属性列表
...
...
@@ -9,7 +8,12 @@ Component({
show
:
Boolean
,
address
:
Array
,
type
:
String
,
goods
:
Object
,
goods
:
{
type
:
Object
,
observer
:
function
(
n
)
{
this
.
setDefaultSku
(
n
)
}
},
defaultAddress
:
Object
,
defaultAds
:
String
,
staffShop
:
Boolean
,
...
...
@@ -26,6 +30,26 @@ Component({
* 组件的方法列表
*/
methods
:
{
setDefaultSku
(
skuData
)
{
let
{
specificationList
}
=
skuData
let
[
specificationDetailList
]
=
skuData
.
specificationDetailList
console
.
log
(
specificationDetailList
,
specificationList
)
let
defaultGoods
=
specificationDetailList
.
specificationData
.
split
(
'&'
)
specificationList
.
map
(
e
=>
{
defaultGoods
.
map
(
i
=>
{
let
[
key
,
value
]
=
i
.
split
(
'-'
)
if
(
key
==
e
.
specificationName
)
{
e
.
specificationValueList
.
map
(
c
=>
{
if
(
c
.
specificationValue
==
value
)
c
.
active
=
true
})
}
})
})
specificationDetailList
.
retailPrice
=
specificationDetailList
.
retailPrice
this
.
setData
({
goods
:
skuData
})
},
computeJf
(
num
)
{
let
{
goods
,
jfCount
,
staffShop
}
=
this
.
data
if
(
!
staffShop
)
return
...
...
@@ -64,10 +88,35 @@ Component({
remain
:
e
.
detail
.
value
})
},
choose
(
e
)
{
let
{
ind
,
index
}
=
e
.
currentTarget
.
dataset
let
{
goods
:
{
specificationList
,
specificationDetailList
}
}
=
this
.
data
let
activeList
=
[]
if
(
specificationList
[
index
].
specificationValueList
[
ind
].
active
)
return
specificationList
[
index
].
specificationValueList
.
map
(
i
=>
(
i
.
active
=
false
))
specificationList
[
index
].
specificationValueList
[
ind
].
active
=
true
specificationList
.
map
(
i
=>
{
i
.
specificationValueList
.
map
(
c
=>
{
if
(
c
.
active
)
activeList
.
push
(
`
${
i
.
specificationName
}
-
${
c
.
specificationValue
}
`
)
})
})
let
specificationData
=
activeList
.
join
(
'&'
)
this
.
setData
({
[
`goods.specificationList[
${
index
}
]`
]:
specificationList
[
index
]
})
this
.
setData
({
goodsNumber
:
1
})
const
thisPage
=
wx
.
p
.
router
.
getPageInstance
()
thisPage
.
setData
({
activeSku
:
specificationData
})
},
toCreatedOrder
()
{
// const userInfo = wx.p.util.getUserInfo()
// const userStorage = wx.$storage.get("userInfo");
const
{
remain
,
goods
,
goodsNumber
,
defaultAddress
,
staffShop
}
=
this
.
data
const
userInfo
=
wx
.
p
.
storage
.
get
(
'userInfo'
)
const
{
remain
,
goods
,
goodsNumber
,
defaultAddress
,
staffShop
,
clickType
}
=
this
.
data
if
(
!
defaultAddress
.
receiveName
){
return
wx
.
$api
.
showToast
(
'请选择收货地址'
)
}
...
...
@@ -89,73 +138,20 @@ Component({
sellQty
:
goodsNumber
,
}],
}
wx
.
$api
.
showLoading
(
'支付中...'
)
const
HTTPNAME
=
staffShop
?
'jfToCreateOrder'
:
'platformGoodsCreateOrder'
shopmallApi
[
HTTPNAME
](
params
).
then
(
res
=>
{
if
(
staffShop
&&!
goods
.
salePrice
){
wx
.
hideLoading
();
wx
.
p
.
router
.
reLaunch
(
'/packageStoreAssistant/packageMine/pages/ShopPaySuccess/index'
)
return
}
if
(
res
)
this
.
toPayOrder
(
res
.
orderCode
)
})
},
toPayOrder
(
orderCode
)
{
const
{
staffShop
}
=
this
.
data
const
HTTPNAME
=
staffShop
?
'orderCreatePay'
:
'platformGoodsPayOrder'
shopmallApi
[
HTTPNAME
]({
orderCode
,
paymentSource
:
1
}).
then
(
res
=>
{
wx
.
hideLoading
();
if
(
res
)
{
const
{
timeStamp
,
nonceStr
,
packages
,
signType
,
paySign
}
=
res
.
payParams
wx
.
requestPayment
({
timeStamp
:
timeStamp
,
nonceStr
:
nonceStr
,
package
:
packages
,
signType
:
signType
,
paySign
:
paySign
,
success
()
{
const
URL
=
staffShop
?
'/packageStoreAssistant/packageMine/pages/ShopPaySuccess/index'
:
'/packageShopmall/packageMine/pages/order/complete/complete'
wx
.
p
.
router
.
reLaunch
(
URL
,
{
success
:
true
,
})
},
fail
(
res
)
{
if
(
res
.
errMsg
==
'requestPayment:fail cancel'
)
{
wx
.
$api
.
showToast
(
'取消支付'
)
}
}
})
}
if
(
staffShop
){
wx
.
p
.
eventbus
.
emit
(
'REFRESH_WITHDRALWAL'
)
}
})
},
// 检查登录状态
async
checkLoginStatus
()
{
this
.
toCreatedOrder
()
return
if
(
this
.
data
.
staffShop
){
this
.
setData
({
showJfModal
:
true
})
return
if
(
clickType
==
'join'
)
{
// 添加购物车
cartApi
.
addToCart
().
then
(
res
=>
{
let
{
code
,
message
}
=
res
if
(
code
==
0
)
{
this
.
closeSku
()
wx
.
p
.
wxApi
.
showToast
(
'加入购物车成功'
)
}
else
{
wx
.
p
.
wxApi
.
showToast
(
message
)
}
})
}
else
{
wx
.
p
.
router
.
go
(
'/pageIndex/pages/confirmOrder/index'
)
}
const
sessionId
=
wx
.
p
.
util
.
getSessionId
(),
userInfo
=
wx
.
p
.
util
.
getUserInfo
()
||
null
;
if
((
userInfo
&&
!
userInfo
.
phone
)
||
!
userInfo
)
return
this
.
reLogin
()
if
(
sessionId
)
{
const
{
code
}
=
await
USERAPI
.
checkSession
({
sessionId
,
});
if
(
code
==
"0"
)
this
.
toCreatedOrder
()
else
this
.
reLogin
();
}
else
this
.
reLogin
();
},
reLogin
()
{
wx
.
navigateTo
({
url
:
'/pages/Login/Login'
})
}
}
})
components/Sku/index.scss
View file @
d06bfba
...
...
@@ -79,23 +79,33 @@
}
.sku-list
{
display
:
flex
;
flex-wrap
:
wrap
;
.sku
{
padding
:
6rpx
20rpx
;
background
:
#F5F6FA
;
border-radius
:
12rpx
;
margin-right
:
16rpx
;
margin-bottom
:
20rpx
;
.sku-title
{
color
:
#2D2D2E
;
font-weight
:
500
;
padding-top
:
var
(
--
margin
);
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
}
.sku_active
{
background
:
#fc5b32
0f
;
border
:
2rpx
solid
#FC5B32
;
border-radius
:
4rpx
;
font-weight
:
400
;
.sku-item
{
display
:
flex
;
flex-wrap
:
wrap
;
.item
{
height
:
52rpx
;
background
:
#F7F8FA
;
padding
:
0
20rpx
;
margin
:
20rpx
20rpx
0
0
;
font-size
:
24rpx
;
color
:
#FC5B32
;
color
:
#656566
;
border
:
2rpx
solid
#F7F8FA
;
box-sizing
:
border-box
;
border-radius
:
4rpx
;
&
.active
{
border-color
:
rgb
(
252
,
91
,
50
);
color
:
rgb
(
252
,
91
,
50
);
background-color
:
rgba
(
252
,
91
,
50
,
.06
);
}
}
}
}
}
...
...
components/Sku/index.wxml
View file @
d06bfba
...
...
@@ -18,9 +18,18 @@
<view class="sku-box">
<view class="title">规格</view>
<view class="sku-list">
<block wx:for="{{goods.specificationResponses}}" wx:key="index">
<block wx:for="{{goods.specificationList}}" wx:key="index">
<view class="sku-title">{{item.specificationName}}</view>
<view class="sku-item">
<block wx:for="{{item.specificationValueList}}" wx:key="ind" wx:for-index="ind" wx:for-item="i">
<view class="item text-center {{i.active?'active':''}} {{i.stock ===0?'disabled':''}}" bindtap="choose" data-index="{{index}}"
data-ind="{{ind}}">{{i.specificationValue}}</view>
</block>
</view>
</block>
<!-- <block wx:for="{{goods.specificationResponses}}" wx:key="index">
<view class="sku flex_cc sku_active">{{item.specName}}:{{item.specValue}}</view>
</block>
</block>
-->
</view>
</view>
<view class="count-box flex_scb">
...
...
@@ -38,7 +47,7 @@
<textarea bindinput="intRemain" maxlength="100" class="textArea" placeholder="请输入备注信息(选填)" placeholder-class="textarea-placeholder"></textarea>
</view>
</view>
<view bind:tap="toShowAddressModal" class="adress-box flex_scb">
<view bind:tap="toShowAddressModal" class="adress-box flex_scb"
wx:if="{{true}}"
>
<view class="title">收货地址</view>
<view class="right flex_scb">
<view class="content {{defaultAds?'':'emptyText'}}">{{defaultAds || '请选择'}}</view>
...
...
@@ -47,7 +56,7 @@
</view>
<view class="btn-wrap flex_cc">
<view wx:if="{{staffShop&&!canPay}}" class="btn flex_cc diable_btn">积分不足</view>
<view wx:else bind:tap="
checkLoginStatus
" class="btn flex_cc">确认</view>
<view wx:else bind:tap="
toCreatedOrder
" class="btn flex_cc">确认</view>
</view>
<view style="height:290rpx"></view>
</view>
...
...
components/goods/goods.json
View file @
d06bfba
{
"component"
:
true
,
"usingComponents"
:
{}
"usingComponents"
:
{
"sku"
:
"../Sku/index"
}
}
\ No newline at end of file
components/goods/goods.wxml
View file @
d06bfba
...
...
@@ -43,4 +43,5 @@
</view>
</view>
</template>
</view>
\ No newline at end of file
</view>
<sku bind:cancelSku="closeSku" bind:getCount="getCount" bind:sameAddress="resetAddress" wx:if="{{showSku}}" show="{{showSku}}" clickType="{{'join'}}"></sku>
\ No newline at end of file
packageIndex/pages/goodsDetail/index.js
View file @
d06bfba
...
...
@@ -127,12 +127,115 @@ Page({
"imgMain"
:
0
,
"imgSort"
:
1
}
],
"specificationResponses"
:
[
{
"specName"
:
"颜色"
,
"specValue"
:
"鹅黄"
"specificationList"
:
[
{
"id"
:
3957
,
"goodsId"
:
null
,
"specificationName"
:
"1"
,
"createdBy"
:
null
,
"createdDate"
:
null
,
"updatedBy"
:
null
,
"updatedDate"
:
null
,
"deletedFlag"
:
null
,
"specificationValueList"
:
[
{
"id"
:
4946
,
"goodsSpecificationId"
:
3957
,
"specificationValue"
:
"1"
,
"createdBy"
:
"bobodmd"
,
"createdDate"
:
1755518778000
,
"updatedBy"
:
"bobodmd"
,
"updatedDate"
:
1755518778000
,
"deletedFlag"
:
"N"
},
{
"id"
:
4948
,
"goodsSpecificationId"
:
3957
,
"specificationValue"
:
"2"
,
"createdBy"
:
"bobodmd"
,
"createdDate"
:
1755674239000
,
"updatedBy"
:
"bobodmd"
,
"updatedDate"
:
1755674239000
,
"deletedFlag"
:
"N"
}
]
},
{
"specName"
:
"选择尺寸"
,
"specValue"
:
"28寸"
"id"
:
3958
,
"goodsId"
:
null
,
"specificationName"
:
"2"
,
"createdBy"
:
null
,
"createdDate"
:
null
,
"updatedBy"
:
null
,
"updatedDate"
:
null
,
"deletedFlag"
:
null
,
"specificationValueList"
:
[
{
"id"
:
4947
,
"goodsSpecificationId"
:
3958
,
"specificationValue"
:
"2"
,
"createdBy"
:
"bobodmd"
,
"createdDate"
:
1755518778000
,
"updatedBy"
:
"bobodmd"
,
"updatedDate"
:
1755518778000
,
"deletedFlag"
:
"N"
},
{
"id"
:
4949
,
"goodsSpecificationId"
:
3958
,
"specificationValue"
:
"3"
,
"createdBy"
:
"bobodmd"
,
"createdDate"
:
1755674239000
,
"updatedBy"
:
"bobodmd"
,
"updatedDate"
:
1755674239000
,
"deletedFlag"
:
"N"
}
]
}
],
"specificationDetailList"
:
[
{
"id"
:
5448
,
"goodsId"
:
22525
,
"retailPrice"
:
500
,
"stock"
:
3
,
"specificationData"
:
"1-1&2-3"
,
"specificationKey"
:
"d61482cdf947ade156679a5f861a8701"
,
"originGoodsId"
:
null
,
"createdBy"
:
"bobodmd"
,
"createdDate"
:
1755674239000
,
"updatedBy"
:
"bobodmd"
,
"updatedDate"
:
1755674239000
,
"deletedFlag"
:
"N"
},
{
"id"
:
5447
,
"goodsId"
:
22525
,
"retailPrice"
:
1000
,
"stock"
:
1
,
"specificationData"
:
"1-1&2-2"
,
"specificationKey"
:
"8ab61fe03f6398a177cbcd988f7b7b96"
,
"originGoodsId"
:
null
,
"createdBy"
:
"bobodmd"
,
"createdDate"
:
1755674239000
,
"updatedBy"
:
"bobodmd"
,
"updatedDate"
:
1755674239000
,
"deletedFlag"
:
"N"
},
{
"id"
:
5450
,
"goodsId"
:
22525
,
"retailPrice"
:
1000
,
"stock"
:
1
,
"specificationData"
:
"1-2&2-3"
,
"specificationKey"
:
"a5798f7c9dfc46609c85f76c67e8915b"
,
"originGoodsId"
:
null
,
"createdBy"
:
"bobodmd"
,
"createdDate"
:
1755674239000
,
"updatedBy"
:
"bobodmd"
,
"updatedDate"
:
1755674239000
,
"deletedFlag"
:
"N"
},
{
"id"
:
5449
,
"goodsId"
:
22525
,
"retailPrice"
:
1500
,
"stock"
:
2
,
"specificationData"
:
"1-2&2-2"
,
"specificationKey"
:
"4348e92ea0b37d7a36b5f64feb467ead"
,
"originGoodsId"
:
null
,
"createdBy"
:
"bobodmd"
,
"createdDate"
:
1755674239000
,
"updatedBy"
:
"bobodmd"
,
"updatedDate"
:
1755674239000
,
"deletedFlag"
:
"N"
}
],
"goodsDescribe"
:
"<p>22</p>"
,
"goodsPosition"
:
2
,
...
...
@@ -207,7 +310,8 @@ Page({
countyName
:
'南山区'
,
address
:
'南山智园崇文园区1号楼14层'
,
isDefault
:
0
}]
}],
defaultAddress
:
{}
},
appHide
()
{
wx
.
offAppHide
()
...
...
@@ -236,17 +340,15 @@ Page({
})
},
goodsActionClick
(
e
)
{
if
(
e
.
detail
==
'join'
)
return
this
.
toAddShopCar
()
if
(
this
.
data
.
isCarOwner
)
return
this
.
judgePayWay
()
this
.
showSkuModal
(
e
.
detail
)
},
onLoad
(
options
)
{
wx
.
p
.
router
.
getRouterParams
(
options
).
then
(
params
=>
{
//
this.getDetail(options)
this
.
getDetail
(
options
)
}).
catch
(
err
=>
{
console
.
error
(
'参数获取失败:'
,
err
)
})
// this.getPlatFormAddress(staff
)
this
.
getPlatFormAddress
(
)
},
showSkuModal
(
type
)
{
// if (this.data.isCarOwner) return
...
...
@@ -261,39 +363,57 @@ Page({
})
},
// 获取默认的地址
getPlatFormAddress
(
s
ta
ff
)
{
wx
.
showLoading
()
getPlatFormAddress
(
s
at
ff
)
{
//
wx.showLoading()
let
para
=
{}
if
(
staff
)
{
para
.
businessType
=
1
}
else
{
const
SID
=
wx
.
p
.
util
.
getSessionId
()
if
(
!
SID
)
return
wx
.
hideLoading
()
}
shopmallApi
.
platformAddressList
(
para
).
then
(
data
=>
{
wx
.
hideLoading
()
let
contactAddress
=
''
,
defaultAddress
=
{}
let
_isSetDefault
=
false
if
(
data
&&
data
.
length
)
{
data
.
forEach
(
el
=>
{
if
(
el
.
isDefault
==
1
)
{
contactAddress
=
el
.
provinceName
+
el
.
cityName
+
el
.
countyName
+
el
.
address
,
defaultAddress
=
el
_isSetDefault
=
true
}
})
if
(
!
_isSetDefault
)
{
let
_first
=
data
[
0
]
// if (staff) {
// para.businessType = 1
// }else{
// const SID = wx.p.util.getSessionId()
// if (!SID) return wx.hideLoading()
// }
let
contactAddress
=
''
,
defaultAddress
=
{}
let
_isSetDefault
=
false
this
.
data
.
addressList
?.
forEach
(
el
=>
{
if
(
el
.
isDefault
==
1
)
{
contactAddress
=
el
.
provinceName
+
el
.
cityName
+
el
.
countyName
+
el
.
address
,
defaultAddress
=
el
_isSetDefault
=
true
}
})
if
(
!
_isSetDefault
)
{
let
_first
=
this
.
data
.
addressList
[
0
]
contactAddress
=
_first
.
provinceName
+
_first
.
cityName
+
_first
.
countyName
+
_first
.
address
,
defaultAddress
=
_first
}
}
this
.
setData
({
addressList
:
data
,
contactAddress
,
defaultAddress
})
}
this
.
setData
({
contactAddress
,
defaultAddress
})
// shopmallApi.platformAddressList(para).then(data => {
// wx.hideLoading()
// let contactAddress = '', defaultAddress = {}
// let _isSetDefault = false
// if (data && data.length) {
// data.forEach(el => {
// if (el.isDefault == 1) {
// contactAddress = el.provinceName + el.cityName + el.countyName + el.address,
// defaultAddress = el
// _isSetDefault = true
// }
// })
// if (!_isSetDefault) {
// let _first = data[0]
// contactAddress = _first.provinceName + _first.cityName + _first.countyName + _first.address,
// defaultAddress = _first
// }
// }
// this.setData({
// addressList: data,
// contactAddress,
// defaultAddress
// })
// })
},
jump
(
e
)
{
let
{
url
,
isChooseAddress
}
=
e
.
currentTarget
.
dataset
...
...
@@ -322,50 +442,53 @@ Page({
},
// 获取详情
getDetail
(
options
)
{
if
(
!
options
||
!
options
.
id
)
return
const
{
id
,
staff
,
score
,
isCarOwner
,
openId
}
=
options
const
merchantId
=
wx
.
$storage
.
get
(
"srcm_shopmall_merchant_id"
);
this
.
merchantId
=
merchantId
let
para
=
{
id
},
canPay
=
true
if
(
staff
)
para
.
businessType
=
1
if
(
isCarOwner
)
{
if
(
openId
)
{
this
.
shareOpenId
=
options
.
openId
}
this
.
data
.
enter_time
=
new
Date
().
format
(
'yyyy-MM-dd hh:mm:ss'
)
this
.
firstEnter
=
true
this
.
appHide
()
this
.
getMyIntegral
()
para
.
merchantId
=
merchantId
// if(!options || !options.id)return
// const { id, staff, score, isCarOwner, openId } = options
// const merchantId = wx.$storage.get("srcm_shopmall_merchant_id");
// this.merchantId = merchantId
// let para = { id }, canPay = true
// if (staff) para.businessType = 1
// if (isCarOwner) {
// if (openId) {
// this.shareOpenId = options.openId
// }
// this.data.enter_time = new Date().format('yyyy-MM-dd hh:mm:ss')
// this.firstEnter = true
// this.appHide()
// this.getMyIntegral()
// para.merchantId = merchantId
// }
let
data
=
this
.
data
.
detailInfo
let
activeSku
=
null
if
(
data
?.
specificationDetailList
&&
data
?.
specificationDetailList
?.
length
)
{
activeSku
=
data
?.
specificationDetailList
[
0
]?.
specificationData
data
.
skuPrice
=
data
.
specificationDetailList
[
0
].
retailPrice
}
shopmallApi
.
platformGoodsDetail
(
para
).
then
(
res
=>
{
if
(
res
&&
res
.
specificationResponses
)
{
this
.
toGetSpecString
(
res
,
res
.
startQty
)
}
if
(
staff
)
{
canPay
=
score
>
res
.
redeemPoints
}
// if (isCarOwner) {
// res.retailPrice = NP.divide(res.retailPrice, 100)
// }
this
.
setData
({
detailInfo
:
res
||
{},
canPay
,
isCarOwner
})
})
},
toGetSpecString
(
info
,
count
)
{
let
skuInfo
=
this
.
data
,
num
=
''
,
weight
=
''
num
=
`
${
count
}${
info
.
goodsUnit
}
`
weight
=
`
${
info
.
grossWeight
}${
info
.
grossWeightUnit
}
`
skuInfo
=
`
${
info
.
specificationResponses
[
0
].
specValue
}
`
+
`,
${
weight
}
`
+
`,
${
num
}
`
this
.
setData
({
skuInfo
detailInfo
:
data
,
activeSku
})
console
.
log
(
data
)
// this.toGetSpecString(this.data.detailInfo, this.data.detailInfo.startQty)
// shopmallApi.platformGoodsDetail(para).then(res => {
// if (res && res.specificationResponses) {
// this.toGetSpecString(res, res.startQty)
// }
// if (staff) {
// canPay = score > res.redeemPoints
// }
// // if (isCarOwner) {
// // res.retailPrice = NP.divide(res.retailPrice, 100)
// // }
// this.setData({
// detailInfo: res || {},
// canPay,
// isCarOwner
// })
// })
},
getCount
(
e
)
{
this
.
toGetSpecString
(
this
.
data
.
detailInfo
,
e
.
detail
)
//
this.toGetSpecString(this.data.detailInfo, e.detail)
this
.
count
=
e
.
detail
},
// 添加购物车
...
...
@@ -391,11 +514,6 @@ Page({
resetAddress
(
e
)
{
this
.
setData
(
e
.
detail
)
},
toDuiHuang
()
{
if
(
this
.
data
.
canPay
)
{
this
.
showSkuModal
(
'pay'
)
}
},
getViewInfo
()
{
wx
.
$api
.
getViewInfo
(
'.fixed_btn_wrap'
,
...
...
packageIndex/pages/goodsDetail/index.wxml
View file @
d06bfba
...
...
@@ -39,7 +39,7 @@
<view class="price">
<view class="price-box">
<view class="sale-price">
{{
detailInfo.points
Price}}
{{
activeSku ? detailInfo.skuPrice : detailInfo.sell
Price}}
<text>积分</text>
</view>
<view class="market-price">¥{{detailInfo.marketPrice}}</view>
...
...
@@ -51,23 +51,23 @@
<view class="goods-title">{{detailInfo.goodsName}}</view>
</view>
<view class="container-item select-params-box">
<view class="cell">
<view class="flex">
<view class="cell"
wx:if="{{activeSku}}"
>
<view class="flex"
bind:tap="showSkuModal"
>
<view class="title">已选</view>
<view
bind:tap="showSkuModal"
class="content flex_ccc">
<view>{{
skuInfo
}}</view>
<view class="content flex_ccc">
<view>{{
activeSku
}}</view>
</view>
</view>
<mp-icon icon="arrow"
bind:tap="showSkuModal"
color="#B1B1B3" size="{{12}}"></mp-icon>
<mp-icon icon="arrow" color="#B1B1B3" size="{{12}}"></mp-icon>
</view>
<view class="cell">
<view class="cell"
bindtap="jump"
>
<view class="flex">
<view class="title">配送</view>
<view
bindtap="jump"
data-is-choose-address data-url="/packageMine/pages/address/index/index" class="content flex_ccc">
<view data-is-choose-address data-url="/packageMine/pages/address/index/index" class="content flex_ccc">
<view class="address-text">{{contactAddress || '--'}}</view>
</view>
</view>
<mp-icon icon="arrow"
bindtap="jump"
color="#B1B1B3" size="{{12}}"></mp-icon>
<mp-icon icon="arrow" color="#B1B1B3" size="{{12}}"></mp-icon>
</view>
<view class="cell">
<view class="title">服务</view>
...
...
@@ -115,4 +115,4 @@
<block wx:if="{{navHeight&&!staffShop}}">
<goods-action platformShop="{{true}}" bindready="goodsActionReady" pay-disabled="{{false}}" upgradeSet="{{!detailInfo.retailPrice&&detailInfo.exchangeIntegral}}" stock="{{detailInfo.goodsStock===0}}" buyFlag="{{false}}" bindclick="goodsActionClick" hideShop="{{false}}"></goods-action>
</block>
<sku staffShop="{{staffShop}}" canPay="{{canPay}}" bind:cancelSku="closeSku" bind:getCount="getCount" bind:sameAddress="resetAddress" wx:if="{{showSku}}" show="{{showSku}}" defaultAds="{{contactAddress}}" goods="{{detailInfo}}" defaultAddress="{{defaultAddress}}" address="{{addressList}}"></sku>
\ No newline at end of file
<sku staffShop="{{staffShop}}" canPay="{{canPay}}" bind:cancelSku="closeSku" bind:getCount="getCount" bind:sameAddress="resetAddress" wx:if="{{showSku}}" show="{{showSku}}" defaultAds="{{contactAddress}}" goods="{{detailInfo}}" defaultAddress="{{defaultAddress}}" clickType="{{clickType}}" address="{{addressList}}"></sku>
\ No newline at end of file
pages/Login/Login.js
View file @
d06bfba
...
...
@@ -192,6 +192,7 @@ Page({
/**登录回调 */
customerLoginCallBack
(
data
)
{
wx
.
p
.
storage
.
set
(
'sessionId'
,
data
?.
sessionId
)
wx
.
p
.
storage
.
set
(
'userInfo'
,
data
)
// 获取积分来源
this
.
getSource
(
data
)
},
...
...
@@ -209,6 +210,8 @@ Page({
})
}
else
if
(
data
?.
length
==
1
)
{
this
.
setChannelSource
(
data
[
0
]?.
channelSource
,
loginData
)
}
else
{
// 无积分渠道游客
this
.
setChannelSource
(
4
,
loginData
)
}
}
else
{
wx
.
p
.
wxApi
.
showToast
(
message
)
...
...
@@ -218,46 +221,47 @@ Page({
// 设置积分渠道
setChannelSource
(
source
,
loginData
)
{
wx
.
p
.
isLogin
=
true
wx
.
p
.
storage
.
set
(
'userInfo'
,
{...
loginData
})
wx
.
p
.
storage
.
set
(
'channelSource'
,
`
${
source
}
`
)
wx
.
p
.
storage
.
set
(
'sessionId'
,
loginData
?.
sessionId
)
wx
.
p
.
storage
.
set
(
'userInfo'
,
{...
loginData
,
channelSource
:
source
})
// 查询积分钱包
this
.
getPointsWallet
()
},
// 获取积分钱包数据
getPointsWallet
()
{
let
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
commonApi
.
getPointsWalletData
({
phone
:
userInfo
?.
phone
,
name
:
userInfo
?.
nickName
,
scoreSource
:
wx
.
p
.
storage
.
get
(
'channelSource'
)
}).
then
(
res
=>
{
let
{
code
,
data
,
message
}
=
res
if
(
code
==
0
)
{
if
(
data
&&
Object
.
keys
(
data
)?.
length
)
{
// 有数据返回说明已开通钱包
// 调用替换钱包昵称接口
this
.
replaceNickName
(
data
)
}
else
{
let
channelSource
=
wx
.
p
.
storage
.
get
(
'channelSource'
)
// 获取当前积分数量
commonApi
.
getPointsSummary
({
staffPhone
:
userInfo
?.
phone
,
channelSource
}).
then
(
r
=>
{
if
(
r
?.
code
==
0
)
{
// 获取当前积分数量
commonApi
.
getPointsSummary
({
staffPhone
:
userInfo
?.
phone
,
channelSource
:
userInfo
?.
channelSource
}).
then
(
r
=>
{
if
(
r
?.
code
==
0
)
{
this
.
setData
({
walletObj
:
{
name
:
r
?.
data
?.
staffName
,
phone
:
userInfo
?.
phone
,
scoreSource
:
userInfo
?.
channelSource
,
currentScore
:
r
?.
data
?.
currentScore
||
0
}
})
// 获取钱包数据
commonApi
.
getPointsWalletData
({
phone
:
userInfo
?.
phone
,
name
:
r
?.
data
?.
staffName
,
scoreSource
:
userInfo
?.
channelSource
}).
then
(
res
=>
{
let
{
code
,
data
,
message
}
=
res
if
(
code
==
0
)
{
if
(
data
&&
Object
.
keys
(
data
)?.
length
)
{
// 有数据返回说明已开通钱包
// 调用替换钱包昵称接口
this
.
replaceNickName
(
data
)
}
else
{
// 未开通弹出开通钱包弹窗
this
.
setData
({
showEnableWallet
:
true
,
walletObj
:
{
name
:
userInfo
?.
nickName
,
phone
:
userInfo
?.
phone
,
scoreSource
:
channelSource
,
currentScore
:
r
?.
data
?.
currentScore
||
0
}
showEnableWallet
:
true
})
}
else
{
wx
.
p
.
wxApi
.
showToast
(
r
.
message
)
}
})
}
}
else
{
wx
.
p
.
wxApi
.
showToast
(
message
)
}
})
}
else
{
wx
.
p
.
wxApi
.
showToast
(
message
)
wx
.
p
.
wxApi
.
showToast
(
r
.
message
)
}
})
},
// 替换积分钱包
昵
称
// 替换积分钱包
名
称
replaceNickName
(
data
)
{
let
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
commonApi
.
replaceWalletName
({
...
...
@@ -268,7 +272,8 @@ Page({
let
{
code
,
data
,
message
}
=
res
wx
.
p
.
storage
.
set
(
'userInfo'
,
{...
userInfo
,
nickName
:
data
?.
name
})
// 更新storage中的nickName
if
(
code
==
0
)
{
wx
.
p
.
router
.
reLaunch
(
'/pages/tab/index/index'
)
// 返回上一页
wx
.
p
.
router
.
back
()
}
else
{
wx
.
p
.
wxApi
.
showToast
(
message
)
}
...
...
@@ -283,11 +288,11 @@ Page({
// 关闭开通积分钱包弹窗
closeWallet
()
{
this
.
setData
({
showEnableWallet
:
false
})
let
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
let
{
walletObj
}
=
this
.
data
let
data
=
{
name
:
userInfo
?.
nickName
,
phone
:
userInfo
?.
phone
,
scoreSource
:
w
x
.
p
.
storage
.
get
(
'channelSource'
)
name
:
walletObj
?.
nickName
,
phone
:
walletObj
?.
phone
,
scoreSource
:
w
alletObj
?.
channelSource
}
// 替换钱包昵称 使用登录信息返回的数据
this
.
replaceNickName
(
data
)
...
...
@@ -301,6 +306,7 @@ Page({
if
(
code
==
0
)
{
this
.
setData
({
showEnableSuccess
:
true
,
showEnableWallet
:
false
,
walletObj
})
}
else
{
...
...
pages/loading/loading.js
View file @
d06bfba
...
...
@@ -36,16 +36,6 @@ Page({
if
(
code
==
"0"
)
{
wx
.
p
.
isLogin
=
true
;
wx
.
p
.
storage
.
set
(
"sessionId"
,
data
.
sessionId
);
// 获取登录信息
commonApi
.
getLoginInfo
().
then
(
res
=>
{
if
(
res
.
code
==
0
)
{
}
else
{
wx
.
p
.
isLogin
=
false
;
wx
.
p
.
storage
.
rm
(
"userInfo"
);
wx
.
p
.
storage
.
rm
(
"sessionId"
);
}
})
if
(
!
data
)
throw
message
;
}
else
{
wx
.
p
.
isLogin
=
false
;
...
...
pages/tab/index/index.js
View file @
d06bfba
...
...
@@ -129,15 +129,14 @@ Page({
*/
onLoad
(
options
)
{
const
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
let
channelSource
=
wx
.
p
.
storage
.
get
(
'channelSource'
)
this
.
setData
({
userInfo
,
channelSource
})
this
.
setData
({
userInfo
})
// 获取当前积分数据
this
.
getPointsData
()
},
getPointsData
()
{
let
{
userInfo
,
channelSource
}
=
this
.
data
if
(
!
userInfo
?.
phone
&&
!
channelSource
)
return
commonApi
.
getPointsSummary
({
staffPhone
:
userInfo
?.
phone
,
channelSource
:
Number
(
channelSource
)}).
then
(
r
=>
{
let
{
userInfo
}
=
this
.
data
if
(
!
userInfo
?.
phone
&&
!
userInfo
?.
channelSource
)
return
commonApi
.
getPointsSummary
({
staffPhone
:
userInfo
?.
phone
,
channelSource
:
Number
(
userInfo
?.
channelSource
)}).
then
(
r
=>
{
if
(
r
?.
code
==
0
)
{
this
.
setData
({
currentScore
:
r
?.
data
?.
currentScore
||
0
...
...
router/router.config.js
View file @
d06bfba
...
...
@@ -7,6 +7,7 @@
export
const
authPages
=
[
'/packageMine/'
,
'/pages/mine/'
,
'/packageIndex/'
// '/packageIndex/pages/integral/index/index' //积分
];
...
...
utils/constants.js
View file @
d06bfba
...
...
@@ -11,8 +11,7 @@ export const STORAGE_OBJECTkEY = {
sessionId
:
'sessionId'
,
bindInfo
:
'bindInfo'
,
unauthorized
:
'unauthorized'
,
wx_user_info
:
'wx_user_info'
,
channelSource
:
'channelSource'
wx_user_info
:
'wx_user_info'
}
export
default
{
...
...
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