Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
zhiliang-light-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
35d4749d
authored
2019-10-12 16:01:37 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
默认提交
1 parent
5f973076
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
338 additions
and
71 deletions
src/component/authorize-comp/authorize-comp.wxml
src/component/seckill-order-comp/seckill-order-comp.js
src/component/seckill-order-comp/seckill-order-comp.scss
src/component/seckill-order-comp/seckill-order-comp.wxml
src/config.js
src/http/fetch-api.js
src/pages/auction-detail/auction-detail.js
src/pages/auction-detail/auction-detail.wxml
src/pages/auction-list/auction-list.wxml
src/pages/auction-mine/auction-mine.js
src/pages/auction-mine/auction-mine.scss
src/pages/auction-mine/auction-mine.wxml
src/pages/seckill-detail/seckill-detail.js
src/pages/seckill-detail/seckill-detail.wxml
src/pages/seckill-mine/seckill-mine.js
src/pages/seckill-mine/seckill-mine.json
src/pages/seckill-mine/seckill-mine.scss
src/pages/seckill-mine/seckill-mine.wxml
src/component/authorize-comp/authorize-comp.wxml
View file @
35d4749
...
...
@@ -10,7 +10,8 @@
</view>
</view>
<view class="btn-wrap">
<button class="btn gray" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">确认授权</button>
<!-- <button class="btn gray" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">确认授权</button> -->
<button class="btn gray" bindtap="hideMask">暂不授权</button>
<button class="btn" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">确认授权</button>
</view>
</view>
...
...
src/component/seckill-order-comp/seckill-order-comp.js
View file @
35d4749
...
...
@@ -30,11 +30,22 @@ Component({
type
:
Object
,
value
:
{}
},
// 订单状态
orderStatus
:
{
type
:
Number
,
value
:
0
,
},
// 是否售罄
isSellOut
:
{
type
:
Boolean
,
value
:
false
,
}
},
data
:
{
// 这里是一些组件内部数据
someData
:
{},
num
:
1
,
remark
:
""
,
},
methods
:
{
...
...
@@ -47,22 +58,51 @@ Component({
onStepperChange
(
e
)
{
this
.
setNum
(
e
.
detail
);
},
bindRemarkInput
(
e
)
{
this
.
setData
({
remark
:
e
.
detail
.
value
});
},
setNum
(
val
)
{
this
.
setData
({
num
:
val
})
},
setRemark
(
val
)
{
this
.
setData
({
remark
:
val
})
},
// 隐藏蒙层
hideMask
()
{
this
.
triggerEvent
(
'evtcomp'
,
{
name
:
"_evt_hide_mask"
});
},
// 点击自定义按钮
onInnerButtonHandler
()
{
onInnerButtonHandler
(
evt
)
{
this
.
triggerEvent
(
'evtcomp'
,
{
name
:
"_evt_hide_mask"
});
},
// 确认下单
onSubmitOrderHandler
(
evt
)
{
this
.
triggerEvent
(
'evtcomp'
,
{
name
:
"_evt_submit_order"
,
data
:
{
num
:
this
.
data
.
num
,
remark
:
this
.
data
.
remark
,
}
});
},
// 返回个人中心
onReturnUserCenterHandler
(
evt
)
{
this
.
triggerEvent
(
'evtcomp'
,
{
name
:
"_evt_return_user_center"
});
}
}
})
...
...
src/component/seckill-order-comp/seckill-order-comp.scss
View file @
35d4749
...
...
@@ -16,8 +16,19 @@
color
:
#333333
;
}
.succ
{
position
:
absolute
;
left
:
0
;
right
:
0
;
top
:
24px
;
margin
:
0
auto
;
width
:
100%
;
text-align
:
center
;
color
:
#3680EB
;
}
.cspace
{
height
:
76
px
;
height
:
120
px
;
}
.cont
{
...
...
@@ -39,7 +50,7 @@
.con
{
@extend
.bb
;
padding
:
0
0
0
24
px
;
padding
:
0
0
0
32
px
;
display
:
flex
;
align-content
:
space-between
;
justify-content
:
flex-start
;
...
...
src/component/seckill-order-comp/seckill-order-comp.wxml
View file @
35d4749
...
...
@@ -3,6 +3,8 @@
<span class="iconfont iconbaseline-close-px remove" bindtap="hideMask"></span>
<view class="cspace"></view>
<view class="cont">
<view wx:if="{{orderStatus == 1}}" class="succ">下单成功</view>
<!-- 产品 -->
<view class="product">
<view class="prize">
<image class="image" mode="aspectFill" src="{{productInfo.seckillImages && productInfo.seckillImages[0] || ''}}" />
...
...
@@ -28,8 +30,14 @@
<view class="tt t3 price">¥{{filter.Fen2Yuan(productInfo.originalPrice*num)}}</view>
</view>
</view>
<!-- 无存库 -->
<view class="table" wx:if="{{isSellOut}}">
<view class="empty-tips">
<text class="txt">抱歉来晚一步,库存已告罄\n下次再来吧!</text>
</view>
</view>
<!-- 表单 -->
<view class="table" wx:
if="{{1>10}}"
>
<view class="table" wx:
else
>
<view class="tips">*本活动仅记录订单,无需付款,后期由线下工作人员另行安排支付与配送,请确保收货信息准确。</view>
<view class="form">
<view class="form-item">
...
...
@@ -46,19 +54,19 @@
</view>
<view class="form-item">
<view class="label">备注:</view>
<
!-- <view class="val">{{userInfo.storeName}}</view> --
>
<
input value="{{remark}}" bindinput="bindRemarkInput" class="val ipt" placeholder="请填写备注" /
>
<
input wx:if="{{orderStatus==0}}" value="{{remark}}" bindinput="bindRemarkInput" class="val ipt" placeholder="请填写备注" /
>
<
view wx:if="{{orderStatus==1}}" class="val">{{remark || '无'}}</view
>
</view>
</view>
</view>
<!-- 无存库 -->
<view class="table" wx:else>
<view class="empty-tips">
<text class="txt">抱歉来晚一步,库存已告罄\n下次再来吧!</text>
</view>
</view>
</view>
<view class="btn-wrap">
<view bindtap="onInnerButtonHandler" class="btn">确认下单</view>
<block wx:if="{{isSellOut}}">
<view bindtap="hideMask" class="btn">返回个人中心</view>
</block>
<block wx:else>
<view wx:if="{{orderStatus==0}}" bindtap="onSubmitOrderHandler" class="btn">确认下单</view>
<view wx:if="{{orderStatus==1}}" bindtap="onReturnUserCenterHandler" class="btn">返回个人中心</view>
</block>
</view>
</view>
...
...
src/config.js
View file @
35d4749
...
...
@@ -2,7 +2,7 @@ let ENV_CONFIG = require('./env/index');
const
APPID
=
''
/** ====每次发布版本记得修改此环境配置==== */
const
ENV
=
'Dev'
;
const
ENV
=
'Dev'
;
// Dev Prod
const
NET_CONFIG
=
ENV_CONFIG
[
ENV
];
const
MOCKAPI
=
ENV_CONFIG
.
mockApi
;
...
...
src/http/fetch-api.js
View file @
35d4749
...
...
@@ -95,7 +95,9 @@ const fetch = function ({
data
,
method
})
{
if
(
loading
&&
mode
!=
'log'
)
wx
.
showLoading
();
if
(
loading
&&
mode
!=
'log'
)
wx
.
showLoading
({
mask
:
true
});
// 新建promise对象
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
/**
...
...
src/pages/auction-detail/auction-detail.js
View file @
35d4749
...
...
@@ -44,10 +44,6 @@ Page({
this
.
setData
({
options
})
this
.
queryAuctionDetail
().
then
((
result
)
=>
{
this
.
startTimer
();
})
this
.
queryAuctionRecordLast
();
this
.
initData
();
},
onUnload
()
{
...
...
@@ -57,6 +53,10 @@ Page({
initData
()
{
this
.
queryMember
().
then
((
result
)
=>
{
this
.
queryAuctionDetail
().
then
((
result
)
=>
{
this
.
startTimer
();
})
this
.
queryAuctionRecordLast
();
this
.
openSocket
();
});
},
...
...
@@ -106,7 +106,7 @@ Page({
getTimeStr
(
initObj
)
{
let
productInfo
=
this
.
data
.
productInfo
;
let
endTime
=
productInfo
&&
productInfo
.
endTime
||
0
;
return
formatDateTime
(
endTime
,
initObj
)
return
formatDateTime
(
endTime
,
initObj
)
},
/**
...
...
@@ -214,6 +214,7 @@ Page({
})
app
.
post
({
toast
:
false
,
loading
:
true
,
url
:
app
.
api
.
auctionSubmit
,
data
:
{
auctionCode
:
code
,
...
...
src/pages/auction-detail/auction-detail.wxml
View file @
35d4749
...
...
@@ -9,7 +9,7 @@
<!-- 产品图 -->
<view class="img-wrap">
<swiper class="swiper" indicator-color="rgba(0,0,0,.3)" indicator-active-color="rgba(255,255,255,1)" indicator-dots="{{true}}" autoplay="{{true}}" interval="{{5000}}" duration="{{500}}">
<block wx:for="{{productInfo.auctionImage}}" wx:key="{{index}}">
<block wx:for="{{productInfo.auctionImage
s
}}" wx:key="{{index}}">
<swiper-item>
<image class="swiper-image" src="{{item}}" mode="aspectFill" />
</swiper-item>
...
...
src/pages/auction-list/auction-list.wxml
View file @
35d4749
...
...
@@ -12,7 +12,7 @@
<view class="list">
<view wx:for="{{dataList}}" wx:key="{{index}}" class="border list-item">
<view class="prize">
<image class="image" mode="aspectFill" src="{{item.auctionImage
&& item.auctionImage
[0] || ''}}" />
<image class="image" mode="aspectFill" src="{{item.auctionImage
s && item.auctionImages
[0] || ''}}" />
</view>
<view class="cont">
<view class="up">
...
...
src/pages/auction-mine/auction-mine.js
View file @
35d4749
...
...
@@ -62,12 +62,9 @@ Page({
if
(
!
result
)
return
;
if
(
!
result
.
list
)
return
;
let
dataList
=
result
.
list
;
dataList
.
forEach
(
element
=>
{
element
.
dateStr
=
new
Date
(
element
.
startTime
).
toString
(
"yyyy.MM.dd hh:mm"
)
+
" - "
+
new
Date
(
element
.
endTime
).
toString
(
"yyyy.MM.dd hh:mm"
);
});
dataList
=
this
.
data
.
dataList
.
concat
(
dataList
);
dataList
.
forEach
(
element
=>
{
element
.
recordTime
=
new
Date
(
element
.
recordTime
).
toString
(
"yyyy.MM.dd hh:mm:ss
"
);
element
.
dateStr
=
new
Date
(
element
.
auctionTime
).
toString
(
"yyyy.MM.dd hh:mm
"
);
});
console
.
log
(
"dataList:"
,
dataList
);
this
.
setData
({
...
...
src/pages/auction-mine/auction-mine.scss
View file @
35d4749
...
...
@@ -12,7 +12,7 @@ $contentWidth:690px;
.main
{
.top-space
{
height
:
0
px
;
height
:
24
px
;
}
.content
{
...
...
@@ -21,7 +21,7 @@ $contentWidth:690px;
// list
.list
{
width
:
$contentWidth
;
margin
:
24px
auto
0
;
margin
:
0
auto
0
;
font-size
:
22px
;
&
-item
{
...
...
@@ -34,7 +34,7 @@ $contentWidth:690px;
.prize
{
margin
:
0
32px
;
border
:solid
1PX
#F0F0F0
;
border
:
solid
1
PX
#F0F0F0
;
border-radius
:
8px
;
padding
:
16px
;
...
...
@@ -50,6 +50,15 @@ $contentWidth:690px;
flex
:
1
;
// padding: 0 0 0 16px;
@extend
.bb
;
height
:
220px
;
.up
{}
.down
{
position
:
absolute
;
bottom
:
0
;
}
.tt
{}
...
...
@@ -59,22 +68,22 @@ $contentWidth:690px;
.t2
{
font-size
:
26px
;
margin-top
:
8
px
;
margin-top
:
4
px
;
}
.t3
{
font-size
:
26px
;
font-weight
:
bold
;
margin-top
:
4
px
;
margin-top
:
0
px
;
}
.t4
{
font-size
:
22px
;
margin-top
:
4
px
;
margin-top
:
2
px
;
color
:
#666666
;
}
.sp4
{
.sp4
{
margin-top
:
24px
;
}
}
...
...
src/pages/auction-mine/auction-mine.wxml
View file @
35d4749
...
...
@@ -9,14 +9,18 @@
<view class="list">
<view wx:for="{{dataList}}" wx:key="{{index}}" class="border list-item">
<view class="prize">
<image class="image" mode="aspectFill" src="{{item.auctionImage
&& item.auctionImage
[0] || ''}}" />
<image class="image" mode="aspectFill" src="{{item.auctionImage
s && item.auctionImages
[0] || ''}}" />
</view>
<view class="cont">
<view class="up">
<view class="tt t1">{{item.auctionName}}</view>
<view class="tt t2">原价:{{filter.Fen2Yuan(item.originalPrice)}}元</view>
<view class="tt t3 price">竞拍价格:{{filter.Fen2Yuan(item.auctionPrice)}}元</view>
<view class="tt t4 sp4">订单编号:A20191008103818293X</view>
<view class="tt t4">竞拍时间:{{item.auctionTime}}</view>
</view>
<view class="down">
<view class="tt t4 sp4">订单编号:{{item.auctionCode}}</view>
<view class="tt t4">竞拍时间:{{item.dateStr}}</view>
</view>
</view>
</view>
</view>
...
...
src/pages/seckill-detail/seckill-detail.js
View file @
35d4749
...
...
@@ -11,13 +11,15 @@ let app = getApp();
Page
({
data
:
{
authorizeVisible
:
false
,
seckillOrderVisible
:
tru
e
,
seckillOrderVisible
:
fals
e
,
userInfo
:
{},
productInfo
:
{},
navBackTimeout
:
0
,
options
:
{},
wxTimerList
:
{},
lastTime
:
""
,
isSellOut
:
false
,
orderStatus
:
0
,
// 0.未下单 1.下单成功
},
onShareAppMessage
()
{},
showAuth
()
{
...
...
@@ -34,9 +36,6 @@ Page({
this
.
setData
({
options
})
this
.
querySeckillDetail
().
then
((
result
)
=>
{
this
.
startTimer
();
})
this
.
initData
();
},
onUnload
()
{
...
...
@@ -44,7 +43,11 @@ Page({
},
initData
()
{
this
.
queryMember
().
then
((
result
)
=>
{});
this
.
queryMember
().
then
((
result
)
=>
{
this
.
querySeckillDetail
().
then
((
result
)
=>
{
this
.
startTimer
();
})
});
},
// 开始倒计时
...
...
@@ -104,14 +107,17 @@ Page({
if
(
productInfo
&&
productInfo
.
status
==
1
)
{
// 显示弹窗
this
.
setData
({
orderStatus
:
0
,
isSellOut
:
false
,
seckillOrderVisible
:
true
})
let
minNum
=
productInfo
.
minNum
;
this
.
seckillOrderComp
=
this
.
selectComponent
(
"#seckillOrderComp"
);
console
.
log
(
"this.seckillOrderComp:"
,
this
.
seckillOrderComp
);
console
.
log
(
"minNum:"
,
minNum
);
console
.
log
(
"this.seckillOrderComp:"
,
this
.
seckillOrderComp
);
console
.
log
(
"minNum:"
,
minNum
);
if
(
this
.
seckillOrderComp
)
{
this
.
seckillOrderComp
.
setNum
(
minNum
);
this
.
seckillOrderComp
.
setRemark
(
""
);
}
}
},
...
...
@@ -149,37 +155,41 @@ Page({
* 拍卖出价提交
* @param {*} price
*/
querySeckillSubmit
(
price
)
{
querySeckillSubmit
(
data
)
{
let
code
=
this
.
data
.
options
.
code
;
data
.
seckillCode
=
code
;
app
.
post
({
toast
:
false
,
loading
:
true
,
url
:
app
.
api
.
seckillSubmit
,
data
:
{
seckillCode
:
code
,
price
:
price
*
100
//转成分
}
data
:
data
}).
then
((
result
)
=>
{
console
.
log
(
"result:"
,
result
);
// this.setData({
// auctionBidSuccessVisible: true
// })
this
.
setData
({
orderStatus
:
1
,
})
wx
.
showModal
({
content
:
'下单成功'
,
showCancel
:
false
,
success
(
res
)
{}
})
}).
catch
((
err
)
=>
{
console
.
log
(
"querySeckillSubmit err:"
,
err
);
//
switch (err.code) {
// // 来晚一步,该价格已经被其他用户提交 显示组件
// case 1010
:
//
this.setData({
// auctionBidFailVisible: true
//
})
//
break;
//
default:
//
wx.showToast({
//
title: err.errMsg || "系统开小差"
//
})
//
break;
//
}
switch
(
err
.
code
)
{
// 库存不足
case
1013
:
this
.
setData
({
isSellOut
:
true
,
})
break
;
default
:
wx
.
showToast
({
title
:
err
.
errMsg
||
"系统开小差"
})
break
;
}
});
},
...
...
@@ -221,7 +231,19 @@ Page({
this
.
hideMask
();
break
;
// 返回个人中心
case
"_evt_return_user_center"
:
this
.
hideMask
();
app
.
router
.
push
({
openType
:
"switchTab"
,
path
:
"userCenter"
})
break
;
// 确认下单
case
"_evt_submit_order"
:
this
.
querySeckillSubmit
(
data
);
break
;
default
:
break
;
...
...
src/pages/seckill-detail/seckill-detail.wxml
View file @
35d4749
...
...
@@ -51,5 +51,5 @@
<authorize-comp bind:evtcomp="evtcomp"></authorize-comp>
</van-popup>
<van-popup show="{{ seckillOrderVisible }}">
<seckill-order-comp id="seckillOrderComp" product-info="{{productInfo}}" user-info="{{userInfo}}" bind:evtcomp="evtcomp"></seckill-order-comp>
<seckill-order-comp id="seckillOrderComp" product-info="{{productInfo}}" user-info="{{userInfo}}"
order-status="{{orderStatus}}" is-sell-out="{{isSellOut}}"
bind:evtcomp="evtcomp"></seckill-order-comp>
</van-popup>
...
...
src/pages/seckill-mine/seckill-mine.js
View file @
35d4749
import
{
getBindtapData
}
from
'../../utils/util'
;
let
Date
=
require
(
'../../utils/date.js'
);
let
app
=
getApp
();
Page
({
data
:
{},
data
:
{
authorizeVisible
:
false
,
isInit
:
false
,
total
:
0
,
page
:
1
,
size
:
10
,
dataList
:
[],
},
onShareAppMessage
()
{},
showAuth
()
{
this
.
setData
({
authorizeVisible
:
true
})
},
onLoad
(
options
)
{},
onShow
()
{
},
onLoad
(
options
)
{
this
.
resetPage
();
this
.
initData
();
},
initData
()
{
this
.
queryAuctionList
();
},
// 到达底部
onReachBottom
()
{
if
(
this
.
data
.
dataList
.
length
<
this
.
data
.
total
)
{
this
.
setData
({
page
:
this
.
data
.
page
+
1
});
this
.
queryAuctionList
();
}
},
// 重置页面列表 点击搜索条件时需要
resetPage
()
{
this
.
setData
({
page
:
1
,
dataList
:
[]
})
},
// 拍卖列表
queryAuctionList
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
app
.
post
({
url
:
app
.
api
.
auctionMine
,
data
:
{
page
:
this
.
data
.
page
,
size
:
this
.
data
.
size
,
}
}).
then
((
result
)
=>
{
if
(
!
result
)
return
;
if
(
!
result
.
list
)
return
;
let
dataList
=
result
.
list
;
dataList
.
forEach
(
element
=>
{
element
.
dateStr
=
new
Date
(
element
.
startTime
).
toString
(
"yyyy.MM.dd hh:mm"
)
+
" - "
+
new
Date
(
element
.
endTime
).
toString
(
"yyyy.MM.dd hh:mm"
);
});
dataList
=
this
.
data
.
dataList
.
concat
(
dataList
);
dataList
.
forEach
(
element
=>
{
element
.
recordTime
=
new
Date
(
element
.
recordTime
).
toString
(
"yyyy.MM.dd hh:mm:ss"
);
});
console
.
log
(
"dataList:"
,
dataList
);
this
.
setData
({
dataList
:
dataList
,
total
:
result
.
total
||
0
,
isInit
:
true
,
})
resolve
();
})
})
},
// 隐藏蒙层
hideMask
()
{
this
.
setData
({
...
...
src/pages/seckill-mine/seckill-mine.json
View file @
35d4749
{
"navigationBarTitleText"
:
"
demo
"
"navigationBarTitleText"
:
"
我的竞拍订单
"
}
...
...
src/pages/seckill-mine/seckill-mine.scss
View file @
35d4749
@import
'../../assets/scss/mixins'
;
@import
'../../assets/scss/utils'
;
$contentWidth
:
690px
;
.page
{
.bgc
{
background-color
:
#f8f8f8
;
}
.bg
{}
.main
{
.top-space
{
height
:
0px
;
}
.content
{
position
:
relative
;
// list
.list
{
width
:
$contentWidth
;
margin
:
24px
auto
0
;
font-size
:
22px
;
&
-item
{
@extend
.bb
;
padding
:
30px
0
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
.prize
{
margin
:
0
32px
;
border
:solid
1PX
#F0F0F0
;
border-radius
:
8px
;
padding
:
16px
;
.image
{
width
:
160px
;
height
:
160px
;
}
}
.cont
{
position
:
relative
;
height
:
100%
;
flex
:
1
;
// padding: 0 0 0 16px;
@extend
.bb
;
.tt
{}
.t1
{
font-size
:
32px
;
}
.t2
{
font-size
:
26px
;
margin-top
:
8px
;
}
.t3
{
font-size
:
26px
;
font-weight
:
bold
;
margin-top
:
4px
;
}
.t4
{
font-size
:
22px
;
margin-top
:
4px
;
color
:
#666666
;
}
.sp4
{
margin-top
:
24px
;
}
}
}
}
}
}
}
...
...
src/pages/seckill-mine/seckill-mine.wxml
View file @
35d4749
<wxs module="filter" src="../../utils/utilswxs.wxs"></wxs>
<view class="page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="top-space"></view>
<view class="content"></view>
<view class="content">
<view class="list">
<view wx:for="{{dataList}}" wx:key="{{index}}" class="border list-item">
<view class="prize">
<image class="image" mode="aspectFill" src="{{item.auctionImage && item.auctionImage[0] || ''}}" />
</view>
<view class="cont">
<view class="tt t1">{{item.auctionName}}</view>
<view class="tt t2">原价:{{filter.Fen2Yuan(item.originalPrice)}}元</view>
<view class="tt t3 price">竞拍价格:{{filter.Fen2Yuan(item.auctionPrice)}}元</view>
<view class="tt t4 sp4">订单编号:A20191008103818293X</view>
<view class="tt t4">竞拍时间:{{item.auctionTime}}</view>
</view>
</view>
</view>
</view>
<empty-tips-light inner-text="这里空空如也~" wx:if="{{dataList.length <= 0 && isInit}}"></empty-tips-light>
</view>
</view>
<van-popup show="{{ authorizeVisible }}">
...
...
Please
register
or
sign in
to post a comment