大宝管理后台代码
dcc
2024-07-07 55424ae85fe3b97a0fa383e00515e5edc4e9a75b
7.6更改的东西
5 files modified
4 files added
1045 ■■■■■ changed files
.env 1 ●●●● patch | view | raw | blame | history
.env.development 3 ●●●● patch | view | raw | blame | history
.env.preview 3 ●●●● patch | view | raw | blame | history
src/api/position.js 66 ●●●●● patch | view | raw | blame | history
src/config/router.config.js 31 ●●●● patch | view | raw | blame | history
src/views/position/components/currentPriceReview-hold.vue 410 ●●●●● patch | view | raw | blame | history
src/views/position/currentPriceReview.vue 32 ●●●●● patch | view | raw | blame | history
src/views/vip/VIPScramble.vue 32 ●●●●● patch | view | raw | blame | history
src/views/vip/components/VIPScramble-hold.vue 467 ●●●●● patch | view | raw | blame | history
.env
@@ -2,6 +2,7 @@
VUE_APP_PREVIEW=true
# VUE_APP_API_BASE_URL= https://www.prudentcapitals.net/
# VUE_APP_API_BASE_URL=http://www.jqydl.com:8091/
# VUE_APP_API_BASE_URL= http://192.168.10.5:8091/
 VUE_APP_API_BASE_URL= https://api.apratrade.com/
# VUE_APP_API_BASE_URL=https://www.rksv.store:8091/
# VUE_APP_API_BASE_URL=http://www.ojwuf.com:8091/
.env.development
@@ -6,6 +6,7 @@
# VUE_APP_API_BASE_URL=https://www.rksv.store:8091/
# VUE_APP_API_BASE_URL=http://www.ojwuf.com:8091/
# VUE_APP_API_BASE_URL=http://192.168.0.105:8091/
VUE_APP_API_BASE_URL=https://api.apratrade.com/
# VUE_APP_API_BASE_URL=http://192.168.10.5:8091/
 VUE_APP_API_BASE_URL= https://api.apratrade.com/
# VUE_APP_API_BASE_URL= https://www.prudentcapitals.net/
# VUE_APP_API_BASE_URL=https://api.guosen.org/
.env.preview
@@ -2,4 +2,5 @@
VUE_APP_PREVIEW=true
VUE_APP_API_BASE_URL=https://api.apratrade.com/
# VUE_APP_API_BASE_URL=http://192.168.10.5:8091/
 VUE_APP_API_BASE_URL= https://api.apratrade.com/
