dev
xiaowen 3 years ago
parent 7348d51134
commit 8f57b19873

@ -25,7 +25,8 @@
"pages/varComm/pages/brandRatio/index", "pages/varComm/pages/brandRatio/index",
"pages/brandCrisis/index", "pages/brandCrisis/index",
"pages/detail/index", "pages/detail/index",
"pages/brandCrisis/crisiSet/index" "pages/brandCrisis/crisiSet/index",
"pages/brandCrisis/chooseModel/index"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
@ -97,7 +98,9 @@
"van-col": "@vant/weapp/col/index", "van-col": "@vant/weapp/col/index",
"van-divider": "@vant/weapp/divider/index", "van-divider": "@vant/weapp/divider/index",
"van-toast": "@vant/weapp/toast/index", "van-toast": "@vant/weapp/toast/index",
"van-switch": "@vant/weapp/switch/index" "van-switch": "@vant/weapp/switch/index",
"van-radio": "@vant/weapp/radio/index",
"van-radio-group": "@vant/weapp/radio-group/index"
} }
} }

@ -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;
}

@ -11,7 +11,7 @@ Page({
}) })
}, },
onShow() { onShow() {
let sSeriesName = wx.getStorageSync("sSeriesName") || ''; let sSeriesName = wx.getStorageSync("sSeriesArr") || '';
let sCrisis = wx.getStorageSync("sCrisis") || '1,2,3'; let sCrisis = wx.getStorageSync("sCrisis") || '1,2,3';
this.setData({ this.setData({
sSeriesName: sSeriesName, sSeriesName: sSeriesName,
@ -33,9 +33,11 @@ Page({
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=' token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
}).then(res => { }).then(res => {
wx.navigateTo({ wx.navigateTo({
url: '/pages/brandSearch/index?sBrand=' + res url: '/pages/brandCrisis/chooseModel/index?brand=' + res
}) })
}) })
}, },
save() {
}
}) })

@ -26,4 +26,7 @@
详情 详情
</view> </view>
</van-cell> </van-cell>
<view class="footer-btn">
<view class="footer-sbn" bindtap="save">保存</view>
</view>
</view> </view>

