Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
marubi-wish-list-mp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
91d68f79
authored
2019-08-07 18:46:08 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
版本提交
1 parent
8c056043
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
149 additions
and
65 deletions
src/app.js
src/component/authorize-comp/authorize-comp.js
src/component/tips-nearby-store-comp/tips-nearby-store-comp.scss
src/pages/coop/coop.js
src/pages/coop/coop.scss
src/pages/coop/coop.wxml
src/pages/create-wish/create-wish.js
src/pages/index/index.js
src/pages/rank/rank.wxml
src/pages/wish/wish.js
src/app.js
View file @
91d68f7
...
...
@@ -67,16 +67,7 @@ App({
}).
then
((
result
)
=>
{
this
.
globalData
.
indexInfo
=
result
;
this
.
globalData
.
userInfo
=
result
.
userInfo
;
if
(
result
.
isNeedAuth
==
1
&&
auth
==
true
)
{
//需要授权
this
.
router
.
push
({
path
:
"authorize"
})
reject
();
// resolve();
}
else
{
resolve
(
result
)
}
resolve
(
result
)
}).
catch
((
err
)
=>
{
reject
();
});
...
...
src/component/authorize-comp/authorize-comp.js
View file @
91d68f7
...
...
@@ -24,6 +24,11 @@ Component({
name
:
"_evt_hide_mask"
});
},
authComplete
()
{
this
.
triggerEvent
(
'evtcomp'
,
{
name
:
"_evt_auth_complete"
});
},
bindGetUserInfo
(
e
)
{
wx
.
showLoading
();
this
.
getUserInfo
(
e
.
detail
);
...
...
@@ -51,6 +56,7 @@ Component({
// })
}
_this
.
hideMask
();
_this
.
authComplete
();
}).
catch
((
err
)
=>
{})
},
}
...
...
src/component/tips-nearby-store-comp/tips-nearby-store-comp.scss
View file @
91d68f7
...
...
@@ -8,7 +8,8 @@ $contentWidth:690px;
position
:
relative
;
background-color
:
#fff
;
// width: 750px;
max-height
:
860px
;
// max-height: 860px;
height
:
860px
;
.cont
{
// width: 750px;
...
...
src/pages/coop/coop.js
View file @
91d68f7
...
...
@@ -32,8 +32,13 @@ Page({
this
.
setData
({
options
})
console
.
log
(
"onLoad"
);
},
onHide
()
{
},
onShow
()
{
console
.
log
(
"onShow"
);
this
.
initData
();
},
initData
()
{
...
...
@@ -41,19 +46,6 @@ Page({
this
.
setData
({
userInfo
:
app
.
globalData
.
userInfo
})
// 判断是否需要授权
if
(
result
.
isNeedAuth
==
1
)
{
app
.
router
.
push
({
path
:
"authorize"
,
query
:
{
redirect
:
"coop"
}
})
}
else
{
// this.queryWishbillDetail();
// this.initShake();
}
this
.
queryWishbillDetail
();
this
.
initShake
();
})
...
...
@@ -81,20 +73,29 @@ Page({
},
// 助力
queryWishbillAssist
()
{
if
(
!
this
.
data
.
canShake
||
this
.
data
.
tipsCommonVisible
)
{
return
;
}
this
.
setData
({
canShake
:
false
})
app
.
post
({
url
:
app
.
api
.
wishbillAssist
,
data
:
{
billCode
:
this
.
data
.
options
.
code
}
}).
then
((
result
)
=>
{
console
.
log
(
"queryWishbillAssist result:"
,
result
);
let
status
=
result
.
status
;
this
.
setData
({
status
:
status
})
if
(
status
==
1
)
{
// 助力成功
// 合并数据
let
wishList
=
result
.
elasticValueList
;
wishList
.
forEach
(
element
=>
{
let
product
=
productMap
[
element
.
prizeDefineCode
+
""
];
console
.
log
(
"product:"
,
product
);
element
=
Object
.
assign
(
element
,
product
);
let
progress
=
element
.
elasticValue
/
element
.
conditionElasticValue
*
100
;
if
(
progress
>
100
)
progress
=
100
;
...
...
@@ -103,6 +104,7 @@ Page({
element
.
progress
=
progress
;
element
.
progressLeft
=
progressLeft
;
});
console
.
log
(
"wishList:"
,
wishList
);
this
.
setData
({
coopInfo
:
result
,
wishList
:
wishList
...
...
@@ -125,10 +127,15 @@ Page({
})
}
this
.
setData
({
canShake
:
true
})
})
},
// 获取心愿单详情
queryWishbillDetail
()
{
console
.
log
(
"queryWishbillDetail code:"
,
this
.
data
.
options
.
code
);
return
new
Promise
((
resolve
,
reject
)
=>
{
app
.
post
({
url
:
app
.
api
.
wishbillDetail
,
...
...
@@ -136,10 +143,10 @@ Page({
billCode
:
this
.
data
.
options
.
code
}
}).
then
((
result
)
=>
{
let
status
=
result
.
isAssist
;
this
.
setData
({
status
})
//
let status = result.isAssist;
//
this.setData({
//
status
//
})
let
wishList
=
result
.
wishGifts
;
wishList
.
forEach
(
element
=>
{
let
product
=
productMap
[
element
.
prizeDefineCode
+
""
];
...
...
@@ -157,7 +164,7 @@ Page({
})
console
.
log
(
"wishInfo:"
,
this
.
data
.
wishInfo
);
console
.
log
(
"wishList:"
,
this
.
data
.
wishList
);
resolve
();
})
});
},
...
...
@@ -180,6 +187,10 @@ Page({
this
.
hideMask
();
break
;
case
"_evt_auth_complete:"
:
this
.
initData
();
break
;
default
:
break
;
}
...
...
src/pages/coop/coop.scss
View file @
91d68f7
...
...
@@ -60,7 +60,8 @@
color
:
#333333
;
font-size
:
28px
;
line-height
:
1
.6
;
height
:
150px
;
height
:
140px
;
@include
ellipsis
(
3
);
}
// 心愿
...
...
src/pages/coop/coop.wxml
View file @
91d68f7
...
...
@@ -9,7 +9,7 @@
<view class="content">
<!-- 摇一摇 -->
<!-- bindtap="queryWishbillAssist" -->
<view wx:if="{{status != 1}}" class="shake">
<view
bindtap="queryWishbillAssist"
wx:if="{{status != 1}}" class="shake">
<image class="ebg" mode="widthFix" src="../../image/oss/coop/coop-c2.png" />
<view class="space1"></view>
<view class="cont">
...
...
@@ -47,7 +47,7 @@
</view>
</view>
<view class="tips2">
<text class="t1">太厉害了\n您总共摇出了{{
wish
Info.totalElasticValue}}弹力值</text>
<text class="t1">太厉害了\n您总共摇出了{{
coop
Info.totalElasticValue}}弹力值</text>
</view>
<!-- 奖品 -->
<view class="wish">
...
...
src/pages/create-wish/create-wish.js
View file @
91d68f7
...
...
@@ -30,6 +30,7 @@ Page({
wishList
:
[],
// 创建后的心愿单列表
userInfo
:
{},
isPageVisible
:
false
,
// canShake:false,
},
onShareAppMessage
()
{},
onShow
()
{
...
...
@@ -39,10 +40,11 @@ Page({
this
.
isPageVisible
=
false
;
},
onLoad
(
options
)
{
// console.log("cw -- onLoad");
this
.
initData
();
},
initData
()
{
this
.
hideMask
();
// 还原缓存心愿单
let
myWishList
=
app
.
store
.
getItem
(
"wish"
)
||
[];
this
.
setData
({
...
...
@@ -56,6 +58,7 @@ Page({
this
.
queryWishbillPrizeCandidate
().
then
((
result
)
=>
{
this
.
initBorder
();
})
this
.
checkNeedQuestion
();
});
this
.
initShake
();
},
...
...
@@ -93,6 +96,68 @@ Page({
}
});
},
/**
* 检验是否需要先答题 是的话弹答题
* 1.已经登陆
* 2.是新会员
* 3.不是黑名单
* 4.未答题
*/
checkNeedQuestion
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
indexInfo
=
app
.
globalData
.
indexInfo
;
let
{
isCrmLogin
,
isNewMember
,
isBlackList
,
hadAnswerQuestion
,
}
=
indexInfo
;
if
(
isCrmLogin
==
1
&&
isNewMember
==
1
&&
isBlackList
==
0
&&
hadAnswerQuestion
==
0
)
{
this
.
setData
({
tipsNewMemberVisible
:
true
,
})
}
else
{}
resolve
();
});
},
/**
* 检查是否有资格玩
* 1.未已经登陆 => 提示登陆
* 2.非黑名单 => 弹团购会员弹窗
* 3.是新会员且未答题 => 弹未答题弹窗
*/
checkCanPlay
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
indexInfo
=
app
.
globalData
.
indexInfo
;
let
{
isCrmLogin
,
isNewMember
,
isBlackList
,
hadAnswerQuestion
,
}
=
indexInfo
;
if
(
isCrmLogin
==
0
)
{
this
.
setData
({
tipsRegisterVisible
:
true
,
})
reject
();
}
else
if
(
isBlackList
==
1
)
{
this
.
setData
({
tipsGroupMemberVisible
:
true
,
})
reject
();
}
else
if
(
isNewMember
==
1
&&
hadAnswerQuestion
==
0
)
{
this
.
setData
({
tipsNewMemberVisible
:
true
,
})
reject
();
}
else
{
resolve
();
}
});
},
/**
* 提交前判断状态
* 判断顺序
...
...
@@ -109,8 +174,6 @@ Page({
isNewMember
,
isBlackList
,
hadAnswerQuestion
,
isSelfAssist
,
wishBillCode
}
=
indexInfo
;
// 未登陆 出注册弹窗提示
// isCrmLogin = 1;
...
...
@@ -121,6 +184,7 @@ Page({
reject
();
return
;
}
// 黑名单
if
(
isBlackList
==
1
)
{
this
.
setData
({
...
...
@@ -129,6 +193,7 @@ Page({
reject
();
return
;
}
// 新老会员
// isNewMember
// hadAnswerQuestion = 1; //硬编码答题
...
...
@@ -193,9 +258,13 @@ Page({
}).
then
((
result
)
=>
{
if
(
app
.
globalData
.
indexInfo
.
isNewMember
==
1
)
{
// 新会员
this
.
setData
({
tipsCreateCompleteVisible
:
true
,
wishBillInfo
:
result
// this.setData({
// tipsCreateCompleteVisible: true,
// wishBillInfo: result
// })
app
.
router
.
push
({
openType
:
"reLaunch"
,
path
:
"wish"
})
}
else
{
// 老会员,自动助力,出提示页面
...
...
@@ -247,36 +316,39 @@ Page({
* @param {*} evt
*/
onAddWishHandler
(
evt
)
{
let
myWishList
=
this
.
data
.
myWishList
;
let
curWish
=
this
.
data
.
curWish
;
this
.
checkCanPlay
().
then
((
result
)
=>
{
let
myWishList
=
this
.
data
.
myWishList
;
let
curWish
=
this
.
data
.
curWish
;
// 检查愿望数是否超出
if
(
myWishList
.
length
>=
3
)
{
this
.
setData
({
tipsInnerText
:
"许愿数超出上限啦~"
,
tipsCommonVisible
:
true
// 检查愿望数是否超出
if
(
myWishList
.
length
>=
3
)
{
this
.
setData
({
tipsInnerText
:
"许愿数超出上限啦~"
,
tipsCommonVisible
:
true
})
return
;
}
// // 查重
let
uni
=
myWishList
.
some
((
item
)
=>
{
return
item
.
prizeDefineCode
==
curWish
.
prizeDefineCode
})
return
;
}
if
(
uni
)
{
this
.
setData
({
tipsInnerText
:
"心愿重复啦~\n换个其他心愿试试!"
,
tipsCommonVisible
:
true
})
return
;
}
// // 查重
let
uni
=
myWishList
.
some
((
item
)
=>
{
return
item
.
prizeDefineCode
==
curWish
.
prizeDefineCode
})
if
(
uni
)
{
// 写入愿望单
myWishList
.
push
(
curWish
);
this
.
setData
({
tipsInnerText
:
"心愿重复啦~\n换个其他心愿试试!"
,
tipsCommonVisible
:
true
myWishList
})
return
;
}
app
.
store
.
setItem
(
"wish"
,
myWishList
)
;
}
);
// 写入愿望单
myWishList
.
push
(
curWish
);
this
.
setData
({
myWishList
})
app
.
store
.
setItem
(
"wish"
,
myWishList
);
},
/**
* 取消心愿单
...
...
src/pages/index/index.js
View file @
91d68f7
...
...
@@ -35,10 +35,12 @@ Page({
let
{
wishBillCode
}
=
app
.
globalData
.
indexInfo
;
// 判断页面跳转
let
path
=
"createWish"
;
if
(
wishBillCode
)
{
path
=
"wish"
}
console
.
log
(
"path:"
,
path
);
app
.
router
.
push
({
path
:
path
})
...
...
src/pages/rank/rank.wxml
View file @
91d68f7
...
...
@@ -19,7 +19,7 @@
<view class="display">
<view class="border border2">
<view class="inner inner2">
<image class="portrait" mode="widthFix" src="{{rank[
0
].avatar}}" />
<image class="portrait" mode="widthFix" src="{{rank[
1
].avatar}}" />
</view>
<view class="no no2 ">NO.2</view>
</view>
...
...
src/pages/wish/wish.js
View file @
91d68f7
...
...
@@ -12,7 +12,7 @@ Page({
data
:
{
isOverShare
:
true
,
//自定义分享
tipsRuleVisible
:
false
,
tipsPirzeVisible
:
tru
e
,
tipsPirzeVisible
:
fals
e
,
userInfo
:
{},
wishInfo
:
{},
wishList
:
[],
...
...
Please
register
or
sign in
to post a comment