| | |
| | | <template> |
| | | <div> |
| | | <ul class="sport-tabs"> |
| | | <li |
| | | :class="actives === item.key && 'active'" |
| | | v-for="item in tabsList" |
| | | :key="item.key" |
| | | @click="clickTabs(item)" |
| | | > |
| | | <li :class="actives === item.key && 'active'" v-for="item in tabsList" :key="item.key" @click="clickTabs(item)"> |
| | | {{ item.title }} |
| | | </li> |
| | | </ul> |
| | | <van-list |
| | | v-model="loading" |
| | | :finished="finished" |
| | | :finished-text="$t('hj43')" |
| | | :loading-text="$t('hj430')" |
| | | @load="onLoad" |
| | | > |
| | | <div |
| | | class="sport-content-li" |
| | | :style="actives === 1 ? 'height:5.52rem' : 'height:7.52rem'" |
| | | v-for="(item, index) in dataList" |
| | | :key="index" |
| | | @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)" |
| | | > |
| | | <van-list v-model="loading" :finished="finished" :finished-text="$t('hj43')" :loading-text="$t('hj430')" |
| | | @load="onLoad"> |
| | | <div class="sport-content-li" :style="actives === 1 ? 'height:5.52rem' : 'height:7.52rem'" |
| | | v-for="(item, index) in dataList" :key="index" @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)"> |
| | | <div @click.stop="pushRouter(item)"> |
| | | <div class="title-box"> |
| | | <div class="span">{{ item.stockName }}</div> |
| | | <div |
| | | class="states" |
| | | :class="item.orderDirection === '买跌' ? 'states-red' : ''" |
| | | > |
| | | <div class="states" :class="item.orderDirection === '买跌' ? 'states-red' : ''"> |
| | | {{ $t(item.orderDirection) }} |
| | | </div> |
| | | </div> |
| | | {{ item.stockSpell }} |
| | | </div> |
| | | <!-- <div @click="$router.push('/Stockdetail')"></div> --> |
| | | <van-row> |
| | | <van-row v-if="actives != 2"> |
| | | <van-col span="8"> |
| | | <div style="text-align: left"> |
| | | <div class="sport-content-title2"> |
| | | {{ $t("盈虧") }} ({{ activeObj.symbolCode }}) |
| | | </div> |
| | | <div class="sport-content-text" > |
| | | <div class="sport-content-text"> |
| | | {{ item.profitAndLose | _toLocaleString }} |
| | | </div> |
| | | </div> |
| | |
| | | <div style="text-align: right"> |
| | | <div class="sport-content-title2">{{ $t("倉位(股)") }}</div> |
| | | <div class="sport-content-text">{{ item.orderNum }}</div> |
| | | </div></van-col |
| | | > |
| | | </div> |
| | | </van-col> |
| | | </van-row> |
| | | <van-row> |
| | | <van-col span="8"> |
| | |
| | | {{ $t("hj40") }}({{ activeObj.symbolCode }}) |
| | | </div> |
| | | <div class="sport-content-text2"> |
| | | {{ item.now_price | _toLocaleString }} |
| | | {{ item.nowPrice | _toLocaleString }} |
| | | </div> |
| | | </div> |
| | | </van-col> |
| | |
| | | {{ $t("訂單金額") }} ({{ activeObj.symbolCode }}) |
| | | </div> |
| | | <div class="sport-content-text2"> |
| | | {{ item.orderTotalPrice | _toLocaleString }} |
| | | {{ item.targetPrice | _toLocaleString }} |
| | | </div> |
| | | </div> |
| | | </van-col> |
| | |
| | | </div> |
| | | </div> |
| | | </van-col> |
| | | <!-- <van-col span="8"> |
| | | <van-col span="8" style="height: 100%;display: flex;align-items: center;justify-content: center;"> |
| | | <div v-if="actives == 2"> |
| | | <van-button type="primary" @click.stop="cancelPending(item.id)"> {{ $t("撤销挂单") |
| | | }}</van-button> |
| | | </div> |
| | | </van-col> |
| | | <!-- <van-col span="8"> |
| | | <div style="text-align: center"> |
| | | <div class="sport-content-title2"> |
| | | {{ $t("止損價") }} ({{ activeObj.symbolCode }}) |
| | |
| | | <van-col span="12"> |
| | | <div style="text-align: left"> |
| | | <div class="sport-content-title2">{{ $t("持倉時間") }}</div> |
| | | <div class="sport-content-text2"> |
| | | <div class="sport-content-text2" v-if="actives != 2"> |
| | | {{ $moment(item.buyOrderTime).format("DD-MM-YYYY hh:mm:ss A") }} |
| | | </div> |
| | | <div class="sport-content-text2" v-else> |
| | | {{ $moment(item.addTime).format("DD-MM-YYYY hh:mm:ss A") }} |
| | | </div> |
| | | </div> |
| | | </van-col> |
| | |
| | | </div> |
| | | <div class="hang"> |
| | | <div class="left">{{ $t("倉位(股)") }}</div> |
| | | <div class="right" style="color: rgb(3, 173, 143)"> |
| | | <input class="right" inputmode="numeric" style="color: rgb(3, 173, 143);width: 1.1rem;" v-model.number="closeNumber" @input="handleInput"> |
| | | <!-- <div class="right" style="color: rgb(3, 173, 143)"> |
| | | {{ closeSell.orderNum }} |
| | | </div> |
| | | </div> --> |
| | | </div> |
| | | <div class="hang"> |
| | | <div class="left">{{ $t("類型") }}</div> |
| | |
| | | </div> |
| | | </template> |
| | | </Dialog> |
| | | <Dialog ref="closeOrder" :title="$t('撤销挂单')" :confirm="cancelPendingOrder"> |
| | | </Dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import Dialog from "@/components/Dialog"; |
| | | import { getchicang, sell } from "../../../axios/api"; |
| | | import { getchicang, sell, getorderList, delGuaDan } from "../../../axios/api"; |
| | | import { Notify } from "vant"; |
| | | export default { |
| | | components: { Dialog }, |
| | |
| | | pageSize: 150, |
| | | loading: true, |
| | | finished: false, |
| | | closeSell: {}, |
| | | closeSell: { |
| | | orderNum: 0 |
| | | }, |
| | | show: false, |
| | | actives: 0, |
| | | dataList: [], |
| | |
| | | title: this.$t("持倉"), |
| | | key: 0, |
| | | }, |
| | | |
| | | { |
| | | title: this.$t("平倉"), |
| | | key: 1, |
| | | }, |
| | | { |
| | | title: this.$t('当前委托'), |
| | | key: 2, |
| | | } |
| | | ], |
| | | id: '', |
| | | closeNumber: 0 |
| | | }; |
| | | }, |
| | | created(){ |
| | | created() { |
| | | this.timer = setInterval(() => { |
| | | this.getList(); |
| | | }, 1000); |
| | |
| | | clearInterval(this.timer); // 在组件销毁前清除定时器 |
| | | }, |
| | | methods: { |
| | | handleInput(){ |
| | | if (this.closeNumber > this.closeSell.orderNum) { |
| | | this.closeNumber = this.closeSell.orderNum; // 如果超过100则设置为100 |
| | | } else if (this.closeNumber < 1) { |
| | | this.closeNumber = 1; // 如果小于0则设置为0,如果不需要小于0,可以删除这个部分 |
| | | } |
| | | }, |
| | | pushRouter(item) { |
| | | const obj = { |
| | | pid: item.stockCode || "", |
| | |
| | | async confirm() { |
| | | const res = await sell({ |
| | | positionSn: this.closeSell.positionSn, |
| | | closeNumber: this.closeNumber |
| | | }); |
| | | if (res.status === 0) { |
| | | this.$refs.closeDialog.show = false; |
| | |
| | | this.pageNum = 1; |
| | | this.finished = false; |
| | | } |
| | | const res = await getchicang({ |
| | | state: this.actives, |
| | | stockType: laber || this.activeObj.laber, |
| | | pageNum: 1, |
| | | pageSize: 100, |
| | | }); |
| | | |
| | | let res; |
| | | if (this.actives == 0 || this.actives == 1) { |
| | | res = await getchicang({ |
| | | state: this.actives, |
| | | stockType: laber || this.activeObj.laber, |
| | | pageNum: 1, |
| | | pageSize: 100, |
| | | }); |
| | | } else { |
| | | res = await getorderList({ |
| | | stockType: laber || this.activeObj.laber, |
| | | pageNum: 1, |
| | | pageSize: 100, |
| | | }); |
| | | } |
| | | this.loading = false; |
| | | if (res.status === 0) { |
| | | this.dataList = res.data.list; |
| | | if (res.data.list) { |
| | | this.dataList = res.data.list; |
| | | } else { |
| | | this.dataList = res.data; |
| | | } |
| | | this.$forceUpdate(); // 强制Vue重新渲染 |
| | | // if (res.data.total <= this.dataList.length) { |
| | | this.finished = true; |
| | |
| | | close(item) { |
| | | this.closeSell = item; |
| | | this.$refs.closeDialog.show = true; |
| | | this.closeNumber = this.closeSell.orderNum; |
| | | }, |
| | | clickTabs(e) { |
| | | this.dataList = []; |
| | |
| | | this.actives = e.key; |
| | | this.getList(); |
| | | }, |
| | | cancelPending(id){ |
| | | this.id = id |
| | | this.$refs.closeOrder.show = true |
| | | }, |
| | | async cancelPendingOrder() { |
| | | const res = await delGuaDan({ |
| | | id : this.id |
| | | }); |
| | | if (res.status === 1) { |
| | | this.$refs.closeOrder.show = false |
| | | Notify({ type: "success", message: res.msg }); |
| | | this.dataList = []; |
| | | this.pageNum = 1; |
| | | this.finished = false; |
| | | this.getList(); |
| | | } else { |
| | | Notify({ type: "danger", message: res.msg }); |
| | | } |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | top: 0; |
| | | z-index: 99; |
| | | background-color: #fff; |
| | | |
| | | li { |
| | | height: 0.90667rem; |
| | | line-height: 0.90667rem; |
| | |
| | | color: #14181f; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .active { |
| | | color: #0066ed; |
| | | border-bottom: 0.08rem solid #0066ed; |
| | | } |
| | | } |
| | | |
| | | .sport-content-li { |
| | | width: 100%; |
| | | height: 7.52rem; |
| | |
| | | border-bottom: 0.02667rem solid #f0f2f3; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .title-box { |
| | | display: flex; |
| | | font-style: normal; |
| | |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .span { |
| | | } |
| | | .span {} |
| | | |
| | | .states { |
| | | display: inline-flex; |
| | | justify-content: center; |
| | |
| | | color: #8c9fad; |
| | | // text-align: left; |
| | | } |
| | | |
| | | .sport-content-text { |
| | | margin-top: 5px; |
| | | font-style: normal; |
| | |
| | | // line-height: 18px; |
| | | // text-align: right; |
| | | } |
| | | |
| | | .sport-content-text2 { |
| | | margin-top: 5px; |
| | | // font-family: "PingFang SC"; |
| | |
| | | .but-box { |
| | | display: flex; |
| | | justify-content: space-around; |
| | | |
| | | .but { |
| | | text-align: center; |
| | | |
| | |
| | | color: #0067ed; |
| | | border: none; |
| | | } |
| | | |
| | | .buts { |
| | | min-width: 2.13333rem; |
| | | height: 0.69333rem; |
| | |
| | | color: #14181f; |
| | | } |
| | | } |
| | | |
| | | .hang { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | |
| | | .left { |
| | | font-style: normal; |
| | | font-weight: 500; |
| | | font-size: 0.34667rem; |
| | | color: #8c9fad; |
| | | } |
| | | |
| | | .right { |
| | | font-style: normal; |
| | | font-weight: 500; |