修改城市
This commit is contained in:
@@ -8,16 +8,12 @@
|
||||
<view class="positionview">
|
||||
<view class="postop">
|
||||
<view class="posleft">
|
||||
<image class="leftimg" src="https://qicheoss.oss-cn-shanghai.aliyuncs.com/static/images/images/position.png"
|
||||
mode="">
|
||||
</imag>
|
||||
<!-- <u-icon name="map-fill" color="#3D3D3D" size="14"></u-icon> -->
|
||||
<u-icon name="map-fill" color="#3D3D3D" size="14"></u-icon>
|
||||
<text class="lefttxt">选择门店</text>
|
||||
</view>
|
||||
<view class="posright" @click="link('/pages/repair/selectCity')">
|
||||
<text class="righttxt">{{ cityname?cityname:citySave }}</text>
|
||||
<text class="righttxt">{{ selectCity?selectCity:citySave }}</text>
|
||||
<u-icon name="arrow-right" color="#999999" size="10"></u-icon>
|
||||
<!-- <image class="rightimg" src="https://qicheoss.oss-cn-shanghai.aliyuncs.com/static/images/images/right.png" mode=""></image>-->
|
||||
</view>
|
||||
</view>
|
||||
<z-paging ref="paging" :fixed="false" use-page-scroll auto-full-height v-model="dataList" @query="queryList">
|
||||
@@ -77,13 +73,11 @@
|
||||
latitude: '30',
|
||||
longitude: '126'
|
||||
},
|
||||
cityname: '',
|
||||
}
|
||||
},
|
||||
computed: { ...mapGetters(['checkIds', 'citySave', 'homenum']) },
|
||||
computed: { ...mapGetters(['checkIds', 'citySave', 'homenum','selectCity']) },
|
||||
onLoad(query) {
|
||||
console.log(query, 'repair--query')
|
||||
this.cityname = query.cityname
|
||||
if (this.selectCity) this.citySave=this.selectCity
|
||||
if (this.homenum == 1) {
|
||||
uni.setNavigationBarTitle({ title: '常规保养' })
|
||||
}
|
||||
@@ -102,14 +96,13 @@
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
success: res => {
|
||||
console.log(res)
|
||||
qqmapsdk.reverseGeocoder({
|
||||
location: {
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude
|
||||
},
|
||||
success: res1 => {
|
||||
console.log(res1.result.address_component.city)
|
||||
// console.log(res1.result.address_component.city)
|
||||
this.$store.dispatch('SetCity', res1.result.address_component.city)
|
||||
},
|
||||
fail: res => {
|
||||
@@ -137,7 +130,6 @@
|
||||
})
|
||||
},
|
||||
callPhone(phoneNumber) {
|
||||
console.log(phoneNumber)
|
||||
uni.makePhoneCall({ phoneNumber })
|
||||
},
|
||||
link(url, id) {
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
<template v-for="(item, index) in itemArr">
|
||||
<u-index-anchor :text="indexList[index]" :id="index" :index="index">
|
||||
</u-index-anchor>
|
||||
<u-index-item :key="indexList[index]">
|
||||
<view class="list-cell" v-for="(cell, index) in item">
|
||||
<u-index-item :key="indexList[index]" :item='item' @getItem='getItem'>
|
||||
<view class="list-cell" v-for="(cell,index) in item" :key="cell.code" @click="clickCity(index)">
|
||||
{{cell.city}}
|
||||
</view>
|
||||
</u-index-item>
|
||||
@@ -64,7 +64,9 @@
|
||||
itemArr: [],
|
||||
cityNmae: '',
|
||||
citySearch:[],
|
||||
isShow:true
|
||||
isShow:true,
|
||||
// 顺序城市索引
|
||||
cityIndex:null,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -72,11 +74,9 @@
|
||||
},
|
||||
onLoad() {
|
||||
let areas = area.city_list
|
||||
console.log(area, 'area');
|
||||
for (let key in areas) {
|
||||
this.itemArr.push(areas[key])
|
||||
};
|
||||
console.log(this.itemArr,'itemarrrrrr');
|
||||
},
|
||||
onShow() {
|
||||
this.getHotCity()
|
||||
@@ -87,23 +87,34 @@
|
||||
this.hotCity=res.data
|
||||
},
|
||||
citySelect(e) {
|
||||
console.log(e,'eeeeeeeeeee');
|
||||
},
|
||||
searchBtn() {
|
||||
this.citySearch = this.searchCity(this.itemArr, this.cityNmae)
|
||||
// console.log(this.citySearch,'itemarrrrrrrrr');
|
||||
},
|
||||
searchCity(arr, targetCity) {
|
||||
const flatArr = arr.flat();
|
||||
const result = flatArr.filter(item => item.city.includes(targetCity));
|
||||
return result;
|
||||
},
|
||||
// 热门城市
|
||||
getCityName(name){
|
||||
console.log(name,'点击城市名');
|
||||
this.$store.dispatch('SetCity', name)
|
||||
let cityname=name
|
||||
uni.navigateTo({
|
||||
url:`/pages/repair/repair?cityname=${cityname}`,
|
||||
this.$store.dispatch('SelectCity', name)
|
||||
uni.navigateBack({
|
||||
url:`/pages/repair/repair`,
|
||||
})
|
||||
},
|
||||
// 顺序城市
|
||||
clickCity(index){
|
||||
this.cityIndex=index
|
||||
},
|
||||
getItem(getItem){
|
||||
getItem.forEach((ele,index)=>{
|
||||
if(this.cityIndex==index){
|
||||
this.$store.dispatch('SelectCity', ele.city)
|
||||
uni.navigateBack({
|
||||
url:`/pages/repair/repair`,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,13 +44,31 @@
|
||||
this.getMineInfo()
|
||||
},
|
||||
methods: {
|
||||
async getMineInfo(){
|
||||
getMineInfo(){
|
||||
// const res =await getMineInfoAPI()
|
||||
const detail=await realNameDetaiNowlAPI()
|
||||
this.myInfo=detail.data
|
||||
realNameDetaiNowlAPI().then(res=>{
|
||||
this.myInfo=res.data
|
||||
}).catch(err=>{
|
||||
uni.showModal({
|
||||
title: "您还没有完善信息,是否现在去完善信息!",
|
||||
cancelText: "稍后再去",
|
||||
confirmText: "现在就去",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/user/realName",
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log("用户点击取消");
|
||||
}
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
// this.myInfo.phone=this.phoneHide(detail.data.phone)
|
||||
// this.myInfo.idCard=this.idCardHide(detail.data.idCard)
|
||||
// this.myInfo.realName=detail.data.realName
|
||||
|
||||
},
|
||||
// 脱敏
|
||||
phoneHide(phone) {
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
<view class="model_view" >
|
||||
<view class="view_txt"> 请选择车型 </view>
|
||||
<view class="list_view">
|
||||
<u-list @scrolltolower="scrolltolower">
|
||||
<u-list @scrolltolower="scrolltolower" height="375">
|
||||
<u-list-item v-for="(item, index) in modelNameList" :key="index" >
|
||||
<u-cell :title="`${ index+1 } 、${item.brandName} —— ${item.name}`" @click="clickCell(item)"></u-cell>
|
||||
</u-list-item>
|
||||
@@ -145,6 +145,7 @@
|
||||
|
||||
<script>
|
||||
import { userBindAPI, getCarInfoAPI,modelListAPI } from '@/api/user'
|
||||
import { getMineInfoAPI, realNameDetaiNowlAPI } from '@/api/mine'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -166,12 +167,12 @@
|
||||
modelName:''
|
||||
},
|
||||
carInfo: {},
|
||||
noneInfo: true,
|
||||
noneInfo: true,
|
||||
dataTime: '',
|
||||
// 车型
|
||||
modelData:{
|
||||
page: 1,
|
||||
limit: 20,
|
||||
limit: 10,
|
||||
},
|
||||
modelTotal:0,
|
||||
modelTotalPage:0,
|
||||
@@ -214,7 +215,8 @@
|
||||
}
|
||||
]
|
||||
],
|
||||
|
||||
// 用户信息
|
||||
mineInfo:{}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -238,7 +240,6 @@
|
||||
watch: {
|
||||
formData: {
|
||||
handler(val) {
|
||||
console.log(val, 'valllllllllllll');
|
||||
if (val.carNo.length > 9) {
|
||||
this.$toast('超出车牌长度')
|
||||
}
|
||||
@@ -260,15 +261,12 @@
|
||||
methods: {
|
||||
// 使用性质
|
||||
confirmTypeBtn(e){
|
||||
console.log(e,'confirm222222');
|
||||
console.log(e.value[0].id,'ididididid');
|
||||
this.formData.type=e.value[0].id
|
||||
this.type=e.value[0].type
|
||||
this.showType=false
|
||||
},
|
||||
// 车辆类型
|
||||
confirmCategoryBtn(e){
|
||||
console.log(e,'confirm222222');
|
||||
this.formData.category=e.value[0].id
|
||||
this.category=e.value[0].category
|
||||
this.showCategory=false
|
||||
@@ -276,7 +274,6 @@
|
||||
|
||||
// 车型
|
||||
scrolltolower(){
|
||||
console.log('触底触底');
|
||||
if(this.modelData.page<this.modelTotalPage){
|
||||
this.modelData.page += 1
|
||||
}
|
||||
@@ -288,8 +285,8 @@
|
||||
},
|
||||
// 车辆型号
|
||||
modelList(){
|
||||
// 车辆型号
|
||||
modelListAPI(this.modelData).then(res=>{
|
||||
console.log(res,'car-ressssss');
|
||||
this.nameList=res.data.list
|
||||
this.modelTotal=res.data.total
|
||||
this.modelTotalPage=res.data.totalPage
|
||||
@@ -299,28 +296,52 @@
|
||||
}).catch(err=>{
|
||||
this.$toast(err)
|
||||
})
|
||||
// 用户信息
|
||||
getMineInfoAPI().then(res=>{
|
||||
this.mineInfo=res.data
|
||||
}).catch(err=>{
|
||||
console.log(err);
|
||||
})
|
||||
},
|
||||
// 提交
|
||||
async submit() {
|
||||
if (this.noneInfo == true) {
|
||||
userBindAPI(this.carInfo).then(res => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/user/bindResult'
|
||||
})
|
||||
}).catch(err => {
|
||||
this.$toast(err)
|
||||
})
|
||||
} else {
|
||||
userBindAPI(this.formData).then(res => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/user/bindResult'
|
||||
})
|
||||
}).catch(err => {
|
||||
this.$toast(err)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
// 未实名 isCertification => true已实名
|
||||
if(this.mineInfo.isCertification){
|
||||
if (this.noneInfo == true) {
|
||||
userBindAPI(this.carInfo).then(res => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/user/bindResult'
|
||||
})
|
||||
}).catch(err => {
|
||||
this.$toast(err)
|
||||
})
|
||||
} else {
|
||||
userBindAPI(this.formData).then(res => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/user/bindResult'
|
||||
})
|
||||
}).catch(err => {
|
||||
this.$toast(err)
|
||||
})
|
||||
}
|
||||
}else{
|
||||
// this.$toast('请先完善实名信息')
|
||||
uni.showModal({
|
||||
title: "您还没有完善信息,是否现在去完善信息!",
|
||||
cancelText: "稍后再去",
|
||||
confirmText: "现在就去",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/user/realName",
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log("用户点击取消");
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
cancel() {
|
||||
this.carClose()
|
||||
this.formData.carNo = ''
|
||||
@@ -330,9 +351,7 @@
|
||||
},
|
||||
// 点击确认
|
||||
keyboardConfirmBtn() {
|
||||
// console.log(this.formData.carNo,'this.formData');
|
||||
getCarInfoAPI({ carNo: this.formData.carNo }).then(res => {
|
||||
// console.log(res);
|
||||
if (res.data) {
|
||||
this.carInfo = res.data
|
||||
this.$store.dispatch('CarNo', this.formData.carNo)
|
||||
@@ -352,9 +371,7 @@
|
||||
},
|
||||
// 车牌格式 按键被点击
|
||||
keyboardChange(e) {
|
||||
// console.log(e,'keyboardChange-eeeeeee');
|
||||
let a = this.checkType(e);
|
||||
// console.log(a,'aaaaaaaaaaaa');
|
||||
if (a == 1) {
|
||||
if (this.formData.carNo) {
|
||||
this.formData.carNo = this.replaceStr(this.formData.carNo, 0, e)
|
||||
@@ -375,13 +392,11 @@
|
||||
},
|
||||
// 下标替换字符串
|
||||
replaceStr(str, index, char) {
|
||||
// console.log(str, index, char,'----str, index, char----');
|
||||
const strAry = str.split('');
|
||||
strAry[index] = char;
|
||||
return strAry.join('');
|
||||
},
|
||||
checkType(str) {
|
||||
// console.log(str,'type----str');
|
||||
if (/^[\u4e00-\u9fa5]+$/.test(str)) {
|
||||
// 中文
|
||||
return 1
|
||||
@@ -413,7 +428,6 @@
|
||||
},
|
||||
|
||||
datetimeConfirmBtn() {
|
||||
// this.formData.unbindDate=new Date(this.datetimeValue).toLocaleDateString()
|
||||
this.datetimeShow = false
|
||||
const date = new Date(this.datetimeValue)
|
||||
const year = date.getFullYear()
|
||||
@@ -424,7 +438,6 @@
|
||||
const second = date.getSeconds()
|
||||
this.alltime = year + '-' + this.addZero(month) + '-' + this.addZero(day) + ' ' + this.addZero(hour) + ':' +
|
||||
this.addZero(minute) + ':' + this.addZero(second)
|
||||
console.log(this.alltime, 'alltime');
|
||||
this.formData.unbindTime = this.alltime
|
||||
this.dataTime = `${year}年${month}月${day}日`
|
||||
},
|
||||
@@ -435,8 +448,6 @@
|
||||
return num
|
||||
},
|
||||
|
||||
|
||||
|
||||
// 上传
|
||||
upload(name, key, type) {
|
||||
if (name === 'image') {
|
||||
@@ -457,7 +468,6 @@
|
||||
sourceType: ['album', 'camera'],
|
||||
dir: 'crmebimage/public/product/'
|
||||
}, null, res => {
|
||||
console.log(res);
|
||||
this.formData[key] = res.data
|
||||
this.videoOrImage = false
|
||||
uni.hideLoading();
|
||||
@@ -479,7 +489,6 @@
|
||||
},
|
||||
false,
|
||||
res => {
|
||||
console.log(res);
|
||||
this.formData[key] = res.data
|
||||
this.videoImage = res.data + '?x-oss-process=video/snapshot,t_1000,ar_auto,m_fast,f_png,w_500'
|
||||
this.$store.dispatch('SetForm', { key: 'formData', value: this.formData })
|
||||
@@ -508,7 +517,7 @@
|
||||
}
|
||||
.list_view{
|
||||
// border: 1px solid blue;
|
||||
// height: 95%;
|
||||
// height: 730rpx;
|
||||
// overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ const getters = {
|
||||
checkIds: state => state.tools.checkIds,
|
||||
orderIds: state => state.tools.orderIds,
|
||||
citySave: state => state.tools.citySave,
|
||||
selectCity: state => state.tools.selectCity,
|
||||
homenum: state => state.tools.homenum,
|
||||
carNo: state => state.tools.carNo,
|
||||
setupnum: state => state.tools.setupnum,
|
||||
|
||||
@@ -6,6 +6,7 @@ const tools = {
|
||||
checkIds: uni.getStorageSync('vuex_checkIds') || [],
|
||||
orderIds: uni.getStorageSync('vuex_orderIds') || [],
|
||||
citySave: '',
|
||||
selectCity:'', // 选择城市
|
||||
homenum: null, // 区别repairType
|
||||
carNo: '', // 车牌号
|
||||
setupnum: null, // 区别协议隐私
|
||||
@@ -28,6 +29,9 @@ const tools = {
|
||||
SET_CITY: (state, city) => {
|
||||
state.citySave = city
|
||||
},
|
||||
SET_SELECTCITY: (state, selectCity) => {
|
||||
state.selectCity = selectCity
|
||||
},
|
||||
SET_CARNO: (state, carNo) => {
|
||||
state.carNo = carNo
|
||||
},
|
||||
@@ -72,6 +76,10 @@ const tools = {
|
||||
SetCity({ commit }, city) {
|
||||
console.log('vuex', city);
|
||||
commit('SET_CITY', city)
|
||||
},
|
||||
SelectCity({ commit }, selectCity) {
|
||||
console.log('vuex-selectCity', selectCity);
|
||||
commit('SET_SELECTCITY', selectCity)
|
||||
},
|
||||
CarNo({ commit }, carNo) {
|
||||
console.log('vuex-carNo', carNo);
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
export default {
|
||||
props: {
|
||||
|
||||
item: {
|
||||
type:Array,
|
||||
default(){
|
||||
return []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
class="u-index-item"
|
||||
:id="`u-index-item-${id}`"
|
||||
:class="[`u-index-item-${id}`]"
|
||||
@click="clickIndex"
|
||||
>
|
||||
|
||||
<slot />
|
||||
</view>
|
||||
<!-- #ifdef APP-NVUE -->
|
||||
@@ -47,6 +49,10 @@
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
clickIndex(){
|
||||
// console.log(this.item);
|
||||
this.$emit('getItem',this.item)
|
||||
},
|
||||
init() {
|
||||
// 此处会活动父组件实例,并赋值给实例的parent属性
|
||||
this.getParentData('u-index-list')
|
||||
|
||||
Reference in New Issue
Block a user