Jelajahi Sumber

Merge branch 'master' of http://git.zthymaoyi.com/gdc/yiliangyiyun-app

gjy 2 tahun lalu
induk
melakukan
a658b7da4b
1 mengubah file dengan 19 tambahan dan 10 penghapusan
  1. 19 10
      components/selectAddress.vue

+ 19 - 10
components/selectAddress.vue

@@ -1,7 +1,7 @@
 <template>
 	<view>
-		<picker :class="disabled?'pickerClass':''" ref='picker' @change="bindPickerChange" :value="multiIndex" :range="multiArray" range-key='label'
-			mode="multiSelector" @columnchange='columnchange'>
+		<picker :class="disabled?'pickerClass':''" ref='picker' @change="bindPickerChange" :value="multiIndex"
+			:range="multiArray" range-key='label' mode="multiSelector" @columnchange='columnchange'>
 			<view class="text" :style="textStyleEmpty" v-if="place=='选择地区'">
 				{{place}}
 			</view>
@@ -37,13 +37,13 @@
 			textStyle: {
 				type: Object,
 			},
-			disabled:{
+			disabled: {
 				value: Boolean,
 				default: false
 			}
 		},
 		watch: {
-			
+
 			// searchPlace(oldValue, newValue) {
 			// 	console.log(123)
 			// 	console.log(oldValue, newValue)
@@ -61,6 +61,7 @@
 					"font-size": '32rpx'
 				},
 				multiIndex: [0, 0, 0],
+				addressCopy: null,
 				multiArray: [
 					[],
 					[],
@@ -72,20 +73,28 @@
 			console.log(this.disabled)
 			this.place = this.searchPlace
 			console.log("this.series", this.series)
-			for (let i = 0; i < address.length; i++) {
-				this.multiArray[0].push(address[i])
+			if (this.series == 3) {
+				this.addressCopy = JSON.parse(JSON.stringify(address))
+				this.addressCopy.shift()
+			} else {
+				this.addressCopy = JSON.parse(JSON.stringify(address))
+			}
+			console.log("this.addressCopy", this.addressCopy)
+			for (let i = 0; i < this.addressCopy.length; i++) {
+				this.multiArray[0].push(this.addressCopy[i])
 
 			}
+			this.multiArray[1] = this.addressCopy[0].child
 			// this.$emit('selectAddress', '')
 		},
 		methods: {
 			columnchange(e) {
 				console.log('picker发送选择改变', e.detail)
-				this.multiIndex[e.detail.column] =e.detail.value
+				this.multiIndex[e.detail.column] = e.detail.value
 				console.log("this.multiIndex", this.multiIndex)
 				switch (e.detail.column) {
 					case 0: //拖动第1列
-						this.multiArray[1] = address[e.detail.value].child
+						this.multiArray[1] = this.addressCopy[e.detail.value].child
 						this.multiArray[2] = this.multiArray[1][0].child
 						console.log(this.multiArray[1])
 						this.multiIndex.splice(1, 1, 0)
@@ -149,7 +158,7 @@
 </script>
 
 <style lang="scss" scoped>
-	.text{
-		display:inline-block;
+	.text {
+		display: inline-block;
 	}
 </style>