diff --git a/src/App.vue b/src/App.vue
index ba992b8..5ff0b26 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,30 +1,10 @@
diff --git a/src/pages/goods-details/components/details-model.vue b/src/pages/goods-details/components/details-model.vue
index a80f0ce..59dc7c8 100644
--- a/src/pages/goods-details/components/details-model.vue
+++ b/src/pages/goods-details/components/details-model.vue
@@ -66,7 +66,7 @@
type="danger"
text="立即租用"
@click="onRentNow"
- :disabled="deviceInfo.isBookCar == 0 || userCompanyId == deviceInfo.companyId"
+ :disabled="userCompanyId == deviceInfo.companyId"
/>
@@ -111,6 +111,7 @@ const getDeviceDetailsData = async () => {
}
// 获取预约车数量
const getBookCarDetailsData = async () => {
+ cartCount.value = 0
const { data: res } = await getBookCarDetailsAPI()
if (res.length > 0) {
res.forEach((e) => {
@@ -136,6 +137,7 @@ const onAddCart = () => {
if (res.code === 200) {
showSuccessToast('加入成功')
getDeviceDetailsData()
+ getBookCarDetailsData()
}
})
.catch(() => {})
diff --git a/src/pages/goods-list/index.vue b/src/pages/goods-list/index.vue
index c1a31d5..4423cbc 100644
--- a/src/pages/goods-list/index.vue
+++ b/src/pages/goods-list/index.vue
@@ -1,7 +1,8 @@
-
+
+
{
}
}
const onClickLeft = () => {
- history.back()
+ uni.switchTab({
+ url: '/pages/index/index',
+ })
}
onLoad(() => {
getDeviceListData()
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index d1ad5bc..9080747 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -12,13 +12,15 @@
@select="onUserSelect"
>
- {{ activeUser }}
+ {{ activeUser == 1 ? '出租方' : '承租方' }}
- 您好!安徽送变电公司 / 李世民
+
+ 您好!安徽送变电公司 / {{ memberStore.userInfo.nickName }}
+
@@ -71,11 +73,12 @@ 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 } from '@dcloudio/uni-app'
+import { onLoad, onShow } from '@dcloudio/uni-app'
import { useMemberStore } from '@/stores/index.js'
+import { getOrderStatusCountAPI } from '@/services/index/index.js'
const memberStore = useMemberStore()
const showPopover = ref(false)
-const activeUser = ref('出租方')
+const activeUser = ref(1)
const loading = ref(false)
const finished = ref(false)
const orderData = ref([
@@ -91,7 +94,7 @@ const userActions = ref([
{ text: '承租方', userType: 2 },
])
const onUserSelect = (e) => {
- activeUser.value = e.text
+ activeUser.value = e.userType
memberStore.editUserType(e.userType)
uni.setTabBarItem({
index: 2,
@@ -115,9 +118,23 @@ const onSearchByType = (value, type) => {
}
}
+const getOrderStatusCountData = async () => {
+ const res = await getOrderStatusCountAPI()
+ console.log(res, '数量')
+}
+
onLoad(() => {
finished.value = true
})
+
+onShow(() => {
+ activeUser.value = memberStore.userType
+ uni.setTabBarItem({
+ index: 2,
+ visible: true,
+ })
+ getOrderStatusCountData()
+})
diff --git a/src/pages/lease-demand/index.vue b/src/pages/lease-demand/index.vue
index 1ee5a55..f88fb66 100644
--- a/src/pages/lease-demand/index.vue
+++ b/src/pages/lease-demand/index.vue
@@ -113,7 +113,7 @@
import SearchIpt from '@/components/SearchIpt/index'
import { getLeaseDemandListAPI } from '@/services/demand/index.js'
import { acceptLeaseDemandOrderAPI } from '@/services/demand/index.js'
-import { onLoad } from '@dcloudio/uni-app'
+import { onLoad, onShow } from '@dcloudio/uni-app'
import moment from 'moment'
import { ref } from 'vue'
const keywords = ref('发布')
@@ -147,19 +147,20 @@ const getLeaseDemandListData = async () => {
}
const onReceivingOrders = (id) => {
- uni.showModal({
- title: '温馨提示',
- content: '是否确认接单?',
- success: async () => {
- const res = await acceptLeaseDemandOrderAPI({ id })
- if (res.code === 200) {
- showSuccessToast('接单成功')
- getLeaseDemandListData()
- }
- },
- })
+ // showConfirmDialog({
+ // title: '温馨提示',
+ // message: '是否确认接单',
+ // })
+ // .then(async () => {
+ // const res = await acceptLeaseDemandOrderAPI({ id })
+ // if (res.code === 200) {
+ // showSuccessToast('接单成功')
+ // getLeaseDemandListData()
+ // }
+ // })
+ // .catch(() => {})
}
-onLoad(() => {
+onShow(() => {
getLeaseDemandListData()
})
diff --git a/src/pages/order/index.vue b/src/pages/order/index.vue
index 694137e..3a83165 100644
--- a/src/pages/order/index.vue
+++ b/src/pages/order/index.vue
@@ -24,7 +24,7 @@
-
+
@@ -36,19 +36,26 @@
¥{{ item.dayLeasePrice }}/天
+
+
- {{ startTime ? startTime : '开始日期' }}
+ {{ item.rentBeginTime ? item.rentBeginTime : '开始日期' }}
- {{ endTime ? endTime : '结束日期' }}
+ {{ item.rentEndTime ? item.rentEndTime : '结束日期' }}
-
-
-
@@ -92,6 +96,7 @@
@confirm="onConfirm"
@cancel="onCancel"
:min-date="minDate"
+ :max-date="maxDate"
title="选择日期"
/>
@@ -105,7 +110,21 @@
共计 1 件装备
+
+
+ {{ address.length === 0 ? '请选择收货地址' : `收货地址:${address}` }}
+
+
+
+
+
+
@@ -117,20 +136,24 @@ import { computed, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useMemberStore } from '@/stores/index.js'
import { getDeviceDetailsAPI } from '@/services/goods/index.js'
+import { getAddressListAPI, submitBookCarAPI } from '@/services/cart/index.js'
import moment from 'moment'
const memberStore = useMemberStore()
const checked = ref(['1'])
const orderList = ref([])
const showBottom = ref(false)
-const minDate = new Date(2024, 0, 1)
+const showBottomAddress = ref(false)
+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 timeType = ref(0)
const leaseTime = ref()
-const startTime = ref()
-const endTime = ref()
+const address = ref('')
+const chosenAddressId = ref()
+const addressList = ref([])
const onClickLeft = () => {
uni.navigateBack()
}
-const onSubmitOrder = () => {
+const onSubmitOrder = async () => {
orderList.value.forEach((e) => {
if (e.days < 1) {
showFailToast('请选择租期')
@@ -140,7 +163,39 @@ const onSubmitOrder = () => {
showFailToast('请先阅读公司协议')
return
}
+
+ if (address.value.length == 0) {
+ showFailToast('请选择收货地址')
+ return
+ }
})
+
+ const orderInfo = orderList.value[0]
+ const submitInfo = {
+ maId: orderInfo.maId,
+ id: orderInfo.id,
+ rentBeginTime: orderInfo.rentBeginTime + ' ' + '00:00:00',
+ rentEndTime: orderInfo.rentEndTime + ' ' + '00:00:00',
+ manageType: orderInfo.manageType,
+ days: orderInfo.days,
+ num: orderInfo.num,
+ costs: orderInfo.num * orderInfo.days * orderInfo.dayLeasePrice,
+ }
+
+ const submitParams = {
+ cost: submitInfo.costs,
+ address: address.value,
+ detailsList: [submitInfo],
+ }
+ const res = await submitBookCarAPI([submitParams])
+ if (res.code === 200) {
+ showSuccessToast('提交成功')
+ setTimeout(() => {
+ uni.navigateTo({
+ url: '/pages/goods-list/index',
+ })
+ }, 500)
+ }
}
const onViewProtocol = () => {}
const onSelectTime = (type) => {
@@ -149,11 +204,20 @@ const onSelectTime = (type) => {
}
const onConfirm = () => {
if (timeType.value === 1) {
- startTime.value = leaseTime.value.join('-')
+ orderList.value[0].rentBeginTime = leaseTime.value.join('-')
} else {
- endTime.value = leaseTime.value.join('-')
- orderList.value[0].days = moment(endTime.value).diff(startTime.value, 'day')
+ if (moment(leaseTime.value.join('-')).isBefore(moment(orderList.value[0].rentBeginTime))) {
+ showFailToast('租赁结束日期不能小于租赁开始日期')
+ return
+ } else {
+ orderList.value[0].rentEndTime = leaseTime.value.join('-')
+ orderList.value[0].days = moment(leaseTime.value.join('-')).diff(
+ orderList.value[0].rentBeginTime,
+ 'day',
+ )
+ }
}
+ leaseTime.value = []
showBottom.value = false
}
const onCancel = () => {
@@ -177,8 +241,32 @@ const totalPrice = computed(() => {
return item?.num * item?.dayLeasePrice * item?.days * 100
})
+// 获取地址
+const getAddressListData = async () => {
+ const { rows: res } = await getAddressListAPI()
+ addressList.value = res.map((e, index) => {
+ return {
+ id: index,
+ name: '',
+ tel: '',
+ address: `${e.provinceName}${e.cityName}${e.areaName}${e.address}`,
+ isDefault: false,
+ }
+ })
+}
+
+// 选择地址
+const onClickLink = () => {
+ showBottomAddress.value = true
+}
+const onClickAddress = (res) => {
+ address.value = res.address
+ showBottomAddress.value = false
+}
+
onLoad((options) => {
getDeviceDetailsData(options.id)
+ getAddressListData()
})
@@ -247,7 +335,7 @@ onLoad((options) => {
font-size: 12px;
view {
- padding: 1px 0 1px 10px;
+ padding: 2px 0 2px 10px;
font-size: 12px;
color: #6f6f6f;
@@ -267,4 +355,7 @@ onLoad((options) => {
font-size: 13px;
color: #1989fa;
}
+:deep(.van-address-item__edit) {
+ display: none;
+}
diff --git a/src/services/index/index.js b/src/services/index/index.js
index 06c7026..5f4fd61 100644
--- a/src/services/index/index.js
+++ b/src/services/index/index.js
@@ -10,3 +10,12 @@ export const getDeviceListAPI = (data) => {
data,
})
}
+/**
+ * 首页 获取订单数量
+ */
+export const getOrderStatusCountAPI = (data) => {
+ return http({
+ method: 'GET',
+ url: '/material-mall/order/getOrderStatusCount',
+ })
+}