Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-limited-sell-miniapp
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
baoss
5 years ago
Commit
fd1c741c55d2aa9fca3c59410f98eea747e0fa6e
1 parent
eaaba3fb
released version
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
119 additions
and
154 deletions
app/app.js
app/common/config.js
app/common/miniQRCodeRoute.js
app/models/product/detail.js
app/pages/index/index.js
app/pages/product/detail/components/count-down-by-now/index.js
app/pages/product/detail/detail.js
app/pages/product/detail/detail.wxml
app/app.js
View file @
fd1c741
...
...
@@ -64,6 +64,7 @@ App({
yas
.
report
(
'YB_LAUNCH_APP'
);
let
scene
=
options
?
options
.
scene
:
''
;
this
.
globalData
.
currentScene
=
scene
;
},
onShow
:
function
(
options
)
{
...
...
@@ -71,6 +72,7 @@ App({
verify
.
gen
();
// 此处返回是是 Promise,需要调用接口的业务,最好在 then 里边执行
let
scene
=
options
?
options
.
scene
:
''
;
this
.
globalData
.
currentScene
=
scene
;
// wx.getLocation({}); // 获取位置信息
...
...
@@ -122,12 +124,13 @@ App({
});
let
shareParams
=
{};
if
(
options
&&
options
.
query
)
{
for
(
var
Key
in
options
.
query
)
{
shareParams
[
Key
]
=
options
.
query
[
Key
];
}
}
yas
.
report
(
'YB_SHARE_UNION_TYPE'
,
shareParams
)
yas
.
report
(
'YB_SHARE_UNION_TYPE'
,
shareParams
)
;
yas
.
report
(
'YB_ENTER_FOREGROUND'
);
// 系统-程序切换置前台上报
if
(
this
.
reportData
.
awakeReported
===
false
)
{
...
...
@@ -238,10 +241,11 @@ App({
});
setTimeout
(()
=>
{
let
uid
=
user
.
uid
;
this
.
setUserUnionType
(
uid
);
},
1000
);
},
getUserUnionType
()
{
return
this
.
globalData
.
userUnionType
;
...
...
app/common/config.js
View file @
fd1c741
const
config
=
{
domains
:
{
// production
// api: 'https://api.yoho.cn',
// service: 'https://api.yoho.cn',
api
:
'https://api.yoho.cn'
,
service
:
'https://api.yoho.cn'
,
// gray
// api: 'http://apigray.yoho.cn',
// store: 'http://openstore.yohops.com',
// test
api
:
'http://api-test3.dev.yohocorp.com'
,
service
:
'http://api-test3.dev.yohocorp.com'
,
// api: 'http://api-test3.dev.yohocorp.com',
// service: 'http://api-test3.dev.yohocorp.com',
yasApi
:
'https://analysis.yohobuy.com/yas_mobile'
},
...
...
app/common/miniQRCodeRoute.js
View file @
fd1c741
...
...
@@ -17,9 +17,11 @@ export function getQRCodeSource(code) {
if
(
data
.
code
===
200
)
{
if
(
data
.
data
)
{
let
resultJson
=
JSON
.
parse
(
data
.
data
);
if
(
resultJson
)
{
let
app
=
getApp
();
let
yas
=
new
Yas
(
app
);
yas
.
report
(
'YB_SHARE_UNION_TYPE'
,
resultJson
);
}
return
resultJson
;
...
...
app/models/product/detail.js
View file @
fd1c741
...
...
@@ -133,9 +133,11 @@ export default {
if
(
result
.
code
===
200
)
{
if
(
result
.
data
)
{
let
resultJson
=
JSON
.
parse
(
result
.
data
);
if
(
resultJson
){
if
(
resultJson
)
{
let
app
=
getApp
();
let
yas
=
new
Yas
(
app
);
yas
.
report
(
'YB_SHARE_UNION_TYPE'
,
resultJson
);
}
return
resultJson
;
...
...
app/pages/index/index.js
View file @
fd1c741
...
...
@@ -140,7 +140,7 @@ Page({
}
that
.
setData
({
listData
:
list
,
footText
:
'暂无更多内容'
footText
:
list
.
length
>
0
?
''
:
'暂无更多内容'
});
}
});
...
...
@@ -156,7 +156,7 @@ Page({
title
:
''
,
content
:
'请打开有货APP参与活动'
,
showCancel
:
false
})
})
;
return
;
}
...
...
@@ -173,7 +173,7 @@ Page({
router
.
go
(
'userCenter'
);
},
goToRule
:
function
(
e
)
{
goToRule
:
function
(
e
)
{
router
.
goUrl
(
'https://activity.yoho.cn/feature/2593.html?share_id=5035&title=限定频道说明'
);
}
});
...
...
app/pages/product/detail/components/count-down-by-now/index.js
View file @
fd1c741
let
timer
;
Component
({
properties
:
{
type
:
String
,
current
:
{
type
:
Number
,
observer
:
'_dataChange'
},
begin
:
Number
,
end
:
Number
},
data
:
{
label
:
''
,
days
:
''
,
hours
:
''
,
minutes
:
''
,
seconds
:
''
,
diff
:
''
,
fullContent
:
''
properties
:
{
type
:
String
,
current
:
{
type
:
Number
,
observer
:
'_dataChange'
},
pageLifetimes
:
{
show
()
{
console
.
log
(
'show'
);
},
hide
()
{
console
.
log
(
'hide'
);
clearInterval
(
timer
);
}
begin
:
Number
,
end
:
Number
},
data
:
{
label
:
''
,
days
:
''
,
hours
:
''
,
minutes
:
''
,
seconds
:
''
,
diff
:
''
,
fullContent
:
''
},
pageLifetimes
:
{
show
()
{
console
.
log
(
'show'
);
},
methods
:
{
_dataChange
()
{
const
{
current
,
begin
,
end
}
=
this
.
data
;
hide
()
{
console
.
log
(
'hide'
);
clearInterval
(
timer
);
}
},
methods
:
{
_dataChange
()
{
const
{
current
,
begin
,
end
}
=
this
.
data
;
let
label
=
'距开售'
;
let
label
=
'距开售'
;
// if (current && begin && end) {
// label = begin - current > 0 ? '距离活动开始' : '距离活动结束';
// }
// if (current && begin && end) {
// label = begin - current > 0 ? '距离活动开始' : '距离活动结束';
// }
this
.
data
.
diff
=
Math
.
abs
(
begin
-
current
>
0
?
begin
-
current
:
end
-
current
);
if
(
timer
)
{
clearInterval
(
timer
);
}
this
.
tick
(
label
);
this
.
data
.
diff
=
Math
.
abs
(
begin
-
current
>
0
?
begin
-
current
:
end
-
current
);
if
(
timer
)
{
clearInterval
(
timer
);
}
this
.
tick
(
label
);
timer
=
setInterval
(()
=>
{
this
.
tick
(
label
);
--
this
.
data
.
diff
;
if
(
this
.
data
.
diff
<
0
)
{
clearInterval
(
timer
);
this
.
triggerEvent
(
'endcountdown'
,
{
isEnd
:
current
-
begin
>
0
});
}
},
1000
);
},
tick
(
label
)
{
let
diff
=
this
.
data
.
diff
;
let
days
=
Math
.
floor
(
diff
/
(
24
*
3600
));
timer
=
setInterval
(()
=>
{
this
.
tick
(
label
);
--
this
.
data
.
diff
;
if
(
this
.
data
.
diff
<
0
)
{
clearInterval
(
timer
);
this
.
triggerEvent
(
'endcountdown'
,
{
isEnd
:
current
-
begin
>
0
});
}
},
1000
);
},
tick
(
label
)
{
let
diff
=
this
.
data
.
diff
;
let
days
=
Math
.
floor
(
diff
/
(
24
*
3600
));
days
=
days
>
9
?
days
:
'0'
+
days
;
days
=
days
>
9
?
days
:
'0'
+
days
;
let
leave1
=
diff
%
(
24
*
3600
);
let
hours
=
Math
.
floor
(
leave1
/
(
3600
));
let
leave1
=
diff
%
(
24
*
3600
);
let
hours
=
Math
.
floor
(
leave1
/
(
3600
));
hours
=
hours
>
9
?
hours
:
'0'
+
hours
;
hours
=
hours
>
9
?
hours
:
'0'
+
hours
;
let
leave2
=
leave1
%
3600
;
let
minutes
=
Math
.
floor
(
leave2
/
60
);
let
leave2
=
leave1
%
3600
;
let
minutes
=
Math
.
floor
(
leave2
/
60
);
minutes
=
minutes
>
9
?
minutes
:
'0'
+
minutes
;
minutes
=
minutes
>
9
?
minutes
:
'0'
+
minutes
;
let
seconds
=
leave2
%
60
;
let
seconds
=
leave2
%
60
;
seconds
=
seconds
>
9
?
seconds
:
'0'
+
seconds
;
seconds
=
seconds
>
9
?
seconds
:
'0'
+
seconds
;
// let fullContent = label + ' ' + days + ' 天 ' + hours + ':' + minutes + ':' + seconds;
let
fullContent
=
days
+
' :'
+
hours
+
' :'
+
minutes
;
// let fullContent = label + ' ' + days + ' 天 ' + hours + ':' + minutes + ':' + seconds;
let
fullContent
=
days
+
' :'
+
hours
+
' :'
+
minutes
;
this
.
setData
({
label
,
days
,
hours
,
minutes
,
seconds
,
fullContent
});
}
this
.
setData
({
label
,
days
,
hours
,
minutes
,
seconds
,
fullContent
});
}
}
});
...
...
app/pages/product/detail/detail.js
View file @
fd1c741
...
...
@@ -78,7 +78,10 @@ const QUEUE_SUCCESS = {
REPEAT
:
2
,
FULL
:
3
};
const
OFFLINE_STATUS
=
{
OFFLINE
:
1
,
OFFLINE_OVER
:
0
}
const
YB_TO_ASSIST_C
=
'YB_TO_ASSIST_C'
;
const
YB_ASSIST_SUCCESS_L
=
'YB_ASSIST_SUCCESS_L'
;
const
YB_INVITE_ASSIST_C
=
'YB_INVITE_ASSIST_C'
;
...
...
@@ -104,6 +107,7 @@ Page(Object.assign({
limitProductType
:
LIMIT_TYPE
.
ASSIST
,
showStatus
:
SHOW_STATUS
.
SHARE
,
offlineStatus
:
OFFLINE_STATUS
.
OFFLINE_OVER
,
queueType
:
QUEUE_TYPE
.
READY
,
productSourceType
:
PRODUCT_SOURCE_TYPE
.
SHARE
,
assistStatus
:
ASSIST_STATUS
.
UN_ASSIST
,
...
...
@@ -141,7 +145,7 @@ Page(Object.assign({
let
limitProductCode
=
query
.
limitProductCode
?
query
.
limitProductCode
:
''
;
let
originUid
=
parseInt
(
query
.
originUid
?
query
.
originUid
:
'0'
,
10
);
let
originUnionID
=
query
.
originUnionID
?
query
.
originUnionID
:
''
;
let
uid
=
app
.
getUid
();
let
scene
=
''
;
...
...
@@ -342,7 +346,7 @@ Page(Object.assign({
if
(
res
.
data
.
defaultUrl
)
{
defaultImage
=
res
.
data
.
defaultUrl
;
}
this
.
setData
({
defaultImage
});
...
...
@@ -400,6 +404,7 @@ Page(Object.assign({
saleTime
:
res
.
data
.
saleTime
?
res
.
data
.
saleTime
:
''
,
reminderNum
:
res
.
data
.
reminderNum
?
res
.
data
.
reminderNum
:
0
,
limitProductType
:
res
.
data
.
limitProductType
?
res
.
data
.
limitProductType
:
4
,
offlineStatus
:
res
.
data
.
offlineStatus
?
res
.
data
.
offlineStatus
:
0
,
showStatus
:
res
.
data
.
showStatus
?
res
.
data
.
showStatus
:
0
,
assistLimit
:
res
.
data
.
helpLimit
?
res
.
data
.
helpLimit
:
0
,
queueType
:
res
.
data
.
queueType
?
res
.
data
.
queueType
:
QUEUE_TYPE
.
READY
,
...
...
@@ -410,7 +415,7 @@ Page(Object.assign({
isNew
:
res
.
data
.
isNew
?
res
.
data
.
isNew
:
''
,
currentTime
:
res
.
data
.
currentTime
?
res
.
data
.
currentTime
:
''
,
oldSaleTime
:
res
.
data
.
oldSaleTime
?
res
.
data
.
oldSaleTime
:
''
,
isApp
:
res
.
data
.
isApp
==
'Y'
?
true
:
false
,
isApp
:
res
.
data
.
isApp
==
'Y'
?
true
:
false
,
});
}
else
{
return
Promise
.
reject
();
...
...
@@ -525,7 +530,7 @@ Page(Object.assign({
title
:
''
,
content
:
'请打开有货APP参与活动'
,
showCancel
:
false
})
})
;
return
;
}
...
...
@@ -579,7 +584,7 @@ Page(Object.assign({
if
((
this
.
data
.
avatarList
.
length
+
1
)
===
this
.
data
.
assistLimit
)
{
detailModel
.
getLimitCode
(
this
.
data
.
originUid
,
this
.
data
.
limitProductCode
);
}
}
else
if
(
result
.
code
===
520
)
{
//
此限定商品分享助力只限新客!
}
else
if
(
result
.
code
===
520
)
{
//
此限定商品分享助力只限新客!
wx
.
hideLoading
();
wx
.
showModal
({
title
:
'提示'
,
...
...
@@ -605,7 +610,8 @@ Page(Object.assign({
}).
catch
(
this
.
showError
.
bind
(
this
));
},
//帮ta助力
// 帮ta助力
queueAction
()
{
let
userInfo
=
app
.
getUserInfo
();
...
...
@@ -627,7 +633,7 @@ Page(Object.assign({
helpUserImgUrl
:
userInfo
.
wechat
.
avatarUrl
?
userInfo
.
wechat
.
avatarUrl
:
''
,
limitProductCode
:
this
.
data
.
limitProductCode
}).
then
(
result
=>
{
if
(
result
.
code
===
520
)
{
//
此限定商品分享助力只限新客!
if
(
result
.
code
===
520
)
{
//
此限定商品分享助力只限新客!
wx
.
hideLoading
();
wx
.
showModal
({
title
:
'提示'
,
...
...
@@ -694,9 +700,9 @@ Page(Object.assign({
duration
:
3000
});
}
})
})
;
}
})
})
;
},
assistCancel
()
{
this
.
reload
();
...
...
@@ -742,7 +748,7 @@ Page(Object.assign({
title
:
''
,
content
:
'请打开有货APP参与活动'
,
showCancel
:
false
})
})
;
return
;
}
router
.
go
(
'queueIndex'
,
Object
.
assign
({
...
...
@@ -761,15 +767,15 @@ Page(Object.assign({
});
},
goApp
:
function
(
e
)
{
goApp
:
function
(
e
)
{
},
launchAppError
:
function
(
e
)
{
launchAppError
:
function
(
e
)
{
wx
.
showToast
({
title
:
'打开失败!您可能未安装Yoho!Buy官方APP,请下载后再尝试。'
,
icon
:
'none'
,
duration
:
3000
})
})
;
},
goLogin
(
login
=
1
)
{
...
...
@@ -862,13 +868,15 @@ Page(Object.assign({
}
});
},
//用户是否关注过有货服务号
// 用户是否关注过有货服务号
getUserWechatRelateInfo
()
{
if
(
!
this
.
data
.
uid
)
{
return
Promise
.
resolve
();
}
let
uid
=
this
.
data
.
uid
;
return
detailModel
.
getUserWechatRelateInfo
(
uid
).
then
(
result
=>
{
if
(
result
.
code
===
200
&&
result
.
data
.
isSubscribe
)
{
this
.
setData
({
...
...
app/pages/product/detail/detail.wxml
View file @
fd1c741
...
...
@@ -68,7 +68,11 @@
<action-bar wx:if="{{assistStatus === 1 || assistStatus === 3}}">
<form bindsubmit="assistShare" report-submit='true'>
<view class="bottom1-action">
<button class="as-bottom ok" formType="submit">{{isNew=='Y' ? '邀请新用户助力获取限购码' : '邀请好友助力获取限购码'}}</button>
<block wx:if="{{offlineStatus === 1}}">
<button class="as-bottom ok1" formType="submit">{{isNew=='Y' ? '邀请新用户助力获取限购码' : '邀请好友助力获取限购码'}}
<text class="buy-tip"> (线下购买专用)</text></button>
</block>
<button wx:else class="as-bottom ok" formType="submit">{{isNew=='Y' ? '邀请新用户助力获取限购码' : '邀请好友助力获取限购码'}}</button>
<view class="help-wrapper" bindtap="goHelp">
<image class="help" src="../../../static/images/XD_q_ic@3x.png"></image>
</view>
...
...
@@ -255,62 +259,6 @@
</block>
</block>
<block wx:elif="{{showStatus === 8}}">
<block wx:if="{{productSourceType === 1}}">
<action-bar wx:if="{{assistStatus === 1 || assistStatus === 3}}">
<form bindsubmit="assistShare" report-submit='true'>
<view class="bottom1-action">
<button class="as-bottom ok1" formType="submit">{{isNew=='Y' ? '邀请新用户助力获取限购码' : '邀请好友助力获取限购码'}}
<text class="buy-tip"> (线下购买专用)</text></button>
<view class="help-wrapper" bindtap="goHelp">
<image class="help" src="../../../static/images/XD_q_ic@3x.png"></image>
</view>
</view>
</form>
</action-bar>
<action-bar wx:elif="{{assistStatus === 2}}">
<view class="bottom1-action">
<view class="as-bottom cancel">即将开售</view>
</view>
</action-bar>
<block wx:else></block>
</block>
<block wx:if="{{productSourceType === 2}}">
<action-bar wx:if="{{assistStatus === 2 || assistStatus === 5}}">
<view class="top-assist-action">
<view class="top-title" >你的好友已助力成功</view>
<view class="top-action3">
<view class="as-bottom ok width150" bindtap="restartSelfShare">我也要参加</view>
</view>
</view>
</action-bar>
<action-bar wx:elif="{{assistStatus === 3}}">
<view class="top-assist-action">
<view class="top-title" >你的好友邀请你为ta助力</view>
<view class="top-action">
<view class="as-bottom ok width130" bindtap="assistAction">帮ta助力</view>
<view class="as-bottom ok width130" bindtap="assistJion">直接参加</view>
</view>
</view>
</action-bar>
<action-bar wx:elif="{{assistStatus === 4}}">
<view class="bottom1-action">
<view class="as-bottom ok">已助力</view>
<view class="help-wrapper" bindtap="goHelp">
<image class="help" src="../../../static/images/XD_q_ic@3x.png"></image>
</view>
</view>
</action-bar>
<block wx:else></block>
</block>
</block>
</block>
<block wx:elif="{{limitProductType === 5}}">
...
...
Please
register
or
login
to post a comment