feat: 智聪记账管理,物价管理功能代码提交。
This commit is contained in:
44
src/api/invest/productInfor.js
Normal file
44
src/api/invest/productInfor.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询商品基础信息列表
|
||||
export function listProductInfor(query) {
|
||||
return request({
|
||||
url: '/invest/productInfor/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询商品基础信息详细
|
||||
export function getProductInfor(id) {
|
||||
return request({
|
||||
url: '/invest/productInfor/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增商品基础信息
|
||||
export function addProductInfor(data) {
|
||||
return request({
|
||||
url: '/invest/productInfor',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改商品基础信息
|
||||
export function updateProductInfor(data) {
|
||||
return request({
|
||||
url: '/invest/productInfor',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除商品基础信息
|
||||
export function delProductInfor(id) {
|
||||
return request({
|
||||
url: '/invest/productInfor/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
src/api/invest/productPriceRecord.js
Normal file
44
src/api/invest/productPriceRecord.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询物价记录列表
|
||||
export function listProductPriceRecord(query) {
|
||||
return request({
|
||||
url: '/invest/productPriceRecord/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询物价记录详细
|
||||
export function getProductPriceRecord(id) {
|
||||
return request({
|
||||
url: '/invest/productPriceRecord/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增物价记录
|
||||
export function addProductPriceRecord(data) {
|
||||
return request({
|
||||
url: '/invest/productPriceRecord',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改物价记录
|
||||
export function updateProductPriceRecord(data) {
|
||||
return request({
|
||||
url: '/invest/productPriceRecord',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除物价记录
|
||||
export function delProductPriceRecord(id) {
|
||||
return request({
|
||||
url: '/invest/productPriceRecord/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -344,6 +344,38 @@
|
||||
}
|
||||
}
|
||||
,
|
||||
{
|
||||
"path": "pages/work/product/productInfor/list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品信息"
|
||||
}
|
||||
} ,
|
||||
{
|
||||
"path": "pages/work/product/productInfor/details",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品信息详情"
|
||||
}
|
||||
}
|
||||
,
|
||||
{
|
||||
"path": "pages/work/product/productInfor/addEdit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品信息"
|
||||
}
|
||||
} ,
|
||||
{
|
||||
"path": "pages/work/product/productPriceRecord/list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "物价记录"
|
||||
}
|
||||
} ,
|
||||
{
|
||||
"path": "pages/work/product/productPriceRecord/addEdit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "物价记录"
|
||||
}
|
||||
}
|
||||
,
|
||||
{
|
||||
"path": "pages/work/base/debitCard/list",
|
||||
"style": {
|
||||
|
||||
@@ -95,7 +95,8 @@ import auth from "@/plugins/auth"; // 建议使用auth进行鉴权操作
|
||||
{ path: '/pages/work/base/posmachine/list', text: 'pos机管理', icon: 'shop-filled', permission: 'invest:posmachine:list' },
|
||||
{ path: '/pages/work/base/financials/list', text: '理财账户管理', icon: 'calendar', permission: 'invest:futureStocks:list' },
|
||||
{ path: '/pages/work/base/stocks/list', text: '股票账户管理', icon: 'auth-filled', permission: 'invest:futureStocks:list' },
|
||||
{ path: '/pages/work/base/futures/list', text: '期货账户管理', icon: 'paperplane-filled', permission: 'invest:futureStocks:list' }
|
||||
{ path: '/pages/work/base/futures/list', text: '期货账户管理', icon: 'paperplane-filled', permission: 'invest:futureStocks:list' },
|
||||
{ path: '/pages/work/product/productInfor/list', text: '商品信息', icon: 'list', permission: 'invest:productInfor:list' }
|
||||
])
|
||||
const billGridList=ref([
|
||||
// { path: '/pages/work/bill/creditCardBill/list', text: '信用卡账单', icon: 'list', permission: 'invest:creditCardBill:list' },
|
||||
@@ -115,6 +116,7 @@ import auth from "@/plugins/auth"; // 建议使用auth进行鉴权操作
|
||||
// { path: '/pages/work/accounts/investAccountDeal/list', text: '投资交易记录', icon: 'chatboxes', permission: 'invest:futureStocks:list' },
|
||||
// { path: '/pages/work/accounts/debitTransferRecord/list', text: '储蓄账户记账', icon: 'tune', permission: 'invest:debitCard' },
|
||||
{ path: '/pages/work/accounts/lendTransferRecord/list', text: '借贷账户记账', icon: 'link', permission: 'invest:onlineLend' },
|
||||
{ path: '/pages/work/product/productPriceRecord/list', text: '物价记录', icon: 'map', permission: 'invest:productPriceRecord:list' }
|
||||
// { path: '/pages/work/accounts/accountDealRecord/list', text: '账户交易记录', icon: 'paperclip', permission: 'invest:accountDealRecord:list' }
|
||||
])
|
||||
const heartJourneyGridList=ref([
|
||||
|
||||
207
src/pages/work/product/productInfor/addEdit.vue
Normal file
207
src/pages/work/product/productInfor/addEdit.vue
Normal file
@@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<view class="container" style="paddingBottom:1rpx;">
|
||||
<u-navbar
|
||||
leftIconSize="40rpx"
|
||||
leftIconColor="#333333"
|
||||
title="商品信息"
|
||||
>
|
||||
</u-navbar>
|
||||
<view class="section">
|
||||
<view class="section-title">{{ title}}</view>
|
||||
<view class="form-view">
|
||||
<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" label-width="auto"
|
||||
:labelStyle="{ color: '#333333', fontSize: '30rpx' }">
|
||||
<u-form-item label="商品名称" prop="name" required >
|
||||
<u--input v-model="form.name" placeholder="请填写商品名称"
|
||||
inputAlign="right" border="none"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="商品编码" prop="code" required >
|
||||
<u--input v-model="form.code" placeholder="请填写商品编码"
|
||||
inputAlign="right" border="none"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="类别" prop="categoryName" required @click="handleShowCategory">
|
||||
<u--input v-model="form.categoryName" 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="unitName" required @click="handleShowUnit">
|
||||
<u--input v-model="form.unitName" 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="ranking" required >
|
||||
<u--input v-model="form.ranking" type="number" placeholder="请填写排序"
|
||||
inputAlign="right" border="none"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="备注" prop="remark" required labelPosition="top">
|
||||
<u--textarea v-model="form.remark" placeholder="请填写备注" border="none" autoHeight inputAlign="right" count
|
||||
maxlength="20000" style="padding:18rpx 0;"></u--textarea>
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
<view class="form-btn">
|
||||
<u-button type="primary" text="提交" @click="submit"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
<u-picker itemHeight="88" :show="showCategory" :columns="categoryList" keyName="dictLabel" @cancel="handleCategoryCancel"
|
||||
@confirm="handleCategoryConfirm"></u-picker>
|
||||
<u-picker itemHeight="88" :show="showUnit" :columns="unitList" keyName="dictLabel" @cancel="handleUnitCancel"
|
||||
@confirm="handleUnitConfirm"></u-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {getProductInfor, addProductInfor, updateProductInfor } from '@/api/invest/ProductInfor'
|
||||
import { getDicts } from '@/api/system/dict/data.js'
|
||||
const { proxy } = getCurrentInstance()
|
||||
import dayjs from 'dayjs'
|
||||
import {onLoad,onReady} from "@dcloudio/uni-app";
|
||||
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
|
||||
import {reactive ,toRefs,ref,computed ,getCurrentInstance }from "vue";
|
||||
const datePickShow = ref(false)
|
||||
const showCategory = ref(false)
|
||||
const showUnit = ref(false)
|
||||
const title = ref("商品信息")
|
||||
const categoryList = ref([])
|
||||
const unitList = ref([])
|
||||
const data = reactive({
|
||||
form: {},
|
||||
rules: {
|
||||
name: [{ type: 'string', required: true, message: '商品名称不能为空', trigger: ['change', 'blur'] }],
|
||||
code: [{ type: 'string', required: true, message: '商品编码不能为空', trigger: ['change', 'blur'] }],
|
||||
unitName: [{ type: 'string', required: true, message: '单位不能为空', trigger: ['change', 'blur'] }],
|
||||
categoryName: [{ type: 'string', required: true, message: '类别不能为空', trigger: ['change', 'blur'] }],
|
||||
}
|
||||
})
|
||||
const { form, rules} = toRefs(data)
|
||||
|
||||
onLoad((option) => {
|
||||
form.value.id = option.id
|
||||
if(form.value.id!=null){
|
||||
title.value="商品信息-修改"
|
||||
}else{
|
||||
title.value="商品信息-新增"
|
||||
form.value.ranking=0
|
||||
}
|
||||
getDict()
|
||||
})
|
||||
onReady(() => {
|
||||
})
|
||||
function getDict() {
|
||||
// 类型
|
||||
getDicts('product_category').then(res => {
|
||||
categoryList.value =[res.data]
|
||||
})
|
||||
// 类型
|
||||
getDicts('product_unit').then(res => {
|
||||
unitList.value =[res.data]
|
||||
})
|
||||
if(form.value.id!=null){
|
||||
getProductInfor(form.value.id).then(res => {
|
||||
form.value = res.data
|
||||
// 类型
|
||||
getDicts('product_category').then(result => {
|
||||
form.value.categoryName=dictStr(form.value.category, result.data)
|
||||
})
|
||||
// 类型
|
||||
getDicts('product_unit').then(result => {
|
||||
form.value.unitName=dictStr(form.value.unit, result.data)
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
function dictStr(val, arr) {
|
||||
let str = ''
|
||||
arr.map(item => {
|
||||
if (item.dictValue === val) {
|
||||
str = item.dictLabel
|
||||
}
|
||||
})
|
||||
return str
|
||||
}
|
||||
|
||||
function handleShowCategory() {
|
||||
if (categoryList.value[0].length === 0) {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '类别为空 ', type: 'warning'
|
||||
})
|
||||
} else {
|
||||
showCategory.value = true
|
||||
}
|
||||
}
|
||||
function handleCategoryConfirm(e) {
|
||||
form.value.categoryName = e.value[0].dictLabel
|
||||
form.value.category = e.value[0].dictValue
|
||||
showCategory.value = false
|
||||
}
|
||||
function handleCategoryCancel() {
|
||||
showCategory.value = false
|
||||
}
|
||||
|
||||
function handleShowUnit() {
|
||||
if (unitList.value[0].length === 0) {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '单位为空 ', type: 'warning'
|
||||
})
|
||||
} else {
|
||||
showUnit.value = true
|
||||
}
|
||||
}
|
||||
function handleUnitConfirm(e) {
|
||||
form.value.unitName = e.value[0].dictLabel
|
||||
form.value.unit = e.value[0].dictValue
|
||||
showUnit.value = false
|
||||
}
|
||||
function handleUnitCancel() {
|
||||
showUnit.value = false
|
||||
}
|
||||
function submit() {
|
||||
proxy.$refs['uForm'].validate().then(() => {
|
||||
if (form.value.id != null) {
|
||||
updateProductInfor(form.value).then(res => {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '修改成功', complete() {
|
||||
uni.navigateTo({ url: `/pages/work/product/productInfor/list` })
|
||||
}
|
||||
})
|
||||
})
|
||||
}else {
|
||||
addProductInfor(form.value).then(res => {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '新增成功', complete() {
|
||||
uni.navigateTo({ url: `/pages/work/product/productInfor/list` })
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.section {
|
||||
margin: 24rpx;
|
||||
padding: 16rpx 24rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 8rpx;
|
||||
|
||||
.section-title {
|
||||
width: 360rpx;
|
||||
color: #333333;
|
||||
line-height: 44rpx;
|
||||
font-size: 30rpx;
|
||||
border-left: 6rpx solid #2681FF;
|
||||
padding-left: 26rpx;
|
||||
}
|
||||
|
||||
.form-view {
|
||||
padding: 20rpx 0rpx 0 10rpx;
|
||||
|
||||
.form-btn {
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
99
src/pages/work/product/productInfor/details.vue
Normal file
99
src/pages/work/product/productInfor/details.vue
Normal file
@@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<view class="container" style="paddingBottom:1rpx;">
|
||||
<u-navbar
|
||||
leftIconSize="40rpx"
|
||||
leftIconColor="#333333"
|
||||
title="商品信息详情"
|
||||
>
|
||||
</u-navbar>
|
||||
<view class="section">
|
||||
<u-cell-group>
|
||||
<u-cell title="类别:" titleStyle="font-weight:bolder" :value="detailInfo.category"></u-cell>
|
||||
<u-cell title="商品名称:" titleStyle="font-weight:bolder" :value="detailInfo.name"></u-cell>
|
||||
<u-cell title="商品编码:" titleStyle="font-weight:bolder" center :value="detailInfo.code"> </u-cell>
|
||||
<u-cell title="单位:" titleStyle="font-weight:bolder" :value="detailInfo.unit"></u-cell>
|
||||
<u-cell title="排序:" titleStyle="font-weight:bolder" :value="detailInfo.ranking"></u-cell>
|
||||
<u-cell title="创建时间:" titleStyle="font-weight:bolder" :value="detailInfo.createTime"></u-cell>
|
||||
|
||||
</u-cell-group>
|
||||
</view>
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getProductInfor} from '@/api/invest/productInfor'
|
||||
import { getDicts } from '@/api/system/dict/data.js'
|
||||
import {onLoad} from "@dcloudio/uni-app";
|
||||
import {reactive ,toRefs,ref,computed }from "vue";
|
||||
const id = ref('')
|
||||
const data = reactive({
|
||||
detailInfo: {}
|
||||
})
|
||||
const {detailInfo} = toRefs(data)
|
||||
onLoad((option) => {
|
||||
id.value = option.id
|
||||
getInfo()
|
||||
})
|
||||
function getInfo() {
|
||||
getProductInfor(id.value).then(res => {
|
||||
detailInfo.value = res.data
|
||||
// 类型
|
||||
getDicts('product_category').then(result => {
|
||||
detailInfo.value.category=dictStr(detailInfo.value.category, result.data)
|
||||
})
|
||||
// 类型
|
||||
getDicts('product_unit').then(result => {
|
||||
detailInfo.value.unit=dictStr(detailInfo.value.unit, result.data)
|
||||
})
|
||||
})
|
||||
}
|
||||
function dictStr(val, arr) {
|
||||
let str = ''
|
||||
arr.map(item => {
|
||||
if (item.dictValue === val) {
|
||||
str = item.dictLabel
|
||||
}
|
||||
})
|
||||
return str
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.section {
|
||||
margin: 24rpx;
|
||||
padding: 16rpx 24rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 8rpx;
|
||||
|
||||
.section-title {
|
||||
width: 280rpx;
|
||||
color: #333333;
|
||||
line-height: 44rpx;
|
||||
font-size: 30rpx;
|
||||
border-left: 6rpx solid #2681FF;
|
||||
padding-left: 26rpx;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 647rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: 40rpx;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.img-con {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20rpx
|
||||
}
|
||||
.form-view {
|
||||
padding: 20rpx 0rpx 0 10rpx;
|
||||
|
||||
.form-btn {
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
385
src/pages/work/product/productInfor/list.vue
Normal file
385
src/pages/work/product/productInfor/list.vue
Normal file
@@ -0,0 +1,385 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<u-sticky offsetTop="8rpx" customNavHeight="8rpx">
|
||||
<view class="search-view">
|
||||
<u--input v-model="queryParams.name" border="false" placeholder="请输入商品名称" class="search-input"
|
||||
@blur="searchBlur" suffixIcon="search" suffixIconStyle="color: #909399">
|
||||
</u--input>
|
||||
<u-icon :name="filterPanel ? 'arrow-up-fill' : 'arrow-down-fill'" color="#666666" size="28" label="筛选"
|
||||
labelPos="left" labelSize="32rpx" labelColor="#666666" @click="filterPanel = !filterPanel"></u-icon>
|
||||
<u-icon name="plus-circle-fill" color="#666666" size="28" style="margin-left:10px" label="新增"
|
||||
labelPos="left" labelSize="32rpx" labelColor="#666666" @click="handleAdd()"></u-icon>
|
||||
<u-transition :show="filterPanel" mode="fade">
|
||||
<view class="filter-panel" :style="{ height: `${windowHeight - 42}px` }">
|
||||
<view class="filter-panel-content">
|
||||
<view class="filter-title">类别</view>
|
||||
<view class="state-list">
|
||||
<view v-for="item in productTypeList" :key="item.id" class="state-item"
|
||||
:class="item.selected ? 'active' : ''" @click="selectStatus(item)">{{ item.dictLabel }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<u-button text="重置" style="margin-right:20rpx" @click="resetQuery()"></u-button>
|
||||
<u-button type="primary" text="确定" @click="searchSubmit()"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</u-transition>
|
||||
</view>
|
||||
</u-sticky>
|
||||
<u-list @scrolltolower="loadmore" :spaceHeight="116" lowerThreshold="100">
|
||||
<u-list-item v-for="(item, index) in listData" :key="index">
|
||||
<view class="list-item">
|
||||
<view class="item-header" @click="enterDetails(item)">
|
||||
<u--text suffixIcon="arrow-right" lines="2" 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">{{ item.code }}</text>
|
||||
</view> -->
|
||||
<view class="item-row">
|
||||
<text class="row-label">类别:</text>
|
||||
<text class="row-value">{{ dictStr(item.category, productTypeList) }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">单位:</text>
|
||||
<text class="row-value">{{ dictStr(item.unit, unitList) }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">创建时间:</text>
|
||||
<text class="row-value">{{ item.createTime }}</text>
|
||||
</view>
|
||||
|
||||
<view class="operate" >
|
||||
<!-- <view class="btn filling" @click="enterDetails(item)">查看</view > -->
|
||||
<view class="btn filling" @click="handleEdit(item)">修改</view>
|
||||
<view class="btn filling" @click="handleDelete(item)">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-list-item>
|
||||
<view>
|
||||
</view>
|
||||
<u-loadmore :status="status" loadingIcon="semicircle" height="88" fontSize="32rpx" @loadmore="loadmore" />
|
||||
</u-list>
|
||||
<u-picker itemHeight="88" :show="settingPickShow" :columns="settingColumns" keyName="settingName"
|
||||
@confirm="settingConfirm" @cancel="settingCancel"></u-picker>
|
||||
</view>
|
||||
<!-- 悬停按钮返回工作台-->
|
||||
<suspend></suspend>
|
||||
<refresh></refresh>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { listProductInfor, delProductInfor } from '@/api/invest/productInfor'
|
||||
import { getDicts } from '@/api/system/dict/data.js'
|
||||
import {onLoad,onShow} from "@dcloudio/uni-app";
|
||||
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
|
||||
import {reactive ,toRefs,ref,computed }from "vue";
|
||||
const pageNum = ref(1)
|
||||
const listData = ref([])
|
||||
const isShow = ref(false)
|
||||
const status = ref('loadmore')
|
||||
const productTypeList = ref([])
|
||||
const unitList = ref([])
|
||||
const settingPickShow = ref(false)
|
||||
const settingColumns = ref([])
|
||||
const data = reactive({
|
||||
filterPanel: false,
|
||||
queryParams: {
|
||||
name: '',
|
||||
type: '',
|
||||
}
|
||||
})
|
||||
const { filterPanel, queryParams} = toRefs(data)
|
||||
const windowHeight = computed(() => {
|
||||
uni.getSystemInfoSync().windowHeight - 50
|
||||
})
|
||||
onLoad(() => {
|
||||
getDict()
|
||||
getList()
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
if (isShow.value) {
|
||||
listData.value=[]
|
||||
getList()
|
||||
isShow.value = false
|
||||
}
|
||||
});
|
||||
|
||||
function loadmore() {
|
||||
pageNum.value += 1
|
||||
if (status.value == 'loadmore') {
|
||||
getList()
|
||||
}
|
||||
}
|
||||
function getList() {
|
||||
status.value = 'loading'
|
||||
listProductInfor({ pageSize: 10, pageNum: pageNum.value, ...queryParams.value }).then(res => {
|
||||
listData.value = listData.value.concat(res.rows)
|
||||
if (listData.value.length < res.total) {
|
||||
status.value = 'loadmore'
|
||||
} else {
|
||||
status.value = 'nomore'
|
||||
}
|
||||
}).catch(() => {
|
||||
status.value = 'nomore'
|
||||
})
|
||||
}
|
||||
function getDict() {
|
||||
// 类型
|
||||
getDicts('product_category').then(res => {
|
||||
productTypeList.value = res.data
|
||||
})
|
||||
// 类型
|
||||
getDicts('product_unit').then(res => {
|
||||
unitList.value = res.data
|
||||
})
|
||||
}
|
||||
function settingConfirm(e) {
|
||||
queryParams.value.settingId = e.value[0].settingId
|
||||
queryParams.value.settingName = e.value[0].settingName
|
||||
settingPickShow.value = false
|
||||
}
|
||||
function settingCancel() {
|
||||
settingPickShow.value = false
|
||||
}
|
||||
function dictStr(val, arr) {
|
||||
let str = ''
|
||||
arr.map(item => {
|
||||
if (item.dictValue === val) {
|
||||
str = item.dictLabel
|
||||
}
|
||||
})
|
||||
return str
|
||||
}
|
||||
function selectStatus(item) {
|
||||
queryParams.value.category = item.dictValue
|
||||
productTypeList.value.map(ele => {
|
||||
if (ele.dictValue == item.dictValue) {
|
||||
ele.selected = true
|
||||
Reflect.set(ele, 'selected', true)
|
||||
} else {
|
||||
Reflect.set(ele, 'selected', false)
|
||||
}
|
||||
})
|
||||
}
|
||||
function searchSubmit() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
filterPanel.value = false
|
||||
}
|
||||
function searchBlur() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
}
|
||||
function resetQuery() {
|
||||
queryParams.value.name = '',
|
||||
queryParams.value.category = ''
|
||||
productTypeList.value.map(ele => {
|
||||
Reflect.set(ele, 'selected', false)
|
||||
})
|
||||
}
|
||||
function enterDetails(item) {
|
||||
uni.navigateTo({ url: `/pages/work/product/productInfor/details?id=${item.id}` })
|
||||
}
|
||||
function handleEdit(item) {
|
||||
uni.navigateTo({ url: `/pages/work/product/productInfor/addEdit?id=${item.id}` })
|
||||
isShow.value = true
|
||||
}
|
||||
function handleAdd() {
|
||||
uni.navigateTo({ url: `/pages/work/product/productInfor/addEdit` })
|
||||
isShow.value = true
|
||||
}
|
||||
function handleDelete(item) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '你确定要删除吗',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
delProductInfor(item.id)
|
||||
uni.navigateTo({ url: `/pages/work/product/productInfor/list` })
|
||||
} else if (res.cancel) {
|
||||
console.log('取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.btnAdd {
|
||||
width: 146rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
border-radius: 8rpx;
|
||||
display:float;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-view {
|
||||
padding: 12rpx 32rpx;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.search-input {
|
||||
background: #F5F5F5;
|
||||
color: #333333;
|
||||
margin-right: 36rpx;
|
||||
}
|
||||
|
||||
.filter-panel {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 96rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
|
||||
.filter-panel-content {
|
||||
background-color: #ffff;
|
||||
padding: 0 30rpx 30rpx;
|
||||
|
||||
.filter-title {
|
||||
color: #000000;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.state-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
|
||||
.state-item {
|
||||
width: 210rpx;
|
||||
height: 72rpx;
|
||||
border: 1rpx solid rgba(0, 0, 0, 0.25);
|
||||
border-radius: 72rpx;
|
||||
text-align: center;
|
||||
line-height: 72rpx;
|
||||
margin: 0 20rpx 20rpx 0;
|
||||
font-size: 28rpx;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: rgba(222, 241, 255, 1);
|
||||
border: 1rpx solid rgba(22, 119, 255, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn-box {
|
||||
display: flex;
|
||||
padding: 24rpx 30rpx;
|
||||
background-color: #fff;
|
||||
box-shadow: 0rpx -10rpx 20rpx #EEEEEE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.list-item {
|
||||
margin: 0 24rpx 24rpx;
|
||||
padding: 32rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.item-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 16rpx;
|
||||
|
||||
.status {
|
||||
.status-item {
|
||||
width: 120rpx;
|
||||
height: 44rpx;
|
||||
text-align: center;
|
||||
line-height: 44rpx;
|
||||
border-radius: 4rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.status1 {
|
||||
background: #F0F0F0;
|
||||
color: #8C8C8C;
|
||||
}
|
||||
|
||||
.status2 {
|
||||
background: rgba(38, 129, 255, 0.2);
|
||||
color: #2681FF;
|
||||
}
|
||||
|
||||
.status3 {
|
||||
background: #F7F7F7;
|
||||
color: #2681FF;
|
||||
}
|
||||
|
||||
.status4 {
|
||||
background: rgba(255, 85, 51, 0.2);
|
||||
color: #FF5533;
|
||||
}
|
||||
|
||||
.status5 {
|
||||
background: #F7F7F7;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.status7 {
|
||||
background: rgba(255, 129, 51, 0.2);
|
||||
color: #FF8133;
|
||||
}
|
||||
|
||||
.status8 {
|
||||
background: rgba(65, 217, 165, 0.2);
|
||||
color: #41D9A5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-row {
|
||||
padding: 16rpx 0;
|
||||
|
||||
.row-label {
|
||||
color: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.row-value {
|
||||
color: rgba(0, 0, 0, 0.85)
|
||||
}
|
||||
}
|
||||
|
||||
.operate {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
.btn {
|
||||
width: 146rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
border-radius: 8rpx;
|
||||
margin-left: 5rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.circulation {
|
||||
background: rgba(0, 0, 0, 0.04);
|
||||
margin-right: 24rpx;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.filling {
|
||||
background: #2681FF;
|
||||
border-radius: 8rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
342
src/pages/work/product/productPriceRecord/addEdit.vue
Normal file
342
src/pages/work/product/productPriceRecord/addEdit.vue
Normal file
@@ -0,0 +1,342 @@
|
||||
<template>
|
||||
<view class="container" style="paddingBottom:1rpx;">
|
||||
<u-navbar
|
||||
leftIconSize="40rpx"
|
||||
leftIconColor="#333333"
|
||||
title="物价记录"
|
||||
>
|
||||
</u-navbar>
|
||||
<view class="section">
|
||||
<view class="section-title">{{ title}}</view>
|
||||
<view class="form-view">
|
||||
<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" label-width="auto"
|
||||
:labelStyle="{ color: '#333333', fontSize: '30rpx' }">
|
||||
<u-form-item label="商品类别" prop="categoryName" required @click="handleCategory">
|
||||
<u--input v-model="form.categoryName" 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="productName" required @click="handleProductName">
|
||||
<u--input v-model="form.productName" 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="kind" required >
|
||||
<u--input v-model="form.kind" placeholder="请填写子类别"
|
||||
inputAlign="right" border="none"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="价格" prop="price" required >
|
||||
<u--input v-model="form.price" type="number" placeholder="请填写价格"
|
||||
inputAlign="right" border="none"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="单位" prop="unitName" required @click="handleUnit">
|
||||
<u--input v-model="form.unitName" 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="recordTime" required @click="selectDate()">
|
||||
<u--input v-model="form.recordTime" disabled disabledColor="#ffffff" placeholder="请选择记录时间" inputAlign="right" border="none"></u--input>
|
||||
<u-icon slot="right" name="arrow-right"></u-icon>
|
||||
</u-form-item>
|
||||
<u-form-item label="地点" prop="address" >
|
||||
<u--input v-model="form.address" placeholder="请填写地点"
|
||||
inputAlign="right" border="none"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="商家" prop="merchant" >
|
||||
<u--input v-model="form.merchant" placeholder="请填写商家"
|
||||
inputAlign="right" border="none"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="备注" prop="remark" labelPosition="top">
|
||||
<u--textarea v-model="form.remark" placeholder="请填写备注" border="none" autoHeight inputAlign="right" count
|
||||
maxlength="20000" style="padding:18rpx 0;"></u--textarea>
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
<view class="form-btn">
|
||||
<u-button type="primary" text="提交" @click="submit"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
<u-picker itemHeight="88" :show="showCategory" :columns="categoryTypeList" keyName="dictLabel" @cancel="handleCategoryCancel"
|
||||
@confirm="handleCategoryConfirm"></u-picker>
|
||||
<u-picker itemHeight="88" :show="showProductName" :columns="productNameList" keyName="name" @cancel="handleProductNameCancel"
|
||||
@confirm="handleProductNameConfirm"></u-picker>
|
||||
<u-picker itemHeight="88" :show="showUnit" :columns="unitList" keyName="dictLabel" @cancel="handleUnitCancel"
|
||||
@confirm="handleUnitConfirm"></u-picker>
|
||||
<u-datetime-picker
|
||||
:show="datePickShow"
|
||||
mode="datetime"
|
||||
ref="recordTimeRef"
|
||||
@cancel="datePickShow=false"
|
||||
@confirm="datePickConfirm"
|
||||
itemHeight="88"
|
||||
></u-datetime-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {getProductPriceRecord, addProductPriceRecord, updateProductPriceRecord } from '@/api/invest/productPriceRecord'
|
||||
import { getDicts } from '@/api/system/dict/data.js'
|
||||
import { listProductInfor } from '@/api/invest/productInfor'
|
||||
const { proxy } = getCurrentInstance()
|
||||
import dayjs from 'dayjs'
|
||||
import {onLoad,onReady} from "@dcloudio/uni-app";
|
||||
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
|
||||
import {reactive ,toRefs,ref,computed ,getCurrentInstance }from "vue";
|
||||
const datePickShow = ref(false)
|
||||
|
||||
const showCategory = ref(false)
|
||||
const showProductName = ref(false)
|
||||
const showUnit = ref(false)
|
||||
|
||||
const title = ref("物价记录")
|
||||
const categoryTypeList = ref([])
|
||||
const productNameList = ref([])
|
||||
|
||||
const flag = ref('add')
|
||||
const unitList = ref([])
|
||||
const data = reactive({
|
||||
form: {
|
||||
id: null,
|
||||
productId: null,
|
||||
price: null,
|
||||
recordTime: null,
|
||||
remark: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updatedBy: null,
|
||||
address: null,
|
||||
delFlag: null,
|
||||
merchant: null,
|
||||
fields: null,
|
||||
unit: null,
|
||||
kind: null,
|
||||
category: null
|
||||
},
|
||||
queryProductParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 1000
|
||||
},
|
||||
rules: {
|
||||
categoryName: [{ required: true, message: '商品类别不能为空', trigger:['change', 'blur'] }],
|
||||
productName: [{ required: true, message: '商品名称不能为空', trigger: ['change', 'blur'] }],
|
||||
price: [{type: 'number', required: true, message: '价格不能为空', trigger: ['change', 'blur'] }],
|
||||
unitName: [{ required: true, message: '单位不能为空', trigger:['change', 'blur'] }],
|
||||
kind: [{ required: true, message: '子类别不能为空', trigger: ['change', 'blur'] }],
|
||||
recordTime: [{ required: true, message: '记录时间不能为空', trigger: ['change', 'blur'] }]
|
||||
}
|
||||
})
|
||||
const { form, queryProductParams, rules} = toRefs(data)
|
||||
|
||||
|
||||
onLoad((option) => {
|
||||
form.value.id = option.id
|
||||
if(flag.value==null){
|
||||
if(form.value.id!=null){
|
||||
title.value="物价记录-修改"
|
||||
}else{
|
||||
title.value="物价记录-新增"
|
||||
}
|
||||
}else{
|
||||
title.value="物价记录-复制"
|
||||
}
|
||||
|
||||
})
|
||||
onReady(() => {
|
||||
form.value.recordTime = dayjs(new Date().getTime()).format("YYYY-MM-DD HH:mm:ss")
|
||||
getData()
|
||||
})
|
||||
function getData() {
|
||||
|
||||
// 类型
|
||||
getDicts('product_category').then(res => {
|
||||
categoryTypeList.value =[res.data]
|
||||
})
|
||||
// 类型
|
||||
getDicts('product_unit').then(res => {
|
||||
unitList.value =[res.data]
|
||||
})
|
||||
|
||||
listProductInfor(queryProductParams.value).then((response) => {
|
||||
productNameList.value = [response.rows]
|
||||
})
|
||||
|
||||
// 记账类型
|
||||
getDicts('product_category').then(result => {
|
||||
form.value.categoryName=dictStr(form.value.category, result.data)
|
||||
})
|
||||
// 交易类型
|
||||
getDicts('product_unit').then(result => {
|
||||
form.value.unitName=dictStr(form.value.unit, result.data)
|
||||
})
|
||||
|
||||
if(form.value.id!=null){
|
||||
getProductPriceRecord(form.value.id).then(res => {
|
||||
form.value = res.data
|
||||
|
||||
// 记账类型
|
||||
getDicts('product_category').then(result => {
|
||||
form.value.categoryName=dictStr(form.value.category, result.data)
|
||||
})
|
||||
// 交易类型
|
||||
getDicts('product_unit').then(result => {
|
||||
form.value.unitName=dictStr(form.value.unit, result.data)
|
||||
})
|
||||
|
||||
queryProductParams.value.category = form.value.category
|
||||
listProductInfor(queryProductParams.value).then((response) => {
|
||||
productNameList.value = [response.rows]
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
function dictStr(val, arr) {
|
||||
let str = ''
|
||||
arr.map(item => {
|
||||
if (item.dictValue === val) {
|
||||
str = item.dictLabel
|
||||
}
|
||||
})
|
||||
return str
|
||||
}
|
||||
|
||||
function handleCategory() {
|
||||
if (categoryTypeList.value[0].length === 0) {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '商品类别为空 ', type: 'warning'
|
||||
})
|
||||
} else {
|
||||
showCategory.value = true
|
||||
}
|
||||
}
|
||||
function handleCategoryConfirm(e) {
|
||||
form.value.categoryName = e.value[0].dictLabel
|
||||
form.value.category = e.value[0].dictValue
|
||||
queryProductParams.value.category = form.value.category
|
||||
form.value.productId = null
|
||||
form.value.productName = null
|
||||
form.value.kind = null
|
||||
form.value.unit = null
|
||||
form.value.unitName = null
|
||||
form.value.price = null
|
||||
listProductInfor(queryProductParams.value).then((response) => {
|
||||
productNameList.value = [response.rows]
|
||||
})
|
||||
|
||||
|
||||
showCategory.value = false
|
||||
|
||||
}
|
||||
function handleCategoryCancel() {
|
||||
showCategory.value = false
|
||||
}
|
||||
function handleProductName() {
|
||||
if (productNameList.value[0].length === 0) {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '商品名称为空 ', type: 'warning'
|
||||
})
|
||||
} else {
|
||||
showProductName.value = true
|
||||
}
|
||||
}
|
||||
function handleProductNameConfirm(e) {
|
||||
form.value.productName = e.value[0].name
|
||||
form.value.kind = e.value[0].name
|
||||
form.value.productId = e.value[0].id
|
||||
form.value.unit = e.value[0].unit
|
||||
// 单位
|
||||
getDicts('product_unit').then(result => {
|
||||
form.value.unitName=dictStr( form.value.unit, result.data)
|
||||
})
|
||||
showProductName.value = false
|
||||
}
|
||||
function handleProductNameCancel() {
|
||||
showProductName.value = false
|
||||
}
|
||||
|
||||
|
||||
function handleUnit() {
|
||||
if (unitList.value[0].length === 0) {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '单位为空 ', type: 'warning'
|
||||
})
|
||||
} else {
|
||||
showUnit.value = true
|
||||
}
|
||||
}
|
||||
function handleUnitConfirm(e) {
|
||||
form.value.unitName = e.value[0].dictLabel
|
||||
form.value.unit = e.value[0].dictValue
|
||||
showUnit.value = false
|
||||
}
|
||||
function handleUnitCancel() {
|
||||
showUnit.value = false
|
||||
}
|
||||
function selectDate() {
|
||||
datePickShow.value = true
|
||||
proxy.$refs['recordTimeRef'].innerValue = new Date().getTime()
|
||||
}
|
||||
function datePickConfirm(e) {
|
||||
form.value.recordTime = dayjs(e.value).format("YYYY-MM-DD HH:mm:ss")
|
||||
datePickShow.value = false
|
||||
}
|
||||
function submit() {
|
||||
proxy.$refs['uForm'].validate().then(() => {
|
||||
if (form.value.id != null) {
|
||||
if(flag.value==null){
|
||||
updateProductPriceRecord(form.value).then(res => {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '修改成功', complete() {
|
||||
uni.navigateTo({ url: `/pages/work/product/productPriceRecord/list` })
|
||||
}
|
||||
})
|
||||
})
|
||||
}else {
|
||||
form.value.id == null
|
||||
addProductPriceRecord(form.value).then(res => {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '新增成功', complete() {
|
||||
uni.navigateTo({ url: `/pages/work/product/productPriceRecord/list` })
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}else {
|
||||
addProductPriceRecord(form.value).then(res => {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '新增成功', complete() {
|
||||
uni.navigateTo({ url: `/pages/work/product/productPriceRecord/list` })
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.section {
|
||||
margin: 24rpx;
|
||||
padding: 16rpx 24rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 8rpx;
|
||||
|
||||
.section-title {
|
||||
width: 360rpx;
|
||||
color: #333333;
|
||||
line-height: 44rpx;
|
||||
font-size: 30rpx;
|
||||
border-left: 6rpx solid #2681FF;
|
||||
padding-left: 26rpx;
|
||||
}
|
||||
|
||||
.form-view {
|
||||
padding: 20rpx 0rpx 0 10rpx;
|
||||
|
||||
.form-btn {
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
456
src/pages/work/product/productPriceRecord/list.vue
Normal file
456
src/pages/work/product/productPriceRecord/list.vue
Normal file
@@ -0,0 +1,456 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<u-sticky offsetTop="8rpx" customNavHeight="8rpx">
|
||||
<view class="search-view">
|
||||
<u--input v-model="queryParams.kind" border="false" placeholder="请输入商品名称" class="search-input"
|
||||
@blur="searchBlur" suffixIcon="search" suffixIconStyle="color: #909399">
|
||||
</u--input>
|
||||
<u-icon :name="filterPanel ? 'arrow-up-fill' : 'arrow-down-fill'" color="#666666" size="28" label="筛选"
|
||||
labelPos="left" labelSize="32rpx" labelColor="#666666" @click="filterPanel = !filterPanel"></u-icon>
|
||||
<u-icon name="plus-circle-fill" color="#666666" size="28" style="margin-left:10px" label="新增"
|
||||
labelPos="left" labelSize="32rpx" labelColor="#666666" @click="handleAdd()"></u-icon>
|
||||
<u-transition :show="filterPanel" mode="fade">
|
||||
<view class="filter-panel" :style="{ height: `${windowHeight - 42}px` }">
|
||||
<view class="filter-panel-content">
|
||||
<view class="filter-title">类别</view>
|
||||
<view class="state-list">
|
||||
<view v-for="item in productTypeList" :key="item.id" class="state-item"
|
||||
:class="item.selected ? 'active' : ''" @click="selectStatus(item)">{{ item.dictLabel }}</view>
|
||||
</view>
|
||||
<view class="select-header">记录日期</view>
|
||||
<view class="selcet-content" style="padding: 0 24rpx">
|
||||
<u-input
|
||||
:disabled="true"
|
||||
:disabledColor="'#fff'"
|
||||
class="dateInput"
|
||||
border="surround"
|
||||
v-model="queryParams.startTime"
|
||||
placeholder="请选择开始时间"
|
||||
>
|
||||
<template v-slot:suffix>
|
||||
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon>
|
||||
</template>
|
||||
</u-input>
|
||||
<u-input
|
||||
:disabled="true"
|
||||
:disabledColor="'#fff'"
|
||||
class="dateInput"
|
||||
border="surround"
|
||||
v-model="queryParams.endTime"
|
||||
placeholder="请选择结束时间"
|
||||
>
|
||||
<template v-slot:suffix>
|
||||
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon>
|
||||
</template>
|
||||
</u-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<u-button text="重置" style="margin-right:20rpx" @click="resetQuery()"></u-button>
|
||||
<u-button type="primary" text="确定" @click="searchSubmit()"></u-button>
|
||||
</view>
|
||||
<u-datetime-picker
|
||||
:closeOnClickOverlay="true"
|
||||
:show="timeShow"
|
||||
v-model="time"
|
||||
mode="date"
|
||||
:minDate="-2209017600000"
|
||||
@close="openOrCloseDate"
|
||||
@cancel="openOrCloseDate"
|
||||
@confirm="confirm"
|
||||
></u-datetime-picker>
|
||||
</view>
|
||||
</u-transition>
|
||||
</view>
|
||||
</u-sticky>
|
||||
<u-list @scrolltolower="loadmore" :spaceHeight="116" lowerThreshold="100">
|
||||
<u-list-item v-for="(item, index) in listData" :key="index">
|
||||
<view class="list-item">
|
||||
<view class="item-header">
|
||||
<u--text lines="2" iconStyle="font-size: 18px; color: #333333; font-weight:bold"
|
||||
:text="item.kind+' 价格:'+item.price+' 元/'+dictStr(item.unit, unitList)" size="30rpx" color="#333333" :bold="true"></u--text>
|
||||
</view>
|
||||
<!-- <view class="item-row">
|
||||
<text class="row-label">商品编码:</text>
|
||||
<text class="row-value">{{ item.code }}</text>
|
||||
</view> -->
|
||||
<view class="item-row">
|
||||
<text class="row-label">类别:</text>
|
||||
<text class="row-value">{{ dictStr(item.category, productTypeList) }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">记录时间:</text>
|
||||
<text class="row-value">{{ item.recordTime }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">地点:</text>
|
||||
<text class="row-value">{{ item.address }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">商家:</text>
|
||||
<text class="row-value">{{ item.merchant }}</text>
|
||||
</view>
|
||||
|
||||
<view class="operate" >
|
||||
<!-- <view class="btn filling" @click="enterDetails(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>
|
||||
</view>
|
||||
</u-list-item>
|
||||
<view>
|
||||
</view>
|
||||
<u-loadmore :status="status" loadingIcon="semicircle" height="88" fontSize="32rpx" @loadmore="loadmore" />
|
||||
</u-list>
|
||||
<u-picker itemHeight="88" :show="settingPickShow" :columns="settingColumns" keyName="settingName"
|
||||
@confirm="settingConfirm" @cancel="settingCancel"></u-picker>
|
||||
</view>
|
||||
<!-- 悬停按钮返回工作台-->
|
||||
<suspend></suspend>
|
||||
<refresh></refresh>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { listProductPriceRecord, delProductPriceRecord } from '@/api/invest/productPriceRecord'
|
||||
import { getDicts } from '@/api/system/dict/data.js'
|
||||
import {onLoad,onShow} from "@dcloudio/uni-app";
|
||||
import { timeHandler } from '@/utils/common.ts'
|
||||
import dayjs from 'dayjs'
|
||||
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
|
||||
import {reactive ,toRefs,ref,computed }from "vue";
|
||||
const pageNum = ref(1)
|
||||
const listData = ref([])
|
||||
const isShow = ref(false)
|
||||
const status = ref('loadmore')
|
||||
const productTypeList = ref([])
|
||||
const unitList = ref([])
|
||||
const settingPickShow = ref(false)
|
||||
const settingColumns = ref([])
|
||||
|
||||
const timeShow= ref(false)
|
||||
const flag= ref(true)
|
||||
const time =ref( Number(new Date()))
|
||||
const data = reactive({
|
||||
filterPanel: false,
|
||||
queryParams: {
|
||||
kind: '',
|
||||
type: '',
|
||||
}
|
||||
})
|
||||
const { filterPanel, queryParams} = toRefs(data)
|
||||
const windowHeight = computed(() => {
|
||||
uni.getSystemInfoSync().windowHeight - 50
|
||||
})
|
||||
onLoad(() => {
|
||||
getDict()
|
||||
getList()
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
if (isShow.value) {
|
||||
listData.value=[]
|
||||
getList()
|
||||
isShow.value = false
|
||||
}
|
||||
});
|
||||
|
||||
function loadmore() {
|
||||
pageNum.value += 1
|
||||
if (status.value == 'loadmore') {
|
||||
getList()
|
||||
}
|
||||
}
|
||||
function getList() {
|
||||
status.value = 'loading'
|
||||
listProductPriceRecord({ pageSize: 10, pageNum: pageNum.value, ...queryParams.value }).then(res => {
|
||||
listData.value = listData.value.concat(res.rows)
|
||||
if (listData.value.length < res.total) {
|
||||
status.value = 'loadmore'
|
||||
} else {
|
||||
status.value = 'nomore'
|
||||
}
|
||||
}).catch(() => {
|
||||
status.value = 'nomore'
|
||||
})
|
||||
}
|
||||
function openOrCloseDate(data) {
|
||||
timeShow.value = !timeShow.value
|
||||
flag.value = data
|
||||
}
|
||||
function getDict() {
|
||||
// 类型
|
||||
getDicts('product_category').then(res => {
|
||||
productTypeList.value = res.data
|
||||
})
|
||||
// 类型
|
||||
getDicts('product_unit').then(res => {
|
||||
unitList.value = res.data
|
||||
})
|
||||
}
|
||||
function settingConfirm(e) {
|
||||
queryParams.value.settingId = e.value[0].settingId
|
||||
queryParams.value.settingName = e.value[0].settingName
|
||||
settingPickShow.value = false
|
||||
}
|
||||
function settingCancel() {
|
||||
settingPickShow.value = false
|
||||
}
|
||||
function dictStr(val, arr) {
|
||||
let str = ''
|
||||
arr.map(item => {
|
||||
if (item.dictValue === val) {
|
||||
str = item.dictLabel
|
||||
}
|
||||
})
|
||||
return str
|
||||
}
|
||||
function selectStatus(item) {
|
||||
queryParams.value.category = item.dictValue
|
||||
productTypeList.value.map(ele => {
|
||||
if (ele.dictValue == item.dictValue) {
|
||||
ele.selected = true
|
||||
Reflect.set(ele, 'selected', true)
|
||||
} else {
|
||||
Reflect.set(ele, 'selected', false)
|
||||
}
|
||||
})
|
||||
}
|
||||
function searchSubmit() {
|
||||
if(queryParams.value.startTime!=''&&queryParams.value.startTime!=undefined&&queryParams.value.endTime!=''&&queryParams.value.endTime!=undefined){
|
||||
queryParams.value.time = queryParams.value.startTime+'-'+queryParams.value.endTime
|
||||
}
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
filterPanel.value = false
|
||||
}
|
||||
function searchBlur() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
}
|
||||
function confirm(e) {
|
||||
const date = timeHandler(new Date(e.value), '-', ':')
|
||||
let formatValue = 'YYYY-MM-DD'
|
||||
dayjs(date).format(formatValue)
|
||||
if (flag.value) {
|
||||
queryParams.value.startTime = dayjs(date).format(formatValue)
|
||||
} else {
|
||||
queryParams.value.endTime = dayjs(date).format(formatValue)
|
||||
}
|
||||
timeShow.value = false
|
||||
}
|
||||
function resetQuery() {
|
||||
queryParams.value.kind = '',
|
||||
queryParams.value.category = ''
|
||||
queryParams.value.time = ''
|
||||
queryParams.value.startTime = ''
|
||||
queryParams.value.endTime = ''
|
||||
productTypeList.value.map(ele => {
|
||||
Reflect.set(ele, 'selected', false)
|
||||
})
|
||||
}
|
||||
function handleEdit(item) {
|
||||
uni.navigateTo({ url: `/pages/work/product/productPriceRecord/addEdit?id=${item.id}` })
|
||||
isShow.value = true
|
||||
}
|
||||
|
||||
function handleCopy(item) {
|
||||
uni.navigateTo({ url: `/pages/work/product/productPriceRecord/addEdit?flag=copy&id=${item.id}` })
|
||||
isShow.value = true
|
||||
}
|
||||
function handleAdd() {
|
||||
uni.navigateTo({ url: `/pages/work/product/productPriceRecord/addEdit` })
|
||||
isShow.value = true
|
||||
}
|
||||
function handleDelete(item) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '你确定要删除吗',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
delProductPriceRecord(item.id)
|
||||
uni.navigateTo({ url: `/pages/work/product/productPriceRecord/list` })
|
||||
} else if (res.cancel) {
|
||||
console.log('取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.btnAdd {
|
||||
width: 146rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
border-radius: 8rpx;
|
||||
display:float;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-view {
|
||||
padding: 12rpx 32rpx;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.search-input {
|
||||
background: #F5F5F5;
|
||||
color: #333333;
|
||||
margin-right: 36rpx;
|
||||
}
|
||||
|
||||
.filter-panel {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 96rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
|
||||
.filter-panel-content {
|
||||
background-color: #ffff;
|
||||
padding: 0 30rpx 30rpx;
|
||||
|
||||
.filter-title {
|
||||
color: #000000;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.state-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
|
||||
.state-item {
|
||||
width: 210rpx;
|
||||
height: 72rpx;
|
||||
border: 1rpx solid rgba(0, 0, 0, 0.25);
|
||||
border-radius: 72rpx;
|
||||
text-align: center;
|
||||
line-height: 72rpx;
|
||||
margin: 0 20rpx 20rpx 0;
|
||||
font-size: 28rpx;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: rgba(222, 241, 255, 1);
|
||||
border: 1rpx solid rgba(22, 119, 255, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn-box {
|
||||
display: flex;
|
||||
padding: 24rpx 30rpx;
|
||||
background-color: #fff;
|
||||
box-shadow: 0rpx -10rpx 20rpx #EEEEEE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.list-item {
|
||||
margin: 0 24rpx 24rpx;
|
||||
padding: 32rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.item-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 16rpx;
|
||||
|
||||
.status {
|
||||
.status-item {
|
||||
width: 120rpx;
|
||||
height: 44rpx;
|
||||
text-align: center;
|
||||
line-height: 44rpx;
|
||||
border-radius: 4rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.status1 {
|
||||
background: #F0F0F0;
|
||||
color: #8C8C8C;
|
||||
}
|
||||
|
||||
.status2 {
|
||||
background: rgba(38, 129, 255, 0.2);
|
||||
color: #2681FF;
|
||||
}
|
||||
|
||||
.status3 {
|
||||
background: #F7F7F7;
|
||||
color: #2681FF;
|
||||
}
|
||||
|
||||
.status4 {
|
||||
background: rgba(255, 85, 51, 0.2);
|
||||
color: #FF5533;
|
||||
}
|
||||
|
||||
.status5 {
|
||||
background: #F7F7F7;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.status7 {
|
||||
background: rgba(255, 129, 51, 0.2);
|
||||
color: #FF8133;
|
||||
}
|
||||
|
||||
.status8 {
|
||||
background: rgba(65, 217, 165, 0.2);
|
||||
color: #41D9A5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-row {
|
||||
padding: 16rpx 0;
|
||||
|
||||
.row-label {
|
||||
color: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.row-value {
|
||||
color: rgba(0, 0, 0, 0.85)
|
||||
}
|
||||
}
|
||||
|
||||
.operate {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
.btn {
|
||||
width: 146rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
border-radius: 8rpx;
|
||||
margin-left: 5rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.circulation {
|
||||
background: rgba(0, 0, 0, 0.04);
|
||||
margin-right: 24rpx;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.filling {
|
||||
background: #2681FF;
|
||||
border-radius: 8rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user