| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- //Component Object
- let LD = {
- name:'不限',
- id:''
- }
- import { bindInput } from '../../utils/utils'
- Component({
- properties: {
- arr:{
- type:Array,
- value:[],
- observer: function() {
-
- }
- },
- active:{
- type:String,
- value:'',
- observer: function() {
-
- }
- },
-
- city:{
- type:String,
- value:'',
- observer: function(val) {
- this.setData({
- selectObj:{
- quyu: {
- name:val,
- id:''
- },
- didian: LD,
- xianshi: LD
- }
- })
- }
- }
- },
- data: {
- selectObj:{},
- min:'',
- max:''
- },
- methods: {
- bindInput,
- handleClick(e){
- console.log(this.properties.arr)
- let {type,row} = e.currentTarget.dataset
- let tmp = {}
- tmp[type] = row
- let obj = {
- selectObj:Object.assign(this.data.selectObj,tmp)
- }
- if (type==='quyu') {
- obj = {
- selectObj:Object.assign(this.data.selectObj,{
- didian: LD,
- xianshi:LD
- })
- }
- }
- if (type==='didian') {
- obj = {
- selectObj:Object.assign(this.data.selectObj,{
- xianshi: LD
- })
- }
- }
- if (type === 'jiage') {
- obj = {
- selectObj:Object.assign(this.data.selectObj,tmp),
- minjiage: '',
- maxjiage: ''
- }
- }
- if (type === 'jushi') {
- obj = {
- selectObj:Object.assign(this.data.selectObj,tmp),
- minjushi: '',
- maxjushi: ''
- }
- }
- Object.keys(this.data.selectObj).forEach(item=>{
- let i =this.data.selectObj[item]
- i.name = i.name.replace('不限','')
- })
- this.setData(obj)
- this.triggerEvent('selecthandle',{
- type,
- selectObj:this.data.selectObj
- })
- },
- comfirm(e){
- let {type} = e.currentTarget.dataset
- let tmp = {}
- let min =this.data['min'+type]
- let max =this.data['max'+type]
- tmp[type] = (!isNaN(min)&&!isNaN(max))?`${min}#${max}`:''
-
- // console.log(tmp);
- // let test = new RegExp(/\D/g)
-
- this.triggerEvent('comfirmhandle',tmp)
- }
- },
- created: function() {
- },
- attached: function() {
- },
- ready: function() {
- },
- moved: function() {
- },
- detached: function() {
- }
- });
-
|