consumer模块完成90%,完善店铺商品优惠券领取
This commit is contained in:
@@ -15,12 +15,12 @@
|
||||
<text class="search-placeholder">请输入药品名称、症状或品牌</text>
|
||||
|
||||
<!-- 扫码图标 -->
|
||||
<view class="nav-icon-btn" @click.stop="onScan">
|
||||
<view class="nav-icon-btn" @click="onScan">
|
||||
<text class="nav-icon">🔳</text>
|
||||
</view>
|
||||
|
||||
<!-- 相机图标 -->
|
||||
<view class="nav-camera-btn" @click.stop="onCamera">
|
||||
<view class="nav-camera-btn" @click="onCamera">
|
||||
<text class="nav-camera-icon">📷</text>
|
||||
</view>
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
</view>
|
||||
|
||||
<view class="product-action">
|
||||
<view class="cart-btn" @click.stop="addToCart(product)">
|
||||
<view class="cart-btn" @click="addToCart(product)">
|
||||
<text class="cart-icon">+</text>
|
||||
<text class="cart-text">加入购物车</text>
|
||||
</view>
|
||||
@@ -692,7 +692,8 @@ const loadMore = async () => {
|
||||
}
|
||||
|
||||
// 添加到购物车
|
||||
const addToCart = async (product: any) => {
|
||||
const addToCart = async (product: any, e: any | null = null) => {
|
||||
e?.stopPropagation()
|
||||
uni.showLoading({ title: '添加中...' })
|
||||
try {
|
||||
// 尝试调用 Supabase 服务添加
|
||||
@@ -749,6 +750,44 @@ const navigateToPrescription = () => uni.navigateTo({ url: '/pages/medicine/pres
|
||||
const navigateToOTC = () => uni.navigateTo({ url: '/pages/medicine/otc' })
|
||||
const navigateToHealthTools = () => uni.navigateTo({ url: '/pages/medicine/tools' })
|
||||
const navigateToReminders = () => uni.navigateTo({ url: '/pages/user/reminders' })
|
||||
|
||||
// 扫码功能
|
||||
const onScan = (e: any | null) => {
|
||||
e?.stopPropagation()
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
console.log('扫码结果:' + res.result)
|
||||
uni.showToast({
|
||||
title: '扫码成功',
|
||||
icon: 'success'
|
||||
})
|
||||
// 这里可以添加基于扫码结果的逻辑,比如跳转到商品详情
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('扫码失败:', err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 相机功能e: any | null) => {
|
||||
e?.stopPropagation()
|
||||
const onCamera = () => {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sourceType: ['camera'],
|
||||
success: (res) => {
|
||||
console.log('拍照结果:', res.tempFilePaths)
|
||||
uni.showToast({
|
||||
title: '拍摄成功',
|
||||
icon: 'success'
|
||||
})
|
||||
// 这里可以添加基于图片的逻辑,比如图搜
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('拍照失败:', err)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
Reference in New Issue
Block a user