Initial commit
Made-with: Cursor
This commit is contained in:
4
srde/miniprogram/components/trade-item/trade-item.json
Normal file
4
srde/miniprogram/components/trade-item/trade-item.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
18
srde/miniprogram/components/trade-item/trade-item.ts
Normal file
18
srde/miniprogram/components/trade-item/trade-item.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
Component({
|
||||
properties: {
|
||||
id: String,
|
||||
symbol: String,
|
||||
direction: String,
|
||||
entry_price: [String, Number],
|
||||
status: String,
|
||||
position_size: [String, Number],
|
||||
pnl: Number,
|
||||
},
|
||||
methods: {
|
||||
onTap() {
|
||||
if (this.data.id) {
|
||||
wx.navigateTo({ url: `/pages/trade-detail/trade-detail?id=${this.data.id}` });
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
14
srde/miniprogram/components/trade-item/trade-item.wxml
Normal file
14
srde/miniprogram/components/trade-item/trade-item.wxml
Normal file
@@ -0,0 +1,14 @@
|
||||
<view class="trade-item card" bindtap="onTap">
|
||||
<view class="row">
|
||||
<text class="symbol">{{symbol}}</text>
|
||||
<text class="dir {{direction}}">{{direction === 'long' ? '多' : '空'}}</text>
|
||||
</view>
|
||||
<view class="row sub">
|
||||
<text>入场 {{entry_price}}</text>
|
||||
<text class="status-{{status}}">{{status === 'open' ? '持仓' : '已平'}}</text>
|
||||
</view>
|
||||
<view class="row sub" wx:if="{{pnl !== undefined}}">
|
||||
<text>盈亏</text>
|
||||
<text class="{{pnl >= 0 ? 'profit' : 'loss'}}">{{pnl >= 0 ? '+' : ''}}{{pnl}}</text>
|
||||
</view>
|
||||
</view>
|
||||
9
srde/miniprogram/components/trade-item/trade-item.wxss
Normal file
9
srde/miniprogram/components/trade-item/trade-item.wxss
Normal file
@@ -0,0 +1,9 @@
|
||||
.trade-item { cursor: pointer; }
|
||||
.trade-item .row { display: flex; justify-content: space-between; margin-bottom: 8rpx; }
|
||||
.trade-item .symbol { font-weight: 600; color: #333; }
|
||||
.trade-item .dir { font-size: 24rpx; }
|
||||
.trade-item .dir.long { color: #5a9; }
|
||||
.trade-item .dir.short { color: #95a; }
|
||||
.trade-item .sub { font-size: 24rpx; color: #888; }
|
||||
.trade-item .profit { color: #5a9; }
|
||||
.trade-item .loss { color: #a44; }
|
||||
Reference in New Issue
Block a user