详细地址定位

master
游梦婷 1 year ago
parent 5b26b552a8
commit b66ee01d81
  1. 4
      Utils/physicalObject.js
  2. 66
      components/cart-choose/cart-choose.vue
  3. 1
      components/goods-list/goods-list.vue
  4. 7
      components/pick-regions/pick-regions.vue
  5. 68
      components/uni-combox/components/uni-combox/uni-combox.vue
  6. 44
      pages.json
  7. 377
      physical-merchants/address/addNewAddress/addNewAddress.vue
  8. 2
      physical-merchants/settleAccounts/settleAccounts.vue
  9. 11
      uni.scss
  10. 13
      uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue

@ -71,6 +71,10 @@ export const insertDeliveryAddress = params => {
return POST('POST', `${base}/deliveryAddress/insertDeliveryAddress`, params).then(res => res.data);
}
export const baiduApiMapSearch = params => {
return POST('GET', `${base}/common/baiduApiMapSearch`, params).then(res => res.data);
}
// 更新收货地址
export const updateDeliveryAddress = params => {
return POST('POST', `${base}/deliveryAddress/updateDeliveryAddress`, params).then(res => res.data);

@ -55,41 +55,49 @@
</view>
<!-- 数量分类 -->
<view class="choose-bottom-title paddbotm10 fontwig6 font14 mart15 choose-num">
<view v-if="status != 3" class="choose-bottom-title paddbotm10 fontwig6 font14 mart15 choose-num">
<view class="">购买数量</view>
<uni-number-box v-model="chooseNumber" :disabled="specificationList[chooseIndex].stock==0" :min="1" :max="specificationList[chooseIndex].stock || 9999999" @noMoreLess="noMoreLess" @noMore="noMore" @change="changeNumValue" />
</view>
</view>
<view class="choose-cart" v-if="specificationList[chooseIndex].stock==0">
<view class="choose-way" >
<view class="fcorfff way1 bgcolor-qh" @click="noStock">
暂无库存
<!-- <template v-if="isShowButton"> -->
<view class="choose-cart" v-if="specificationList[chooseIndex].stock==0">
<view class="choose-way" >
<view class="fcorfff way1 bgcolor-qh" @click="noStock">
暂无库存
</view>
</view>
</view>
</view>
<view class="choose-cart" v-else>
<view class="choose-way" v-if="status == 1">
<view class="fcorfff way bgcolor-left" @click="toCart">
加入购物车
<view class="choose-cart" v-else>
<view class="choose-way" v-if="status == 1">
<view class="fcorfff way bgcolor-left" @click="toCart">
加入购物车
</view>
<view class="fcorfff way bgcolor-ri" @click="toBuy">
立即购买
</view>
</view>
<view class="fcorfff way bgcolor-ri" @click="toBuy">
立即购买
<view class="choose-way" v-if="status == 0">
<view class="fcorfff way1 bgcolor-left" @click="toCart">
加入购物车
</view>
</view>
</view>
<view class="choose-way" v-if="status == 0">
<view class="fcorfff way1 bgcolor-left" @click="toCart">
加入购物车
<view class="choose-way" v-if="status == 2">
<view class="fcorfff way1 bgcolor-left" @click="toBuy">
立即购买
</view>
</view>
</view>
<view class="choose-way" v-if="status == 2">
<view class="fcorfff way1 bgcolor-left" @click="toBuy">
立即购买
<view class="choose-way" v-if="status == 3">
<view class="fcorfff way1 bgcolor-left" @click="toSelect">
确定选择
</view>
</view>
</view>
</view>
<!-- </template> -->
</view>
@ -118,9 +126,9 @@
return []
},
},
// 0,1
// 0,1. 2:
status:{
type:Number,
type:[Number,String],
default:0,
},
goodsDetail:{
@ -128,6 +136,10 @@
default() {
return {}
}
},
isShowButton:{
type:Boolean,
default:true,
}
},
watch:{
@ -241,6 +253,12 @@
},
//
toSelect(){
this.$emit('close',this.specificationList[this.chooseIndex])
},
//
toBuy(){

@ -595,6 +595,7 @@
.goods-item-bottom .new-price {
color: #3DA7E7;
font-weight: bold;
font-size: 18px;
}
.goods-item-bottom .old-price {

@ -83,6 +83,7 @@
}else if(region){ //&&region.length == 6
this.handleDefaultRegion(region)
}else{
console.log(region)
console.warn('defaultRegion非有效格式')
}
@ -195,9 +196,15 @@
if(i==0 && j==(children.length-1)){
this.isInitMultiArray = true;
}
this.$emit('failreagion')
}
}
}
let address = [this.CHINA_REGIONS[this.multiIndex[0]],this.cityArr[this.multiIndex[1]],this.districtArr[this.multiIndex[2]]];
this.$emit('getRegion',address)
}
},
}