@ -1,5 +1,7 @@
.cs-container { .cs-container {
width: calc(100% - 32px);
padding: 0px 16px; padding: 0px 16px;
} }
.cs-dc { .cs-dc {
display: flex; display: flex;
@ -8,6 +10,7 @@
.cs-dc-s1 { .cs-dc-s1 {
font-size: 14px; font-size: 14px;
color: #333333; color: #333333;
width: 64%;
} }
.cs-dc-s2 { .cs-dc-s2 {
font-size: 12px; font-size: 12px;
@ -41,3 +44,22 @@
color: #D0D0D0; color: #D0D0D0;
font-size: 13px; font-size: 13px;
} }
.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;
}

@ -76,7 +76,7 @@ Page({
sBrand: this.data.sBrand, sBrand: this.data.sBrand,
sStartTime: sStartTime, sStartTime: sStartTime,
sEndTime: sEndTime, sEndTime: sEndTime,
sSeriesName: sSeriesName, // sSeriesName: sSeriesName,
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=', token: wx.getStorageSync('token') || 't%2BrswgjvzGM=',
} }
app.globalData.request(obj, (val) => { app.globalData.request(obj, (val) => {
@ -138,7 +138,7 @@ Page({
sType: "BrandData", sType: "BrandData",
sCrisis: sCrisis, sCrisis: sCrisis,
sBrand: this.data.sBrand, sBrand: this.data.sBrand,
sSeriesName: sSeriesName, // sSeriesName: sSeriesName,
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=' token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
} }
app.globalData.request(obj, (val) => { app.globalData.request(obj, (val) => {
@ -190,7 +190,7 @@ Page({
sStartTime: sStartTime, sStartTime: sStartTime,
sEndTime: sEndTime, sEndTime: sEndTime,
sBrand: this.data.sBrand, sBrand: this.data.sBrand,
sSeriesName: sSeriesName, // sSeriesName: sSeriesName,
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=' token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
} }
app.globalData.request(obj).then(res => { app.globalData.request(obj).then(res => {

@ -18,7 +18,8 @@ Page({
sBrand: '', sBrand: '',
daActive: -1, daActive: -1,
dbActive: '', dbActive: '',
dcActive: '' dcActive: '',
model: ''
}, },
onLaunch() { onLaunch() {
wx.getSystemInfo({ wx.getSystemInfo({
@ -38,15 +39,16 @@ Page({
let currentPage = pages[pages.length - 1] let currentPage = pages[pages.length - 1]
let options = currentPage.options let options = currentPage.options
this.setData({ this.setData({
type: options.type || 2, type: options.type || 2
sBrand: options.sBrand || ''
}) })
}, },
onShow() { onShow() {
this.getData(); this.getData();
this.createSelectorQuery().select(".nav-top").boundingClientRect(res => { this.createSelectorQuery().select(".nav-top").boundingClientRect(res => {
if (res) { if (res) {
const { height } = res; const {
height
} = res;
this.setData({ this.setData({
heightTop: height heightTop: height
}) })
@ -107,9 +109,6 @@ Page({
this.setData({ this.setData({
dcActive: row.name dcActive: row.name
}) })
// wx.switchTab({
// url: "/pages/brandCrisis/index"
// })
}, },
getSeries(brandname) { getSeries(brandname) {
let obj = { let obj = {
@ -156,7 +155,6 @@ Page({
obj[res[i].brandid] = true obj[res[i].brandid] = true
} }
} }
newArr = newArr.filter(ele => ele.brandname === this.data.sBrand)
this.setData({ this.setData({
mockData: arr, mockData: arr,
navData: newArr, navData: newArr,
@ -165,12 +163,26 @@ Page({
setTimeout(() => { setTimeout(() => {
wx.hideToast(); wx.hideToast();
}, 1000) }, 1000)
}) })
}, },
handlerBack() { handlerBack() {
wx.navigateBack({ wx.navigateBack({
delta: 1 delta: 1
}); });
},
onChange(event) {
this.setData({
model: event.detail,
});
wx.setStorageSync('sSeries', event.detail);
},
onClick(event) {
const {
name
} = event.currentTarget.dataset;
this.setData({
model: name
});
wx.setStorageSync('sSeries', name);
} }
}); });

@ -11,7 +11,7 @@
</view> </view>
<view class="bs-tabs"> <view class="bs-tabs">
<scroll-view class="bs-tab-sv" scroll-x="true" enable-flex="true"> <scroll-view class="bs-tab-sv" scroll-x="true" enable-flex="true">
<view class="bs-tab-sv-item {{index === daActive ? 'd-active' : ''}}" wx:for="{{navData}}" data-row="{{item}}" wx:key="index" bindtap="handlerChoose"> <view class="bs-tab-sv-item" wx:for="{{navData}}" data-row="{{item}}" wx:key="index" bindtap="handlerChoose">
<image class="userAvatar" src="{{item.img}}" lazy-load="{{true}}" /> <image class="userAvatar" src="{{item.img}}" lazy-load="{{true}}" />
<view class="bs-tab-title">{{item.brandname}}</view> <view class="bs-tab-title">{{item.brandname}}</view>
</view> </view>
@ -22,16 +22,19 @@
<van-index-bar class="bs-bar" sticky-offset-top="{{heightTop}}"> <van-index-bar class="bs-bar" sticky-offset-top="{{heightTop}}">
<view wx:for="{{mockData}}" wx:key="idx"> <view wx:for="{{mockData}}" wx:key="idx">
<van-index-anchor index="{{item.name}}" /> <van-index-anchor index="{{item.name}}" />
<view class="bs-item {{item2.brandid === dbActive ? 'd-active' : ''}}" wx:for="{{item.data}}" wx:key="idx" wx:for-item="item2" data-row="{{item2}}" bindtap="handlerChoose1"> <view class="bs-item" wx:for="{{item.data}}" wx:key="idx" wx:for-item="item2" data-row="{{item2}}" bindtap="handlerChoose1">
<image slot="icon" class="bs-item-image" src="{{item2.img}}" lazy-load="{{true}}" /> <image slot="icon" class="bs-item-image" src="{{item2.img}}" lazy-load="{{true}}" />
<text>{{item2.brandname}}</text> <text>{{item2.brandname}}</text>
</view> </view>
</view> </view>
</van-index-bar> </van-index-bar>
<van-popup z-index="2000" show="{{showPop}}" custom-style="height: calc(100% - {{heightTop}}px);width: 68%; top: {{heightTop*2+55}}px;" position="right" bind:close="handlerCloseDialog"> <van-popup z-index="2000" show="{{showPop}}" custom-style="height: calc(100% - {{heightTop}}px);width: 68%; top: {{heightTop*2+55}}px;" position="right" bind:close="handlerCloseDialog">
<view class="bs-item {{dcActive === item.name ? 'd-active' : ''}}" wx:for="{{series}}" wx:key="index" wx:for-item="item" data-row="{{item}}" bindtap="handlerChooseS"> <van-radio-group value="{{ model }}" bind:change="onChange">
<image slot="icon" class="bs-item-image" src="{{item.img}}" lazy-load="{{true}}" /> <van-cell-group>
<text>{{item.name}}</text> <van-cell wx:for="{{ series }}" wx:key="index" title="{{ item.name }}" clickable data-name="{{item.name}}" bind:click="onClick">
</view> <van-radio slot="right-icon" name="{{item.name}}" />
</van-cell>
</van-cell-group>
</van-radio-group>
</van-popup> </van-popup>
</view> </view>

@ -131,6 +131,10 @@
width: 100%; width: 100%;
overflow: auto; overflow: auto;
} }
.value-class {
flex: none !important;
}
.d-active { .d-active {
background: #4A9AFF; background: #4A9AFF;
color: #fff;
} }
Loading…
Cancel
Save