fix:修复bug

This commit is contained in:
2026-03-18 09:24:35 +08:00
parent 60df817de5
commit 741769cbeb
14 changed files with 263 additions and 180 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ NODE_ENV=development
VITE_DELETE_CONSOLE=false VITE_DELETE_CONSOLE=false
#本地环境 #本地环境
VITE_SERVER_BASEURL=https://howhowfresh.com/prod-api #VITE_SERVER_BASEURL=https://howhowfresh.com/prod-api
#VITE_SERVER_BASEURL=http://192.168.5.36:8080 VITE_SERVER_BASEURL=http://192.168.5.58:8080
#VITE_SERVER_BASEURL=http://192.168.0.148:8888 #VITE_SERVER_BASEURL=http://192.168.0.148:8888
#VITE_SERVER_BASEURL=http://liuyao.nat100.top/meiguowaimai #VITE_SERVER_BASEURL=http://liuyao.nat100.top/meiguowaimai
+2
View File
@@ -320,6 +320,7 @@
"input-placeholder": "Email Address/Phone", "input-placeholder": "Email Address/Phone",
"prompt": { "prompt": {
"confirm-email-verify": "The email address was inconsistent twice", "confirm-email-verify": "The email address was inconsistent twice",
"confirm-password-verify": "The passwords do not match",
"email-address-verify": "Please enter the correct email address", "email-address-verify": "Please enter the correct email address",
"first-name": "Please enter a name", "first-name": "Please enter a name",
"last-name": "Please enter your last name", "last-name": "Please enter your last name",
@@ -342,6 +343,7 @@
}, },
"sign-up": { "sign-up": {
"confirm-email": "Confirm email", "confirm-email": "Confirm email",
"confirm-password": "Confirm password",
"first-name": "First name", "first-name": "First name",
"last-name": "Last name", "last-name": "Last name",
"password": "Password", "password": "Password",
+2
View File
@@ -320,6 +320,7 @@
"input-placeholder": "邮箱地址/手机号", "input-placeholder": "邮箱地址/手机号",
"prompt": { "prompt": {
"confirm-email-verify": "两次邮箱不一致", "confirm-email-verify": "两次邮箱不一致",
"confirm-password-verify": "两次密码不一致",
"email-address-verify": "请输入正确的邮箱地址", "email-address-verify": "请输入正确的邮箱地址",
"first-name": "请输入名字", "first-name": "请输入名字",
"last-name": "请输入姓氏", "last-name": "请输入姓氏",
@@ -342,6 +343,7 @@
}, },
"sign-up": { "sign-up": {
"confirm-email": "确认邮箱", "confirm-email": "确认邮箱",
"confirm-password": "确认密码",
"first-name": "名", "first-name": "名",
"last-name": "姓", "last-name": "姓",
"password": "密码", "password": "密码",
+2 -2
View File
@@ -2,8 +2,8 @@
"name" : "CHEFLINK delivery", "name" : "CHEFLINK delivery",
"appid" : "__UNI__06509BE", "appid" : "__UNI__06509BE",
"description" : "", "description" : "",
"versionName" : "1.0.26", "versionName" : "1.0.28",
"versionCode" : 126, "versionCode" : 128,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {
+16
View File
@@ -70,6 +70,22 @@ const handleSubmit = R.when(checkForm, debounce(Config.debounceLongTime, submit,
function navigateTo(url: string) { function navigateTo(url: string) {
// 从“密码页”去注册时,尽量复用上一页输入的邮箱/手机号
if (url.includes('/pages-login/pages/sign-up/index')) {
const type = logicStore.loginForm.type
logicStore.resetRegisterForm()
if (type === 'email' && logicStore.loginForm.email) {
logicStore.registerForm.type = 'email'
logicStore.registerForm.email = logicStore.loginForm.email
logicStore.registerForm.confirmEmail = logicStore.loginForm.email
} else if (type === 'phone' && logicStore.loginForm.phone) {
logicStore.registerForm.type = 'phone'
logicStore.registerForm.phone = logicStore.loginForm.phone
logicStore.registerForm.areaCode = logicStore.loginForm.areaCode
}
uni.navigateTo({url});
return
}
logicStore.resetRegisterForm() logicStore.resetRegisterForm()
uni.navigateTo({url}); uni.navigateTo({url});
} }
+63 -16
View File
@@ -20,21 +20,38 @@ const columns = ref<string[]>(Config.phoneCodeList);
const isAgreed = ref(false) const isAgreed = ref(false)
const EmailRegisterSchema = z.object({
firstName: z.string().min(1, {message: t('pages-login.index.prompt.first-name')}),
surname: z.string().min(1, {message: t('pages-login.index.prompt.last-name')}),
email: z.string().min(1, {message: t('pages-login.index.prompt.email-address-verify')}).email({message: t('pages-login.index.prompt.email-address-verify')}),
confirmEmail: z.string().min(1, {message: t('pages-login.index.prompt.email-address-verify')}).email({message: t('pages-login.index.prompt.email-address-verify')}),
loginPwd: z.string().min(1, {message: t('pages-login.index.prompt.password')}),
confirmLoginPwd: z.string().min(1, {message: t('pages-login.index.prompt.password')}),
})
.refine((data) => data.email === data.confirmEmail, {
path: ['confirmEmail'],
message: t('pages-login.index.prompt.confirm-email-verify')
})
.refine((data) => data.loginPwd === data.confirmLoginPwd, {
path: ['confirmLoginPwd'],
message: t('pages-login.index.prompt.confirm-password-verify')
})
const FormSchema = z.object({ const PhoneRegisterSchema = z.object({
firstName: z.string().min(1, {message: t('pages-login.index.prompt.first-name')}), firstName: z.string().min(1, {message: t('pages-login.index.prompt.first-name')}),
surname: z.string().min(1, {message: t('pages-login.index.prompt.last-name')}), surname: z.string().min(1, {message: t('pages-login.index.prompt.last-name')}),
phone: z.string().min(1, {message: t('pages-login.index.prompt.phone-number')}).regex(/^\d{6,11}$/, {message: t('pages-login.index.prompt.phone-number-verify')}), phone: z.string().min(1, {message: t('pages-login.index.prompt.phone-number')}).regex(/^\d{6,11}$/, {message: t('pages-login.index.prompt.phone-number-verify')}),
loginPwd: z.string().min(1, {message: t('pages-login.index.prompt.password')}), loginPwd: z.string().min(1, {message: t('pages-login.index.prompt.password')}),
email: z.string().email({message: t('pages-login.index.prompt.email-address-verify')}), confirmLoginPwd: z.string().min(1, {message: t('pages-login.index.prompt.password')}),
confirmEmail: z.string().email({message: t('pages-login.index.prompt.email-address-verify')}), }).refine((data) => data.loginPwd === data.confirmLoginPwd, {
}).refine((data) => data.email === data.confirmEmail, { path: ['confirmLoginPwd'],
path: ['confirmEmail'], message: t('pages-login.index.prompt.confirm-password-verify')
message: t('pages-login.index.prompt.confirm-email-verify')
}) })
function checkForm(): boolean { function checkForm(): boolean {
const validateFormField = FormSchema.safeParse(logicStore.registerForm) const type = logicStore.registerForm.type
const schema = type === 'phone' ? PhoneRegisterSchema : EmailRegisterSchema
const validateFormField = schema.safeParse(logicStore.registerForm)
if (!validateFormField.success) { if (!validateFormField.success) {
const fieldErrorMessage = validateFormField.error.flatten().fieldErrors const fieldErrorMessage = validateFormField.error.flatten().fieldErrors
const errorMessage: string | undefined = R.path([0, 0], R.values(fieldErrorMessage)) const errorMessage: string | undefined = R.path([0, 0], R.values(fieldErrorMessage))
@@ -63,15 +80,21 @@ const btnLoading = ref(false)
function codeSubmit() { function codeSubmit() {
btnLoading.value = true btnLoading.value = true
// console.log(data) // console.log(data)
const {
confirmEmail,
confirmLoginPwd,
...rest
} = logicStore.registerForm as any
appUserRegisterPost({ appUserRegisterPost({
body: { body: {
...logicStore.registerForm, ...rest,
phone: logicStore.registerForm.phone, // 后端接收“确认密码”字段名为 newPwd
newPwd: confirmLoginPwd,
areaCode: areaCode.value, areaCode: areaCode.value,
// captcha: data.code, // captcha: data.code,
// uuid: data.uuid, // uuid: data.uuid,
userPort: Config.userPort, // 登录端口2 商户端 userPort: Config.userPort, // 登录端口2 商户端
} } as any
}).then((res) => { }).then((res) => {
userStore.token = res.data.token; userStore.token = res.data.token;
logicStore.reset() logicStore.reset()
@@ -120,12 +143,17 @@ function navigateTo(url: string) {
const emailIsReadonly = ref(false) const emailIsReadonly = ref(false)
const phoneIsReadonly = ref(false) const phoneIsReadonly = ref(false)
onMounted(() => { onMounted(() => {
const {email, type} = logicStore.registerForm const {email, confirmEmail, phone, type} = logicStore.registerForm
if (type === 'phone') { if (type === 'phone') {
// phoneIsReadonly.value = true phoneIsReadonly.value = !!phone
emailIsReadonly.value = false
} }
if (type === 'email') { if (type === 'email') {
// emailIsReadonly.value = true emailIsReadonly.value = !!(email || confirmEmail)
phoneIsReadonly.value = false
if (!logicStore.registerForm.email && logicStore.registerForm.confirmEmail) {
logicStore.registerForm.email = logicStore.registerForm.confirmEmail
}
} }
}) })
</script> </script>
@@ -139,7 +167,7 @@ onMounted(() => {
</view> </view>
<view class=""> <view class="">
<!-- 邮箱 --> <!-- 邮箱 -->
<view class=""> <view v-if="logicStore.registerForm.type !== 'phone'" class="">
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ t("common.email") }}</view> <view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ t("common.email") }}</view>
<view class="border-color px-30rpx flex items-center bg-#EFEFEF"> <view class="border-color px-30rpx flex items-center bg-#EFEFEF">
<wd-input <wd-input
@@ -158,7 +186,7 @@ onMounted(() => {
</view> </view>
</view> </view>
<!-- Confirm email --> <!-- Confirm email -->
<view class="mt-36rpx"> <view v-if="logicStore.registerForm.type !== 'phone'" class="mt-36rpx">
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ <view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{
t("pages-login.sign-up.confirm-email") t("pages-login.sign-up.confirm-email")
}} }}
@@ -198,6 +226,25 @@ onMounted(() => {
</wd-input> </wd-input>
</view> </view>
</view> </view>
<!-- Confirm password -->
<view class="mt-36rpx ">
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ t("pages-login.sign-up.confirm-password") }}</view>
<view class="border-color px-30rpx flex items-center bg-#EFEFEF">
<wd-input
v-model.trim="logicStore.registerForm.confirmLoginPwd"
:cursorSpacing="20"
:focus-when-clear="false"
:maxlength="20"
:placeholder="t('common.enterPassword')"
clearable
custom-class="flex-1 !bg-transparent"
no-border
placeholderClass="!text-#999 !text-32rpx"
showPassword
>
</wd-input>
</view>
</view>
<!-- First name --> <!-- First name -->
<view class="mt-36rpx "> <view class="mt-36rpx ">
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ t("pages-login.sign-up.first-name") }}</view> <view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ t("pages-login.sign-up.first-name") }}</view>
@@ -235,7 +282,7 @@ onMounted(() => {
</view> </view>
</view> </view>
<!-- Phone number --> <!-- Phone number -->
<view class="mt-36rpx "> <view v-if="logicStore.registerForm.type !== 'email'" class="mt-36rpx ">
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ <view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{
t("pages-login.sign-up.phone-number") t("pages-login.sign-up.phone-number")
}} }}
+3 -1
View File
@@ -13,9 +13,10 @@ export const useLogicStore = defineStore('login-logic', () => {
email: '', email: '',
confirmEmail: '', confirmEmail: '',
firstName: '', firstName: '',
lastName: '', surname: '',
phone: '', phone: '',
loginPwd: '', loginPwd: '',
confirmLoginPwd: '',
areaCode: defaultAreaCode.value, areaCode: defaultAreaCode.value,
captcha: "", captcha: "",
}) })
@@ -81,6 +82,7 @@ export const useLogicStore = defineStore('login-logic', () => {
surname: '', surname: '',
phone: '', phone: '',
loginPwd: '', loginPwd: '',
confirmLoginPwd: '',
areaCode: defaultAreaCode.value, areaCode: defaultAreaCode.value,
captcha: "", captcha: "",
} }
+71 -70
View File
@@ -170,7 +170,7 @@ function handleClickSegmented(index: number) {
deliveryMethod.value = index deliveryMethod.value = index
// 重置配送类型为预约配送 // 重置配送类型为预约配送
deliveryTimeType.value = 2 deliveryTimeType.value = 2
appMerchantOrderCalculatePriceCart() void appMerchantOrderCalculatePriceCart()
} }
} }
@@ -205,7 +205,7 @@ function selectedTipChange(item: any) {
if(item.value === selectedTipIndex.value) return if(item.value === selectedTipIndex.value) return
diyTipValue.value = '' diyTipValue.value = ''
selectedTipIndex.value = item.value selectedTipIndex.value = item.value
appMerchantOrderCalculatePriceCart() void appMerchantOrderCalculatePriceCart()
} }
// 批量订单:选择某个店铺的小费 // 批量订单:选择某个店铺的小费
@@ -213,7 +213,7 @@ function selectedTipChangeForMerchant(merchantId: string, item: any) {
if(item.value === merchantTipIndexMap.value[merchantId]) return if(item.value === merchantTipIndexMap.value[merchantId]) return
merchantDiyTipValueMap.value[merchantId] = '' merchantDiyTipValueMap.value[merchantId] = ''
merchantTipIndexMap.value[merchantId] = item.value merchantTipIndexMap.value[merchantId] = item.value
appMerchantOrderCalculatePriceCart() void appMerchantOrderCalculatePriceCart()
} }
// 单个订单的自定义小费确认(金额,单位:美元) // 单个订单的自定义小费确认(金额,单位:美元)
@@ -227,7 +227,7 @@ function handleConfirmTip() {
if (selectedTipIndex.value !== 0) { if (selectedTipIndex.value !== 0) {
selectedTipIndex.value = 0 selectedTipIndex.value = 0
} }
appMerchantOrderCalculatePriceCart() void appMerchantOrderCalculatePriceCart()
} }
// 批量订单:确认某个店铺的自定义小费(金额,单位:美元) // 批量订单:确认某个店铺的自定义小费(金额,单位:美元)
@@ -240,7 +240,7 @@ function handleConfirmTipForMerchant(merchantId: string) {
if (merchantTipIndexMap.value[merchantId] !== 0) { if (merchantTipIndexMap.value[merchantId] !== 0) {
merchantTipIndexMap.value[merchantId] = 0 merchantTipIndexMap.value[merchantId] = 0
} }
appMerchantOrderCalculatePriceCart() void appMerchantOrderCalculatePriceCart()
} }
// 是否选择了配送周卡 // 是否选择了配送周卡
@@ -249,7 +249,7 @@ const isWeeklyDelivery = ref(false);
const toggleWeeklyDelivery = (value: boolean) => { const toggleWeeklyDelivery = (value: boolean) => {
if(value === isWeeklyDelivery.value) return if(value === isWeeklyDelivery.value) return
isWeeklyDelivery.value = value; isWeeklyDelivery.value = value;
appMerchantOrderCalculatePriceCart() void appMerchantOrderCalculatePriceCart()
}; };
// 价格明细 // 价格明细
@@ -297,9 +297,19 @@ const formData = ref<CreateOrderCartBo>({
}) })
// 是否需要餐具 // 是否需要餐具
const needTableware = ref(false) const needTableware = ref(false)
onLoad((options: any)=> {
async function safeAwait<T>(label: string, task: () => Promise<T>): Promise<T | undefined> {
try {
return await task()
} catch (e) {
console.error(`[checkout] ${label} failed`, e)
return undefined
}
}
onLoad(async (options: any)=> {
loading.value = true loading.value = true
try {
// 判断是批量下单还是普通下单 // 判断是批量下单还是普通下单
if(options.type == 'batch' && options.cartIds) { if(options.type == 'batch' && options.cartIds) {
// 批量下单模式 // 批量下单模式
@@ -310,12 +320,11 @@ onLoad((options: any)=> {
// 默认取用户信息中的手机号作为收货手机号 // 默认取用户信息中的手机号作为收货手机号
formData.value.phone = userStore.userInfo.phone || '' formData.value.phone = userStore.userInfo.phone || ''
contact.value.areaCode = userStore.userInfo.areaCode || '' contact.value.areaCode = userStore.userInfo.areaCode || ''
// 获取用户地址列表
getAddressList() // 严格按顺序执行
// 查询批量购物车详情 await safeAwait('getAddressList', getAddressList)
getBatchCartInfo() await safeAwait('getBatchCartInfo', getBatchCartInfo)
// 查询用户默认信用卡 await safeAwait('appUserCardSelectDefault', appUserCardSelectDefault)
appUserCardSelectDefault()
} else if(options.storeId) { } else if(options.storeId) {
// 普通下单模式 // 普通下单模式
orderType.value = 'normal' orderType.value = 'normal'
@@ -327,20 +336,28 @@ onLoad((options: any)=> {
// 默认取用户信息中的手机号作为收货手机号 // 默认取用户信息中的手机号作为收货手机号
formData.value.phone = userStore.userInfo.phone || '' formData.value.phone = userStore.userInfo.phone || ''
contact.value.areaCode = userStore.userInfo.areaCode || '' contact.value.areaCode = userStore.userInfo.areaCode || ''
// 获取用户地址列表
getAddressList() // 严格按顺序执行
// 查询当前店铺购物车详情 await safeAwait('getAddressList', getAddressList)
getCartInfo() await safeAwait('getCartInfo', getCartInfo)
// 获取商家详情信息 await safeAwait('getStoreDetail', getStoreDetail)
getStoreDetail() await safeAwait('appUserCardSelectDefault', appUserCardSelectDefault)
// 查询用户默认信用卡 }
appUserCardSelectDefault() } finally {
loading.value = false
} }
}) })
onShow(()=> { onShow(async ()=> {
// 刷新购物车列表 // 刷新地址,并在必要时重新计算价格
getAddressList() await safeAwait('getAddressList', getAddressList)
const hasCart =
orderType.value === 'batch'
? (batchCartIds.value?.length || 0) > 0
: (cartDataList.value?.length || 0) > 0
if (hasCart) {
await safeAwait('appMerchantOrderCalculatePriceCart', appMerchantOrderCalculatePriceCart)
}
}) })
// 页面加载状态 // 页面加载状态
@@ -360,24 +377,21 @@ onMounted(() => {
}); });
const cartDataList = ref<MerchantCartVo[]>([]) const cartDataList = ref<MerchantCartVo[]>([])
function getCartInfo() { async function getCartInfo() {
appMerchantCartListByMerchantIdPost({ const res: any = await appMerchantCartListByMerchantIdPost({
params: { params: {
merchantId: storeId.value, merchantId: storeId.value,
} }
}).then((res: any)=> { })
console.log('购物车列表', res) console.log('购物车列表', res)
cartDataList.value = res.data cartDataList.value = res.data
// 购物车有菜品,查询菜品会员折扣价 // 购物车有菜品,查询菜品会员折扣价 + 计算价格(严格串行)
if(cartDataList.value.length > 0) { if(cartDataList.value.length > 0) {
appMerchantCartCalculateSavings() await appMerchantCartCalculateSavings()
// 查询购物车下单价格 await appMerchantOrderCalculatePriceCart()
appMerchantOrderCalculatePriceCart()
} }
}).finally(()=> {
loading.value = false
})
} }
// 批量下单:查询购物车详情 // 批量下单:查询购物车详情
@@ -430,30 +444,26 @@ async function getBatchCartInfo() {
cartDataList.value = results.filter(item => item !== null); cartDataList.value = results.filter(item => item !== null);
console.log('批量模式-最终购物车数据', cartDataList.value); console.log('批量模式-最终购物车数据', cartDataList.value);
// 查询菜品会员折扣价 // 批量模式:查询菜品会员折扣价 + 计算价格(严格串行)
if(cartIds.length > 0) { if(cartIds.length > 0) {
appMerchantCartCalculateSavings() await appMerchantCartCalculateSavings()
// 注意:价格计算会在地址加载完成后自动调用 await appMerchantOrderCalculatePriceCart()
// 这里不需要立即调用 appMerchantOrderCalculatePriceCart()
} }
} catch (error) { } catch (error) {
console.error('获取批量购物车详情失败', error) console.error('获取批量购物车详情失败', error)
cartDataList.value = []; cartDataList.value = [];
} finally {
loading.value = false
} }
} }
// 查询菜品会员折扣价 // 查询菜品会员折扣价
const cartSavingsData = ref({}) const cartSavingsData = ref({})
function appMerchantCartCalculateSavings() { async function appMerchantCartCalculateSavings() {
const cartIds = orderType.value == 'batch' ? batchCartIds.value : cartDataList.value.map(item => item.id) const cartIds = orderType.value == 'batch' ? batchCartIds.value : cartDataList.value.map(item => item.id)
appMerchantCartCalculateSavingsPost({ const res: any = await appMerchantCartCalculateSavingsPost({
body: cartIds body: cartIds
}).then(res=> { })
console.log('菜品会员折扣价', res) console.log('菜品会员折扣价', res)
cartSavingsData.value = res.data cartSavingsData.value = res.data
})
} }
// 获取商家详情信息 // 获取商家详情信息
@@ -470,12 +480,13 @@ const storeIsSelfPickup = computed(()=> {
const storeDetail = ref<MerchantVo>({}) const storeDetail = ref<MerchantVo>({})
// 用户距离商家的距离信息 // 用户距离商家的距离信息
const storeDistance = ref(null) const storeDistance = ref(null)
function getStoreDetail() { async function getStoreDetail() {
appMerchantDetailMerchantIdGet({ const res: any = await appMerchantDetailMerchantIdGet({
params: { params: {
merchantId: storeId.value, merchantId: storeId.value,
} }
}).then((res: any) => { })
console.log('商家详情', res) console.log('商家详情', res)
storeDetail.value = res.data as MerchantVo storeDetail.value = res.data as MerchantVo
@@ -515,13 +526,10 @@ function getStoreDetail() {
deliveryMethod.value = 0 deliveryMethod.value = 0
showDeliverySwitch.value = true showDeliverySwitch.value = true
} }
}).catch((error) => {
console.error('获取商家详情失败:', error);
})
} }
const priceData = ref({}) const priceData = ref({})
function appMerchantOrderCalculatePriceCart() { async function appMerchantOrderCalculatePriceCart() {
// 优先使用新选择的地址id // 优先使用新选择的地址id
const targetAddressId = selectedAddressId.value || currentAddressId.value const targetAddressId = selectedAddressId.value || currentAddressId.value
// if(!targetAddressId) return // if(!targetAddressId) return
@@ -561,7 +569,7 @@ function appMerchantOrderCalculatePriceCart() {
} }
}) })
appMerchantOrderCalculatePriceCartBatchPost({ const res: any = await appMerchantOrderCalculatePriceCartBatchPost({
body: { body: {
addressId: targetAddressId, addressId: targetAddressId,
cartIds: cartIds, cartIds: cartIds,
@@ -571,10 +579,9 @@ function appMerchantOrderCalculatePriceCart() {
phone: formData.value.phone, phone: formData.value.phone,
areaCode: contact.value.areaCode, areaCode: contact.value.areaCode,
} }
}).then(res=> { })
console.log('批量购物车下单价格', res) console.log('批量购物车下单价格', res)
priceData.value = res.data priceData.value = res.data
})
} else { } else {
// 普通模式使用单店铺计算价格接口 // 普通模式使用单店铺计算价格接口
// 计算小费金额(美元) // 计算小费金额(美元)
@@ -588,7 +595,7 @@ function appMerchantOrderCalculatePriceCart() {
} }
} }
appMerchantOrderCalculatePriceCartPost({ const res: any = await appMerchantOrderCalculatePriceCartPost({
body: { body: {
addressId: targetAddressId, addressId: targetAddressId,
cartIds: cartIds, cartIds: cartIds,
@@ -599,10 +606,9 @@ function appMerchantOrderCalculatePriceCart() {
phone: formData.value.phone, phone: formData.value.phone,
areaCode: contact.value.areaCode, areaCode: contact.value.areaCode,
} }
}).then(res=> { })
console.log('购物车下单价格', res) console.log('购物车下单价格', res)
priceData.value = res.data priceData.value = res.data
})
} }
} }
@@ -620,13 +626,13 @@ const addressInfo = computed(()=> {
return addressesList.value.find(item => String(item.id) === String(targetId)) || {}; return addressesList.value.find(item => String(item.id) === String(targetId)) || {};
}); });
function getAddressList() { async function getAddressList() {
appUserAddressListPost({ const res: any = await appUserAddressListPost({
params: { params: {
pageNum: 1, pageNum: 1,
pageSize: 100, pageSize: 100,
} }
}).then(res => { })
console.log('获取用户地址列表', res) console.log('获取用户地址列表', res)
addressesList.value = res.rows addressesList.value = res.rows
if(addressesList.value.length > 0) { if(addressesList.value.length > 0) {
@@ -643,13 +649,7 @@ function getAddressList() {
visitMethod.value.label = t('components.visit.putItAtTheDoor') visitMethod.value.label = t('components.visit.putItAtTheDoor')
visitMethod.value.value = 1 visitMethod.value.value = 1
} }
// 如果是批量模式,地址加载完成后重新计算价格
if(orderType.value === 'batch') {
appMerchantOrderCalculatePriceCart()
} }
}
})
} }
function chooseAddress() { function chooseAddress() {
@@ -675,17 +675,18 @@ function chooseAddress() {
} }
// 重新计算价格 // 重新计算价格
appMerchantOrderCalculatePriceCart() void appMerchantOrderCalculatePriceCart()
}, },
}, },
}) })
} }
function appUserCardSelectDefault() { function appUserCardSelectDefault() {
appUserCardSelectDefaultPost({}).then(res=> { return appUserCardSelectDefaultPost({}).then((res: any)=> {
console.log('查询用户默认信用卡', res) console.log('查询用户默认信用卡', res)
payMethodOptions.value.cardId = res.data?.cardId || '' payMethodOptions.value.cardId = res.data?.cardId || ''
payMethodOptions.value.cardNumber = res.data?.cardNumber || '' payMethodOptions.value.cardNumber = res.data?.cardNumber || ''
return res
}) })
} }
@@ -1078,7 +1079,7 @@ function navigateToCoupon(merchantId?: string) {
couponInfo.value = data couponInfo.value = data
} }
// 重新计算价格 // 重新计算价格
appMerchantOrderCalculatePriceCart() void appMerchantOrderCalculatePriceCart()
} }
}, },
}, },
@@ -1093,7 +1094,7 @@ function handleClose(merchantId?: string) {
couponInfo.value = null couponInfo.value = null
} }
// 重新计算价格 // 重新计算价格
appMerchantOrderCalculatePriceCart() void appMerchantOrderCalculatePriceCart()
} }
</script> </script>
+1 -1
View File
@@ -307,7 +307,7 @@ function getStoreDetail() {
<view class="flex items-center gap-12rpx"> <view class="flex items-center gap-12rpx">
<text class="current-price">US${{ dishDetailData?.discountPrice }}</text> <text class="current-price">US${{ dishDetailData?.discountPrice }}</text>
<text class="original-price">US${{ dishDetailData?.originalPrice }}</text> <text class="original-price">US${{ dishDetailData?.originalPrice }}</text>
<view class="member-price-tag center"> <view v-if="Number(dishDetailData?.memberPrice) > 0" class="member-price-tag center">
<text class="member-price-text">{{ t('pages-store.store.members') }}: ${{ dishDetailData?.memberPrice }}</text> <text class="member-price-text">{{ t('pages-store.store.members') }}: ${{ dishDetailData?.memberPrice }}</text>
</view> </view>
</view> </view>
+4 -1
View File
@@ -695,7 +695,10 @@ function handleShare() {
</view> </view>
<view class="flex-center-sb mt-12rpx"> <view class="flex-center-sb mt-12rpx">
<text class="text-26rpx lh-30rpx text-#333 font-500">US${{ item.discountPrice }}</text> <text class="text-26rpx lh-30rpx text-#333 font-500">US${{ item.discountPrice }}</text>
<view class="member-price-tag text-[#FBE3C3] font-500 text-28rpx lh-28rpx center pl-6rpx break-all"> <view
v-if="Number(item.memberPrice) > 0"
class="member-price-tag text-[#FBE3C3] font-500 text-28rpx lh-28rpx center pl-6rpx break-all"
>
<text class="!text-24rpx">{{ t('pages-store.store.members') }}: </text> <text class="!text-24rpx">{{ t('pages-store.store.members') }}: </text>
${{ item.memberPrice }} ${{ item.memberPrice }}
</view> </view>
+1 -1
View File
@@ -311,7 +311,7 @@ function navigateTo(url: string) {
<!-- 会员价标签 --> <!-- 会员价标签 -->
<view <view
v-if="item.merchantDishVo.memberPrice" v-if="Number(item.merchantDishVo.memberPrice) > 0"
class="member-price-tag ml-10rpx center pl-16rpx pr-6rpx pb-2rpx" class="member-price-tag ml-10rpx center pl-16rpx pr-6rpx pb-2rpx"
> >
<text class="text-[#FBE3C3] text-20rpx" <text class="text-[#FBE3C3] text-20rpx"
@@ -138,7 +138,12 @@ defineExpose({
</view> </view>
<view class="flex-center-sb"> <view class="flex-center-sb">
<text class="text-30rpx lh-30rpx text-#333 font-500">US${{ item.merchantDishVo.discountPrice }}</text> <text class="text-30rpx lh-30rpx text-#333 font-500">US${{ item.merchantDishVo.discountPrice }}</text>
<view class="member-price-tag text-[#FBE3C3] text-18rpx center pl-6rpx">{{ t('pages-store.store.members') }}: ${{ item.merchantDishVo.memberPrice }}</view> <view
v-if="Number(item.merchantDishVo.memberPrice) > 0"
class="member-price-tag text-[#FBE3C3] text-18rpx center pl-6rpx"
>
{{ t('pages-store.store.members') }}: ${{ item.merchantDishVo.memberPrice }}
</view>
</view> </view>
<view class="flex-center-sb mt-12rpx"> <view class="flex-center-sb mt-12rpx">
<view class="text-28rpx text-#999"> <view class="text-28rpx text-#999">
@@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import {thumbnailImg} from "@/utils/utils"; import {thumbnailImg} from "@/utils/utils";
const props = defineProps<{ const props = defineProps<{
list: object[]; list: any[];
}>(); }>();
const { t } = useI18n(); const { t } = useI18n();
@@ -16,11 +16,13 @@ function handleClickFood(item: any) {
<scroll-view scroll-x="true"> <scroll-view scroll-x="true">
<view class="flex"> <view class="flex">
<view class="w-30rpx shrink-0"></view> <view class="w-30rpx shrink-0"></view>
<template v-for="(item, index) in list"> <template v-for="(item, index) in list" :key="item?.id ?? index">
<view @click="handleClickFood(item)" :class="[index === 0 ? '' : 'ml-28rpx']"> <view @click="handleClickFood(item)" :class="[index === 0 ? '' : 'ml-28rpx']">
<image :src="thumbnailImg(item?.shopImages?.split(',')[0])" class="w-448rpx h-252rpx rounded-24rpx mb-20rpx bg-common" mode="aspectFill"></image> <image :src="thumbnailImg(item?.shopImages?.split(',')[0])" class="w-448rpx h-252rpx rounded-24rpx mb-20rpx bg-common" mode="aspectFill"></image>
<text class="text-30rpx lh-30rpx text-#333 font-500 line-clamp-1">{{ item?.merchantName }}</text> <text class="text-30rpx lh-30rpx text-#333 font-500 line-clamp-1">{{ item?.merchantName }}</text>
<view v-if="+item.deliveryService === 1" class="text-#CE7138 text-24rpx lh-24rpx mt-12rpx">${{ item.deliveryFee }} {{ t('pages.home.deliveryFee') }}</view> <view v-if="+item.deliveryService === 1" class="text-#CE7138 text-24rpx lh-24rpx mt-12rpx">
{{ t('pages-store.store.tips5') }} ${{ item.deliveryFee }}{{ t('pages-store.store.start') }}
</view>
<view class="text-24rpx lh-24rpx flex items-center mt-12rpx"> <view class="text-24rpx lh-24rpx flex items-center mt-12rpx">
<text class="text-#333 font-500">{{ item.rating }}</text> <text class="text-#333 font-500">{{ item.rating }}</text>
<image src="@img/chef/124.png" class="w-24rpx h-24rpx mx-4rpx mt-2rpx"></image> <image src="@img/chef/124.png" class="w-24rpx h-24rpx mx-4rpx mt-2rpx"></image>
@@ -384,7 +384,10 @@ const debouncedEmit = debounce(1300, (isCollected: boolean, id: string, type: Co
</view> </view>
<view class="flex-center-sb mt-12rpx"> <view class="flex-center-sb mt-12rpx">
<text class="text-32rpx lh-30rpx text-#333 font-500">US${{ item?.discountPrice }}</text> <text class="text-32rpx lh-30rpx text-#333 font-500">US${{ item?.discountPrice }}</text>
<view class="member-price-tag text-[#FBE3C3] font-500 text-30rpx lh-30rpx center pl-6rpx break-all"> <view
v-if="Number(item?.memberPrice) > 0"
class="member-price-tag text-[#FBE3C3] font-500 text-30rpx lh-30rpx center pl-6rpx break-all"
>
<text>{{ t('pages-store.store.members') }}: </text> <text>{{ t('pages-store.store.members') }}: </text>
${{ item?.memberPrice }} ${{ item?.memberPrice }}
</view> </view>