src/api/position.js
@@ -1,10 +1,17 @@
import request from '@/utils/request'
import qs from 'qs'
const userApi = {
    orderList: '/admin/pending/orderList.do', //现价交易
    sitevipList: '/admin/sitevip/list.do', //vip
    sitevipAdd: '/admin/sitevip/add.do', //vip sitevipUpdate
    sitevipUpdate: '/admin/sitevip/update.do', //vip
    sitevipDel: '/admin/sitevip/del.do', //vip
    sitevipUpdateStatus: '/admin/sitevip/updateStatus.do', //vip
    positionlist: '/admin/position/list.do', // 融资列表
    indexpositionlist: '/admin/index/position/list.do', // 指数列表
    futurespositionlist: '/admin/futures/position/list.do', // 期货列表
    positionlock: '/admin/position/lock.do', // 融资锁仓 解锁
    examine: '/admin/pending/examine.do', //管理员审核挂单接口
    positionsell: '/admin/position/sell.do', // 融资强制平仓
    positiondel: '/admin/position/del.do', //  融资平仓删除
    indexpositionlock: '/admin/index/position/lock.do', // 指数锁仓 解锁
@@ -36,6 +43,57 @@
        data: qs.stringify(parameter)
    })
}
export function orderList (parameter) {
    return request({
        url: userApi.orderList,
        method: 'get',
        params: parameter
    })
}
export function sitevipList (parameter) {
    return request({
        url: userApi.sitevipList,
        method: 'get',
        params: parameter
    })
}
export function sitevipAdd (parameter) {
    return request({
        url: userApi.sitevipAdd,
        method: 'post',
        data: qs.stringify(parameter)
    })
}
export function sitevipUpdate (parameter) {
    return request({
        url: userApi.sitevipUpdate,
        method: 'post',
        data: qs.stringify(parameter)
    })
}
export function sitevipDel (parameter) {
    return request({
        url: userApi.sitevipDel,
        method: 'get',
        params: parameter
    })
}
export function sitevipUpdateStatus (parameter) {
    return request({
        url: userApi.sitevipUpdateStatus,
        method: 'post',
        data: qs.stringify(parameter)
    })
}
export function indexpositionlist (parameter) {
    return request({
        url: userApi.indexpositionlist,
@@ -59,6 +117,14 @@
    })
}
export function examine (parameter) {
    return request({
        url: userApi.examine,
        method: 'post',
        data: qs.stringify(parameter)
    })
}
export function positionsell (parameter) {
    return request({
        url: userApi.positionsell,
src/config/router.config.js
@@ -171,6 +171,12 @@
            component: () => import('@/views/position/financing'),
            meta: { title: '持仓管理', keepAlive: true, permission: ['financing'] },
          },
          {
            path: '/position/currentPriceReview',
            name: 'currentPriceReview',
            component: () => import('@/views/position/currentPriceReview'),
            meta: { title: '现价审核', keepAlive: true, permission: ['financing'] },
          },
          // {
          //   path: '/position/createfinancing',
          //   name: 'createfinancing',
@@ -330,7 +336,7 @@
            name: 'timelist',
            component: () => import('@/views/risksetting/timelist'),
            meta: { title: '股票时间列表', keepAlive: true, permission: ['timelist'] },
          },
          }
          // {
          //   path: '/risksetting/indexsetting',
          //   name: 'indexsetting',
@@ -344,6 +350,21 @@
          //   component: () => import('@/views/risksetting/spreadsetting'),
          //   meta: { title: '点差设置', keepAlive: true, permission: ['spreadsetting'] },
          // },
        ],
      },
      // // vip抢筹
      {
        path: '/vip',
        redirect: '/vip/VIPScramble',
        component: RouteView,
        meta: { title: 'VIP抢筹', icon: 'money-collect', permission: ['financing'] },
        children: [
          {
            path: '/vip/VIPScramble',
            name: 'VIPScramble',
            component: () => import('@/views/vip/VIPScramble'),
            meta: { title: 'VIP抢筹', keepAlive: true, permission: ['financing'] },
          },
        ],
      },
      // 系统设置
@@ -614,14 +635,14 @@
            path: '/loanmanage/index',
            name: 'Loanmanage',
            component: () => import('@/views/loanmanage/index'),
            meta: { title: '贷款列表', keepAlive: true, permission: ['loanmanage'] }
            meta: { title: '贷款列表', keepAlive: true, permission: ['loanmanage'] },
          },
          {
            path: '/loanmanage/institution',
            name: 'institution',
            component: () => import('@/views/loanmanage/institution'),
            meta: { title: '贷款机构', keepAlive: true, permission: ['institution'] }
          }
            meta: { title: '贷款机构', keepAlive: true, permission: ['institution'] },
          },
          // {
          //   path: '/loanmanage/institution',
          //   name: 'Institution',