@ -4,17 +4,29 @@
<text>{{label}}</text>
</view>
<view class="uni-combox__input-box">
<input class="uni-combox__input" type="text" :placeholder="placeholder" v-model="inputVal" @input="onInput"
<input class="uni-combox__input" type="text" :placeholder="placeholder" :placeholder-class="placeholderClass" v-model="inputVal" @input="onInput"
@focus="onFocus" @blur="onBlur" />
<uni-icons class="uni-combox__input-arrow" type="arrowdown" size="14" @click="toggleSelector"></uni-icons>
<view class="uni-combox__selector" v-if="showSelector">
<scroll-view scroll-y="true" class="uni-combox__selector-scroll">
<uni-icons class="uni-combox__input-arrow" v-if="isShowIcon" type="arrowdown" size="14" @click="toggleSelector"></uni-icons>
<view v-else class="icon location foc3da7e7" @click="location"></view>
<view :class="' uni-combox__selector '+(isAddress?' topmore ': ' ')" v-if="showSelector">
<scroll-view v-if="isShowIcon" scroll-y="true" class="uni-combox__selector-scroll">
<view class="uni-combox__selector-empty" v-if="filterCandidatesLength === 0">
<text>{{emptyTips}}</text>
</view>
<view class="uni-combox__selector-item" v-for="(item,index) in filterCandidates" :key="index" @click="onSelectorClick(index)">
<text>{{item}}</text>
</view>
</scroll-view>
<!-- -->
<scroll-view v-else scroll-y="true" class="uni-combox__selector-scroll">
<view class="uni-combox__selector-empty" v-if="candidates.length === 0">
<text>{{emptyTips}}</text>
</view>
<view v-else class="uni-combox__selector-item" @click="toggleSelector" >
<slot></slot>
</view>
</scroll-view>
</view>
</view>
@ -56,12 +68,24 @@
},
emptyTips: {
type: String,
default: '无匹配项'
default: '无匹配项'
},
value: {
type: [String, Number],
default: ''
}
},
isAddress:{
type:Boolean,
default:false
},
isShowIcon:{
type:Boolean,
default:true
},
placeholderClass:{
type: String,
default: ''
},
},
data() {
return {
@ -96,13 +120,32 @@
}
},
methods: {
location(){
this.showSelector = !this.showSelector
if(this.isAddress&&this.showSelector){
this.$emit("location")
}
},
toggleSelector() {
this.showSelector = !this.showSelector
},
onFocus() {
this.showSelector = true
this.$emit("focus");
if(this.isAddress){
this.showSelector = false
}else{
this.showSelector = true
}
},
onBlur() {
this.$emit("blur")
if(this.isAddress){
this.showSelector = false;
return
}
setTimeout(() => {
this.showSelector = false
}, 153)
@ -169,13 +212,20 @@
background-color: #FFFFFF;
border-radius: 6px;
box-shadow: #DDDDDD 4px 4px 8px, #DDDDDD -4px -4px 8px;
z-index: 2;
z-index: 100;
.topmore{
top:52px;
}
}
.uni-combox__selector-scroll {
max-height: 200px;
box-sizing: border-box;
}
.uni-combox__selector-scroll2 {
max-height:300px;
box-sizing: border-box;
}
.uni-combox__selector::before {
content: '';
@ -186,7 +236,7 @@
border-right: solid 6px transparent;
border-left: solid 6px transparent;
left: 50%;
top: -6px;
top: -4px;
margin-left: -6px;
}

@ -1125,7 +1125,7 @@
{
"path": "address/addNewAddress/addNewAddress",
"style": {
"navigationBarTitleText": "新增地址",
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
@ -1164,13 +1164,7 @@
"enablePullDownRefresh": false
}
},
// {
// "path": "wuliu/wuliu",
// "style": {
// "navigationBarTitleText": "物流信息",
// "enablePullDownRefresh": false
// }
// },
{
"path": "classify/order/pay",
"style": {
@ -1189,6 +1183,40 @@
"enablePullDownRefresh": false
}
}
// ,
// {
// "path": "applyRefund/applyRefund",
// "style": {
// // "navigationBarTitleText": "",
// "enablePullDownRefresh": false
// }
// },
// {
// "path": "applyRefund/selectApplyRefund",
// "style": {
// "navigationBarTitleText": "申请售后",
// "enablePullDownRefresh": false
// }
// },
// {
// "path": "applyRefund/refundDetail",
// "style": {
// "navigationBarTitleText": "退款详情",
// "enablePullDownRefresh": false
// }
// },
// {
// "path": "applyRefund/fillRefundWuliu",
// "style": {
// "navigationBarTitleText": "填写退货物流",
// "enablePullDownRefresh": false
// }
// }
]
}

