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

13
App.vue
View File

@ -1,6 +1,12 @@
<script setup> <script setup>
import { onLaunch, onShow, onError } from '@dcloudio/uni-app'; import {
import { ShoproInit } from './sheep'; onLaunch,
onShow,
onError
} from '@dcloudio/uni-app';
import {
ShoproInit
} from './sheep';
onLaunch(() => { onLaunch(() => {
// 使 // 使
@ -18,8 +24,7 @@
// #ifdef APP-PLUS // #ifdef APP-PLUS
// urlSchemes // urlSchemes
const args = plus.runtime.arguments; const args = plus.runtime.arguments;
if (args) { if (args) {}
}
// //
uni.getClipboardData({ uni.getClipboardData({

View File

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

View File

@ -6,42 +6,35 @@
<view v-if="item.btns.includes('comment')"> <view v-if="item.btns.includes('comment')">
<view class="commont-from-wrap"> <view class="commont-from-wrap">
<!-- 评价商品 --> <!-- 评价商品 -->
<s-goods-item <s-goods-item :img="item.goods_image" :title="item.goods_title" :skuText="item.goods_sku_text"
:img="item.goods_image" :price="item.goods_price" :num="item.goods_num"></s-goods-item>
:title="item.goods_title"
:skuText="item.goods_sku_text"
:price="item.goods_price"
:num="item.goods_num"
></s-goods-item>
</view> </view>
<view class="form-item"> <view class="form-item">
<!-- 评分 --> <!-- 评分 -->
<view class="star-box ss-flex ss-col-center"> <view class="star-box ss-flex ss-col-center">
<view class="star-title ss-m-r-40"> <view class="star-title ss-m-r-40">
{{ rateMap[state.commentList[index].level] }} <!-- {{ rateMap[state.commentList[index].level] }} -->
商品质量
</view> </view>
<uni-rate v-model="state.commentList[index].level" /> <uni-rate v-model="state.commentList[index].level" />
</view> </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"> <view class="area-box">
<uni-easyinput <uni-easyinput :inputBorder="false" type="textarea" maxlength="120" autoHeight
:inputBorder="false"
type="textarea"
maxlength="120"
autoHeight
v-model="state.commentList[index].content" v-model="state.commentList[index].content"
placeholder="宝贝满足你的期待吗?说说你的使用心得,分享给想买的他们吧~" placeholder="宝贝满足你的期待吗?说说你的使用心得,分享给想买的他们吧~"></uni-easyinput>
></uni-easyinput>
<view class="img-box"> <view class="img-box">
<s-uploader <s-uploader v-model:url="state.commentList[index].images" fileMediatype="image"
v-model:url="state.commentList[index].images" limit="9" mode="grid" :imageStyles="{ width: '168rpx', height: '168rpx' }" />
fileMediatype="image"
limit="9"
mode="grid"
:imageStyles="{ width: '168rpx', height: '168rpx' }"
/>
</view> </view>
</view> </view>
</view> </view>
@ -61,12 +54,18 @@
<script setup> <script setup>
import sheep from '@/sheep'; import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app'; import {
import { computed, reactive } from 'vue'; onLoad
} from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
const state = reactive({ const state = reactive({
orderInfo: {}, orderInfo: {},
commentList: [], commentList: [],
orderId: null
}); });
const rateMap = { const rateMap = {
@ -78,10 +77,21 @@
}; };
async function onSubmit() { async function onSubmit() {
const { error } = await sheep.$api.order.comment(state.orderInfo.id, { //
comments: state.commentList, // console.log(state.orderInfo);
}); // return;
if (error === 0) { 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(); sheep.$router.back();
} }
} }
@ -94,11 +104,48 @@
if (options.id) { if (options.id) {
id = options.id; id = options.id;
} }
if (options.orderId) {
state.orderId = options.orderId
}
const { data, error } = await sheep.$api.order.detail(id); const res = await sheep.$api.order.detail(id);
if (error === 0) { if (res.code === 0) {
if (data.btns.includes('comment')) { let obj = {
state.orderInfo = data; 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) => { state.orderInfo.items.forEach((item) => {
if (item.btns.includes('comment')) { if (item.btns.includes('comment')) {
state.commentList.push({ state.commentList.push({
@ -109,6 +156,7 @@
}); });
} }
}); });
console.log(state.orderInfo.items, '循环')
return; return;
} }
} }
@ -127,14 +175,17 @@
// //
.form-item { .form-item {
background: #fff; background: #fff;
.star-box { .star-box {
height: 100rpx; height: 100rpx;
padding: 0 25rpx; padding: 0 25rpx;
} }
.star-title { .star-title {
font-weight: 600; font-weight: 600;
} }
} }
.area-box { .area-box {
width: 690rpx; width: 690rpx;
min-height: 306rpx; min-height: 306rpx;
@ -147,6 +198,7 @@
margin-top: 20rpx; margin-top: 20rpx;
} }
} }
.post-btn { .post-btn {
width: 690rpx; width: 690rpx;
line-height: 80rpx; line-height: 80rpx;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,8 +29,8 @@
<view class="total-box"> <view class="total-box">
<!-- state.pagination.income.toFixed(2) --> <!-- state.pagination.income.toFixed(2) -->
<view class="ss-m-b-10">总收入{{ }}</view> <!-- <view class="ss-m-b-10">总收入{{ }}</view>
<view>总支出{{ }}</view> <view>总支出{{ }}</view> -->
<!-- (-state.pagination.expense).toFixed(2) --> <!-- (-state.pagination.expense).toFixed(2) -->
</view> </view>
</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.event_text }}{{ item.memo ? '-' + item.memo : '' }}</text> -->
<text class="title ss-line-1">{{ item.title }}</text> <text class="title ss-line-1">{{ item.title }}</text>
<view class="money"> <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> <text v-else class="minus">{{ item.price }}</text>
</view> </view>
</view> </view>

View File

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

View File

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

View File

@ -4,11 +4,17 @@ import request2 from '@/sheep/request2';
export default { export default {
// 订单详情 // 订单详情
detail: (id, params) => detail: (id, params) =>
request({ request2({
url: 'order/order/' + id, url: 'trade/order/get-detail?id=' + id,
method: 'GET', method: 'GET',
params, params,
}), }),
// detail: (id, params) =>
// request({
// url: 'order/order/' + id,
// method: 'GET',
// params,
// }),
// 发票详情 // 发票详情
invoice: (id) => invoice: (id) =>
request({ request({
@ -52,12 +58,34 @@ export default {
// }, // },
// }), // }),
// 计算订单信息 // 计算订单信息
calc: (data) => calc: (data) => {
request({ const data2 = {
url: 'order/order/calc', ...data,
method: 'POST', }
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) => create: (data) =>
request({ request({
@ -79,12 +107,18 @@ export default {
method: 'PUT', method: 'PUT',
}), }),
// 评价订单 // 评价订单
comment: (id, data) => comment: (data) =>
request({ request2({
url: 'order/order/comment/' + id, url: 'trade/order/item/create-comment',
method: 'POST', method: 'POST',
data, data,
}), }),
// comment: (id, data) =>
// request({
// url: 'order/order/comment/' + id,
// method: 'POST',
// data,
// }),
// 申请退款 // 申请退款
applyRefund: (id) => applyRefund: (id) =>
request({ request({
@ -113,14 +147,23 @@ export default {
data, data,
}), }),
list: (params) => list: (params) =>
request({ request2({
url: 'order/aftersale', url: 'trade/after-sale/page',
method: 'GET', method: 'GET',
params, params,
custom: { custom: {
showLoading: false, showLoading: false,
}, },
}), }),
// list: (params) =>
// request({
// url: 'order/aftersale',
// method: 'GET',
// params,
// custom: {
// showLoading: false,
// },
// }),
//取消售后 //取消售后
cancel: (id) => cancel: (id) =>
request({ request({
@ -135,8 +178,8 @@ export default {
}), }),
// 售后详情 // 售后详情
detail: (id) => detail: (id) =>
request({ request2({
url: 'order/aftersale/' + id, url: 'trade/after-sale/get?id=' + id,
method: 'GET', method: 'GET',
}), }),
}, },

View File

@ -3,6 +3,15 @@ import request2 from '@/sheep/request2';
import $platform from '@/sheep/platform'; import $platform from '@/sheep/platform';
export default { export default {
getUnused: () =>
request2({
url: 'promotion/coupon/get-unused-count',
method: 'GET',
custom: {
showLoading: false,
auth: true,
},
}),
profile: () => profile: () =>
request2({ request2({
url: 'member/user/get', url: 'member/user/get',
@ -187,9 +196,17 @@ export default {
}), }),
address: { address: {
// default: () =>
// request({
// url: 'user/address/default',
// method: 'GET',
// custom: {
// showError: false,
// },
// }),
default: () => default: () =>
request({ request2({
url: 'user/address/default', url: 'member/address/get-default',
method: 'GET', method: 'GET',
custom: { custom: {
showError: false, showError: false,
@ -367,11 +384,20 @@ export default {
wallet: { wallet: {
log: (params) => log: (params) =>
request2({ request2({
// url: 'member/point/record/page',
url: 'pay/wallet-transaction/page', url: 'pay/wallet-transaction/page',
method: 'GET', method: 'GET',
params, params,
custom: {}, custom: {},
}), }),
log2: (params) =>
request2({
url: 'member/point/record/page',
// url: 'pay/wallet-transaction/page',
method: 'GET',
params,
custom: {},
}),
// log: (params) => // log: (params) =>
// request({ // request({
// url: '/user/api/walletLog', // url: '/user/api/walletLog',

View File

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

View File

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

View File

@ -4,11 +4,8 @@
<view class="ss-modal-box bg-white ss-flex-col"> <view class="ss-modal-box bg-white ss-flex-col">
<view class="modal-header ss-flex ss-col-center"> <view class="modal-header ss-flex ss-col-center">
<view class="header-left ss-m-r-30"> <view class="header-left ss-m-r-30">
<image <image class="sku-image" :src="sheep.$url.cdn(state.selectedSkuPrice.image || goodsInfo.image)"
class="sku-image" mode="aspectFill"></image>
:src="sheep.$url.cdn(state.selectedSkuPrice.image || goodsInfo.image)"
mode="aspectFill"
></image>
</view> </view>
<view class="header-right ss-flex-col ss-row-between ss-flex-1"> <view class="header-right ss-flex-col ss-row-between ss-flex-1">
<view class="goods-title ss-line-2">{{ goodsInfo.title }}</view> <view class="goods-title ss-line-2">{{ goodsInfo.title }}</view>
@ -18,16 +15,10 @@
{{ goodsPrice.price }} {{ goodsPrice.price }}
</view> </view>
<view class="ss-flex"> <view class="ss-flex">
<view <view v-if="goodsPrice.price > 0 && goodsPrice.score > 0" class="score-text ss-m-l-4">+
v-if="goodsPrice.price > 0 && goodsPrice.score > 0"
class="score-text ss-m-l-4"
>+
</view> </view>
<image <image v-if="goodsPrice.score > 0"
v-if="goodsPrice.score > 0" :src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="score-img">
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
class="score-img"
>
</image> </image>
<view v-if="goodsPrice.score > 0" class="score-text"> <view v-if="goodsPrice.score > 0" class="score-text">
{{ goodsPrice.score }} {{ 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="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="label-text ss-m-b-20">{{ sku1.name }}</view>
<view class="ss-flex ss-col-center ss-flex-wrap"> <view class="ss-flex ss-col-center ss-flex-wrap">
<button <button class="ss-reset-button spec-btn" v-for="sku2 in sku1.children" :class="[
class="ss-reset-button spec-btn"
v-for="sku2 in sku1.children"
:class="[
{ {
'ui-BG-Main-Gradient': state.currentSkuArray[sku2.parent_id] == sku2.id, 'ui-BG-Main-Gradient': state.currentSkuArray[sku2.parent_id] == sku2.id,
}, },
{ {
'disabled-btn': sku2.disabled == true, '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 }} {{ sku2.name }}
</button> </button>
</view> </view>
</view> </view>
<view class="buy-num-box ss-flex ss-col-center ss-row-between ss-m-b-40"> <view class="buy-num-box ss-flex ss-col-center ss-row-between ss-m-b-40">
<view class="label-text">购买数量</view> <view class="label-text">购买数量</view>
<su-number-box <su-number-box :min="1" :max="state.selectedSkuPrice.stock" :step="1"
:min="1" v-model="state.selectedSkuPrice.goods_num" @change="onNumberChange($event)"></su-number-box>
:max="state.selectedSkuPrice.stock"
:step="1"
v-model="state.selectedSkuPrice.goods_num"
@change="onNumberChange($event)"
></su-number-box>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<view class="modal-footer border-top"> <view class="modal-footer border-top">
<view <view class="buy-box ss-flex ss-col-center ss-flex ss-col-center ss-row-center" v-if="isScore">
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> <button class="ss-reset-button score-btn ui-Shadow-Main" @tap="onBuy"></button>
</view> </view>
<view class="buy-box ss-flex ss-col-center ss-flex ss-col-center ss-row-center" v-else> <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 class="ss-reset-button add-btn ui-Shadow-Main" @tap="onAddCart"></button>
>加入购物车</button
>
<button class="ss-reset-button buy-btn ui-Shadow-Main" @tap="onBuy"></button> <button class="ss-reset-button buy-btn ui-Shadow-Main" @tap="onBuy"></button>
</view> </view>
</view> </view>
@ -100,10 +74,19 @@
</template> </template>
<script setup> <script setup>
import { computed, reactive, watch } from 'vue'; import {
computed,
reactive,
watch
} from 'vue';
import sheep from '@/sheep'; import sheep from '@/sheep';
import { formatStock, formatPrice } from '@/sheep/hooks/useGoods'; import {
import { isEmpty } from 'lodash'; formatStock,
formatPrice
} from '@/sheep/hooks/useGoods';
import {
isEmpty
} from 'lodash';
const emits = defineEmits(['change', 'addCart', 'buy', 'close']); const emits = defineEmits(['change', 'addCart', 'buy', 'close']);
const props = defineProps({ const props = defineProps({
@ -153,8 +136,7 @@
() => state.selectedSkuPrice, () => state.selectedSkuPrice,
(newVal) => { (newVal) => {
emits('change', newVal); emits('change', newVal);
}, }, {
{
immediate: true, // immediate: true, //
deep: 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="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="left-box ss-flex ss-col-center ss-m-l-36">
<view class="avatar-box ss-m-r-24"> <view class="avatar-box ss-m-r-24">
<image <image class="avatar-img" :src="
class="avatar-img"
:src="
isLogin isLogin
? sheep.$url.cdn(userInfo.avatar) ? sheep.$url.cdn(userInfo.avatar)
: sheep.$url.static('/static/img/shop/default_avatar.png') : 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> <view>
<view class="nickname-box ss-flex ss-col-center"> <view class="nickname-box ss-flex ss-col-center">
@ -28,7 +23,9 @@
</view> </view>
</view> </view>
<view
<!-- 提示绑定手机号 先隐藏 yudao 需要再修改 -->
<!-- <view
class="bind-mobile-box ss-flex ss-row-between ss-col-center" class="bind-mobile-box ss-flex ss-row-between ss-col-center"
v-if="isLogin && !userInfo.verification?.mobile" v-if="isLogin && !userInfo.verification?.mobile"
> >
@ -37,7 +34,7 @@
<view class="mobile-title ss-m-l-20"> 点击绑定手机号确保账户安全 </view> <view class="mobile-title ss-m-l-20"> 点击绑定手机号确保账户安全 </view>
</view> </view>
<button class="ss-reset-button bind-btn" @tap="onBind"></button> <button class="ss-reset-button bind-btn" @tap="onBind"></button>
</view> </view> -->
</view> </view>
</template> </template>
@ -56,9 +53,15 @@
* *
* *
*/ */
import { computed, reactive } from 'vue'; import {
computed,
reactive
} from 'vue';
import sheep from '@/sheep'; 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); const userInfo = computed(() => sheep.$store('user').userInfo);

View File

@ -1,4 +1,16 @@
<template> <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="ss-wallet-menu-wrap ss-flex ss-col-center">
<view <view
class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center" 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 class="menu-title ss-m-t-28">账户余额</view>
</view> </view>
<!-- <view class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center" <!-- <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')"> @tap="sheep.$router.go('/pages/user/wallet/commission')">
<view class="value-box ss-flex ss-col-bottom"> <view class="value-box ss-flex ss-col-bottom">
<view class="value-text">{{ userInfo?.commission || '0.00' }}</view> <view class="value-text">{{ userInfo?.commission || '0.00' }}</view>
@ -18,6 +31,34 @@
</view> </view>
<view class="menu-title ss-m-t-28">佣金</view> <view class="menu-title ss-m-t-28">佣金</view>
</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 <view
class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center" class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center"
@tap="sheep.$router.go('/pages/user/wallet/score')" @tap="sheep.$router.go('/pages/user/wallet/score')"
@ -55,13 +96,17 @@
<view class="menu-title ss-m-t-30">我的钱包</view> <view class="menu-title ss-m-t-30">我的钱包</view>
</view> </view>
</view> </view>
>>>>>>> 6251ffa9944516e995002e7f11539aef3e1d50de
</template> </template>
<script setup> <script setup>
/** /**
* 装修组件 - 订单菜单组 * 装修组件 - 订单菜单组
*/ */
import { computed, ref } from 'vue'; import {
computed,
ref
} from 'vue';
import sheep from '@/sheep'; import sheep from '@/sheep';
const userInfo = computed(() => sheep.$store('user').userInfo); const userInfo = computed(() => sheep.$store('user').userInfo);
@ -73,6 +118,7 @@
.menu-wallet { .menu-wallet {
width: 144rpx; width: 144rpx;
} }
.menu-item { .menu-item {
height: 160rpx; height: 160rpx;

View File

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

View File

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