fix: 增加账户状态功能优化完善。

This commit is contained in:
tianyongbao
2024-07-18 19:26:22 +08:00
parent 0ad573e209
commit 6cff60c160
46 changed files with 360 additions and 36 deletions

View File

@@ -20,6 +20,11 @@
<u--input v-model="form.code" placeholder="请填写账号"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="账户状态" required prop="statusName" @click="handleShowStatus">
<u--input v-model="form.statusName" disabled disabledColor="#ffffff" placeholder="请选择账户状态"
inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-down"></u-icon>
</u-form-item>
<u-form-item label="密码" prop="password" >
<u--input v-model="form.password" placeholder="请填写密码"
inputAlign="right" border="none"></u--input>
@@ -67,6 +72,8 @@
<u-toast ref="uToast"></u-toast>
<u-picker itemHeight="88" :show="showDebitCard" :columns="debitCardList" keyName="nameCodeAvailableLimit" @cancel="handleDebitCardCancel"
@confirm="handleDebitCardConfirm"></u-picker>
<u-picker itemHeight="88" :show="showStatus" :columns="statusList" keyName="dictLabel" @cancel="handleStatusCancel"
@confirm="handleStatusConfirm"></u-picker>
<u-datetime-picker
:show="datePickShow"
mode="date"
@@ -81,6 +88,7 @@
<script setup>
import { getFutureStocks, addFutureStocks, updateFutureStocks } from '@/api/invest/futureStocks'
import { listAccounts } from '@/api/invest/accounts'
import { getDicts } from '@/api/system/dict/data.js'
const { proxy } = getCurrentInstance()
import dayjs from 'dayjs'
import {onLoad,onReady} from "@dcloudio/uni-app";
@@ -91,6 +99,8 @@ const showDebitCard = ref(false)
const title = ref("期货账户管理")
const debitCardList = ref([])
const dateType = ref(1)
const showStatus = ref(false)
const statusList = ref([])
const data = reactive({
form: {
id: null,
@@ -110,18 +120,21 @@ const data = reactive({
updateBy: null,
updateTime: null,
delFlag: null,
remark: null
remark: null,
status: '1',
statusName: '正常使用'
},
queryDebitCardParams: {
pageNum: 1,
type: '1',
state: '1',
status: '1',
pageSize: 1000
},
// dateType:'1',
rules: {
name: [{ type: 'string', required: true, message: '期货账户名称不能为空', trigger: ['change', 'blur'] }],
code: [{ type: 'string', required: true, message: '账号不能为空', trigger: ['change', 'blur'] }],
statusName: [{ type: 'string', required: true, message: '账户状态不能为空', trigger: ['change', 'blur'] }],
}
})
const { form, queryDebitCardParams, rules} = toRefs(data)
@@ -140,6 +153,10 @@ onLoad((option) => {
form.value.effectiveDate = dayjs(new Date().getTime()).format("YYYY-MM-DD")
})
function getDict() {
// 类型
getDicts('account_status').then(res => {
statusList.value =[res.data]
})
// 类型
listAccounts(queryDebitCardParams.value).then((response) => {
debitCardList.value = [response.rows]
@@ -148,10 +165,22 @@ onLoad((option) => {
if(form.value.id!=null){
getFutureStocks(form.value.id).then(res => {
form.value = res.data
// 类型
getDicts('account_status').then(result => {
form.value.statusName=dictStr(form.value.status, result.data)
})
})
}
}
function dictStr(val, arr) {
let str = ''
arr.map(item => {
if (item.dictValue === val) {
str = item.dictLabel
}
})
return str
}
function handleDebitCard() {
if (debitCardList.value[0].length === 0) {
proxy.$refs['uToast'].show({
@@ -169,6 +198,24 @@ onLoad((option) => {
function handleDebitCardCancel() {
showDebitCard.value = false
}
function handleShowStatus() {
if (statusList.value[0].length === 0) {
proxy.$refs['uToast'].show({
message: '账户状态操作为空 ', type: 'warning'
})
} else {
showStatus.value = true
}
}
function handleStatusConfirm(e) {
form.value.statusName = e.value[0].dictLabel
form.value.status = e.value[0].dictValue
showStatus.value = false
}
function handleStatusCancel() {
showStatus.value = false
}
function selectDate(type) {
dateType.value=type
datePickShow.value = true

View File

@@ -10,6 +10,7 @@
<u-cell-group>
<u-cell title="名称:" titleStyle="font-weight:bolder" :value="detailInfo.name"></u-cell>
<u-cell title="账号:" titleStyle="font-weight:bolder" :value="detailInfo.code"></u-cell>
<u-cell title="账户状态:" titleStyle="font-weight:bolder" :value="detailInfo.status"></u-cell>
<u-cell title="期货交易中心账号:" titleStyle="font-weight:bolder" :value="detailInfo.tradingCenterCode"></u-cell>
<u-cell title="手续费:" titleStyle="font-weight:bolder" center :value="detailInfo.commission"> </u-cell>
<u-cell title="保证金比例:" titleStyle="font-weight:bolder" :value="detailInfo.bond"></u-cell>
@@ -24,6 +25,7 @@
<script setup>
import { getFutureStocks } from '@/api/invest/futureStocks'
import { getDicts } from '@/api/system/dict/data.js'
import {onLoad} from "@dcloudio/uni-app";
import {reactive ,toRefs,ref,computed }from "vue";
const id = ref('')
@@ -38,6 +40,10 @@ onLoad((option) => {
function getInfo() {
getFutureStocks(id.value).then(res => {
detailInfo.value = res.data
// 类型
getDicts('account_status').then(result => {
detailInfo.value.status=dictStr(detailInfo.value.status, result.data)
})
})
}
function dictStr(val, arr) {

View File

@@ -16,7 +16,10 @@
<u--text suffixIcon="arrow-right" lines="1" iconStyle="font-size: 18px; color: #333333; font-weight:bold"
:text="item.name+'-'+item.code " size="30rpx" color="#333333" :bold="true"></u--text>
</view>
<view class="item-row">
<text class="row-label">账户状态</text>
<text class="row-value">{{ dictStr(item.status, statusList) }}</text>
</view>
<view class="item-row">
<text class="row-label">期货交易中心账号</text>
<text class="row-value">{{ item.tradingCenterCode }}</text>
@@ -60,6 +63,7 @@
<script setup>
import { listFutureStocks, delFutureStocks} from '@/api/invest/futureStocks'
import {onLoad,onShow} from "@dcloudio/uni-app";
import { getDicts } from '@/api/system/dict/data.js'
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
import {reactive ,toRefs,ref,computed }from "vue";
const pageNum = ref(1)
@@ -68,6 +72,7 @@ const isShow = ref(false)
const status = ref('loadmore')
const settingPickShow = ref(false)
const settingColumns = ref([])
const statusList = ref([])
const data = reactive({
queryParams: {
name: null,
@@ -79,6 +84,10 @@ const windowHeight = computed(() => {
uni.getSystemInfoSync().windowHeight - 50
})
onLoad(() => {
// 账户状态
getDicts('account_status').then(res => {
statusList.value = res.data
})
getList()
});