diff --git a/api/address.js b/api/address.js index 66d9eb7..9c7eeae 100644 --- a/api/address.js +++ b/api/address.js @@ -3,7 +3,7 @@ import { } from "../util/api" // const baseURL = "http://192.168.0.12:3005/term" -const baseURL = "http://192.168.0.26:3000/api" +const baseURL = "http://192.168.0.11:3000/api" // 项目相关API export const addressAPI = { diff --git a/api/common.js b/api/common.js index 58cea4b..2ea273b 100644 --- a/api/common.js +++ b/api/common.js @@ -1,6 +1,6 @@ import { http } from "../util/api"; -const baseURL = "http://192.168.0.26:3000/api" +const baseURL = "http://192.168.0.11:3000/api" export const commonAPI = { getRegion: () => http.get(baseURL + '/regions/provinces'), diff --git a/api/finnancial.js b/api/finnancial.js index c0729f5..1c2c997 100644 --- a/api/finnancial.js +++ b/api/finnancial.js @@ -2,7 +2,8 @@ import { http } from "../util/api" -const baseURL = "http://192.168.0.15:3008" +// const baseURL = "http://192.168.0.15:3008" // 本地 +const baseURL = "http://192.168.0.4:3008" // 测试服务器 // 项目相关API export const financeAPI = { diff --git a/api/group.js b/api/group.js index e7e2162..7dc24cd 100644 --- a/api/group.js +++ b/api/group.js @@ -2,7 +2,8 @@ import { http } from "../util/api"; -const baseURL = "http://192.168.0.15:3007" +// const baseURL = "http://192.168.0.15:3007" // 本地 +const baseURL = "http://192.168.0.4:3007" // 测试服务器 export const groupAPI = { getList: (params) => http.get(baseURL + '/group/list', params), diff --git a/api/mall.js b/api/mall.js index 3f7aba9..d612d68 100644 --- a/api/mall.js +++ b/api/mall.js @@ -2,7 +2,7 @@ import { http } from "../util/api"; -const baseUrl = "http://192.168.0.26:3000" +const baseUrl = "http://192.168.0.11:3000" export const mallAPI = { getMallList: (params) => http.get(baseUrl + '/api/products', params), @@ -12,6 +12,8 @@ export const mallAPI = { addCart: (data) => http.post(baseUrl +"/api/cart/add", data), // 添加购物车 createOrder: (data) => http.post(baseUrl + `/api/orders/create-from-cart`,data), // 创建订单 getOrder: (orderId) => http.get(baseUrl + `/api/orders/pending-payment/${orderId}`), // 获取订单 + payment: (data) => http.post(baseUrl + "/api/orders/confirm-payment", data), // 支付订单 + getCouponList: (uid) => http.get(baseUrl + `/api/coupon/user/${uid}`) } export default { diff --git a/api/message.js b/api/message.js index f8e5e8d..6d2b39e 100644 --- a/api/message.js +++ b/api/message.js @@ -3,7 +3,8 @@ import { } from "../util/api" // const baseURL = "http://192.168.0.12:3005/chat" -const baseURL = "http://192.168.0.15:3007" +// const baseURL = "http://192.168.0.15:3007" // 本地 +const baseURL = "http://192.168.0.4:3007" // 测试服务器 // 项目相关API export const messageAPI = { diff --git a/api/program.js b/api/program.js index 1b2b849..aa4e0b5 100644 --- a/api/program.js +++ b/api/program.js @@ -3,7 +3,8 @@ import { } from "../util/api" // const baseURL = "http://192.168.0.12:3005/term" -const baseURL = "http://192.168.0.15:3006" +// const baseURL = "http://192.168.0.15:3006" +const baseURL = "http://192.168.0.4:3006" // 项目相关API export const programAPI = { diff --git a/api/user.js b/api/user.js index e735f3a..c04481a 100644 --- a/api/user.js +++ b/api/user.js @@ -2,6 +2,8 @@ import { http } from "../util/api" +const baseURL = "http://192.168.0.4:3000/api" + // 用户相关API export const userAPI = { // 获取用户列表 @@ -19,7 +21,9 @@ export const userAPI = { delete: (id) => http.delete(`/users/${id}`), // 获取用户统计 - getStats: () => http.get('/users/stats/overview') + getStats: () => http.get('/users/stats/overview'), + + getProfile: () => http.get(baseURL + '/user/profile') } export default { diff --git a/pages.json b/pages.json index 774aef9..6c4b2d7 100644 --- a/pages.json +++ b/pages.json @@ -142,7 +142,23 @@ "style" : { "navigationBarTitleText" : "确认订单", - "backgroundColor": "#E4ECFF" + "backgroundColor": "#E4ECFF", + "enablePullDownRefresh": true + } + }, + { + "path" : "pages/my/order", + "style" : + { + "navigationBarTitleText" : "我的订单" + } + }, + { + "path" : "pages/home/mallSearch", + "style" : + { + "navigationBarTitleText" : "搜索商品", + "navigationStyle": "custom" } } ], diff --git a/pages/home/index.vue b/pages/home/index.vue index 8001f36..391375d 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -82,13 +82,12 @@ {{item.name}} - ¥{{item.price}} {{item.rongdou_price}} - + {{item.points_price}} @@ -112,13 +111,12 @@ {{item.name}} - ¥{{item.price}} {{item.rongdou_price}} - + {{item.points_price}} diff --git a/pages/home/mallDetail.vue b/pages/home/mallDetail.vue index 09ab07e..9a2d60c 100644 --- a/pages/home/mallDetail.vue +++ b/pages/home/mallDetail.vue @@ -31,7 +31,7 @@ {{dataInfo.rongdou_price}} - + {{dataInfo.points_price}} @@ -67,7 +67,7 @@ {{item.price}} - + {{item.points}} @@ -85,7 +85,7 @@ {{item.price}} - + {{item.points}} @@ -98,7 +98,7 @@ - @@ -199,7 +199,7 @@ mallAPI } from '../../api/mall'; import { - getImageUrl + getImageUrl, arrayContainsAll } from '../../util/common.js'; const instance = getCurrentInstance(); @@ -312,11 +312,6 @@ return hasValidCombination; } - // arr1是否包含arr2 - const arrayContainsAll = (arr1, arr2) => { - return arr2.every(item => arr1.includes(item)); - } - // 是否被选中 const isChose = (key) => { return choseKeys.value.includes(key) @@ -385,6 +380,7 @@ cart_item_ids: [cartItemId] }).then(response => { if (response.success) { + showSure.value = false // 进入支付页面 uni.navigateTo({ url: '/pages/home/pay?preOrderId=' + response.data diff --git a/pages/home/mallSearch.vue b/pages/home/mallSearch.vue new file mode 100644 index 0000000..5655d3e --- /dev/null +++ b/pages/home/mallSearch.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/pages/home/pay.vue b/pages/home/pay.vue index 165a0cb..2d9cd87 100644 --- a/pages/home/pay.vue +++ b/pages/home/pay.vue @@ -2,14 +2,13 @@ - + - + - 张三 | - 浙江省 宁波市 海曙区 + {{selectAddressLabel}} - + @@ -49,68 +48,449 @@ - - + + 选择优惠券 + + 选择优惠券后自动换算扣除 + + + + 支付方式 - + 融豆 - + + + + + + 积分 + + + + + + + + 融豆+积分 + + + + + + + + 支付宝 + + + + + + + + 微信 + + + - + - 实际支付:1231 + 实际支付: + + + {{allPayNum}} - 确认支付 + 确认支付 + + + + + + + + @@ -118,9 +498,10 @@ .pay-container { width: 100%; height: 100%; - background: var(--Color, #E4ECFF); + background: #E4ECFF; .scroll-container { + padding-bottom: 200rpx; .box-bg { background: #F5F8FF; @@ -135,6 +516,8 @@ .text { display: flex; align-items: center; + // border: 1px solid #000; + flex: 1; } .right-icon { @@ -176,6 +559,10 @@ } } + .discount { + padding: 30rpx 40rpx; + } + .pay-method { padding: 30rpx 40rpx; @@ -208,7 +595,15 @@ background: #F5F8FF; - .text {} + .text { + display: flex; + align-items: center; + + .icon { + height: 30rpx; + width: 30rpx; + } + } .btn {} } diff --git a/pages/my/my.vue b/pages/my/my.vue index 2391346..eef0024 100644 --- a/pages/my/my.vue +++ b/pages/my/my.vue @@ -9,6 +9,10 @@ {{user.real_name}} + + + + @@ -144,6 +148,12 @@ + + diff --git a/static/icon/jifen.png b/static/icon/jifen.png new file mode 100644 index 0000000..1597132 Binary files /dev/null and b/static/icon/jifen.png differ diff --git a/static/icon/rongdou.png b/static/icon/rongdou.png index f588b7a..4bd32b7 100644 Binary files a/static/icon/rongdou.png and b/static/icon/rongdou.png differ diff --git a/util/common.js b/util/common.js index 18054af..b4ae585 100644 --- a/util/common.js +++ b/util/common.js @@ -5,6 +5,12 @@ export const validatePhone = (phone) => { }; + +// arr1是否包含arr2 +export const arrayContainsAll = (arr1, arr2) => { + return arr2.every(item => arr1.includes(item)); +} + export const getImageUrl = (imagePath) => { if (!imagePath) return '' // 如果图片路径以/uploads开头,直接返回原路径 @@ -12,7 +18,7 @@ export const getImageUrl = (imagePath) => { if (imagePath.startsWith('/uploads')) { return `${baseURL}/jurongquan${imagePath}` } - + if (imagePath.startsWith('http')) return imagePath // const baseURL = "http://192.168.1.43:3000" @@ -31,40 +37,40 @@ export const getUserInfo = () => { * @returns {string|boolean} - 脱敏后的电话号码,无效则返回false */ export function maskPhoneNumber(phone) { - // 检查是否为字符串 - if (typeof phone !== 'string') { - return phone; - } + // 检查是否为字符串 + if (typeof phone !== 'string') { + return phone; + } - // 移除所有非数字字符 - const cleaned = phone.replace(/\D/g, ''); + // 移除所有非数字字符 + const cleaned = phone.replace(/\D/g, ''); - // 验证常见的电话号码格式 - // 支持: 11位手机号(中国大陆)、带区号的固定电话 - const phoneRegex = /^(1[3-9]\d{9})$|^(\d{3,4}-\d{7,8})$|^(\d{3,4}\d{7,8})$/; + // 验证常见的电话号码格式 + // 支持: 11位手机号(中国大陆)、带区号的固定电话 + const phoneRegex = /^(1[3-9]\d{9})$|^(\d{3,4}-\d{7,8})$|^(\d{3,4}\d{7,8})$/; - if (!phoneRegex.test(cleaned) && !phoneRegex.test(phone)) { - return phone; // 不是有效的电话号码 - } + if (!phoneRegex.test(cleaned) && !phoneRegex.test(phone)) { + return phone; // 不是有效的电话号码 + } - // 根据不同格式进行脱敏 - if (cleaned.length === 11) { - // 手机号: 保留前3位和后4位,中间4位用*代替 - return cleaned.replace(/^(\d{3})(\d{4})(\d{4})$/, '$1****$3'); - } else if (phone.includes('-')) { - // 带区号的固定电话: 区号不变,号码中间用*代替 - const [areaCode, number] = phone.split('-'); - if (number.length <= 4) { - return `${areaCode}-****`; - } - return `${areaCode}-${number.substr(0, 2)}****${number.substr(-2)}`; - } else { - // 不带区号的固定电话 - if (cleaned.length <= 4) { - return '****'; - } - return `${cleaned.substr(0, 2)}****${cleaned.substr(-2)}`; - } + // 根据不同格式进行脱敏 + if (cleaned.length === 11) { + // 手机号: 保留前3位和后4位,中间4位用*代替 + return cleaned.replace(/^(\d{3})(\d{4})(\d{4})$/, '$1****$3'); + } else if (phone.includes('-')) { + // 带区号的固定电话: 区号不变,号码中间用*代替 + const [areaCode, number] = phone.split('-'); + if (number.length <= 4) { + return `${areaCode}-****`; + } + return `${areaCode}-${number.substr(0, 2)}****${number.substr(-2)}`; + } else { + // 不带区号的固定电话 + if (cleaned.length <= 4) { + return '****'; + } + return `${cleaned.substr(0, 2)}****${cleaned.substr(-2)}`; + } } /** @@ -73,48 +79,48 @@ export function maskPhoneNumber(phone) { * @returns {string} - 脱敏后的姓名 */ export function maskName(name) { - // 检查输入是否为有效字符串 - if (!name || typeof name !== 'string') { - return ''; - } + // 检查输入是否为有效字符串 + if (!name || typeof name !== 'string') { + return ''; + } - // 去除前后空格 - const trimmedName = name.trim(); + // 去除前后空格 + const trimmedName = name.trim(); - // 检查是否为英文姓名(包含空格) - if (trimmedName.includes(' ')) { - const parts = trimmedName.split(' ').filter(part => part); + // 检查是否为英文姓名(包含空格) + if (trimmedName.includes(' ')) { + const parts = trimmedName.split(' ').filter(part => part); - // 处理英文名:名全显,姓只显首字母 - if (parts.length >= 2) { - const firstName = parts.slice(0, -1).join(' '); - const lastName = parts[parts.length - 1]; - return `${firstName} ${lastName.charAt(0)}*`; - } - } + // 处理英文名:名全显,姓只显首字母 + if (parts.length >= 2) { + const firstName = parts.slice(0, -1).join(' '); + const lastName = parts[parts.length - 1]; + return `${firstName} ${lastName.charAt(0)}*`; + } + } - // 处理中文姓名 - const length = trimmedName.length; + // 处理中文姓名 + const length = trimmedName.length; - switch (length) { - case 1: - // 单字名,不脱敏 - return trimmedName; - case 2: - // 双字名,隐藏第二个字 - return `${trimmedName[0]}*`; - case 3: - // 三字名,隐藏中间字 - return `${trimmedName[0]}*${trimmedName[2]}`; - case 4: - // 四字名(如复姓),隐藏中间两个字 - return `${trimmedName[0]}**${trimmedName[3]}`; - default: - // 更长的姓名,显示首尾各两个字,中间用*代替 - if (length > 4) { - return `${trimmedName.substr(0, 2)}${'*'.repeat(length - 4)}${trimmedName.substr(-2)}`; - } - } + switch (length) { + case 1: + // 单字名,不脱敏 + return trimmedName; + case 2: + // 双字名,隐藏第二个字 + return `${trimmedName[0]}*`; + case 3: + // 三字名,隐藏中间字 + return `${trimmedName[0]}*${trimmedName[2]}`; + case 4: + // 四字名(如复姓),隐藏中间两个字 + return `${trimmedName[0]}**${trimmedName[3]}`; + default: + // 更长的姓名,显示首尾各两个字,中间用*代替 + if (length > 4) { + return `${trimmedName.substr(0, 2)}${'*'.repeat(length - 4)}${trimmedName.substr(-2)}`; + } + } - return trimmedName; + return trimmedName; } \ No newline at end of file