diff --git a/src/views/order/index.vue b/src/views/order/index.vue
index 5855ca8..ccd50fc 100644
--- a/src/views/order/index.vue
+++ b/src/views/order/index.vue
@@ -87,20 +87,29 @@
-
-
-
-
+
+
+
+
+
+ 新增地址
+
@@ -339,6 +348,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -349,8 +456,9 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import { getBookCarDetailByMaId, submitBookCarApi } from '../../http/api/order/index'
import { getBookCarAgreementApi, getProListApi } from 'http/api/cart/index'
import CustomDatePickerButton from '../cart/components/date-picker-button.vue'
-import { getAddressListApi } from 'http/api/address-manage/index'
+import { getAddressListApi,addAddressInfoApi } from 'http/api/address-manage/index'
import { getCodeNumDetailApi } from 'http/api/equip'
+import { getAreaApi } from 'http/api/home'
import moment from 'moment'
import { useRoute, useRouter } from 'vue-router'
import { useStore } from '../../store/user'
@@ -370,6 +478,26 @@ const protocolChecked = ref(false)
const orderList = ref([])
const addressTitle = ref('请选择收货地址')
const addressList = ref([])
+
+const addOrEditDialogVisible = ref(false)
+const addOrEditForm = ref({
+ areaCode: '', // 省
+ cityCode: '', // 市
+ provinceCode: '', // 区
+ address: '', // 详细地址
+})
+const addOrEditFormRef = ref(null)
+const addOrEditFormRules = reactive({
+ areaCode: [{ required: true, message: '请选择项目所在区/县', trigger: 'change' }],
+ cityCode: [{ required: true, message: '请选择项目所在市', trigger: 'change' }],
+ provinceCode: [{ required: true, message: '请选择项目所在省', trigger: 'change' }],
+ address: [{ required: true, message: '请输入项目详细地址', trigger: 'blur' }],
+})
+const areaList = ref([]) // 省
+const areaCityList = ref([]) // 市
+const areaCountyList = ref([]) // 区/县
+
+
const queryForm: any = reactive({
useUnit: store.userInfo?.dept?.deptId || '', // 需求单位(使用可选链避免报错)
useUnitName: store.userInfo?.dept?.deptName || '', // 需求单位名称(使用可选链避免报错)
@@ -439,6 +567,60 @@ onMounted(() => {
}, 500)
})
+const handleAddress = () => {
+ addOrEditDialogVisible.value = true
+ getAreaData()
+ nextTick(() => {
+ addOrEditFormRef.value.resetFields()
+ })
+}
+const getAreaData = async () => {
+ try {
+ const res: any = await getAreaApi(0)
+ areaList.value = res.data
+ } catch (error) {
+ console.log('🚀 ~ getAreaData ~ error:', error)
+ }
+}
+
+const onProvinceChange = async (id: any) => {
+ try {
+ const res: any = await getAreaApi(id)
+ areaCityList.value = res.data
+ } catch (error) {
+ console.log('🚀 ~ onProvinceChange ~ error:', error)
+ }
+}
+const onCityChange = async (id: any) => {
+ try {
+ const res: any = await getAreaApi(id)
+ areaCountyList.value = res.data
+ } catch (error) {
+ console.log('🚀 ~ onCityChange ~ error:', error)
+ }
+}
+const onCountyChange = async (id: any) => {}
+// 提交
+const onSubmit = () => {
+ addOrEditFormRef.value.validate(async (valid: any) => {
+ if (valid) {
+ try {
+ const res: any = await addAddressInfoApi(addOrEditForm.value)
+ if (res.code === 200) {
+ ElMessage({
+ type: 'success',
+ message: '提交成功',
+ })
+
+ addOrEditDialogVisible.value = false
+ getReceiptGoodsAddress()
+ }
+ } catch (error) {
+ console.log('🚀 ~ addOrEditFormRef.value.validate ~ error:', error)
+ }
+ }
+ })
+}
const onLeaseDateChange = (value: any, companyIndex: number, goodsIndex: number) => {
orderList.value.forEach((e: any) => {
if (!value) {