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 b02f7a89
authored
Aug 28, 2025
by
zhangxw
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
确认订单页面多规格商品更换规格
1 parent
a2e3e68b
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
83 additions
and
25 deletions
components/Sku/index.js
components/Sku/index.wxml
packageIndex/pages/confirmOrder/index.js
packageIndex/pages/confirmOrder/index.json
packageIndex/pages/confirmOrder/index.wxml
packageIndex/pages/confirmOrder/index.wxss
packageIndex/pages/exchangeSuccess/index.js
packageIndex/pages/exchangeSuccess/index.json
packageIndex/pages/exchangeSuccess/index.scss
packageIndex/pages/exchangeSuccess/index.wxml
packageIndex/pages/goodsDetail/index.js
pages/tab/index/index.js
pages/tab/index/index.scss
components/Sku/index.js
View file @
b02f7a8
...
...
@@ -27,7 +27,6 @@ Component({
currentIndex
:
0
,
goodsNumber
:
1
,
showJfModal
:
false
,
jfCount
:
0
,
detailInfo
:
{}
},
...
...
@@ -35,13 +34,6 @@ Component({
* 组件的方法列表
*/
methods
:
{
computeJf
(
num
)
{
let
{
detailInfo
,
jfCount
}
=
this
.
data
jfCount
=
NP
.
times
(
detailInfo
.
redeemPoints
||
0
,
num
)
this
.
setData
({
jfCount
})
},
cancel
()
{
this
.
setData
({
show
:
false
...
...
@@ -50,6 +42,9 @@ Component({
},
setDefaultSku
(
detailInfo
)
{
let
specificationDetailList
=
detailInfo
.
platformGlGoodsSpecifications
&&
detailInfo
.
platformGlGoodsSpecifications
[
0
]
if
(
detailInfo
?.
specificationData
)
{
specificationDetailList
=
detailInfo
?.
platformGlGoodsSpecifications
?.
find
(
val
=>
val
.
specificationData
==
detailInfo
.
specificationData
)
}
let
defaultGoods
=
specificationDetailList
?.
specificationData
.
split
(
'&'
)
detailInfo
.
platformGlGoodsSpecificationList
?.
map
(
e
=>
{
defaultGoods
.
map
(
i
=>
{
...
...
@@ -62,7 +57,9 @@ Component({
})
})
this
.
setData
({
detailInfo
detailInfo
,
[
'detailInfo.goodsStock'
]:
specificationDetailList
?.
stock
,
goodsNumber
:
detailInfo
?.
sellQty
||
1
})
},
// 选择规格
...
...
@@ -99,7 +96,6 @@ Component({
},
changeCount
(
e
)
{
this
.
triggerEvent
(
'getCount'
,
e
.
detail
)
this
.
computeJf
(
e
.
detail
)
this
.
setData
({
goodsNumber
:
e
.
detail
})
...
...
@@ -118,9 +114,13 @@ Component({
toCreatedOrder
()
{
let
{
clickType
,
remain
,
detailInfo
,
defaultAddress
,
goodsNumber
}
=
this
.
data
const
userInfo
=
wx
.
p
.
storage
.
get
(
'userInfo'
)
if
(
!
[
'pay'
,
'join'
].
includes
(
clickType
))
{
if
(
!
[
'pay'
,
'join'
,
'change'
].
includes
(
clickType
))
{
return
this
.
cancel
()
}
if
(
clickType
==
'change'
)
{
this
.
cancel
()
return
this
.
triggerEvent
(
'changeSku'
,
{
specificationData
:
detailInfo
.
specificationData
,
sellQty
:
goodsNumber
||
detailInfo
.
startQty
})
}
if
(
!
detailInfo
.
goodsStock
)
return
detailInfo
.
sellQty
=
goodsNumber
||
detailInfo
.
sellQty
detailInfo
?.
platformGlGoodsSpecifications
?.
forEach
(
val
=>
{
...
...
@@ -148,7 +148,6 @@ Component({
if
(
!
defaultAddress
.
receiveName
){
return
wx
.
p
.
wxApi
.
showToast
(
'请选择收货地址'
)
}
console
.
log
(
detailInfo
,
'22222222'
)
// 跳转到确认订单
let
query
=
{
defaultAddress
,
...
...
components/Sku/index.wxml
View file @
b02f7a8
...
...
@@ -45,17 +45,17 @@
<view class="right flex_sc">
<!-- <view class="tip">至少购买{{goods.startQty}}{{goods.goodsUnit}}</view> -->
<view class="stepper">
<stepper count="{{goodsNumber}}" max="{{detailInfo.goodsStock
|| 1
}}" catchchange="changeCount"></stepper>
<stepper count="{{goodsNumber}}" max="{{detailInfo.goodsStock}}" catchchange="changeCount"></stepper>
</view>
</view>
</view>
<view class="textarea-box" wx:if="{{clickType != 'join'}}">
<view class="textarea-box" wx:if="{{clickType != 'join'
&& clickType != 'change'
}}">
<view class="title">订单备注</view>
<view class="pannel">
<textarea bindinput="intRemain" maxlength="100" class="textArea" placeholder="请输入备注信息(选填)" placeholder-class="textarea-placeholder"></textarea>
</view>
</view>
<view bind:tap="toShowAddressModal" class="adress-box flex_scb" wx:if="{{clickType != 'join'}}">
<view bind:tap="toShowAddressModal" class="adress-box flex_scb" wx:if="{{clickType != 'join'
&& clickType != 'change'
}}">
<view class="title">收货地址</view>
<view class="right flex_scb">
<view class="content {{defaultAds?'':'emptyText'}}">{{defaultAds || '请选择'}}</view>
...
...
packageIndex/pages/confirmOrder/index.js
View file @
b02f7a8
...
...
@@ -27,7 +27,6 @@ Page({
onLoad
:
function
(
options
)
{
wx
.
p
.
router
.
getRouterParams
(
options
).
then
(
params
=>
{
let
userInfo
=
wx
.
p
.
storage
.
get
(
'userInfo'
)
console
.
log
(
params
,
'2222'
)
this
.
setData
({
goodsInfo
:
params
,
userInfo
...
...
@@ -69,7 +68,7 @@ Page({
wx
.
p
.
wxApi
.
showLoading
()
homeApi
.
createOrder
(
params
).
then
(
res
=>
{
wx
.
hideLoading
()
wx
.
p
.
router
.
re
directTo
(
'/packageIndex/pages/exchangeSuccess/index'
)
wx
.
p
.
router
.
re
Launch
(
'/packageIndex/pages/exchangeSuccess/index'
)
})
}
},
...
...
@@ -133,6 +132,39 @@ Page({
showModal
:
true
})
},
// 多规格商品更换规格
handleChangeSku
(
e
)
{
let
{
target
,
index
}
=
e
.
currentTarget
.
dataset
// 获取商品详情
this
.
getGoodsDetail
(
target
,
index
)
},
getGoodsDetail
(
target
,
index
)
{
homeApi
.
getGoodsDetailInfo
({
id
:
target
.
id
||
target
.
goodsId
,
businessType
:
1
}).
then
(
res
=>
{
res
.
specificationData
=
target
.
specificationData
res
?.
platformGoodsResources
?.
forEach
(
item
=>
{
if
(
item
.
resType
==
1
)
item
.
imgUrl
=
item
.
content
})
if
(
res
.
goodsSource
==
2
)
{
res
.
imageResponses
=
res
?.
platformGoodsResources
?.
filter
(
val
=>
val
.
bizType
==
1
)
res
.
goodsDescList
=
res
?.
platformGoodsResources
?.
filter
(
val
=>
val
.
bizType
==
2
)
}
res
.
sellQty
=
target
.
sellQty
this
.
setData
({
selectInfo
:
res
||
{},
showSku
:
true
,
selectSkuIndex
:
index
})
})
},
changeSku
(
e
)
{
let
{
selectSkuIndex
}
=
this
.
data
this
.
setData
({
[
`goodsInfo.goodsList[
${
selectSkuIndex
}
].specificationData`
]:
e
.
detail
.
specificationData
,
[
`goodsInfo.goodsList[
${
selectSkuIndex
}
].sellQty`
]:
e
.
detail
.
sellQty
},
()
=>
{
this
.
getMoney
(
this
.
data
.
goodsInfo
)
})
},
goodsActionReady
(
e
)
{
this
.
setData
({
padding_bottom
:
e
.
detail
...
...
packageIndex/pages/confirmOrder/index.json
View file @
b02f7a8
...
...
@@ -2,6 +2,7 @@
"navigationBarTitleText"
:
"确认订单"
,
"usingComponents"
:
{
"stepper"
:
"/components/Stepper/Stepper"
,
"address"
:
"/components/Adress/index"
"address"
:
"/components/Adress/index"
,
"sku"
:
"/components/Sku/index"
}
}
\ No newline at end of file
packageIndex/pages/confirmOrder/index.wxml
View file @
b02f7a8
...
...
@@ -40,8 +40,9 @@
<view class="text-hide">
{{item.goodsSkuName}}
</view>
<view class="specificationData-text">
<view class="text-hide description">{{item.specificationData || ''}}</view>
<view wx:if="{{item.specificationData}}" class="specificationData-text" bindtap="handleChangeSku" data-target="{{item}}" data-index="{{index}}">
<view class="text-hide description">{{item.specificationData}}</view>
<mp-icon icon="back" class="change-icon" color="#6E6E7A" size="{{8}}"></mp-icon>
</view>
</view>
<view class="price-box">
...
...
@@ -96,6 +97,7 @@
</goods-action>
</block>
<address address="{{addressList}}" defaultAddress="{{contactInfo}}" bind:getAddress="getAddress" show="{{showAddress}}"></address>
<sku bind:cancelSku="closeSku" wx:if="{{showSku}}" show="{{showSku}}" goods="{{selectInfo}}" bindchangeSku="changeSku" clickType="change"></sku>
<Dialog show="{{ showModal }}" mask="true" bindbuttontap="dialogConfirm" buttons="{{buttons}}" title="积分兑换">
<view class="suggest-box">
<view>您当前总积分为<text>{{walletObj.currentScore}}</text>积分</view>
...
...
packageIndex/pages/confirmOrder/index.wxss
View file @
b02f7a8
...
...
@@ -93,6 +93,9 @@
.box .item .content .goods-info .text {
flex-shrink: 0;
width: calc(100% - 180rpx);
display: flex;
flex-direction: column;
justify-content: space-between;
}
.box .item .content .goods-info .text .price-box {
...
...
@@ -165,7 +168,7 @@
color: #6E6E7A;
}
.text .specificationData-text .
select
{
.text .specificationData-text .
change-icon
{
margin-left: 8rpx;
transform: rotate(-90deg);
}
...
...
packageIndex/pages/exchangeSuccess/index.js
View file @
b02f7a8
...
...
@@ -20,6 +20,11 @@ Page({
})
},
back
()
{
clearInterval
(
this
.
timer
)
wx
.
p
.
router
.
switchTab
(
"/pages/tab/index/index"
)
},
countdown
()
{
this
.
timer
=
setInterval
(()
=>
{
let
{
count
}
=
this
.
data
...
...
@@ -64,7 +69,7 @@ Page({
* 生命周期函数--监听页面卸载
*/
onUnload
()
{
clearInterval
(
this
.
timer
)
},
/**
...
...
packageIndex/pages/exchangeSuccess/index.json
View file @
b02f7a8
{
"usingComponents"
:
{}
"usingComponents"
:
{},
"navigationStyle"
:
"custom"
}
\ No newline at end of file
packageIndex/pages/exchangeSuccess/index.scss
View file @
b02f7a8
/* packageIndex/pages/exchangeSuccess/index.wxss */
.back
{
margin-left
:
40rpx
;
}
.container
{
width
:
100%
;
height
:
100vh
;
...
...
packageIndex/pages/exchangeSuccess/index.wxml
View file @
b02f7a8
<!--packageIndex/pages/exchangeSuccess/index.wxml-->
<view class="container">
<navigation-bar custom bindnavbarReady="navbarReady">
<view class="navigation">
<view class="back" bindtap="back">
<mp-icon icon="back" color="#2C2C2C" size="{{12}}"></mp-icon>
</view>
</view>
</navigation-bar>
<view class="icon">
<glsx-image src="/status/success.png"></glsx-image>
</view>
...
...
packageIndex/pages/goodsDetail/index.js
View file @
b02f7a8
...
...
@@ -185,7 +185,7 @@ Page({
detailInfo
:
res
||
{},
eventFlag
:
true
,
activeSku
:
res
.
specificationData
,
goodsStock
:
res
.
goodsStock
goodsStock
:
res
.
goodsStock
||
0
})
})
},
...
...
pages/tab/index/index.js
View file @
b02f7a8
...
...
@@ -180,7 +180,7 @@ Page({
params
.
merchantNo
=
userInfo
?.
merchantId
}
else
if
(
activeTab
)
{
// 积分区间
params
.
storeStart
=
activeTab
==
2
?
0
:
activeTab
==
3
?
100
:
activeTab
==
4
?
200
:
''
params
.
storeEnd
=
activeTab
==
2
?
100
:
activeTab
==
3
?
200
:
activeTab
==
4
?
300
:
''
params
.
storeEnd
=
activeTab
==
2
?
99
:
activeTab
==
3
?
200
:
activeTab
==
4
?
300
:
''
}
homeApi
.
getGoodsStockroomList
(
params
).
then
(
res
=>
{
this
.
setData
({
...
...
@@ -221,6 +221,7 @@ Page({
handleSearch
(
e
)
{
this
.
setData
({
goodsSkuName
:
e
.
detail
,
goodsList
:
[],
pageNum
:
1
},
()
=>
{
this
.
getGoodsList
()
...
...
@@ -232,6 +233,7 @@ Page({
this
.
setData
({
activeTab
:
e
.
detail
.
activeTab
,
frontendCategoryId
:
e
.
detail
?.
activeSubTab
,
goodsList
:
[],
pageNum
:
1
},
()
=>
{
this
.
getGoodsList
()
...
...
pages/tab/index/index.scss
View file @
b02f7a8
...
...
@@ -51,6 +51,9 @@
font-weight
:
700
;
}
}
.arrow-icon
{
margin-left
:
10rpx
;
}
}
.layout
{
...
...
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