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
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
336 additions
and
205 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
NP
from
'number-precision'
import
cartApi
from
'~/api/module/cart.js'
Component
({
Component
({
/**
/**
* 组件的属性列表
* 组件的属性列表
...
@@ -9,7 +8,12 @@ Component({
...
@@ -9,7 +8,12 @@ Component({
show
:
Boolean
,
show
:
Boolean
,
address
:
Array
,
address
:
Array
,
type
:
String
,
type
:
String
,
goods
:
Object
,
goods
:
{
type
:
Object
,
observer
:
function
(
n
)
{
this
.
setDefaultSku
(
n
)
}
},
defaultAddress
:
Object
,
defaultAddress
:
Object
,
defaultAds
:
String
,
defaultAds
:
String
,
staffShop
:
Boolean
,
staffShop
:
Boolean
,
...
@@ -26,6 +30,26 @@ Component({
...
@@ -26,6 +30,26 @@ Component({
* 组件的方法列表
* 组件的方法列表
*/
*/
methods
:
{
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
)
{
computeJf
(
num
)
{
let
{
goods
,
jfCount
,
staffShop
}
=
this
.
data
let
{
goods
,
jfCount
,
staffShop
}
=
this
.
data
if
(
!
staffShop
)
return
if
(
!
staffShop
)
return
...
@@ -64,10 +88,35 @@ Component({
...
@@ -64,10 +88,35 @@ Component({
remain
:
e
.
detail
.
value
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
()
{
toCreatedOrder
()
{
// const userInfo = wx.p.util.getUserInfo()
const
userInfo
=
wx
.
p
.
storage
.
get
(
'userInfo'
)
// const userStorage = wx.$storage.get("userInfo");
const
{
remain
,
goods
,
goodsNumber
,
defaultAddress
,
staffShop
,
clickType
}
=
this
.
data
const
{
remain
,
goods
,
goodsNumber
,
defaultAddress
,
staffShop
}
=
this
.
data
if
(
!
defaultAddress
.
receiveName
){
if
(
!
defaultAddress
.
receiveName
){
return
wx
.
$api
.
showToast
(
'请选择收货地址'
)
return
wx
.
$api
.
showToast
(
'请选择收货地址'
)
}
}
...
@@ -89,73 +138,20 @@ Component({
...
@@ -89,73 +138,20 @@ Component({
sellQty
:
goodsNumber
,
sellQty
:
goodsNumber
,
}],
}],
}
}
wx
.
$api
.
showLoading
(
'支付中...'
)
if
(
clickType
==
'join'
)
{
const
HTTPNAME
=
staffShop
?
'jfToCreateOrder'
:
'platformGoodsCreateOrder'
// 添加购物车
shopmallApi
[
HTTPNAME
](
params
).
then
(
res
=>
{
cartApi
.
addToCart
().
then
(
res
=>
{
if
(
staffShop
&&!
goods
.
salePrice
){
let
{
code
,
message
}
=
res
wx
.
hideLoading
();
if
(
code
==
0
)
{
wx
.
p
.
router
.
reLaunch
(
'/packageStoreAssistant/packageMine/pages/ShopPaySuccess/index'
)
this
.
closeSku
()
return
wx
.
p
.
wxApi
.
showToast
(
'加入购物车成功'
)
}
}
else
{
if
(
res
)
this
.
toPayOrder
(
res
.
orderCode
)
wx
.
p
.
wxApi
.
showToast
(
message
)
})
},
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
(
'取消支付'
)
}
}
}
})
})
}
else
{
wx
.
p
.
router
.
go
(
'/pageIndex/pages/confirmOrder/index'
)
}
}
if
(
staffShop
){
wx
.
p
.
eventbus
.
emit
(
'REFRESH_WITHDRALWAL'
)
}
})
},
// 检查登录状态
async
checkLoginStatus
()
{
this
.
toCreatedOrder
()
return
if
(
this
.
data
.
staffShop
){
this
.
setData
({
showJfModal
:
true
})
return
}
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 @@
...
@@ -79,23 +79,33 @@
}
}
.sku-list
{
.sku-list
{
.sku-title
{
color
:
#2D2D2E
;
font-weight
:
500
;
padding-top
:
var
(
--
margin
);
display
:
flex
;
display
:
flex
;
flex-wrap
:
wrap
;
align-items
:
center
;
.sku
{
justify-content
:
space-between
;
padding
:
6rpx
20rpx
;
background
:
#F5F6FA
;
border-radius
:
12rpx
;
margin-right
:
16rpx
;
margin-bottom
:
20rpx
;
}
}
.sku-item
{
.sku_active
{
display
:
flex
;
background
:
#fc5b32
0f
;
flex-wrap
:
wrap
;
border
:
2rpx
solid
#FC5B32
;
.item
{
border-radius
:
4rpx
;
height
:
52rpx
;
font-weight
:
400
;
background
:
#F7F8FA
;
padding
:
0
20rpx
;
margin
:
20rpx
20rpx
0
0
;
font-size
:
24rpx
;
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 @@
...
@@ -18,9 +18,18 @@
<view class="sku-box">
<view class="sku-box">
<view class="title">规格</view>
<view class="title">规格</view>
<view class="sku-list">
<view class="sku-list">
<block wx:for="{{goods.specificationResponses}}" wx:key="index">
<block wx:for="{{goods.specificationList}}" wx:key="index">
<view class="sku flex_cc sku_active">{{item.specName}}:{{item.specValue}}</view>
<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>
<!-- <block wx:for="{{goods.specificationResponses}}" wx:key="index">
<view class="sku flex_cc sku_active">{{item.specName}}:{{item.specValue}}</view>
</block> -->
</view>
</view>
</view>
</view>
<view class="count-box flex_scb">
<view class="count-box flex_scb">
...
@@ -38,7 +47,7 @@
...
@@ -38,7 +47,7 @@
<textarea bindinput="intRemain" maxlength="100" class="textArea" placeholder="请输入备注信息(选填)" placeholder-class="textarea-placeholder"></textarea>
<textarea bindinput="intRemain" maxlength="100" class="textArea" placeholder="请输入备注信息(选填)" placeholder-class="textarea-placeholder"></textarea>
</view>
</view>
</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="title">收货地址</view>
<view class="right flex_scb">
<view class="right flex_scb">
<view class="content {{defaultAds?'':'emptyText'}}">{{defaultAds || '请选择'}}</view>
<view class="content {{defaultAds?'':'emptyText'}}">{{defaultAds || '请选择'}}</view>
...
@@ -47,7 +56,7 @@
...
@@ -47,7 +56,7 @@
</view>
</view>
<view class="btn-wrap flex_cc">
<view class="btn-wrap flex_cc">
<view wx:if="{{staffShop&&!canPay}}" class="btn flex_cc diable_btn">积分不足</view>
<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>
<view style="height:290rpx"></view>
<view style="height:290rpx"></view>
</view>
</view>
...
...
components/goods/goods.json
View file @
d06bfba
{
{
"component"
:
true
,
"component"
:
true
,
"usingComponents"
:
{}
"usingComponents"
:
{
"sku"
:
"../Sku/index"
}
}
}
\ No newline at end of file
\ No newline at end of file
components/goods/goods.wxml
View file @
d06bfba
...
@@ -44,3 +44,4 @@
...
@@ -44,3 +44,4 @@
</view>
</view>
</template>
</template>
</view>
</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
\ No newline at end of file
packageIndex/pages/goodsDetail/index.js
View file @
d06bfba
...
@@ -127,12 +127,115 @@ Page({
...
@@ -127,12 +127,115 @@ Page({
"imgMain"
:
0
,
"imgMain"
:
0
,
"imgSort"
:
1
"imgSort"
:
1
}
],
}
],
"specificationResponses"
:
[
{
"specificationList"
:
[
{
"specName"
:
"颜色"
,
"id"
:
3957
,
"specValue"
:
"鹅黄"
"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"
},
{
},
{
"specName"
:
"选择尺寸"
,
"id"
:
4948
,
"specValue"
:
"28寸"
"goodsSpecificationId"
:
3957
,
"specificationValue"
:
"2"
,
"createdBy"
:
"bobodmd"
,
"createdDate"
:
1755674239000
,
"updatedBy"
:
"bobodmd"
,
"updatedDate"
:
1755674239000
,
"deletedFlag"
:
"N"
}
]
},
{
"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>"
,
"goodsDescribe"
:
"<p>22</p>"
,
"goodsPosition"
:
2
,
"goodsPosition"
:
2
,
...
@@ -207,7 +310,8 @@ Page({
...
@@ -207,7 +310,8 @@ Page({
countyName
:
'南山区'
,
countyName
:
'南山区'
,
address
:
'南山智园崇文园区1号楼14层'
,
address
:
'南山智园崇文园区1号楼14层'
,
isDefault
:
0
isDefault
:
0
}]
}],
defaultAddress
:
{}
},
},
appHide
()
{
appHide
()
{
wx
.
offAppHide
()
wx
.
offAppHide
()
...
@@ -236,17 +340,15 @@ Page({
...
@@ -236,17 +340,15 @@ Page({
})
})
},
},
goodsActionClick
(
e
)
{
goodsActionClick
(
e
)
{
if
(
e
.
detail
==
'join'
)
return
this
.
toAddShopCar
()
if
(
this
.
data
.
isCarOwner
)
return
this
.
judgePayWay
()
this
.
showSkuModal
(
e
.
detail
)
this
.
showSkuModal
(
e
.
detail
)
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
wx
.
p
.
router
.
getRouterParams
(
options
).
then
(
params
=>
{
wx
.
p
.
router
.
getRouterParams
(
options
).
then
(
params
=>
{
//
this.getDetail(options)
this
.
getDetail
(
options
)
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
error
(
'参数获取失败:'
,
err
)
console
.
error
(
'参数获取失败:'
,
err
)
})
})
// this.getPlatFormAddress(staff
)
this
.
getPlatFormAddress
(
)
},
},
showSkuModal
(
type
)
{
showSkuModal
(
type
)
{
// if (this.data.isCarOwner) return
// if (this.data.isCarOwner) return
...
@@ -261,21 +363,18 @@ Page({
...
@@ -261,21 +363,18 @@ Page({
})
})
},
},
// 获取默认的地址
// 获取默认的地址
getPlatFormAddress
(
s
ta
ff
)
{
getPlatFormAddress
(
s
at
ff
)
{
wx
.
showLoading
()
//
wx.showLoading()
let
para
=
{}
let
para
=
{}
if
(
staff
)
{
// if (staff) {
para
.
businessType
=
1
// para.businessType = 1
}
else
{
// }else{
const
SID
=
wx
.
p
.
util
.
getSessionId
()
// const SID = wx.p.util.getSessionId()
if
(
!
SID
)
return
wx
.
hideLoading
()
// if (!SID) return wx.hideLoading()
}
// }
shopmallApi
.
platformAddressList
(
para
).
then
(
data
=>
{
wx
.
hideLoading
()
let
contactAddress
=
''
,
defaultAddress
=
{}
let
contactAddress
=
''
,
defaultAddress
=
{}
let
_isSetDefault
=
false
let
_isSetDefault
=
false
if
(
data
&&
data
.
length
)
{
this
.
data
.
addressList
?.
forEach
(
el
=>
{
data
.
forEach
(
el
=>
{
if
(
el
.
isDefault
==
1
)
{
if
(
el
.
isDefault
==
1
)
{
contactAddress
=
el
.
provinceName
+
el
.
cityName
+
el
.
countyName
+
el
.
address
,
contactAddress
=
el
.
provinceName
+
el
.
cityName
+
el
.
countyName
+
el
.
address
,
defaultAddress
=
el
defaultAddress
=
el
...
@@ -283,17 +382,38 @@ Page({
...
@@ -283,17 +382,38 @@ Page({
}
}
})
})
if
(
!
_isSetDefault
)
{
if
(
!
_isSetDefault
)
{
let
_first
=
data
[
0
]
let
_first
=
this
.
data
.
addressList
[
0
]
contactAddress
=
_first
.
provinceName
+
_first
.
cityName
+
_first
.
countyName
+
_first
.
address
,
contactAddress
=
_first
.
provinceName
+
_first
.
cityName
+
_first
.
countyName
+
_first
.
address
,
defaultAddress
=
_first
defaultAddress
=
_first
}
}
}
this
.
setData
({
this
.
setData
({
addressList
:
data
,
contactAddress
,
contactAddress
,
defaultAddress
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
)
{
jump
(
e
)
{
let
{
url
,
isChooseAddress
}
=
e
.
currentTarget
.
dataset
let
{
url
,
isChooseAddress
}
=
e
.
currentTarget
.
dataset
...
@@ -322,50 +442,53 @@ Page({
...
@@ -322,50 +442,53 @@ Page({
},
},
// 获取详情
// 获取详情
getDetail
(
options
)
{
getDetail
(
options
)
{
if
(
!
options
||
!
options
.
id
)
return
// if(!options || !options.id)return
const
{
id
,
staff
,
score
,
isCarOwner
,
openId
}
=
options
// const { id, staff, score, isCarOwner, openId } = options
const
merchantId
=
wx
.
$storage
.
get
(
"srcm_shopmall_merchant_id"
);
// const merchantId = wx.$storage.get("srcm_shopmall_merchant_id");
this
.
merchantId
=
merchantId
// this.merchantId = merchantId
let
para
=
{
id
},
canPay
=
true
// let para = { id }, canPay = true
if
(
staff
)
para
.
businessType
=
1
// 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
}
shopmallApi
.
platformGoodsDetail
(
para
).
then
(
res
=>
{
if
(
res
&&
res
.
specificationResponses
)
{
this
.
toGetSpecString
(
res
,
res
.
startQty
)
}
if
(
staff
)
{
canPay
=
score
>
res
.
redeemPoints
}
// if (isCarOwner) {
// if (isCarOwner) {
// res.retailPrice = NP.divide(res.retailPrice, 100)
// 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
}
this
.
setData
({
this
.
setData
({
detailInfo
:
res
||
{},
detailInfo
:
data
,
canPay
,
activeSku
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
})
})
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
)
{
getCount
(
e
)
{
this
.
toGetSpecString
(
this
.
data
.
detailInfo
,
e
.
detail
)
//
this.toGetSpecString(this.data.detailInfo, e.detail)
this
.
count
=
e
.
detail
this
.
count
=
e
.
detail
},
},
// 添加购物车
// 添加购物车
...
@@ -391,11 +514,6 @@ Page({
...
@@ -391,11 +514,6 @@ Page({
resetAddress
(
e
)
{
resetAddress
(
e
)
{
this
.
setData
(
e
.
detail
)
this
.
setData
(
e
.
detail
)
},
},
toDuiHuang
()
{
if
(
this
.
data
.
canPay
)
{
this
.
showSkuModal
(
'pay'
)
}
},
getViewInfo
()
{
getViewInfo
()
{
wx
.
$api
.
getViewInfo
(
wx
.
$api
.
getViewInfo
(
'.fixed_btn_wrap'
,
'.fixed_btn_wrap'
,
...
...
packageIndex/pages/goodsDetail/index.wxml
View file @
d06bfba
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
<view class="price">
<view class="price">
<view class="price-box">
<view class="price-box">
<view class="sale-price">
<view class="sale-price">
{{
detailInfo.points
Price}}
{{
activeSku ? detailInfo.skuPrice : detailInfo.sell
Price}}
<text>积分</text>
<text>积分</text>
</view>
</view>
<view class="market-price">¥{{detailInfo.marketPrice}}</view>
<view class="market-price">¥{{detailInfo.marketPrice}}</view>
...
@@ -51,23 +51,23 @@
...
@@ -51,23 +51,23 @@
<view class="goods-title">{{detailInfo.goodsName}}</view>
<view class="goods-title">{{detailInfo.goodsName}}</view>
</view>
</view>
<view class="container-item select-params-box">
<view class="container-item select-params-box">
<view class="cell">
<view class="cell"
wx:if="{{activeSku}}"
>
<view class="flex">
<view class="flex"
bind:tap="showSkuModal"
>
<view class="title">已选</view>
<view class="title">已选</view>
<view
bind:tap="showSkuModal"
class="content flex_ccc">
<view class="content flex_ccc">
<view>{{
skuInfo
}}</view>
<view>{{
activeSku
}}</view>
</view>
</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>
<view class="cell">
<view class="cell"
bindtap="jump"
>
<view class="flex">
<view class="flex">
<view class="title">配送</view>
<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 class="address-text">{{contactAddress || '--'}}</view>
</view>
</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>
<view class="cell">
<view class="cell">
<view class="title">服务</view>
<view class="title">服务</view>
...
@@ -115,4 +115,4 @@
...
@@ -115,4 +115,4 @@
<block wx:if="{{navHeight&&!staffShop}}">
<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>
<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>
</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
\ 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
\ No newline at end of file
pages/Login/Login.js
View file @
d06bfba
...
@@ -192,6 +192,7 @@ Page({
...
@@ -192,6 +192,7 @@ Page({
/**登录回调 */
/**登录回调 */
customerLoginCallBack
(
data
)
{
customerLoginCallBack
(
data
)
{
wx
.
p
.
storage
.
set
(
'sessionId'
,
data
?.
sessionId
)
wx
.
p
.
storage
.
set
(
'sessionId'
,
data
?.
sessionId
)
wx
.
p
.
storage
.
set
(
'userInfo'
,
data
)
// 获取积分来源
// 获取积分来源
this
.
getSource
(
data
)
this
.
getSource
(
data
)
},
},
...
@@ -209,6 +210,8 @@ Page({
...
@@ -209,6 +210,8 @@ Page({
})
})
}
else
if
(
data
?.
length
==
1
)
{
}
else
if
(
data
?.
length
==
1
)
{
this
.
setChannelSource
(
data
[
0
]?.
channelSource
,
loginData
)
this
.
setChannelSource
(
data
[
0
]?.
channelSource
,
loginData
)
}
else
{
// 无积分渠道游客
this
.
setChannelSource
(
4
,
loginData
)
}
}
}
else
{
}
else
{
wx
.
p
.
wxApi
.
showToast
(
message
)
wx
.
p
.
wxApi
.
showToast
(
message
)
...
@@ -218,19 +221,24 @@ Page({
...
@@ -218,19 +221,24 @@ Page({
// 设置积分渠道
// 设置积分渠道
setChannelSource
(
source
,
loginData
)
{
setChannelSource
(
source
,
loginData
)
{
wx
.
p
.
isLogin
=
true
wx
.
p
.
isLogin
=
true
wx
.
p
.
storage
.
set
(
'userInfo'
,
{...
loginData
})
wx
.
p
.
storage
.
set
(
'userInfo'
,
{...
loginData
,
channelSource
:
source
})
wx
.
p
.
storage
.
set
(
'channelSource'
,
`
${
source
}
`
)
wx
.
p
.
storage
.
set
(
'sessionId'
,
loginData
?.
sessionId
)
// 查询积分钱包
// 查询积分钱包
this
.
getPointsWallet
()
this
.
getPointsWallet
()
},
},
// 获取积分钱包数据
// 获取积分钱包数据
getPointsWallet
()
{
getPointsWallet
()
{
let
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
let
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
// 获取当前积分数量
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
({
commonApi
.
getPointsWalletData
({
phone
:
userInfo
?.
phone
,
phone
:
userInfo
?.
phone
,
name
:
userInfo
?.
nick
Name
,
name
:
r
?.
data
?.
staff
Name
,
scoreSource
:
wx
.
p
.
storage
.
get
(
'channelSource'
)
scoreSource
:
userInfo
?.
channelSource
}).
then
(
res
=>
{
}).
then
(
res
=>
{
let
{
code
,
data
,
message
}
=
res
let
{
code
,
data
,
message
}
=
res
if
(
code
==
0
)
{
if
(
code
==
0
)
{
...
@@ -238,26 +246,22 @@ Page({
...
@@ -238,26 +246,22 @@ Page({
// 调用替换钱包昵称接口
// 调用替换钱包昵称接口
this
.
replaceNickName
(
data
)
this
.
replaceNickName
(
data
)
}
else
{
}
else
{
let
channelSource
=
wx
.
p
.
storage
.
get
(
'channelSource'
)
// 未开通弹出开通钱包弹窗
// 获取当前积分数量
commonApi
.
getPointsSummary
({
staffPhone
:
userInfo
?.
phone
,
channelSource
}).
then
(
r
=>
{
if
(
r
?.
code
==
0
)
{
this
.
setData
({
this
.
setData
({
showEnableWallet
:
true
,
showEnableWallet
:
true
walletObj
:
{
name
:
userInfo
?.
nickName
,
phone
:
userInfo
?.
phone
,
scoreSource
:
channelSource
,
currentScore
:
r
?.
data
?.
currentScore
||
0
}
})
})
}
}
else
{
}
else
{
wx
.
p
.
wxApi
.
showToast
(
r
.
message
)
wx
.
p
.
wxApi
.
showToast
(
message
)
}
}
})
})
}
}
else
{
}
else
{
wx
.
p
.
wxApi
.
showToast
(
message
)
wx
.
p
.
wxApi
.
showToast
(
r
.
message
)
}
}
})
})
},
},
// 替换积分钱包
昵
称
// 替换积分钱包
名
称
replaceNickName
(
data
)
{
replaceNickName
(
data
)
{
let
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
let
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
commonApi
.
replaceWalletName
({
commonApi
.
replaceWalletName
({
...
@@ -268,7 +272,8 @@ Page({
...
@@ -268,7 +272,8 @@ Page({
let
{
code
,
data
,
message
}
=
res
let
{
code
,
data
,
message
}
=
res
wx
.
p
.
storage
.
set
(
'userInfo'
,
{...
userInfo
,
nickName
:
data
?.
name
})
// 更新storage中的nickName
wx
.
p
.
storage
.
set
(
'userInfo'
,
{...
userInfo
,
nickName
:
data
?.
name
})
// 更新storage中的nickName
if
(
code
==
0
)
{
if
(
code
==
0
)
{
wx
.
p
.
router
.
reLaunch
(
'/pages/tab/index/index'
)
// 返回上一页
wx
.
p
.
router
.
back
()
}
else
{
}
else
{
wx
.
p
.
wxApi
.
showToast
(
message
)
wx
.
p
.
wxApi
.
showToast
(
message
)
}
}
...
@@ -283,11 +288,11 @@ Page({
...
@@ -283,11 +288,11 @@ Page({
// 关闭开通积分钱包弹窗
// 关闭开通积分钱包弹窗
closeWallet
()
{
closeWallet
()
{
this
.
setData
({
showEnableWallet
:
false
})
this
.
setData
({
showEnableWallet
:
false
})
let
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
let
{
walletObj
}
=
this
.
data
let
data
=
{
let
data
=
{
name
:
userInfo
?.
nickName
,
name
:
walletObj
?.
nickName
,
phone
:
userInfo
?.
phone
,
phone
:
walletObj
?.
phone
,
scoreSource
:
w
x
.
p
.
storage
.
get
(
'channelSource'
)
scoreSource
:
w
alletObj
?.
channelSource
}
}
// 替换钱包昵称 使用登录信息返回的数据
// 替换钱包昵称 使用登录信息返回的数据
this
.
replaceNickName
(
data
)
this
.
replaceNickName
(
data
)
...
@@ -301,6 +306,7 @@ Page({
...
@@ -301,6 +306,7 @@ Page({
if
(
code
==
0
)
{
if
(
code
==
0
)
{
this
.
setData
({
this
.
setData
({
showEnableSuccess
:
true
,
showEnableSuccess
:
true
,
showEnableWallet
:
false
,
walletObj
walletObj
})
})
}
else
{
}
else
{
...
...
pages/loading/loading.js
View file @
d06bfba
...
@@ -36,16 +36,6 @@ Page({
...
@@ -36,16 +36,6 @@ Page({
if
(
code
==
"0"
)
{
if
(
code
==
"0"
)
{
wx
.
p
.
isLogin
=
true
;
wx
.
p
.
isLogin
=
true
;
wx
.
p
.
storage
.
set
(
"sessionId"
,
data
.
sessionId
);
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
;
if
(
!
data
)
throw
message
;
}
else
{
}
else
{
wx
.
p
.
isLogin
=
false
;
wx
.
p
.
isLogin
=
false
;
...
...
pages/tab/index/index.js
View file @
d06bfba
...
@@ -129,15 +129,14 @@ Page({
...
@@ -129,15 +129,14 @@ Page({
*/
*/
onLoad
(
options
)
{
onLoad
(
options
)
{
const
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
const
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
let
channelSource
=
wx
.
p
.
storage
.
get
(
'channelSource'
)
this
.
setData
({
userInfo
})
this
.
setData
({
userInfo
,
channelSource
})
// 获取当前积分数据
// 获取当前积分数据
this
.
getPointsData
()
this
.
getPointsData
()
},
},
getPointsData
()
{
getPointsData
()
{
let
{
userInfo
,
channelSource
}
=
this
.
data
let
{
userInfo
}
=
this
.
data
if
(
!
userInfo
?.
phone
&&
!
channelSource
)
return
if
(
!
userInfo
?.
phone
&&
!
userInfo
?.
channelSource
)
return
commonApi
.
getPointsSummary
({
staffPhone
:
userInfo
?.
phone
,
channelSource
:
Number
(
channelSource
)}).
then
(
r
=>
{
commonApi
.
getPointsSummary
({
staffPhone
:
userInfo
?.
phone
,
channelSource
:
Number
(
userInfo
?.
channelSource
)}).
then
(
r
=>
{
if
(
r
?.
code
==
0
)
{
if
(
r
?.
code
==
0
)
{
this
.
setData
({
this
.
setData
({
currentScore
:
r
?.
data
?.
currentScore
||
0
currentScore
:
r
?.
data
?.
currentScore
||
0
...
...
router/router.config.js
View file @
d06bfba
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
export
const
authPages
=
[
export
const
authPages
=
[
'/packageMine/'
,
'/packageMine/'
,
'/pages/mine/'
,
'/pages/mine/'
,
'/packageIndex/'
// '/packageIndex/pages/integral/index/index' //积分
// '/packageIndex/pages/integral/index/index' //积分
];
];
...
...
utils/constants.js
View file @
d06bfba
...
@@ -11,8 +11,7 @@ export const STORAGE_OBJECTkEY = {
...
@@ -11,8 +11,7 @@ export const STORAGE_OBJECTkEY = {
sessionId
:
'sessionId'
,
sessionId
:
'sessionId'
,
bindInfo
:
'bindInfo'
,
bindInfo
:
'bindInfo'
,
unauthorized
:
'unauthorized'
,
unauthorized
:
'unauthorized'
,
wx_user_info
:
'wx_user_info'
,
wx_user_info
:
'wx_user_info'
channelSource
:
'channelSource'
}
}
export
default
{
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