@@ -634,7 +655,7 @@
          //   component: () => import('@/views/loanmanage/index'),
          //   meta: { title: '贷款机构', keepAlive: true, permission: ['loanmanage'] }
          // }
        ]
        ],
      },
      {
        path: '/interesttreasure',
src/views/position/components/currentPriceReview-hold.vue
New file
@@ -0,0 +1,410 @@
<template>
  <div>
    <a-card :bordered="false">
      <div class="table-page-search-wrapper">
        <a-form layout="inline">
          <a-row :gutter="48">
            <a-col :md="12" :lg="6" :sm="24">
              <a-form-item label="搜索关键次">
                <a-input v-model="queryParam.keywords" style="width: 100%" placeholder="请输入搜索关键次" />
              </a-form-item>
            </a-col>
            <a-col :md="12" :lg="6" :sm="24">
              <a-form-item label="状态">
                <a-select v-model="queryParam.status" placeholder="请选择状态">
                  <a-select-option :value="''">全部</a-select-option>
                  <a-select-option :value="0">已挂单</a-select-option>
                  <a-select-option :value="1">买入成功</a-select-option>
                  <a-select-option :value="2">买入失败</a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="48">
            <a-col :md="12" :lg="6" :sm="24">
              <a-form-item>
                <span class="table-page-search-submitButtons">
                  <a-button @click="getqueryParam" icon="redo"> 重置</a-button>
                  <a-button
                    type="primary"
                    icon="search"
                    style="margin-left: 8px"
                    @click=";(queryParam.pageNum = 1), getlist()"
                    >查询
                  </a-button>
                </span>
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
      </div>
    </a-card>
    <a-table
      bordered
      :loading="loading"
      :pagination="pagination"
      :columns="columns"
      :data-source="datalist"
      rowKey="id"
    >
      <span slot="stockName" slot-scope="text, record">
        <template>
          <div>
            <span style="margin-right: 10px">{{ record.stockName }}</span>
            <a-tag
              :color="
                record.stockPlate == '科创'
                  ? 'blue'
                  : !record.stockPlate
                  ? 'orange'
                  : record.stockPlate == '创业'
                  ? 'pink'
                  : 'purple'
              "
            >
              {{ record.stockPlate == '科创' ? '科创' : !record.stockPlate ? '股票' : record.stockPlate }}
            </a-tag>
            <p>({{ record.stockCode }})</p>
          </div>
        </template>
      </span>
      <span slot="positionType" slot-scope="text, record">
        <template>
          <div>
            <a-tag :color="record.positionType == 1 ? 'blue' : 'green'">
              {{ record.positionType == 1 ? '模拟持仓' : '正式持仓' }}
            </a-tag>
          </div>
        </template>
      </span>
      <span slot="status" slot-scope="text, record">
        <template>
          <div>
            <a-tag v-if="record.status == 0"> 已挂单 </a-tag>
            <a-tag v-if="record.status == 1"> 买入成功 </a-tag>
            <a-tag v-if="record.status == 2"> 买入失败 </a-tag>
          </div>
        </template>
      </span>
      <span slot="orderDirection" slot-scope="text, record">
        <template>
          <div>
            <a-tag :color="record.orderDirection == '买涨' ? 'red' : 'green'">
              {{ record.orderDirection }}
            </a-tag>
          </div>
        </template>
      </span>
      <span slot="nowPrice" slot-scope="text, record">
        <template>
          <div>
            <p
              :class="
                Number(record.nowPrice) - record.targetPrice < 0
                  ? 'greens'
                  : Number(record.nowPrice) - record.targetPrice > 0
                  ? 'reds'
                  : ''
              "
            >
              {{ record.nowPrice }}
            </p>
          </div>
        </template>
      </span>
      <span slot="profitAndLose" slot-scope="text">
        <template>
          <div>
            <p :class="text < 0 ? 'greens' : text > 0 ? 'reds' : ''">
              {{ text }}
            </p>
          </div>
        </template>
      </span>
      <span slot="allProfitAndLose" slot-scope="text">
        <template>
          <div>
            <p :class="text < 0 ? 'greens' : text > 0 ? 'reds' : ''">
              {{ text }}
            </p>
          </div>
        </template>
      </span>
      <template slot="action" slot-scope="text, record">
        <a slot="action" href="javascript:;" @click="getLockopen(record.id)">转持仓</a>
      </template>
    </a-table>
    <a-modal
      title="锁仓"
      :width="640"
      :visible="Lockvisibledialog"
      :confirmLoading="Lockvisibleloading"
      @ok="getDialogok"
      @cancel="handleCancel"
    >
      <a-form :form="Lockvisibleform" ref="createModal">
        <a-form-item>
          <a-input
            v-decorator="['lockMsg', { rules: [{ required: true, message: '请输入锁仓原因!', whitespace: true }] }]"
            placeholder="请输入锁仓原因!"
          />
        </a-form-item>
      </a-form>
    </a-modal>
  </div>
</template>
<script>
import { positionlist, positionlock, positionsell, orderList, examine } from '@/api/position'
import { nextagent } from '@/api/home'
import moment from 'moment'
export default {
  name: 'Financinghold',
  data() {
    return {
      columns: [
        {
          title: 'ID',
          dataIndex: 'id',
          align: 'center',
        },
        {
          title: '用户ID',
          dataIndex: 'userId',
          align: 'center',
        },
        {
          title: '股票ID',
          dataIndex: 'stockId',
          align: 'center',
        },
        {
          title: '数量',
          dataIndex: 'buyNum',
          align: 'center',
        },
        // {
        //   title: '类型',
        //   dataIndex: 'buyType',
        //   align: 'center',
        // },
        {
          title: '止盈',
          dataIndex: 'profitTarget',
          align: 'center',
        },
        {
          title: '止损',
          dataIndex: 'stopTarget',
          align: 'center',
        },
        {
          title: '现价',
          dataIndex: 'nowPrice',
          align: 'center',
          scopedSlots: { customRender: 'nowPrice' },
        },
        {
          title: '目标价格',
          dataIndex: 'targetPrice',
          align: 'center',
        },
        {
          title: '状态',
          dataIndex: 'status',
          align: 'center',
          scopedSlots: { customRender: 'status' },
        },
        {
          title: '添加时间',
          dataIndex: 'addTime',
          align: 'center',
          width: 180,
          customRender: (text, row, index) => {
            return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''
          },
        },
        {
          title: '操作',
          key: 'action',
          align: 'center',
          fixed: 'right',
          width: 150,
          scopedSlots: { customRender: 'action' },
        },
      ],
      // 表头
      pagination: {
        total: 0,
        pageSize: 10, // 每页中显示10条数据
        showSizeChanger: true,
        pageSizeOptions: ['10', '20', '50', '100'], // 每页中显示的数据
        onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize), // 改变每页数量时更新显示
        onChange: (page, pageSize) => this.onPageChange(page, pageSize), // 点击页码事件
        showTotal: (total) => `共有 ${total} 条数据`, // 分页中显示总的数据
      },
      loading: false,
      queryParam: {
        pageNum: 1,
        pageSize: 10,
        keywords: '',
        status: '',
      },
      datalist: [],
      agentlist: [],
      agentloading: false,
      Lockvisibledialog: false,
      Lockvisibleloading: false,
      Lockvisibleform: this.$form.createForm(this),
      clickpositionId: '',
      agentqueryParam: {
        pageNum: 1,
        pageSize: 100,
      },
    }
  },
  created() {
    this.getlist()
  },
  methods: {
    getCompulsoryclosing(val) {
      var that = this
      this.$confirm({
        title: '提示',
        content: '确认要强制平仓吗?',
        onOk() {
          var data = {
            positionSn: val,
          }
          positionsell(data)
            .then((res) => {
              if (res.status == 0) {
                that.$message.success(res.msg)
                that.getlist()
              } else {
                that.$message.error({ content: '平仓失败' })
              }
            })
            .catch((error) => {
              that.$message.error({ content: '平仓失败' })
            })
        },
        onCancel() {
          console.log('Cancel')
        },
      })
    },
    getLockopen(val) {
      var that = this
      this.$confirm({
        title: '提示',
        content: '确认要转持仓吗?',
        onOk() {
          var data = {
            id: val,
          }
          examine(data).then((res) => {
            if (res.status == 0) {
              that.$message.success(res.msg)
              that.getlist()
            } else {
              that.$message.error(res.msg)
            }
          })
        },
        onCancel() {
          console.log('Cancel')
        },
      })
    },
    handleCancel() {
      this.Lockvisibledialog = false
      const form = this.$refs.createModal.form
      form.resetFields()
    },
    getDialogok() {
      const form = this.$refs.createModal.form
      form.validateFields((errors, values) => {
        if (!errors) {
          this.Lockvisibleloading = true
          var data = {
            state: 1,
            lockMsg: values.lockMsg,
            positionId: this.clickpositionId,
          }
          positionlock(data)
            .then((res) => {
              if (res.status == 0) {
                this.Lockvisibledialog = false
                this.$message.success(res.msg)
                form.resetFields()
                this.getlist()
              } else {
                this.$message.error(res.msg)
              }
              this.Lockvisibleloading = false
            })
            .catch((error) => {
              reject(error)
            })
        }
      })
    },
    getinit() {
      this.queryParam = {
        pageNum: 1,
        pageSize: 10,
        keywords: '',
        status: '',
      }
      this.getlist()
    },
    getqueryParam() {
      this.queryParam = {
        pageNum: 1,
        pageSize: 10,
        keywords: '',
        status: '',
      }
    },
    getagentlist() {
      var that = this
      this.agentloading = true
      nextagent(this.agentqueryParam).then((res) => {
        this.agentlist = res.data.list
        setTimeout(() => {
          that.agentloading = false
        }, 500)
      })
    },
    getlist() {
      this.loading = true
      console.log(this.queryParam)
      orderList(this.queryParam).then((res) => {
        console.log(res)
        this.datalist = res.data.list
        this.pagination.total = res.data.total
        this.loading = false
      })
    },
    onPageChange(page, pageSize) {
      this.queryParam.pageNum = page
      this.getlist()
    },
    onSizeChange(current, pageSize) {
      this.queryParam.pageNum = current
      this.queryParam.pageSize = pageSize
      this.getlist()
    },
  },
}
</script>
<style scoped>
.greens {
  color: #52c41a;
}
.reds {
  color: #f5222d;
}
</style>
src/views/position/currentPriceReview.vue
New file
@@ -0,0 +1,32 @@
<template>
    <page-header-wrapper>
      <a-card>
        <currentPriceReviewHold ref="currentPriceReviewHold"></currentPriceReviewHold>
      </a-card>
    </page-header-wrapper>
  </template>
  <script>
  import currentPriceReviewHold from './components/currentPriceReview-hold'
  export default {
      name: 'currentPriceReview',
      components: {
        currentPriceReviewHold,
      },
      data () {
          return {
          }
      },
      methods: {
      }
  }
  </script>
  <style lang="less" scoped>
  /deep/ .ant-tabs-nav-scroll {
      display: flex;
      justify-content: center;
  }
  </style>
