index.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366
  1. <template>
  2. <view class="contract-box" :rise-fall="stocksColor">
  3. <view class="contract-title">
  4. <view class="contract-item" @click.stop="openDrawer">
  5. <view class="title-iocn">
  6. <text class="title-iocn-item"></text>
  7. <text class="title-iocn-item"></text>
  8. <text class="title-iocn-item"></text>
  9. </view>
  10. <!-- <image class="title-iocn" src="../../../static/logo.png" mode="aspectFit"></image> -->
  11. <text class="title-text">{{ currencyVal.currency_name }}/{{ currencyVal.legal_name }}</text>
  12. </view>
  13. <view class="contract-item">
  14. <!-- <text class="title-ratio">资金费率:{{ rateProfitsTotal.profits_total }}%</text> -->
  15. <image class="ratio-icon" @click.stop="lookDetails" src="../../../static/images/icon_05.png"
  16. mode="aspectFit"></image>
  17. <image class="ratio-icon" @click.stop="setContract" src="../../../static/images/icon_06.png"
  18. mode="aspectFit"></image>
  19. </view>
  20. </view>
  21. <view class="account-box">
  22. <view class="account-item">
  23. <view class="account-title">
  24. <text class="text">持仓保证金USDT)</text>
  25. </view>
  26. <text class="account-num">{{ leverTrade.caution_money }}</text>
  27. </view>
  28. <view class="account-item">
  29. <view class="account-title">
  30. <text class="text">可用保证金(USDT)</text>
  31. </view>
  32. <text class="account-num">{{ leverTrade.origin_caution_money_all }}</text>
  33. </view>
  34. <view class="account-item">
  35. <view class="account-title">
  36. <text class="text">未实现亏盈(USDT)</text>
  37. </view>
  38. <text class="account-num">{{ leverTrade.profits_all }}</text>
  39. </view>
  40. <view class="account-item">
  41. <view class="account-title">
  42. <text class="text">净值(USDT</text>
  43. </view>
  44. <text class="account-num">{{ pagesInfo.user_net_value }}</text>
  45. </view>
  46. <view class="account-item">
  47. <view class="account-title">
  48. <text class="text">风险率(%)</text>
  49. </view>
  50. <text class="account-num">{{ leverTrade.hazard_rate }}</text>
  51. </view>
  52. <view class="account-item">
  53. <view class="account-title">
  54. <text class="text">账户余额(USDT)</text>
  55. </view>
  56. <text class="account-num">{{ pagesInfo.user_lever }}</text>
  57. </view>
  58. </view>
  59. <view class="data-box">
  60. <view class="data-left">
  61. <view class="nums-title">
  62. <view class="left-title flex">
  63. <text>价格</text>
  64. <text>数量</text>
  65. </view>
  66. <view class="subhead-title flex">
  67. <text>(USDT)</text>
  68. <text>(张)</text>
  69. </view>
  70. </view>
  71. <view class="nums-list">
  72. <template v-for="(item , indx) in bids" v-if="indx < marketNum">
  73. <market-depth :type="1" :val="item"></market-depth>
  74. </template>
  75. <!-- <view class="nums-item die" v-for="(item , indx) in bids" :key="`bids_${indx}`" v-if="indx < 7">
  76. <text class="nums-item-bg pankoubgcolor" :style="{'width': item[2] + '%' }"></text>
  77. <view class="item-num">
  78. <text class="color">{{ item[1] }}</text>
  79. <text>{{ item[0] }}</text>
  80. </view>
  81. </view> -->
  82. </view>
  83. <view class="index-num-box">
  84. <view class="index-num-title">
  85. <text>{{ daymarket.now_price }}</text>
  86. <text>{{ daymarket.change }}%</text>
  87. </view>
  88. <view class="index-title">
  89. <text>指数{{ daymarket.high }}</text>
  90. <text>标记{{ daymarket.open }}</text>
  91. </view>
  92. </view>
  93. <view class="nums-list" style="padding-top: 6.5rpx;">
  94. <!-- <template v-for="(item , indx) in asks" v-if="indx < 7"> -->
  95. <template v-for="(item , indx) in asks" v-if="indx < marketNum">
  96. <market-depth :type="2" :val="item"></market-depth>
  97. </template>
  98. </view>
  99. </view>
  100. <view class="data-right">
  101. <view class="right-select">
  102. <view class="select-box position-select" @click.stop="selectList = !selectList">
  103. <text class="select-text">{{ status == 1 ? '市价委托' : '限价委托' }}</text>
  104. <text class="iconfont">&#xeb6d;</text>
  105. <view class="select-list" v-show="selectList">
  106. <text @click.stop="setType(item)"
  107. :class="['select-list-item' , status === item.value ? 'active-select-item' : '']"
  108. v-for="(item , index) in range" :key="`range_${index}`">{{ item.text }}</text>
  109. </view>
  110. </view>
  111. <view class="select-box" @click.stop="adjustLever()">
  112. <text class="select-text">{{ leverName }}{{ multiple }}x</text>
  113. <text class="iconfont">&#xeb6d;</text>
  114. </view>
  115. <!-- <uni-data-select :localdata="range" class="select-item" v-model="value"
  116. @change="change"></uni-data-select>
  117. <uni-data-select class="select-item" v-model="value" @change="change"></uni-data-select> -->
  118. </view>
  119. <view class="right-input input-item-p">
  120. <template v-if="status === 1">
  121. 市价
  122. </template>
  123. <template v-if="status === 0">
  124. <view class="target-price">
  125. <text class="target-price-tag" @click.stop="setNum(1 , target_price)">-</text>
  126. <input class="input-item" v-model="target_price" type="number">
  127. <text class="target-price-tag" @click.stop="setNum(2 , target_price)">+</text>
  128. </view>
  129. </template>
  130. <!-- target_price -->
  131. </view>
  132. <!-- 下单数量 -->
  133. <view class="right-input">
  134. <input ref="shareRef" :focus="isShareFocus" v-show="!percent" class="input-item"
  135. @focus="percent = 0" v-model="share" type="number">
  136. <text @click.stop="switchShare" v-show="percent"
  137. class="input-item input-item-text">{{ percent }}%</text>
  138. <view class="right-input-icon">
  139. <text>张</text>
  140. <text class="icon-link">|</text>
  141. <text class="switch-icon iconfont">&#xe672;</text>
  142. </view>
  143. </view>
  144. <view class="step-content">
  145. <step :percent.sync="percent" />
  146. </view>
  147. <view class="set-node">
  148. <view class="set-node-box">
  149. <view @click.stop="setNodePrice = !setNodePrice"
  150. :class="['set-node-status' , setNodePrice ? 'active-set' : '']">
  151. <text class="iconfont" v-show="setNodePrice">&#xe6c5;</text>
  152. </view>
  153. <text class="set-node-text">设置止盈止损</text>
  154. </view>
  155. <text v-show="setNodePrice" class="set-node-high" @click="$emit('setHighInfo')">高级</text>
  156. </view>
  157. <!-- 止盈 -->
  158. <view class="right-input" v-show="setNodePrice && restrictType === 1">
  159. <input placeholder-class="placeholder-class"
  160. :placeholder="`按${ restrictProfitStatus == 1 ? '价格' : '比例' }止盈`" class="input-item"
  161. v-model="restrictProfitVal" type="number">
  162. <view class="right-input-icon">
  163. <text v-show="restrictProfitStatus === 2" class="input-item input-item-text">%</text>
  164. <text v-show="restrictProfitStatus === 1">USDT</text>
  165. <text class="icon-link">|</text>
  166. <text class="switch-icon iconfont"
  167. @click.stop="restrictProfitStatus === 1 ? restrictProfitStatus = 2 : restrictProfitStatus = 1 ">&#xe672;</text>
  168. </view>
  169. </view>
  170. <view class="right-input" v-show="setNodePrice && restrictType === 2 && restrictProfitVal >= 0">
  171. <view class="right-input-icon">
  172. <text>市价止盈</text>
  173. </view>
  174. <view class="input-item input-item-val">
  175. {{ restrictProfitVal }}
  176. </view>
  177. </view>
  178. <!-- 止损 -->
  179. <view class="right-input" v-show="setNodePrice && restrictType === 1">
  180. <input :placeholder="`按${ restrictLossStatus == 1 ? '价格' : '比例' }止损`" class="input-item"
  181. v-model="restrictLossVal" type="number">
  182. <view class="right-input-icon">
  183. <text v-show="restrictLossStatus === 2" class="input-item input-item-text">%</text>
  184. <text v-show="restrictLossStatus === 1">USDT</text>
  185. <text class="icon-link">|</text>
  186. <text class="switch-icon iconfont"
  187. @click.stop="restrictLossStatus === 1 ? restrictLossStatus = 2 : restrictLossStatus = 1 ">&#xe672;</text>
  188. </view>
  189. </view>
  190. <view class="right-input" v-show="setNodePrice && restrictType === 2 && restrictLossVal >= 0">
  191. <view class="right-input-icon">
  192. <text>市价止损</text>
  193. </view>
  194. <view class="input-item input-item-val">
  195. {{ restrictLossVal }}
  196. </view>
  197. </view>
  198. <view class="info-item">
  199. <text class="info-item-lable">成本</text>
  200. <view class="info-item-val">{{ cost || '--'}}USDT</view>
  201. </view>
  202. <view class="info-item">
  203. <text class="info-item-lable">可用</text>
  204. <view class="info-item-val">
  205. <text>{{ pagesInfo.user_lever }}USDT</text>
  206. <text class="info-item-icon iconfont">&#xe672;</text>
  207. </view>
  208. </view>
  209. <view class="info-btns">
  210. <view class="info-btn-info">
  211. <text class="info-btn-lable">可做多</text>
  212. <text
  213. class="info-btn-val">{{ pagesInfo.lever_share_limit ? pagesInfo.lever_share_limit.max : '--' }}张</text>
  214. <!-- {{ pagesInfo.lever_share_limit ? pagesInfo.lever_share_limit?.max : '--' }} -->
  215. </view>
  216. <view class="info-btn" @click.stop="setSubmitLever(2)">
  217. 买入/做多
  218. </view>
  219. </view>
  220. <view class="info-btns err-btns">
  221. <view class="info-btn-info">
  222. <text class="info-btn-lable">可做空</text>
  223. <text
  224. class="info-btn-val">{{ pagesInfo.lever_share_limit ? pagesInfo.lever_share_limit.max : '--' }}张</text>
  225. </view>
  226. <view class="info-btn" @click.stop="setSubmitLever(1)">
  227. 卖出/做空
  228. </view>
  229. </view>
  230. </view>
  231. </view>
  232. <gap height="10rpx" />
  233. <view class="lable-title">
  234. <view class="lable-text">
  235. <text @click.stop="freightSpaceIndex = 1"
  236. :class="['lable-text-item' , freightSpaceIndex == 1 ? 'active-text-item' : '' ]">持仓({{ leverTrade && leverTrade.tradesList ? leverTrade.tradesList.length : 0 }})</text>
  237. <text @click.stop="freightSpaceIndex = 2"
  238. :class="['lable-text-item' , freightSpaceIndex == 2 ? 'active-text-item' : '' ]">当前委托({{ myPedingTransaction.length }})</text>
  239. </view>
  240. <view class="iconfont" style="color: #878592;" @click.stop="getHistory()">&#xe613;</view>
  241. </view>
  242. <swiper class="swiper-content" :current="freightSpaceIndex - 1"
  243. :style="{'height': scrollHeight ? `${scrollHeight}px` : '' }" disable-touch>
  244. <swiper-item class="swiper-item-box">
  245. <u-list class="swiper-list" :style="{'height': scrollHeight ? `${scrollHeight}px` : '' }">
  246. <freightSpace ref="freightSpaceRef" :myTransaction="myTransaction"
  247. @closeLeverSuccess="closeLeverSuccess" @setDepot="setDepot" :currency="currencyVal"
  248. v-bind="$attrs" v-on="$listeners" />
  249. </u-list>
  250. </swiper-item>
  251. <swiper-item>
  252. <u-list class="swiper-list" :style="{'height': scrollHeight ? `${scrollHeight}px` : '' }">
  253. <entrust :myPedingTransaction="myPedingTransaction" @closeLeverSuccess="closeLeverSuccess" />
  254. </u-list>
  255. </swiper-item>
  256. </swiper>
  257. <!-- <template v-if="freightSpaceIndex === 1">
  258. </template>
  259. <template v-if="freightSpaceIndex === 2">
  260. </template> -->
  261. <!-- 侧边抽屉 -->
  262. <drawer ref="drawerRef" />
  263. <!-- 调整杠杆 -->
  264. <lever ref="leverRef" :lever-num.sync="multiple" :leverName.sync="leverName" />
  265. <unopen ref="unopenRef" @confirm="confirm" textAlign="left" :title="title" cancelBtn
  266. :content="closeLeverContent" />
  267. <unopen ref="placeOrderRef" @confirm="confirmPlaceOrder" title="下单确认" cancelBtn content="确定要下单吗?" />
  268. </view>
  269. </template>
  270. <script>
  271. import drawer from "./../modules/drawer.vue"
  272. import lever from "./lever.vue"
  273. import freightSpace from "./freight-space.vue"
  274. import entrust from "./entrust.vue"
  275. import {
  276. Api_setSubmitLever,
  277. } from "@/api/index.js"
  278. import {
  279. mapGetters
  280. } from 'vuex'
  281. export default {
  282. components: {
  283. drawer,
  284. lever,
  285. freightSpace,
  286. entrust
  287. },
  288. props: {
  289. myTransaction: {
  290. type: Array,
  291. default: () => {
  292. return []
  293. }
  294. },
  295. pagesInfo: {
  296. type: Object,
  297. default: () => {
  298. return {}
  299. }
  300. },
  301. myPedingTransaction: {
  302. type: Array,
  303. default: () => {
  304. return []
  305. }
  306. },
  307. },
  308. data() {
  309. return {
  310. selectList: false,
  311. value: '市价委托',
  312. range: [{
  313. value: 1,
  314. text: '市价委托'
  315. },
  316. {
  317. value: 0,
  318. text: '限价委托'
  319. },
  320. // {
  321. // value: '计划委托',
  322. // text: '计划委托'
  323. // },
  324. ],
  325. leverName: '全仓',
  326. freightSpaceIndex: 1,
  327. marketNum: 7,
  328. entrustList: [],
  329. scrollHeight: '',
  330. percent: 0,
  331. // 下单参数
  332. multiple: 100, // 逐仓倍数
  333. isShareFocus: false, //是否自动获取焦点
  334. share: '', // 张数
  335. status: 1, // 状态,填1. 1市价交易,为0则是挂单交易
  336. target_price: '',
  337. // 平仓 - 反向开仓
  338. closeLeverContent: '',
  339. title: '平仓',
  340. restrict: '',
  341. setNodePrice: false,
  342. // 止盈
  343. restrictProfitVal: '',
  344. restrictProfitStatus: 1, // 按价格止盈 , 2 : 比例止盈
  345. restrictType: 1, // 1 普通输入 , 2 市价(禁止输入,只能通过高级设置)
  346. // 止损
  347. restrictLossVal: '',
  348. restrictLossStatus: 1, // 按价格止损 , 2 : 比例止损
  349. cost: '', // 成本
  350. };
  351. },
  352. watch: {
  353. setNodePrice: {
  354. handler(newStatus) {
  355. if (newStatus) {
  356. this.marketNum = 9
  357. } else {
  358. this.marketNum = 7
  359. }
  360. }
  361. },
  362. PageContentHeight: {
  363. handler(newHeigth) {
  364. this.scrollHeight = newHeigth - uni.upx2px(100) - this.tabBarHeight;
  365. },
  366. immediate: true
  367. },
  368. percent(newNums) {
  369. const maxNums = this.pagesInfo?.lever_share_limit?.max
  370. if (newNums >= 0 && maxNums) {
  371. const nums = maxNums * newNums / 100;
  372. console.log('nums = ' , nums)
  373. this.calculateCost(nums)
  374. }
  375. },
  376. share(nums) {
  377. this.calculateCost(nums)
  378. },
  379. // percent(num){
  380. // if(num){
  381. // const nums = pagesInfo.lever_share_limit.max
  382. // }
  383. // }
  384. },
  385. computed: {
  386. ...mapGetters([
  387. "stocksColor",
  388. 'bids',
  389. 'asks',
  390. 'daymarket',
  391. 'tabBarHeight',
  392. 'PageContentHeight',
  393. 'currencyVal',
  394. 'contractAccount',
  395. 'leverTrade'
  396. ])
  397. },
  398. created() {
  399. },
  400. mounted() {
  401. this.$eventBus.$on('placeOrder', (val) => {
  402. // 止盈
  403. this.restrictProfitVal = val.target_profit_price;
  404. this.restrictProfitStatus = 1
  405. // 止损
  406. this.restrictLossVal = val.stop_loss_price;
  407. // restrictLossStatus: 1, // 按价格止损 , 2 : 比例止损
  408. if (this.restrictProfitVal || this.restrictLossVal) {
  409. this.restrictType = 2 // 按价格止盈 , 2 : 比例止盈
  410. } else {
  411. this.restrictType = 1
  412. }
  413. });
  414. },
  415. methods: {
  416. // 成本计算
  417. calculateCost(nus) {
  418. // $decimalNum
  419. // // 加法
  420. // add: (a, b) => {
  421. // return new Decimal(a).add(new Decimal(b))
  422. // },
  423. // // 减法
  424. // sub: (a, b) => {
  425. // return new Decimal(a).sub(new Decimal(b))
  426. // },
  427. // // 乘法
  428. // mul: (a, b) => {
  429. // return new Decimal(a).mul(new Decimal(b))
  430. // },
  431. // // 除法
  432. // div: (a, b) => {
  433. // return new Decimal(a).div(new Decimal(b))
  434. // },
  435. try {
  436. // 成本 = 价格*张数*每张折合数量*(1+保证金百分比)/逐仓倍数
  437. const t1 = this.$decimalNum.mul(this.daymarket.now_price, nus); // 价格*张数
  438. const t2 = this.$decimalNum.mul(t1, this.pagesInfo.lever_share_num) // 价格*张数*每张折合数量
  439. const t3 = this.$decimalNum.add(1, this.pagesInfo.lever_trade_fee) // 1+保证金百分比
  440. const t4 = this.$decimalNum.mul(t2, t3) // 价格*张数*每张折合数量*(1+保证金百分比)
  441. const t5 = this.$decimalNum.div(t4, this.multiple) // 价格*张数*每张折合数量*(1+保证金百分比)/逐仓倍数
  442. // * this.pagesInfo.lever_share_num *(1+ this.pagesInfo.lever_trade_fee)/ this.multiple
  443. this.cost = t5 ? t5.toFixed(2) : '--'
  444. } catch(err) {
  445. console.log('计算错误' , err)
  446. this.cost = '--'
  447. }
  448. },
  449. getData() {
  450. this.closeLeverSuccess();
  451. },
  452. setNum(type) {
  453. if (this.status === 0) {
  454. // 只有限价才去计算
  455. if (!this.target_price) {
  456. this.target_price = 0
  457. };
  458. switch (type) {
  459. case 1:
  460. this.target_price = this.$decimalNum.sub(this.target_price, 0.01);
  461. break;
  462. case 2:
  463. this.target_price = this.$decimalNum.add(this.target_price, 0.01);
  464. break;
  465. }
  466. }
  467. },
  468. setType(item) {
  469. this.status = item.value;
  470. this.selectList = false
  471. if (this.status === 0) {
  472. this.target_price = this.daymarket.now_price;
  473. } else {
  474. this.target_price = ''
  475. }
  476. },
  477. // 平仓成功
  478. closeLeverSuccess() {
  479. this.$emit('refreshData')
  480. // this.getLeverDeal()
  481. },
  482. openDrawer() {
  483. this.$refs.drawerRef.open();
  484. },
  485. change(e) {
  486. console.log("e:", e);
  487. },
  488. adjustLever() {
  489. this.$nextTick(() => {
  490. this.$refs.leverRef.open()
  491. })
  492. },
  493. // 下单确认
  494. setSubmitLever(type) {
  495. this.$nextTick(() => {
  496. this.$refs.placeOrderRef.open(type)
  497. })
  498. },
  499. // 确认下单
  500. confirmPlaceOrder(type) {
  501. const setData = {
  502. status: this.status,
  503. legal_id: this.currencyVal.legal_id,
  504. currency_id: this.currencyVal.currency_id,
  505. multiple: this.multiple,
  506. share: this.percent ? `${this.percent}%` : this.share,
  507. type: type
  508. }
  509. if (this.setNodePrice) {
  510. // restrictProfitVal: '',
  511. // restrictProfitStatus: 1, // 按价格止盈 , 2 : 比例止盈
  512. // restrictType: 1, // 1 普通输入 , 2 市价(禁止输入,只能通过高级设置)
  513. // // 止损
  514. // restrictLossVal: '',
  515. // restrictLossStatus: 1, // 按价格止损 , 2 : 比例止损
  516. setData.target_profit_price = this.restrictProfitStatus === 1 ? this.restrictProfitVal :
  517. `${this.restrictProfitVal}%` // 【5-18】止盈,选填
  518. setData.stop_loss_price = this.restrictLossStatus === 1 ? this.restrictLossVal :
  519. `${this.restrictLossVal}%` // 5-18】止损,选填
  520. };
  521. if (this.status === 0) {
  522. setData.target_price = this.target_price
  523. }
  524. uni.showLoading({
  525. title: '',
  526. mask: true
  527. })
  528. Api_setSubmitLever(setData).then(res => {
  529. // this.getLeverDeal()
  530. uni.showToast({
  531. icon: 'none',
  532. title: '下单成功'
  533. })
  534. setTimeout(() => {
  535. uni.hideToast()
  536. this.$emit('refreshData')
  537. }, 500)
  538. }).finally(() => {
  539. uni.hideLoading()
  540. })
  541. },
  542. // 查看合约历史
  543. getHistory() {
  544. uni.navigateTo({
  545. url: `/pages/contract/history/index?legal_id=${this.currencyVal.legal_id}&currency_id=${this.currencyVal.currency_id}`
  546. })
  547. },
  548. // 平仓 - 反向开仓
  549. setDepot(obj) {
  550. this.closeLeverContent = obj.closeLeverContent;
  551. this.title = obj.title;
  552. this.$nextTick(() => {
  553. this.$refs.unopenRef.open()
  554. })
  555. },
  556. confirm() {
  557. this.$nextTick(() => {
  558. this.$refs.freightSpaceRef.confirm();
  559. })
  560. },
  561. lookDetails() {
  562. if (this.currencyVal && this.currencyVal.currency_id && this.currencyVal.legal_id) {
  563. uni.navigateTo({
  564. url: '/pages/contract/sustainability/details'
  565. })
  566. }
  567. },
  568. // 合约设置
  569. setContract() {
  570. this.$emit('setContract')
  571. },
  572. // 切换张数
  573. switchShare() {
  574. this.percent = 0
  575. this.isShareFocus = false;
  576. this.$nextTick(() => {
  577. this.isShareFocus = true;
  578. });
  579. }
  580. },
  581. }
  582. </script>
  583. <style lang="scss" scoped>
  584. .contract-box {
  585. .contract-title {
  586. padding: 5rpx $pages-padding 0;
  587. min-height: 78rpx;
  588. display: flex;
  589. align-items: center;
  590. justify-content: space-between;
  591. .contract-item {
  592. display: flex;
  593. align-items: center;
  594. flex-shrink: 0;
  595. .title-iocn {
  596. width: 28rpx;
  597. height: 24rpx;
  598. display: flex;
  599. flex-direction: column;
  600. // align-items: center;
  601. justify-content: space-between;
  602. .title-iocn-item {
  603. width: 100%;
  604. height: 4rpx;
  605. border-radius: 2rpx;
  606. background: #111111;
  607. &:first-child {
  608. width: 50%;
  609. }
  610. }
  611. }
  612. .title-text {
  613. font-size: 37rpx;
  614. font-family: PingFang SC, PingFang SC-Bold;
  615. font-weight: 700;
  616. text-align: left;
  617. color: #141213;
  618. line-height: 1.2;
  619. letter-spacing: 0.74rpx;
  620. padding-left: 19rpx;
  621. }
  622. .title-ratio {
  623. font-size: 24rpx;
  624. font-family: PingFang SC, PingFang SC-Regular;
  625. font-weight: 400;
  626. color: #808080;
  627. line-height: 33rpx;
  628. }
  629. .ratio-icon {
  630. width: 31rpx;
  631. height: 33rpx;
  632. margin-left: 22rpx;
  633. }
  634. }
  635. }
  636. .account-box {
  637. width: 100%;
  638. padding: 21rpx $pages-padding;
  639. display: flex;
  640. flex-wrap: wrap;
  641. background-color: #F6F6F6;
  642. .account-item {
  643. display: flex;
  644. flex-direction: column;
  645. flex-shrink: 0;
  646. &:nth-child(3n) {
  647. width: 40%;
  648. text-align: right;
  649. }
  650. &:nth-child(3n - 1) {
  651. width: 30%;
  652. text-align: right;
  653. }
  654. &:nth-child(3n - 2) {
  655. width: 30%;
  656. }
  657. &:nth-child(n + 4) {
  658. margin-top: 20rpx;
  659. }
  660. .account-title {
  661. font-size: 20rpx;
  662. font-family: PingFang SC, PingFang SC-Bold;
  663. font-weight: 600;
  664. color: #807e89;
  665. line-height: 30rpx;
  666. height: 30rpx;
  667. .text {
  668. border-bottom: 2rpx dashed #707070;
  669. }
  670. }
  671. .account-num {
  672. font-size: 22rpx;
  673. font-family: PingFang SC, PingFang SC-Bold;
  674. font-weight: 700;
  675. color: #1a1a1a;
  676. height: 33rpx;
  677. line-height: 33rpx;
  678. margin-top: 11rpx;
  679. }
  680. }
  681. }
  682. }
  683. .data-box {
  684. width: 100%;
  685. padding: 25rpx $pages-padding 20rpx;
  686. display: flex;
  687. justify-content: space-between;
  688. align-items: stretch;
  689. .data-left {
  690. width: 303rpx;
  691. .nums-title {
  692. width: 100%;
  693. height: 67rpx;
  694. .flex {
  695. display: flex;
  696. justify-content: space-between;
  697. align-items: center;
  698. line-height: 33rpx;
  699. font-size: 24rpx;
  700. font-family: PingFang SC, PingFang SC-Bold;
  701. font-weight: 700;
  702. color: #807e89;
  703. }
  704. }
  705. // .<view class="nums-title">
  706. // <view class="left-title flex">
  707. // <text>价格</text>
  708. // <text>数量</text>
  709. // </view>
  710. // <view class="subhead-title flex">
  711. // <text>(USDT)</text>
  712. // <text>(张)</text>
  713. // </view>
  714. // </view>
  715. // .left-title {
  716. // font-size: 24rpx;
  717. // font-family: PingFang SC, PingFang SC-Bold;
  718. // font-weight: 700;
  719. // color: #807e89;
  720. // line-height: 33rpx;
  721. // }
  722. // .subhead-title {
  723. // font-size: 24rpx;
  724. // font-family: PingFang SC, PingFang SC-Bold;
  725. // font-weight: 700;
  726. // color: #807e89;
  727. // line-height: 33rpx;
  728. // }
  729. .nums-list {
  730. width: 100%;
  731. padding: 10rpx 0 4rpx;
  732. min-height: 318rpx;
  733. .nums-item {
  734. width: 100%;
  735. position: relative;
  736. height: 40rpx;
  737. margin-bottom: 4rpx;
  738. .nums-item-bg {
  739. position: absolute;
  740. top: 0;
  741. right: 0;
  742. z-index: 1;
  743. height: 100%;
  744. }
  745. .item-num {
  746. width: 100%;
  747. height: 100%;
  748. position: absolute;
  749. top: 0;
  750. right: 0;
  751. z-index: 2;
  752. display: flex;
  753. justify-content: space-between;
  754. align-items: center;
  755. font-size: 22rpx;
  756. font-family: PingFang SC, PingFang SC-Bold;
  757. font-weight: 700;
  758. line-height: 33rpx;
  759. color: #1a1a1a;
  760. text+text {
  761. font-weight: 700;
  762. line-height: 33rpx;
  763. }
  764. }
  765. }
  766. }
  767. // <view class="nums-list">
  768. // <view class="nums-item">
  769. // <text class="nums-item-bg"></text>
  770. // <text class="item-num">28516.8</text>
  771. // <text class="item-num">28516.8</text>
  772. // </view>
  773. // </view>
  774. }
  775. .data-right {
  776. width: 365rpx;
  777. // background-color: green;
  778. .right-select {
  779. width: 100%;
  780. display: flex;
  781. justify-content: space-between;
  782. align-items: center;
  783. .select-box {
  784. width: 175rpx;
  785. height: 50rpx;
  786. display: flex;
  787. justify-content: space-between;
  788. align-items: center;
  789. background-color: #f1f1f1;
  790. padding: 0 3px;
  791. border-radius: 8rpx;
  792. .select-text {
  793. font-size: 26rpx;
  794. font-weight: 700;
  795. }
  796. .iconfont {
  797. font-size: 20rpx;
  798. color: $Theme-Color;
  799. }
  800. }
  801. .position-select {
  802. position: relative;
  803. .select-list {
  804. position: absolute;
  805. left: 0;
  806. top: 50rpx;
  807. width: 185rpx;
  808. display: flex;
  809. flex-direction: column;
  810. background-color: #fff;
  811. z-index: 1;
  812. .select-list-item {
  813. width: 100%;
  814. height: 70rpx;
  815. line-height: 70rpx;
  816. padding: 0 30rpx;
  817. font-size: 22rpx;
  818. font-weight: bold;
  819. color: #c1c1c1;
  820. }
  821. .active-select-item {
  822. background-color: #f1f1f1;
  823. color: #000;
  824. }
  825. }
  826. }
  827. // <view class="select-box">
  828. // <text class="select-text">限价委托</text>
  829. // <text class="iconfont">&#xe601;</text>
  830. // </view>
  831. // <view class="select-box">
  832. // <text class="select-text">限价委托</text>
  833. // <text class="iconfont">&#xe601;</text>
  834. // </view>
  835. // .select-item {
  836. // width: 175rpx !important;
  837. // height: 50rpx;
  838. // flex: 0;
  839. // ::v-deep .uni-stat-box {
  840. // width: 175rpx !important;
  841. // height: 48rpx;
  842. // .uni-select {
  843. // width: 175rpx !important;
  844. // height: 48rpx;
  845. // .uni-select__input-box {
  846. // width: 100%;
  847. // height: 48rpx !important;
  848. // }
  849. // .uniui-clear{
  850. // display: none;
  851. // }
  852. // }
  853. // }
  854. // }
  855. }
  856. .right-input {
  857. width: 100%;
  858. height: 76rpx;
  859. background: #efefef;
  860. border-radius: 10rpx;
  861. margin-top: 30rpx;
  862. display: flex;
  863. justify-content: space-between;
  864. align-items: center;
  865. padding: 0 20rpx;
  866. font-size: 24rpx;
  867. font-family: PingFang SC, PingFang SC-Bold;
  868. font-weight: 700;
  869. color: #808080;
  870. line-height: 40rpx;
  871. .input-item {
  872. height: 100%;
  873. font-size: 24rpx;
  874. flex: 1;
  875. color: #000;
  876. }
  877. .input-item-val {
  878. display: flex;
  879. justify-content: flex-end;
  880. align-items: center;
  881. }
  882. .placeholder-class {
  883. font-size: 24rpx;
  884. }
  885. .input-item-text {
  886. display: flex;
  887. align-items: center;
  888. }
  889. .input-item-p {
  890. font-size: 24rpx;
  891. font-family: PingFang SC, PingFang SC-Bold;
  892. font-weight: 700;
  893. color: #808080;
  894. line-height: 40rpx;
  895. opacity: 0.3;
  896. }
  897. .right-input-icon {
  898. flex-shrink: 0;
  899. font-size: 24rpx;
  900. font-family: PingFang SC, PingFang SC-Bold;
  901. // font-weight: 700;
  902. color: #808080;
  903. line-height: 40rpx;
  904. display: flex;
  905. align-items: center;
  906. text {
  907. &:first-child {
  908. font-size: 24rpx;
  909. }
  910. }
  911. .icon-link {
  912. font-size: 20rpx;
  913. margin: 0 15rpx;
  914. color: $Theme-Color;
  915. }
  916. .icon {
  917. width: 30rpx;
  918. height: 26rpx;
  919. font-size: 18rpx;
  920. }
  921. }
  922. // <view class="target-price">
  923. // <text class="target-price-tag">-</text>
  924. // <input class="input-item" v-model="target_price" type="number">
  925. // <text class="target-price-tag">+</text>
  926. // </view>
  927. .target-price {
  928. width: 100%;
  929. height: 100%;
  930. display: flex;
  931. justify-content: space-between;
  932. align-items: stretch;
  933. .target-price-tag {
  934. flex-shrink: 0;
  935. width: 50rpx;
  936. height: 100%;
  937. text-align: center;
  938. font-size: 26rpx;
  939. color: $Theme-Color;
  940. display: flex;
  941. align-items: center;
  942. &:last-child {
  943. justify-content: flex-end;
  944. }
  945. }
  946. .input-item {
  947. flex: 1;
  948. height: 100%;
  949. font-size: 24rpx;
  950. text-align: center;
  951. // .nums-inp {
  952. // width: 100%;
  953. // height: 100%;
  954. // text-align: center;
  955. // font-size: 28rpx;
  956. // font-weight: bold;
  957. // }
  958. // .nums-t {
  959. // position: absolute;
  960. // left: 0;
  961. // top: 0;
  962. // width: 100%;
  963. // height: 100%;
  964. // }
  965. // <input class="nums-inp" type="text" v-model="leverNum">
  966. // <text class="nums-inp-tag">X</text>
  967. }
  968. }
  969. }
  970. .step-content {
  971. padding: 24rpx 0 35rpx;
  972. }
  973. .set-node {
  974. width: 100%;
  975. display: flex;
  976. align-items: center;
  977. justify-content: space-between;
  978. .set-node-box {
  979. display: flex;
  980. align-items: center;
  981. }
  982. .set-node-high {
  983. font-size: 24rpx;
  984. font-family: PingFang SC, PingFang SC-Regular;
  985. font-weight: 400;
  986. color: $Theme-Color;
  987. line-height: 1.1;
  988. }
  989. .set-node-status {
  990. width: 27rpx;
  991. height: 27rpx;
  992. background: #e6e6e8;
  993. border-radius: 2rpx;
  994. }
  995. .active-set {
  996. background-color: $Theme-Color;
  997. display: flex;
  998. justify-content: center;
  999. align-items: center;
  1000. .iconfont {
  1001. font-size: 26rpx;
  1002. color: #fff;
  1003. }
  1004. }
  1005. .set-node-text {
  1006. font-size: 24rpx;
  1007. font-family: PingFang SC, PingFang SC-Regular;
  1008. font-weight: 400;
  1009. color: #808080;
  1010. line-height: 1.1;
  1011. margin-left: 14rpx;
  1012. border-bottom: 2rpx dashed #707070;
  1013. }
  1014. }
  1015. .info-item {
  1016. width: 100%;
  1017. display: flex;
  1018. justify-content: space-between;
  1019. align-items: center;
  1020. font-size: 26rpx;
  1021. padding: 32rpx 0 0;
  1022. line-height: 1.1;
  1023. .info-item-lable {
  1024. color: $SizeColor3;
  1025. border-bottom: 1rpx dashed #707070;
  1026. }
  1027. .info-item-val {
  1028. font-size: 22rpx;
  1029. font-weight: bold;
  1030. display: flex;
  1031. align-items: center;
  1032. .info-item-icon {
  1033. font-size: 20rpx;
  1034. margin-left: 20rpx;
  1035. width: 30rpx;
  1036. height: 30rpx;
  1037. background-color: $Theme-Color;
  1038. color: #fff;
  1039. text-align: center;
  1040. line-height: 30rpx;
  1041. border-radius: 6rpx;
  1042. }
  1043. }
  1044. }
  1045. .info-btns {
  1046. width: 100%;
  1047. padding-top: 16rpx;
  1048. .info-btn-info {
  1049. display: flex;
  1050. justify-content: space-between;
  1051. font-size: 24rpx;
  1052. padding-bottom: 10rpx;
  1053. .info-btn-lable {
  1054. color: $SizeColor3;
  1055. }
  1056. .info-btn-val {
  1057. font-weight: bold;
  1058. }
  1059. // <view class="info-btn-info">
  1060. // <text class="info-btn-lable">可做多</text>
  1061. // <text class="info-btn-val">33719张</text>
  1062. // </view>
  1063. }
  1064. .info-btn {
  1065. width: 100%;
  1066. height: 80rpx;
  1067. background-color: $Theme-Color;
  1068. text-align: center;
  1069. line-height: 80rpx;
  1070. font-size: 30rpx;
  1071. color: #fff;
  1072. border-radius: 10rpx;
  1073. font-weight: bold;
  1074. }
  1075. }
  1076. .err-btns {
  1077. .info-btn {
  1078. background-color: $Theme-Color3;
  1079. }
  1080. }
  1081. }
  1082. }
  1083. .switch-icon {
  1084. color: $Theme-Color;
  1085. font-size: 26rpx;
  1086. }
  1087. .lable-title {
  1088. width: 100%;
  1089. height: 100rpx;
  1090. border-bottom: 1rpx solid $border-color;
  1091. padding: 0 $pages-padding;
  1092. display: flex;
  1093. justify-content: space-between;
  1094. align-items: center;
  1095. .lable-text {
  1096. height: 100%;
  1097. display: flex;
  1098. align-items: stretch;
  1099. .lable-text-item {
  1100. height: 100%;
  1101. display: flex;
  1102. align-items: center;
  1103. font-size: 28rpx;
  1104. &:first-child {
  1105. margin-right: 40rpx;
  1106. }
  1107. }
  1108. .active-text-item {
  1109. font-size: 34rpx;
  1110. font-weight: bold;
  1111. color: $Theme-Color;
  1112. position: relative;
  1113. &::before {
  1114. content: '';
  1115. position: absolute;
  1116. left: 50%;
  1117. bottom: 0;
  1118. width: 40rpx;
  1119. height: 8rpx;
  1120. background-color: $Theme-Color;
  1121. transform: translateX(-50%);
  1122. border-radius: 4rpx;
  1123. }
  1124. }
  1125. }
  1126. }
  1127. .index-num-box {
  1128. height: 115rpx;
  1129. width: 100%;
  1130. border: 1rpx solid $border-color;
  1131. border-left: none;
  1132. border-right: none;
  1133. display: flex;
  1134. flex-direction: column;
  1135. justify-content: center;
  1136. .index-num-title {
  1137. height: 50rpx;
  1138. line-height: 50rpx;
  1139. display: flex;
  1140. justify-content: space-between;
  1141. font-family: PingFang SC, PingFang SC-Bold;
  1142. font-weight: 700;
  1143. color: #20b482;
  1144. text {
  1145. &:first-child {
  1146. font-size: 36rpx;
  1147. }
  1148. &:last-child {
  1149. font-size: 28rpx;
  1150. }
  1151. }
  1152. }
  1153. .index-title {
  1154. height: 28rpx;
  1155. display: flex;
  1156. justify-content: space-between;
  1157. font-family: PingFang SC, PingFang SC-Bold;
  1158. font-weight: 700;
  1159. text {
  1160. font-size: 20rpx;
  1161. line-height: 28rpx;
  1162. color: #808080;
  1163. border-bottom: 1px dashed #808080;
  1164. }
  1165. }
  1166. // .index-num-title {
  1167. // font-size: 36rpx;
  1168. // font-family: PingFang SC, PingFang SC-Bold;
  1169. // font-weight: 700;
  1170. // color: #20b482;
  1171. // line-height: 50rpx;
  1172. // text+text {
  1173. // font-size: 28rpx;
  1174. // font-family: PingFang SC, PingFang SC-Bold;
  1175. // font-weight: 700;
  1176. // color: #20b482;
  1177. // line-height: 40rpx;
  1178. // }
  1179. // }
  1180. // .index-title {
  1181. // font-size: 20rpx;
  1182. // color: #808080;
  1183. // line-height: 1.2;
  1184. // text {
  1185. // border-bottom: 2rpx dashed #707070;
  1186. // display: flex;
  1187. // align-items: center;
  1188. // }
  1189. // padding-bottom: 18rpx;
  1190. // border-bottom: 1px solid #f2f2f2;
  1191. // // &:first-child{
  1192. // // text-align: right;
  1193. // // }
  1194. // }
  1195. }
  1196. </style>