diff --git a/pages/car_new/car_new.js b/pages/car_new/car_new.js
index 9fd18e8..3f05dbf 100644
--- a/pages/car_new/car_new.js
+++ b/pages/car_new/car_new.js
@@ -2,8 +2,8 @@ const request = require('../../utils/request');
Page({
data: {
carList: [],
- type:1,
- selectedSort: 'default',
+ type: 1,
+ 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: '5-10万', value: '5-10'},
- { text: '10万以上', value: '>10' }
+ { 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-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();
},
diff --git a/pages/car_new/car_new.wxml b/pages/car_new/car_new.wxml
index 450e3f9..63dac96 100644
--- a/pages/car_new/car_new.wxml
+++ b/pages/car_new/car_new.wxml
@@ -21,55 +21,7 @@
options="{{priceOptions}}"
bind:change="onPriceChange"
/>
-
-
-
- {{item.label}}
-
-
-
-
- {{opt.key}}
-
-
-
-
-
-
-
-
- {{item.label}}:{{item._rangeStart || item.options.start}}{{item.options.unit}} - {{item._rangeEnd || item.options.end}}{{item.options.unit}}
-
-
-
-
-
-
- 确认
-
-
diff --git a/pages/index/index.js b/pages/index/index.js
index bc2a4b9..5e4bac1 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -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 })
}
})
diff --git a/pages/index/index.json b/pages/index/index.json
index 91d054c..00ef47d 100644
--- a/pages/index/index.json
+++ b/pages/index/index.json
@@ -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
}
\ No newline at end of file
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index d04bfeb..3a40b38 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -17,7 +17,7 @@
导航
- 电话
+ 电话
@@ -52,7 +52,7 @@
-
+
\ No newline at end of file
diff --git a/pages/info/info.js b/pages/info/info.js
index e6fcac4..9825353 100644
--- a/pages/info/info.js
+++ b/pages/info/info.js
@@ -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: '微信咨询',
diff --git a/pages/info/info.json b/pages/info/info.json
index d8b5518..004f791 100644
--- a/pages/info/info.json
+++ b/pages/info/info.json
@@ -6,5 +6,6 @@
"van-loading": "@vant/weapp/loading/index",
"van-overlay": "@vant/weapp/overlay/index"
},
+ "enableShareAppMessage": true,
"disableScroll": false
}
\ No newline at end of file
diff --git a/project.config.json b/project.config.json
index baf20b2..69fd7cb 100644
--- a/project.config.json
+++ b/project.config.json
@@ -36,6 +36,6 @@
"tabIndent": "auto",
"tabSize": 2
},
- "appid": "wx62337d2f58b2825a",
+ "appid": "wxf656003f2a1359f5",
"simulatorPluginLibVersion": {}
}
\ No newline at end of file
diff --git a/utils/request.js b/utils/request.js
index 2c2ba3f..2d5eff9 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -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 = '';