Compare commits

...

3 Commits

Author SHA1 Message Date
BianLzhaoMin dde2f506b2 首页等问题修复 2024-12-27 14:05:38 +08:00
BianLzhaoMin 89f2ab9a0b 问题清单修复 2024-12-26 22:09:57 +08:00
BianLzhaoMin e48e6d1025 问题清单修复 2024-12-26 21:57:55 +08:00
16 changed files with 813 additions and 131 deletions

View File

@ -9,7 +9,7 @@
}
"
>
{{ activeTypeName }}
{{ props.activeTypeName }}
<van-icon name="arrow-down" />
<view class="check-item" v-if="isSelectShow">
@ -17,6 +17,8 @@
@click.stop="
() => {
activeTypeName = '机具'
// emits('update:activeTypeName', '')
isSelectShow = !isSelectShow
}
"
@ -27,6 +29,7 @@
@click.stop="
() => {
activeTypeName = '需求'
// emits('update:activeTypeName', '')
isSelectShow = !isSelectShow
}
"
@ -35,20 +38,52 @@
</view>
</view>
</view>
<van-field v-model="searchModelValue" />
<van-field :modelValue="searchModelValue" @update:modelValue="onInputChange" />
<van-button square type="primary" icon="search" @click="onSearchBtn" />
</view>
</template>
<script setup>
import { ref } from 'vue'
import { computed, ref } from 'vue'
const isSelectShow = ref(false)
const activeTypeName = ref('机具')
const searchModelValue = ref('')
const emits = defineEmits(['onSearchByType'])
// const activeTypeName = ref('')
// const searchModelValue = ref('')
const emits = defineEmits(['onSearchByType', 'update:activeTypeName', 'update:searchModelValue'])
const onSearchBtn = () => {
emits('onSearchByType', searchModelValue.value, activeTypeName.value === '机具' ? 1 : 2)
}
const props = defineProps({
activeTypeName: {
type: String,
default: () => '机具',
},
searchModelValue: {
type: String,
default: () => '',
},
})
const activeTypeName = computed({
get: () => {
return props.activeTypeName
},
set: (val) => {
emits('update:activeTypeName', val)
},
})
const searchModelValue = computed({
get: () => {
return props.searchModelValue
},
set: (val) => {
emits('update:searchModelValue', val)
},
})
const onInputChange = (value) => {
searchModelValue.value = value
}
</script>
<style lang="scss" scoped>

View File

@ -74,8 +74,9 @@
"vueVersion": "3",
"h5": {
"router": {
"base": "/h5/",
"base": "/h5portal/",
"mode": "history"
}
},
"title": "安徽机具租赁商城"
}
}

View File

@ -134,9 +134,8 @@
line-height: 30px;
"
>
<text> 总金额 </text>
<text style="font-weight: bold; color: var(--van-submit-bar-price-color)">
{{ goods.num * goods.dayLeasePrice * goods.days }}
</text>
</view>

View File

@ -156,6 +156,7 @@
color="#22ab9b"
@click="onReceivingOrders"
:disabled="memberStore.userInfo.companyId == demandDetails.publishCompany"
v-if="memberStore.userType === 1"
/>
</van-action-bar>
</scroll-view>

View File

@ -186,7 +186,7 @@
<van-popup v-model:show="showArea" destroy-on-close position="bottom">
<van-area
:area-list="areaList"
:area-list="anAreaList"
v-model="areaListValue"
@confirm="onConfirmArea"
@cancel="showArea = false"
@ -221,7 +221,7 @@ import { addLeaseInfoAPI } from '@/services/demand/index.js'
import { onLoad } from '@dcloudio/uni-app'
import { areaList } from '@vant/area-data'
import moment from 'moment'
import { reactive, ref } from 'vue'
import { computed, reactive, ref } from 'vue'
const minDate = new Date(moment().format('YYYY'), moment().format('MM') - 1, moment().format('DD'))
const maxDate = new Date(moment().format('YYYY') * 1 + 100, 12, 31)
const showArea = ref(false)
@ -412,10 +412,19 @@ const onConfirmArea = (val) => {
})
showArea.value = false
}
const anAreaList = computed(() => {
return {
province_list: { 340000: '安徽省' },
city_list: areaList.city_list,
county_list: areaList.county_list,
}
})
onLoad(() => {
getEquipmentTypeData()
console.log(areaList, 'areaList')
// anAreaList.province = areaList.value.province.filter(
// (province) => ['340000'].includes(province.code), //
// )
})
</script>

