|
@@ -20,7 +20,7 @@
|
|
|
<view class="history-city-title">历史收货地</view>
|
|
|
<view class="city-list">
|
|
|
<view class="city" v-for="(item,index) in historyScityList" :key='index'>
|
|
|
- {{item}}
|
|
|
+ {{item.selected}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -29,15 +29,19 @@
|
|
|
<view class="page">
|
|
|
<view class="title flex flex-space-between">
|
|
|
<view class="flex nav-bag-left">
|
|
|
+ <!-- 省 -->
|
|
|
<view class="flex" :class="(type==0?fstatus:sstatus)==0?'select-active':''" @click="titleClick(0)">
|
|
|
<view class="tt point">{{type==0?fchooseprovince:schooseprovince}}</view>
|
|
|
<view v-if="type==0?fchooseprovince:schooseprovince" style="margin: 0 10rpx;">></view>
|
|
|
</view>
|
|
|
- <view class="flex" v-if="(type==0?fchooseprovince:schooseprovince)!='选择'"
|
|
|
+ <!-- 市 -->
|
|
|
+ <view class="flex"
|
|
|
+ v-if="(type==0?fchooseprovince:schooseprovince)!='选择'&&(type==0?fchooseprovince:schooseprovince)!='全国'"
|
|
|
:class="(type==0?fstatus:sstatus)==1?'select-active':''" @click="titleClick(1)">
|
|
|
<view class="tt point nav-point">{{type==0?fchoosecity:schoosecity}}</view>
|
|
|
<view v-if="type==0?fchoosecity:schoosecity" style="margin: 0 10rpx;">></view>
|
|
|
</view>
|
|
|
+ <!-- 区 -->
|
|
|
<view class="tt area"
|
|
|
v-if="(type==0?fchooseprovince:schooseprovince)!='选择'&&(type==0?fchoosecity:schoosecity)!='请选择市'&&(type==0?fchoosecity:schoosecity)!='全部'"
|
|
|
:class="(type==0?fstatus:sstatus)==2?'select-active':''" @click="titleClick(2)">
|
|
@@ -117,6 +121,7 @@
|
|
|
count: 0,
|
|
|
ftitle: '',
|
|
|
stitle: '',
|
|
|
+ selectList: [],
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -129,25 +134,119 @@
|
|
|
console.log(options)
|
|
|
this.type = options.type
|
|
|
this.title = options.startPlace + '→' + options.endPlace
|
|
|
+ //获取缓存收发地
|
|
|
+
|
|
|
+ if (uni.getStorageSync('fPlaceList')) {
|
|
|
+ this.historyFcityList = uni.getStorageSync('fPlaceList');
|
|
|
+ } else {
|
|
|
+ this.historyFcityList = []
|
|
|
+ }
|
|
|
+ if (uni.getStorageSync('sPlaceList')) {
|
|
|
+ this.historyScityList = uni.getStorageSync('sPlaceList');
|
|
|
+ } else {
|
|
|
+ this.historyScityList = []
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //赋值地区
|
|
|
},
|
|
|
methods: {
|
|
|
- confirmBtn() {
|
|
|
+ // 历史收发地去重
|
|
|
+ makeHistoryList(val) {
|
|
|
debugger
|
|
|
- //判断是否点击了选项
|
|
|
- if (this.fchooseprovince == '选择') {
|
|
|
- this.$refs.uToast.show({
|
|
|
- type: 'error',
|
|
|
- message: "请选择省或直辖市",
|
|
|
- })
|
|
|
+ if (this.type == 0) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ let _obj = {}
|
|
|
+ // for (let i = 0; i < this.historyScityList.length; i++) {
|
|
|
+ // // let _data = this.historyScityList[i]
|
|
|
+ // }
|
|
|
+ if (val.selected == '全国' || val.schoosecity == '全部') {
|
|
|
+
|
|
|
+ this.historyScityList = this.historyScityList.reduce((cur, item) => {
|
|
|
+ if (item.schoosecity == val.schoosecity) {
|
|
|
+ _obj[item.selected] ? "" : _obj[item.selected] = true && cur.push(item);
|
|
|
+ return cur;
|
|
|
+ }
|
|
|
+ _obj[item.selected] ? "" : _obj[item.selected] = true && cur.push(item);
|
|
|
+ return cur;
|
|
|
+
|
|
|
+ }, [])
|
|
|
+ }
|
|
|
+ return this.historyScityList
|
|
|
}
|
|
|
+ },
|
|
|
+ confirmBtn() {
|
|
|
+ debugger
|
|
|
//设置地区
|
|
|
if (this.type == 0) {
|
|
|
+ if (this.fchooseprovince == '选择' || (this.fchoosecity == '请选择市' && this.fchooseprovince != '全国')) {
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ type: 'error',
|
|
|
+ message: "请选择区域!",
|
|
|
+ })
|
|
|
+ }
|
|
|
+ console.log(this.fchooseprovince)
|
|
|
+ console.log(this.fchoosecity)
|
|
|
+ console.log(this.fchoosearea)
|
|
|
+ // if(this.fchoosecity)
|
|
|
+ // this.historyFcityList.push('')
|
|
|
// this.fchooseprovince
|
|
|
// this.fchoosecity
|
|
|
// this.fchoosearea
|
|
|
+ } else {
|
|
|
+ if (this.schooseprovince == '选择' || (this.schoosecity == '请选择市' && this.schooseprovince != '全国')) {
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ type: 'error',
|
|
|
+ message: "请选择区域!",
|
|
|
+ })
|
|
|
+ }
|
|
|
+ console.log(this.schooseprovince)
|
|
|
+ console.log(this.schoosecity)
|
|
|
+ console.log(this.schoosearea)
|
|
|
+ let _obj = {
|
|
|
+ schooseprovince: this.schooseprovince,
|
|
|
+ schoosecity: this.schoosecity,
|
|
|
+ schoosearea: this.schoosearea,
|
|
|
+ selected: ''
|
|
|
+ }
|
|
|
+ if (this.schoosecity == '请选择市' && this.schooseprovince == '全国') {
|
|
|
+ _obj.selected = this.schooseprovince
|
|
|
+ this.historyScityList.unshift(_obj)
|
|
|
+ let _newList = this.makeHistoryList(_obj)
|
|
|
+ uni.setStorageSync('sPlaceList', _newList);
|
|
|
+ }
|
|
|
+ if (this.schoosearea == '请选择区' && this.schoosecity == '全部') {
|
|
|
+ _obj.selected = this.schooseprovince
|
|
|
+ this.historyScityList.unshift(_obj)
|
|
|
+ let _newList = this.makeHistoryList(_obj)
|
|
|
+
|
|
|
+ uni.setStorageSync('sPlaceList', _newList);
|
|
|
+ }
|
|
|
+ if (this.schoosearea == '全部') {
|
|
|
+ _obj.selected = this.schoosecity
|
|
|
+ this.historyScityList.unshift(_obj)
|
|
|
+ let _newList = this.makeHistoryList(_obj)
|
|
|
+ uni.setStorageSync('sPlaceList', _newList);
|
|
|
+ }
|
|
|
+ debugger
|
|
|
+ if (this.schoosearea != '请选择区' && this.schoosearea != '全部') {
|
|
|
+ let _list = this.schoosearea.split(',')
|
|
|
+ let _newList
|
|
|
+ for (let i = 0; i < _list.length; i++) {
|
|
|
|
|
|
+ let _deepObj = uni.$u.deepClone(_obj)
|
|
|
+ _deepObj.selected = _list[i]
|
|
|
+ this.historyScityList.unshift(_deepObj)
|
|
|
+ _newList = this.makeHistoryList(_deepObj)
|
|
|
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ console.log(_newList)
|
|
|
+ uni.setStorageSync('sPlaceList', this.historyScityList);
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(this.historyScityList)
|
|
|
+ // this.historyScityList
|
|
|
// schooseprovince
|
|
|
// schoosecity
|
|
|
// schoosearea
|
|
@@ -185,7 +284,6 @@
|
|
|
},
|
|
|
// 点击面包屑导航
|
|
|
titleClick(status) {
|
|
|
- debugger
|
|
|
this.ftitle = ''
|
|
|
this.stitle = ''
|
|
|
this.count = 0
|
|
@@ -240,30 +338,31 @@
|
|
|
this.fchoosecity = '请选择市'
|
|
|
this.fchoosearea = '请选择区'
|
|
|
this.isfprovince = i
|
|
|
- } else {
|
|
|
- this.schoosecity = '请选择市'
|
|
|
- this.schoosearea = '请选择区'
|
|
|
- this.issprovince = i
|
|
|
- }
|
|
|
- if (item.child) {
|
|
|
- if (this.type == 0) {
|
|
|
+ this.fchooseprovince = item.label
|
|
|
+ if (item.child) {
|
|
|
this.fcitylist = item.child
|
|
|
- } else {
|
|
|
- this.scitylist = item.child
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
- // this.setchose(1)
|
|
|
- if (this.type == 0) {
|
|
|
- this.fchooseprovince = item.label
|
|
|
+ if (this.fchoosecity != '全部') {
|
|
|
+ this.fstatus = statusIndex + 1
|
|
|
+ }
|
|
|
} else {
|
|
|
+ this.issprovince = i
|
|
|
this.schooseprovince = item.label
|
|
|
- }
|
|
|
- if ((this.type == 0 ? this.fchoosecity : this.schoosecity) != '全部') {
|
|
|
- if (this.type == 0) {
|
|
|
- this.fstatus = statusIndex + 1
|
|
|
+ if (item.label == '全国') {
|
|
|
+ item.checked = !item.checked
|
|
|
+ if (!item.checked) {
|
|
|
+ this.issprovince = null
|
|
|
+ }
|
|
|
+ return
|
|
|
} else {
|
|
|
- this.sstatus = statusIndex + 1
|
|
|
+ this.schoosecity = '请选择市'
|
|
|
+ this.schoosearea = '请选择区'
|
|
|
+ if (item.child) {
|
|
|
+ this.scitylist = item.child
|
|
|
+ }
|
|
|
+ if (this.schoosecity != '全部') {
|
|
|
+ this.sstatus = statusIndex + 1
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -287,9 +386,6 @@
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- // this.setchose(2)
|
|
|
- // if (item.label != '市辖区' && item.label != '特别行政区') {
|
|
|
-
|
|
|
if (this.type == 0) {
|
|
|
this.fchoosecity = item.label
|
|
|
} else {
|
|
@@ -305,26 +401,34 @@
|
|
|
},
|
|
|
//选择区
|
|
|
selectaArea(item, i) {
|
|
|
- debugger
|
|
|
-
|
|
|
if (item.label == '全部') {
|
|
|
- for (let i = 0; i < this.sarealist.length; i++) {
|
|
|
- if (i != 0) {
|
|
|
- this.sarealist[i].checked = false
|
|
|
- }
|
|
|
+ if (this.type == 0) {
|
|
|
+ for (let i = 0; i < this.farealist.length; i++) {
|
|
|
+ if (i == 0) {
|
|
|
+ this.farealist[i].checked = true
|
|
|
+ } else {
|
|
|
+ this.farealist[i].checked = false
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ this.fchoosearea = '全部'
|
|
|
+ this.$forceUpdate()
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ for (let i = 0; i < this.sarealist.length; i++) {
|
|
|
+ if (i == 0) {
|
|
|
+ this.sarealist[i].checked = true
|
|
|
+ } else {
|
|
|
+ this.sarealist[i].checked = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.schoosearea = '全部'
|
|
|
+ this.$forceUpdate()
|
|
|
+ return
|
|
|
}
|
|
|
- return
|
|
|
}
|
|
|
|
|
|
if (this.count < 3) {
|
|
|
- this.$u.toast(item.label)
|
|
|
- // if (item.checked) {
|
|
|
- // item.checked = !item.checked
|
|
|
- // return
|
|
|
- // }else{
|
|
|
- // // this.count--;
|
|
|
- // }
|
|
|
item.checked = !item.checked
|
|
|
if (item.checked && this.count < 3) {
|
|
|
this.count++;
|
|
@@ -342,12 +446,9 @@
|
|
|
message: "最多选择3个地区",
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
this.$forceUpdate()
|
|
|
+ //设置面包屑 0发货地 1收货地
|
|
|
if (this.type == 0) {
|
|
|
if (item.checked && !this.fchoosearea.includes(item.label)) {
|
|
|
if (this.ftitle) {
|
|
@@ -355,11 +456,9 @@
|
|
|
} else {
|
|
|
this.ftitle += item.label
|
|
|
}
|
|
|
-
|
|
|
this.fchoosearea = this.ftitle
|
|
|
console.log(this.fchoosearea)
|
|
|
} else {
|
|
|
-
|
|
|
if (this.ftitle.includes(',' + item.label)) {
|
|
|
this.ftitle = this.ftitle.replace(',' + item.label, '')
|
|
|
this.fchoosearea = this.fchoosearea.replace(',' + item.label, '')
|
|
@@ -373,11 +472,8 @@
|
|
|
this.ftitle = this.ftitle.replace(item.label + ',', '')
|
|
|
this.fchoosearea = this.fchoosearea.replace(item.label + ',', '')
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
if (item.checked && !this.schoosearea.includes(item.label)) {
|
|
|
if (this.stitle) {
|
|
@@ -385,14 +481,12 @@
|
|
|
} else {
|
|
|
this.stitle += item.label
|
|
|
}
|
|
|
-
|
|
|
this.schoosearea = this.stitle
|
|
|
} else {
|
|
|
if (this.stitle.includes(',' + item.label)) {
|
|
|
this.stitle = this.stitle.replace(',' + item.label, '')
|
|
|
this.schoosearea = this.schoosearea.replace(',' + item.label, '')
|
|
|
} else {
|
|
|
-
|
|
|
let _val = this.stitle.split(',')
|
|
|
let _len = _val.length;
|
|
|
if (_len == 1) {
|
|
@@ -402,51 +496,10 @@
|
|
|
this.stitle = this.stitle.replace(item.label + ',', '')
|
|
|
this.schoosearea = this.schoosearea.replace(item.label + ',', '')
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
- // this.getchoose()
|
|
|
},
|
|
|
- // getchoose() {
|
|
|
- // const {
|
|
|
- // chooseprovince,
|
|
|
- // choosecity,
|
|
|
- // choosearea
|
|
|
- // } = this
|
|
|
- // this.$emit('conceal', {
|
|
|
- // chooseprovince,
|
|
|
- // choosecity,
|
|
|
- // choosearea
|
|
|
- // })
|
|
|
- // },
|
|
|
- // setchose(id) {
|
|
|
- // if (id == 1) {
|
|
|
- // this.choosecity = ''
|
|
|
- // this.choosearea = ''
|
|
|
-
|
|
|
- // if (this.type == 0) {
|
|
|
- // this.isfcity = null
|
|
|
- // } else {
|
|
|
- // this.isscity = null
|
|
|
- // }
|
|
|
- // if (this.type == 0) {
|
|
|
- // this.isfarea = null
|
|
|
- // } else {
|
|
|
- // this.issarea = null
|
|
|
- // }
|
|
|
-
|
|
|
- // } else if (id == 2) {
|
|
|
- // this.choosearea = ''
|
|
|
- // if (this.type == 0) {
|
|
|
- // this.isfarea = null
|
|
|
- // } else {
|
|
|
- // this.issarea = null
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
changeCity(type) {
|
|
|
if (type == 0) {
|
|
|
this.type = 0
|
|
@@ -454,24 +507,6 @@
|
|
|
this.type = 1
|
|
|
}
|
|
|
},
|
|
|
- // conceal1(param) {
|
|
|
- // const {
|
|
|
- // chooseprovince,
|
|
|
- // choosecity,
|
|
|
- // choosearea
|
|
|
- // } = param
|
|
|
- // // 获取到传过来的 省 市 区 县数据
|
|
|
- // this.title1 = chooseprovince + choosecity + choosearea
|
|
|
- // if (choosecity == '全部') {
|
|
|
- // this.succeed()
|
|
|
- // } else if (choosearea != '') {
|
|
|
- // this.succeed()
|
|
|
- // }
|
|
|
- // },
|
|
|
- //筛选框关闭
|
|
|
- // succeed() {
|
|
|
- // this.$refs.uDropdown.close();
|
|
|
- // },
|
|
|
back() {
|
|
|
uni.navigateBack({
|
|
|
|
|
@@ -535,8 +570,8 @@
|
|
|
}
|
|
|
|
|
|
.city-list {
|
|
|
- // height: 118rpx;
|
|
|
- // overflow: hidden;
|
|
|
+ max-height: 118rpx;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.city {
|
|
@@ -549,6 +584,7 @@
|
|
|
line-height: 33rpx;
|
|
|
border-radius: 4rpx;
|
|
|
background: #F7F8FA;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
.content2 {
|
|
@@ -556,7 +592,11 @@
|
|
|
}
|
|
|
|
|
|
.container {
|
|
|
- padding-left: 20rpx;
|
|
|
+ // width: 100%;
|
|
|
+ width: calc(100% - 40rpx);
|
|
|
+ display: inline-flex;
|
|
|
+ flex-flow: row wrap;
|
|
|
+ align-content: flex-start;
|
|
|
}
|
|
|
|
|
|
.select-active,
|
|
@@ -567,10 +607,8 @@
|
|
|
|
|
|
.content-item {
|
|
|
background: #F7F8FA;
|
|
|
- display: inline-block;
|
|
|
- width: calc(25% - 20rpx);
|
|
|
- margin: 10rpx 20rpx 10rpx 0;
|
|
|
- font-size: 26rpx;
|
|
|
+ margin: 10rpx;
|
|
|
+ font-size: 30rpx;
|
|
|
color: #333333;
|
|
|
text-align: center;
|
|
|
padding: 10rpx 0;
|
|
@@ -580,6 +618,7 @@
|
|
|
white-space: nowrap;
|
|
|
padding: 6rpx 8rpx;
|
|
|
box-sizing: border-box;
|
|
|
+ flex: 0 0 calc(25% - 20rpx);
|
|
|
}
|
|
|
|
|
|
.title {
|
|
@@ -603,7 +642,7 @@
|
|
|
|
|
|
.nav-bag-left {
|
|
|
width: 70%;
|
|
|
- font-size: 28rpx;
|
|
|
+ font-size: 30rpx;
|
|
|
}
|
|
|
|
|
|
.btn {
|