src/views/vip/VIPScramble.vue
New file
@@ -0,0 +1,32 @@
<template>
    <page-header-wrapper>
      <a-card>
        <VIPScrambleHold ref="VIPScrambleHold"></VIPScrambleHold>
      </a-card>
    </page-header-wrapper>
  </template>
  <script>
  import VIPScrambleHold from './components/VIPScramble-hold'
  export default {
      name: 'VIPScramble',
      components: {
        VIPScrambleHold,
      },
      data () {
          return {
          }
      },
      methods: {
      }
  }
  </script>
  <style lang="less" scoped>
  /deep/ .ant-tabs-nav-scroll {
      display: flex;
      justify-content: center;
  }
  </style>
src/views/vip/components/VIPScramble-hold.vue
New file
@@ -0,0 +1,467 @@
<template>
  <div>
    <a-card :bordered="false">
      <div class="table-page-search-wrapper">
        <a-form layout="inline">
          <a-row :gutter="48">
            <a-col :md="12" :lg="6" :sm="24">
              <a-form-item label="名称或股票代码">
                <a-input v-model="queryParam.keyword" style="width: 100%" placeholder="请输入名称或股票代码" />
              </a-form-item>
            </a-col>
            <a-col :md="12" :lg="6" :sm="24">
              <a-form-item label="状态">
                <a-select v-model="queryParam.status" placeholder="请选择状态">
                  <a-select-option :value="''">全部</a-select-option>
                  <a-select-option :value="1">开</a-select-option>
                  <a-select-option :value="0">关</a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="48">
            <a-col :md="12" :lg="6" :sm="24">
              <a-form-item>
                <span class="table-page-search-submitButtons">
                  <a-button @click="getqueryParam" icon="redo"> 重置</a-button>
                  <a-button
                    type="primary"
                    icon="search"
                    style="margin-left: 8px"
                    @click=";(queryParam.pageNum = 1), getlist()"
                    >查询
                  </a-button>
                  <a-button type="primary" icon="plus-circle" style="margin-left: 8px" @click="Lockvisibledialog = true"
                    >添加
                  </a-button>
                </span>
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
      </div>
    </a-card>
    <a-table
      bordered
      :loading="loading"
      :pagination="pagination"
      :columns="columns"
      :data-source="datalist"
      rowKey="id"
    >
      <span slot="stockName" slot-scope="text, record">
        <template>
          <div>
            <span style="margin-right: 10px">{{ record.stockName }}</span>
            <a-tag
              :color="
                record.stockPlate == '科创'
                  ? 'blue'
                  : !record.stockPlate
                  ? 'orange'
                  : record.stockPlate == '创业'
                  ? 'pink'
                  : 'purple'
              "
            >
              {{ record.stockPlate == '科创' ? '科创' : !record.stockPlate ? '股票' : record.stockPlate }}
            </a-tag>
            <p>({{ record.stockCode }})</p>
          </div>
        </template>
      </span>
      <span slot="positionType" slot-scope="text, record">
        <template>
          <div>
            <a-tag :color="record.positionType == 1 ? 'blue' : 'green'">
              {{ record.positionType == 1 ? '模拟持仓' : '正式持仓' }}
            </a-tag>
          </div>
        </template>
      </span>
      <span slot="status" slot-scope="text, record">
        <template>
          <div>
            <a-tag v-if="record.status == 1"> 开 </a-tag>
            <a-tag v-if="record.status == 0"> 关 </a-tag>
          </div>
        </template>
      </span>
      <span slot="orderDirection" slot-scope="text, record">
        <template>
          <div>
            <a-tag :color="record.orderDirection == '买涨' ? 'red' : 'green'">
              {{ record.orderDirection }}
            </a-tag>
          </div>
        </template>
      </span>
      <span slot="nowPrice" slot-scope="text, record">
        <template>
          <div>
            <p
              :class="
                Number(record.nowPrice) - record.targetPrice < 0
                  ? 'greens'
                  : Number(record.nowPrice) - record.targetPrice > 0
                  ? 'reds'
                  : ''
              "
            >
              {{ record.nowPrice }}
            </p>
          </div>
        </template>
      </span>
      <span slot="profitAndLose" slot-scope="text">
        <template>
          <div>
            <p :class="text < 0 ? 'greens' : text > 0 ? 'reds' : ''">
              {{ text }}
            </p>
          </div>
        </template>
      </span>
      <span slot="allProfitAndLose" slot-scope="text">
        <template>
          <div>
            <p :class="text < 0 ? 'greens' : text > 0 ? 'reds' : ''">
              {{ text }}
            </p>
          </div>
        </template>
      </span>
      <template slot="action" slot-scope="text, record">
        <a slot="action" href="javascript:;" @click="geteditStock(record)">修改</a>
        <a-divider type="vertical" />
        <a slot="action" href="javascript:;" @click="getLockopen(record.id)">删除</a>
      </template>
    </a-table>
    <a-modal
      :title="currentdetail ? '修改' : '添加'"
      :width="830"
      :visible="Lockvisibledialog"
      :confirmLoading="Lockvisibleloading"
      @ok="getDialogok"
      @cancel="handleCancel"
    >
      <a-form :form="addUserform" ref="addUserform">
        <a-row :gutter="48">
          <a-col :md="12" :lg="12" :sm="12">
            <a-form-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                placeholder="请输入名称"
                v-decorator="['name', { rules: [{ required: true, message: '请输入名称' }] }]"
              />
            </a-form-item>
          </a-col>
          <a-col :md="12" :lg="12" :sm="12">
            <a-form-item label="股票代码" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                placeholder="请输入股票代码"
                v-decorator="['stockCode', { rules: [{ required: true, message: '请输入股票代码' }] }]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="48">
          <a-col :md="12" :lg="12" :sm="12">
            <a-form-item label="涨跌幅" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                placeholder="请输入涨跌幅"
                v-decorator="['stockChg', { rules: [{ required: true, message: '请输入涨跌幅' }] }]"
              />
            </a-form-item>
          </a-col>
          <a-col :md="12" :lg="12" :sm="12">
            <!-- <a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-select
                placeholder="请选择状态"
                v-decorator="['status', { rules: [{ required: true, message: '请选择状态' }] }]"
              >
                <a-select-option :value="1">开</a-select-option>
                <a-select-option :value="0">关</a-select-option>
              </a-select>
            </a-form-item> -->
            <a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-select
                placeholder="请选择状态"
                v-decorator="['status', { rules: [{ required: true, message: '请选择状态' }] }]"
              >
                <a-select-option :value="1">开</a-select-option>
                <a-select-option :value="0">关</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="48">
          <a-col :md="12" :lg="12" :sm="12">
            <a-form-item label="最低交易数量(手)" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                placeholder="请输入最低交易数量(手)"
                v-decorator="['lowestTrade', { rules: [{ required: true, message: '请输入最低交易数量(手)' }] }]"
              />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-modal>
  </div>