View File

@ -18,30 +18,66 @@
</view>
</view>
<view style="padding: 10px">
<SearchIpt @onSearchByType="onSearchByType" />
<SearchIpt
@onSearchByType="onSearchByType"
v-model:activeTypeName="activeTypeName"
v-model:searchModelValue="searchModelValue"
/>
</view>
<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(
searchParams.dayLeasePriceOrderBy === 'ASC' ? '' : 'ASC',
)
"
size="12"
/>
<van-icon
name="play"
:color="searchParams.dayLeasePriceOrderBy === 'DESC' ? '#00a288' : ''"
@click="
onClickPrice(
searchParams.dayLeasePriceOrderBy === 'DESC' ? '' : '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(searchParams.updateTimeOrderBy === 'ASC' ? '' : 'ASC')
"
size="12"
/>
<van-icon
name="play"
:color="searchParams.updateTimeOrderBy === 'DESC' ? '#00a288' : ''"
@click="
onClickTime(searchParams.updateTimeOrderBy === 'DESC' ? '' : 'DESC')
"
size="12"
/>
</view>
</view>
</view>
@ -62,11 +98,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 +141,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 +160,34 @@
<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 { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue'
import { getTypeListAPI } from '@/services/common/index.js'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { ref, computed } from 'vue'
import { useMemberStore } from '@/stores/index.js'
import { debounce } from 'lodash-es'
const memberStore = useMemberStore()
const activeSelect = ref(0)
const showBottom = ref(false)
const deviceList = ref([])
const total = ref(0)
const activeTypeName = ref('')
const searchModelValue = ref('')
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 +195,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 +230,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,36 +276,110 @@ 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 查询需求
* @value 搜索框值
*/
if (type === 2) {
uni.setStorageSync('myParam', { value: searchModelValue.value, type: 2 })
uni.switchTab({
url: `/pages/lease-demand/index?value=${value}`,
url: `/pages/lease-demand/index`,
})
} else {
getDeviceListData()
searchParams.value.keyWord = value
getDeviceListData(true)
}
}
const onClickLeft = () => {
@ -219,9 +391,21 @@ const onClickLeft = () => {
const onFilter = () => {
showBottom.value = true
}
onLoad(() => {
getDeviceListData()
onLoad((options) => {
if (options.type == 1) {
activeTypeName.value = '机具'
}
searchParams.value.keyWord = options.value
searchModelValue.value = options.value
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)
})
onShow(() => {})
</script>
<style lang="scss" scoped>
@ -332,10 +516,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

@ -22,15 +22,33 @@
<view class="notice-box">
<van-image height="0.8rem" width="4rem" :src="noticeImg" />
<view>
<van-notice-bar color="#00a288" background="transparent" left-icon="volume-o">
最新通知···
<van-notice-bar
background="transparent"
color="#00a288"
left-icon="volume-o"
:scrollable="false"
>
<van-swipe
vertical
:autoplay="3000"
:touchable="false"
:show-indicators="false"
class="notice-swipe"
>
<van-swipe-item :key="item.noticeId" v-for="item in noticeListMessage">
<van-text-ellipsis :content="item.noticeTitle" />
</van-swipe-item>
</van-swipe>
</van-notice-bar>
</view>
</view>
<view class="search-ipt">
<!-- <van-field placeholder="搜索" /> -->
<SearchIpt @onSearchByType="onSearchByType" />
<SearchIpt
@onSearchByType="onSearchByType"
v-model:activeTypeName="activeTypeName"
v-model:searchModelValue="searchModelValue"
/>
</view>
</view>
@ -47,18 +65,12 @@
</view>
<view class="to-do-list">
<!-- <van-image height="0.8rem" width="4rem" :src="toDoList" /> -->
<TitleTip :title="`待办事项`" />
<van-list
v-model:loading="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
>
<van-cell v-for="item in 4" :key="item">
<van-list>
<van-cell v-for="item in toDoListMessage" :key="item.taskId">
<view class="items-info">
您有一条费用待确认
<text>查看更多</text>
您有一条订单消息
<text @click="onViewMore">查看更多</text>
</view>
</van-cell>
</van-list>
@ -75,25 +87,36 @@ import orderIcon_4 from '@/static/index/order_icon4.png'
import orderIcon_5 from '@/static/index/order_icon5.png'
import orderIcon_6 from '@/static/index/order_icon6.png'
import noticeImg from '@/static/index/notice.png'
import toDoList from '@/static/index/to_do_list.png'
import SearchIpt from '@/components/SearchIpt/index'
import TitleTip from '@/components/TitleTip/index'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { useMemberStore } from '@/stores/index.js'
import { getOrderStatusCountAPI } from '@/services/index/index.js'
import {
getOrderStatusCountAPI,
getToDoListAPI,
getNoticeLListAPI,
} from '@/services/index/index.js'
const activeTypeName = ref('机具')
const searchModelValue = ref('')
const memberStore = useMemberStore()
const userCompanyName = ref()
const showPopover = ref(false)
const activeUser = ref(1)
const loading = ref(false)
const finished = ref(false)
const toDoListMessage = ref([])
const noticeListMessage = ref([])
const orderData = ref([
{ order_title: '我的订单', order_count: 20, order_icon: orderIcon_1 },
{ order_title: '待出库', order_count: 6, order_icon: orderIcon_2 },
{ order_title: '待收货', order_count: 8, order_icon: orderIcon_3 },
{ order_title: '租赁中', order_count: 12, order_icon: orderIcon_4 },
{ order_title: '已退租', order_count: 7, order_icon: orderIcon_5 },
{ order_title: '已完成', order_count: 3, order_icon: orderIcon_6 },
{ order_title: '我的订单', order_count: 0, order_status: 0, order_icon: orderIcon_1 },
{
order_title: '待出库',
order_status: 2,
order_count: 0,
order_icon: orderIcon_2,
},
{ order_title: '待收货', order_status: 3, order_count: 0, order_icon: orderIcon_3 },
{ order_title: '租赁中', order_status: 4, order_count: 0, order_icon: orderIcon_4 },
{ order_title: '已退租', order_status: 5, order_count: 0, order_icon: orderIcon_5 },
{ order_title: '已完成', order_status: 20, order_count: 0, order_icon: orderIcon_6 },
])
const userActions = ref([
{ text: '出租方', userType: 1 },
@ -114,24 +137,38 @@ const onSearchByType = (value, type) => {
* @value 搜索框值
*/
if (type === 2) {
uni.setStorageSync('myParam', { value: searchModelValue.value, type: 2 })
uni.switchTab({
url: `/pages/lease-demand/index?value=${value}`,
url: `/pages/lease-demand/index`,
})
} else {
uni.navigateTo({
url: '/pages/goods-list/index',
url: `/pages/goods-list/index?value=${value}&type=1`,
})
}
}
const getOrderStatusCountData = async () => {
const res = await getOrderStatusCountAPI()
// console.log(res, '')
const { data: res } = await getOrderStatusCountAPI()
orderData.value[0].order_count = res.length
orderData.value[1].order_count = res.filter((e) => e.orderStatus == 2).length
orderData.value[2].order_count = res.filter((e) => e.orderStatus == 3).length
orderData.value[3].order_count = res.filter((e) => e.orderStatus == 4).length
orderData.value[4].order_count = res.filter((e) => e.orderStatus == 5).length
orderData.value[5].order_count = res.filter((e) => e.orderStatus == 20).length
console.log(res, '数量')
}
const onViewMyOrder = (order) => {
uni.navigateTo({
url: `/pages/order-details/index?type=${activeUser.value}`,
url: `/pages/order-details/index?type=${activeUser.value}&status=${order.order_status}`,
})
}
const onViewMore = () => {
uni.navigateTo({
url: `/pages/order-details/index`,
})
}
@ -140,7 +177,7 @@ onLoad(() => {
userCompanyName.value = memberStore?.userCompanyName
})
onShow(() => {
onShow(async () => {
activeUser.value = memberStore.userType
if (activeUser.value === 2) {
@ -151,6 +188,11 @@ onShow(() => {
}
getOrderStatusCountData()
const res = await getToDoListAPI()
const { data: result } = await getNoticeLListAPI()
toDoListMessage.value = res.rows
noticeListMessage.value = result.rows
})
</script>
@ -179,6 +221,10 @@ onShow(() => {
view {
flex: 1;
}
.notice-swipe {
height: 40px;
}
}
.search-ipt {
@ -231,4 +277,8 @@ onShow(() => {
:deep(.van-notice-bar__right-icon) {
color: #df3939;
}
:deep(.van-text-ellipsis) {
height: 40px;
line-height: 40px;
}
</style>

View File

@ -12,13 +12,17 @@
"
>
<view>
<van-icon name="arrow-left" @click="onClickLeft" />
<!-- <van-icon name="arrow-left" @click="onClickLeft" /> -->
<text style="color: #000"> 需求共享大厅 </text>
</view>
</view>
<view class="demand-header">
<view>
<SearchIpt @onSearchByType="onSearchByType" />
<SearchIpt
v-model:activeTypeName="activeTypeName"
v-model:searchModelValue="searchModelValue"
@onSearchByType="onSearchByType"
/>
</view>
<navigator
@ -39,18 +43,81 @@
<view class="goods-items">
<view class="filter-box">
<view>
使用年限
<van-icon name="sort" />
<view class="filter-items">
发布时间
<view class="filter-type">
<van-icon
name="play"
:color="searchParams.startTime === 'ASC' ? '#00a288' : ''"
@click="onClickStartTime(searchParams.startTime === 'ASC' ? '' : 'ASC')"
size="12"
/>
<van-icon
name="play"
:color="searchParams.startTime === 'DESC' ? '#00a288' : ''"
@click="
onClickStartTime(searchParams.startTime === 'DESC' ? '' : 'DESC')
"
size="12"
/>
</view>
</view>
<view>
租金
<van-icon name="sort" />
<view class="filter-items">
租期
<view class="filter-type">
<van-icon
name="play"
:color="searchParams.rentDay === 'ASC' ? '#00a288' : ''"
@click="onClickRentDay(searchParams.rentDay === 'ASC' ? '' : 'ASC')"
size="12"
/>
<van-icon
name="play"
:color="searchParams.rentDay === 'DESC' ? '#00a288' : ''"
@click="onClickRentDay(searchParams.rentDay === 'DESC' ? '' : 'DESC')"
size="12"
/>
</view>
</view>
<view>
上架时间
<van-icon name="sort" />
<view class="filter-items">
截止时间
<view class="filter-type">
<van-icon
name="play"
:color="searchParams.endTime === 'ASC' ? '#00a288' : ''"
@click="onClickEndTime(searchParams.endTime === 'ASC' ? '' : 'ASC')"
size="12"
/>
<van-icon
name="play"
:color="searchParams.endTime === 'DESC' ? '#00a288' : ''"
@click="onClickEndTime(searchParams.endTime === 'DESC' ? '' : 'DESC')"
size="12"
/>
</view>
</view>
<view class="filter-items">
租赁数量
<view class="filter-type">
<van-icon
name="play"
:color="searchParams.rentNum === 'ASC' ? '#00a288' : ''"
@click="onClickRentNum(searchParams.rentNum === 'ASC' ? '' : 'ASC')"
size="12"
/>
<van-icon
name="play"
:color="searchParams.rentNum === 'DESC' ? '#00a288' : ''"
@click="onClickRentNum(searchParams.rentNum === 'DESC' ? '' : 'DESC')"
size="12"
/>
</view>
</view>
</view>
<view @click="onFilter">
筛选
<van-icon name="filter-o" />
</view>
</view>
@ -120,6 +187,7 @@
style="margin-left: 10px"
:disabled="userCompanyId == d.publishCompany"
@click="onReceivingOrders(d.id)"
v-if="memberStore.userType === 1"
>
接单
</van-button>
@ -127,7 +195,62 @@
</view>
</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"
@click="
() => {
showBottom = false
}
"
>
<van-icon name="close" color="#575B66" size="20" />
</view>
<view
style="
text-align: center;
font-weight: bold;
color: #333333;
font-family: PingFangSC, PingFang SC;
"
>
全部筛选
</view>
<view class="filter-content">
<van-sidebar v-model="activeSelect">
<van-sidebar-item
:key="index"
:title="item.selectName"
v-for="(item, index) in selectList"
/>
</van-sidebar>
<scroll-view scroll-y class="right-btns">
<view>
<view> {{ selectList[activeSelect].selectName }} </view>
<view class="btns">
<view
:class="{ active_btn: item.isChecked }"
v-for="(item, index) in selectList[activeSelect].val_list"
:key="index"
@click="onClickTags(item)"
>
{{ item.name }}
</view>
</view>
</view>
</scroll-view>
</view>
</view>
</van-popup>
</view>
</template>
@ -135,39 +258,124 @@
import SearchIpt from '@/components/SearchIpt/index'
import { getLeaseDemandListAPI } from '@/services/demand/index.js'
import { acceptLeaseDemandOrderAPI } from '@/services/demand/index.js'
import { getTypeListAPI, getAreaAPI } from '@/services/common/index.js'
import { ref, computed } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { useMemberStore } from '@/stores/index.js'
import { debounce } from 'lodash-es'
import moment from 'moment'
const memberStore = useMemberStore()
const userCompanyId = ref()
import moment from 'moment'
import { ref } from 'vue'
const keywords = ref('发布')
const leaseDemandLis = ref([])
const showBottom = ref(false)
const activeSelect = ref(0)
const total = ref(0)
const activeTypeName = ref('')
const searchModelValue = ref('')
const searchParams = ref({
keyWord: '',
companyId: '',
typeId: '',
level: '',
cityCode: '',
pageNum: 1,
pageSize: 10,
startTime: '',
rentDay: '',
endTime: '',
rentNum: '',
})
const selectList = ref([
{
selectName: '装备分类',
val_list: [
{
name: '全部',
value: '',
isChecked: true,
},
],
},
{
selectName: '项目所在地',
val_list: [
{
name: '全部',
value: '',
isChecked: true,
},
],
},
{
selectName: '需求单位',
val_list: [
{
name: '全部',
value: '',
isChecked: true,
},
],
},
])
const onClickLeft = () => {
uni.navigateBack()
}
const onScrollTolower = () => {
console.log('滚动触底')
//
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[0].val_list.push(...typeList)
}
const onScrollTolower = debounce(() => {
if (total.value > leaseDemandLis.value.length) {
searchParams.value.pageNum++
getLeaseDemandListData()
}
}, 500)
const onSearchByType = (value, type) => {
/**
* @type 1 查询机具 2 查询需求
* @value 搜索框值
*/
if (type === 2) {
getLeaseDemandListData()
searchParams.value.keyWord = value
getLeaseDemandListData(true)
} else {
uni.navigateTo({ url: '/pages/goods-list/index' })
// uni.navigateTo({ url: '/pages/goods-list/index' })
uni.navigateTo({
url: `/pages/goods-list/index?value=${value}&type=1`,
})
}
}
//
const finish = computed(() => {
if (total.value === leaseDemandLis.value.length) return true
})
//
const getLeaseDemandListData = async () => {
const { data: res } = await getLeaseDemandListAPI({})
leaseDemandLis.value = res.rows
const getLeaseDemandListData = async (isTap = false) => {
if (isTap) searchParams.value.pageNum = 1
const { data: res } = await getLeaseDemandListAPI(searchParams.value)
total.value = res.total
if (isTap) {
leaseDemandLis.value = res.rows
} else {
if (res.rows.length == 0) {
leaseDemandLis.value = []
} else {
leaseDemandLis.value.push(...res.rows)
}
}
const nowTime = moment()
leaseDemandLis.value.forEach((e) => {
e.countDownTime =
@ -198,11 +406,69 @@ const onDemandDetails = (id) => {
url: `/pages/demand-details/index?id=${id}`,
})
}
onLoad(() => {
const onClickStartTime = (type) => {
searchParams.value.startTime = type
getLeaseDemandListData(true)
}
const onClickRentDay = (type) => {
searchParams.value.rentDay = type
getLeaseDemandListData(true)
}
const onClickEndTime = (type) => {
searchParams.value.endTime = type
getLeaseDemandListData(true)
}
const onClickRentNum = (type) => {
searchParams.value.rentNum = type
getLeaseDemandListData(true)
}
const onFilter = () => {
showBottom.value = true
}
//
const onClickTags = (item) => {
selectList.value[activeSelect.value].val_list.forEach((e) => {
e.isChecked = false
})
item.isChecked = true
if (activeSelect.value == 0) {
searchParams.value.typeId = item.value
searchParams.value.level = item.value ? 1 : ''
}
if (activeSelect.value == 1) {
searchParams.value.cityCode = item.value
}
if (activeSelect.value == 2) {
searchParams.value.companyId = item.value
}
getLeaseDemandListData(true)
}
onLoad(async () => {
getTypeListData()
const { data: res } = await getAreaAPI(34)
const addressList = res.map((e) => {
return { ...e, name: e.areaName, value: e.areaCode, isChecked: false, index: 1 }
})
const companyList = memberStore.companyList.map((e) => {
return { ...e, name: e.companyName, value: e.companyId, isChecked: false, index: 2 }
})
selectList.value[1].val_list.push(...addressList)
selectList.value[2].val_list.push(...companyList)
userCompanyId.value = memberStore.userInfo.companyId
})
onShow(() => {
getLeaseDemandListData()
const params = uni.getStorageSync('myParam')
// console.log(params, 'params---')
if (params.type == 2) {
activeTypeName.value = '需求'
}
searchParams.value.keyWord = params.value
searchModelValue.value = params.value
getLeaseDemandListData(true)
})
</script>
@ -240,9 +506,42 @@ onShow(() => {
}
}
.filter-box {
.goods-items {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px;
box-sizing: border-box;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
// background: $uni-bg-color;
.filter-box {
display: flex;
align-items: center;
.filter-items {
display: flex;
align-items: center;
font-size: 14px;
.filter-type {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 0 4px;
& .van-icon:first-child {
transform: rotateZ(-90deg);
margin-bottom: -3px;
}
& .van-icon:last-child {
transform: rotateZ(90deg);
margin-top: -3px;
}
}
}
}
}
.scroll-item {
@ -287,4 +586,48 @@ onShow(() => {
:deep(.van-nav-bar__title) {
color: #333;
}
.filter-bottom {
height: 100%;
display: flex;
flex-direction: column;
overflow-y: hidden;
}
.filter-content {
flex: 1;
height: 100%;
display: flex;
.right-btns {
flex: 1;
padding: 10px;
box-sizing: border-box;
.btns {
display: flex;
flex-wrap: wrap;
margin-top: 15px;
view {
min-width: calc((100% - 20px) / 3);
padding: 0 8px;
box-sizing: border-box;
margin-bottom: 10px;
margin-right: 10px;
min-height: 28px;
line-height: 28px;
text-align: center;
border-radius: 14px;
}
.active_btn {
color: #22ab9b;
background-color: #d1eae7;
}
& view:nth-child(3n) {
margin-right: 0;
}
}
}
}
</style>

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">
@ -38,7 +38,7 @@
<van-grid-item v-if="memberStore.userType === 2">
<navigator url="/pages/order-details/index?type=2">
<van-icon name="cart" />
<text>订单</text>
<text>租订单</text>
</navigator>
</van-grid-item>
</van-grid>

View File

@ -421,6 +421,7 @@ const orderQueryParams = ref({
pageSize: 20,
pageNum: 1,
flag: true,
orderStatus: '',
})
const submitParams = ref({
@ -453,13 +454,13 @@ const orderType = (status) => {
}
const tabList = ref([
{ tab_name: '全部' },
{ tab_name: '待出库' },
{ tab_name: '带收货' },
{ tab_name: '租赁中' },
{ tab_name: '已退租' },
{ tab_name: '已完成' },
{ tab_name: '已取消' },
{ tab_name: '全部', order_status: 0 },
{ tab_name: '待出库', order_status: 2 },
{ tab_name: '待收货', order_status: 3 },
{ tab_name: '租赁中', order_status: 4 },
{ tab_name: '已退租', order_status: 5 },
{ tab_name: '已完成', order_status: 20 },
{ tab_name: '已取消', order_status: 99 },
])
//
@ -488,6 +489,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 +534,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 +543,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 +552,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 +562,7 @@ const onReturnRepair = (item) => {
})
}
if (fileInfoList.length > 0) {
if (fileInfoList?.length > 0) {
fileInfoList.forEach((e) => {
e.name = e.fileName
e.url = e.fileUrl
@ -785,6 +787,10 @@ const onSubmitRepairResult = () => {
onLoad((options) => {
orderQueryParams.value.flag = options?.type == 1 ? true : false
// console.log(options?.status, '')
const tabIndex = tabList.value.findIndex((e) => e.order_status == options?.status)
activeTabs.value = tabIndex
orderQueryParams.value.orderStatus = options?.status == 0 ? '' : options?.status
getOrderListData()
})

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,22 @@ export const fileUploadAPI = (data) => {
data,
})
}
/**
* 装备 获取分类
*/
export const getTypeListAPI = () => {
return http({
method: 'GET',
url: `/material-mall/maType/getTypeList`,
})
}
/**
* 装备 获取分类
*/
export const getAreaAPI = (areaCode) => {
return http({
method: 'GET',
url: `/material-mall/maType/getArea?areaCode=${areaCode}`,
})
}

View File

@ -19,3 +19,21 @@ export const getOrderStatusCountAPI = (data) => {
url: '/material-mall/order/getOrderStatusCount',
})
}
/**
* 首页 获取待办数据
*/
export const getToDoListAPI = () => {
return http({
method: 'GET',
url: '/material-mall/todo/getToDoList',
})
}
/**
* 首页 获取通知公告
*/
export const getNoticeLListAPI = () => {
return http({
method: 'GET',
url: '/material-mall/notice/list',
})
}

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;
// }