Merge branch 'vue3_tmp' of https://gitee.com/huizhizao/yudao-mall-uniapp into master-vue3

# Conflicts:
#	pages/index/index.vue
pull/25/head
YunaiV 2023-12-09 11:45:12 +08:00
commit 4854cee7ca
25 changed files with 4404 additions and 4257 deletions

17
App.vue
View File

@ -1,6 +1,12 @@
<script setup>
import { onLaunch, onShow, onError } from '@dcloudio/uni-app';
import { ShoproInit } from './sheep';
import {
onLaunch,
onShow,
onError
} from '@dcloudio/uni-app';
import {
ShoproInit
} from './sheep';
onLaunch(() => {
// 使
@ -18,18 +24,17 @@
// #ifdef APP-PLUS
// urlSchemes
const args = plus.runtime.arguments;
if (args) {
}
if (args) {}
//
uni.getClipboardData({
success: (res) => { },
success: (res) => {},
});
// #endif
// #ifdef MP-WEIXIN
//
console.log(options,'options');
console.log(options, 'options');
// #endif

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

@ -7,26 +7,13 @@
<!-- 骨架屏 -->
<detailSkeleton v-if="state.skeletonLoading" />
<!-- 下架/售罄提醒 -->
<s-empty
v-else-if="state.goodsInfo === null"
text="商品不存在或已下架"
icon="/static/soldout-empty.png"
showAction
actionText="再逛逛"
actionUrl="/pages/goods/list"
/>
<s-empty v-else-if="state.goodsInfo === null" text="商品不存在或已下架" icon="/static/soldout-empty.png" showAction
actionText="再逛逛" actionUrl="/pages/goods/list" />
<block v-else>
<view class="detail-swiper-selector">
<!-- 商品轮播图 -->
<su-swiper
class="ss-m-b-14"
isPreview
:list="state.goodsSwiper"
dotStyle="tag"
imageMode="widthFix"
dotCur="bg-mask-40"
:seizeHeight="750"
/>
<su-swiper class="ss-m-b-14" isPreview :list="state.goodsSwiper" dotStyle="tag" imageMode="widthFix"
dotCur="bg-mask-40" :seizeHeight="750" />
<!-- 价格+标题 -->
<view class="title-card detail-card ss-p-y-40 ss-p-x-20">
@ -46,22 +33,15 @@
<view class="discounts-box ss-flex ss-row-between ss-m-b-28">
<div class="tag-content">
<view class="tag-box ss-flex">
<view
class="tag ss-m-r-10"
v-for="promos in state.goodsInfo.promos"
:key="promos.id"
@tap="onActivity"
>
<view class="tag ss-m-r-10" v-for="promos in state.goodsInfo.promos"
:key="promos.id" @tap="onActivity">
{{ promos.title }}
</view>
</view>
</div>
<view
class="get-coupon-box ss-flex ss-col-center ss-m-l-20"
@tap="state.showModel = true"
v-if="state.couponInfo.length"
>
<view class="get-coupon-box ss-flex ss-col-center ss-m-l-20" @tap="state.showModel = true"
v-if="state.couponInfo.length">
<view class="discounts-title ss-m-r-8">领券</view>
<text class="cicon-forward"></text>
</view>
@ -72,24 +52,15 @@
<!-- 功能卡片 -->
<view class="detail-cell-card detail-card ss-flex-col">
<detail-cell-sku
v-model="state.selectedSkuPrice.goods_sku_text"
:skus="state.goodsInfo.skus"
@tap="state.showSelectSku = true"
/>
<detail-cell-sku v-model="state.selectedSkuPrice.goods_sku_text" :skus="state.goodsInfo.skus"
@tap="state.showSelectSku = true" />
<detail-cell-service v-if="state.goodsInfo.service" v-model="state.goodsInfo.service" />
<detail-cell-params v-if="state.goodsInfo.params" v-model="state.goodsInfo.params" />
</view>
<!-- 规格与数量弹框 -->
<s-select-sku
:goodsInfo="state.goodsInfo"
:show="state.showSelectSku"
@addCart="onAddCart"
@buy="onBuy"
@change="onSkuChange"
@close="state.showSelectSku = false"
/>
<s-select-sku :goodsInfo="state.goodsInfo" :show="state.showSelectSku" @addCart="onAddCart"
@buy="onBuy" @change="onSkuChange" @close="state.showSelectSku = false" />
</view>
<!-- 评价 -->
@ -98,25 +69,16 @@
<detail-content-card class="detail-content-selector" :content="state.goodsInfo.description" />
<!-- 活动跳转 -->
<detail-activity-tip
v-if="state.goodsInfo.activities"
:data="state.goodsInfo"
></detail-activity-tip>
<detail-activity-tip v-if="state.goodsInfo.activities" :data="state.goodsInfo"></detail-activity-tip>
<!-- 详情tabbar -->
<detail-tabbar v-model="state.goodsInfo">
<!-- TODO: 缺货中 已售罄 判断 设计-->
<view class="buy-box ss-flex ss-col-center ss-p-r-20" v-if="state.goodsInfo.stock > 0">
<button
class="ss-reset-button add-btn ui-Shadow-Main"
@tap="state.showSelectSku = true"
>
<button class="ss-reset-button add-btn ui-Shadow-Main" @tap="state.showSelectSku = true">
加入购物车
</button>
<button
class="ss-reset-button buy-btn ui-Shadow-Main"
@tap="state.showSelectSku = true"
>
<button class="ss-reset-button buy-btn ui-Shadow-Main" @tap="state.showSelectSku = true">
立即购买
</button>
</view>
@ -124,27 +86,30 @@
<button class="ss-reset-button disabled-btn" disabled> 已售罄 </button>
</view>
</detail-tabbar>
<s-coupon-get
v-model="state.couponInfo"
:show="state.showModel"
@close="state.showModel = false"
@get="onGet"
/>
<s-activity-pop
v-model="state.activityInfo"
:show="state.showActivityModel"
@close="state.showActivityModel = false"
/>
<s-coupon-get v-model="state.couponInfo" :show="state.showModel" @close="state.showModel = false"
@get="onGet" />
<s-activity-pop v-model="state.activityInfo" :show="state.showActivityModel"
@close="state.showActivityModel = false" />
</block>
</s-layout>
</view>
</template>
<script setup>
import { reactive, computed } from 'vue';
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
import {
reactive,
computed
} from 'vue';
import {
onLoad,
onPageScroll
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import { formatSales, formatGoodsSwiper, formatPrice } from '@/sheep/hooks/useGoods';
import {
formatSales,
formatGoodsSwiper,
formatPrice
} from '@/sheep/hooks/useGoods';
import detailNavbar from './components/detail/detail-navbar.vue';
import detailCellSku from './components/detail/detail-cell-sku.vue';
import detailCellService from './components/detail/detail-cell-service.vue';
@ -154,7 +119,9 @@
import detailCommentCard from './components/detail/detail-comment-card.vue';
import detailContentCard from './components/detail/detail-content-card.vue';
import detailActivityTip from './components/detail/detail-activity-tip.vue';
import { isEmpty } from 'lodash';
import {
isEmpty
} from 'lodash';
// import detailActivityTip from './components/detail/detail-activity-tip.vue';
// import detailTab from './components/detail/detail-tab.vue';
@ -190,13 +157,11 @@
sheep.$router.go('/pages/order/confirm', {
data: JSON.stringify({
order_type: 'goods',
goods_list: [
{
goods_list: [{
goods_id: e.goods_id,
goods_num: e.goods_num,
goods_sku_price_id: e.id,
},
],
}, ],
}),
});
}
@ -208,7 +173,10 @@
//
async function onGet(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,
@ -221,8 +189,7 @@
const shareInfo = computed(() => {
if (isEmpty(state.goodsInfo)) return {};
return sheep.$platform.share.getShareInfo(
{
return sheep.$platform.share.getShareInfo({
title: state.goodsInfo.title,
image: sheep.$url.cdn(state.goodsInfo.image),
desc: state.goodsInfo.subtitle,
@ -230,15 +197,13 @@
page: '2',
query: state.goodsInfo.id,
},
},
{
}, {
type: 'goods', //
title: state.goodsInfo.title, //
image: sheep.$url.cdn(state.goodsInfo.image), //
price: state.goodsInfo.price[0], //
original_price: state.goodsInfo.original_price, //
},
);
}, );
});
onLoad(async (options) => {
@ -251,15 +216,25 @@
state.goodsId = options.id;
//
sheep.$api.goods.detail(state.goodsId).then((res) => {
console.log(res)
//
// let arr = [];
// res.skus = res.data.skus.map(item => {
// arr = [...arr, ...item.properties];
// item.children = item.properties;
// item.goods_id = res.data.id;
// item.name = item.children[0].propertyName;
// return item;
// })
// console.log(arr, '');
// console.log(res.data, '');
state.skeletonLoading = false;
if (res.code === 0) {
//
res.data.sales=res.data.salesCount
res.data.original_price=res.data.marketPrice/100
res.data.subtitle=res.data.introduction
res.data.title=res.data.name
res.data.price=[res.data.price/100]
res.data.sales = res.data.salesCount
res.data.original_price = res.data.marketPrice / 100
res.data.subtitle = res.data.introduction
res.data.title = res.data.name
res.data.price = [res.data.price / 100]
state.goodsInfo = res.data;
state.goodsSwiper = formatGoodsSwiper(state.goodsInfo.sliderPicUrls);
} else {
@ -267,7 +242,10 @@
state.goodsInfo = null;
}
});
const { error, data } = await sheep.$api.coupon.listByGoods(state.goodsId);
const {
error,
data
} = await sheep.$api.coupon.listByGoods(state.goodsId);
if (error === 0) {
state.couponInfo = data;
}
@ -323,10 +301,12 @@
min-width: 0;
white-space: nowrap;
}
.tag-box {
overflow: hidden;
text-overflow: ellipsis;
}
.tag {
flex-shrink: 0;
padding: 4rpx 10rpx;
@ -388,6 +368,7 @@
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
color: $white;
}
.disabled-btn {
width: 428rpx;
height: 72rpx;
@ -399,9 +380,11 @@
.model-box {
height: 60vh;
.model-content {
height: 56vh;
}
.title {
font-size: 36rpx;
font-weight: bold;

View File

@ -1,10 +1,6 @@
<template>
<s-layout title="购物车" tabbar="/pages/index/cart" :bgStyle="{ color: '#fff' }">
<s-empty
v-if="state.list.length === 0"
text="购物车空空如也,快去逛逛吧~"
icon="/static/cart-empty.png"
/>
<s-empty v-if="state.list.length === 0" text="购物车空空如也,快去逛逛吧~" icon="/static/cart-empty.png" />
<!-- 头部 -->
<view class="cart-box ss-flex ss-flex-col ss-row-between" v-if="state.list.length">
@ -28,29 +24,16 @@
<view class="goods-box ss-r-10 ss-m-b-14" v-for="item in state.list" :key="item.id">
<view class="ss-flex ss-col-center">
<label class="check-box ss-flex ss-col-center ss-p-l-10" @tap="onSelectSingle(item.id)">
<radio
:checked="state.selectedIds.includes(item.id)"
color="var(--ui-BG-Main)"
style="transform: scale(0.8)"
@tap.stop="onSelectSingle(item.id)"
/>
<radio :checked="state.selectedIds.includes(item.id)" color="var(--ui-BG-Main)"
style="transform: scale(0.8)" @tap.stop="onSelectSingle(item.id)" />
</label>
<s-goods-item
:title="item.spu.name"
:img="item.spu.picUrl || item.goods.image"
<s-goods-item :title="item.spu.name" :img="item.spu.picUrl || item.goods.image"
:price="item.sku.price/100"
:skuText="item.sku.properties.length>1? item.sku.properties.reduce((items2,items)=>items2.valueName+' '+items.valueName):item.sku.properties[0].valueName"
priceColor="#FF3000"
:titleWidth="400"
>
priceColor="#FF3000" :titleWidth="400">
<template v-if="!state.editMode" v-slot:tool>
<su-number-box
:min="0"
:max="item.sku.stock"
:step="1"
v-model="item.count"
@change="onNumberChange($event, item)"
></su-number-box>
<su-number-box :min="0" :max="item.sku.stock" :step="1" v-model="item.count"
@change="onNumberChange($event, item)"></su-number-box>
</template>
</s-goods-item>
</view>
@ -61,12 +44,8 @@
<view class="cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom">
<view class="footer-left ss-flex ss-col-center">
<label class="check-box ss-flex ss-col-center ss-p-r-30" @tap="onSelectAll">
<radio
:checked="state.isAllSelected"
color="var(--ui-BG-Main)"
style="transform: scale(0.8)"
@tap.stop="onSelectAll"
/>
<radio :checked="state.isAllSelected" color="var(--ui-BG-Main)"
style="transform: scale(0.8)" @tap.stop="onSelectAll" />
<view class="ss-m-l-8"> 全选 </view>
</label>
<text>合计</text>
@ -75,18 +54,12 @@
</view>
</view>
<view class="footer-right">
<button
v-if="state.editMode"
class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
@tap="onDelete"
>
<button v-if="state.editMode" class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
@tap="onDelete">
删除
</button>
<button
v-else
class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
@tap="onConfirm"
>
<button v-else class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
@tap="onConfirm">
去结算
{{ state.selectedIds?.length ? `(${state.selectedIds.length})` : '' }}
</button>
@ -99,7 +72,11 @@
<script setup>
import sheep from '@/sheep';
import { computed, reactive, unref } from 'vue';
import {
computed,
reactive,
unref
} from 'vue';
const sys_navBar = sheep.$platform.navbar;
const cart = sheep.$store('cart');
@ -124,24 +101,39 @@
//
function onConfirm() {
let items = []
let goods_list = [];
state.selectedList = state.list.filter((item) => state.selectedIds.includes(item.id));
state.selectedList.map((item) => {
console.log(item, '便利');
//
items.push({
skuId: item.sku.id,
count: item.count,
cartId: item.id,
})
goods_list.push({
goods_id: item.goods_id,
goods_num: item.goods_num,
goods_sku_price_id: item.goods_sku_price_id,
// goods_id: item.goods_id,
goods_id: item.spu.id,
// goods_num: item.goods_num,
goods_num: item.count,
// id
// goods_sku_price_id: item.goods_sku_price_id,
});
});
// return;
if (goods_list.length === 0) {
sheep.$helper.toast('请选择商品');
return;
}
sheep.$router.go('/pages/order/confirm', {
data: JSON.stringify({
order_type: 'goods',
goods_list,
from: 'cart',
// order_type: 'goods',
// goods_list,
items,
// from: 'cart',
deliveryType: 1,
pointStatus: false,
}),
});
}
@ -151,7 +143,7 @@
cart.delete(cartItem.id);
return;
}
if(cartItem.goods_num === e) return;
if (cartItem.goods_num === e) return;
cartItem.goods_num = e;
cart.update({
goods_id: cartItem.id,
@ -199,6 +191,7 @@
.cart-content {
margin-top: 70rpx;
.goods-box {
background-color: #fff;
}

View File

@ -3,134 +3,111 @@
<s-layout title="售后详情" :navbar="!isEmpty(state.info) && state.loading ? 'inner' : 'normal'">
<view class="content_box" v-if="!isEmpty(state.info) && state.loading">
<!-- 步骤条 -->
<view
class="steps-box ss-flex"
:style="[
<!-- 这个没找到替换方案 -->
<view class="steps-box ss-flex" :style="[
{
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
paddingTop: Number(statusBarHeight + 88) + 'rpx',
},
]"
>
]">
<!-- <uni-steps :options="state.list" :active="state.active" active-color="#fff" /> -->
<view class="ss-flex">
<view class="steps-item" v-for="(item, index) in state.list" :key="index">
<view class="ss-flex">
<text
class="sicon-circleclose"
v-if="
<text class="sicon-circleclose" v-if="
(state.list.length - 1 == index && state.info.aftersale_status === -2) ||
(state.list.length - 1 == index && state.info.aftersale_status === -1)
"
></text>
<text
class="sicon-circlecheck"
v-else
:class="state.active >= index ? 'activity-color' : 'info-color'"
></text>
"></text>
<text class="sicon-circlecheck" v-else
:class="state.active >= index ? 'activity-color' : 'info-color'"></text>
<view
v-if="state.list.length - 1 != index"
class="line"
:class="state.active >= index ? 'activity-bg' : 'info-bg'"
></view>
<view v-if="state.list.length - 1 != index" class="line"
:class="state.active >= index ? 'activity-bg' : 'info-bg'"></view>
</view>
<view class="steps-item-title" :class="state.active >= index ? 'activity-color' : 'info-color'">
{{ item.title }}
</view>
<view
class="steps-item-title"
:class="state.active >= index ? 'activity-color' : 'info-color'"
>{{ item.title }}</view
>
</view>
</view>
</view>
<!-- 服务状态 -->
<view
class="status-box ss-flex ss-col-center ss-row-between ss-m-x-20"
@tap="sheep.$router.go('/pages/order/aftersale/log', { id: state.aftersaleId })"
>
<!-- <view class="status-box ss-flex ss-col-center ss-row-between ss-m-x-20"
@tap="sheep.$router.go('/pages/order/aftersale/log', { id: state.aftersaleId })">
<view class="">
<view class="status-text">{{ state.info.aftersale_status_desc }}</view>
<view class="status-time">{{ state.info.update_time }}</view>
</view>
<text class="ss-iconfont _icon-forward" style="color: #666"></text>
</view>
</view> -->
<!-- 退款金额 -->
<view class="aftersale-money ss-flex ss-col-center ss-row-between">
<view class="aftersale-money--title">退款总额</view>
<view class="aftersale-money--num">{{ state.info.refund_fee }}</view>
<view class="aftersale-money--num">{{ state.info.refundPrice/100 }}</view>
</view>
<!-- 服务商品 -->
<view class="order-shop">
<s-goods-item
:title="state.info.goods_title"
:price="state.info.goods_price"
:img="state.info.goods_image"
priceColor="#333333"
:titleWidth="480"
:skuText="state.info.goods_sku_text"
:num="state.info.goods_num"
></s-goods-item>
<!-- <s-goods-item :title="state.info.goods_title" :price="state.info.goods_price"
:img="state.info.goods_image" priceColor="#333333" :titleWidth="480"
:skuText="state.info.goods_sku_text" :num="state.info.goods_num"></s-goods-item> -->
<s-goods-item :img=" state.info.picUrl" :title=" state.info.spuName" priceColor="#333333"
:titleWidth="480" :skuText=" state.info.properties.reduce((a,b)=>a+b.valueName+' ','')"
:price=" state.info.refundPrice/100" :num=" state.info.count"></s-goods-item>
</view>
<!-- 服务内容 -->
<view class="aftersale-content">
<view class="aftersale-item ss-flex ss-col-center">
<view class="item-title">服务单号</view>
<view class="item-content ss-m-r-16">{{ state.info.aftersale_sn }}</view>
<view class="item-content ss-m-r-16">{{ state.info.no }}</view>
<button class="ss-reset-button copy-btn" @tap="onCopy"></button>
</view>
<view class="aftersale-item ss-flex ss-col-center">
<view class="item-title">申请时间</view>
<view class="item-content">{{ state.info.create_time }}</view>
<view class="item-content">
{{ sheep.$helper.timeFormat(state.info.createTime, 'yyyy-mm-dd hh:MM:ss') }}
</view>
</view>
<view class="aftersale-item ss-flex ss-col-center">
<view class="item-title">售后类型</view>
<view class="item-content">{{ state.info.type_text }}</view>
<view class="item-content">{{ status2[state.info.way] }}</view>
</view>
<view class="aftersale-item ss-flex ss-col-center">
<view class="item-title">申请原因</view>
<view class="item-content">{{ state.info.reason }}</view>
<view class="item-content">{{ state.info.applyReason }}</view>
</view>
<view class="aftersale-item ss-flex ss-col-center">
<view class="item-title">相关描述</view>
<view class="item-content">{{ state.info.content }}</view>
<view class="item-content">{{ state.info.applyDescription }}</view>
</view>
</view>
</view>
<s-empty
v-if="isEmpty(state.info) && state.loading"
icon="/static/order-empty.png"
text="暂无该订单售后详情"
/>
<su-fixed bottom placeholder bg="bg-white" v-if="!isEmpty(state.info)">
<s-empty v-if="isEmpty(state.info) && state.loading" icon="/static/order-empty.png" text="暂无该订单售后详情" />
<!-- <su-fixed bottom placeholder bg="bg-white" v-if="!isEmpty(state.info)">
<view class="foot_box">
<button
class="ss-reset-button btn"
v-if="state.info.btns?.includes('cancel')"
@tap="onApply(state.info.id)"
>取消申请</button
>
<!-- <button
class="ss-reset-button btn"
v-if="state.info.btns?.includes('delete')"
@tap="onDelete(state.info.id)"
>删除</button
> -->
<button class="ss-reset-button contcat-btn btn" @tap="sheep.$router.go('/pages/chat/index')"
>联系客服</button
>
<button class="ss-reset-button btn" v-if="state.info.btns?.includes('cancel')"
@tap="onApply(state.info.id)">取消申请</button>
<button class="ss-reset-button btn" v-if="state.info.btns?.includes('delete')"
@tap="onDelete(state.info.id)">删除</button>
<button class="ss-reset-button contcat-btn btn"
@tap="sheep.$router.go('/pages/chat/index')">联系客服</button>
</view>
</su-fixed>
</su-fixed> -->
</s-layout>
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { reactive } from 'vue';
import { isEmpty } from 'lodash';
import {
onLoad
} from '@dcloudio/uni-app';
import {
reactive
} from 'vue';
import {
isEmpty
} from 'lodash';
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
@ -138,8 +115,7 @@
active: 0,
aftersaleId: 0,
info: {},
list: [
{
list: [{
title: '提交申请',
},
{
@ -149,13 +125,20 @@
loading: false,
});
const status2 = {
10: '仅退款',
20: '退货退款'
}
function onApply(orderId) {
uni.showModal({
title: '提示',
content: '确定要取消此申请吗?',
success: async function (res) {
success: async function(res) {
if (res.confirm) {
const { error } = await sheep.$api.order.aftersale.cancel(orderId);
const {
error
} = await sheep.$api.order.aftersale.cancel(orderId);
if (error === 0) {
getDetail(state.aftersaleId);
}
@ -168,9 +151,11 @@
uni.showModal({
title: '提示',
content: '确定要删除吗?',
success: async function (res) {
success: async function(res) {
if (res.confirm) {
const { error } = await sheep.$api.order.aftersale.delete(orderId);
const {
error
} = await sheep.$api.order.aftersale.delete(orderId);
if (error === 0) {
sheep.$router.back();
}
@ -182,15 +167,22 @@
sheep.$helper.copyText(state.info.aftersale_sn);
};
async function getDetail(id) {
const { error, data } = await sheep.$api.order.aftersale.detail(id);
const {
code,
data
} = await sheep.$api.order.aftersale.detail(id);
state.loading = true;
if (error === 0) {
if (code === 0) {
state.info = data;
if (state.info.aftersale_status === -2 || state.info.aftersale_status === -1) {
state.list.push({ title: state.info.aftersale_status_text });
state.list.push({
title: state.info.aftersale_status_text
});
state.active = 2;
} else {
state.list.push({ title: '完成' });
state.list.push({
title: '完成'
});
state.active = state.info.aftersale_status;
}
} else {
@ -218,9 +210,11 @@
font-size: 24rpx;
color: #fff;
}
.sicon-circlecheck {
font-size: 24rpx;
}
.steps-item-title {
font-size: 24rpx;
font-weight: 400;
@ -231,15 +225,19 @@
}
}
}
.activity-color {
color: #fff;
}
.info-color {
color: rgba(#fff, 0.4);
}
.activity-bg {
background: #fff;
}
.info-bg {
background: rgba(#fff, 0.4);
}

View File

@ -3,76 +3,58 @@
<s-layout title="售后列表">
<!-- tab -->
<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/data-empty.png" text="暂无数据">
</s-empty>
<!-- 列表 -->
<view v-if="state.pagination.total > 0">
<view
class="list-box ss-m-y-20"
v-for="order in state.pagination.data"
:key="order.id"
@tap="sheep.$router.go('/pages/order/aftersale/detail', { id: order.id })"
>
<view class="list-box ss-m-y-20" v-for="order in state.pagination.data" :key="order.id"
@tap="sheep.$router.go('/pages/order/aftersale/detail', { id: order.id })">
<view class="order-head ss-flex ss-col-center ss-row-between">
<text class="no">服务单号{{ order.aftersale_sn }}</text>
<text class="state">{{ order.aftersale_status_text }}</text>
<text class="no">服务单号{{ order.no }}</text>
<text class="state">{{ status[order.status] }}</text>
</view>
<s-goods-item
:img="order.goods_image"
:title="order.goods_title"
:skuText="order.goods_sku_text"
:price="order.goods_price"
:num="order.goods_num"
></s-goods-item>
<s-goods-item :img="order.picUrl" :title="order.spuName"
:skuText="order.properties.reduce((a,b)=>a+b.valueName+' ','')" :price="order.refundPrice/100"
:num="order.count"></s-goods-item>
<view class="apply-box ss-flex ss-col-center ss-row-between border-bottom ss-p-x-20">
<view class="ss-flex ss-col-center">
<view class="title ss-m-r-20">{{ order.type_text }}</view>
<view class="value">{{ order.aftersale_status_desc }}</view>
<!-- 此处需修改 -->
<view class="title ss-m-r-20">{{ status2[order.way] }}</view>
<!-- <view class="value">{{ order.aftersale_status_desc }}</view> -->
<view class="value">{{ order.applyReason }}</view>
</view>
<text class="_icon-forward"></text>
</view>
<view class="tool-btn-box ss-flex ss-col-center ss-row-right ss-p-r-20">
<!-- <view class="tool-btn-box ss-flex ss-col-center ss-row-right ss-p-r-20">
<view>
<button
class="ss-reset-button tool-btn"
@tap.stop="onApply(order.id)"
v-if="order.btns.includes('cancel')"
>取消申请</button
>
<button class="ss-reset-button tool-btn" @tap.stop="onApply(order.id)"
v-if="order.btns.includes('cancel')">取消申请</button>
</view>
<view>
<button
class="ss-reset-button tool-btn"
@tap.stop="onDelete(order.id)"
v-if="order.btns.includes('delete')"
>删除</button
>
<button class="ss-reset-button tool-btn" @tap.stop="onDelete(order.id)"
v-if="order.btns.includes('delete')">删除</button>
</view>
</view> -->
</view>
</view>
</view>
</view>
<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 = {
@ -92,28 +74,41 @@
},
loadStatus: '',
});
const tabMaps = [
{
//
const status = {
10: '申请售后',
20: '商品待退货',
30: '商家待收货',
40: '等待退款',
50: '退款成功',
61: '买家取消',
62: '商家拒绝',
63: '商家拒收货'
}
const status2 = {
10: '仅退款',
20: '退货退款'
}
const tabMaps = [{
name: '全部',
value: 'all',
},
{
name: '申请中',
value: 'nooper',
},
{
name: '处理中',
value: 'ing',
},
{
name: '已完成',
value: 'completed',
},
{
name: '已拒绝',
value: 'refuse',
},
// {
// name: '',
// value: 'nooper',
// },
// {
// name: '',
// value: 'ing',
// },
// {
// name: '',
// value: 'completed',
// },
// {
// name: '',
// value: 'refuse',
// },
];
//
function onTabsChange(e) {
@ -124,24 +119,28 @@
//
async function getOrderList(page = 1, list_rows = 5) {
pagination.current_page = page;
state.loadStatus = 'loading';
let res = await sheep.$api.order.aftersale.list({
type: tabMaps[state.currentTab].value,
list_rows,
page,
// type: tabMaps[state.currentTab].value,
pageSize: list_rows,
pageNo: page,
});
if (res.error === 0) {
let orderList = _.concat(state.pagination.data, res.data.data);
console.log(res, '未处理前售后列表数据')
if (res.code === 0) {
let orderList = _.concat(state.pagination.data, res.data.list);
state.pagination = {
total: res.data.total,
...res.data,
data: orderList,
};
if (state.pagination.current_page < state.pagination.last_page) {
console.log(state.pagination, '售后订单数据')
// if (state.pagination.current_page < state.pagination.last_page) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
}
// } else {
// state.loadStatus = 'noMore';
// }
}
}
@ -149,9 +148,11 @@
uni.showModal({
title: '提示',
content: '确定要取消此申请吗?',
success: async function (res) {
success: async function(res) {
if (res.confirm) {
const { error } = await sheep.$api.order.aftersale.cancel(orderId);
const {
error
} = await sheep.$api.order.aftersale.cancel(orderId);
if (error === 0) {
state.pagination = pagination
getOrderList();
@ -165,9 +166,11 @@
uni.showModal({
title: '提示',
content: '确定要删除吗?',
success: async function (res) {
success: async function(res) {
if (res.confirm) {
const { error } = await sheep.$api.order.aftersale.delete(orderId);
const {
error
} = await sheep.$api.order.aftersale.delete(orderId);
if (error === 0) {
state.pagination = pagination
getOrderList();
@ -186,9 +189,9 @@
//
function loadmore() {
if (state.loadStatus !== 'noMore') {
getOrderList(state.pagination.current_page + 1);
}
// if (state.loadStatus !== 'noMore') {
getOrderList(pagination.current_page + 1);
// }
}
//

View File

@ -1,25 +1,17 @@
<template>
<s-layout title="确认订单">
<view
class="bg-white address-box ss-m-b-14 ss-r-b-10"
@tap="onSelectAddress"
v-if="state.orderInfo.need_address === 1"
>
<!-- v-if="state.orderInfo.need_address === 1" -->
<!-- 这个判断先删除 -->
<view class="bg-white address-box ss-m-b-14 ss-r-b-10" @tap="onSelectAddress">
<s-address-item :item="state.addressInfo" :hasBorderBottom="false">
<view class="ss-rest-button"><text class="_icon-forward"></text></view>
</s-address-item>
</view>
<view class="order-card-box ss-m-b-14">
<s-goods-item
v-for="item in state.orderInfo.goods_list"
:key="item.goods_id"
:img="item.current_sku_price.image || item.goods.image"
:title="item.goods.title"
:skuText="item.current_sku_price?.goods_sku_text"
:price="item.current_sku_price.price"
:num="item.goods_num"
marginBottom="10"
>
<s-goods-item v-for="item in state.orderInfo.goods_list" :key="item.goods_id"
:img="item.current_sku_price.image || item.goods.image" :title="item.goods.title"
:skuText="item.current_sku_price?.goods_sku_text" :price="item.current_sku_price.price"
:num="item.goods_num" marginBottom="10">
<template #top>
<view class="order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white">
<view class="item-title">配送方式</view>
@ -33,13 +25,8 @@
<view class="order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10">
<view class="item-title">订单备注</view>
<view class="ss-flex ss-col-center">
<uni-easyinput
maxlength="20"
placeholder="建议留言前先与商家沟通"
v-model="state.orderPayload.remark"
:inputBorder="false"
:clearable="false"
></uni-easyinput>
<uni-easyinput maxlength="20" placeholder="建议留言前先与商家沟通" v-model="state.orderPayload.remark"
:inputBorder="false" :clearable="false"></uni-easyinput>
</view>
</view>
</view>
@ -52,16 +39,11 @@
<text class="item-value ss-m-r-24">{{ state.orderInfo.goods_amount }}</text>
</view>
</view>
<view
class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderPayload.order_type === 'score'"
>
<view class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderPayload.order_type === 'score'">
<view class="item-title">扣除积分</view>
<view class="ss-flex ss-col-center">
<image
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
class="score-img"
></image>
<image :src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="score-img"></image>
<text class="item-value ss-m-r-24">{{ state.orderInfo.score_amount }}</text>
</view>
</view>
@ -71,34 +53,25 @@
<text class="item-value ss-m-r-24">+{{ state.orderInfo.dispatch_amount }}</text>
</view>
</view>
<view
class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderPayload.order_type != 'score'"
>
<view class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderPayload.order_type != 'score'">
<!-- <view v-if="state.orderInfo.coupon_discount_fee > 0" class="order-item ss-flex ss-col-center ss-row-between"> -->
<view class="item-title">优惠券</view>
<view class="ss-flex ss-col-center" @tap="state.showCoupon = true">
<text class="item-value text-red" v-if="state.orderPayload.coupon_id"
>-{{ state.orderInfo.coupon_discount_fee }}</text
>
<text
class="item-value"
:class="state.couponInfo.can_use?.length > 0 ? 'text-red' : 'text-disabled'"
v-else
>{{
<text class="item-value text-red"
v-if="state.orderPayload.coupon_id">-{{ state.orderInfo.coupon_discount_fee }}</text>
<text class="item-value"
:class="state.couponInfo.can_use?.length > 0 ? 'text-red' : 'text-disabled'" v-else>{{
state.couponInfo.can_use?.length > 0
? state.couponInfo.can_use?.length + '张可用'
: '暂无可用优惠券'
}}</text
>
}}</text>
<text class="_icon-forward item-icon"></text>
</view>
</view>
<view
class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderInfo.promo_infos?.length"
>
<view class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderInfo.promo_infos?.length">
<!-- <view v-if="state.orderInfo.promo_discount_fee > 0" class="order-item ss-flex ss-col-center ss-row-between"> -->
<view class="item-title">活动优惠</view>
<view class="ss-flex ss-col-center" @tap="state.showDiscount = true">
@ -113,10 +86,7 @@
<view class="total-num text-red"> {{ state.orderInfo.pay_fee }} </view>
<view class="ss-flex" v-if="state.orderPayload.order_type === 'score'">
<view class="total-num ss-font-30 text-red ss-m-l-4"> + </view>
<image
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
class="score-img"
></image>
<image :src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="score-img"></image>
<view class="total-num ss-font-30 text-red">{{ state.orderInfo.score_amount }}</view>
</view>
</view>
@ -132,18 +102,10 @@
</view>
</view>
<!-- 选择优惠券弹框 -->
<s-coupon-select
v-model="state.couponInfo"
:show="state.showCoupon"
@confirm="onSelectCoupon"
@close="state.showCoupon = false"
/>
<s-coupon-select v-model="state.couponInfo" :show="state.showCoupon" @confirm="onSelectCoupon"
@close="state.showCoupon = false" />
<!-- 满额折扣弹框 -->
<s-discount-list
v-model="state.orderInfo"
:show="state.showDiscount"
@close="state.showDiscount = false"
/>
<s-discount-list v-model="state.orderInfo" :show="state.showDiscount" @close="state.showDiscount = false" />
<!-- 底部 -->
<su-fixed bottom :opacity="false" bg="bg-white" placeholder :noFixed="false" :index="200">
<view class="footer-box border-top ss-flex ss-row-between ss-p-x-20 ss-col-center">
@ -151,18 +113,12 @@
<view class="total-num ss-font-30 text-red"> {{ state.orderInfo.pay_fee }} </view>
<view v-if="state.orderPayload.order_type === 'score'" class="ss-flex">
<view class="total-num ss-font-30 text-red ss-m-l-4">+</view>
<image
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
class="score-img"
></image>
<image :src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="score-img"></image>
<view class="total-num ss-font-30 text-red">{{ state.orderInfo.score_amount }}</view>
</view>
</view>
<button
class="ss-reset-button ui-BG-Main-Gradient ss-r-40 submit-btn ui-Shadow-Main"
@tap="onConfirm"
>
<button class="ss-reset-button ui-BG-Main-Gradient ss-r-40 submit-btn ui-Shadow-Main" @tap="onConfirm">
{{ exchangeNow ? '立即兑换' : '提交订单' }}
</button>
</view>
@ -171,10 +127,19 @@
</template>
<script setup>
import { reactive, computed } from 'vue';
import { onLoad, onPageScroll, onShow } from '@dcloudio/uni-app';
import {
reactive,
computed
} from 'vue';
import {
onLoad,
onPageScroll,
onShow
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import { isEmpty } from 'lodash';
import {
isEmpty
} from 'lodash';
const state = reactive({
orderPayload: {},
@ -203,8 +168,13 @@
// &
async function changeConsignee(addressInfo = {}) {
if (isEmpty(addressInfo)) {
const { error, data } = await sheep.$api.user.address.default();
if (error === 0 && !isEmpty(data)) {
const {
code,
data
} = await sheep.$api.user.address.default();
console.log(data, '默认收货地址');
if (code === 0 && !isEmpty(data)) {
console.log('执行赋值')
addressInfo = data;
}
}
@ -243,7 +213,7 @@
title: '提示',
content: '确定使用积分立即兑换?',
cancelText: '再想想',
success: async function (res) {
success: async function(res) {
if (res.confirm) {
submitOrder();
}
@ -256,7 +226,10 @@
// &
async function submitOrder() {
const { error, data } = await sheep.$api.order.create(state.orderPayload);
const {
error,
data
} = await sheep.$api.order.create(state.orderPayload);
if (error === 0) {
//
if (state.orderPayload.from === 'cart') {
@ -276,7 +249,17 @@
// &
async function getOrderInfo() {
let { error, data } = await sheep.$api.order.calc(state.orderPayload);
console.log(state.orderPayload, '计算价格传参')
// let {code, data} = await sheep.$api.order.calc(state.orderPayload);
// let data = await sheep.$api.order.calc(state.orderPayload);
console.log(state.orderPayload.items)
let data = await sheep.$api.order.calc({
deliveryType: 1,
pointStatus: false,
items: state.orderPayload.items
});
console.log(data, '修改后的获取订单详细数据')
return;
if (error === 0) {
state.totalNumber = 0;
state.orderInfo = data;
@ -288,13 +271,17 @@
//
async function getCoupons() {
const { error, data } = await sheep.$api.order.coupons(state.orderPayload);
const {
error,
data
} = await sheep.$api.order.coupons(state.orderPayload);
if (error === 0) {
state.couponInfo = data;
}
}
onLoad(async (options) => {
console.log(options)
if (options.data) {
state.orderPayload = JSON.parse(options.data);
changeConsignee();
@ -325,17 +312,20 @@
margin-top: 4rpx;
}
}
.uni-easyinput__content {
display: flex !important;
align-items: center !important;
justify-content: right !important;
}
}
.score-img {
width: 36rpx;
height: 36rpx;
margin: 0 4rpx;
}
.order-item {
height: 80rpx;
@ -349,6 +339,7 @@
font-weight: 500;
font-family: OPPOSANS;
}
.text-disabled {
color: #bbbbbb;
}
@ -399,19 +390,23 @@
color: $dark-9;
}
}
.title {
font-size: 36rpx;
font-weight: bold;
color: #333333;
}
.subtitle {
font-size: 28rpx;
color: #999999;
}
.cicon-checkbox {
font-size: 36rpx;
color: var(--ui-BG-Main);
}
.cicon-box {
font-size: 36rpx;
color: #999999;

View File

@ -2,46 +2,29 @@
<template>
<s-layout title="订单详情" class="index-wrap" navbar="inner">
<!-- 订单状态 -->
<view
class="state-box ss-flex-col ss-col-center ss-row-right"
:style="[
<view class="state-box ss-flex-col ss-col-center ss-row-right" :style="[
{
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
paddingTop: Number(statusBarHeight + 88) + 'rpx',
},
]"
>
]">
<view class="ss-flex ss-m-t-32 ss-m-b-20">
<image
v-if="
<image v-if="
state.orderInfo.status_code == 'unpaid' ||
state.orderInfo.status_code == 'nosend' ||
state.orderInfo.status_code == 'nocomment'
"
class="state-img"
:src="sheep.$url.static('/static/img/shop/order/order_loading.png')"
>
" class="state-img" :src="sheep.$url.static('/static/img/shop/order/order_loading.png')">
</image>
<image
v-if="
<image v-if="
state.orderInfo.status_code == 'completed' ||
state.orderInfo.status_code == 'refund_agree'
"
class="state-img"
:src="sheep.$url.static('/static/img/shop/order/order_success.png')"
>
" class="state-img" :src="sheep.$url.static('/static/img/shop/order/order_success.png')">
</image>
<image
v-if="state.orderInfo.status_code == 'cancel' || state.orderInfo.status_code == 'closed'"
class="state-img"
:src="sheep.$url.static('/static/img/shop/order/order_close.png')"
>
<image v-if="state.orderInfo.status_code == 'cancel' || state.orderInfo.status_code == 'closed'"
class="state-img" :src="sheep.$url.static('/static/img/shop/order/order_close.png')">
</image>
<image
v-if="state.orderInfo.status_code == 'noget'"
class="state-img"
:src="sheep.$url.static('/static/img/shop/order/order_express.png')"
>
<image v-if="state.orderInfo.status_code == 'noget'" class="state-img"
:src="sheep.$url.static('/static/img/shop/order/order_express.png')">
</image>
<view class="ss-font-30">{{ state.orderInfo.status_text }}</view>
</view>
@ -63,77 +46,54 @@
<!-- 订单信息 -->
<view class="order-list" v-for="item in state.orderInfo.items" :key="item.goods_id">
<view class="order-card">
<s-goods-item
@tap="onGoodsDetail(item.goods_id)"
:img="item.goods_image"
:title="item.goods_title"
:skuText="item.goods_sku_text"
:price="item.goods_price"
:score="state.orderInfo.score_amount"
:num="item.goods_num"
>
<template #top>
<s-goods-item @tap="onGoodsDetail(item.goods_id)" :img="item.goods_image" :title="item.goods_title"
:skuText="item.goods_sku_text" :price="item.goods_price" :score="state.orderInfo.score_amount"
:num="item.goods_num">
<!-- <template #top>
<view class="order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white">
<view class="item-title">配送方式</view>
<view class="ss-flex ss-col-center">
<text class="item-value ss-m-r-20">{{ item.dispatch_type_text }}</text>
<button
class="ss-reset-button copy-btn"
@tap="onDetail(item)"
v-if="
<button class="ss-reset-button copy-btn" @tap="onDetail(item)" v-if="
(item.dispatch_type === 'autosend' || item.dispatch_type === 'custom') &&
item.dispatch_status !== 0
"
>详情</button
>
">详情</button>
</view>
</view>
</template>
<template #tool>
<view class="ss-flex">
<button
class="ss-reset-button apply-btn"
v-if="item.btns.includes('aftersale')"
<button class="ss-reset-button apply-btn" v-if="item.btns.includes('aftersale')"
@tap.stop="
sheep.$router.go('/pages/order/aftersale/apply', {
item: JSON.stringify(item),
})
"
>
">
申请售后
</button>
<button
class="ss-reset-button apply-btn"
v-if="item.btns.includes('re_aftersale')"
<button class="ss-reset-button apply-btn" v-if="item.btns.includes('re_aftersale')"
@tap.stop="
sheep.$router.go('/pages/order/aftersale/apply', {
item: JSON.stringify(item),
})
"
>
">
重新售后
</button>
<button
class="ss-reset-button apply-btn"
v-if="item.btns.includes('aftersale_info')"
<button class="ss-reset-button apply-btn" v-if="item.btns.includes('aftersale_info')"
@tap.stop="
sheep.$router.go('/pages/order/aftersale/detail', {
id: item.ext.aftersale_id,
})
"
>
">
售后详情
</button>
<button
class="ss-reset-button apply-btn"
v-if="item.btns.includes('buy_again')"
<button class="ss-reset-button apply-btn" v-if="item.btns.includes('buy_again')"
@tap.stop="
sheep.$router.go('/pages/goods/index', {
id: item.goods_id,
})
"
>
">
再次购买
</button>
</view>
@ -142,7 +102,7 @@
<button class="ss-reset-button tag-btn" v-if="item.status_text">
{{ item.status_text }}
</button>
</template>
</template> -->
</s-goods-item>
</view>
</view>
@ -176,19 +136,12 @@
<view class="notice-item ss-flex ss-row-between">
<text class="title">商品总额</text>
<view class="ss-flex">
<text class="detail" v-if="Number(state.orderInfo.goods_amount) > 0"
>{{ state.orderInfo.goods_amount }}</text
>
<view
v-if="state.orderInfo.score_amount && Number(state.orderInfo.goods_amount) > 0"
class="detail"
>+</view
>
<text class="detail"
v-if="Number(state.orderInfo.goods_amount) > 0">{{ state.orderInfo.goods_amount }}</text>
<view v-if="state.orderInfo.score_amount && Number(state.orderInfo.goods_amount) > 0"
class="detail">+</view>
<view class="price-text ss-flex ss-col-center" v-if="state.orderInfo.score_amount">
<image
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
class="score-img"
></image>
<image :src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="score-img"></image>
<view class="detail">{{ state.orderInfo.score_amount }}</view>
</view>
</view>
@ -197,10 +150,7 @@
<text class="title">运费</text>
<text class="detail">{{ state.orderInfo.dispatch_amount }}</text>
</view>
<view
class="notice-item ss-flex ss-row-between"
v-if="state.orderInfo.total_discount_fee > 0"
>
<view class="notice-item ss-flex ss-row-between" v-if="state.orderInfo.total_discount_fee > 0">
<text class="title">优惠金额</text>
<text class="detail">¥{{ state.orderInfo.total_discount_fee }}</text>
</view>
@ -208,28 +158,17 @@
<text class="title">{{
['paid', 'completed'].includes(state.orderInfo.status) ? '已付款' : '需付款'
}}</text>
<text class="detail all-price" v-if="Number(state.orderInfo.pay_fee) > 0"
>{{ state.orderInfo.pay_fee }}</text
>
<view
v-if="
<text class="detail all-price"
v-if="Number(state.orderInfo.pay_fee) > 0">{{ state.orderInfo.pay_fee }}</text>
<view v-if="
state.orderInfo.score_amount &&
Number(state.orderInfo.pay_fee) > 0 &&
['paid', 'completed'].includes(state.orderInfo.status)
"
class="detail all-price"
>+</view
>
<view
class="price-text ss-flex ss-col-center"
v-if="
" class="detail all-price">+</view>
<view class="price-text ss-flex ss-col-center" v-if="
state.orderInfo.score_amount && ['paid', 'completed'].includes(state.orderInfo.status)
"
>
<image
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
class="score-img"
></image>
">
<image :src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="score-img"></image>
<view class="detail all-price">{{ state.orderInfo.score_amount }}</view>
</view>
</view>
@ -243,65 +182,31 @@
<!-- TODO: 查看物流等待成团评价完后返回页面没刷新页面 -->
<su-fixed bottom placeholder bg="bg-white" v-if="state.orderInfo.btns?.length">
<view class="footer-box ss-flex ss-col-center ss-row-right">
<button
class="ss-reset-button cancel-btn"
v-if="state.orderInfo.btns?.includes('cancel')"
@tap="onCancel(state.orderInfo.id)"
>取消订单</button
>
<button
class="ss-reset-button pay-btn ui-BG-Main-Gradient"
v-if="state.orderInfo.btns?.includes('pay')"
@tap="onPay(state.orderInfo.order_sn)"
>继续支付</button
>
<button
class="ss-reset-button cancel-btn"
v-if="state.orderInfo.btns?.includes('apply_refund')"
@tap="onRefund(state.orderInfo.id)"
>申请退款</button
>
<button
class="ss-reset-button cancel-btn"
v-if="state.orderInfo.btns?.includes('groupon')"
@tap="
<button class="ss-reset-button cancel-btn" v-if="state.orderInfo.btns?.includes('cancel')"
@tap="onCancel(state.orderInfo.id)">取消订单</button>
<button class="ss-reset-button pay-btn ui-BG-Main-Gradient" v-if="state.orderInfo.btns?.includes('pay')"
@tap="onPay(state.orderInfo.order_sn)">继续支付</button>
<button class="ss-reset-button cancel-btn" v-if="state.orderInfo.btns?.includes('apply_refund')"
@tap="onRefund(state.orderInfo.id)">申请退款</button>
<button class="ss-reset-button cancel-btn" v-if="state.orderInfo.btns?.includes('groupon')" @tap="
sheep.$router.go('/pages/activity/groupon/detail', {
id: state.orderInfo.ext.groupon_id,
})
"
>
">
{{ state.orderInfo.status_code === 'groupon_ing' ? '邀请拼团' : '拼团详情' }}
</button>
<button
class="ss-reset-button cancel-btn"
v-if="state.orderInfo.btns?.includes('express')"
@tap="onExpress(state.orderInfo.id)"
>查看物流</button
>
<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
>
<button
v-if="state.orderInfo.btns?.includes('invoice')"
class="ss-reset-button cancel-btn"
@tap.stop="onOrderInvoice(state.orderInfo.invoice?.id)"
>
<button class="ss-reset-button cancel-btn" v-if="state.orderInfo.btns?.includes('express')"
@tap="onExpress(state.orderInfo.id)">查看物流</button>
<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.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)">
查看发票
</button>
<button
v-if="state.orderInfo.btns?.includes('re_apply_refund')"
class="ss-reset-button cancel-btn"
@tap.stop="onRefund(state.orderInfo.id)"
>
<button v-if="state.orderInfo.btns?.includes('re_apply_refund')" class="ss-reset-button cancel-btn"
@tap.stop="onRefund(state.orderInfo.id)">
重新退款
</button>
</view>
@ -311,9 +216,16 @@
<script setup>
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
import { isEmpty } from 'lodash';
import {
onLoad
} from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
import {
isEmpty
} from 'lodash';
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
@ -353,7 +265,9 @@
}
function onGoodsDetail(id) {
sheep.$router.go('/pages/goods/index', { id });
sheep.$router.go('/pages/goods/index', {
id
});
}
//
@ -361,9 +275,12 @@
uni.showModal({
title: '提示',
content: '确定要取消订单吗?',
success: async function (res) {
success: async function(res) {
if (res.confirm) {
const { error, data } = await sheep.$api.order.cancel(orderId);
const {
error,
data
} = await sheep.$api.order.cancel(orderId);
if (error === 0) {
getOrderDetail(data.order_sn);
}
@ -377,9 +294,12 @@
uni.showModal({
title: '提示',
content: '确定要申请退款吗?',
success: async function (res) {
success: async function(res) {
if (res.confirm) {
const { error, data } = await sheep.$api.order.applyRefund(orderId);
const {
error,
data
} = await sheep.$api.order.applyRefund(orderId);
if (error === 0) {
getOrderDetail(data.order_sn);
}
@ -413,7 +333,10 @@
}
//
const { error, data } = await sheep.$api.order.confirm(orderId);
const {
error,
data
} = await sheep.$api.order.confirm(orderId);
if (error === 0) {
getOrderDetail(data.order_sn);
}
@ -466,15 +389,19 @@
}
//
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) {
//
let res = {};
if (state.comeinType === 'wechat') {
res = await sheep.$api.order.detail(id, {
@ -483,8 +410,42 @@
} else {
res = await sheep.$api.order.detail(id);
}
if (res.error === 0) {
console.log(res, '我的订单详情数据');
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.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,
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 + ' ', '')
}
})
state.orderInfo = res.data;
console.log(state.orderInfo, '修改后数据')
} else {
sheep.$router.back();
}
@ -512,6 +473,7 @@
height: 36rpx;
margin: 0 4rpx;
}
.apply-btn {
width: 140rpx;
height: 50rpx;
@ -521,6 +483,7 @@
line-height: normal;
margin-left: 16rpx;
}
.state-box {
color: rgba(#fff, 0.9);
width: 100%;
@ -528,6 +491,7 @@
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
background-size: 750rpx 100%;
box-sizing: border-box;
.state-img {
width: 60rpx;
height: 60rpx;
@ -580,6 +544,7 @@
margin-right: 10rpx;
}
}
.tag-btn {
margin-left: 16rpx;
font-size: 24rpx;
@ -642,6 +607,7 @@
}
}
}
.copy-btn {
width: 100rpx;
line-height: 50rpx;

View File

@ -7,7 +7,7 @@
<s-empty v-if="state.pagination.total === 0" icon="/static/order-empty.png" text="暂无订单"></s-empty>
<view v-if="state.pagination.total > 0">
<view class="bg-white order-list-card-box ss-r-10 ss-m-t-14 ss-m-20" v-for="order in state.pagination.data"
:key="order.id" @tap="onOrderDetail(order.no)">
:key="order.id" @tap="onOrderDetail(order.id)">
<view class="order-card-header ss-flex ss-col-center ss-row-between ss-p-x-20">
<view class="order-no">订单号{{ order.no }}</view>
<view class="order-state ss-font-26" :class="formatOrderColor(order.status_code)">{{
@ -15,7 +15,8 @@
}}</view>
</view>
<view class="border-bottom" v-for="item in order.items" :key="item.id">
<s-goods-item :img="item.picUrl" :title="item.spuName" :skuText="item.properties.length>1? item.properties.reduce((items2,items)=>items2.valueName+' '+items.valueName):item.properties[0].valueName"
<s-goods-item :img="item.picUrl" :title="item.spuName"
:skuText="item.properties.length>1? item.properties.reduce((items2,items)=>items2.valueName+' '+items.valueName):item.properties[0].valueName"
:price="item.price/100" :score="order.score_amount" :num="item.count">
<template #tool>
<view class="ss-flex">
@ -402,7 +403,7 @@
status: tabMaps[state.currentTab].value,
pageSize: list_rows,
pageNo: page,
commentStatus: tabMaps[state.currentTab].value==30?false:null
commentStatus: tabMaps[state.currentTab].value == 30 ? false : null
});
state.error = res.code;
if (res.code === 0) {
@ -430,7 +431,7 @@
//
function loadmore() {
if (state.loadStatus !== 'noMore') {
getOrderList(parseInt((state.pagination.data.length/5)+1));
getOrderList(parseInt((state.pagination.data.length / 5) + 1));
}
}

View File

@ -1,48 +1,42 @@
<template>
<s-layout title="收货地址" :bgStyle="{ color: '#FFF' }">
<view v-if="state.list.length">
<s-address-item
hasBorderBottom
v-for="item in state.list"
:key="item.id"
:item="item"
@tap="onSelect(item)"
>
<s-address-item hasBorderBottom v-for="item in state.list" :key="item.id" :item="item"
@tap="onSelect(item)">
</s-address-item>
</view>
<su-fixed bottom placeholder>
<view class="footer-box ss-flex ss-row-between ss-p-20">
<!-- 微信小程序和微信H5 -->
<button
v-if="['WechatMiniProgram', 'WechatOfficialAccount'].includes(sheep.$platform.name)"
<button v-if="['WechatMiniProgram', 'WechatOfficialAccount'].includes(sheep.$platform.name)"
@tap="importWechatAddress"
class="border ss-reset-button sync-wxaddress ss-m-20 ss-flex ss-row-center ss-col-center"
>
class="border ss-reset-button sync-wxaddress ss-m-20 ss-flex ss-row-center ss-col-center">
<text class="cicon-weixin ss-p-r-10" style="color: #09bb07; font-size: 40rpx"></text>
导入微信地址
</button>
<button
class="add-btn ss-reset-button ui-Shadow-Main"
@tap="sheep.$router.go('/pages/user/address/edit')"
>
<button class="add-btn ss-reset-button ui-Shadow-Main"
@tap="sheep.$router.go('/pages/user/address/edit')">
新增收货地址
</button>
</view>
</su-fixed>
<s-empty
v-if="state.list.length === 0 && !state.loading"
text="暂无收货地址"
icon="/static/data-empty.png"
/>
<s-empty v-if="state.list.length === 0 && !state.loading" text="暂无收货地址" icon="/static/data-empty.png" />
</s-layout>
</template>
<script setup>
import { reactive, onBeforeMount } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import {
reactive,
onBeforeMount
} from 'vue';
import {
onShow
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import { isEmpty } from 'lodash';
import {
isEmpty
} from 'lodash';
const state = reactive({
list: [],

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,28 +1,27 @@
<!-- 页面 -->
<template>
<s-layout class="wallet-wrap" title="我的积分" navbar="inner">
<view
class="header-box ss-flex ss-flex-col ss-row-center ss-col-center"
:style="[
<view class="header-box ss-flex ss-flex-col ss-row-center ss-col-center" :style="[
{
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
paddingTop: Number(statusBarHeight + 88) + 'rpx',
},
]"
>
<view class="header-bg"><view class="bg"></view></view>
]">
<view class="header-bg">
<view class="bg"></view>
</view>
<view class="score-box ss-flex-col ss-row-center ss-col-center">
<view class="ss-m-b-30">
<text class="all-title ss-m-r-8">当前积分</text>
<!-- <text class="cicon-help-o"></text> -->
</view>
<text class="all-num">{{ userInfo.score || 0 }}</text>
<text class="all-num">{{ userInfo.point || 0 }}</text>
</view>
</view>
<!-- tab -->
<su-sticky :customNavHeight="sys_navBar">
<!-- 统计 -->
<view class="filter-box ss-p-x-30 ss-flex ss-col-center ss-row-between">
<!-- <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">
<button class="ss-reset-button date-btn">
<text>{{ dateFilterText }}</text>
@ -34,51 +33,46 @@
<view class="ss-m-b-10">总收入{{ state.pagination.income }}</view>
<view>总支出{{ -state.pagination.expense }}</view>
</view>
</view>
<su-tabs
:list="tabMaps"
@change="onChange"
:scrollable="false"
:current="state.currentTab"
></su-tabs>
</view> -->
<su-tabs :list="tabMaps" @change="onChange" :scrollable="false" :current="state.currentTab"></su-tabs>
</su-sticky>
<!-- list -->
<view class="list-box">
<view v-if="state.pagination.total > 0">
<view
class="list-item ss-flex ss-col-center ss-row-between"
v-for="item in state.pagination.data"
:key="item.id"
>
<view class="list-item ss-flex ss-col-center ss-row-between" v-for="item in state.pagination.data"
:key="item.id">
<view class="ss-flex-col">
<view class="name">{{ item.event_text }}{{ item.memo ? '-' + item.memo : '' }}</view>
<view class="time">{{ item.create_time }}</view>
<view class="name">{{ item.title }}{{ item.description ? '-' + item.description : '' }}</view>
<view class="time">{{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss')}}</view>
</view>
<view class="add" v-if="item.amount > 0">+{{ parseInt(item.amount) }}</view>
<view class="minus" v-else>{{ parseInt(item.amount) }}</view>
<view class="add" v-if="item.point > 0">+{{ parseInt(item.point) }}</view>
<view class="minus" v-else>{{ parseInt(item.point) }}</view>
</view>
</view>
<s-empty v-else text="暂无数据" icon="/static/data-empty.png" />
</view>
<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="onLoadMore"
/>
}" @tap="onLoadMore" />
</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';
import dayjs from 'dayjs';
import { onPageScroll } from '@dcloudio/uni-app';
import {
onPageScroll
} from '@dcloudio/uni-app';
onPageScroll(() => {});
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
@ -99,23 +93,22 @@
pagination,
loadStatus: '',
date: [],
today:'',
today: '',
});
const tabMaps = [
{
const tabMaps = [{
name: '全部',
value: 'all',
},
{
name: '收入',
value: 'income',
},
{
name: '支出',
value: 'expense',
},
// {
// name: '',
// value: 'income',
// },
// {
// name: '',
// value: 'expense',
// },
];
const dateFilterText = computed(() => {
@ -127,27 +120,31 @@
});
async function getLogList(page = 1, list_rows = 8) {
pagination.current_page = page;
state.loadStatus = 'loading';
let res = await sheep.$api.user.wallet.log({
type: 'score',
list_rows,
page,
tab: tabMaps[state.currentTab].value,
date: appendTimeHMS(state.date),
let res = await sheep.$api.user.wallet.log2({
// type: 'score',
pageSize: list_rows,
pageNo: page,
// tab: tabMaps[state.currentTab].value,
// date: appendTimeHMS(state.date),
});
if (res.error === 0) {
let list = _.concat(state.pagination.data, res.data.list.data);
console.log(res, '优惠券列表')
if (res.code === 0) {
let list = _.concat(state.pagination.data, res.data.list);
console.log(list, '处理后数据')
state.pagination = {
total: res.data.total,
...res.data.list,
data: list,
income: res.data.income,
expense: res.data.expense,
// income: res.data.income,
// expense: res.data.expense,
};
if (state.pagination.current_page < state.pagination.last_page) {
// if (state.pagination.current_page < state.pagination.last_page) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
}
// } else {
// state.loadStatus = 'noMore';
// }
}
}
onLoad(async (options) => {
@ -161,6 +158,7 @@
state.currentTab = e.index;
getLogList();
}
function onChangeTime(e) {
state.date[0] = e[0];
state.date[1] = e[e.length - 1];
@ -173,9 +171,9 @@
}
function onLoadMore() {
if (state.loadStatus !== 'noMore') {
getLogList(state.pagination.current_page + 1);
}
// if (state.loadStatus !== 'noMore') {
getLogList(pagination.current_page + 1);
// }
}
onReachBottom(() => {
onLoadMore();
@ -185,8 +183,7 @@
<style lang="scss" scoped>
.header-box {
width: 100%;
background: linear-gradient(180deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%)
no-repeat;
background: linear-gradient(180deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%) no-repeat;
background-size: 750rpx 100%;
padding: 0 0 120rpx 0;
box-sizing: border-box;
@ -213,6 +210,7 @@
}
}
}
//
.filter-box {
height: 114rpx;

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

@ -3,12 +3,18 @@ import request2 from '@/sheep/request2';
export default {
// 订单详情
detail: (id,params) =>
request({
url: 'order/order/' + id,
detail: (id, params) =>
request2({
url: 'trade/order/get-detail?id=' + id,
method: 'GET',
params,
}),
// detail: (id, params) =>
// request({
// url: 'order/order/' + id,
// method: 'GET',
// params,
// }),
// 发票详情
invoice: (id) =>
request({
@ -24,9 +30,9 @@ export default {
showLoading: false,
},
}),
itemDetail: (id,itemId) =>
itemDetail: (id, itemId) =>
request({
url: 'order/order/itemDetail/'+ id + '/' + itemId,
url: 'order/order/itemDetail/' + id + '/' + itemId,
method: 'GET',
custom: {
showLoading: false,
@ -52,12 +58,34 @@ export default {
// },
// }),
// 计算订单信息
calc: (data) =>
request({
url: 'order/order/calc',
method: 'POST',
data,
}),
calc: (data) => {
const data2 = {
...data,
}
// 解决 SpringMVC 接受 List<Item> 参数的问题
delete data2.items
for (let i = 0; i < data.items.length; i++) {
// data2['items[' + i + '' + '].skuId'] = data.items[i].skuId + '';
// data2['items[' + i + '' + '].count'] = data.items[i].count + '';
// data2['items[' + i + '' + '].cartId'] = data.items[i].cartId + '';
data2['items' + `%5B${i}%5D` + '.skuId'] = data.items[i].skuId + '';
data2['items' + `%5B${i}%5D` + '.count'] = data.items[i].count + '';
data2['items' + `%5B${i}%5D` + '.cartId'] = data.items[i].cartId + '';
}
console.log(data2, '对比数据')
return request2({
url: 'trade/order/settlement',
method: 'GET',
// data,
params: data2
})
},
// calc: (data) =>
// request({
// url: 'order/order/calc',
// method: 'POST',
// data,
// }),
// 创建订单
create: (data) =>
request({
@ -79,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({
@ -113,14 +147,23 @@ export default {
data,
}),
list: (params) =>
request({
url: 'order/aftersale',
request2({
url: 'trade/after-sale/page',
method: 'GET',
params,
custom: {
showLoading: false,
},
}),
// list: (params) =>
// request({
// url: 'order/aftersale',
// method: 'GET',
// params,
// custom: {
// showLoading: false,
// },
// }),
//取消售后
cancel: (id) =>
request({
@ -135,8 +178,8 @@ export default {
}),
// 售后详情
detail: (id) =>
request({
url: 'order/aftersale/' + id,
request2({
url: 'trade/after-sale/get?id=' + id,
method: 'GET',
}),
},

View File

@ -3,6 +3,15 @@ import request2 from '@/sheep/request2';
import $platform from '@/sheep/platform';
export default {
getUnused: () =>
request2({
url: 'promotion/coupon/get-unused-count',
method: 'GET',
custom: {
showLoading: false,
auth: true,
},
}),
profile: () =>
request2({
url: 'member/user/get',
@ -187,9 +196,17 @@ export default {
}),
address: {
// default: () =>
// request({
// url: 'user/address/default',
// method: 'GET',
// custom: {
// showError: false,
// },
// }),
default: () =>
request({
url: 'user/address/default',
request2({
url: 'member/address/get-default',
method: 'GET',
custom: {
showError: false,
@ -225,7 +242,7 @@ export default {
// showSuccess: true,
// },
// }),
update: ( data) =>
update: (data) =>
request2({
url: 'member/address/update',
method: 'PUT',
@ -325,7 +342,7 @@ export default {
url: 'product/favorite/delete-list',
method: 'DELETE',
data: {
spuIds: id.split(',').map(item=>item*1),
spuIds: id.split(',').map(item => item * 1),
// spuIds: id.split(',').join(','),
},
custom: {
@ -367,11 +384,20 @@ export default {
wallet: {
log: (params) =>
request2({
// url: 'member/point/record/page',
url: 'pay/wallet-transaction/page',
method: 'GET',
params,
custom: {},
}),
log2: (params) =>
request2({
url: 'member/point/record/page',
// url: 'pay/wallet-transaction/page',
method: 'GET',
params,
custom: {},
}),
// log: (params) =>
// request({
// url: '/user/api/walletLog',

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

@ -4,11 +4,8 @@
<view class="ss-modal-box bg-white ss-flex-col">
<view class="modal-header ss-flex ss-col-center">
<view class="header-left ss-m-r-30">
<image
class="sku-image"
:src="sheep.$url.cdn(state.selectedSkuPrice.image || goodsInfo.image)"
mode="aspectFill"
></image>
<image class="sku-image" :src="sheep.$url.cdn(state.selectedSkuPrice.image || goodsInfo.image)"
mode="aspectFill"></image>
</view>
<view class="header-right ss-flex-col ss-row-between ss-flex-1">
<view class="goods-title ss-line-2">{{ goodsInfo.title }}</view>
@ -18,16 +15,10 @@
{{ goodsPrice.price }}
</view>
<view class="ss-flex">
<view
v-if="goodsPrice.price > 0 && goodsPrice.score > 0"
class="score-text ss-m-l-4"
>+
<view v-if="goodsPrice.price > 0 && goodsPrice.score > 0" class="score-text ss-m-l-4">+
</view>
<image
v-if="goodsPrice.score > 0"
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
class="score-img"
>
<image v-if="goodsPrice.score > 0"
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="score-img">
</image>
<view v-if="goodsPrice.score > 0" class="score-text">
{{ goodsPrice.score }}
@ -50,48 +41,31 @@
<view class="sku-item ss-m-b-20" v-for="sku1 in goodsInfo.skus" :key="sku1.id">
<view class="label-text ss-m-b-20">{{ sku1.name }}</view>
<view class="ss-flex ss-col-center ss-flex-wrap">
<button
class="ss-reset-button spec-btn"
v-for="sku2 in sku1.children"
:class="[
<button class="ss-reset-button spec-btn" v-for="sku2 in sku1.children" :class="[
{
'ui-BG-Main-Gradient': state.currentSkuArray[sku2.parent_id] == sku2.id,
},
{
'disabled-btn': sku2.disabled == true,
},
]"
:key="sku2.id"
:disabled="sku2.disabled == true"
@tap="onSelectSku(sku2.parent_id, sku2.id)"
>
]" :key="sku2.id" :disabled="sku2.disabled == true" @tap="onSelectSku(sku2.parent_id, sku2.id)">
{{ sku2.name }}
</button>
</view>
</view>
<view class="buy-num-box ss-flex ss-col-center ss-row-between ss-m-b-40">
<view class="label-text">购买数量</view>
<su-number-box
:min="1"
:max="state.selectedSkuPrice.stock"
:step="1"
v-model="state.selectedSkuPrice.goods_num"
@change="onNumberChange($event)"
></su-number-box>
<su-number-box :min="1" :max="state.selectedSkuPrice.stock" :step="1"
v-model="state.selectedSkuPrice.goods_num" @change="onNumberChange($event)"></su-number-box>
</view>
</scroll-view>
</view>
<view class="modal-footer border-top">
<view
class="buy-box ss-flex ss-col-center ss-flex ss-col-center ss-row-center"
v-if="isScore"
>
<view class="buy-box ss-flex ss-col-center ss-flex ss-col-center ss-row-center" v-if="isScore">
<button class="ss-reset-button score-btn ui-Shadow-Main" @tap="onBuy"></button>
</view>
<view class="buy-box ss-flex ss-col-center ss-flex ss-col-center ss-row-center" v-else>
<button class="ss-reset-button add-btn ui-Shadow-Main" @tap="onAddCart"
>加入购物车</button
>
<button class="ss-reset-button add-btn ui-Shadow-Main" @tap="onAddCart"></button>
<button class="ss-reset-button buy-btn ui-Shadow-Main" @tap="onBuy"></button>
</view>
</view>
@ -100,16 +74,25 @@
</template>
<script setup>
import { computed, reactive, watch } from 'vue';
import {
computed,
reactive,
watch
} from 'vue';
import sheep from '@/sheep';
import { formatStock, formatPrice } from '@/sheep/hooks/useGoods';
import { isEmpty } from 'lodash';
import {
formatStock,
formatPrice
} from '@/sheep/hooks/useGoods';
import {
isEmpty
} from 'lodash';
const emits = defineEmits(['change', 'addCart', 'buy', 'close']);
const props = defineProps({
goodsInfo: {
type: Object,
default() {},
default () {},
},
show: {
type: Boolean,
@ -153,8 +136,7 @@
() => state.selectedSkuPrice,
(newVal) => {
emits('change', newVal);
},
{
}, {
immediate: true, //
deep: true, //
},

View File

@ -4,16 +4,11 @@
<view class="ss-flex ss-col-center ss-row-between ss-m-b-20">
<view class="left-box ss-flex ss-col-center ss-m-l-36">
<view class="avatar-box ss-m-r-24">
<image
class="avatar-img"
:src="
<image class="avatar-img" :src="
isLogin
? sheep.$url.cdn(userInfo.avatar)
: sheep.$url.static('/static/img/shop/default_avatar.png')
"
mode="aspectFill"
@tap="sheep.$router.go('/pages/user/info')"
></image>
" mode="aspectFill" @tap="sheep.$router.go('/pages/user/info')"></image>
</view>
<view>
<view class="nickname-box ss-flex ss-col-center">
@ -28,7 +23,9 @@
</view>
</view>
<view
<!-- 提示绑定手机号 先隐藏 yudao 需要再修改 -->
<!-- <view
class="bind-mobile-box ss-flex ss-row-between ss-col-center"
v-if="isLogin && !userInfo.verification?.mobile"
>
@ -37,7 +34,7 @@
<view class="mobile-title ss-m-l-20"> 点击绑定手机号确保账户安全 </view>
</view>
<button class="ss-reset-button bind-btn" @tap="onBind"></button>
</view>
</view> -->
</view>
</template>
@ -56,13 +53,19 @@
*
*
*/
import { computed, reactive } from 'vue';
import {
computed,
reactive
} from 'vue';
import sheep from '@/sheep';
import { showShareModal, showAuthModal } from '@/sheep/hooks/useModal';
import {
showShareModal,
showAuthModal
} from '@/sheep/hooks/useModal';
//
const userInfo = computed(() => sheep.$store('user').userInfo);
console.log('用户信息',userInfo)
console.log('用户信息', userInfo)
//
const isLogin = computed(() => sheep.$store('user').isLogin);

View File

@ -1,4 +1,16 @@
<template>
<<<<<<< HEAD
<view class="ss-wallet-menu-wrap ss-flex ss-col-center">
<view class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center"
@tap="sheep.$router.go('/pages/user/wallet/money')">
<view class="value-box ss-flex ss-col-bottom">
<view class="value-text ss-line-1">{{ userInfo.money }}</view>
<view class="unit-text ss-m-l-6"></view>
</view>
<view class="menu-title ss-m-t-28">账户余额</view>
</view>
<!-- <view class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center"
=======
<view class="ss-wallet-menu-wrap ss-flex ss-col-center">
<view
class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center"
@ -11,6 +23,7 @@
<view class="menu-title ss-m-t-28">账户余额</view>
</view>
<!-- <view class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center"
>>>>>>> 6251ffa9944516e995002e7f11539aef3e1d50de
@tap="sheep.$router.go('/pages/user/wallet/commission')">
<view class="value-box ss-flex ss-col-bottom">
<view class="value-text">{{ userInfo?.commission || '0.00' }}</view>
@ -18,6 +31,34 @@
</view>
<view class="menu-title ss-m-t-28">佣金</view>
</view> -->
<<<<<<< HEAD
<view class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center"
@tap="sheep.$router.go('/pages/user/wallet/score')">
<view class="value-box ss-flex ss-col-bottom">
<view class="value-text">{{ userInfo.point }}</view>
<view class="unit-text ss-m-l-6"></view>
</view>
<view class="menu-title ss-m-t-28">积分</view>
</view>
<view class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center" @tap="
sheep.$router.go('/pages/coupon/list', {
type: 'geted',
})
">
<view class="value-box ss-flex ss-col-bottom">
<view class="value-text">{{ numData.coupons_num }}</view>
<view class="unit-text ss-m-l-6"></view>
</view>
<view class="menu-title ss-m-t-28">优惠券</view>
</view>
<view class="menu-item ss-flex-col ss-row-center ss-col-center menu-wallet"
@tap="sheep.$router.go('/pages/user/wallet/money')">
<image class="item-icon" :src="sheep.$url.static('/static/img/shop/user/wallet_icon.png')" mode="aspectFit">
</image>
<view class="menu-title ss-m-t-30">我的钱包</view>
</view>
</view>
=======
<view
class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center"
@tap="sheep.$router.go('/pages/user/wallet/score')"
@ -55,13 +96,17 @@
<view class="menu-title ss-m-t-30">我的钱包</view>
</view>
</view>
>>>>>>> 6251ffa9944516e995002e7f11539aef3e1d50de
</template>
<script setup>
/**
* 装修组件 - 订单菜单组
*/
import { computed, ref } from 'vue';
import {
computed,
ref
} from 'vue';
import sheep from '@/sheep';
const userInfo = computed(() => sheep.$store('user').userInfo);
@ -73,6 +118,7 @@
.menu-wallet {
width: 144rpx;
}
.menu-item {
height: 160rpx;

View File

@ -4,10 +4,15 @@
*/
import Request from 'luch-request';
import { baseUrl, apiPath } from '@/sheep/config';
import {
baseUrl,
apiPath
} from '@/sheep/config';
import $store from '@/sheep/store';
import $platform from '@/sheep/platform';
import { showAuthModal } from '@/sheep/hooks/useModal';
import {
showAuthModal
} from '@/sheep/hooks/useModal';
const options = {
// 显示操作成功消息 默认不显示

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,21 @@ const user = defineStore({
actions: {
// 获取个人信息
async getInfo() {
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;
this.userInfo = data;
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;
this.userInfo = data;
console.log(data2, '信息')
return Promise.resolve(data);
},
@ -65,22 +81,32 @@ 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
}};
let data3 = await userApi.getUnused();
console.log(data3.data, '优惠券')
if (code === 0 && data2.code === 0) {
console.log('订单数据', data);
this.numData = {
coupons_num: data3.data,
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');
},
@ -127,9 +153,9 @@ const user = defineStore({
// 登录后设置全局分享参数
$share.getShareInfo();
// 提醒绑定手机号
if (app().platform.bind_mobile && !this.userInfo.verification?.mobile) {
showAuthModal('changeMobile');
}
// if (app().platform.bind_mobile && !this.userInfo.verification?.mobile) {
// showAuthModal('changeMobile');
// }
// 添加分享记录
const shareLog = uni.getStorageSync('shareLog');
@ -143,7 +169,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 +185,9 @@ const user = defineStore({
},
persist: {
enabled: true,
strategies: [
{
strategies: [{
key: 'user-store',
},
],
}, ],
},
});