new
zzzz
2024-04-07 a9546154c39b7850746317af561573ed8ee503d1
src/page/user/Warehouse/data.list.vue
@@ -34,7 +34,9 @@
        <van-row>
          <van-col span="8">
            <div style="text-align: left">
              <div class="sport-content-title2">{{ $t("盈虧") }} (USD)</div>
              <div class="sport-content-title2">
                {{ $t("盈虧") }} ({{ item.stockGid }})
              </div>
              <div class="sport-content-text" style="color: #d04b64">
                {{ item.profitAndLose }}
              </div>
@@ -42,7 +44,9 @@
          </van-col>
          <van-col span="8">
            <div style="text-align: center">
              <div class="sport-content-title2">{{ $t("hj141") }} (USD)</div>
              <div class="sport-content-title2">
                {{ $t("hj141") }} ({{ item.stockGid }})
              </div>
              <div class="sport-content-text2">
                {{ item.profitAndLoseParent }}
              </div>
@@ -58,19 +62,25 @@
        <van-row>
          <van-col span="8">
            <div style="text-align: left">
              <div class="sport-content-title2">{{ $t("hj40") }}(USD)</div>
              <div class="sport-content-title2">
                {{ $t("hj40") }}({{ item.stockGid }})
              </div>
              <div class="sport-content-text2">{{ item.now_price }}</div>
            </div>
          </van-col>
          <van-col span="8">
            <div style="text-align: center">
              <div class="sport-content-title2">{{ $t("持倉價") }} (USD)</div>
              <div class="sport-content-title2">
                {{ $t("持倉價") }} ({{ item.stockGid }})
              </div>
              <div class="sport-content-text2">{{ item.buyOrderPrice }}</div>
            </div>
          </van-col>
          <van-col span="8">
            <div style="text-align: right">
              <div class="sport-content-title2">{{ $t("訂單金額") }} (USD)</div>
              <div class="sport-content-title2">
                {{ $t("訂單金額") }} ({{ item.stockGid }})
              </div>
              <div class="sport-content-text2">{{ item.orderTotalPrice }}</div>
            </div>
          </van-col>
@@ -79,14 +89,16 @@
          <van-col span="8">
            <div style="text-align: left">
              <div class="sport-content-title2">
                {{ $t("開倉手續費") }} (USD)
                {{ $t("開倉手續費") }} ({{ item.stockGid }})
              </div>
              <div class="sport-content-text2">{{ item.orderFee }}</div>
            </div>
          </van-col>
          <van-col span="8">
            <div style="text-align: center">
              <div class="sport-content-title2">{{ $t("止損價") }} (USD)</div>
              <div class="sport-content-title2">
                {{ $t("止損價") }} ({{ item.stockGid }})
              </div>
              <div class="sport-content-text2">
                -{{ item.profitTargetPrice || "--" }}
              </div>
@@ -94,7 +106,9 @@
          </van-col>
          <van-col span="8">
            <div style="text-align: right">
              <div class="sport-content-title2">{{ $t("止盈價") }} (USD)</div>
              <div class="sport-content-title2">
                {{ $t("止盈價") }} ({{ item.stockGid }})
              </div>
              <div class="sport-content-text2">
                -{{ item.stopTargetPrice || "--" }}
              </div>
@@ -155,21 +169,21 @@
</template>
<script>
import Dialog from "@/components/Dialog";
import { getchicang, sell } from "../../../axios/api";
import { Notify } from "vant";
import Dialog from '@/components/Dialog'
import { getchicang, sell } from '../../../axios/api'
import { Notify } from 'vant'
export default {
  components: { Dialog },
  props: {
    activeObj: {
      type: Object,
      default: {},
    },
      default: {}
    }
  },
  data() {
  data () {
    return {
      pageNum: 1,
      pageSize: 15,
      pageSize: 150,
      loading: true,
      finished: false,
      closeSell: {},
@@ -178,78 +192,76 @@
      dataList: [],
      tabsList: [
        {
          title: this.$t("持倉"),
          key: 0,
          title: this.$t('持倉'),
          key: 0
        },
        {
          title: this.$t("平倉"),
          key: 1,
        },
      ],
    };
          title: this.$t('平倉'),
          key: 1
        }
      ]
    }
  },
  methods: {
    onLoad() {
      this.pageNum++;
      this.loading = true;
      this.getList();
    onLoad () {
      this.pageNum++
      this.loading = true
    },
    async confirm() {
    async confirm () {
      const res = await sell({
        positionSn: this.closeSell.positionSn,
      });
        positionSn: this.closeSell.positionSn
      })
      if (res.status === 0) {
        this.$refs.closeDialog.show = false;
        this.dataList = [];
        this.pageNum = 1;
        this.finished = false;
        this.getList();
        this.$refs.closeDialog.show = false
        this.dataList = []
        this.pageNum = 1
        this.finished = false
        this.getList()
        this.$emit('closingPosition')
      } else {
        Notify({ type: "danger", message: res.msg });
        Notify({ type: 'danger', message: res.msg })
      }
    },
    async getList(laber) {
      console.log(laber);
    // 获取仓位列表
    async getList (laber) {
      if (laber) {
        this.dataList = [];
        this.pageNum = 1;
        this.finished = false;
        this.dataList = []
        this.pageNum = 1
        this.finished = false
      }
      const res = await getchicang({
        state: this.actives,
        stockType: laber || this.activeObj.laber,
        pageNum: this.pageNum,
        pageSize: this.pageSize,
      });
      if (res.data.total <= this.dataList.length) {
        this.finished = true;
      }
      this.loading = false;
        pageSize: this.pageSize
      })
      this.loading = false
      if (res.status === 0) {
        if (this.pageNum !== 1) {
          this.dataList = [...this.dataList, ...res.data.list];
        } else {
          this.dataList = res.data.list;
        this.dataList = res.data.list
        if (res.data.total <= this.dataList.length) {
          this.finished = true
        }
      } else {
        this.loading = false;
        this.finished = true;
        this.loading = false
        this.finished = true
      }
    },
    close(item) {
      this.closeSell = item;
      this.$refs.closeDialog.show = true;
    close (item) {
      this.closeSell = item
      this.$refs.closeDialog.show = true
    },
    clickTabs(e) {
      this.dataList = [];
      this.pageNum = 1;
      this.finished = false;
      this.actives = e.key;
      this.getList();
    },
  },
};
    clickTabs (e) {
      this.dataList = []
      this.pageNum = 1
      this.finished = false
      this.actives = e.key
      this.getList()
    }
  }
}
</script>
<style lang="less" scoped>