You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.7 KiB
62 lines
1.7 KiB
// pages/message/index.js
|
|
const util = require('../../../utils/util')
|
|
const area = require("../../../const/area.js")
|
|
const app = getApp()
|
|
|
|
Component({
|
|
options: {
|
|
addGlobalClass: true,
|
|
multipleSlots: true
|
|
},
|
|
properties: {
|
|
height: { type: Number, value: 0 }
|
|
},
|
|
data: {
|
|
tabList: [ '全部', '华东', '华中', '华南', '西部', '北部'],
|
|
tabIndex: 0,
|
|
proviceList: [],
|
|
pIndex: 0,
|
|
form: {
|
|
proviceId: ''
|
|
},
|
|
orderList: []
|
|
},
|
|
methods: {
|
|
onRestart: function () {
|
|
if(!this.data.firstShow){
|
|
setTimeout(() => {
|
|
this.setData({ tabIndex: 0, firstShow: true, proviceList: this.getProviceListByIndex(this.data.tabIndex) })
|
|
}, 100)
|
|
this.fetchList()
|
|
}
|
|
},
|
|
getProviceListByIndex: function(tabIndex){
|
|
var proviceList = []
|
|
for (let index = 0; index < area.list[tabIndex].data.length; index++) {
|
|
proviceList.push(area.list[tabIndex].data[index].name)
|
|
}
|
|
return proviceList
|
|
},
|
|
onTabChange: function({ detail }){
|
|
if (this.data.tabIndex == Number(detail.index)) {
|
|
return
|
|
}
|
|
this.data.tabIndex = Number(detail.index)
|
|
this.data.form.proviceId = area.list[this.data.tabIndex].data[this.data.pIndex].code
|
|
this.setData({ pIndex: 0, proviceList: this.getProviceListByIndex(this.data.tabIndex) })
|
|
this.fetchList()
|
|
},
|
|
onProviceChange: function({ detail }){
|
|
if (this.data.pIndex == Number(detail.index)) {
|
|
return
|
|
}
|
|
this.data.pIndex = Number(detail.index)
|
|
this.data.form.proviceId = area.list[this.data.tabIndex].data[this.data.pIndex].code
|
|
this.fetchList()
|
|
},
|
|
fetchList: function(){
|
|
console.log(this.data.form)
|
|
}
|
|
}
|
|
|
|
})
|