Added new frontend components for drink ordering app including coupons, orders, address management and menu pages
This commit is contained in:
parent
89b0941b1c
commit
d68d3a1adf
29
api/invoice.js
Normal file
29
api/invoice.js
Normal file
@ -0,0 +1,29 @@
|
||||
import api from './api'
|
||||
|
||||
/**
|
||||
* 创建发票申请
|
||||
*/
|
||||
export function createInvoiceApplication(data) {
|
||||
return api.post(`/invoiceapplication/create`, data, { login: false })
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发票申请历史
|
||||
*/
|
||||
export function getInvoiceApplicationList(data) {
|
||||
return api.get(`/invoiceapplication/list`, data, { login: false })
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发票申请详情
|
||||
*/
|
||||
export function getInvoiceApplicationDetail(id) {
|
||||
return api.get(`/invoiceapplication/detail/${id}`, {}, { login: false })
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户发票信息
|
||||
*/
|
||||
export function getUserInvoiceInfo(id) {
|
||||
return api.get(`/invoiceapplication/get?id=${id}`, {}, { login: false })
|
||||
}
|
25
main.js
25
main.js
@ -1,21 +1,18 @@
|
||||
/*
|
||||
* @Author: Gaoxs
|
||||
* @Date: 2023-04-07 15:12:06
|
||||
* @LastEditors: Gaoxs
|
||||
* @Description:
|
||||
*/
|
||||
import util from '@/utils'
|
||||
|
||||
import App from './App'
|
||||
|
||||
import { createPinia } from 'pinia'
|
||||
|
||||
import { createSSRApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import piniaPersist from 'pinia-plugin-persistedstate'
|
||||
import App from './App.vue'
|
||||
|
||||
// 创建Pinia实例
|
||||
const pinia = createPinia()
|
||||
// 使用piniaPersist插件
|
||||
pinia.use(piniaPersist)
|
||||
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
app.use(util)
|
||||
app.use(createPinia())
|
||||
// 使用Pinia
|
||||
app.use(pinia)
|
||||
|
||||
return {
|
||||
app,
|
||||
}
|
||||
|
22
main2.js
Normal file
22
main2.js
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* @Author: Gaoxs
|
||||
* @Date: 2023-04-07 15:12:06
|
||||
* @LastEditors: Gaoxs
|
||||
* @Description:
|
||||
*/
|
||||
import util from '@/utils'
|
||||
|
||||
import App from './App'
|
||||
|
||||
import { createPinia } from 'pinia'
|
||||
|
||||
import { createSSRApp } from 'vue'
|
||||
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
app.use(util)
|
||||
app.use(createPinia())
|
||||
return {
|
||||
app,
|
||||
}
|
||||
}
|
2050
package-lock.json
generated
2050
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,7 @@
|
||||
"flyio": "^0.6.14",
|
||||
"jweixin-module": "^1.6.0",
|
||||
"pinia": "^2.1.6",
|
||||
"pinia-plugin-persistedstate": "^4.2.0",
|
||||
"vant": "^4.6.2",
|
||||
"weixin-js-sdk": "^1.6.3",
|
||||
"yarn": "^1.22.19"
|
||||
|
@ -24,7 +24,7 @@
|
||||
<view class="right">
|
||||
<button type="default" plain size="mini" class="btn" hover-class="none"
|
||||
@tap="handleCartItemReduce(index)">
|
||||
<view class="iconfont iconsami-select"></view>
|
||||
<view class="iconfont iconsami-select" style="color: white;"></view>
|
||||
</button>
|
||||
<view class="number">{{ item.number }}</view>
|
||||
<button type="primary" class="btn" size="min" hover-class="none"
|
||||
@ -38,7 +38,7 @@
|
||||
</view>
|
||||
<view class="fixed-bottom flex justify-between align-center bg-white ">
|
||||
<view class="mx-2 ont-weight-light">应付:<text class="text-danger">¥{{ getCartGoodsPrice }}</text></view>
|
||||
<view><uv-button type="warning" color="#09b4f1" :customStyle="customStyle" size="large" text="去结算" @click="toPay"></uv-button></view>
|
||||
<view ><uv-button style="background-color: #52ac41;" type="warning" color="#09b4f1" :customStyle="customStyle" size="large" text="去结算" @click="toPay"></uv-button></view>
|
||||
</view>
|
||||
<uv-toast ref="uToast"></uv-toast>
|
||||
</template>
|
||||
@ -228,6 +228,8 @@ const toPay = () => {
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
line-height: 46rpx;
|
||||
background-color: #52ac41;
|
||||
border-color: #ffffff;
|
||||
}
|
||||
|
||||
.number {
|
||||
|
@ -43,7 +43,7 @@
|
||||
</list-cell>
|
||||
</view>
|
||||
<view class="btn-section">
|
||||
<button type="primary" size="default" @tap="save">保存</button>
|
||||
<button type="primary" style="background-color: #52ac41;" size="default" @tap="save">保存</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -155,7 +155,8 @@ const chooseLocation = async() => {
|
||||
font-size: $font-size-base;
|
||||
|
||||
&.checked {
|
||||
background-color: $color-primary;
|
||||
// background-color: $color-primary;
|
||||
background-color: #52ac41;
|
||||
color: $text-color-white;
|
||||
border: 2rpx solid $color-primary;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
</template>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<button type="primary" size="default" @tap="add">新增地址</button>
|
||||
<button type="primary" style="background-color: #52ac41;" size="default" @tap="add">新增地址</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -72,7 +72,7 @@ import {
|
||||
const main = useMainStore()
|
||||
const { isLogin } = storeToRefs(main)
|
||||
const title = ref('账单')
|
||||
const orderList = ref([[], [], [], []])
|
||||
const orderList = ref([[], [], []])
|
||||
const list = ref([
|
||||
{
|
||||
name: '全部'
|
||||
|
@ -9,7 +9,7 @@
|
||||
<view class="exchange-box">
|
||||
<view class="input-box">
|
||||
<input type="text" v-model="exchange_code" placeholder="请输入兑换码" placeholder-class="text-color-assist font-size-base" />
|
||||
<button type="primary" @click="exchange">兑换</button>
|
||||
<button type="primary" style="background-color: #52ac41;" @click="exchange">兑换</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tabbar">
|
||||
@ -332,7 +332,8 @@ page {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: $font-size-base;
|
||||
color: $text-color-base;
|
||||
// color: $text-color-base;
|
||||
color: #52ac41;
|
||||
position: relative;
|
||||
|
||||
.title {
|
||||
@ -340,10 +341,10 @@ page {
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: $color-primary;
|
||||
color: #52ac41;
|
||||
|
||||
.title {
|
||||
border-bottom: 5rpx solid $color-primary;
|
||||
border-bottom: 5rpx solid #52ac41;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,25 @@
|
||||
<template>
|
||||
<uv-navbar
|
||||
:fixed="false"
|
||||
title="填写信息"
|
||||
left-arrow
|
||||
@leftClick="$onClickLeft"
|
||||
/>
|
||||
<view class="page">
|
||||
<!-- 头部导航 -->
|
||||
<view class="header">
|
||||
<!-- <view class="header">
|
||||
<image
|
||||
class="back-icon"
|
||||
src="/static/images/back.png"
|
||||
@tap="goBack"
|
||||
></image>
|
||||
<text class="header-title">填写信息</text>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 表单 -->
|
||||
<view class="form-container">
|
||||
<view class="form-container" style=" padding: 40rpx 20rpx; border-radius: 20rpx;">
|
||||
<!-- 姓名 -->
|
||||
<view class="form-item">
|
||||
<view class="form-item" style="">
|
||||
<text class="form-label">姓名</text>
|
||||
<input
|
||||
class="form-input"
|
||||
|
@ -12,7 +12,7 @@
|
||||
<text class="label">发票类型</text>
|
||||
<view class="radio-group">
|
||||
<view class="radio-item" @click="invoiceType = 'company'">
|
||||
<radio :checked="invoiceType === 'company'" color="#52ac41" />
|
||||
<radio :checked="invoiceType === 'company'" color="#52ac41" />
|
||||
<text>企业单位</text>
|
||||
</view>
|
||||
<view class="radio-item" @click="invoiceType = 'personal'">
|
||||
@ -31,7 +31,7 @@
|
||||
placeholder="请输入发票抬头(必填)"
|
||||
placeholderClass="placeholder"
|
||||
class="input-field"
|
||||
v-model="companyForm.title"
|
||||
v-model="companyForm.invoiceTitle"
|
||||
/>
|
||||
</view>
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
placeholder="公司地址(选填)"
|
||||
placeholderClass="placeholder"
|
||||
class="input-field"
|
||||
v-model="companyForm.address"
|
||||
v-model="companyForm.companyAddress"
|
||||
/>
|
||||
</view>
|
||||
|
||||
@ -64,7 +64,7 @@
|
||||
placeholder="公司电话(选填)"
|
||||
placeholderClass="placeholder"
|
||||
class="input-field"
|
||||
v-model="companyForm.phone"
|
||||
v-model="companyForm.companyPhone"
|
||||
/>
|
||||
</view>
|
||||
|
||||
@ -75,7 +75,7 @@
|
||||
placeholder="开户银行(选填)"
|
||||
placeholderClass="placeholder"
|
||||
class="input-field"
|
||||
v-model="companyForm.bank"
|
||||
v-model="companyForm.bankName"
|
||||
/>
|
||||
</view>
|
||||
|
||||
@ -93,29 +93,27 @@
|
||||
|
||||
<!-- 个人/非企业单位表单 -->
|
||||
<block v-else>
|
||||
<view class="section-title">接收方式</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="label">邮箱地址<text class="required">*</text></text>
|
||||
<text class="label">发票抬头<text class="required">*</text></text>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="请输入接收邮箱地址(必填)"
|
||||
placeholder="请输入个人发票抬头(必填)"
|
||||
placeholderClass="placeholder"
|
||||
class="input-field"
|
||||
v-model="personalForm.email"
|
||||
v-model="personalForm.invoiceTitle"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="label">手机号<text class="required">*</text></text>
|
||||
<!-- <view class="form-item">
|
||||
<text class="label">税号</text>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="填写手机号(必填)"
|
||||
placeholder="请输入个人税号(选填)"
|
||||
placeholderClass="placeholder"
|
||||
class="input-field"
|
||||
v-model="personalForm.mobile"
|
||||
v-model="personalForm.taxNumber"
|
||||
/>
|
||||
</view>
|
||||
</view> -->
|
||||
</block>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
@ -129,24 +127,29 @@
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useMainStore } from '@/store/store'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { createInvoiceApplication, getUserInvoiceInfo } from '@/api/invoice'
|
||||
|
||||
// 发票类型(company: 企业单位, personal: 个人/非企业单位)
|
||||
const invoiceType = ref('company')
|
||||
|
||||
// 企业单位表单数据
|
||||
const companyForm = reactive({
|
||||
title: '',
|
||||
taxNumber: '',
|
||||
address: '',
|
||||
phone: '',
|
||||
bank: '',
|
||||
bankAccount: ''
|
||||
userId: '123',
|
||||
invoiceTitle: '', // 发票抬头
|
||||
taxNumber: '', // 纳税人识别号
|
||||
companyAddress: '', // 单位地址
|
||||
companyPhone: '', // 公司电话
|
||||
bankName: '', // 开户银行
|
||||
bankAccount: '' // 银行账户
|
||||
})
|
||||
|
||||
// 个人/非企业单位表单数据
|
||||
const personalForm = reactive({
|
||||
email: '',
|
||||
mobile: ''
|
||||
userId: '123',
|
||||
invoiceTitle: '', // 个人发票抬头
|
||||
// taxNumber: '' // 个人税号(可能为空)
|
||||
})
|
||||
|
||||
// 切换发票类型
|
||||
@ -155,59 +158,181 @@ const setInvoiceType = (type) => {
|
||||
}
|
||||
|
||||
// 提交发票信息
|
||||
const submitInvoice = () => {
|
||||
if (invoiceType.value === 'company') {
|
||||
// 验证企业表单
|
||||
if (!companyForm.title) {
|
||||
uni.showToast({
|
||||
title: '请输入发票抬头',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!companyForm.taxNumber) {
|
||||
uni.showToast({
|
||||
title: '请输入纳税人识别号',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
const submitInvoice = async () => {
|
||||
try {
|
||||
if (invoiceType.value === 'company') {
|
||||
// 验证企业表单
|
||||
if (!companyForm.invoiceTitle) {
|
||||
uni.showToast({
|
||||
title: '请输入发票抬头',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!companyForm.taxNumber) {
|
||||
uni.showToast({
|
||||
title: '请输入纳税人识别号',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 提交企业发票信息
|
||||
console.log('提交企业发票信息', companyForm)
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
icon: 'success'
|
||||
})
|
||||
} else {
|
||||
// 验证个人表单
|
||||
if (!personalForm.email) {
|
||||
uni.showToast({
|
||||
title: '请输入接收邮箱地址',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!personalForm.mobile) {
|
||||
uni.showToast({
|
||||
title: '请输入手机号',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
// 构建提交数据
|
||||
const params = {
|
||||
userId: companyForm.userId,
|
||||
invoiceType: 'enterprise',
|
||||
invoiceTitle: companyForm.invoiceTitle,
|
||||
taxNumber: companyForm.taxNumber,
|
||||
companyAddress: companyForm.companyAddress,
|
||||
companyPhone: companyForm.companyPhone,
|
||||
bankName: companyForm.bankName,
|
||||
bankAccount: companyForm.bankAccount
|
||||
}
|
||||
|
||||
// 提交个人发票信息
|
||||
console.log('提交个人发票信息', personalForm)
|
||||
// 提交企业发票信息
|
||||
uni.showLoading({
|
||||
title: '提交中...'
|
||||
})
|
||||
|
||||
// 调用接口提交数据
|
||||
const data = await createInvoiceApplication(params)
|
||||
|
||||
uni.hideLoading()
|
||||
|
||||
if (data) {
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
icon: 'success'
|
||||
})
|
||||
// 返回上一页
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '提交失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// 验证个人表单
|
||||
if (!personalForm.invoiceTitle) {
|
||||
uni.showToast({
|
||||
title: '请输入发票抬头',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 构建提交数据
|
||||
const params = {
|
||||
userId: personalForm.userId,
|
||||
invoiceType: 'individual',
|
||||
invoiceTitle: personalForm.invoiceTitle,
|
||||
// taxNumber: personalForm.taxNumber || ''
|
||||
}
|
||||
|
||||
// 提交个人发票信息
|
||||
uni.showLoading({
|
||||
title: '提交中...'
|
||||
})
|
||||
|
||||
// 调用接口提交数据
|
||||
const data = await createInvoiceApplication(params)
|
||||
|
||||
uni.hideLoading()
|
||||
|
||||
if (data) {
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
icon: 'success'
|
||||
})
|
||||
// 返回上一页
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '提交失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
icon: 'success'
|
||||
title: '网络请求失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
console.error('提交发票信息错误:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 页面加载时获取发票信息(如果有)
|
||||
// 获取用户ID
|
||||
// const member="", isLogin="";
|
||||
const main = useMainStore()
|
||||
// const { userInfo } = storeToRefs(main)
|
||||
|
||||
const { member, isLogin } = storeToRefs(main);
|
||||
|
||||
// 是否正在加载数据
|
||||
const loading = ref(false)
|
||||
|
||||
// 获取用户的发票信息
|
||||
const getUserInvoice = async (id) => {
|
||||
try {
|
||||
loading.value = true
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
})
|
||||
|
||||
const data = await getUserInvoiceInfo(id)
|
||||
|
||||
if (data) {
|
||||
console.log('获取到发票信息:', data)
|
||||
|
||||
// 根据返回的发票类型设置当前选中的类型
|
||||
if (data.invoiceType === 'enterprise') {
|
||||
invoiceType.value = 'company'
|
||||
|
||||
// 填充企业发票信息
|
||||
companyForm.userId = data.userId || userInfo.value?.uid || ''
|
||||
companyForm.invoiceTitle = data.invoiceTitle || ''
|
||||
companyForm.taxNumber = data.taxNumber || ''
|
||||
companyForm.companyAddress = data.companyAddress || ''
|
||||
companyForm.companyPhone = data.companyPhone || ''
|
||||
companyForm.bankName = data.bankName || ''
|
||||
companyForm.bankAccount = data.bankAccount || ''
|
||||
} else if (data.invoiceType === 'individual') {
|
||||
invoiceType.value = 'personal'
|
||||
|
||||
// 填充个人发票信息
|
||||
personalForm.userId = data.userId || userInfo.value?.uid || ''
|
||||
personalForm.invoiceTitle = data.invoiceTitle || ''
|
||||
}
|
||||
} else {
|
||||
// 如果没有获取到信息,使用当前用户ID
|
||||
companyForm.userId = userInfo.value?.uid || ''
|
||||
personalForm.userId = userInfo.value?.uid || ''
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取发票信息失败:', error)
|
||||
// 设置默认用户ID
|
||||
companyForm.userId = userInfo.value?.uid || ''
|
||||
personalForm.userId = userInfo.value?.uid || ''
|
||||
} finally {
|
||||
loading.value = false
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
// 这里可以添加获取之前保存的发票信息的逻辑
|
||||
// 获取用户信息
|
||||
console.log('用户ID:', member.value.id)
|
||||
|
||||
// 获取用户发票信息
|
||||
getUserInvoice(member.value.id)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
<text class="quality-title">匠心品质</text>
|
||||
<view class="quality-grid">
|
||||
<view v-for="(item, index) in qualityItems" :key="index" class="quality-item">
|
||||
<image :src="item.image" class="quality-image" mode="aspectFill"></image>
|
||||
<!-- <image :src="item.image" class="quality-image" mode="aspectFill"></image> -->
|
||||
<view class="quality-text">
|
||||
<text class="quality-name">{{ item.title }}</text>
|
||||
<text class="quality-desc">{{ item.subtitle }}</text>
|
||||
@ -51,17 +51,17 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
const aboutImage = 'https://ai-public.mastergo.com/ai/img_res/f2b39cd28cec5dab9ea16d879f388594.jpg';
|
||||
const aboutImage = 'https://file.aiyushantp.com/file/64fbc6c674c82bdf2ba8875108eed136973f648208e7c8c384271b7b1ea272e5.png';
|
||||
|
||||
const qualityItems = ref([
|
||||
{
|
||||
image: 'https://ai-public.mastergo.com/ai/img_res/8c148678838dd15d8ce667b28f711884.jpg',
|
||||
title: '2 年老鸽',
|
||||
title: '2年老鸽',
|
||||
subtitle: '精选食材'
|
||||
},
|
||||
{
|
||||
image: 'https://ai-public.mastergo.com/ai/img_res/bc7e796b92b26de05767d99ad450dfa4.jpg',
|
||||
title: '400 天老母鸡',
|
||||
title: '400天老母鸡',
|
||||
subtitle: '营养丰富'
|
||||
}
|
||||
]);
|
||||
@ -83,9 +83,11 @@ const qualityItems = ref([
|
||||
|
||||
.hero-image {
|
||||
width: 100%;
|
||||
height: 250px;
|
||||
height: 300rpx;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 32px;
|
||||
// display: block;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.section {
|
||||
@ -135,6 +137,7 @@ const qualityItems = ref([
|
||||
width: 48%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// justify-content: center;
|
||||
background-color: #ffffff;
|
||||
padding: 12px;
|
||||
border-radius: 8px;
|
||||
|
@ -13,8 +13,10 @@
|
||||
@change="change"
|
||||
keyName="name"
|
||||
:scrollable="false"
|
||||
activeColor="#2979ff"
|
||||
activeColor="#3979ff"
|
||||
:itemStyle="{ fontSize: '32rpx', fontWeight: 'bold' }"
|
||||
inactiveStyle="color: #666; font-size: 32rpx;"
|
||||
activeStyle="color: #000; font-size: 34rpx; font-weight: bold; transform: scale(1.05);"
|
||||
></uv-tabs>
|
||||
</view>
|
||||
<view class="orders-list d-flex flex-column w-100" style="padding: 20rpx; padding-bottom: 0;">
|
||||
@ -110,8 +112,29 @@ const current = ref(0)
|
||||
const type = ref(-1)
|
||||
|
||||
const change = (e) => {
|
||||
current.value = tabList.value.findIndex(item => item.type === e.type)
|
||||
type.value = e.type
|
||||
// uv-tabs会直接返回点击的index
|
||||
console.log('Tab change event:', e) // 调试信息
|
||||
|
||||
if (typeof e === 'number') {
|
||||
// 如果e是索引值
|
||||
current.value = e
|
||||
type.value = tabList.value[e].type
|
||||
} else if (e && typeof e === 'object') {
|
||||
// 如果e是对象
|
||||
if (e.index !== undefined) {
|
||||
current.value = e.index
|
||||
type.value = tabList.value[e.index].type
|
||||
} else if (e.type !== undefined) {
|
||||
// 找到匹配的类型索引
|
||||
const index = tabList.value.findIndex(item => item.type === e.type)
|
||||
if (index !== -1) {
|
||||
current.value = index
|
||||
type.value = e.type
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Current tab index:', current.value) // 调试信息
|
||||
getOrders(true)
|
||||
}
|
||||
|
||||
@ -170,13 +193,13 @@ const receive = async(order) => {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 修改tab激活样式
|
||||
::v-deep .uv-tabs__item {
|
||||
:deep(.uv-tabs__item) {
|
||||
font-size: 32rpx;
|
||||
color: #666;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
::v-deep .uv-tabs__item--active {
|
||||
:deep(.uv-tabs__item--active) {
|
||||
font-size: 34rpx !important;
|
||||
font-weight: bold !important;
|
||||
color: #000 !important; // 添加黑色字体
|
||||
|
@ -51,10 +51,11 @@
|
||||
</view>
|
||||
|
||||
<!-- 广告部分 -->
|
||||
<view class="banner-container flex justify-center align-center" style="height: 250rpx;">
|
||||
<view class="" style=" width: 95%; height: 85%; border-radius: 26px; background-color: lightgray;">
|
||||
</view>
|
||||
<!-- <image :src="shopAd" mode="aspectFill" class="shop-banner image_3" style="background-color:lightgray;"></image> -->
|
||||
<view class="banner-container flex justify-center align-center" style="height: 250rpx; margin: 1ch;">
|
||||
<!-- <view class="" style=" width: 95%; height: 85%; border-radius: 26px; background-color: lightgray;">
|
||||
</view> -->
|
||||
<!-- {{ ads.list[0].image }} -->
|
||||
<image :src="ads.list[0].image" mode="aspectFill" class="shop-banner" style="background-color:lightgray; border-radius: 2ch;"></image>
|
||||
</view>
|
||||
|
||||
|
||||
@ -162,7 +163,8 @@
|
||||
</view>
|
||||
<scroll-view class="modal-body" scroll-y>
|
||||
<view v-if="good.image" class="modal-image">
|
||||
<image :src="good.image"></image>
|
||||
|
||||
<image mode="aspectFill" style="width: 100%; height: 100%; border-radius: 22rpx;" :src="good.image"></image>
|
||||
</view>
|
||||
|
||||
<view class="modal-content">
|
||||
@ -1053,7 +1055,7 @@
|
||||
rgba(243, 203, 90, 1) 100%);
|
||||
color: #000;
|
||||
font-weight: 600;
|
||||
font-size: 28rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.menu-category.current:before {
|
||||
@ -1276,6 +1278,7 @@
|
||||
.modal-image {
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.modal-image image {
|
||||
|
@ -179,10 +179,11 @@ onReachBottom(() => {
|
||||
|
||||
// tab栏切换
|
||||
const change = (e) => {
|
||||
//console.log('e;',e.type)
|
||||
//console.log('e.index;',e.index)
|
||||
console.log('e;',e.type)
|
||||
console.log('e.index;',e.index)
|
||||
type.value = e.type;
|
||||
getOrders(true);
|
||||
current.value = e.index;
|
||||
};
|
||||
|
||||
const getOrders = async (isRefresh = false) => {
|
||||
@ -425,7 +426,7 @@ const receive = async (order) => {
|
||||
}
|
||||
|
||||
.text_9 {
|
||||
width: 12rpx;
|
||||
width: 2rpx;
|
||||
height: 39rpx;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(0, 0, 0, 1);
|
||||
@ -434,7 +435,7 @@ const receive = async (order) => {
|
||||
font-weight: 600;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
line-height: 194rpx;
|
||||
/* line-height: 194rpx; */
|
||||
}
|
||||
|
||||
.text_10 {
|
||||
@ -462,8 +463,8 @@ const receive = async (order) => {
|
||||
.text-wrapper_6 {
|
||||
background-color: rgba(82, 172, 65, 1);
|
||||
border-radius: 25px;
|
||||
height: 50rpx;
|
||||
width: 128rpx;
|
||||
height: 54rpx;
|
||||
width: 138rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
@ -485,13 +486,14 @@ const receive = async (order) => {
|
||||
width: auto;
|
||||
height: 34rpx;
|
||||
overflow-wrap: break-word;
|
||||
padding: 0 10rpx;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 24rpx;
|
||||
font-family: PingFang SC-Medium;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 24rpx;
|
||||
/* line-height: 24rpx; */
|
||||
}
|
||||
|
||||
.order-goods {
|
||||
|
149
store/store.js
149
store/store.js
@ -1,84 +1,74 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import cookie from '@/utils/cookie'
|
||||
import { navigateTo } from '@/utils/router'
|
||||
|
||||
export const useMainStore = defineStore('main', {
|
||||
state: () => ({
|
||||
store: {},
|
||||
cart: [],
|
||||
orderType: 'takein',
|
||||
address: {},
|
||||
addresses: {},
|
||||
member: {
|
||||
|
||||
},
|
||||
openid:"",
|
||||
token:"",
|
||||
lang: 'zh-cn',
|
||||
cookieKey:'YSESSID=yshop-e4dk4o2utr3c0n95tp42p745ai',
|
||||
// 默认地为你为北京地址
|
||||
location: {},
|
||||
mycoupon: {}
|
||||
store: {},
|
||||
cart: [],
|
||||
orderType: 'takein',
|
||||
address: {},
|
||||
addresses: {},
|
||||
member: {},
|
||||
openid: "",
|
||||
token: "",
|
||||
lang: 'zh-cn',
|
||||
cookieKey: 'YSESSID=yshop-e4dk4o2utr3c0n95tp42p745ai',
|
||||
location: {},
|
||||
mycoupon: {}
|
||||
}),
|
||||
getters: {
|
||||
|
||||
isLogin(state) {//是否登录
|
||||
isLogin(state) {
|
||||
return Object.keys(state.member).length > 0
|
||||
//return cookie.get('accessToken') ? true : false
|
||||
}
|
||||
//isLogin: state => Object.keys(state.member).length > 0 //是否登录
|
||||
},
|
||||
actions: {
|
||||
DEL_COUPON() {
|
||||
this.mycoupon = {}
|
||||
},
|
||||
SET_COUPON(coupon) {
|
||||
this.mycoupon = coupon
|
||||
},
|
||||
SET_ORDER_TYPE(type) {
|
||||
this.orderType = type
|
||||
},
|
||||
SET_MEMBER(member) {
|
||||
this.member = member
|
||||
cookie.set('userinfo', member)
|
||||
},
|
||||
SET_ADDRESS(address) {
|
||||
this.address = address
|
||||
},
|
||||
SET_ADDRESSES(addresses) {
|
||||
this.addresses = addresses
|
||||
},
|
||||
SET_STORE(store) {
|
||||
this.store = store
|
||||
},
|
||||
SET_CART(cart) {
|
||||
this.cart = cart
|
||||
},
|
||||
REMOVE_CART(state) {
|
||||
this.cart = []
|
||||
},
|
||||
setCookie(state, provider) {
|
||||
state.cookie = provider;
|
||||
uni.setStorage({
|
||||
key: 'cookieKey',
|
||||
data: provider
|
||||
});
|
||||
},
|
||||
SET_LOCATION(location) {
|
||||
this.location = location;
|
||||
},
|
||||
SET_OPENID(openid) {
|
||||
this.openid = openid;
|
||||
},
|
||||
SET_TOKEN(token) {
|
||||
this.token = token;
|
||||
cookie.set('accessToken', token)
|
||||
},
|
||||
|
||||
DEL_COUPON() {
|
||||
this.mycoupon = {}
|
||||
},
|
||||
SET_COUPON(coupon) {
|
||||
this.mycoupon = coupon
|
||||
},
|
||||
SET_ORDER_TYPE(type) {
|
||||
this.orderType = type
|
||||
},
|
||||
SET_MEMBER(member) {
|
||||
this.member = member
|
||||
cookie.set('userinfo', member)
|
||||
},
|
||||
SET_ADDRESS(address) {
|
||||
this.address = address
|
||||
},
|
||||
SET_ADDRESSES(addresses) {
|
||||
this.addresses = addresses
|
||||
},
|
||||
SET_STORE(store) {
|
||||
this.store = store
|
||||
},
|
||||
SET_CART(cart) {
|
||||
this.cart = cart
|
||||
},
|
||||
REMOVE_CART() {
|
||||
this.cart = []
|
||||
},
|
||||
setCookie(provider) {
|
||||
uni.setStorage({
|
||||
key: 'cookieKey',
|
||||
data: provider
|
||||
});
|
||||
},
|
||||
SET_LOCATION(location) {
|
||||
this.location = location;
|
||||
},
|
||||
SET_OPENID(openid) {
|
||||
this.openid = openid;
|
||||
},
|
||||
SET_TOKEN(token) {
|
||||
this.token = token;
|
||||
cookie.set('accessToken', token)
|
||||
},
|
||||
setAccessToken(user) {
|
||||
cookie.set('accessToken', user)
|
||||
// return getUserInfo()
|
||||
},
|
||||
setSelectAddress(id) {
|
||||
console.log('--> % setSelectAddress % id:\n', id)
|
||||
@ -87,16 +77,31 @@ export const useMainStore = defineStore('main', {
|
||||
init() {
|
||||
let accessToken = cookie.get('accessToken')
|
||||
if (accessToken) {
|
||||
//return getUserInfo()
|
||||
// 这里可以添加获取用户信息等逻辑
|
||||
}
|
||||
return null
|
||||
},
|
||||
logout() {
|
||||
this.user = null
|
||||
this.address = []
|
||||
this.areaList = []
|
||||
this.selectAddress = null
|
||||
this.member = {}
|
||||
this.address = {}
|
||||
this.addresses = {}
|
||||
navigateTo('/pages/login/login')
|
||||
},
|
||||
},
|
||||
persist: {
|
||||
enabled: true,
|
||||
strategies: [
|
||||
{
|
||||
storage: {
|
||||
setItem(key, value) {
|
||||
uni.setStorageSync(key, value)
|
||||
},
|
||||
getItem(key) {
|
||||
return uni.getStorageSync(key)
|
||||
},
|
||||
},
|
||||
paths: ['member', 'token'] // 需要持久化的字段
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
102
store/store2.js
Normal file
102
store/store2.js
Normal file
@ -0,0 +1,102 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import cookie from '@/utils/cookie'
|
||||
import { navigateTo } from '@/utils/router'
|
||||
|
||||
export const useMainStore = defineStore('main', {
|
||||
state: () => ({
|
||||
store: {},
|
||||
cart: [],
|
||||
orderType: 'takein',
|
||||
address: {},
|
||||
addresses: {},
|
||||
member: {
|
||||
|
||||
},
|
||||
openid:"",
|
||||
token:"",
|
||||
lang: 'zh-cn',
|
||||
cookieKey:'YSESSID=yshop-e4dk4o2utr3c0n95tp42p745ai',
|
||||
// 默认地为你为北京地址
|
||||
location: {},
|
||||
mycoupon: {}
|
||||
}),
|
||||
getters: {
|
||||
|
||||
isLogin(state) {//是否登录
|
||||
return Object.keys(state.member).length > 0
|
||||
//return cookie.get('accessToken') ? true : false
|
||||
}
|
||||
//isLogin: state => Object.keys(state.member).length > 0 //是否登录
|
||||
},
|
||||
actions: {
|
||||
DEL_COUPON() {
|
||||
this.mycoupon = {}
|
||||
},
|
||||
SET_COUPON(coupon) {
|
||||
this.mycoupon = coupon
|
||||
},
|
||||
SET_ORDER_TYPE(type) {
|
||||
this.orderType = type
|
||||
},
|
||||
SET_MEMBER(member) {
|
||||
this.member = member
|
||||
cookie.set('userinfo', member)
|
||||
},
|
||||
SET_ADDRESS(address) {
|
||||
this.address = address
|
||||
},
|
||||
SET_ADDRESSES(addresses) {
|
||||
this.addresses = addresses
|
||||
},
|
||||
SET_STORE(store) {
|
||||
this.store = store
|
||||
},
|
||||
SET_CART(cart) {
|
||||
this.cart = cart
|
||||
},
|
||||
REMOVE_CART(state) {
|
||||
this.cart = []
|
||||
},
|
||||
setCookie(state, provider) {
|
||||
state.cookie = provider;
|
||||
uni.setStorage({
|
||||
key: 'cookieKey',
|
||||
data: provider
|
||||
});
|
||||
},
|
||||
SET_LOCATION(location) {
|
||||
this.location = location;
|
||||
},
|
||||
SET_OPENID(openid) {
|
||||
this.openid = openid;
|
||||
},
|
||||
SET_TOKEN(token) {
|
||||
this.token = token;
|
||||
cookie.set('accessToken', token)
|
||||
},
|
||||
|
||||
setAccessToken(user) {
|
||||
cookie.set('accessToken', user)
|
||||
// return getUserInfo()
|
||||
},
|
||||
setSelectAddress(id) {
|
||||
console.log('--> % setSelectAddress % id:\n', id)
|
||||
this.selectAddress = this.address.filter(item => item.id == id)[0]
|
||||
},
|
||||
init() {
|
||||
let accessToken = cookie.get('accessToken')
|
||||
if (accessToken) {
|
||||
//return getUserInfo()
|
||||
}
|
||||
return null
|
||||
},
|
||||
logout() {
|
||||
this.user = null
|
||||
this.address = []
|
||||
this.areaList = []
|
||||
this.selectAddress = null
|
||||
navigateTo('/pages/login/login')
|
||||
},
|
||||
},
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user