@ -1,66 +1,75 @@
<template>
<view class="page-bottom-fixed backcor9">
<form @submit="form_submit" class="form-container">
<view class="pd-main height100">
<view class="pd-main border-box height100" style="overflow-y: auto;">
<view class="form-gorup backcolorfff">
<!-- <view class="form-gorup-item-left">
<view class="form-gorup-title marb10">联系人<text class="form-group-tips-must">*</text></view>
<input type="text" name="name" v-model="userAddress.name" maxlength="5"
placeholder-class="corf6" class="fcor666 " placeholder="联系人2~5个字符">
</view>
<view class="form-gorup-item-right">
<view class="form-gorup-title marb10">联系电话<text class="form-group-tips-must">*</text></view>
<input type="number" name="tel" v-model="userAddress.tel" maxlength="11"
placeholder-class="corf6" class="fcor666" placeholder="手机号">
</view> -->
<!-- -->
<view class="form-gorup-title">联系人<text class="form-group-tips-must">*</text>
<view class="dis-flex">
<view class="form-gorup-title marRight10">收货人:
</view>
<input type="text" name="name" v-model="userAddress.name"
placeholder-class="corf6" class="fcor666 bs-bb" placeholder="联系人2~5个字符">
<input type="text" name="name" v-model="userAddress.name" placeholder-class="corf6"
class="fcor666 flex-1 bs-bb" placeholder="名字">
</view>
<view class="width100 mart10 border-b">
</view>
<view class="form-gorup-title">联系电话<text class="form-group-tips-must">*</text>
<view class="dis-flex">
<view class="form-gorup-title marRight10">手机号码:
</view>
<input type="number" name="tel" v-model="userAddress.tel" maxlength="11"
placeholder-class="corf6" class="fcor666 flex-1" placeholder="手机号">
</view>
<input type="number" name="tel" v-model="userAddress.tel" maxlength="11"
placeholder-class="corf6" class="fcor666" placeholder="手机号">
<!-- -->
</view>
<view class="form-gorup backcolorfff">
<view class="">
<pick-regions :defaultRegion="defaultRegionCode" @getRegion="handleGetRegion">
<view class="dis-flex flex-sp form-gorup-title">
<view class=" flex-1">点击选择省市区<text class="form-group-tips-must">必选</text></view>
<view class="icon-ymt to-right font14 fcor666">
</view>
<view class="">
<pick-regions :defaultRegion="defaultRegionCode" @getRegion="handleGetRegion">
<view class="dis-flex ">
<view class=" form-gorup-title">所在地区:</view>
<view class="dis-flex flex-1 flex-end">
<view class=" pickRes fcor666">{{userAddress.region || '请选择'}}</view>
<view class="icon-ymt to-right font14 fcor666"></view>
</view>
</pick-regions>
<view class=" pickRes fcor666" >{{userAddress.region || '请选择'}}</view>
</view>
<view class="width100 mart10 border-b">
</view>
</view>
<view style="clear: both;">
<view class="form-gorup-title">详细地址<text class="form-group-tips-must">*</text>
</pick-regions>
</view>
<input type="text" name="address" v-model="userAddress.address" maxlength="40"
placeholder-class="corf6" :class="'fcor666 bs-bb '" placeholder="详细地址1~40个字符">
</view>
<view class="width100 mart10 border-b">
</view>
<!-- <view style="clear: both;"> -->
<view class="dis-flex">
<view class="form-gorup-title marRight10">详细地址:</view>
<uni-combox @location="location" placeholderClass="corf6" :candidates="candidates" class="flex-1" :isAddress="true" :isShowIcon="false" placeholder="请输入详细地址" v-model="userAddress.address">
<view class="selector-item" v-for="(item,index) in candidates" :key="index" @click="getSelect(item)">
<view class="text1 name">
{{item.name}}
</view>
<view class="text1 address mart5">
{{item.address}}
</view>
</view>
</uni-combox>
<!-- <input type="text" name="address" v-model="userAddress.address" maxlength="40"
placeholder-class="corf6" :class="'fcor666 bs-bb flex-1'" placeholder="详细地址1~40个字符"> -->
</view>
<!-- </view> -->
</view>
<view class="default-checkbox " @click="defaultChange">
@ -72,18 +81,24 @@
<button class="btn " type="default" form-type="submit">保存</button>
</view>
</view>
</form>
</view>
</template>
<script>
import pickRegions from '@/components/pick-regions/pick-regions.vue'
import UniCombox from '@/components/uni-combox/components/uni-combox/uni-combox.vue'
import {insertDeliveryAddress,findDeliveryAddressById,updateDeliveryAddress } from '@/Utils/physicalObject.js'
import {
insertDeliveryAddress,
findDeliveryAddressById,
updateDeliveryAddress,
baiduApiMapSearch
} from '@/Utils/physicalObject.js'
let app = getApp();
export default {
data() {
return {
@ -97,36 +112,44 @@
dataParams: null,
//
region: [],
regionId:'',
regionId: '',
//
defaultRegion: ['北京市', '市辖区', '东城区'],
defaultRegionCode: '110101',
// defaultRegion: ['', '', ''],
defaultRegionCode: '',
candidates:[
// {"name": "-","address": "189",},
// {"name": "-","address": "189",},
// {"name": "-","address": "189",}
],
};
},
components: {
pickRegions
pickRegions,
"uni-combox":UniCombox
},
onLoad(params) {
console.log(params)
this.dataParams = params
},
watch:{
'userAddress.name':{
watch: {
'userAddress.name': {
handler(n) {
if(n.length>5){
setTimeout(()=>{
this.userAddress.name = this.userAddress.name.substr(0,5)
},0)
}
},
if (n.length > 5) {
setTimeout(() => {
this.userAddress.name = this.userAddress.name.substr(0, 5)
}, 0)
}
},
},
},
computed: {
// regionName() {
// //
// // console.log('==============='+this.region.map(item => item))
@ -135,10 +158,16 @@
// }
},
onReady() {
let str = ""
if (this.dataParams && this.dataParams.id) {
str = "地址编辑"
} else {
str = "地址添加"
}
uni.setNavigationBarTitle({
title: '地址'+(((this.dataParams.id || null) == null) ? '添加' : '编辑')
title: str,
});
if(this.dataParams.id){
if (this.dataParams && this.dataParams.id) {
this.findAddressById(this.dataParams.id)
}
@ -147,26 +176,26 @@
methods: {
findAddressById(id){
findAddressById(id) {
let params = {
id:id
id: id
}
findDeliveryAddressById(params).then(res=>{
findDeliveryAddressById(params).then(res => {
if (res.return_code == '000000') {
let resData = res.return_data;
this.userAddress = {
name: resData.consignee,
tel: resData.phone,
region: resData.regionName,
address: resData.address,
is_default: resData.whetherDefault,
}
// console.log(this.defaultRegionCode)
this.defaultRegionCode = resData.regionId;
this.regionId = resData.regionId;
// console.log(this.defaultRegionCode)
}else{
this.userAddress = {
name: resData.consignee,
tel: resData.phone,
region: resData.regionName,
address: resData.address,
is_default: resData.whetherDefault,
}
// console.log(this.defaultRegionCode)
this.defaultRegionCode = resData.regionId;
this.regionId = resData.regionId;
// console.log(this.defaultRegionCode)
} else {
uni.showToast({
title: res.return_msg,
icon: 'none',
@ -175,27 +204,89 @@
}
})
},
//
handleGetRegion(region) {
// let region = JSON.parse(JSON.stringify(reg))
this.region = region;
this.regionId = this.region[2].code;
if(region[0].code == region[1].code&&region[0].code == region[2].code){
if (region[0].code == region[1].code && region[0].code == region[2].code) {
this.userAddress.region = this.region[0].name
}else{
} else {
this.userAddress.region = this.region.map(item => item.name).join(',');
}
console.log(this.userAddress.region,"获取选择的地区",this.regionId,this.region)
console.log(this.userAddress.region, "获取选择的地区", this.regionId, this.region)
},
//
init() {
},
//
location(){
this.userAddress.address = this.userAddress.address.replace(/\s+/g, "")
if(app.globalData.latitude&&app.globalData.longitude){
this.baiduApiMap(app.globalData.longitude,app.globalData.latitude,this.userAddress.address)
}else{
uni.getLocation({
type: 'wgs84',
success: function(res) {
app.globalData.latitude = res.latitude;
app.globalData.longitude = res.longitude;
this.baiduApiMap(app.globalData.longitude,app.globalData.latitude,this.userAddress.address)
}
})
}
},
baiduApiMap(lng,lat,query){
let params;
if(query==""){
params={
lng,lat
}
}else{
params={
lng,lat,query
}
}
baiduApiMapSearch(params).then(res=>{
console.log(res)
if (res.return_code == '000000') {
if(res.return_data&&res.return_data.length>0){
this.candidates = res.return_data;
}else{
this.candidates=[]
}
}else{
this.candidates=[]
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
})
}
})
},
getSelect(desc){
console.log(desc)
this.defaultRegionCode = desc.adcode ;
this.userAddress.address = desc.address;
},
//
defaultChange(e) {
@ -206,6 +297,10 @@
//
form_submit() {
this.userAddress.name = this.userAddress.name.replace(/\s+/g, "")
this.userAddress.tel = this.userAddress.tel.replace(/\s+/g, "")
this.userAddress.address = this.userAddress.address.replace(/\s+/g, "")
//
var validation = [{
fields: "name",
@ -214,7 +309,7 @@
{
fields: "tel",
msg: "请填写联系电话",
vali:/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
vali: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
},
{
fields: "region",
@ -227,35 +322,35 @@
];
this.fields_check(this.userAddress, validation)
let isVali = this.fields_check(this.userAddress, validation);
if(isVali){
if(this.dataParams.id){
if (isVali) {
if (this.dataParams.id) {
this.updateAddress(this.dataParams.id)
}else{
} else {
this.addAddress()
}
}
},
updateAddress(id){
updateAddress(id) {
let _this = this;
let params ={
let params = {
"id": id,
"address": _this.userAddress.address,
"consignee": _this.userAddress.name,
"phone": _this.userAddress.tel,
"regionId": _this.regionId,
"regionName":_this.userAddress.region,
"regionName": _this.userAddress.region,
"whetherDefault": _this.userAddress.is_default
}
updateDeliveryAddress(params).then(res=>{
let title ;
updateDeliveryAddress(params).then(res => {
let title;
if (res.return_code == '000000') {
title = res.return_data;
}else{
title = res.return_data;
} else {
title = res.return_msg;
}
uni.showToast({
@ -264,28 +359,28 @@
duration: 2000
})
//
this.backPageRefresh();
this.backPageRefresh();
})
},
backPageRefresh() {
backPageRefresh() {
uni.navigateBack({})
},
addAddress(){
addAddress() {
let _this = this;
let params={
let params = {
"address": _this.userAddress.address,
"consignee": _this.userAddress.name,
"phone": _this.userAddress.tel,
"regionId": _this.regionId,
"regionName":_this.userAddress.region,
"regionName": _this.userAddress.region,
"whetherDefault": _this.userAddress.is_default
}
// console.log(params,this.userAddress)
insertDeliveryAddress(params).then(res=>{
let title ;
insertDeliveryAddress(params).then(res => {
let title;
if (res.return_code == '000000') {
title = res.return_data;
}else{
title = res.return_data;
} else {
title = res.return_msg;
}
uni.showToast({
@ -293,14 +388,14 @@
icon: 'none',
duration: 2000
})
//
_this.backPageRefresh()
})
},
/**
* 字段数据校验
* data 待校验的数据, 一维json对象
@ -318,10 +413,10 @@
});
return false;
}
if(validation[i]["vali"]){
if (validation[i]["vali"]) {
// console.log(validation[i]["vali"].test(this.userAddress.tel),this.userAddress.tel)
if(!(validation[i]["vali"].test(this.userAddress.tel))){
if (!(validation[i]["vali"].test(this.userAddress.tel))) {
uni.showToast({
title: "请输入正确格式的手机号码",
duration: 1000,
@ -330,7 +425,7 @@
return false;
}
}
}
return true;
},
@ -345,12 +440,13 @@
.bottom-fixed {
position: fixed;
left: 10%;
bottom:var(--window-bottom);
bottom: var(--window-bottom);
border: none;
width: 80%;
box-sizing: border-box;
z-index: 2;
.btn{
.btn {
height: 60px;
border-radius: 30px;
background-color: #3da7e7;
@ -364,8 +460,9 @@
.page-bottom-fixed {
height: calc(100vh - var(--window-top));
padding-bottom: 100px;
padding-bottom: 75px;
box-sizing: border-box;
overflow-y: auto;
}
/*表单*/
@ -376,9 +473,10 @@
padding: 20rpx;
margin-bottom: 20rpx;
border-radius: 20rpx;
overflow: auto;
// overflow: auto;
.pickRes , input {
.pickRes,
input {
border-radius: 0;
box-sizing: border-box;
font-size: 18px;
@ -395,6 +493,9 @@
margin-bottom: 5rpx;
font-weight: 500;
font-size: 18px;
width: 74px;
white-space: nowrap;
text-align: right;
}
}
@ -408,5 +509,31 @@
font-size: 24rpx;
color: #f00;
}
.selector-item {
font-size: 16px;
text-align: center;
border-bottom: solid 1px #DDDDDD;
padding: 10px;
cursor: pointer;
text-align: left;
.name{
height: 18px;
line-height: 18px;
color: #3da7e7;
font-size: 16px;
font-weight: bold;
}
.address{
font-size: 14px;
height: 16px;
line-height: 16px;
color: #666666;
}
}
</style>

@ -172,7 +172,7 @@
</view>
<view class="width100">
<textarea :cursor-spacing="50" class="border-8r backcor9 paading10 note" :focus="false"
:disable-default-padding="false" v-model="noteValue" maxlength="40"
:disable-default-padding="false" v-model.trim="noteValue" maxlength="40"
placeholder="请输入备注信息"></textarea>
</view>

@ -252,6 +252,10 @@ $uni-font-size-paragraph:30upx;
color: #41cda2;
}
.foc3da7e7{
color: #3da7e7 !important;
}
.colorb9 {
color: #b95859;
}
@ -761,6 +765,10 @@ $uni-font-size-paragraph:30upx;
padding-left: 15px;
}
.paddleft25{
padding-left: 25px;
}
.paddtright5 {
padding-right: 5px;
}
@ -976,6 +984,9 @@ $uni-font-size-paragraph:30upx;
.border-t{
border-top: 1px solid #f6f6f6;
}
.border-b-666{
border-bottom: 1px solid #f0f0f0;
}
// 盒模型
.border-box{
box-sizing: border-box;

@ -134,11 +134,14 @@
},
_onBlur(event) {
this.$emit('blur', event)
let value = event.detail.value;
if (!value) {
// this.inputValue = 0;
return;
}
// let value = event.detail.value;
//
let value = parseInt(event.detail.value);
// if (!value) {
// // this.inputValue = 0;
// return;
// }
value = +value;
if (value > this.max) {
this.$emit("noMore")

Loading…
Cancel
Save