From 0f1d2fb3d819d6b560fad65be2f49efcdf566a9b Mon Sep 17 00:00:00 2001
From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com>
Date: Fri, 20 Dec 2024 21:37:18 +0800
Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E8=AF=A6=E6=83=85=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E5=AE=8C=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.html | 5 +-
src/App.vue | 2 +-
src/manifest.json | 82 +++++-----
src/pages.json | 7 +
src/pages/cart/index.vue | 1 -
src/pages/demand-details/index.vue | 235 +++++++++++++++++++++++++++++
src/pages/demand-release/index.vue | 138 ++++++++++++-----
src/pages/lease-demand/index.vue | 46 ++++--
src/style/vant.scss | 1 +
vite.config.js | 3 +-
10 files changed, 425 insertions(+), 95 deletions(-)
create mode 100644 src/pages/demand-details/index.vue
diff --git a/index.html b/index.html
index 8ffa3b0..407f674 100644
--- a/index.html
+++ b/index.html
@@ -4,7 +4,10 @@
+ content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">
+
+
diff --git a/src/App.vue b/src/App.vue
index 5ff0b26..5e2ffdf 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -12,7 +12,7 @@ onShow(() => {})
page {
width: 100%;
height: 100%;
- font-size: 14px;
+ font-size: 16px;
background-color: $uni-bg-color-grey;
}
diff --git a/src/manifest.json b/src/manifest.json
index e5fae47..3b0d5fe 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,31 +1,31 @@
{
- "name": "",
- "appid": "",
- "description": "",
- "versionName": "1.0.0",
- "versionCode": "100",
- "transformPx": false,
+ "name" : "",
+ "appid" : "",
+ "description" : "",
+ "versionName" : "1.0.0",
+ "versionCode" : "100",
+ "transformPx" : false,
/* 5+App特有相关 */
- "app-plus": {
- "usingComponents": true,
- "nvueStyleCompiler": "uni-app",
- "compilerVersion": 3,
- "splashscreen": {
- "alwaysShowBeforeRender": true,
- "waiting": true,
- "autoclose": true,
- "delay": 0
+ "app-plus" : {
+ "usingComponents" : true,
+ "nvueStyleCompiler" : "uni-app",
+ "compilerVersion" : 3,
+ "splashscreen" : {
+ "alwaysShowBeforeRender" : true,
+ "waiting" : true,
+ "autoclose" : true,
+ "delay" : 0
},
- "compatible": {
- "ignoreVersion": true
+ "compatible" : {
+ "ignoreVersion" : true
},
/* 模块配置 */
- "modules": {},
+ "modules" : {},
/* 应用发布信息 */
- "distribute": {
+ "distribute" : {
/* android打包配置 */
- "android": {
- "permissions": [
+ "android" : {
+ "permissions" : [
"",
"",
"",
@@ -44,32 +44,38 @@
]
},
/* ios打包配置 */
- "ios": {},
+ "ios" : {},
/* SDK配置 */
- "sdkConfigs": {}
+ "sdkConfigs" : {}
}
},
/* 快应用特有相关 */
- "quickapp": {},
+ "quickapp" : {},
/* 小程序特有相关 */
- "mp-weixin": {
- "appid": "",
- "setting": {
- "urlCheck": false
+ "mp-weixin" : {
+ "appid" : "",
+ "setting" : {
+ "urlCheck" : false
},
- "usingComponents": true
+ "usingComponents" : true
},
- "mp-alipay": {
- "usingComponents": true
+ "mp-alipay" : {
+ "usingComponents" : true
},
- "mp-baidu": {
- "usingComponents": true
+ "mp-baidu" : {
+ "usingComponents" : true
},
- "mp-toutiao": {
- "usingComponents": true
+ "mp-toutiao" : {
+ "usingComponents" : true
},
- "uniStatistics": {
- "enable": false
+ "uniStatistics" : {
+ "enable" : false
},
- "vueVersion": "3"
+ "vueVersion" : "3",
+ "h5" : {
+ "router" : {
+ "base" : "/h5/",
+ "mode" : "history"
+ }
+ }
}
diff --git a/src/pages.json b/src/pages.json
index bdacc6e..5f37833 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -28,6 +28,13 @@
"navigationStyle": "custom"
}
},
+ // 需求详情
+ {
+ "path": "pages/demand-details/index",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
// 预约车
{
"path": "pages/cart/index",
diff --git a/src/pages/cart/index.vue b/src/pages/cart/index.vue
index a9931aa..705e7c6 100644
--- a/src/pages/cart/index.vue
+++ b/src/pages/cart/index.vue
@@ -443,7 +443,6 @@ const getActionBarHeight = () => {
.select('.van-safe-area-bottom')
.boundingClientRect((data) => {
if (data) {
- console.log(data, '底部高度--')
actionBarHeight.value = data.height
}
})
diff --git a/src/pages/demand-details/index.vue b/src/pages/demand-details/index.vue
new file mode 100644
index 0000000..b06766e
--- /dev/null
+++ b/src/pages/demand-details/index.vue
@@ -0,0 +1,235 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ activeIndex }}/{{ goodsPicCount }}
+
+
+
+
+
+ {{ deviceInfo.deviceName }}
+
+ ¥
+ {{ deviceInfo.dayLeasePrice }}
+ /天
+
+
+
+ {{ deviceInfo.personPhone }}
+
+ 发布时间:{{ deviceInfo.createTime?.slice(0, 10) }}
+ 更新时间:{{ deviceInfo.updateTime?.slice(0, 10) }}
+ 浏览次数:{{ deviceInfo.searchNum }}
+
+
+
+
+ 安徽送变电公司
+
+ 入驻时间:{{ deviceInfo.companyCreateTime }}
+ 上架数量:{{ deviceInfo.devUapNum }}
+ 访问量:{{ deviceInfo.companyVisitNum }}
+
+
+
+ 合肥市
+
+
+
+
+
+ 1
+ 装备
+ 1
+
+
+ 装备类目:
+ 预估数量:
+
+
+
+
+
+
+
+
+
+
+
+ 接单人
+ 接单联系电话
+ 接单公司
+ 接单时间
+
+
+ 接单人
+ 接单联系电话
+ 接单公司
+ 接单时间
+
+
+ 接单人
+ 接单联系电话
+ 接单公司
+ 接单时间
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/demand-release/index.vue b/src/pages/demand-release/index.vue
index e7243a7..423f13a 100644
--- a/src/pages/demand-release/index.vue
+++ b/src/pages/demand-release/index.vue
@@ -107,11 +107,14 @@
-
- 添加需求描述
-
+
+
+ 添加需求描述
+
+
@@ -152,11 +156,23 @@
+
+
+
+ 移除
+
+
-
+
提交
-
+
@@ -252,19 +268,47 @@ const demandDetails = ref([
description: '',
},
])
+// 添加需求描述
+const onAddDemand = () => {
+ demandDetails.value.push({
+ newId: Date.now(),
+ typeIds: [],
+ typeId: '',
+ typeName: '',
+ leaseNum: 1,
+ fileInfoList: [],
+ description: '',
+ })
+}
+// 移除
+const onDeleteDemand = (index) => {
+ demandDetails.value.splice(index, 1)
+}
+
+// 校验租赁开始日期
const validatorStartTime = (val) => {
- console.log(val, '开始时间')
-}
-const validatorEndTime = (val) => {
- console.log(val, '结束时间')
+ if (val && new Date(val) >= new Date(demandForm.leaseEndTime)) {
+ return '租赁开始日期不能大于租赁结束日期'
+ } else {
+ return true
+ }
}
+// 校验租赁结束日期
+const validatorEndTime = (val) => {
+ if (val && new Date(val) <= new Date(demandForm.leaseStartTime)) {
+ return '租赁结束日期不能小于租赁开始日期'
+ } else {
+ return true
+ }
+}
+
+// 获取装备类目
const getEquipmentTypeData = async () => {
const { data: res } = await getEquipmentTypeAPI()
equipmentTypeList.value = res
}
-const onConfirm = () => {}
// 打开日期选择框
const onOpenTimePopup = (type) => {
@@ -278,8 +322,11 @@ const onOpenPopup = (index) => {
showEquipmentType.value = true
}
const onChangeEquipmentType = (value) => {
- demandDetails.value[equipmentOpenIndex.value].typeName =
- value.selectedOptions[value.selectedOptions.length - 1].name
+ let equipmentName = ''
+ value.selectedOptions.forEach((e) => {
+ equipmentName = equipmentName + '/' + e.name
+ })
+ demandDetails.value[equipmentOpenIndex.value].typeName = equipmentName.slice(1)
demandDetails.value[equipmentOpenIndex.value].typeId =
value.selectedOptions[value.selectedOptions.length - 1].id
demandDetails.value[equipmentOpenIndex.value].typeIds = []
@@ -292,35 +339,46 @@ const onCloseEquipmentType = () => {
// 提交
const onSubmitDemand = async () => {
- demandReleaseFormRef.value.validate().then(async (res) => {
- let isDemand = false
- for (let index = 0; index < demandDetails.value.length; index++) {
- try {
- const valid = demandDetailsFormRefList.value[index].validate()
- if (typeof valid == 'object') {
- isDemand = true
- throw new Error('表单校验失败')
- }
- } catch (error) {}
- }
+ demandReleaseFormRef.value
+ .validate()
+ .then(async (res) => {
+ console.log(res, '主表单校验结果')
+ let isDemand = false
- if (isDemand) return
- showConfirmDialog({
- title: '温馨提示',
- message: '是否确定提交该需求',
- })
- .then(async () => {
- demandForm.detailsList = demandDetails.value
- const res = await addLeaseInfoAPI(demandForm)
- if (res.code === 200) {
- showSuccessToast('提交成功')
- setTimeout(() => {
- uni.navigateBack()
- }, 500)
+ // 校验动态表单列表
+ for (let index = 0; index < demandDetails.value.length; index++) {
+ try {
+ // 等待每个动态表单的校验结果
+ const valid = await demandDetailsFormRefList.value[index].validate()
+ } catch (error) {
+ isDemand = true
+ throw new Error('动态表单校验失败')
}
+ }
+
+ // 如果主表单或动态表单校验不通过,终止提交
+ if (isDemand) return
+
+ // 如果校验通过,弹出确认对话框
+ showConfirmDialog({
+ title: '温馨提示',
+ message: '是否确定提交该需求',
})
- .catch(() => {})
- })
+ .then(async () => {
+ demandForm.detailsList = demandDetails.value
+ const res = await addLeaseInfoAPI(demandForm)
+ if (res.code === 200) {
+ showSuccessToast('提交成功')
+ setTimeout(() => {
+ uni.navigateBack()
+ }, 500)
+ }
+ })
+ .catch(() => {})
+ })
+ .catch((error) => {
+ console.log('主表单校验失败:', error.message)
+ })
}
// 日期确定按钮
@@ -336,6 +394,7 @@ const onConfirmTime = (val) => {
demandForm.endTime = `${y}-${m}-${d} 23:59:59`
}
+ timeValue.value = []
showPicker.value = false
}
@@ -357,6 +416,7 @@ const onConfirmArea = (val) => {
onLoad(() => {
getEquipmentTypeData()
+ console.log(areaList, 'areaList')
})
diff --git a/src/pages/lease-demand/index.vue b/src/pages/lease-demand/index.vue
index f88fb66..9a6f632 100644
--- a/src/pages/lease-demand/index.vue
+++ b/src/pages/lease-demand/index.vue
@@ -92,11 +92,15 @@
- 需求详情
+ 需求详情
接单
@@ -114,6 +118,9 @@ import SearchIpt from '@/components/SearchIpt/index'
import { getLeaseDemandListAPI } from '@/services/demand/index.js'
import { acceptLeaseDemandOrderAPI } from '@/services/demand/index.js'
import { onLoad, onShow } from '@dcloudio/uni-app'
+import { useMemberStore } from '@/stores/index.js'
+const memberStore = useMemberStore()
+const userCompanyId = ref()
import moment from 'moment'
import { ref } from 'vue'
const keywords = ref('发布')
@@ -146,20 +153,31 @@ const getLeaseDemandListData = async () => {
})
}
+// 接单
const onReceivingOrders = (id) => {
- // showConfirmDialog({
- // title: '温馨提示',
- // message: '是否确认接单',
- // })
- // .then(async () => {
- // const res = await acceptLeaseDemandOrderAPI({ id })
- // if (res.code === 200) {
- // showSuccessToast('接单成功')
- // getLeaseDemandListData()
- // }
- // })
- // .catch(() => {})
+ showConfirmDialog({
+ title: '温馨提示',
+ message: '是否确认接单',
+ })
+ .then(async () => {
+ const res = await acceptLeaseDemandOrderAPI({ id })
+ if (res.code === 200) {
+ showSuccessToast('接单成功')
+ getLeaseDemandListData()
+ }
+ })
+ .catch(() => {})
}
+
+// 需求详情
+const onDemandDetails = () => {
+ uni.navigateTo({
+ url: '/pages/demand-details/index',
+ })
+}
+onLoad(() => {
+ userCompanyId.value = memberStore.userInfo.companyId
+})
onShow(() => {
getLeaseDemandListData()
})
diff --git a/src/style/vant.scss b/src/style/vant.scss
index 9b077e9..3549d14 100644
--- a/src/style/vant.scss
+++ b/src/style/vant.scss
@@ -1,5 +1,6 @@
.primary-lease {
--van-button-primary-background:#00a288;
+ --van-button-primary-border-color:#00ad9d;
--el-color-primary-light-3:#00ad9d;
--el-color-primary-dark-2:#00ad9d;
--el-color-primary-light-5:#78d3cb;
diff --git a/vite.config.js b/vite.config.js
index d2444f7..d6b6839 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -31,7 +31,8 @@ export default defineConfig({
proxy: {
// 在此处编写代理规则
'/api': {
- target: 'ttp://192.168.0.244:28580',
+ target: 'http://36.33.26.201:17788/proxyApi',
+ // target: 'http://192.168.0.244:28580',
changeOrigin: true,
rewrite: (path) => {
return path.replace(/\/api/, '')