| | |
| | | <div> |
| | | <div class="text-grey text-right">{{ $t('现价') }}</div> |
| | | <div class="mt-20 text-right" :class="item.close_price > item.open_price ? 'text-green' : 'text-red'"> |
| | | {{ item.close_price }}</div> |
| | | <!-- {{ item.close_price }} --> |
| | | {{newprice}} |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="flex pt-40 pb-40"> |
| | |
| | | $t('您目前没有持仓') }}</div> |
| | | <van-popup v-model="show"> |
| | | <popup-delivery :showBtns="true" :price="price" :detailData="detailData" :key="detailData.order_no" |
| | | @close="onClose" /> |
| | | @close="onClose" :symbol="symbol" /> |
| | | </van-popup> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import PopupDelivery from '@/components/popup-delivery' |
| | | import { WS_URL } from '@/config' |
| | | import { Popup } from 'vant'; |
| | | import { _futrueOrderDetail } from "@/API/trade.api"; |
| | | export default { |
| | | name: "deliveryHoldList", |
| | | data() { |
| | | return { |
| | | sockets: { |
| | | quotes: null, // 行情 |
| | | deep: null /// 深度 |
| | | }, |
| | | show: false, |
| | | newprice:"", |
| | | iconShow: false, |
| | | detailData: {}, |
| | | } |
| | |
| | | return [] |
| | | } |
| | | }, |
| | | symbol: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | price: { |
| | | type: [Number, String], |
| | | default: '0.00' |
| | | }, |
| | | }, |
| | | deactivated(){ |
| | | this.closeSocket() |
| | | }, |
| | | mounted (){ |
| | | this.fetchDeepData() |
| | | }, |
| | | methods: { |
| | | closeSocket() { |
| | | this.sockets.deep.close() |
| | | // this.sockets.quotes && this.sockets.quotes.close() |
| | | // this.sockets.deep && this.sockets.deep.close() |
| | | this.sockets.quotes = null |
| | | this.sockets.deep = null |
| | | }, |
| | | fetchDeepData() { |
| | | |
| | | this.startDeepSocket() // socket |
| | | }, |
| | | startDeepSocket() { |
| | | this.sockets.deep = new WebSocket(`${WS_URL}/3/${this.symbol}`) |
| | | this.sockets.deep.onmessage = (evt) => { |
| | | const { data } = evt |
| | | const { code, data: _data } = JSON.parse(data) |
| | | // console.log(_data.bids[0].price); |
| | | this.newprice = _data.asks[0].price |
| | | } |
| | | }, |
| | | clearTimeout() { |
| | | clearTimeout(this.timeout) |
| | | this.timeout = null |