From f2f208f258a1a6e6247ec138c1a16eb63138d4db Mon Sep 17 00:00:00 2001 From: cyh666666 <2398882793@qq.com> Date: Mon, 26 Jan 2026 17:15:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E5=AE=8C=E5=96=84=E8=B4=AD?= =?UTF-8?q?=E7=89=A9=E9=80=BB=E8=BE=91=E9=97=AD=E7=8E=AF=EF=BC=8Cconsumer?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=AE=8C=E6=88=90=E5=BA=A675%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/supadb/aksupa.uts | 9 + pages.json | 71 +- pages/mall/consumer/address-edit.uvue | 43 +- pages/mall/consumer/address-list.uvue | 36 +- pages/mall/consumer/address.uvue | 458 +++++++++++- pages/mall/consumer/apply-refund.uvue | 293 ++++++++ pages/mall/consumer/checkout.uvue | 859 +++++++++++++++++++++-- pages/mall/consumer/logistics.uvue | 204 ++++++ pages/mall/consumer/order-detail.uvue | 13 + pages/mall/consumer/orders.uvue | 108 ++- pages/mall/consumer/payment-success.uvue | 173 +++++ pages/mall/consumer/payment.uvue | 26 +- pages/mall/consumer/product-detail.uvue | 20 +- pages/mall/consumer/profile.uvue | 141 ++-- pages/mall/consumer/refund-review.uvue | 163 +++++ pages/mall/consumer/review.uvue | 7 +- pages/sense/senseDataService.uts | 18 +- pages/user/login.uvue | 33 +- types/mall-types.uts | 26 + utils/sapi.uts | 28 +- utils/store.uts | 4 +- 21 files changed, 2516 insertions(+), 217 deletions(-) create mode 100644 pages/mall/consumer/apply-refund.uvue create mode 100644 pages/mall/consumer/logistics.uvue create mode 100644 pages/mall/consumer/payment-success.uvue create mode 100644 pages/mall/consumer/refund-review.uvue diff --git a/components/supadb/aksupa.uts b/components/supadb/aksupa.uts index 50f67294..4da64a2a 100644 --- a/components/supadb/aksupa.uts +++ b/components/supadb/aksupa.uts @@ -1021,4 +1021,13 @@ function buildSupabaseFilterQuery(filter : UTSJSONObject | null) : string { return params.join('&'); } +/** + * 创建 Supabase 客户端实例 + * @param url 项目 URL + * @param key 项目匿名密钥 (Anon Key) + */ +export function createClient(url : string, key : string) : AkSupa { + return new AkSupa(url, key); +} + export default AkSupa; \ No newline at end of file diff --git a/pages.json b/pages.json index 49ccff18..1fdcb2c0 100644 --- a/pages.json +++ b/pages.json @@ -1,5 +1,12 @@ { "pages": [ + { + "path": "pages/user/login", + "style": { + "navigationBarTitleText": "用户登录", + "navigationStyle": "custom" + } + }, { "path": "pages/mall/consumer/index", "style": { @@ -81,6 +88,68 @@ "style": { "navigationBarTitleText": "编辑地址" } + }, + { + "path": "pages/mall/consumer/checkout", + "style": { + "navigationBarTitleText": "确认订单" + } + }, + { + "path": "pages/mall/consumer/payment", + "style": { + "navigationBarTitleText": "收银台" + } + }, + { + "path": "pages/mall/consumer/payment-success", + "style": { + "navigationBarTitleText": "支付成功", + "navigationStyle": "custom" + } + }, + { + "path": "pages/mall/consumer/orders", + "style": { + "navigationBarTitleText": "我的订单", + "enablePullDownRefresh": true + } + }, + { + "path": "pages/mall/consumer/order-detail", + "style": { + "navigationBarTitleText": "订单详情" + } + }, + { + "path": "pages/mall/consumer/logistics", + "style": { + "navigationBarTitleText": "物流详情" + } + }, + { + "path": "pages/mall/consumer/review", + "style": { + "navigationBarTitleText": "评价晒单" + } + }, + { + "path": "pages/mall/consumer/refund", + "style": { + "navigationBarTitleText": "退款/售后" + } + }, + { + "path": "pages/mall/consumer/apply-refund", + "style": { + "navigationBarTitleText": "申请售后" + } + }, + { + "path": "pages/mall/consumer/refund-review", + "style": { + "navigationBarTitleText": "服务评价" + } } ], "tabBar": { @@ -121,4 +190,4 @@ } ] } -} \ No newline at end of file +} diff --git a/pages/mall/consumer/address-edit.uvue b/pages/mall/consumer/address-edit.uvue index d88f1c20..18ee45d0 100644 --- a/pages/mall/consumer/address-edit.uvue +++ b/pages/mall/consumer/address-edit.uvue @@ -20,6 +20,11 @@ + + 智能填写 + + 示例:张三 13800138000 北京市朝阳区三里屯SOHO A座 + 标签 @@ -65,6 +70,7 @@ const isEdit = ref(false) const addressId = ref('') const regionString = ref('') const tags = ['家', '公司', '学校'] +const smartInput = ref('') const formData = reactive({ name: '', @@ -203,6 +209,41 @@ const saveAddress = () => { }, 1500) } +const parseSmartInput = () => { + const input = smartInput.value.trim() + if (!input) return + + // 提取手机号 + const phoneRegex = /(1[3-9]\d{9})/ + const phoneMatch = input.match(phoneRegex) + if (phoneMatch) { + formData.phone = phoneMatch[0] + } + + // 提取姓名(取第一个2-4位中文) + const nameRegex = /([\u4e00-\u9fa5]{2,4})/ + const nameMatch = input.match(nameRegex) + if (nameMatch) { + formData.name = nameMatch[0] + } + + // 去掉姓名和电话后剩余作为地址 + let addrText = input + if (formData.name) addrText = addrText.replace(formData.name, '') + if (formData.phone) addrText = addrText.replace(formData.phone, '') + addrText = addrText.replace(/[,,;;\s]+/g, ' ').trim() + + // 解析省市区 + const pattern1 = /^(.*?省)?(.*?市)?(.*?[区县])?(.*)$/ + const m = addrText.match(pattern1) + if (m) { + const [, province, city, district, detail] = m + regionString.value = `${(province||'').trim()} ${(city||'').trim()} ${(district||'').trim()}`.trim() + formData.detail = (detail||'').trim() + } else { + formData.detail = addrText + } +} const deleteAddress = () => { uni.showModal({ title: '提示', @@ -316,4 +357,4 @@ const deleteAddress = () => { line-height: 44px; border: 1px solid #ddd; } - \ No newline at end of file + diff --git a/pages/mall/consumer/address-list.uvue b/pages/mall/consumer/address-list.uvue index d094e1a9..6e9f5b11 100644 --- a/pages/mall/consumer/address-list.uvue +++ b/pages/mall/consumer/address-list.uvue @@ -45,11 +45,27 @@ type Address = { } const addresses = ref([]) +const selectionMode = ref(false) +let openerEventChannel: any = null onShow(() => { loadAddresses() }) +onMounted(() => { + try { + const ec = uni.getOpenerEventChannel() + openerEventChannel = ec + ec?.on('setSelectMode', (data: any) => { + if (data && typeof data.selectMode === 'boolean') { + selectionMode.value = data.selectMode + } + }) + } catch (e) { + // ignore + } +}) + const loadAddresses = () => { const storedAddresses = uni.getStorageSync('addresses') if (storedAddresses) { @@ -95,9 +111,21 @@ const editAddress = (id: string) => { } const selectAddress = (item: Address) => { - // 如果是选择地址模式(例如从订单确认页过来),则返回并传递地址 - // 目前暂未实现选择模式,仅作为普通点击 - editAddress(item.id) + if (selectionMode.value && openerEventChannel) { + openerEventChannel.emit('addressSelected', { + id: item.id, + recipient_name: item.name, + phone: item.phone, + province: item.province, + city: item.city, + district: item.district, + detail: item.detail, + is_default: item.isDefault + }) + uni.navigateBack() + } else { + editAddress(item.id) + } } @@ -218,4 +246,4 @@ const selectAddress = (item: Address) => { line-height: 44px; border: none; } - \ No newline at end of file + diff --git a/pages/mall/consumer/address.uvue b/pages/mall/consumer/address.uvue index b1848238..9b6b4af1 100644 --- a/pages/mall/consumer/address.uvue +++ b/pages/mall/consumer/address.uvue @@ -55,10 +55,78 @@ - + + 添加新地址 + + + + + + 新建收货地址 + × + + + + + 收货人 + + + + + 手机号 + + + + + + 智能填写地址 +