</template>
<script>
import { positionlock, positionsell, examine, sitevipList, sitevipAdd, sitevipUpdate,sitevipUpdateStatus,sitevipDel } from '@/api/position'
import { nextagent } from '@/api/home'
import pick from 'lodash.pick'
import moment from 'moment'
export default {
  name: 'VIPScrambleHold',
  data() {
    return {
      columns: [
        {
          title: 'ID',
          dataIndex: 'id',
          align: 'center',
        },
        {
          title: '名称',
          dataIndex: 'name',
          align: 'center',
        },
        {
          title: '股票代码',
          dataIndex: 'stockCode',
          align: 'center',
        },
        {
          title: '涨跌幅',
          dataIndex: 'stockChg',
          align: 'center',
        },
        {
          title: '状态',
          dataIndex: 'status',
          align: 'center',
          scopedSlots: { customRender: 'status' },
        },
        {
          title: '最低交易数量(手)',
          dataIndex: 'lowestTrade',
          align: 'center',
        },
        {
          title: '创建时间',
          dataIndex: 'createTime',
          align: 'center',
          width: 180,
          customRender: (text, row, index) => {
            return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''
          },
        },
        {
          title: '修改时间',
          dataIndex: 'updateTime',
          align: 'center',
          width: 180,
          customRender: (text, row, index) => {
            return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''
          },
        },
        {
          title: '操作',
          key: 'action',
          align: 'center',
          fixed: 'right',
          width: 150,
          scopedSlots: { customRender: 'action' },
        },
      ],
      // 表头
      pagination: {
        total: 0,
        pageSize: 10, // 每页中显示10条数据
        showSizeChanger: true,
        pageSizeOptions: ['10', '20', '50', '100'], // 每页中显示的数据
        onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize), // 改变每页数量时更新显示
        onChange: (page, pageSize) => this.onPageChange(page, pageSize), // 点击页码事件
        showTotal: (total) => `共有 ${total} 条数据`, // 分页中显示总的数据
      },
      loading: false,
      queryParam: {
        pageNum: 1,
        pageSize: 10,
        keyword: '',
        status: '',
      },
      fields: [
        'name',
        'stockCode',
        'stockChg',
        'status',
        'lowestTrade',
        'createTime',
        'updateTime',
      ],
      datalist: [],
      agentlist: [],
      agentloading: false,
      Lockvisibledialog: false,
      Lockvisibleloading: false,
      Lockvisibleform: this.$form.createForm(this),
      clickpositionId: '',
      agentqueryParam: {
        pageNum: 1,
        pageSize: 100,
      },
      labelCol: {
        xs: { span: 8 },
        sm: { span: 8 },
        md: { span: 8 },
      },
      wrapperCol: {
        xs: { span: 14 },
        sm: { span: 14 },
        md: { span: 14 },
      },
      addUserform: this.$form.createForm(this),
      currentdetail: '',
    }
  },
  created() {
    this.getlist()
  },
  methods: {
    geteditStock(val) {
      this.currentdetail = val
      this.Lockvisibledialog = true
      this.fields.forEach((v) => this.addUserform.getFieldDecorator(v))
      this.addUserform.setFieldsValue(pick(val, this.fields))
    },
    getLockopen(val) {
      var that = this
      this.$confirm({
        title: '提示',
        content: '确认要删除吗?',
        onOk() {
          var data = {
            id: val,
          }
          sitevipDel(data).then((res) => {
            if (res.status == 0) {
              that.$message.success(res.msg)
              that.getlist()
            } else {
              that.$message.error(res.msg)
            }
          })
        },
        onCancel() {
          console.log('Cancel')
        },
      })
    },
    handleCancel() {
      this.Lockvisibledialog = false
      const form = this.$refs.addUserform.form
      form.resetFields()
    },
    getDialogok() {
      const form = this.$refs.addUserform.form
      form.validateFields((errors, values) => {
        console.log(values);
        if (!errors) {
          if (this.currentdetail != '') {
            this.Lockvisibledialog = true
            values.id = this.currentdetail.id
            // values.subscriptionTime = this.subscriptionTime
            // values.subscribeTime = this.subscribeTime
            sitevipUpdate(values).then((res) => {
              if (res.status == 0) {
                this.Lockvisibledialog = false
                this.$message.success('修改成功')
                this.currentdetail = ''
                form.resetFields()
                this.getlist()
              } else {
                this.$message.error(res.msg)
              }
              this.Lockvisibledialog = false
            })
          } else {
            this.addUserDialogloading = true
            sitevipAdd(values).then((res) => {
              if (res.status == 0) {
                this.Lockvisibledialog = false
                this.$message.success(res.msg)
                form.resetFields()
                this.getinit()
              } else {
                this.$message.error(res.msg)
              }
              this.addUserDialogloading = false
            })
          }
        }
      })
    },
    getinit() {
      this.queryParam = {
        pageNum: 1,
        pageSize: 10,
        keyword: '',
        status: '',
      }
      this.getlist()
    },
    getqueryParam() {
      this.queryParam = {
        pageNum: 1,
        pageSize: 10,
        keyword: '',
        status: '',
      }
    },
    getagentlist() {
      var that = this
      this.agentloading = true
      nextagent(this.agentqueryParam).then((res) => {
        this.agentlist = res.data.list
        setTimeout(() => {
          that.agentloading = false
        }, 500)
      })
    },
    getlist() {
      this.loading = true
      console.log(this.queryParam)
      sitevipList(this.queryParam).then((res) => {
        console.log(res)
        this.datalist = res.data.records
        this.pagination.total = res.data.total
        this.loading = false
      })
    },
    onPageChange(page, pageSize) {
      this.queryParam.pageNum = page
      this.getlist()
    },
    onSizeChange(current, pageSize) {
      this.queryParam.pageNum = current
      this.queryParam.pageSize = pageSize
      this.getlist()
    },
  },
}
</script>
<style scoped>
.greens {
  color: #52c41a;
}
.reds {
  color: #f5222d;
}
</style>