new
This commit is contained in:
parent
610a06519b
commit
bd8a9a4b0c
|
|
@ -3,7 +3,7 @@ Page({
|
|||
data: {
|
||||
carList: [],
|
||||
type: 1,
|
||||
selectedSort: 'default',
|
||||
selectedSort: '',
|
||||
selectedBrand: '',
|
||||
selectedPrice: '',
|
||||
filterParams: {},
|
||||
|
|
@ -12,15 +12,21 @@ Page({
|
|||
selectedBrandLabel:"品牌",
|
||||
brandTree: [],
|
||||
sortOptions: [
|
||||
{ text: '默认排序', value: 'default' },
|
||||
{ text: '价格升序', value: 'priceAsc' },
|
||||
{ text: '价格降序', value: 'priceDesc' }
|
||||
{ text: '默认排序', value: '' },
|
||||
{ text: '最新上架', value: 'created_at-desc' },
|
||||
{ text: '价格降序', value: 'price-desc' },
|
||||
{ text: '价格升序', value: 'price-asc' }
|
||||
],
|
||||
priceOptions: [
|
||||
{ text: '全部价格', value: '' },
|
||||
{ text: '5万以下', value: '<5' },
|
||||
{ text: '3万以下', value: '0-3' },
|
||||
{ text: '3-5万', value: '3-5'},
|
||||
{ text: '5-10万', value: '5-10' },
|
||||
{ text: '10万以上', value: '>10' }
|
||||
{ text: '10-15万', value: '10-15' },
|
||||
{ text: '15-20万', value: '15-20' },
|
||||
{ text: '20-30万', value: '20-30' },
|
||||
{ text: '30-50万', value: '30-50' },
|
||||
{ text: '50万以上', value: ' 50-10000' },
|
||||
],
|
||||
extendFields: [], // 筛选配置
|
||||
|
||||
|
|
@ -191,21 +197,60 @@ Page({
|
|||
}
|
||||
},
|
||||
|
||||
openMap() {
|
||||
const { latitude, longitude, address, name } = this.data.company
|
||||
wx.openLocation({
|
||||
latitude,
|
||||
longitude,
|
||||
scale: 18,
|
||||
name,
|
||||
address
|
||||
})
|
||||
},
|
||||
onLoad(options){
|
||||
if (options.type) {
|
||||
this.setData({
|
||||
type: options.type
|
||||
});
|
||||
const new_car_prices = [
|
||||
{ text: '全部价格', value: '' },
|
||||
{ text: '5万以下', value: '0-5' },
|
||||
{ text: '5-10万', value: '5-10' },
|
||||
{ text: '10-15万', value: '10-15' },
|
||||
{ text: '15-20万', value: '15-20' },
|
||||
{ text: '20-30万', value: '20-30' },
|
||||
{ text: '30-50万', value: '30-50' },
|
||||
{ text: '50-100万', value: '50-100' },
|
||||
{ text: '100万以上', value: '100-10000' },
|
||||
];
|
||||
|
||||
const old_car_prices = [
|
||||
{ text: '全部价格', value: '' },
|
||||
{ text: '3万以下', value: '0-3' },
|
||||
{ text: '3-5万', value: '3-5'},
|
||||
{ text: '5-10万', value: '5-10' },
|
||||
{ text: '10-15万', value: '10-15' },
|
||||
{ text: '15-20万', value: '15-20' },
|
||||
{ text: '20-30万', value: '20-30' },
|
||||
{ text: '30-50万', value: '30-50' },
|
||||
{ text: '50万以上', value: ' 50-100000' },
|
||||
];
|
||||
|
||||
const rent_car_prices = [
|
||||
{ text: '全部价格', value: '' },
|
||||
{ text: '100元以下', value: '0-100' },
|
||||
{ text: '100-200元', value: '100-200' },
|
||||
{ text: '200-300元', value: '200-300' },
|
||||
{ text: '300-500元', value: '300-500' },
|
||||
{ text: '500-800元', value: '500-800' },
|
||||
{ text: '800-1500元', value: '800-1500' },
|
||||
{ text: '1500元以上', value: '1500-100000' },
|
||||
];
|
||||
|
||||
if(options.type == 1){
|
||||
this.setData({
|
||||
priceOptions: new_car_prices
|
||||
});
|
||||
}else if(options.type == 2){
|
||||
this.setData({
|
||||
priceOptions: old_car_prices
|
||||
});
|
||||
}else{
|
||||
this.setData({
|
||||
priceOptions: rent_car_prices
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
this.loadBrandData();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -21,55 +21,7 @@
|
|||
options="{{priceOptions}}"
|
||||
bind:change="onPriceChange"
|
||||
/>
|
||||
<van-dropdown-item title="参数"
|
||||
use-slot
|
||||
id="dropdownItemParam"
|
||||
>
|
||||
<view class="filter-extend">
|
||||
<view wx:for="{{extendFields}}" wx:key="id" class="filter-group">
|
||||
<view class="filter-label">{{item.label}}</view>
|
||||
|
||||
<!-- 多选项字段 -->
|
||||
<view wx:if="{{item.type === 'checkbox'}}" class="filter-tags">
|
||||
<view
|
||||
wx:for="{{item.options}}"
|
||||
wx:for-item="opt"
|
||||
wx:key="index"
|
||||
class="filter-tag-item"
|
||||
data-name="{{item.name}}"
|
||||
data-value="{{opt.value}}"
|
||||
bind:tap="onTagToggle"
|
||||
>
|
||||
<van-tag
|
||||
size="medium"
|
||||
plain="{{!opt._checked}}"
|
||||
>
|
||||
{{opt.key}}
|
||||
</van-tag>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view wx:if="{{item.type === 'range'}}" class="filter-slider-group">
|
||||
<view class="slider-label">
|
||||
{{item.label}}:{{item._rangeStart || item.options.start}}{{item.options.unit}} - {{item._rangeEnd || item.options.end}}{{item.options.unit}}
|
||||
</view>
|
||||
|
||||
<van-slider
|
||||
range
|
||||
value="{{[item._rangeStart ? item._rangeStart : item.options.start, item._rangeEnd ? item._rangeEnd : item.options.end]}}"
|
||||
min="{{item.options.start}}"
|
||||
max="{{item.options.end}}"
|
||||
data-name="{{item.name}}"
|
||||
bind:change="onSliderChange"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<van-button type="primary" block size="small" bind:tap="onExtendConfirm">确认</van-button>
|
||||
</view>
|
||||
</van-dropdown-item>
|
||||
</van-dropdown-menu>
|
||||
</view>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,15 +2,12 @@ const request = require('../../utils/request');
|
|||
Page({
|
||||
data: {
|
||||
|
||||
bannerList: [
|
||||
'http://192.168.1.11:8089/uploads/20250630/054c53776891b766c6f1bd65059a5b27.jpg',
|
||||
'http://192.168.1.11:8089/uploads/20250630/c7f45ec56c19eac42a23c5e987cacc93.jpg'
|
||||
],
|
||||
bannerList: [],
|
||||
company: {
|
||||
name: '某某汽车服务有限公司',
|
||||
address: '上海市浦东新区世纪大道100号',
|
||||
latitude: 31.2304, // 地图坐标
|
||||
longitude: 121.4737,
|
||||
name: 'HM car center',
|
||||
address: 'HM car center',
|
||||
latitude: 31.854870, // 地图坐标
|
||||
longitude: 106.746141,
|
||||
phone: '021-88888888'
|
||||
}
|
||||
},
|
||||
|
|
@ -18,6 +15,14 @@ Page({
|
|||
// 页面显示时刷新数据
|
||||
this.loadBanner();
|
||||
},
|
||||
onShareAppMessage() {
|
||||
// 分享配置
|
||||
return {
|
||||
title: this.data.company.name,
|
||||
path: `/pages/index`,
|
||||
imageUrl: this.data.bannerList[0]
|
||||
};
|
||||
},
|
||||
// 跳转到新车页面
|
||||
goToNewCar: function () {
|
||||
wx.navigateTo({
|
||||
|
|
@ -25,6 +30,16 @@ Page({
|
|||
});
|
||||
},
|
||||
|
||||
openMap() {
|
||||
const { latitude, longitude, address, name } = this.data.company
|
||||
wx.openLocation({
|
||||
latitude,
|
||||
longitude,
|
||||
scale: 18,
|
||||
name,
|
||||
address
|
||||
})
|
||||
},
|
||||
// 跳转到租车页面
|
||||
goToRental: function () {
|
||||
wx.navigateTo({
|
||||
|
|
@ -38,11 +53,29 @@ Page({
|
|||
url: '/pages/car_new/car_new?type=' + 2
|
||||
});
|
||||
},
|
||||
// 拨打电话
|
||||
makePhoneCall(e) {
|
||||
const phone = e.currentTarget.dataset.phone || this.data.contactPhone;
|
||||
|
||||
wx.makePhoneCall({
|
||||
phoneNumber: phone,
|
||||
success: () => {
|
||||
console.log('拨打电话成功');
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('拨打电话失败:', err);
|
||||
wx.showToast({
|
||||
title: '拨打失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
async loadBanner() {
|
||||
const data = await request({
|
||||
url: '/admin/wechat/api/banners'
|
||||
});
|
||||
this.setData({ bannerList: data })
|
||||
this.setData({ bannerList: data.banner });
|
||||
this.setData({ company: data.company })
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"navigationBarTitleText": "首页",
|
||||
"usingComponents": {
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"van-dropdown-menu": "@vant/weapp/dropdown-menu/index",
|
||||
|
|
@ -7,5 +8,6 @@
|
|||
"van-slider": "@vant/weapp/slider/index",
|
||||
"van-tag": "@vant/weapp/tag/index",
|
||||
"van-button": "@vant/weapp/button/index"
|
||||
}
|
||||
},
|
||||
"enableShareAppMessage": true
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
</view>
|
||||
<view class="company-actions">
|
||||
<van-button size="small" type="primary" plain icon="location-o" bindtap="openMap">导航</van-button>
|
||||
<van-button size="small" type="info" plain icon="phone" open-type="makePhoneCall" data-phone="{{company.phone}}">电话</van-button>
|
||||
<van-button size="small" type="info" plain icon="phone" bindtap="makePhoneCall" data-phone="{{company.phone}}">电话</van-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
</view>
|
||||
|
||||
<!-- 热门推荐 -->
|
||||
<view class="hot-recommend">
|
||||
<!-- <view class="hot-recommend">
|
||||
<view class="section-title">
|
||||
<text>热门推荐</text>
|
||||
<van-icon name="arrow" size="16px" />
|
||||
|
|
@ -70,4 +70,4 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
|
@ -42,6 +42,25 @@ Page({
|
|||
};
|
||||
},
|
||||
|
||||
// 拨打电话
|
||||
makePhoneCall(e) {
|
||||
const phone = e.currentTarget.dataset.phone
|
||||
|| this.data.contactPhone || this.data.carDetail.contact.mobile;
|
||||
|
||||
wx.makePhoneCall({
|
||||
phoneNumber: phone,
|
||||
success: () => {
|
||||
console.log('拨打电话成功');
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('拨打电话失败:', err);
|
||||
wx.showToast({
|
||||
title: '拨打失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
onShareTimeline() {
|
||||
// 分享到朋友圈
|
||||
return {
|
||||
|
|
@ -79,7 +98,6 @@ Page({
|
|||
|
||||
// 模拟API调用
|
||||
const carDetail = await this.fetchCarDetail(this.data.carId);
|
||||
console.log(carDetail)
|
||||
if (carDetail) {
|
||||
// 计算优惠金额
|
||||
const discountAmount = (carDetail.re_price - carDetail.price).toFixed(1);
|
||||
|
|
@ -198,29 +216,10 @@ Page({
|
|||
});
|
||||
},
|
||||
|
||||
// 拨打电话
|
||||
makePhoneCall(e) {
|
||||
const phone = e.currentTarget.dataset.phone || this.data.contactPhone;
|
||||
|
||||
wx.makePhoneCall({
|
||||
phoneNumber: phone,
|
||||
success: () => {
|
||||
console.log('拨打电话成功');
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('拨打电话失败:', err);
|
||||
wx.showToast({
|
||||
title: '拨打失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 打开微信咨询
|
||||
openWechat() {
|
||||
// 方案1: 复制微信号
|
||||
const wechatId = 'car_consultant_001';
|
||||
const wechatId = this.data.carDetail.contact.mobile || '';
|
||||
|
||||
wx.showModal({
|
||||
title: '微信咨询',
|
||||
|
|
|
|||
|
|
@ -6,5 +6,6 @@
|
|||
"van-loading": "@vant/weapp/loading/index",
|
||||
"van-overlay": "@vant/weapp/overlay/index"
|
||||
},
|
||||
"enableShareAppMessage": true,
|
||||
"disableScroll": false
|
||||
}
|
||||
|
|
@ -36,6 +36,6 @@
|
|||
"tabIndent": "auto",
|
||||
"tabSize": 2
|
||||
},
|
||||
"appid": "wx62337d2f58b2825a",
|
||||
"appid": "wxf656003f2a1359f5",
|
||||
"simulatorPluginLibVersion": {}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
const BASE_URL = 'https://car.cherrybless.com'; // 👈 换成你的后端地址
|
||||
// const BASE_URL = 'http://127.0.0.1:8089'; // 👈 换成你的后端地址
|
||||
|
||||
function request({ url, method = 'GET', data = {}, header = {} }) {
|
||||
const token = '';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user