问题清单修复

This commit is contained in:
BianLzhaoMin 2024-12-26 21:57:55 +08:00
parent 3e5232c296
commit e48e6d1025
11 changed files with 244 additions and 57 deletions

View File

@ -76,6 +76,7 @@
"router": {
"base": "/h5/",
"mode": "history"
}
},
"title": "安徽机具租赁商城"
}
}

View File

@ -23,25 +23,45 @@
<view class="goods-items">
<view class="filter-box">
<view class="filter-items">
<!-- <view class="filter-items">
使用年限
<view class="filter-type">
<van-icon name="play" size="12" />
<van-icon name="play" size="12" />
</view>
</view>
</view> -->
<view class="filter-items">
租金
<view class="filter-type">
<van-icon name="play" size="12" />
<van-icon name="play" size="12" />
<van-icon
name="play"
:color="searchParams.dayLeasePriceOrderBy === 'ASC' ? '#00a288' : ''"
@click="onClickPrice('ASC')"
size="12"
/>
<van-icon
name="play"
:color="searchParams.dayLeasePriceOrderBy === 'DESC' ? '#00a288' : ''"
@click="onClickPrice('DESC')"
size="12"
/>
</view>
</view>
<view class="filter-items">
上架时间
<view class="filter-type">
<van-icon name="play" size="12" />
<van-icon name="play" size="12" />
<van-icon
name="play"
:color="searchParams.updateTimeOrderBy === 'ASC' ? '#00a288' : ''"
@click="onClickTime('ASC')"
size="12"
/>
<van-icon
name="play"
:color="searchParams.updateTimeOrderBy === 'DESC' ? '#00a288' : ''"
@click="onClickTime('DESC')"
size="12"
/>
</view>
</view>
</view>
@ -62,11 +82,22 @@
<GoodsItems :goodsInfo="item" />
</van-grid-item>
</van-grid>
<view class="loading-text">
{{ finish ? '没有更多数据了~' : '正在加载...' }}
</view>
</scroll-view>
<van-popup position="bottom" v-model:show="showBottom" :style="{ height: '60%' }">
<view class="filter-bottom">
<view style="text-align: right; padding: 4px 8px">
<view
style="text-align: right; padding: 4px 8px"
@click="
() => {
showBottom = false
}
"
>
<van-icon name="close" color="#575B66" size="20" />
</view>
<view
@ -94,9 +125,10 @@
<view> {{ selectList[activeSelect].selectName }} </view>
<view class="btns">
<view
class="active_btn"
:class="{ active_btn: item.isChecked }"
v-for="(item, index) in selectList[activeSelect].val_list"
:key="index"
@click="onClickTags(item)"
>
{{ item.name }}
</view>
@ -112,13 +144,32 @@
<script setup>
import GoodsItems from '@/components/GoodsItems'
import SearchIpt from '@/components/SearchIpt/index'
import Navbar from '@/components/Navbar/index'
import { getDeviceListAPI } from '@/services/index/index.js'
import { getTypeListAPI } from '@/services/common/index.js'
import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { useMemberStore } from '@/stores/index.js'
const memberStore = useMemberStore()
const activeSelect = ref(0)
const showBottom = ref(false)
const deviceList = ref([])
const total = ref(0)
import { debounce } from 'lodash-es'
const searchParams = ref({
keyWord: '',
ageMin: '',
ageMax: '',
companyId: '',
dayLeasePriceMin: '',
dayLeasePriceMax: '',
typeId: '',
level: '',
maStatus: 2,
pageNum: 1,
pageSize: 10,
updateTimeOrderBy: '',
dayLeasePriceOrderBy: '',
})
const selectList = ref([
{
selectName: '使用年限',
@ -126,10 +177,32 @@ const selectList = ref([
{
name: '全部',
value: '',
isChecked: true,
},
{
name: '0-1年',
value: [0, 1],
isChecked: false,
},
{
name: '1-3年',
value: [1, 3],
isChecked: false,
},
{
name: '3-5年',
value: [3, 5],
isChecked: false,
},
{
name: '5-8年',
value: [5, 8],
isChecked: false,
},
{
name: '10年以上',
value: ['', 10],
isChecked: false,
},
],
},
@ -139,36 +212,43 @@ const selectList = ref([
{
name: '全部',
value: '',
},
{
name: '0-1年',
value: [0, 1],
},
],
},
{
selectName: '下级分类',
val_list: [
{
name: '全部',
value: '',
},
{
name: '0-1年',
value: [0, 1],
isChecked: true,
},
],
},
{
selectName: '价格区间',
val_list: [
{
name: '全部',
value: '',
isChecked: true,
},
{
name: '0-1年',
value: [0, 1],
name: '0-500',
value: [0, 500],
isChecked: false,
},
{
name: '500-1000',
value: [500, 1000],
isChecked: false,
},
{
name: '1000-500',
value: [1000, 1500],
isChecked: false,
},
{
name: '1500-2000',
value: [1500, 2000],
isChecked: false,
},
{
name: '2000-2500',
value: [2000, 2500],
isChecked: false,
},
],
},
@ -178,25 +258,97 @@ const selectList = ref([
{
name: '全部',
value: '',
},
{
name: '0-1年',
value: [0, 1],
isChecked: true,
},
],
},
])
const onScrollTolower = () => {
console.log('滚动触底')
}
const getDeviceListData = async () => {
const { data: result } = await getDeviceListAPI({})
deviceList.value = result.rows
//
const finish = computed(() => {
if (total.value === deviceList.value.length) return true
})
const onScrollTolower = debounce(() => {
if (total.value > deviceList.value.length) {
searchParams.value.pageNum++
getDeviceListData()
}
}, 500)
//
const getDeviceListData = async (isTap = false) => {
if (isTap) searchParams.value.pageNum = 1
const { data: result } = await getDeviceListAPI(searchParams.value)
total.value = result.total
if (isTap) {
deviceList.value = result.rows
} else {
if (result.rows.length == 0) {
deviceList.value = []
} else {
deviceList.value.push(...result.rows)
}
}
}
const onViewGoodsDetails = (item) => {
uni.navigateTo({ url: `/pages/goods-details/index?id=${item.maId}` })
}
//
const getTypeListData = async () => {
const { data: res } = await getTypeListAPI()
const typeList = res.map((e) => {
return { ...e, name: e.typeName, value: e.typeId, isChecked: false }
})
selectList.value[1].val_list.push(...typeList)
}
//
const onClickTags = (item) => {
selectList.value[activeSelect.value].val_list.forEach((e) => {
e.isChecked = false
})
item.isChecked = true
if (activeSelect.value == 0) {
if (item.value == '') {
searchParams.value.ageMin = ''
searchParams.value.ageMax = ''
} else {
searchParams.value.ageMin = item.value[0]
searchParams.value.ageMax = item.value[1]
}
}
if (activeSelect.value == 1) {
searchParams.value.typeId = item.value
searchParams.value.level = item.value ? 1 : ''
}
if (activeSelect.value == 2) {
if (item.value == '') {
searchParams.value.dayLeasePriceMin = ''
searchParams.value.dayLeasePriceMax = ''
} else {
searchParams.value.dayLeasePriceMin = item.value[0]
searchParams.value.dayLeasePriceMax = item.value[1]
}
}
if (activeSelect.value == 3) {
searchParams.value.companyId = item.value
}
getDeviceListData(true)
}
//
const onClickPrice = (type) => {
searchParams.value.dayLeasePriceOrderBy = type
getDeviceListData(true)
}
//
const onClickTime = (type) => {
searchParams.value.updateTimeOrderBy = type
getDeviceListData(true)
}
const onSearchByType = (value, type) => {
/**
* @type 1 查询机具 2 查询需求
@ -207,7 +359,8 @@ const onSearchByType = (value, type) => {
url: `/pages/lease-demand/index?value=${value}`,
})
} else {
getDeviceListData()
searchParams.value.keyWord = value
getDeviceListData(true)
}
}
const onClickLeft = () => {
@ -220,7 +373,12 @@ const onFilter = () => {
showBottom.value = true
}
onLoad(() => {
getDeviceListData()
getDeviceListData(true)
getTypeListData()
const companyList = memberStore.companyList.map((e) => {
return { ...e, name: e.companyName, value: e.companyId, isChecked: false }
})
selectList.value[3].val_list.push(...companyList)
})
</script>
@ -332,10 +490,12 @@ onLoad(() => {
flex-wrap: wrap;
margin-top: 15px;
view {
width: calc((100% - 20px) / 3);
min-width: calc((100% - 20px) / 3);
padding: 0 8px;
box-sizing: border-box;
margin-bottom: 10px;
margin-right: 10px;
height: 28px;
min-height: 28px;
line-height: 28px;
text-align: center;
border-radius: 14px;

View File

@ -12,7 +12,7 @@
"
>
<view>
<van-icon name="arrow-left" @click="onClickLeft" />
<!-- <van-icon name="arrow-left" @click="onClickLeft" /> -->
<text style="color: #000"> 需求共享大厅 </text>
</view>
</view>

View File

@ -15,7 +15,8 @@
</template>
<script setup>
import { ref } from 'vue'
import { useMemberStore } from '@/stores/index.js'
const memberStore = useMemberStore()
const onClickLeft = () => {
uni.navigateBack()
}
@ -36,7 +37,10 @@ const onLogOut = () => {
})
.then(async () => {
//
uni.navigateTo({ url: '/pages/login/index' })
uni.clearStorageSync()
uni.clearStorage()
// memberStore.clearUserInfo()
uni.reLaunch({ url: '/pages/login/index' })
})
.catch(() => {})
}

View File

@ -12,7 +12,7 @@
fit="cover"
width="68px"
height="68px"
src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg"
:src="memberStore.userInfo.avatar"
/>
<view class="right-name">

View File

@ -488,6 +488,7 @@ const onReturnRepair = (item) => {
submitParams.value.code = code
submitParams.value.orderId = orderId
editOrderDetailsAPI({ orderId }).then(async (result) => {
console.log(result, 'resultresultresult')
repairList.value = result.data.detailsList.map((e) => {
//
const repairRecord = {
@ -532,7 +533,7 @@ const onReturnRepair = (item) => {
const { repairRecordList, scrapRecordList, lossRecordList, fileInfoList } = res
if (repairRecordList.length > 0) {
if (repairRecordList?.length > 0) {
repairRecordList.forEach((e) => {
repairList.value.forEach((j) => {
if (e.maId == j.repairRecord.maId) {
@ -541,7 +542,7 @@ const onReturnRepair = (item) => {
})
})
}
if (scrapRecordList.length > 0) {
if (scrapRecordList?.length > 0) {
scrapRecordList.forEach((e) => {
repairList.value.forEach((j) => {
if (e.maId == j.scrapRecord.maId) {
@ -550,7 +551,7 @@ const onReturnRepair = (item) => {
})
})
}
if (lossRecordList.length > 0) {
if (lossRecordList?.length > 0) {
lossRecordList.forEach((e) => {
repairList.value.forEach((j) => {
if (e.maId == j.lossRecord.maId) {
@ -560,7 +561,7 @@ const onReturnRepair = (item) => {
})
}
if (fileInfoList.length > 0) {
if (fileInfoList?.length > 0) {
fileInfoList.forEach((e) => {
e.name = e.fileName
e.url = e.fileUrl

View File

@ -191,9 +191,7 @@ const onSubmitOrder = async () => {
if (res.code === 200) {
showSuccessToast('提交成功')
setTimeout(() => {
uni.navigateTo({
url: '/pages/goods-list/index',
})
uni.redirectTo({ url: `/pages/order-details/index?type=2` })
}, 500)
}
}

View File

@ -19,3 +19,13 @@ export const fileUploadAPI = (data) => {
data,
})
}
/**
* 装备 获取分类
*/
export const getTypeListAPI = () => {
return http({
method: 'GET',
url: `/material-mall/maType/getTypeList`,
})
}

View File

@ -18,6 +18,10 @@ export const useMemberStore = defineStore(
// 清除用户信息
const clearUserInfo = () => {
userInfo.value = undefined
token.value = ''
userType.value = 1
companyList.value = []
userCompanyName.value = ''
}
// 存储 token
const setToken = (val) => {

View File

@ -34,6 +34,15 @@
padding: 4px 0;
}
// 加载提示文字
.loading-text {
text-align: center;
font-size: 28rpx;
color: #666;
padding: 20rpx 0;
}
// :root {
// --van-primary-color:#00a288;
// }

View File

@ -32,10 +32,10 @@ export default defineConfig({
proxy: {
// 在此处编写代理规则
'/api': {
// target: 'http://36.33.26.201:17788/proxyApi',
target: 'http://36.33.26.201:17788/proxyApi',
// target: 'http://192.168.2.123:28080',
// target: 'http://192.168.2.122:28080',
target: 'http://192.168.0.244:28580', // 测试服务
// target: 'http://192.168.0.244:28580', // 测试服务
changeOrigin: true,
rewrite: (path) => {
return path.replace(/\/api/, '')