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 })
|
||||||
|
}
|
27
main.js
27
main.js
@ -1,22 +1,19 @@
|
|||||||
/*
|
|
||||||
* @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 { 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() {
|
export function createApp() {
|
||||||
const app = createSSRApp(App)
|
const app = createSSRApp(App)
|
||||||
app.use(util)
|
// 使用Pinia
|
||||||
app.use(createPinia())
|
app.use(pinia)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
app,
|
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",
|
"flyio": "^0.6.14",
|
||||||
"jweixin-module": "^1.6.0",
|
"jweixin-module": "^1.6.0",
|
||||||
"pinia": "^2.1.6",
|
"pinia": "^2.1.6",
|
||||||
|
"pinia-plugin-persistedstate": "^4.2.0",
|
||||||
"vant": "^4.6.2",
|
"vant": "^4.6.2",
|
||||||
"weixin-js-sdk": "^1.6.3",
|
"weixin-js-sdk": "^1.6.3",
|
||||||
"yarn": "^1.22.19"
|
"yarn": "^1.22.19"
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<view class="right">
|
<view class="right">
|
||||||
<button type="default" plain size="mini" class="btn" hover-class="none"
|
<button type="default" plain size="mini" class="btn" hover-class="none"
|
||||||
@tap="handleCartItemReduce(index)">
|
@tap="handleCartItemReduce(index)">
|
||||||
<view class="iconfont iconsami-select"></view>
|
<view class="iconfont iconsami-select" style="color: white;"></view>
|
||||||
</button>
|
</button>
|
||||||
<view class="number">{{ item.number }}</view>
|
<view class="number">{{ item.number }}</view>
|
||||||
<button type="primary" class="btn" size="min" hover-class="none"
|
<button type="primary" class="btn" size="min" hover-class="none"
|
||||||
@ -38,7 +38,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="fixed-bottom flex justify-between align-center bg-white ">
|
<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 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>
|
</view>
|
||||||
<uv-toast ref="uToast"></uv-toast>
|
<uv-toast ref="uToast"></uv-toast>
|
||||||
</template>
|
</template>
|
||||||
@ -228,6 +228,8 @@ const toPay = () => {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 46rpx;
|
line-height: 46rpx;
|
||||||
|
background-color: #52ac41;
|
||||||
|
border-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.number {
|
.number {
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
</list-cell>
|
</list-cell>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn-section">
|
<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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -155,7 +155,8 @@ const chooseLocation = async() => {
|
|||||||
font-size: $font-size-base;
|
font-size: $font-size-base;
|
||||||
|
|
||||||
&.checked {
|
&.checked {
|
||||||
background-color: $color-primary;
|
// background-color: $color-primary;
|
||||||
|
background-color: #52ac41;
|
||||||
color: $text-color-white;
|
color: $text-color-white;
|
||||||
border: 2rpx solid $color-primary;
|
border: 2rpx solid $color-primary;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn-box">
|
<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>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
@ -72,7 +72,7 @@ import {
|
|||||||
const main = useMainStore()
|
const main = useMainStore()
|
||||||
const { isLogin } = storeToRefs(main)
|
const { isLogin } = storeToRefs(main)
|
||||||
const title = ref('账单')
|
const title = ref('账单')
|
||||||
const orderList = ref([[], [], [], []])
|
const orderList = ref([[], [], []])
|
||||||
const list = ref([
|
const list = ref([
|
||||||
{
|
{
|
||||||
name: '全部'
|
name: '全部'
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<view class="exchange-box">
|
<view class="exchange-box">
|
||||||
<view class="input-box">
|
<view class="input-box">
|
||||||
<input type="text" v-model="exchange_code" placeholder="请输入兑换码" placeholder-class="text-color-assist font-size-base" />
|
<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>
|
</view>
|
||||||
<view class="tabbar">
|
<view class="tabbar">
|
||||||
@ -332,7 +332,8 @@ page {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: $font-size-base;
|
font-size: $font-size-base;
|
||||||
color: $text-color-base;
|
// color: $text-color-base;
|
||||||
|
color: #52ac41;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
@ -340,10 +341,10 @@ page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
color: $color-primary;
|
color: #52ac41;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
border-bottom: 5rpx solid $color-primary;
|
border-bottom: 5rpx solid #52ac41;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<uv-navbar
|
||||||
|
:fixed="false"
|
||||||
|
title="填写信息"
|
||||||
|
left-arrow
|
||||||
|
@leftClick="$onClickLeft"
|
||||||
|
/>
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<!-- 头部导航 -->
|
<!-- 头部导航 -->
|
||||||
<view class="header">
|
<!-- <view class="header">
|
||||||
<image
|
<image
|
||||||
class="back-icon"
|
class="back-icon"
|
||||||
src="/static/images/back.png"
|
src="/static/images/back.png"
|
||||||
@tap="goBack"
|
@tap="goBack"
|
||||||
></image>
|
></image>
|
||||||
<text class="header-title">填写信息</text>
|
<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>
|
<text class="form-label">姓名</text>
|
||||||
<input
|
<input
|
||||||
class="form-input"
|
class="form-input"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<text class="label">发票类型</text>
|
<text class="label">发票类型</text>
|
||||||
<view class="radio-group">
|
<view class="radio-group">
|
||||||
<view class="radio-item" @click="invoiceType = 'company'">
|
<view class="radio-item" @click="invoiceType = 'company'">
|
||||||
<radio :checked="invoiceType === 'company'" color="#52ac41" />
|
<radio :checked="invoiceType === 'company'" color="#52ac41" />
|
||||||
<text>企业单位</text>
|
<text>企业单位</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="radio-item" @click="invoiceType = 'personal'">
|
<view class="radio-item" @click="invoiceType = 'personal'">
|
||||||
@ -31,7 +31,7 @@
|
|||||||
placeholder="请输入发票抬头(必填)"
|
placeholder="请输入发票抬头(必填)"
|
||||||
placeholderClass="placeholder"
|
placeholderClass="placeholder"
|
||||||
class="input-field"
|
class="input-field"
|
||||||
v-model="companyForm.title"
|
v-model="companyForm.invoiceTitle"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -53,7 +53,7 @@
|
|||||||
placeholder="公司地址(选填)"
|
placeholder="公司地址(选填)"
|
||||||
placeholderClass="placeholder"
|
placeholderClass="placeholder"
|
||||||
class="input-field"
|
class="input-field"
|
||||||
v-model="companyForm.address"
|
v-model="companyForm.companyAddress"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -64,7 +64,7 @@
|
|||||||
placeholder="公司电话(选填)"
|
placeholder="公司电话(选填)"
|
||||||
placeholderClass="placeholder"
|
placeholderClass="placeholder"
|
||||||
class="input-field"
|
class="input-field"
|
||||||
v-model="companyForm.phone"
|
v-model="companyForm.companyPhone"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -75,7 +75,7 @@
|
|||||||
placeholder="开户银行(选填)"
|
placeholder="开户银行(选填)"
|
||||||
placeholderClass="placeholder"
|
placeholderClass="placeholder"
|
||||||
class="input-field"
|
class="input-field"
|
||||||
v-model="companyForm.bank"
|
v-model="companyForm.bankName"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -93,29 +93,27 @@
|
|||||||
|
|
||||||
<!-- 个人/非企业单位表单 -->
|
<!-- 个人/非企业单位表单 -->
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view class="section-title">接收方式</view>
|
|
||||||
|
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<text class="label">邮箱地址<text class="required">*</text></text>
|
<text class="label">发票抬头<text class="required">*</text></text>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请输入接收邮箱地址(必填)"
|
placeholder="请输入个人发票抬头(必填)"
|
||||||
placeholderClass="placeholder"
|
placeholderClass="placeholder"
|
||||||
class="input-field"
|
class="input-field"
|
||||||
v-model="personalForm.email"
|
v-model="personalForm.invoiceTitle"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="form-item">
|
<!-- <view class="form-item">
|
||||||
<text class="label">手机号<text class="required">*</text></text>
|
<text class="label">税号</text>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="填写手机号(必填)"
|
placeholder="请输入个人税号(选填)"
|
||||||
placeholderClass="placeholder"
|
placeholderClass="placeholder"
|
||||||
class="input-field"
|
class="input-field"
|
||||||
v-model="personalForm.mobile"
|
v-model="personalForm.taxNumber"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view> -->
|
||||||
</block>
|
</block>
|
||||||
|
|
||||||
<!-- 提交按钮 -->
|
<!-- 提交按钮 -->
|
||||||
@ -129,24 +127,29 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive } from 'vue'
|
import { ref, reactive } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { useMainStore } from '@/store/store'
|
||||||
|
import { storeToRefs } from 'pinia'
|
||||||
|
import { createInvoiceApplication, getUserInvoiceInfo } from '@/api/invoice'
|
||||||
|
|
||||||
// 发票类型(company: 企业单位, personal: 个人/非企业单位)
|
// 发票类型(company: 企业单位, personal: 个人/非企业单位)
|
||||||
const invoiceType = ref('company')
|
const invoiceType = ref('company')
|
||||||
|
|
||||||
// 企业单位表单数据
|
// 企业单位表单数据
|
||||||
const companyForm = reactive({
|
const companyForm = reactive({
|
||||||
title: '',
|
userId: '123',
|
||||||
taxNumber: '',
|
invoiceTitle: '', // 发票抬头
|
||||||
address: '',
|
taxNumber: '', // 纳税人识别号
|
||||||
phone: '',
|
companyAddress: '', // 单位地址
|
||||||
bank: '',
|
companyPhone: '', // 公司电话
|
||||||
bankAccount: ''
|
bankName: '', // 开户银行
|
||||||
|
bankAccount: '' // 银行账户
|
||||||
})
|
})
|
||||||
|
|
||||||
// 个人/非企业单位表单数据
|
// 个人/非企业单位表单数据
|
||||||
const personalForm = reactive({
|
const personalForm = reactive({
|
||||||
email: '',
|
userId: '123',
|
||||||
mobile: ''
|
invoiceTitle: '', // 个人发票抬头
|
||||||
|
// taxNumber: '' // 个人税号(可能为空)
|
||||||
})
|
})
|
||||||
|
|
||||||
// 切换发票类型
|
// 切换发票类型
|
||||||
@ -155,59 +158,181 @@ const setInvoiceType = (type) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 提交发票信息
|
// 提交发票信息
|
||||||
const submitInvoice = () => {
|
const submitInvoice = async () => {
|
||||||
if (invoiceType.value === 'company') {
|
try {
|
||||||
// 验证企业表单
|
if (invoiceType.value === 'company') {
|
||||||
if (!companyForm.title) {
|
// 验证企业表单
|
||||||
uni.showToast({
|
if (!companyForm.invoiceTitle) {
|
||||||
title: '请输入发票抬头',
|
uni.showToast({
|
||||||
icon: 'none'
|
title: '请输入发票抬头',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!companyForm.taxNumber) {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交企业发票信息
|
||||||
|
uni.showLoading({
|
||||||
|
title: '提交中...'
|
||||||
})
|
})
|
||||||
return
|
|
||||||
}
|
// 调用接口提交数据
|
||||||
if (!companyForm.taxNumber) {
|
const data = await createInvoiceApplication(params)
|
||||||
uni.showToast({
|
|
||||||
title: '请输入纳税人识别号',
|
uni.hideLoading()
|
||||||
icon: 'none'
|
|
||||||
|
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: '提交中...'
|
||||||
})
|
})
|
||||||
return
|
|
||||||
|
// 调用接口提交数据
|
||||||
|
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()
|
||||||
console.log('提交企业发票信息', companyForm)
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '提交成功',
|
title: '网络请求失败,请重试',
|
||||||
icon: 'success'
|
icon: 'none'
|
||||||
})
|
|
||||||
} else {
|
|
||||||
// 验证个人表单
|
|
||||||
if (!personalForm.email) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '请输入接收邮箱地址',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!personalForm.mobile) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '请输入手机号',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 提交个人发票信息
|
|
||||||
console.log('提交个人发票信息', personalForm)
|
|
||||||
uni.showToast({
|
|
||||||
title: '提交成功',
|
|
||||||
icon: 'success'
|
|
||||||
})
|
})
|
||||||
|
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(() => {
|
onLoad(() => {
|
||||||
// 这里可以添加获取之前保存的发票信息的逻辑
|
// 获取用户信息
|
||||||
|
console.log('用户ID:', member.value.id)
|
||||||
|
|
||||||
|
// 获取用户发票信息
|
||||||
|
getUserInvoice(member.value.id)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<text class="quality-title">匠心品质</text>
|
<text class="quality-title">匠心品质</text>
|
||||||
<view class="quality-grid">
|
<view class="quality-grid">
|
||||||
<view v-for="(item, index) in qualityItems" :key="index" class="quality-item">
|
<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">
|
<view class="quality-text">
|
||||||
<text class="quality-name">{{ item.title }}</text>
|
<text class="quality-name">{{ item.title }}</text>
|
||||||
<text class="quality-desc">{{ item.subtitle }}</text>
|
<text class="quality-desc">{{ item.subtitle }}</text>
|
||||||
@ -51,17 +51,17 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
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([
|
const qualityItems = ref([
|
||||||
{
|
{
|
||||||
image: 'https://ai-public.mastergo.com/ai/img_res/8c148678838dd15d8ce667b28f711884.jpg',
|
image: 'https://ai-public.mastergo.com/ai/img_res/8c148678838dd15d8ce667b28f711884.jpg',
|
||||||
title: '2 年老鸽',
|
title: '2年老鸽',
|
||||||
subtitle: '精选食材'
|
subtitle: '精选食材'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
image: 'https://ai-public.mastergo.com/ai/img_res/bc7e796b92b26de05767d99ad450dfa4.jpg',
|
image: 'https://ai-public.mastergo.com/ai/img_res/bc7e796b92b26de05767d99ad450dfa4.jpg',
|
||||||
title: '400 天老母鸡',
|
title: '400天老母鸡',
|
||||||
subtitle: '营养丰富'
|
subtitle: '营养丰富'
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
@ -83,9 +83,11 @@ const qualityItems = ref([
|
|||||||
|
|
||||||
.hero-image {
|
.hero-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 250px;
|
height: 300rpx;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
margin-bottom: 32px;
|
margin-bottom: 32px;
|
||||||
|
// display: block;
|
||||||
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section {
|
.section {
|
||||||
@ -135,6 +137,7 @@ const qualityItems = ref([
|
|||||||
width: 48%;
|
width: 48%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
// justify-content: center;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
@ -13,8 +13,10 @@
|
|||||||
@change="change"
|
@change="change"
|
||||||
keyName="name"
|
keyName="name"
|
||||||
:scrollable="false"
|
:scrollable="false"
|
||||||
activeColor="#2979ff"
|
activeColor="#3979ff"
|
||||||
:itemStyle="{ fontSize: '32rpx', fontWeight: 'bold' }"
|
: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>
|
></uv-tabs>
|
||||||
</view>
|
</view>
|
||||||
<view class="orders-list d-flex flex-column w-100" style="padding: 20rpx; padding-bottom: 0;">
|
<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 type = ref(-1)
|
||||||
|
|
||||||
const change = (e) => {
|
const change = (e) => {
|
||||||
current.value = tabList.value.findIndex(item => item.type === e.type)
|
// uv-tabs会直接返回点击的index
|
||||||
type.value = e.type
|
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)
|
getOrders(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,13 +193,13 @@ const receive = async(order) => {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
// 修改tab激活样式
|
// 修改tab激活样式
|
||||||
::v-deep .uv-tabs__item {
|
:deep(.uv-tabs__item) {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .uv-tabs__item--active {
|
:deep(.uv-tabs__item--active) {
|
||||||
font-size: 34rpx !important;
|
font-size: 34rpx !important;
|
||||||
font-weight: bold !important;
|
font-weight: bold !important;
|
||||||
color: #000 !important; // 添加黑色字体
|
color: #000 !important; // 添加黑色字体
|
||||||
|
@ -51,10 +51,11 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 广告部分 -->
|
<!-- 广告部分 -->
|
||||||
<view class="banner-container flex justify-center align-center" style="height: 250rpx;">
|
<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 class="" style=" width: 95%; height: 85%; border-radius: 26px; background-color: lightgray;">
|
||||||
</view>
|
</view> -->
|
||||||
<!-- <image :src="shopAd" mode="aspectFill" class="shop-banner image_3" style="background-color:lightgray;"></image> -->
|
<!-- {{ ads.list[0].image }} -->
|
||||||
|
<image :src="ads.list[0].image" mode="aspectFill" class="shop-banner" style="background-color:lightgray; border-radius: 2ch;"></image>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
@ -162,7 +163,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<scroll-view class="modal-body" scroll-y>
|
<scroll-view class="modal-body" scroll-y>
|
||||||
<view v-if="good.image" class="modal-image">
|
<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>
|
||||||
|
|
||||||
<view class="modal-content">
|
<view class="modal-content">
|
||||||
@ -1053,7 +1055,7 @@
|
|||||||
rgba(243, 203, 90, 1) 100%);
|
rgba(243, 203, 90, 1) 100%);
|
||||||
color: #000;
|
color: #000;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 28rpx;
|
font-size: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-category.current:before {
|
.menu-category.current:before {
|
||||||
@ -1276,6 +1278,7 @@
|
|||||||
.modal-image {
|
.modal-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 400rpx;
|
height: 400rpx;
|
||||||
|
padding: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-image image {
|
.modal-image image {
|
||||||
|
@ -179,10 +179,11 @@ onReachBottom(() => {
|
|||||||
|
|
||||||
// tab栏切换
|
// tab栏切换
|
||||||
const change = (e) => {
|
const change = (e) => {
|
||||||
//console.log('e;',e.type)
|
console.log('e;',e.type)
|
||||||
//console.log('e.index;',e.index)
|
console.log('e.index;',e.index)
|
||||||
type.value = e.type;
|
type.value = e.type;
|
||||||
getOrders(true);
|
getOrders(true);
|
||||||
|
current.value = e.index;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getOrders = async (isRefresh = false) => {
|
const getOrders = async (isRefresh = false) => {
|
||||||
@ -425,7 +426,7 @@ const receive = async (order) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.text_9 {
|
.text_9 {
|
||||||
width: 12rpx;
|
width: 2rpx;
|
||||||
height: 39rpx;
|
height: 39rpx;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
color: rgba(0, 0, 0, 1);
|
color: rgba(0, 0, 0, 1);
|
||||||
@ -434,7 +435,7 @@ const receive = async (order) => {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
line-height: 194rpx;
|
/* line-height: 194rpx; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.text_10 {
|
.text_10 {
|
||||||
@ -462,8 +463,8 @@ const receive = async (order) => {
|
|||||||
.text-wrapper_6 {
|
.text-wrapper_6 {
|
||||||
background-color: rgba(82, 172, 65, 1);
|
background-color: rgba(82, 172, 65, 1);
|
||||||
border-radius: 25px;
|
border-radius: 25px;
|
||||||
height: 50rpx;
|
height: 54rpx;
|
||||||
width: 128rpx;
|
width: 138rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -485,13 +486,14 @@ const receive = async (order) => {
|
|||||||
width: auto;
|
width: auto;
|
||||||
height: 34rpx;
|
height: 34rpx;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
|
padding: 0 10rpx;
|
||||||
color: rgba(255, 255, 255, 1);
|
color: rgba(255, 255, 255, 1);
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-family: PingFang SC-Medium;
|
font-family: PingFang SC-Medium;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
line-height: 24rpx;
|
/* line-height: 24rpx; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-goods {
|
.order-goods {
|
||||||
|
151
store/store.js
151
store/store.js
@ -1,84 +1,74 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
|
|
||||||
import cookie from '@/utils/cookie'
|
import cookie from '@/utils/cookie'
|
||||||
import { navigateTo } from '@/utils/router'
|
import { navigateTo } from '@/utils/router'
|
||||||
|
|
||||||
export const useMainStore = defineStore('main', {
|
export const useMainStore = defineStore('main', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
store: {},
|
store: {},
|
||||||
cart: [],
|
cart: [],
|
||||||
orderType: 'takein',
|
orderType: 'takein',
|
||||||
address: {},
|
address: {},
|
||||||
addresses: {},
|
addresses: {},
|
||||||
member: {
|
member: {},
|
||||||
|
openid: "",
|
||||||
},
|
token: "",
|
||||||
openid:"",
|
lang: 'zh-cn',
|
||||||
token:"",
|
cookieKey: 'YSESSID=yshop-e4dk4o2utr3c0n95tp42p745ai',
|
||||||
lang: 'zh-cn',
|
location: {},
|
||||||
cookieKey:'YSESSID=yshop-e4dk4o2utr3c0n95tp42p745ai',
|
mycoupon: {}
|
||||||
// 默认地为你为北京地址
|
|
||||||
location: {},
|
|
||||||
mycoupon: {}
|
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
|
isLogin(state) {
|
||||||
isLogin(state) {//是否登录
|
|
||||||
return Object.keys(state.member).length > 0
|
return Object.keys(state.member).length > 0
|
||||||
//return cookie.get('accessToken') ? true : false
|
|
||||||
}
|
}
|
||||||
//isLogin: state => Object.keys(state.member).length > 0 //是否登录
|
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
DEL_COUPON() {
|
DEL_COUPON() {
|
||||||
this.mycoupon = {}
|
this.mycoupon = {}
|
||||||
},
|
},
|
||||||
SET_COUPON(coupon) {
|
SET_COUPON(coupon) {
|
||||||
this.mycoupon = coupon
|
this.mycoupon = coupon
|
||||||
},
|
},
|
||||||
SET_ORDER_TYPE(type) {
|
SET_ORDER_TYPE(type) {
|
||||||
this.orderType = type
|
this.orderType = type
|
||||||
},
|
},
|
||||||
SET_MEMBER(member) {
|
SET_MEMBER(member) {
|
||||||
this.member = member
|
this.member = member
|
||||||
cookie.set('userinfo', member)
|
cookie.set('userinfo', member)
|
||||||
},
|
},
|
||||||
SET_ADDRESS(address) {
|
SET_ADDRESS(address) {
|
||||||
this.address = address
|
this.address = address
|
||||||
},
|
},
|
||||||
SET_ADDRESSES(addresses) {
|
SET_ADDRESSES(addresses) {
|
||||||
this.addresses = addresses
|
this.addresses = addresses
|
||||||
},
|
},
|
||||||
SET_STORE(store) {
|
SET_STORE(store) {
|
||||||
this.store = store
|
this.store = store
|
||||||
},
|
},
|
||||||
SET_CART(cart) {
|
SET_CART(cart) {
|
||||||
this.cart = cart
|
this.cart = cart
|
||||||
},
|
},
|
||||||
REMOVE_CART(state) {
|
REMOVE_CART() {
|
||||||
this.cart = []
|
this.cart = []
|
||||||
},
|
},
|
||||||
setCookie(state, provider) {
|
setCookie(provider) {
|
||||||
state.cookie = provider;
|
uni.setStorage({
|
||||||
uni.setStorage({
|
key: 'cookieKey',
|
||||||
key: 'cookieKey',
|
data: provider
|
||||||
data: provider
|
});
|
||||||
});
|
},
|
||||||
},
|
SET_LOCATION(location) {
|
||||||
SET_LOCATION(location) {
|
this.location = location;
|
||||||
this.location = location;
|
},
|
||||||
},
|
SET_OPENID(openid) {
|
||||||
SET_OPENID(openid) {
|
this.openid = openid;
|
||||||
this.openid = openid;
|
},
|
||||||
},
|
SET_TOKEN(token) {
|
||||||
SET_TOKEN(token) {
|
this.token = token;
|
||||||
this.token = token;
|
cookie.set('accessToken', token)
|
||||||
cookie.set('accessToken', token)
|
},
|
||||||
},
|
|
||||||
|
|
||||||
setAccessToken(user) {
|
setAccessToken(user) {
|
||||||
cookie.set('accessToken', user)
|
cookie.set('accessToken', user)
|
||||||
// return getUserInfo()
|
|
||||||
},
|
},
|
||||||
setSelectAddress(id) {
|
setSelectAddress(id) {
|
||||||
console.log('--> % setSelectAddress % id:\n', id)
|
console.log('--> % setSelectAddress % id:\n', id)
|
||||||
@ -87,16 +77,31 @@ export const useMainStore = defineStore('main', {
|
|||||||
init() {
|
init() {
|
||||||
let accessToken = cookie.get('accessToken')
|
let accessToken = cookie.get('accessToken')
|
||||||
if (accessToken) {
|
if (accessToken) {
|
||||||
//return getUserInfo()
|
// 这里可以添加获取用户信息等逻辑
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
},
|
},
|
||||||
logout() {
|
logout() {
|
||||||
this.user = null
|
this.member = {}
|
||||||
this.address = []
|
this.address = {}
|
||||||
this.areaList = []
|
this.addresses = {}
|
||||||
this.selectAddress = null
|
|
||||||
navigateTo('/pages/login/login')
|
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