restrict.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <uni-popup ref="popupRef" type="bottom">
  3. <view class="popups-box">
  4. <view class="popups-title">
  5. 持仓止盈止损修改
  6. <text class="close-icon iconfont" @click.stop="close()">&#xeca0;</text>
  7. </view>
  8. <view class="popups-content">
  9. <view class="content-item">
  10. <text class="content-lable">合约名称</text>
  11. <view class="content-val">
  12. <text class="val-name">{{ content.symbol }}</text>
  13. <text class="val-lever">{{ content.multiple }}倍杠杆</text>
  14. <text class="val-tag">{{ content.type_name }}</text>
  15. </view>
  16. </view>
  17. <view class="content-item">
  18. <text class="content-lable">开仓价格(USDT)</text>
  19. <view class="content-val">
  20. {{ content.price }}
  21. </view>
  22. </view>
  23. <view class="content-item">
  24. <text class="content-lable">标记价格(USDT)</text>
  25. <view class="content-val">
  26. {{ content.origin_price }}
  27. </view>
  28. </view>
  29. <view class="content-restrict">
  30. <view class="restrict-item">
  31. <text class="restrict-lable">止盈</text>
  32. <view class="restrict-btn">
  33. <text class="iconfont">&#xe672;</text>
  34. <text>按比例设置</text>
  35. </view>
  36. </view>
  37. <view class="restrict-input-box">
  38. <input class="restrict-input" v-model="target_profit_price" type="number"
  39. placeholder-class="placeholder-class" placeholder="请输入触发价">
  40. <text class="restrict-tag">USDT</text>
  41. <text class="restrict-btn" @click.stop="target_profit_price = ''">清空</text>
  42. </view>
  43. <view class="restrict-input-box input-type">
  44. <text class="restrict-input">市价</text>
  45. <text class="restrict-tag">USDT</text>
  46. <text class="restrict-btn">市价</text>
  47. </view>
  48. <view class="restrict-hint">
  49. <text class="iconfont">&#xe8ec;</text>
  50. <text>市价单的成交价格可能偏离用户下单时看到的成交价格</text>
  51. </view>
  52. <view class="restrict-hint2">
  53. <text>当标价价格触达{{ target_profit_price || '--'}}时,将会触发市价委托平仓</text>
  54. <text>预计盈亏--</text>
  55. </view>
  56. <view class="restrict-item">
  57. <text class="restrict-lable">止损</text>
  58. <view class="restrict-btn">
  59. <text class="iconfont">&#xe672;</text>
  60. <text>按比例设置</text>
  61. </view>
  62. </view>
  63. <view class="restrict-input-box">
  64. <input class="restrict-input" v-model="stop_loss_price" type="number"
  65. placeholder-class="placeholder-class" placeholder="请输入触发价">
  66. <text class="restrict-tag">USDT</text>
  67. <text class="restrict-btn" @click.stop="stop_loss_price = ''">清空</text>
  68. </view>
  69. <view class="restrict-input-box input-type">
  70. <text class="restrict-input">市价</text>
  71. <text class="restrict-tag">USDT</text>
  72. <text class="restrict-btn">市价</text>
  73. </view>
  74. <view class="restrict-hint">
  75. <text class="iconfont">&#xe8ec;</text>
  76. <text>市价单的成交价格可能偏离用户下单时看到的成交价格</text>
  77. </view>
  78. <view class="restrict-hint2">
  79. <text>当标价价格触达{{ stop_loss_price || '--'}}时,将会触发市价委托平仓</text>
  80. <text>预计盈亏--</text>
  81. </view>
  82. <view class="content-btns">
  83. <view class="content-btn cancel-btn" @click.stop="close()">
  84. 取消
  85. </view>
  86. <view class="content-btn" @click.stop="setLeverStop()">
  87. 确定
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. </uni-popup>
  94. </template>
  95. <script>
  96. import { Api_setLeverStop } from "@/api/index.js"
  97. export default {
  98. data() {
  99. return {
  100. content: {},
  101. target_profit_price: '',
  102. stop_loss_price: ''
  103. };
  104. },
  105. mounted() {
  106. // this.open()
  107. },
  108. methods: {
  109. open(item) {
  110. this.content = item
  111. this.$nextTick(() => {
  112. this.$refs.popupRef.open();
  113. })
  114. },
  115. close() {
  116. this.$refs.popupRef.close()
  117. },
  118. // confirm() {
  119. // this.close();
  120. // this.$emit('confirm')
  121. // },
  122. //
  123. setLeverStop(){
  124. Api_setLeverStop({
  125. id:this.content.id,
  126. target_profit_price: this.target_profit_price,
  127. stop_loss_price: this.stop_loss_price
  128. }).then(res => {
  129. this.close();
  130. this.$emit('setSuccess')
  131. })
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .popups-box {
  138. width: 100%;
  139. .popups-title {
  140. text-align: center;
  141. width: 100%;
  142. height: 100rpx;
  143. line-height: 100rpx;
  144. background-color: $box-bg;
  145. position: relative;
  146. font-size: 30rpx;
  147. font-weight: bold;
  148. border-radius: 40rpx 40rpx 0 0;
  149. .close-icon {
  150. position: absolute;
  151. right: 30rpx;
  152. top: 50%;
  153. transform: translateY(-50%);
  154. }
  155. }
  156. }
  157. .popups-content {
  158. width: 100%;
  159. background-color: #fff;
  160. .content-item {
  161. width: 100%;
  162. display: flex;
  163. justify-content: space-between;
  164. align-items: center;
  165. padding: 20rpx $pages-padding;
  166. font-size: 22rpx;
  167. .content-lable {
  168. color: $SizeColor;
  169. }
  170. .content-val {
  171. color: #000;
  172. font-weight: bold;
  173. // <text class="val-name">LTC/USDT</text>
  174. // <text class="val-lever">100倍杠杆</text>
  175. // <text class="val-tag">逐仓做多</text>
  176. .val-name {}
  177. .val-tag,
  178. .val-lever {
  179. padding: 5rpx 4rpx;
  180. color: #fff;
  181. font-size: 20rpx;
  182. border-radius: 4rpx;
  183. margin-left: 6rpx;
  184. }
  185. .val-lever {
  186. background-color: $Theme-Color;
  187. }
  188. .val-tag {
  189. background-color: $Theme-Color1;
  190. }
  191. }
  192. &:last-child {
  193. border-bottom: 10rpx solid $border-color;
  194. }
  195. }
  196. .content-restrict {
  197. width: 100%;
  198. padding: 0 $pages-padding;
  199. .restrict-item {
  200. width: 100%;
  201. padding-top: 30rpx;
  202. display: flex;
  203. justify-content: space-between;
  204. align-items: center;
  205. font-size: 26rpx;
  206. font-weight: bold;
  207. .restrict-btn {
  208. .iconfont {
  209. font-size: 28rpx;
  210. color: $Theme-Color;
  211. margin-right: 10rpx;
  212. }
  213. }
  214. }
  215. .restrict-input-box {
  216. margin-top: 20rpx;
  217. width: 100%;
  218. display: flex;
  219. align-items: center;
  220. font-size: 26rpx;
  221. height: 80rpx;
  222. border: 1rpx solid $border-color;
  223. border-radius: 10rpx;
  224. padding-right: 20rpx;
  225. text {
  226. flex-shrink: 0;
  227. }
  228. .restrict-input {
  229. flex: 1;
  230. height: 100%;
  231. border: none;
  232. padding: 0 20rpx;
  233. }
  234. .placeholder-class {
  235. font-size: 26rpx;
  236. font-weight: bold;
  237. }
  238. .restrict-tag {
  239. color: $SizeColor2;
  240. }
  241. .restrict-btn {
  242. color: $Theme-Color;
  243. padding-left: 20rpx;
  244. }
  245. }
  246. .input-type {
  247. background-color: $box-bg;
  248. .restrict-input {
  249. flex: 1;
  250. height: auto;
  251. padding: 0 20rpx;
  252. color: #000;
  253. font-weight: bold;
  254. }
  255. .restrict-btn {
  256. line-height: 1;
  257. border-left: 1px solid $Theme-Color;
  258. margin-left: 10rpx;
  259. padding-left: 10rpx;
  260. }
  261. }
  262. // <view class="restrict-hint">
  263. // <text class="iconfont">&#xe8ec;</text>
  264. // <text>市价单的成交价格可能偏离用户下单时看到的成交价格</text>
  265. // </view>
  266. // <view class="restrict-hint2">
  267. // <text>当标价价格触达{{ target_profit_price || '--'}}时,将会触发市价委托平仓</text>
  268. // <text>预计盈亏--</text>
  269. // </view>
  270. .restrict-hint {
  271. width: 100%;
  272. display: flex;
  273. align-items: center;
  274. padding-top: 10rpx;
  275. text {
  276. font-size: 22rpx;
  277. }
  278. .iconfont {
  279. font-size: 26rpx;
  280. margin-right: 6rpx;
  281. color: #000;
  282. }
  283. }
  284. .restrict-hint2 {
  285. width: 100%;
  286. display: flex;
  287. align-items: center;
  288. justify-content: space-between;
  289. font-size: 20rpx;
  290. color: $SizeColor;
  291. padding-top: 10rpx;
  292. }
  293. }
  294. }
  295. .content-btns {
  296. width: 100%;
  297. display: flex;
  298. justify-content: space-between;
  299. align-items: stretch;
  300. padding-top: 60rpx;
  301. .content-btn {
  302. flex: 1;
  303. height: 80rpx;
  304. line-height: 80rpx;
  305. background-color: $Theme-Color;
  306. margin-bottom: 40rpx;
  307. color: #fff;
  308. text-align: center;
  309. font-size: 30rpx;
  310. letter-spacing: 1px;
  311. border-radius: 6rpx;
  312. }
  313. .cancel-btn {
  314. margin-right: 20rpx;
  315. border: 1rpx solid $Theme-Color;
  316. background-color: #fff;
  317. color: $Theme-Color;
  318. }
  319. }
  320. </style>