| | |
| | | <div class="sert"> |
| | | <span v-for="(item, index) in chicangList" :key="index" @click="chicangidx = index" |
| | | :class="chicangidx == index ? 'sdpl' : ''">{{ item.name }}</span> |
| | | <a :style="{ left: getIndicatorLeft() + 'rem' }"></a> |
| | | <a :style="{ left: getIndicatorLeft() }"></a> |
| | | </div> |
| | | <div class="bnm"></div> |
| | | </div> |
| | |
| | | <van-list v-model="loading" :finished="finished" :finished-text="$t('hj43')" |
| | | v-show="chicangidx === 0" @load="onLoad" :immediate-check="immediate"> |
| | | <!-- <div class="cichang" v-for="(item,index) in tabsPositionNumArr" :key="item.buyOrderId"> --> |
| | | <div class="cichang" v-for="(item, key) in tabsPositionObj" :key="item.buyOrderId"> |
| | | <div class="cichang" v-for="(item, key) in tabsPositionObj" :key="item.buyOrderId" @click="goDetail(item)"> |
| | | <div class="dingbu"> |
| | | <div class="dl"> |
| | | <h6>{{ item.stockName ? item.stockName : item.indexName }}</h6> |
| | |
| | | <div class="button-container"> |
| | | <!-- <div class="dr" style="margin-right: 16px" v-if="chicangidx == 0" @click="goBuyDetail(item)">买入</div> |
| | | <div class="dr-blue" style="margin-right: 16px" v-if="chicangidx == 0" @click="getpingcangbf(item.positionSn,item.orderNum)"> 部分平仓 </div> --> |
| | | <div class="dr-blue" style="margin-right: 16px" v-if="chicangidx == 0" @click="getpingcang(item.positionSn)"> {{ $t('hj121') }} </div> |
| | | <div class="dr-blue" style="margin-right: 16px" v-if="chicangidx == 0" @click.stop="getpingcang(item.positionSn)"> {{ $t('hj121') }} </div> |
| | | |
| | | </div> |
| | | </div> |
| | |
| | | <!-- <p v-if="chicangidx == 1"><span>{{ $t('jy19') }}</span><a class="red">5.49/{{ $t('jy96') }}</a></p> |
| | | <p v-if="chicangidx == 1"><span>{{ $t('jy15') }}</span><a class="red">49959.00</a></p> --> |
| | | <!-- <p><span>{{ $t('jy531') }}</span><a class="red">{{item.orderLever}}</a></p> --> |
| | | <p><span>{{ $t('jy37') }}</span><a class="red">{{item.buyAmtAutual}}</a></p> |
| | | <!-- <p><span>{{ $t('jy37') }}</span><a class="red">{{item.buyAmtAutual}}</a></p> --> |
| | | </div> |
| | | </div> |
| | | </van-list> |
| | |
| | | <p><span>{{ $t('jy533') }}</span><a class="red">{{item.orderFee}}</a></p> |
| | | <p><span>{{ $t('jy17') }}</span><a class="red">{{item.orderTotalPrice}}</a></p> |
| | | <p><span>{{ $t('jy153') }}</span><a class="red">{{item.orderSpread}}</a></p> |
| | | <p v-if="chicangidx == 1"><span>{{ $t('jy15') }}</span><a class="red">{{item.orderStayFee}}</a></p> |
| | | <!-- <p v-if="chicangidx == 1"><span>{{ $t('jy15') }}</span><a class="red">{{item.orderStayFee}}</a></p> --> |
| | | </div> |
| | | </div> |
| | | </van-list> |
| | |
| | | <p><span>{{ $t('jy19') }}</span><a class="red">{{item.buyOrderPrice}}/{{ $t('jy96') }}</a></p> |
| | | <p v-if="chicangidx == 1"><span>{{ $t('jy25') }}</span><a class="red">{{item.sellOrderPrice}}/{{ $t('jy96') }}</a></p> |
| | | <p><span>{{ $t('jy18') }}</span><a class="red">{{item.orderNum}}</a></p> |
| | | <p><span>挂单时间</span><a class="red">{{ item.buyOrderTime | gettime }}</a></p> |
| | | <p><span>{{ $t('jy521') }}</span><a class="red">{{ item.buyOrderTime | gettime }}</a></p> |
| | | <p><span>{{ $t('jy17') }}</span><a class="red">{{item.orderTotalPrice}}</a></p> |
| | | <!-- <p><span>{{ $t('jy153') }}</span><a class="red">{{item.orderSpread}}</a></p> --> |
| | | <p v-if="chicangidx == 1"><span>{{ $t('jy15') }}</span><a class="red">{{item.orderStayFee}}</a></p> |
| | |
| | | name: this.$t('jy410') |
| | | }, |
| | | { |
| | | name: '我的委托' |
| | | name: this.$t('jy520') |
| | | } |
| | | ], |
| | | chicangidx: 0, |
| | |
| | | methods: { |
| | | // 计算滑动指示器的位置 |
| | | getIndicatorLeft() { |
| | | const totalWidth = 5.34 // .sert 的总宽度(rem) |
| | | const tabCount = this.chicangList.length |
| | | const indicatorWidth = 0.53 // 指示器宽度(rem) |
| | | |
| | | // 计算每个标签的中心位置 |
| | | const tabWidth = totalWidth / tabCount |
| | | const centerPosition = (this.chicangidx + 0.7) * tabWidth |
| | | // 每个标签占的百分比 |
| | | const tabWidthPercent = 100 / tabCount |
| | | |
| | | // 减去指示器宽度的一半,使其居中 |
| | | return centerPosition - indicatorWidth / 2 |
| | | // 当前选中标签的中心位置(百分比) |
| | | const centerPositionPercent = (this.chicangidx + 0.5) * tabWidthPercent |
| | | |
| | | // 返回百分比,指示器会自动居中 |
| | | return centerPositionPercent + '%' |
| | | }, |
| | | goDetail(item) { |
| | | this.$router.push(`/WarehouseDetail?positionSn=${item.positionSn}`) |
| | | // 根据当前的tab索引传递不同的类型值 |
| | | // chicangidx: 0-持仓, 1-平仓, 2-委托 |
| | | const type = this.chicangidx === 1 ? 'pingcang' : this.chicangidx === 2 ? 'weituo' : 'chicang'; |
| | | this.$router.push(`/WarehouseDetail?positionSn=${item.positionSn}&type=${type}`) |
| | | }, |
| | | onLoad() { |
| | | //持仓 |
| | |
| | | // 如果 chicangidx 为 0,表示是沪深京市场(可能是股票市场的不同板块) |
| | | if (this.chicangidx == 0) { |
| | | // 先弹出一个选择平仓数量的输入框 |
| | | this.$prompt('平仓数量', '部分平仓', { |
| | | this.$prompt(this.$t('jy522'), this.$t('jy523'), { |
| | | confirmButtonText: this.$t('hj161'), |
| | | cancelButtonText: this.$t('hj106'), |
| | | inputPattern: /^[0-9]*[1-9][0-9]*$/, // 限制输入为正整数 |
| | | inputErrorMessage: '格式错误' // 输入不合法时的错误提示 |
| | | inputErrorMessage: this.$t('jy524') // 输入不合法时的错误提示 |
| | | }).then(async ({ value }) => { |
| | | const selectedQuantity = Number(value); // 用户选择的平仓数量 |
| | | |
| | | if (selectedQuantity <= 0) { |
| | | Toast('格式错误'); // 如果输入无效数量,提示错误 |
| | | Toast(this.$t('jy524')); // 如果输入无效数量,提示错误 |
| | | return; |
| | | } |
| | | if(selectedQuantity > orderNum){ |
| | | Toast('超过最大数量'+orderNum); // 如果输入无效数量,提示错误 |
| | | Toast(this.$t('jy525') + orderNum); // 如果输入无效数量,提示错误 |
| | | return; |
| | | } |
| | | // 弹出确认框,询问用户是否确认平仓 |
| | |
| | | border-radius: 0.4rem 0.4rem 0 0; |
| | | margin-top: -0.4rem; |
| | | background: #fff; |
| | | padding: 0 0.4rem; |
| | | box-sizing: border-box; |
| | | |
| | | .sert { |
| | | width: 5.34rem; |
| | | width: 100%; |
| | | margin: 0 auto; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | position: relative; |
| | | height: 1.07rem; |
| | | box-sizing: border-box; |
| | | |
| | | span { |
| | | text-align: center; |
| | |
| | | font-size: .4rem; |
| | | font-weight: 550; |
| | | line-height: 1.07rem; |
| | | flex: 1; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | min-width: 0; |
| | | } |
| | | |
| | | .sdpl { |
| | |
| | | border-radius: 0.05rem; |
| | | position: absolute; |
| | | bottom: 0; |
| | | margin-left: -0.266rem; |
| | | transform: translateX(-50%); |
| | | transition: all .5s; |
| | | } |
| | | } |