| | |
| | | |
| | | <van-popover v-model="showPopover" trigger="click" placement="top" :actions="actions" @select="onSelect"> |
| | | <template #reference> |
| | | <van-button type="primary"> {{ $t("一键平仓") }}</van-button> |
| | | <van-button type="primary"> {{ $t("平仓") }}</van-button> |
| | | </template> |
| | | </van-popover> |
| | | </div> |
| | |
| | | return { |
| | | pages: {}, |
| | | ordernum: "", |
| | | actions: [{ text: this.$t('确定'), key: '1' }, { text: this.$t('取消'), key: '2' }], |
| | | showPopover: false, |
| | | // 通过 actions 属性来定义菜单选项 |
| | | actions: [{ text: '确定', key: '1' }, { text: '取消', key: '2' }], |
| | | }; |
| | | }, |
| | | // 生命周期 - 创建完成(访问当前this实例) |
| | |
| | | Notify({ type: "danger", message: res.msg }); |
| | | } |
| | | }, |
| | | // 一键平仓确认弹框 |
| | | // 直接全部确认弹框 |
| | | onSelect(action) { |
| | | console.log(action.key); |
| | | if (action.key == 1) this.oneClose(); |
| | | }, |
| | | // 一键平仓 |
| | | // 直接全部平仓 |
| | | async oneClose() { |
| | | const res = await api.sell({ |
| | | positionSn: this.pages.positionSn, |
| | | number: this.pages.orderNum |
| | | }); |
| | | if (res.status === 0) { |
| | | this.finished = false; |
| | | Notify({ type: "success", message: res.msg }); |
| | | this.$router.go(-1); |
| | | } else { |
| | | Notify({ type: "danger", message: res.msg }); |
| | | } |