Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7-Eleven
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高淑倩
7-Eleven
Commits
d6e9bf9b
Commit
d6e9bf9b
authored
Dec 26, 2019
by
谢中龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
711积分换物库存校验提前
parent
f713cd1f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
102 additions
and
4 deletions
+102
-4
IntegralMallGoods.js
...Package/page/pages/IntegralMallGoods/IntegralMallGoods.js
+47
-3
IntegralMallGoods.wxml
...ckage/page/pages/IntegralMallGoods/IntegralMallGoods.wxml
+1
-0
IntegrateGoodsExchangeInfo.js
.../IntegrateGoodsExchangeInfo/IntegrateGoodsExchangeInfo.js
+49
-1
IntegrateGoodsExchangeInfo.json
...ntegrateGoodsExchangeInfo/IntegrateGoodsExchangeInfo.json
+2
-0
IntegrateGoodsExchangeInfo.wxml
...ntegrateGoodsExchangeInfo/IntegrateGoodsExchangeInfo.wxml
+2
-0
exchangeAddress.js
src/subPackage/page/pages/exchangeAddress/exchangeAddress.js
+1
-0
No files found.
src/subPackage/page/pages/IntegralMallGoods/IntegralMallGoods.js
View file @
d6e9bf9b
...
@@ -46,6 +46,10 @@ wxService.page({
...
@@ -46,6 +46,10 @@ wxService.page({
// this.initIntegralCouponList();
// this.initIntegralCouponList();
//获取会员积分信息
//获取会员积分信息
this
.
getMemberIntegrateInfo
();
this
.
getMemberIntegrateInfo
();
if
(
wx
.
getStorageSync
(
'needReloadExchangeList'
))
{
wx
.
removeStorageSync
(
'needReloadExchangeList'
);
this
.
initIntegralProductList
();
}
},
},
//刷新积分请求
//刷新积分请求
refreshPointRequest
()
{
refreshPointRequest
()
{
...
@@ -109,16 +113,49 @@ wxService.page({
...
@@ -109,16 +113,49 @@ wxService.page({
else
{
else
{
this
.
data
.
currentTab
=
'goods'
;
this
.
data
.
currentTab
=
'goods'
;
}
}
let
integralGoodsList
=
data
?
data
:
[];
integralGoodsList
.
forEach
(
item
=>
{
item
.
canExchange
=
true
;
});
this
.
setData
({
this
.
setData
({
integralGoodsList
:
data
?
data
:
[],
currentTab
:
this
.
data
.
currentTab
currentTab
:
this
.
data
.
currentTab
})
});
this
.
findExchangeNumByIds
(
integralGoodsList
);
}
}
}
}
}).
finally
(()
=>
{
}).
finally
(()
=>
{
wx
.
hideLoading
();
wx
.
hideLoading
();
})
})
},
},
//查询指定积分换物活动兑换数量
findExchangeNumByIds
(
integralGoodsList
)
{
//获取ids
let
ids
=
integralGoodsList
.
map
(
g
=>
{
return
g
.
id
;
});
wxService
.
post
(
`/member/pointsRedemptionProductSetting/getExchangeCount`
,
ids
).
then
(
res
=>
{
if
(
res
){
let
data
=
res
.
data
.
data
?
res
.
data
.
data
:
null
;
if
(
data
)
{
for
(
let
k
in
data
)
{
let
id
=
k
,
value
=
data
[
k
];
for
(
let
i
=
0
;
i
<
integralGoodsList
.
length
;
i
++
)
{
if
(
integralGoodsList
[
i
].
id
==
id
)
{
integralGoodsList
[
i
].
canExchange
=
integralGoodsList
[
i
].
stock
>
value
;
}
}
}
}
}
this
.
setData
({
integralGoodsList
:
integralGoodsList
,
});
});
},
// 积分兑换优惠券列表
// 积分兑换优惠券列表
initIntegralCouponList
()
{
initIntegralCouponList
()
{
wx
.
showLoading
({
wx
.
showLoading
({
...
@@ -150,8 +187,15 @@ wxService.page({
...
@@ -150,8 +187,15 @@ wxService.page({
},
},
// 立即兑换物品
// 立即兑换物品
exchangeGoods
(
e
)
{
exchangeGoods
(
e
)
{
const
{
id
,
point
}
=
e
.
currentTarget
.
dataset
;
const
{
id
,
point
,
canexchange
}
=
e
.
currentTarget
.
dataset
;
const
{
memberId
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
const
{
memberId
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
if
(
!
canexchange
)
{
this
.
setData
({
dialogStockEmpty
:
true
});
return
;
}
//检查是不是可以兑换
//检查是不是可以兑换
wx
.
showLoading
({
wx
.
showLoading
({
title
:
'检查兑换资格中..'
,
title
:
'检查兑换资格中..'
,
...
...
src/subPackage/page/pages/IntegralMallGoods/IntegralMallGoods.wxml
View file @
d6e9bf9b
...
@@ -94,6 +94,7 @@
...
@@ -94,6 +94,7 @@
<view class='coupon-btn-click'
<view class='coupon-btn-click'
data-id="{{item.id}}"
data-id="{{item.id}}"
data-point="{{item.point}}"
data-point="{{item.point}}"
data-canexchange="{{item.canExchange}}"
catchtap='exchangeGoods'>立即兑换</view>
catchtap='exchangeGoods'>立即兑换</view>
<view class='coupon-btn-num'>{{item.point}}积分</view>
<view class='coupon-btn-num'>{{item.point}}积分</view>
</view>
</view>
...
...
src/subPackage/page/pages/IntegrateGoodsExchangeInfo/IntegrateGoodsExchangeInfo.js
View file @
d6e9bf9b
...
@@ -11,7 +11,8 @@ wxService.page({
...
@@ -11,7 +11,8 @@ wxService.page({
*/
*/
data
:
{
data
:
{
isExchange
:
false
,
isExchange
:
false
,
dialogUserLimit
:
false
,
dialogUserLimit
:
false
,
dialogStockEmpty
:
false
,
integralMallDetail
:
{}
integralMallDetail
:
{}
},
},
...
@@ -24,10 +25,34 @@ wxService.page({
...
@@ -24,10 +25,34 @@ wxService.page({
this
.
getIntegralCouponDetail
(
id
)
this
.
getIntegralCouponDetail
(
id
)
},
},
//btn回调
onDialogBtnCallBack
(
e
)
{
let
pages
=
getCurrentPages
();
let
index
=
pages
.
length
-
1
;
for
(
let
i
=
0
;
i
<
pages
.
length
;
i
++
)
{
if
(
pages
[
i
].
route
.
indexOf
(
'IntegralMallGoods/IntegralMallGoods'
)
>
-
1
)
{
index
=
index
-
i
;
break
;
}
}
wx
.
navigateBack
({
delta
:
index
});
},
//立即兑换
//立即兑换
exchange
()
{
exchange
()
{
const
{
memberId
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
);
const
{
memberId
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
);
const
id
=
this
.
data
.
integralMallDetail
.
id
;
const
id
=
this
.
data
.
integralMallDetail
.
id
;
if
(
!
this
.
data
.
integralMallDetail
.
canExchange
){
this
.
setData
({
dialogStockEmpty
:
true
,
});
return
;
}
//检查是不是可以兑换
//检查是不是可以兑换
wx
.
showLoading
({
wx
.
showLoading
({
title
:
'检查兑换资格中..'
,
title
:
'检查兑换资格中..'
,
...
@@ -57,12 +82,34 @@ wxService.page({
...
@@ -57,12 +82,34 @@ wxService.page({
if
(
result
==
0
)
{
if
(
result
==
0
)
{
wx
.
hideLoading
()
wx
.
hideLoading
()
data
.
desc
=
JSON
.
parse
(
data
.
desc
)
data
.
desc
=
JSON
.
parse
(
data
.
desc
)
data
.
canExchange
=
true
;
this
.
setData
({
this
.
setData
({
integralMallDetail
:
data
integralMallDetail
:
data
},()
=>
{
this
.
findExchangeNumByIds
(
id
);
});
});
}
}
}).
finally
(()
=>
{
}).
finally
(()
=>
{
wx
.
hideLoading
()
wx
.
hideLoading
()
})
})
},
//查询指定积分换物活动兑换数量
findExchangeNumByIds
(
id
)
{
//获取ids
let
ids
=
[
id
];
wxService
.
post
(
`/member/pointsRedemptionProductSetting/getExchangeCount`
,
ids
).
then
(
res
=>
{
if
(
res
){
let
data
=
res
.
data
.
data
?
res
.
data
.
data
:
null
;
if
(
data
)
{
let
value
=
data
[
id
];
this
.
data
.
integralMallDetail
.
canExchange
=
this
.
data
.
integralMallDetail
.
stock
>
value
;
}
}
}
this
.
setData
({
integralMallDetail
:
this
.
data
.
integralMallDetail
});
});
},
})
})
\ No newline at end of file
src/subPackage/page/pages/IntegrateGoodsExchangeInfo/IntegrateGoodsExchangeInfo.json
View file @
d6e9bf9b
{
{
"navigationBarTitleText"
:
"积分换物详情"
,
"navigationBarTitleText"
:
"积分换物详情"
,
"usingComponents"
:
{
"usingComponents"
:
{
"dialog-stock-empty"
:
"/component/dialogStockEmpty/dialogStockEmpty"
,
"dialog-user-limit"
:
"/component/dialogUserLimit/dialogUserLimit"
"dialog-user-limit"
:
"/component/dialogUserLimit/dialogUserLimit"
}
}
}
}
\ No newline at end of file
src/subPackage/page/pages/IntegrateGoodsExchangeInfo/IntegrateGoodsExchangeInfo.wxml
View file @
d6e9bf9b
...
@@ -27,3 +27,5 @@
...
@@ -27,3 +27,5 @@
<!--goHome-->
<!--goHome-->
<go-home/>
<go-home/>
<dialog-user-limit show="{{dialogUserLimit}}"/>
<dialog-user-limit show="{{dialogUserLimit}}"/>
<dialog-stock-empty show="{{dialogStockEmpty}}" bind:btnClick="onDialogBtnCallBack"/>
src/subPackage/page/pages/exchangeAddress/exchangeAddress.js
View file @
d6e9bf9b
...
@@ -128,6 +128,7 @@ wxService.page({
...
@@ -128,6 +128,7 @@ wxService.page({
wx
.
showToast
({
wx
.
showToast
({
title
:
'兑换成功'
,
title
:
'兑换成功'
,
});
});
wx
.
setStorageSync
(
'needReloadExchangeList'
,
true
)
setTimeout
(()
=>
{
setTimeout
(()
=>
{
wx
.
navigateBack
({
wx
.
navigateBack
({
...
...
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