feat: 智聪记账管理,物价管理bug修复。

This commit is contained in:
tianyongbao
2025-03-21 18:49:31 +08:00
parent ac40fad529
commit ca5dca4c4e
5 changed files with 73 additions and 25 deletions

View File

@@ -99,7 +99,7 @@ const accountNameList = ref([])
const dealCategoryList = ref([]) const dealCategoryList = ref([])
const childCategoryList = ref([]) const childCategoryList = ref([])
const childCategoryShow = ref(true) const childCategoryShow = ref(true)
const flag = ref('add')
const dealTypeList = ref([]) const dealTypeList = ref([])
const data = reactive({ const data = reactive({
form: { form: {
@@ -140,11 +140,16 @@ const { form, queryAccountParams, rules} = toRefs(data)
onLoad((option) => { onLoad((option) => {
form.value.id = option.id form.value.id = option.id
if(form.value.id!=null){ flag.value = option.flag
title.value="账户交易记录-修改" if(flag.value==null){
}else{ if(form.value.id!=null){
title.value="账户交易记录-新增" title.value="账户交易记录-修改"
} }else{
title.value="账户交易记录-新增"
}
}else{
title.value="账户交易记录-复制"
}
}) })
onReady(() => { onReady(() => {
@@ -216,8 +221,13 @@ getDicts('deal_category').then(result => {
getDicts('deal_type').then(result => { getDicts('deal_type').then(result => {
form.value.dealTypeName=dictStr(form.value.dealType, result.data) form.value.dealTypeName=dictStr(form.value.dealType, result.data)
}) })
if(form.value.type=='1'||form.value.type=='2'){
queryAccountParams.value.type = "" queryAccountParams.value.type = form.value.type
}
else {
queryAccountParams.value.type = null
}
listAccounts(queryAccountParams.value).then((response) => { listAccounts(queryAccountParams.value).then((response) => {
accountNameList.value = [response.rows] accountNameList.value = [response.rows]
}) })
@@ -348,13 +358,24 @@ getDicts('deal_category').then(result => {
function submit() { function submit() {
proxy.$refs['uForm'].validate().then(() => { proxy.$refs['uForm'].validate().then(() => {
if (form.value.id != null) { if (form.value.id != null) {
if(flag.value==null){
updateAccountDealRecord(form.value).then(res => { updateAccountDealRecord(form.value).then(res => {
proxy.$refs['uToast'].show({ proxy.$refs['uToast'].show({
message: '修改成功', complete() { message: '修改成功', complete() {
uni.navigateTo({ url: `/pages/work/accounts/accountDealRecord/list` }) uni.navigateTo({ url: `/pages/work/accounts/accountDealRecord/list` })
} }
})
}) })
})
}else {
form.value.id == null
addAccountDealRecord(form.value).then(res => {
proxy.$refs['uToast'].show({
message: '新增成功', complete() {
uni.navigateTo({ url: `/pages/work/accounts/accountDealRecord/list` })
}
})
})
}
}else { }else {
addAccountDealRecord(form.value).then(res => { addAccountDealRecord(form.value).then(res => {
proxy.$refs['uToast'].show({ proxy.$refs['uToast'].show({

View File

@@ -123,6 +123,7 @@
<view class="operate" > <view class="operate" >
<!-- <view class="btn filling" @click="enterDetails(item)">查看</view> --> <!-- <view class="btn filling" @click="enterDetails(item)">查看</view> -->
<view class="btn filling" @click="handleEdit(item)">修改</view> <view class="btn filling" @click="handleEdit(item)">修改</view>
<view class="btn filling" @click="handleCopy(item)">复制</view>
<view class="btn filling" @click="handleDelete(item)">删除</view> <view class="btn filling" @click="handleDelete(item)">删除</view>
</view> </view>
</view> </view>
@@ -360,6 +361,10 @@ function selectAccountType(item) {
uni.navigateTo({ url: `/pages/work/accounts/accountDealRecord/addEdit?id=${item.id}` }) uni.navigateTo({ url: `/pages/work/accounts/accountDealRecord/addEdit?id=${item.id}` })
isShow.value = true isShow.value = true
} }
function handleCopy(item) {
uni.navigateTo({ url: `/pages/work/accounts/accountDealRecord/addEdit?flag=copy&id=${item.id}` })
isShow.value = true
}
function handleAdd() { function handleAdd() {
uni.navigateTo({ url: `/pages/work/accounts/accountDealRecord/addEdit` }) uni.navigateTo({ url: `/pages/work/accounts/accountDealRecord/addEdit` })
isShow.value = true isShow.value = true

View File

@@ -52,7 +52,7 @@
</template> </template>
<script setup> <script setup>
import {getProductInfor, addProductInfor, updateProductInfor } from '@/api/invest/ProductInfor' import {getProductInfor, addProductInfor, updateProductInfor } from '@/api/invest/productInfor'
import { getDicts } from '@/api/system/dict/data.js' import { getDicts } from '@/api/system/dict/data.js'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
import dayjs from 'dayjs' import dayjs from 'dayjs'
@@ -63,6 +63,7 @@ const datePickShow = ref(false)
const showCategory = ref(false) const showCategory = ref(false)
const showUnit = ref(false) const showUnit = ref(false)
const title = ref("商品信息") const title = ref("商品信息")
const flag = ref('add')
const categoryList = ref([]) const categoryList = ref([])
const unitList = ref([]) const unitList = ref([])
const data = reactive({ const data = reactive({
@@ -78,12 +79,16 @@ const { form, rules} = toRefs(data)
onLoad((option) => { onLoad((option) => {
form.value.id = option.id form.value.id = option.id
if(form.value.id!=null){ flag.value = option.flag
title.value="商品信息-修改" if(flag.value==null){
}else{ if(form.value.id!=null){
title.value="商品信息-新增" title.value="商品信息-修改"
form.value.ranking=0 }else{
} title.value="商品信息-新增"
}
}else{
title.value="商品信息-复制"
}
getDict() getDict()
}) })
onReady(() => { onReady(() => {
@@ -160,13 +165,24 @@ onLoad((option) => {
function submit() { function submit() {
proxy.$refs['uForm'].validate().then(() => { proxy.$refs['uForm'].validate().then(() => {
if (form.value.id != null) { if (form.value.id != null) {
if(flag.value==null){
updateProductInfor(form.value).then(res => { updateProductInfor(form.value).then(res => {
proxy.$refs['uToast'].show({ proxy.$refs['uToast'].show({
message: '修改成功', complete() { message: '修改成功', complete() {
uni.navigateTo({ url: `/pages/work/product/productInfor/list` }) uni.navigateTo({ url: `/pages/work/product/productInfor/list` })
} }
})
}) })
})
}else {
form.value.id == null
addProductInfor(form.value).then(res => {
proxy.$refs['uToast'].show({
message: '新增成功', complete() {
uni.navigateTo({ url: `/pages/work/product/productInfor/list` })
}
})
})
}
}else { }else {
addProductInfor(form.value).then(res => { addProductInfor(form.value).then(res => {
proxy.$refs['uToast'].show({ proxy.$refs['uToast'].show({

View File

@@ -53,6 +53,7 @@
<view class="operate" > <view class="operate" >
<!-- <view class="btn filling" @click="enterDetails(item)">查看</view > --> <!-- <view class="btn filling" @click="enterDetails(item)">查看</view > -->
<view class="btn filling" @click="handleEdit(item)">修改</view> <view class="btn filling" @click="handleEdit(item)">修改</view>
<view class="btn filling" @click="handleCopy(item)">复制</view>
<view class="btn filling" @click="handleDelete(item)">删除</view> <view class="btn filling" @click="handleDelete(item)">删除</view>
</view> </view>
</view> </view>
@@ -189,6 +190,10 @@ function selectStatus(item) {
uni.navigateTo({ url: `/pages/work/product/productInfor/addEdit?id=${item.id}` }) uni.navigateTo({ url: `/pages/work/product/productInfor/addEdit?id=${item.id}` })
isShow.value = true isShow.value = true
} }
function handleCopy(item) {
uni.navigateTo({ url: `/pages/work/product/productInfor/addEdit?flag=copy&id=${item.id}` })
isShow.value = true
}
function handleAdd() { function handleAdd() {
uni.navigateTo({ url: `/pages/work/product/productInfor/addEdit` }) uni.navigateTo({ url: `/pages/work/product/productInfor/addEdit` })
isShow.value = true isShow.value = true

View File

@@ -132,6 +132,7 @@ const { form, queryProductParams, rules} = toRefs(data)
onLoad((option) => { onLoad((option) => {
form.value.id = option.id form.value.id = option.id
flag.value = option.flag
if(flag.value==null){ if(flag.value==null){
if(form.value.id!=null){ if(form.value.id!=null){
title.value="物价记录-修改" title.value="物价记录-修改"