parent
7348d51134
commit
8f57b19873
@ -0,0 +1,59 @@
|
|||||||
|
const app = getApp();
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
list: [],
|
||||||
|
brand: "",
|
||||||
|
result: []
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
wx.setNavigationBarTitle({
|
||||||
|
title: "选择车型"
|
||||||
|
})
|
||||||
|
let pages = getCurrentPages();
|
||||||
|
let currentPage = pages[pages.length - 1]
|
||||||
|
let options = currentPage.options
|
||||||
|
this.setData({
|
||||||
|
brand: options.brand
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.getData();
|
||||||
|
if(wx.getStorageSync("sSeriesArr")) {
|
||||||
|
let arr = wx.getStorageSync("sSeriesArr").split(",");
|
||||||
|
this.setData({
|
||||||
|
result: arr
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getData() {
|
||||||
|
let obj = {
|
||||||
|
action: 'getUserSeriesName',
|
||||||
|
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=',
|
||||||
|
sBrandName: this.data.brand
|
||||||
|
}
|
||||||
|
app.globalData.request(obj).then(res => {
|
||||||
|
this.setData({
|
||||||
|
list: res
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onChange(event) {
|
||||||
|
this.setData({
|
||||||
|
result: event.detail,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
toggle(event) {
|
||||||
|
const {
|
||||||
|
index
|
||||||
|
} = event.currentTarget.dataset;
|
||||||
|
const checkbox = this.selectComponent(`.checkboxes-${index}`);
|
||||||
|
checkbox.toggle();
|
||||||
|
},
|
||||||
|
noop() {},
|
||||||
|
save() {
|
||||||
|
wx.setStorageSync("sSeriesArr", this.data.result.toString());
|
||||||
|
wx.redirectTo({
|
||||||
|
url: '/pages/brandCrisis/crisiSet/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
<view>
|
||||||
|
<van-checkbox-group value="{{ result }}" bind:change="onChange">
|
||||||
|
<van-cell-group>
|
||||||
|
<van-cell
|
||||||
|
wx:for="{{ list }}"
|
||||||
|
wx:key="index"
|
||||||
|
title="{{ item.name }}"
|
||||||
|
value-class="value-class"
|
||||||
|
clickable
|
||||||
|
data-index="{{ index }}"
|
||||||
|
bind:click="toggle"
|
||||||
|
>
|
||||||
|
<van-checkbox
|
||||||
|
catch:tap="noop"
|
||||||
|
class="checkboxes-{{ index }}"
|
||||||
|
name="{{ item.name }}"
|
||||||
|
/>
|
||||||
|
</van-cell>
|
||||||
|
</van-cell-group>
|
||||||
|
</van-checkbox-group>
|
||||||
|
<view class="footer-btn">
|
||||||
|
<view class="footer-sbn" bindtap="save">确定</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
@ -0,0 +1,22 @@
|
|||||||
|
.value-class {
|
||||||
|
flex: none !important;
|
||||||
|
}
|
||||||
|
.footer-btn {
|
||||||
|
position: fixed;
|
||||||
|
width: 100vw;
|
||||||
|
height: 36px;
|
||||||
|
bottom: 40px;
|
||||||
|
line-height: 36px;
|
||||||
|
left: 0px;
|
||||||
|
background-color: #fff;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.footer-sbn {
|
||||||
|
width: 90%;
|
||||||
|
height: 100%;
|
||||||
|
background: #0084FF;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
Loading…
Reference in new issue