Browse Source

fix: 修复地址验证和日期计算问题

- 修改开发环境API端口从8002到8080
- 调整日期计算逻辑,从当前日期+2天改为当天日期
- 增强地址验证逻辑,检查省市区信息和经纬度
- 添加详细地址必填校验
master
前端-胡立永 2 days ago
parent
commit
49b583f82b
6 changed files with 42 additions and 4 deletions
  1. +1
    -1
      pages/index.vue
  2. +18
    -0
      pages/newOrder/address.vue
  3. +1
    -1
      pages/newOrder/addressList.vue
  4. +1
    -1
      pages/newOrder/petList.vue
  5. +20
    -0
      pages/personalCenter/addressInfo.vue
  6. +1
    -1
      utils/getUrl.js

+ 1
- 1
pages/index.vue View File

@ -522,7 +522,7 @@ import { bindCode } from '@/api/order/order.js'
},
getCalendarDate() {
let tomorrow = new Date()
tomorrow.setDate(tomorrow.getDate() + 2);
tomorrow.setDate(tomorrow.getDate());
this.startDate = this.formatDate(tomorrow);
let threeMonthsLater = new Date();
threeMonthsLater.setMonth(threeMonthsLater.getMonth() + 3);


+ 18
- 0
pages/newOrder/address.vue View File

@ -203,6 +203,24 @@
this.$modal.showToast('请输入联系人')
return false;
}
//
if(!params.province && !params.city && !params.district){
this.$modal.showToast('请选择所在地区')
return false;
}
//
if(!params.latitude || !params.longitude){
this.$modal.showToast('定位信息缺失,请重新选择所在地区')
this.addressInfo.province = ''
this.addressInfo.city = ''
this.addressInfo.district = ''
this.addressInfo.selectAddress = ''
return false;
}
if(!params.detailAddress){
this.$modal.showToast('请输入详细地址')
return false;
}
this.loading=true
if(this.optionType=='edit'){
params.id = this.addressId;


+ 1
- 1
pages/newOrder/addressList.vue View File

@ -124,7 +124,7 @@
},
useAddress(params){
//
if(!params.latitude || !params.longitude) {
if(!params.latitude || !params.longitude || (!params.province && !params.city && !params.district)) {
uni.showModal({
title: '提示',
content: '该地址缺少位置信息,需要重新定位,请点击确定重新选择位置',


+ 1
- 1
pages/newOrder/petList.vue View File

@ -334,7 +334,7 @@ export default {
},
getCalendarDate() {
let tomorrow = new Date()
tomorrow.setDate(tomorrow.getDate() + 2);
tomorrow.setDate(tomorrow.getDate());
this.startDate = this.formatDate(tomorrow);
//


+ 20
- 0
pages/personalCenter/addressInfo.vue View File

@ -230,6 +230,26 @@
this.$modal.showToast('请输入联系人')
return false;
}
//
if(!params.province && !params.city && !params.district){
this.$modal.showToast('请选择所在地区')
return false;
}
//
if(!params.latitude || !params.longitude){
this.$modal.showToast('定位信息缺失,请重新选择所在地区')
this.addressInfo.province = ''
this.addressInfo.city = ''
this.addressInfo.district = ''
this.addressInfo.selectAddress = ''
return false;
}
if(!params.detailAddress){
this.$modal.showToast('请输入详细地址')
return false;
}
this.loading=true
console.log(params);
if(this.optionType=='edit'){


+ 1
- 1
utils/getUrl.js View File

@ -5,7 +5,7 @@ const accountInfo = wx.getAccountInfoSync();
const api={
develop:"http://127.0.0.1:8002",
develop:"http://127.0.0.1:8080",
// develop:"http://h5.xzaiyp.top",
// develop:"https://api.catmdogd.com/prod-api",
// develop:"https://api-test.catmdogd.com/test-api",


Loading…
Cancel
Save