我的全部订单,待发货-待评价-评价晒单 优惠券列表

pull/23/head
落日晚风 2023-12-06 17:56:46 +08:00
parent 648b1a6351
commit 16a4fd21b1
9 changed files with 892 additions and 780 deletions

View File

@ -2,93 +2,73 @@
<template>
<s-layout title="优惠券" :bgStyle="{ color: '#f2f2f2' }">
<su-sticky bgColor="#fff">
<su-tabs
:list="tabMaps"
:scrollable="false"
@change="onTabsChange"
:current="state.currentTab"
></su-tabs>
<su-tabs :list="tabMaps" :scrollable="false" @change="onTabsChange" :current="state.currentTab"></su-tabs>
</su-sticky>
<s-empty
v-if="state.pagination.total === 0"
icon="/static/coupon-empty.png"
text="暂无优惠券"
></s-empty>
<s-empty v-if="state.pagination.total === 0" icon="/static/coupon-empty.png" text="暂无优惠券"></s-empty>
<template v-if="state.currentTab == '0'">
<view v-for="item in state.pagination.data" :key="item.id">
<s-coupon-list
:data="item"
@tap="
<view v-for="item in state.pagination.list" :key="item.id">
<s-coupon-list :data="item">
<!-- @tap="
sheep.$router.go('/pages/coupon/detail', {
id: item.id,
})
"
>
" -->
<template #default>
<button
class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center"
:class="item.get_status != 'can_get' ? 'border-btn' : ''"
@click.stop="getBuy(item.id)"
:disabled="item.get_status != 'can_get'"
>
{{ item.get_status_text }}
<button class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center"
:class="item.get_status != 'can_get' ? 'border-btn' : ''" @click.stop="getBuy(item.id)"
:disabled="item.get_status != 'can_get'">
<!-- {{ item.status_text }} -->
{{item.status_text|| '立即使用' }}
</button>
</template>
</s-coupon-list>
</view>
</template>
<template v-else>
<view v-for="item in state.pagination.data" :key="item.id">
<s-coupon-list
:data="item"
type="user"
@tap="
<view v-for="item in state.pagination.list" :key="item.id">
<s-coupon-list :data="item" type="user">
<!-- @tap="
sheep.$router.go('/pages/coupon/detail', {
id: item.coupon_id,
user_coupon_id: item.id,
id: item.id,
})
"
>
" -->
<template #default>
<button
class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center"
:class="
<button class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center" :class="
item.status == 'can_get' || item.status == 'can_use'
? ''
: item.status == 'used' || item.status == 'expired'
? 'disabled-btn'
: 'border-btn'
"
:disabled="item.status != 'can_get' && item.status != 'can_use'"
@click.stop="
" :disabled="item.status != 'can_get' && item.status != 'can_use'" @click.stop="
sheep.$router.go('/pages/coupon/detail', {
id: item.coupon_id,
user_coupon_id: item.id,
})
"
>
{{ item.status_text }}
">
<!-- {{ item.status_text }} -->
{{item.status_text|| '立即使用' }}
</button>
</template>
</s-coupon-list>
</view>
</template>
<uni-load-more
v-if="state.pagination.total > 0"
:status="state.loadStatus"
:content-text="{
<!-- <uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
contentdown: '上拉加载更多',
}"
@tap="loadmore"
/>
}" @tap="loadmore" /> -->
</s-layout>
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
import {
onLoad,
onReachBottom
} from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
import _ from 'lodash';
const pagination = {
@ -107,40 +87,44 @@
last_page: 1,
},
loadStatus: '',
type: '',
type: '1',
});
const tabMaps = [
{
name: '领券中心',
value: 'all',
},
// {
// name: '',
// value: 'all',
// },
{
name: '已领取',
value: 'geted',
value: '1',
},
{
name: '已使用',
value: 'used',
value: '2',
},
{
name: '已失效',
value: 'expired',
value: '3',
},
];
function onTabsChange(e) {
state.pagination = pagination
state.currentTab = e.index;
state.type = e.value;
if (state.currentTab == 0) {
getData();
} else {
// if (state.currentTab == 0) {
// getData();
// } else {
getCoupon();
}
// }
}
async function getData(page = 1, list_rows = 5) {
state.loadStatus = 'loading';
const res = await sheep.$api.coupon.list({ list_rows, page });
const res = await sheep.$api.coupon.list({
list_rows,
page
});
if (res.error === 0) {
let couponlist = _.concat(state.pagination.data, res.data.data);
state.pagination = {
@ -158,29 +142,51 @@
async function getCoupon(page = 1, list_rows = 5) {
state.loadStatus = 'loading';
let res = await sheep.$api.coupon.userCoupon({
type: state.type,
list_rows,
page,
status: state.type,
pageSize: list_rows,
pageNo: page
});
if (res.code === 0) {
//
let obj = {
1: '可用',
2: '已用',
3: '过期'
}
res.data.list = res.data.list.map(item => {
return {
...item,
enough: (item.usePrice / 100).toFixed(2),
amount: (item.discountPrice / 100).toFixed(2),
use_start_time: sheep.$helper.timeFormat(item.validStartTime, 'yyyy-mm-dd hh:MM:ss'),
use_end_time: sheep.$helper.timeFormat(item.validEndTime, 'yyyy-mm-dd hh:MM:ss'),
status_text: obj[item.status]
}
});
if (res.error === 0) {
if (page >= 2) {
let couponlist = _.concat(state.pagination.data, res.data.data);
let couponlist = _.concat(state.pagination.data, res.data.list);
state.pagination = {
...res.data,
data: couponlist,
};
console.log(state.pagination, '拿到的优惠券数据');
} else {
state.pagination = res.data;
console.log(state.pagination, '拿到的优惠券数据');
}
if (state.pagination.current_page < state.pagination.last_page) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
}
// if (state.pagination.current_page < state.pagination.last_page) {
// state.loadStatus = 'more';
// } else {
// state.loadStatus = 'noMore';
// }
}
}
async function getBuy(id) {
const { error, msg } = await sheep.$api.coupon.get(id);
const {
error,
msg
} = await sheep.$api.coupon.get(id);
if (error === 0) {
uni.showToast({
title: msg,
@ -203,17 +209,28 @@
}
}
onLoad((Option) => {
if (Option.type === 'all' || !Option.type) {
getData();
// if (Option.type === 'all' || !Option.type) {
// getData();
// } else {
// state.type = Option.type;
// Option.type === 'geted' ?
// () :
// Option.type === 'used' ?
// (state.currentTab = 1 && state.type = 2) :
// (state.currentTab = 2 && state.type = 3);
if (Option.type == 'geted') {
state.currentTab = 0
state.type = 1
} else if (Option.type == 'used') {
state.currentTab = 1
state.type = 2
} else {
state.type = Option.type;
Option.type === 'geted'
? (state.currentTab = 1)
: Option.type === 'used'
? (state.currentTab = 2)
: (state.currentTab = 3);
getCoupon();
state.currentTab = 2
state.type = 3
}
getCoupon();
// }
});
onReachBottom(() => {
loadmore();
@ -230,10 +247,12 @@
font-size: 24rpx;
font-weight: 400;
}
.border-btn {
background: linear-gradient(90deg, var(--ui-BG-Main-opacity-4), var(--ui-BG-Main-light));
color: #fff !important;
}
.disabled-btn {
background: #cccccc;
background-color: #cccccc !important;

View File

@ -6,42 +6,35 @@
<view v-if="item.btns.includes('comment')">
<view class="commont-from-wrap">
<!-- 评价商品 -->
<s-goods-item
:img="item.goods_image"
:title="item.goods_title"
:skuText="item.goods_sku_text"
:price="item.goods_price"
:num="item.goods_num"
></s-goods-item>
<s-goods-item :img="item.goods_image" :title="item.goods_title" :skuText="item.goods_sku_text"
:price="item.goods_price" :num="item.goods_num"></s-goods-item>
</view>
<view class="form-item">
<!-- 评分 -->
<view class="star-box ss-flex ss-col-center">
<view class="star-title ss-m-r-40">
{{ rateMap[state.commentList[index].level] }}
<!-- {{ rateMap[state.commentList[index].level] }} -->
商品质量
</view>
<uni-rate v-model="state.commentList[index].level" />
</view>
<view class="star-box ss-flex ss-col-center">
<view class="star-title ss-m-r-40">
<!-- {{ rateMap[state.commentList[index].level] }} -->
服务态度
</view>
<uni-rate v-model="state.commentList[index].level2" />
</view>
<!-- 评价 -->
<view class="area-box">
<uni-easyinput
:inputBorder="false"
type="textarea"
maxlength="120"
autoHeight
<uni-easyinput :inputBorder="false" type="textarea" maxlength="120" autoHeight
v-model="state.commentList[index].content"
placeholder="宝贝满足你的期待吗?说说你的使用心得,分享给想买的他们吧~"
></uni-easyinput>
placeholder="宝贝满足你的期待吗?说说你的使用心得,分享给想买的他们吧~"></uni-easyinput>
<view class="img-box">
<s-uploader
v-model:url="state.commentList[index].images"
fileMediatype="image"
limit="9"
mode="grid"
:imageStyles="{ width: '168rpx', height: '168rpx' }"
/>
<s-uploader v-model:url="state.commentList[index].images" fileMediatype="image"
limit="9" mode="grid" :imageStyles="{ width: '168rpx', height: '168rpx' }" />
</view>
</view>
</view>
@ -61,12 +54,18 @@
<script setup>
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
import {
onLoad
} from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
const state = reactive({
orderInfo: {},
commentList: [],
orderId: null
});
const rateMap = {
@ -78,10 +77,21 @@
};
async function onSubmit() {
const { error } = await sheep.$api.order.comment(state.orderInfo.id, {
comments: state.commentList,
});
if (error === 0) {
//
// console.log(state.orderInfo);
// return;
let obj = {
anonymous: false,
benefitScores: state.commentList[0].level2,
content: state.commentList[0].content,
descriptionScores: state.commentList[0].level,
orderItemId: state.commentList[0].item_id,
picUrls: 'https://t7.baidu.com/it/u=2531125946,3055766435&fm=193&f=GIF'
}
const {
code
} = await sheep.$api.order.comment(obj);
if (code === 0) {
sheep.$router.back();
}
}
@ -94,11 +104,48 @@
if (options.id) {
id = options.id;
}
if (options.orderId) {
state.orderId = options.orderId
}
const { data, error } = await sheep.$api.order.detail(id);
if (error === 0) {
if (data.btns.includes('comment')) {
state.orderInfo = data;
const res = await sheep.$api.order.detail(id);
if (res.code === 0) {
let obj = {
10: ['待发货', '等待买家付款', ["apply_refund"]],
30: ['待评价', '等待买家评价', ["express", "comment"]]
}
res.data.status_text = obj[res.data.status][0];
res.data.status_desc = obj[res.data.status][1];
res.data.btns = obj[res.data.status][2];
res.data.address = {
province_name: res.data.receiverAreaName.split(' ')[0],
district_name: res.data.receiverAreaName.split(' ')[2],
city_name: res.data.receiverAreaName.split(' ')[1],
address: res.data.receiverDetailAddress,
consignee: res.data.receiverName,
mobile: res.data.receiverMobile,
}
res.data.pay_fee = res.data.payPrice / 100
res.data.create_time = sheep.$helper.timeFormat(res.data.createTime, 'yyyy-mm-dd hh:MM:ss')
res.data.order_sn = res.data.no
res.data.id = res.data.id
res.data.goods_amount = res.data.totalPrice / 100
res.data.dispatch_amount = res.data.deliveryPrice / 100
res.data.pay_types_text = res.data.payChannelName.split(',')
res.data.items = res.data.items.map(ite => {
return {
...ite,
btns: obj[res.data.status][2],
goods_title: ite.spuName,
goods_num: ite.count,
goods_price: ite.price / 100,
goods_image: ite.picUrl,
goods_sku_text: ite.properties.reduce((it0, it1) => it0 + it1.valueName + ' ', '')
}
})
if (res.data.btns.includes('comment')) {
state.orderInfo = res.data;
state.orderInfo.items.forEach((item) => {
if (item.btns.includes('comment')) {
state.commentList.push({
@ -109,6 +156,7 @@
});
}
});
console.log(state.orderInfo.items, '循环')
return;
}
}
@ -127,14 +175,17 @@
//
.form-item {
background: #fff;
.star-box {
height: 100rpx;
padding: 0 25rpx;
}
.star-title {
font-weight: 600;
}
}
.area-box {
width: 690rpx;
min-height: 306rpx;
@ -147,6 +198,7 @@
margin-top: 20rpx;
}
}
.post-btn {
width: 690rpx;
line-height: 80rpx;

View File

@ -200,7 +200,7 @@
<button class="ss-reset-button cancel-btn" v-if="state.orderInfo.btns?.includes('confirm')"
@tap="onConfirm(state.orderInfo.id)">确认收货</button>
<button class="ss-reset-button cancel-btn" v-if="state.orderInfo.btns?.includes('comment')"
@tap="onComment(state.orderInfo.order_sn)">评价晒单</button>
@tap="onComment(state.orderInfo.id,state.orderInfo)">评价晒单</button>
<button v-if="state.orderInfo.btns?.includes('invoice')" class="ss-reset-button cancel-btn"
@tap.stop="onOrderInvoice(state.orderInfo.invoice?.id)">
查看发票
@ -389,12 +389,15 @@
}
//
function onComment(orderSN) {
function onComment(orderSN, orderId) {
console.log(orderId);
// return;
uni.$once('SELECT_INVOICE', (e) => {
state.invoiceInfo = e.invoiceInfo;
});
sheep.$router.go('/pages/goods/comment/add', {
orderSN,
orderId
});
}
async function getOrderDetail(id) {
@ -410,7 +413,8 @@
console.log(res, '我的订单详情数据');
if (res.code === 0) {
let obj = {
10: ['待发货', '等待买家付款', ["apply_refund"]]
10: ['待发货', '等待买家付款', ["apply_refund"]],
30: ['待评价', '等待买家评价', ["express", "comment"]]
}
res.data.status_text = obj[res.data.status][0];
res.data.status_desc = obj[res.data.status][1];

View File

@ -20,7 +20,7 @@
<su-sticky>
<!-- 统计 -->
<view class="filter-box ss-p-x-30 ss-flex ss-col-center ss-row-between">
<!-- <uni-datetime-picker v-model="state.data" type="daterange" @change="onChangeTime" :end="state.today">
<!-- <uni-datetime-picker v-model="state.data" type="daterange" @change="onChangeTime" :end="state.today">
<button class="ss-reset-button date-btn">
<text>{{ dateFilterText }}</text>
<text class="cicon-drop-down ss-seldate-icon"></text>
@ -29,8 +29,8 @@
<view class="total-box">
<!-- state.pagination.income.toFixed(2) -->
<view class="ss-m-b-10">总收入{{ }}</view>
<view>总支出{{ }}</view>
<!-- <view class="ss-m-b-10">总收入{{ }}</view>
<view>总支出{{ }}</view> -->
<!-- (-state.pagination.expense).toFixed(2) -->
</view>
</view>
@ -45,7 +45,8 @@
<!-- <text class="title ss-line-1">{{ item.event_text }}{{ item.memo ? '-' + item.memo : '' }}</text> -->
<text class="title ss-line-1">{{ item.title }}</text>
<view class="money">
<text v-if="(item.amount >= 0||item.price>=0)" class="add">+{{ item.amount||item.price }}</text>
<text v-if="(item.amount >= 0||item.price>=0)"
class="add">+{{ item.amount||item.price }}</text>
<text v-else class="minus">{{ item.price }}</text>
</view>
</view>
@ -133,7 +134,7 @@
income: res.data.income,
expense: res.data.expense,
};
console.log('交易数据',state.pagination)
console.log('交易数据', state.pagination)
if (state.pagination.current_page < state.pagination.last_page) {
state.loadStatus = 'more';
} else {

View File

@ -1,4 +1,5 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
// 我的拼团
@ -12,11 +13,17 @@ export default {
},
}),
userCoupon: (params) =>
request({
url: 'user/coupon',
request2({
url: 'promotion/coupon/page',
method: 'GET',
params,
}),
// userCoupon: (params) =>
// request({
// url: 'user/coupon',
// method: 'GET',
// params,
// }),
detail: (id, user_coupon_id) =>
request({
url: 'coupon/' + id,

View File

@ -107,12 +107,18 @@ export default {
method: 'PUT',
}),
// 评价订单
comment: (id, data) =>
request({
url: 'order/order/comment/' + id,
comment: (data) =>
request2({
url: 'trade/order/item/create-comment',
method: 'POST',
data,
}),
// comment: (id, data) =>
// request({
// url: 'order/order/comment/' + id,
// method: 'POST',
// data,
// }),
// 申请退款
applyRefund: (id) =>
request({

View File

@ -1,12 +1,8 @@
<template>
<view class="ss-coupon-menu-wrap ss-flex ss-col-center">
<view
class="menu-item ss-flex-col ss-row-center ss-col-center"
v-for="item in props.list"
:key="item.title"
<view class="menu-item ss-flex-col ss-row-center ss-col-center" v-for="item in props.list" :key="item.title"
@tap="sheep.$router.go(item.path, { type: item.type })"
:class="item.type === 'all' ? 'menu-wallet' : 'ss-flex-1'"
>
:class="item.type === 'all' ? 'menu-wallet' : 'ss-flex-1'">
<image class="item-icon" :src="sheep.$url.static(item.icon)" mode="aspectFit"></image>
<view class="menu-title ss-m-t-28">{{ item.title }}</view>
</view>
@ -23,9 +19,8 @@
const props = defineProps({
list: {
type: Array,
default() {
return [
{
default () {
return [{
title: '已领取',
value: '0',
icon: '/static/img/shop/order/nouse_coupon.png',
@ -46,13 +41,13 @@
path: '/pages/coupon/list',
type: 'expired',
},
{
title: '领券中心',
value: '0',
icon: '/static/img/shop/order/all_coupon.png',
path: '/pages/coupon/list',
type: 'all',
},
// {
// title: '',
// value: '0',
// icon: '/static/img/shop/order/all_coupon.png',
// path: '/pages/coupon/list',
// type: 'all',
// },
];
},
},
@ -63,16 +58,19 @@
.ss-coupon-menu-wrap {
.menu-item {
height: 160rpx;
.menu-title {
font-size: 24rpx;
line-height: 24rpx;
color: #333333;
}
.item-icon {
width: 44rpx;
height: 44rpx;
}
}
.menu-wallet {
width: 144rpx;
}

View File

@ -1,47 +1,37 @@
<template>
<view class="ss-m-20" :style="{ opacity: disabled ? '0.5' : '1' }">
<view class="content">
<view
<!-- <view
class="tag ss-flex ss-row-center"
:class="
data.status == 'expired' || data.status == 'used' ? 'disabled-bg-color' : 'info-bg-color'
"
>{{ data.type_text }}</view
>
> -->
<view class="title ss-m-x-30 ss-p-t-18">
<view class="ss-flex ss-row-between">
<view
class="value-text ss-flex-1 ss-m-r-10"
:class="
<view class="value-text ss-flex-1 ss-m-r-10" :class="
data.status == 'expired' || data.status == 'used' ? 'disabled-color' : 'info-color'
"
>{{ data.name }}</view
>
">{{ data.name }}</view>
<view>
<view
class="ss-flex ss-col-bottom"
:class="
<view class="ss-flex ss-col-bottom" :class="
data.status != 'expired' && data.status != 'used' ? 'price-text' : 'disabled-color'
"
>
">
<view class="value-reduce ss-m-b-10" v-if="data.type === 'reduce'"></view>
<view class="value-price">{{ data.amount }}</view>
<view class="value-discount ss-m-b-10 ss-m-l-4" v-if="data.type === 'discount'"
></view
>
<view class="value-discount ss-m-b-10 ss-m-l-4" v-if="data.type === 'discount'"></view>
</view>
</view>
</view>
<view class="ss-flex ss-row-between ss-m-t-16">
<view
class="sellby-text"
:class="
<view class="sellby-text" :class="
data.status == 'expired' || data.status == 'used'
? 'disabled-color'
: 'subtitle-color'
"
>
{{
">
{{'有效期:' + data.use_start_time.substring(0, 11) }}
{{ data.use_end_time.substring(0, 11) }}
<!-- {{
type === 'user'
? '有效期:' + data.use_start_time.substring(0, 11)
: '领取时间:' + data.get_start_time.substring(0, 11)
@ -50,17 +40,13 @@
type === 'user'
? data.use_end_time.substring(0, 11)
: data.get_end_time.substring(0, 11)
}}
}} -->
</view>
<view
class="value-enough"
:class="
<view class="value-enough" :class="
data.status == 'expired' || data.status == 'used'
? 'disabled-color'
: 'subtitle-color'
"
>{{ data.enough }}可用</view
>
">{{ data.enough }}可用</view>
</view>
</view>
</view>
@ -83,7 +69,9 @@
</template>
<script setup>
import { reactive } from 'vue';
import {
reactive
} from 'vue';
import sheep from '@/sheep';
const state = reactive({
stateMap: {
@ -112,18 +100,23 @@
.info-bg-color {
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
}
.disabled-bg-color {
background: #999;
}
.info-color {
color: #333;
}
.subtitle-color {
color: #666;
}
.disabled-color {
color: #999;
}
.content {
width: 100%;
background: #fff;
@ -139,31 +132,38 @@
font-size: 24rpx;
border-radius: 20rpx 0 20rpx 0;
}
.title {
padding-bottom: 22rpx;
border-bottom: 2rpx dashed #d3d3d3;
.value-text {
font-size: 32rpx;
font-weight: 600;
}
.sellby-text {
font-size: 24rpx;
font-weight: 400;
}
.value-price {
font-size: 64rpx;
font-weight: 500;
line-height: normal;
font-family: OPPOSANS;
}
.value-reduce {
line-height: normal;
font-size: 32rpx;
}
.value-discount {
line-height: normal;
font-size: 28rpx;
}
.value-enough {
font-size: 24rpx;
font-weight: 400;
@ -171,6 +171,7 @@
}
}
}
.desc {
width: 100%;
background: #fff;
@ -180,12 +181,14 @@
padding: 24rpx 30rpx;
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04);
border-radius: 0 0 20rpx 20rpx;
.desc-title {
font-size: 24rpx;
color: #999;
font-weight: 400;
}
}
.price-text {
color: #ff0000;
}

View File

@ -1,11 +1,19 @@
import { defineStore } from 'pinia';
import {
defineStore
} from 'pinia';
import userApi from '@/sheep/api/user';
import commissionApi from '@/sheep/api/commission';
import $share from '@/sheep/platform/share';
import { isEmpty, cloneDeep, clone } from 'lodash';
import {
isEmpty,
cloneDeep,
clone
} from 'lodash';
import cart from './cart';
import app from './app';
import { showAuthModal } from '@/sheep/hooks/useModal';
import {
showAuthModal
} from '@/sheep/hooks/useModal';
// 默认用户信息
const defaultUserInfo = {
@ -44,13 +52,20 @@ const user = defineStore({
actions: {
// 获取个人信息
async getInfo() {
const { code, data } = await userApi.profile();
const {
code,
data
} = await userApi.profile();
// 为了兼容 获取用户余额 可能还会用到其他参数
const { code:code2, data:data2 } = await userApi.balance();
if (code !== 0||code2!=0) return;
data.money=data2.balance/100;
// 优惠券数量,积分数量 应该在这里
const {
code: code2,
data: data2
} = await userApi.balance();
if (code !== 0 || code2 != 0) return;
data.money = data2.balance / 100;
this.userInfo = data;
console.log(data2, '信息')
return Promise.resolve(data);
},
@ -65,22 +80,29 @@ const user = defineStore({
// 获取订单、优惠券等其他资产信息
async getNumData() {
const { code, data } = await userApi.data();
const {
code,
data
} = await userApi.data();
const data2 = await userApi.data2();
if (code === 0&&data2.code===0) {
console.log('订单数据',data);
this.numData = {order_num:{
noget:data.deliveredCount,
unpaid:data.unpaidCount,
nocomment:data.uncommentedCount,
aftersale:data2.data
}};
if (code === 0 && data2.code === 0) {
console.log('订单数据', data);
this.numData = {
order_num: {
noget: data.deliveredCount,
unpaid: data.unpaidCount,
nocomment: data.uncommentedCount,
aftersale: data2.data
}
};
}
},
// 添加分享记录
async addShareLog(params) {
const { error } = await userApi.addShareLog(params);
const {
error
} = await userApi.addShareLog(params);
if (error === 0) uni.removeStorageSync('shareLog');
},
@ -143,7 +165,9 @@ const user = defineStore({
// 登出
async logout(force = false) {
if (!force) {
const { error } = await userApi.logout();
const {
error
} = await userApi.logout();
if (error === 0) {
this.resetUserData();
}
@ -157,11 +181,9 @@ const user = defineStore({
},
persist: {
enabled: true,
strategies: [
{
strategies: [{
key: 'user-store',
},
],
}, ],
},
});