feat(订单产品)

This commit is contained in:
Ankkaya 2024-06-03 18:35:53 +08:00
parent 94ee2a3d22
commit b6f8d5a656
16 changed files with 1641 additions and 1093 deletions

View File

@ -12,7 +12,7 @@
"path": "pages/index/redirect" "path": "pages/index/redirect"
}, },
{ {
"path": "pages/order/list", "path": "pages/index/order",
"style": { "style": {
"navigationBarTitleText": "订单" "navigationBarTitleText": "订单"
}, },
@ -115,54 +115,70 @@
} }
}, },
{ {
"path": "wallet/withdraw", "path": "wallet/withdraw",
"style": { "style": {
"navigationBarTitleText": "提现" "navigationBarTitleText": "提现"
}, },
"meta": { "meta": {
"auth": true "auth": true
} }
}, },
{ {
"path": "point/buy", "path": "point/buy",
"style": { "style": {
"navigationBarTitleText": "购买积分" "navigationBarTitleText": "购买积分"
}, },
"meta": { "meta": {
"auth": true "auth": true
} }
}, { },
"path": "point/share", {
"style": { "path": "point/share",
"navigationBarTitleText": "分发积分" "style": {
}, "navigationBarTitleText": "分发积分"
"meta": { },
"auth": true "meta": {
} "auth": true
}, { }
"path": "point/loglist", },
"style": { {
"navigationBarTitleText": "历史积分" "path": "point/loglist",
}, "style": {
"meta": { "navigationBarTitleText": "历史积分"
"auth": true },
} "meta": {
"auth": true
}
} }
] ]
}, },
{ {
"root": "pages/product", "root": "pages/product",
"pages": [ "pages": [
{ {
"path": "manageGoods", "path": "manageGoods",
"style": { "style": {
"navigationBarTitleText": "商品管理" "navigationBarTitleText": "商品管理"
}, },
"meta": { "meta": {
"auth": false "auth": false
} }
} }
] ]
},
{
"root": "pages/order",
"pages": [
{
"path": "detail",
"style": {
"navigationBarTitleText": "订单详情"
},
"meta": {
"auth": true
}
}
]
} }
], ],
"tabBar": { "tabBar": {
@ -174,7 +190,7 @@
"pagePath": "pages/index/product" "pagePath": "pages/index/product"
}, },
{ {
"pagePath": "pages/order/list" "pagePath": "pages/index/order"
}, },
{ {
"pagePath": "pages/index/my" "pagePath": "pages/index/my"

372
pages/index/order.vue Normal file
View File

@ -0,0 +1,372 @@
<template>
<pb-layout
title="订单"
navbar="normal"
tabbar="/pages/index/order"
:bgStyle="bgStyle"
opacityBgUi="bg-white"
color="black"
>
<pb-sticky bgColor="#fff">
<pb-tabs :list="tabMaps" :scrollable="false" @change="onTabsChange" :current="state.currentTab" />
</pb-sticky>
<p-empty
v-if="state.pagination.total === 0"
icon="/static/order-empty.png"
text="暂无订单"
bgColor="transparent"
/>
<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.list"
:key="order.id"
>
<view @tap="onOrderDetail(order.id)">
<view class="order-card-header ss-flex ss-col-center ss-row-between ss-p-x-20">
<view class="order-no">订单号{{ order.no }}</view>
<view class="order-state ss-font-26" :class="formatOrderColor(order)">
{{ formatOrderStatus(order) }}
</view>
</view>
<view class="border-bottom" v-for="item in order.items" :key="item.id">
<p-goods-item
:img="item.picUrl"
:title="item.spuName"
:skuText="item.properties.map((property) => property.valueName).join(' ')"
:price="item.price"
:num="item.count"
/>
</view>
<view
class="order-card-footer ss-flex ss-col-center ss-p-x-20"
:class="order.buttons.length > 3 ? 'ss-row-between' : 'ss-row-right'"
>
<view class="ss-flex ss-col-center">
<button
v-if="order.buttons.length === 0"
class="tool-btn ss-reset-button"
@tap.stop="onOrderDetail(order.id)"
>
查看详情
</button>
<button
v-if="order.buttons.includes('confirm')"
class="tool-btn ss-reset-button"
@tap.stop="onConfirm(order)"
>
确认收货
</button>
<button
v-if="order.buttons.includes('express')"
class="tool-btn ss-reset-button"
@tap.stop="onExpress(order.id)"
>
查看物流
</button>
<button
v-if="order.buttons.includes('cancel')"
class="tool-btn ss-reset-button"
@tap.stop="onCancel(order.id, sindex)"
>
取消订单
</button>
<button
v-if="order.buttons.includes('comment')"
class="tool-btn ss-reset-button"
@tap.stop="onComment(order.id)"
>
评价
</button>
<button
v-if="order.buttons.includes('delete')"
class="delete-btn ss-reset-button"
@tap.stop="onDelete(order.id)"
>
删除订单
</button>
<button
v-if="order.buttons.includes('verification')"
class="tool-btn ss-reset-button ui-BG-Main-Gradient"
@tap.stop="onVerification(order.id)"
>
核销订单
</button>
<button
v-if="order.buttons.includes('delivery')"
class="tool-btn ss-reset-button ui-BG-Main-Gradient"
@tap.stop="onDelivery(order.id)"
>
配送完成
</button>
</view>
</view>
<view class="pay-box ss-m-t-30 ss-flex ss-gap-40 ss-p-b-40 ss-row-right ss-p-r-20">
<view class="ss-flex ss-col-center">
<view class="discounts-title pay-color"
> {{ totalNumsPerOrder(order) }} 件商品,总金额:</view
>
<view class="discounts-money pay-color"> {{ fen2yuan(totalPricePerOrder(order)) }} </view>
</view>
</view>
</view>
</view>
</view>
<uni-load-more
v-if="state.pagination.total > 0"
:status="state.loadStatus"
:content-text="{ contentdown: '上拉加载更多' }"
/>
</pb-layout>
</template>
<script setup>
import { ref } from 'vue'
import OrderApi from '@/peach/api/trade/order'
import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import { fen2yuan, formatOrderColor, formatOrderStatus, handleOrderButtons } from '@/peach/hooks/useGoods'
import peach from '@/peach'
import _, { isEmpty } from 'lodash'
import { resetPagination } from '@/peach/utils'
const bgStyle = {
backgroundColor: 'var(--ui-BG-1)',
description: '',
}
const state = ref({
currentTab: 0,
pagination: {
list: [],
total: 0,
pageNo: 1,
pageSize: 6,
},
loadStatus: '',
})
const tabMaps = [
{
name: '全部',
},
{
name: '待付款',
value: 0,
},
{
name: '待核销',
value: 50,
},
{
name: '待配送',
value: 60,
},
]
//
function totalNumsPerOrder(order) {
if (order.items.length) {
return order.items.reduce((per, cur) => {
return per + cur.count
}, 0)
}
}
//
function totalPricePerOrder(order) {
if (order.items.length) {
return order.items.reduce((per, cur) => {
return per + cur.payPrice
}, 0)
}
}
//
function onTabsChange(e) {
if (state.value.currentTab === e.index) {
return
}
//
resetPagination(state.value.pagination)
state.value.currentTab = e.index
getOrderList()
}
//
function onOrderDetail(id) {
peach.$router.go('/pages/order/detail', {
id,
})
}
//
async function getOrderList() {
state.value.loadStatus = 'loading'
let { data } = await OrderApi.getOrderPage({
pageNo: state.value.pagination.pageNo,
pageSize: state.value.pagination.pageSize,
status: tabMaps[state.value.currentTab].value,
})
data.list.forEach((item) => {
handleOrderButtons(item)
})
state.value.pagination.list = _.concat(state.value.pagination.list, data.list)
console.log(state.value.pagination.list)
state.value.pagination.total = data.total
let currentPageTotal = state.value.pagination.length
state.value.loadStatus = currentPageTotal < state.value.pagination.total ? 'more' : 'noMore'
}
onLoad(async (options) => {
if (options.type) {
state.value.currentTab = options.type
}
await getOrderList()
})
//
function loadMore() {
if (state.value.loadStatus === 'noMore') {
return
}
state.value.pagination.pageNo++
getOrderList()
}
//
onReachBottom(() => {
loadMore()
})
//
onPullDownRefresh(() => {
resetPagination(state.value.pagination)
getOrderList()
setTimeout(function () {
uni.stopPullDownRefresh()
}, 800)
})
</script>
<style lang="scss" scoped>
.tool-btn {
width: 160rpx;
height: 60rpx;
background: #f6f6f6;
font-size: 26rpx;
border-radius: 30rpx;
margin-right: 10rpx;
&:last-of-type {
margin-right: 0;
}
}
.delete-btn {
width: 160rpx;
height: 56rpx;
color: #ff3000;
background: #fee;
border-radius: 28rpx;
font-size: 26rpx;
margin-right: 10rpx;
line-height: normal;
&:last-of-type {
margin-right: 0;
}
}
.apply-btn {
width: 140rpx;
height: 50rpx;
border-radius: 25rpx;
font-size: 24rpx;
border: 2rpx solid #dcdcdc;
line-height: normal;
margin-left: 16rpx;
}
.order-list-card-box {
.order-card-header {
height: 80rpx;
.order-no {
font-size: 26rpx;
font-weight: 500;
}
.order-state {
}
}
.pay-box {
.discounts-title {
font-size: 24rpx;
line-height: normal;
color: #999999;
}
.discounts-money {
font-size: 24rpx;
line-height: normal;
color: #999;
font-family: OPPOSANS;
}
.pay-color {
color: #333;
}
}
.order-card-footer {
height: 100rpx;
.more-item-box {
padding: 20rpx;
.more-item {
height: 60rpx;
.title {
font-size: 26rpx;
}
}
}
.more-btn {
color: $dark-9;
font-size: 24rpx;
}
.content {
width: 154rpx;
color: #333333;
font-size: 26rpx;
font-weight: 500;
}
}
}
:deep(.uni-tooltip-popup) {
background: var(--ui-BG);
}
.warning-color {
color: #faad14;
}
.danger-color {
color: #ff3000;
}
.success-color {
color: #52c41a;
}
.info-color {
color: #999999;
}
</style>

View File

@ -1,85 +1,213 @@
<template> <template>
<pb-layout class="product-list" title="产品" navbar="normal" tabbar="/pages/index/product" :bgStyle="bgStyle" <pb-layout
opacityBgUi="bg-white" color="black"> class="product-list"
<view v-if="state.pagination.total > 0" class="goods-list ss-m-t-20"> title="产品"
<view class="ss-p-l-20 ss-p-r-20" v-for="item in state.pagination.list" :key="item.id"> navbar="normal"
<p-goods-column size="lg" :data="item" :topRadius="10" bottomRadius="10" tabbar="/pages/index/product"
@click="peach.$router.go('/pages/goods/index', { id: item.id })" /> :bgStyle="bgStyle"
</view> opacityBgUi="bg-white"
</view> color="black"
>
<view v-if="state.pagination.total > 0" class="goods-list ss-m-t-20">
<view class="ss-p-l-20 ss-p-r-20 ss-m-b-20" v-for="item in state.pagination.list" :key="item.id">
<p-goods-column
size="lg"
:data="item"
:topRadius="10"
:bottomRadius="10"
@click="peach.$router.go('/pages/goods/index', { id: item.id })"
/>
</view>
</view>
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{ <uni-load-more
contentdown: '上拉加载更多', v-if="state.pagination.total > 0"
}" @click="loadMore" /> :status="state.loadStatus"
:content-text="{
contentdown: '上拉加载更多',
}"
@click="loadMore"
/>
<view class="_icon-add-round add-product" @click="addGoods"></view> <view class="_icon-add-round add-product" @click="addGoods"></view>
<p-empty v-if="state.pagination.total === 0" icon="/static/soldout-empty.png" text="暂无产品" /> <p-empty
</pb-layout> v-if="state.pagination.total === 0"
icon="/static/soldout-empty.png"
text="暂无产品"
bgColor="transparent"
/>
</pb-layout>
</template> </template>
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { onLoad, onReachBottom } from '@dcloudio/uni-app' import { onLoad, onReachBottom } from '@dcloudio/uni-app'
import GoodApi from '@/peach/api/trade/goods'
import peach from '@/peach' import peach from '@/peach'
import _ from 'lodash' import _ from 'lodash'
import { resetPagination } from '@/peach/utils' import { resetPagination } from '@/peach/utils'
const bgStyle = { const bgStyle = {
backgroundImage: '', backgroundImage: '',
backgroundColor: '#fff', backgroundColor: 'var(--ui-BG-1)',
description: '', description: '',
} }
const state = ref({ const state = ref({
pagination: { pagination: {
list: [], list: [],
total: 0, total: 0,
pageNo: 1, pageNo: 1,
pageSize: 6, pageSize: 6,
}, name: '',
createTime: [],
},
loadStatus: '',
}) })
function emptyList() { function emptyList() {
resetPagination(state.value.pagination) resetPagination(state.value.pagination)
} }
function onSearch() { function onSearch() {
emptyList() emptyList()
getList() getList()
} }
function getList() { } async function getList() {
let { data } = await GoodApi.getProductList({
pageNo: state.value.pagination.pageNo,
pageSize: state.value.pagination.pageSize,
})
state.value.pagination.list = _.concat(state.value.pagination.list, data.list)
state.value.pagination.total = data.total
let currentPageTotal = state.value.pagination.length
state.value.loadStatus = currentPageTotal < state.value.pagination.total ? 'more' : 'noMore'
}
function addGoods() { function addGoods() {
peach.$router.go('/pages/product/manageGoods') peach.$router.go('/pages/product/manageGoods')
} }
function loadMore() { function loadMore() {
if (state.value.loadStatus === 'noMore') { if (state.value.loadStatus === 'noMore') {
return return
} }
state.value.pagination.pageNo++ state.value.pagination.pageNo++
getList() getList()
} }
onLoad(async (options) => { onLoad(async (options) => {
getList() getList()
}) })
onReachBottom(() => { onReachBottom(() => {
loadMore() loadMore()
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.product-list { .product-list {
.add-product { .add-product {
position: fixed; position: fixed;
color: var(--ui-BG-Main); color: var(--ui-BG-Main);
bottom: 70px; bottom: 70px;
right: 20px; right: 20px;
font-size: 80rpx; font-size: 80rpx;
} }
.goods-list-box {
width: 50%;
box-sizing: border-box;
.left-list {
margin-right: 10rpx;
margin-bottom: 20rpx;
}
.right-list {
margin-left: 10rpx;
margin-bottom: 20rpx;
}
}
.goods-box {
&:nth-last-of-type(1) {
margin-bottom: 0 !important;
}
&:nth-child(2n) {
margin-right: 0;
}
}
.list-icon {
width: 80rpx;
.sicon-goods-card {
font-size: 40rpx;
}
.sicon-goods-list {
font-size: 40rpx;
}
}
.goods-card {
margin-left: 20rpx;
}
.list-filter-tabs {
background-color: #fff;
}
.filter-list-box {
padding: 28rpx 52rpx;
.filter-item {
font-size: 28rpx;
font-weight: 500;
color: #333333;
line-height: normal;
margin-bottom: 24rpx;
&:nth-last-child(1) {
margin-bottom: 0;
}
}
.filter-item-active {
color: var(--ui-BG-Main);
}
}
.tab-item {
height: 50px;
position: relative;
z-index: 11;
.tab-title {
font-size: 30rpx;
}
.cur-tab-title {
font-weight: $font-weight-bold;
}
.tab-line {
width: 60rpx;
height: 6rpx;
border-radius: 6rpx;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 10rpx;
background-color: var(--ui-BG-Main);
z-index: 12;
}
}
} }
</style> </style>

View File

@ -1,6 +1,13 @@
<!-- 订单详情 --> <!-- 订单详情 -->
<template> <template>
<s-layout title="订单详情" class="index-wrap" navbar="inner"> <pb-layout
title="订单详情"
class="goods-detail-wrap"
navbar="inner"
leftIcon="leftIcon"
color="#fff"
iconColor="#fff"
>
<!-- 订单状态 --> <!-- 订单状态 -->
<view <view
class="state-box ss-flex-col ss-col-center ss-row-right" class="state-box ss-flex-col ss-col-center ss-row-right"
@ -19,25 +26,25 @@
state.orderInfo.status_code == 'nocomment' state.orderInfo.status_code == 'nocomment'
" "
class="state-img" class="state-img"
:src="sheep.$url.static('/static/img/shop/order/order_loading.png')" :src="peach.$url.static('/static/img/shop/order/order_loading.png')"
> >
</image> </image>
<image <image
v-if="state.orderInfo.status_code == 'completed' || state.orderInfo.status_code == 'refund_agree'" v-if="state.orderInfo.status_code == 'completed' || state.orderInfo.status_code == 'refund_agree'"
class="state-img" class="state-img"
:src="sheep.$url.static('/static/img/shop/order/order_success.png')" :src="peach.$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" class="state-img"
:src="sheep.$url.static('/static/img/shop/order/order_close.png')" :src="peach.$url.static('/static/img/shop/order/order_close.png')"
> >
</image> </image>
<image <image
v-if="state.orderInfo.status_code == 'noget'" v-if="state.orderInfo.status_code == 'noget'"
class="state-img" class="state-img"
:src="sheep.$url.static('/static/img/shop/order/order_express.png')" :src="peach.$url.static('/static/img/shop/order/order_express.png')"
> >
</image> </image>
<view class="ss-font-30">{{ formatOrderStatus(state.orderInfo) }}</view> <view class="ss-font-30">{{ formatOrderStatus(state.orderInfo) }}</view>
@ -46,7 +53,7 @@
</view> </view>
<!-- 收货地址 --> <!-- 收货地址 -->
<view class="order-address-box" v-if="state.orderInfo.receiverAreaId > 0"> <view class="order-address-box" v-if="state.orderInfo.receiverAreaId">
<view class="ss-flex ss-col-center"> <view class="ss-flex ss-col-center">
<text class="address-username"> <text class="address-username">
{{ state.orderInfo.receiverName }} {{ state.orderInfo.receiverName }}
@ -62,7 +69,7 @@
<!-- 订单信 --> <!-- 订单信 -->
<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 <p-goods-item
@tap="onGoodsDetail(item.spuId)" @tap="onGoodsDetail(item.spuId)"
:img="item.picUrl" :img="item.picUrl"
:title="item.spuName" :title="item.spuName"
@ -76,7 +83,7 @@
class="ss-reset-button apply-btn" class="ss-reset-button apply-btn"
v-if="[10, 20, 30].includes(state.orderInfo.status) && item.afterSaleStatus === 0" v-if="[10, 20, 30].includes(state.orderInfo.status) && item.afterSaleStatus === 0"
@tap.stop=" @tap.stop="
sheep.$router.go('/pages/order/aftersale/apply', { peach.$router.go('/pages/order/aftersale/apply', {
orderId: state.orderInfo.id, orderId: state.orderInfo.id,
itemId: item.id, itemId: item.id,
}) })
@ -88,7 +95,7 @@
class="ss-reset-button apply-btn" class="ss-reset-button apply-btn"
v-if="item.afterSaleStatus === 10" v-if="item.afterSaleStatus === 10"
@tap.stop=" @tap.stop="
sheep.$router.go('/pages/order/aftersale/detail', { peach.$router.go('/pages/order/aftersale/detail', {
id: item.afterSaleId, id: item.afterSaleId,
}) })
" "
@ -99,7 +106,7 @@
class="ss-reset-button apply-btn" class="ss-reset-button apply-btn"
v-if="item.afterSaleStatus === 20" v-if="item.afterSaleStatus === 20"
@tap.stop=" @tap.stop="
sheep.$router.go('/pages/order/aftersale/detail', { peach.$router.go('/pages/order/aftersale/detail', {
id: item.afterSaleId, id: item.afterSaleId,
}) })
" "
@ -113,7 +120,7 @@
{{ item.status_text }} {{ item.status_text }}
</button> </button>
</template> </template>
</s-goods-item> </p-goods-item>
</view> </view>
</view> </view>
</view> </view>
@ -131,13 +138,13 @@
<view class="notice-item"> <view class="notice-item">
<text class="title">下单时间</text> <text class="title">下单时间</text>
<text class="detail"> <text class="detail">
{{ sheep.$helper.timeFormat(state.orderInfo.createTime, 'yyyy-mm-dd hh:MM:ss') }} {{ peach.$helper.timeFormat(state.orderInfo.createTime, 'yyyy-mm-dd hh:MM:ss') }}
</text> </text>
</view> </view>
<view class="notice-item" v-if="state.orderInfo.payTime"> <view class="notice-item" v-if="state.orderInfo.payTime">
<text class="title">支付时间</text> <text class="title">支付时间</text>
<text class="detail"> <text class="detail">
{{ sheep.$helper.timeFormat(state.orderInfo.payTime, 'yyyy-mm-dd hh:MM:ss') }} {{ peach.$helper.timeFormat(state.orderInfo.payTime, 'yyyy-mm-dd hh:MM:ss') }}
</text> </text>
</view> </view>
<view class="notice-item"> <view class="notice-item">
@ -183,8 +190,8 @@
</view> </view>
<!-- 底部按钮 --> <!-- 底部按钮 -->
<!-- TODO: 查看物流等待成团评价完后返回页面没刷新页面 -->
<su-fixed bottom placeholder bg="bg-white" v-if="state.orderInfo.buttons?.length"> <pb-fixed bottom placeholder bg="bg-white" v-if="state.orderInfo.buttons?.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" class="ss-reset-button cancel-btn"
@ -204,7 +211,7 @@
class="ss-reset-button cancel-btn" class="ss-reset-button cancel-btn"
v-if="state.orderInfo.buttons?.includes('combination')" v-if="state.orderInfo.buttons?.includes('combination')"
@tap=" @tap="
sheep.$router.go('/pages/activity/groupon/detail', { peach.$router.go('/pages/activity/groupon/detail', {
id: state.orderInfo.combinationRecordId, id: state.orderInfo.combinationRecordId,
}) })
" "
@ -232,21 +239,34 @@
> >
评价 评价
</button> </button>
<button
v-if="state.orderInfo.buttons.includes('verification')"
class="ss-reset-button cancel-btn ui-BG-Main-Gradient"
@tap.stop="onVerification(order.id)"
>
核销订单
</button>
<button
v-if="state.orderInfo.buttons.includes('delivery')"
class="ss-reset-button cancel-btn ui-BG-Main-Gradient"
@tap.stop="onDelivery(order.id)"
>
配送完成
</button>
</view> </view>
</su-fixed> </pb-fixed>
</s-layout> </pb-layout>
</template> </template>
<script setup> <script setup>
import sheep from '@/sheep' import peach from '@/peach'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { reactive } from 'vue' import { reactive } from 'vue'
import { isEmpty } from 'lodash' import { isEmpty } from 'lodash'
import { fen2yuan, formatOrderStatus, formatOrderStatusDescription, handleOrderButtons } from '@/sheep/hooks/useGoods' import { fen2yuan, formatOrderStatus, formatOrderStatusDescription, handleOrderButtons } from '@/peach/hooks/useGoods'
import OrderApi from '@/sheep/api/trade/order' import OrderApi from '@/peach/api/trade/order'
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2 const statusBarHeight = peach.$platform.device.statusBarHeight * 2
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png')
const state = reactive({ const state = reactive({
orderInfo: {}, orderInfo: {},
@ -256,19 +276,19 @@ const state = reactive({
// //
const onCopy = () => { const onCopy = () => {
sheep.$helper.copyText(state.orderInfo.sn) peach.$helper.copyText(state.orderInfo.sn)
} }
// //
function onPay(payOrderId) { function onPay(payOrderId) {
sheep.$router.go('/pages/pay/index', { peach.$router.go('/pages/pay/index', {
id: payOrderId, id: payOrderId,
}) })
} }
// //
function onGoodsDetail(id) { function onGoodsDetail(id) {
sheep.$router.go('/pages/goods/index', { peach.$router.go('/pages/goods/index', {
id, id,
}) })
} }
@ -292,7 +312,7 @@ async function onCancel(orderId) {
// //
async function onExpress(id) { async function onExpress(id) {
sheep.$router.go('/pages/order/express/log', { peach.$router.go('/pages/order/express/log', {
id, id,
}) })
} }
@ -305,7 +325,7 @@ async function onConfirm(orderId, ignore = false) {
// 2.mpConfirm,App.vueshow // 2.mpConfirm,App.vueshow
let isOpenBusinessView = true let isOpenBusinessView = true
if ( if (
sheep.$platform.name === 'WechatMiniProgram' && peach.$platform.name === 'WechatMiniProgram' &&
!isEmpty(state.orderInfo.wechat_extra_data) && !isEmpty(state.orderInfo.wechat_extra_data) &&
isOpenBusinessView && isOpenBusinessView &&
!ignore !ignore
@ -325,7 +345,7 @@ async function onConfirm(orderId, ignore = false) {
// //
function mpConfirm(orderId) { function mpConfirm(orderId) {
if (!wx.openBusinessView) { if (!wx.openBusinessView) {
sheep.$helper.toast(`请升级微信版本`) peach.$helper.toast(`请升级微信版本`)
return return
} }
wx.openBusinessView({ wx.openBusinessView({
@ -354,41 +374,30 @@ function mpConfirm(orderId) {
// //
function onComment(id) { function onComment(id) {
sheep.$router.go('/pages/goods/comment/add', { peach.$router.go('/pages/goods/comment/add', {
id, id,
}) })
} }
function onDelivery(id) {
uni.showModal({
title: '提示',
content: '确认完成配送吗?',
success: function (res) {
if (res.confirm) {
}
},
})
}
async function getOrderDetail(id) { async function getOrderDetail(id) {
// let res = await OrderApi.getOrderDetail({ id: id })
let res state.orderInfo = res.data
if (state.comeinType === 'wechat') { handleOrderButtons(state.orderInfo)
//
res = await OrderApi.getOrder(id, {
merchant_trade_no: state.merchantTradeNo,
})
} else {
res = await OrderApi.getOrder(id)
}
if (res.code === 0) {
state.orderInfo = res.data
handleOrderButtons(state.orderInfo)
} else {
sheep.$router.back()
}
} }
onLoad(async (options) => { onLoad(async (options) => {
let id = 0 await getOrderDetail(options.id)
if (options.id) {
id = options.id
}
// TODO
state.comeinType = options.comein_type
if (state.comeinType === 'wechat') {
state.merchantTradeNo = options.merchant_trade_no
}
await getOrderDetail(id)
}) })
</script> </script>
@ -412,7 +421,8 @@ onLoad(async (options) => {
.state-box { .state-box {
color: rgba(#fff, 0.9); color: rgba(#fff, 0.9);
width: 100%; width: 100%;
background: v-bind(headerBg) no-repeat, linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)); background: url('/static/order/order_bg.png') no-repeat,
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;

View File

@ -1,203 +0,0 @@
<template>
<pb-layout title="订单" navbar="normal" tabbar="/pages/order/list" :bgStyle="bgStyle" opacityBgUi="bg-white"
color="black">
<pb-sticky bgColor="#fff">
<pb-tabs :list="tabMaps" :scrollable="false" @change="onTabsChange" :current="state.currentTab" />
</pb-sticky>
<p-empty v-if="state.pagination.total === 0" icon="/static/order-empty.png" text="暂无订单" />
<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.list"
:key="order.payOrderId">
<view v-for="(sorder, sindex) in order.order" @tap="onOrderDetail(sorder.id)">
<view class="order-card-header ss-flex ss-col-center ss-row-between ss-p-x-20">
<!-- <view class="order-no">订单号{{ sorder.no }}</view> -->
<view class="order-no text-lg font-weight-bold">{{ sorder.particularName }}</view>
<view class="order-state ss-font-26" :class="formatOrderColor(sorder)">
{{ formatOrderStatus(sorder) }}
</view>
</view>
<view class="border-bottom" v-for="item in sorder.items" :key="item.id">
<p-goods-item :img="item.picUrl" :title="item.spuName"
:skuText="item.properties.map((property) => property.valueName).join(' ')" :price="item.price"
:num="item.count" />
</view>
<view class="order-card-footer ss-flex ss-col-center ss-p-x-20"
:class="sorder.buttons.length > 3 ? 'ss-row-between' : 'ss-row-right'">
<view class="ss-flex ss-col-center">
<button v-if="sorder.buttons.includes('combination')" class="tool-btn ss-reset-button"
@tap.stop="onOrderGroupon(sorder)">
拼团详情
</button>
<button v-if="sorder.buttons.length === 0" class="tool-btn ss-reset-button"
@tap.stop="onOrderDetail(sorder.id)">
查看详情
</button>
<button v-if="sorder.buttons.includes('confirm')" class="tool-btn ss-reset-button"
@tap.stop="onConfirm(sorder)">
确认收货
</button>
<button v-if="sorder.buttons.includes('express')" class="tool-btn ss-reset-button"
@tap.stop="onExpress(sorder.id)">
查看物流
</button>
<button v-if="sorder.buttons.includes('cancel')" class="tool-btn ss-reset-button"
@tap.stop="onCancel(sorder.id, sindex)">
取消订单
</button>
<button v-if="sorder.buttons.includes('comment')" class="tool-btn ss-reset-button"
@tap.stop="onComment(sorder.id)">
评价
</button>
<button v-if="sorder.buttons.includes('delete')" class="delete-btn ss-reset-button"
@tap.stop="onDelete(sorder.id)">
删除订单
</button>
</view>
</view>
<view class="pay-box ss-m-t-30 ss-flex ss-gap-40 ss-p-b-40 ss-row-right ss-p-r-20">
<view class="ss-flex ss-col-center">
<view class="discounts-title pay-color"> {{ totalNumsPerOrder(order) }} 件商品,总金额:</view>
<view class="discounts-money pay-color"> {{ fen2yuan(totalPricePerOrder(order)) }} </view>
</view>
</view>
</view>
</view>
</view>
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus"
:content-text="{ contentdown: '上拉加载更多' }" />
</pb-layout>
</template>
<script setup>
import { ref } from 'vue'
import OrderApi from '@/peach/api/trade/order'
import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import { fen2yuan, formatOrderColor, formatOrderStatus, handleOrderButtons } from '@/peach/hooks/useGoods'
import peach from '@/peach'
import _, { isEmpty } from 'lodash'
import { resetPagination } from '@/peach/utils'
const bgStyle = {
backgroundColor: '#fff',
description: '',
}
const state = ref({
currentTab: 0,
pagination: {
list: [],
total: 0,
pageNo: 1,
pageSize: 6,
},
loadStatus: '',
})
const tabMaps = [
{
name: '全部',
},
{
name: '待付款',
value: 0,
},
{
name: '待核销',
value: 50,
},
{
name: '待配送',
value: 60,
},
]
//
function totalNumsPerOrder(order) {
if (order.order.length) {
return order.order.reduce((per, cur) => {
return per + cur.productCount
}, 0)
}
}
//
function totalPricePerOrder(order) {
if (order.order.length) {
return order.order.reduce((per, cur) => {
return per + cur.payPrice
}, 0)
}
}
//
function onTabsChange(e) {
if (state.value.currentTab === e.index) {
return
}
//
resetPagination(state.value.pagination)
state.value.currentTab = e.index
getOrderList()
}
//
function onOrderDetail(id) {
peach.$router.go('/pages/order/detail', {
id,
})
}
//
async function getOrderList() {
state.value.loadStatus = 'loading'
let { data } = await OrderApi.getOrderPage({
pageNo: state.value.pagination.pageNo,
pageSize: state.value.pagination.pageSize,
status: tabMaps[state.value.currentTab].value,
})
data.list.forEach((item) => {
item.order.forEach((sitem) => {
handleOrderButtons(sitem)
})
})
state.value.pagination.list = _.concat(state.value.pagination.list, data.list)
console.log(state.value.pagination.list)
state.value.pagination.total = data.total
let currentPageTotal = state.value.pagination.list.reduce((pre, cur) => {
return pre + cur.order.length
}, 0)
state.value.loadStatus = currentPageTotal < state.value.pagination.total ? 'more' : 'noMore'
}
onLoad(async (options) => {
if (options.type) {
state.value.currentTab = options.type
}
await getOrderList()
})
//
function loadMore() {
if (state.value.loadStatus === 'noMore') {
return
}
state.value.pagination.pageNo++
getOrderList()
}
//
onReachBottom(() => {
loadMore()
})
//
onPullDownRefresh(() => {
resetPagination(state.value.pagination)
getOrderList()
setTimeout(function () {
uni.stopPullDownRefresh()
}, 800)
})
</script>

View File

@ -1,245 +1,292 @@
<template> <template>
<pb-layout class="manage-goods" title="发布商品" leftIcon="leftIcon" navbar="normal" tabbar="/pages/product/manageGoods" <pb-layout
:bgStyle="bgStyle" opacityBgUi="bg-white" color="black"> class="manage-goods"
<view class="goods-form"> title="发布商品"
<uni-forms ref="formRef" v-model="formData" :rules="rules" label-position="top" label-width="160"> leftIcon="leftIcon"
<uni-forms-item label="商品封面图" name="picUrl" required> navbar="normal"
<p-uploader v-model:url="formData.picUrl" fileMediatype="image" limit="1" mode="grid" :bgStyle="bgStyle"
:imageStyles="{ width: '168rpx', height: '168rpx' }" /> opacityBgUi="bg-white"
</uni-forms-item> color="black"
<uni-forms-item label="商品轮播图" name="sliderPicUrls" required> >
<p-uploader v-model:url="formData.sliderPicUrls" fileMediatype="image" limit="6" mode="grid" <view class="goods-form">
:imageStyles="{ width: '168rpx', height: '168rpx' }" /> <uni-forms ref="formRef" v-model="formData" :rules="rules" label-position="top" label-width="160">
</uni-forms-item> <uni-forms-item label="商品封面图" name="picUrl" required>
<uni-forms-item label="商品名称" name="name" required> <p-uploader
<uni-easyinput type="text" trim="all" v-model="formData.name" placeholder="请输入商品名称" /> v-model:url="formData.picUrl"
</uni-forms-item> fileMediatype="image"
<uni-forms-item label="商品分类" name="categoryId" label-position="left" required> limit="1"
<uni-easyinput type="text" v-model="formData.categoryId" :styles="selfStyles" placeholderStyle="color:#8a8a8a" mode="grid"
:clearable="false" :inputBorder="false" placeholder="请选择商品分类" disabled> :imageStyles="{ width: '168rpx', height: '168rpx' }"
<template v-slot:right> />
<uni-icons type="right" /> </uni-forms-item>
</template> <uni-forms-item label="商品轮播图" name="sliderPicUrls" required>
</uni-easyinput> <p-uploader
</uni-forms-item> v-model:url="formData.sliderPicUrls"
<uni-forms-item label="商品品牌" name="brandId" label-position="left" required> fileMediatype="image"
<uni-easyinput type="text" v-model="formData.brandId" :styles="selfStyles" placeholderStyle="color:#8a8a8a" limit="6"
:clearable="false" :inputBorder="false" placeholder="请选择商品品牌" disabled> mode="grid"
<template v-slot:right> :imageStyles="{ width: '168rpx', height: '168rpx' }"
<uni-icons type="right" /> />
</template> </uni-forms-item>
</uni-easyinput> <uni-forms-item label="商品名称" name="name" required>
</uni-forms-item> <uni-easyinput type="text" trim="all" v-model="formData.name" placeholder="请输入商品名称" />
<uni-forms-item label="商品规格" name="skus" label-position="left" required> </uni-forms-item>
<uni-easyinput type="text" v-model="formData.skus" :styles="selfStyles" placeholderStyle="color:#8a8a8a" <uni-forms-item label="商品分类" name="categoryId" label-position="left" required>
:clearable="false" :inputBorder="false" placeholder="请添加商品规格" disabled> <template v-slot:right> <uni-easyinput
<uni-icons type="right" /> type="text"
</template></uni-easyinput> v-model="formData.categoryId"
</uni-forms-item> :styles="selfStyles"
<uni-forms-item label="商品关键词" name="keyword" required> placeholderStyle="color:#8a8a8a"
<uni-easyinput type="text" v-model="formData.keyword" placeholder="请输入商品关键词" /> :clearable="false"
</uni-forms-item> :inputBorder="false"
<uni-forms-item label="商品简介" name="introduction" required> placeholder="请选择商品分类"
<uni-easyinput type="textarea" trim="all" autoHeight v-model="formData.introduction" placeholder="请输入商品简介" /> disabled
</uni-forms-item> >
<uni-forms-item label="物流设置" name="deliveryTypes" label-position="left" required> <template v-slot:right>
<uni-easyinput type="text" :clearable="false" :styles="selfStyles" placeholderStyle="color:#8a8a8a" <uni-icons type="right" />
:inputBorder="false" v-model="formData.keyword" placeholder="请选择配送方式" disabled> </template>
<template v-slot:right> </uni-easyinput>
<uni-icons type="right" /> </uni-forms-item>
</template> <uni-forms-item label="商品品牌" name="brandId" label-position="left" required>
</uni-easyinput> <uni-easyinput
</uni-forms-item> type="text"
</uni-forms> v-model="formData.brandId"
</view> :styles="selfStyles"
</pb-layout> placeholderStyle="color:#8a8a8a"
:clearable="false"
:inputBorder="false"
placeholder="请选择商品品牌"
disabled
>
<template v-slot:right>
<uni-icons type="right" />
</template>
</uni-easyinput>
</uni-forms-item>
<uni-forms-item label="商品规格" name="skus" label-position="left" required>
<uni-easyinput
type="text"
v-model="formData.skus"
:styles="selfStyles"
placeholderStyle="color:#8a8a8a"
:clearable="false"
:inputBorder="false"
placeholder="请添加商品规格"
disabled
>
<template v-slot:right>
<uni-icons type="right" /> </template
></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="商品关键词" name="keyword" required>
<uni-easyinput type="text" v-model="formData.keyword" placeholder="请输入商品关键词" />
</uni-forms-item>
<uni-forms-item label="商品简介" name="introduction" required>
<uni-easyinput
type="textarea"
trim="all"
autoHeight
v-model="formData.introduction"
placeholder="请输入商品简介"
/>
</uni-forms-item>
<uni-forms-item label="物流设置" name="deliveryTypes" label-position="left" required>
<uni-easyinput
type="text"
:clearable="false"
:styles="selfStyles"
placeholderStyle="color:#8a8a8a"
:inputBorder="false"
v-model="formData.keyword"
placeholder="请选择配送方式"
disabled
>
<template v-slot:right>
<uni-icons type="right" />
</template>
</uni-easyinput>
</uni-forms-item>
</uni-forms>
</view>
</pb-layout>
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app'
import peach from '@/peach'; import peach from '@/peach'
import GoodsApi from '@/peach/api/trade/goods'; import GoodsApi from '@/peach/api/trade/goods'
import _ from 'lodash'; import _ from 'lodash'
const bgStyle = { const bgStyle = {
backgroundImage: '', backgroundImage: '',
backgroundColor: '#fff', backgroundColor: '#fff',
description: '', description: '',
} }
const selfStyles = { const selfStyles = {
backgroundColor: '#f9f9f9' backgroundColor: '#f9f9f9',
} }
const formData = ref({ const formData = ref({
picUrl: 'http://101.43.181.163:9001/mall-backend/8f11e372520501531d06bfce15ea97bbecead41c5e4a36d15d7e40af85729ff3.png', picUrl: 'http://101.43.181.163:9001/mall-backend/8f11e372520501531d06bfce15ea97bbecead41c5e4a36d15d7e40af85729ff3.png',
sliderPicUrls: [ sliderPicUrls: [
'http://101.43.181.163:9001/mall-backend/8f11e372520501531d06bfce15ea97bbecead41c5e4a36d15d7e40af85729ff3.png', 'http://101.43.181.163:9001/mall-backend/8f11e372520501531d06bfce15ea97bbecead41c5e4a36d15d7e40af85729ff3.png',
'http://101.43.181.163:9001/mall-backend/8f11e372520501531d06bfce15ea97bbecead41c5e4a36d15d7e40af85729ff3.png', 'http://101.43.181.163:9001/mall-backend/8f11e372520501531d06bfce15ea97bbecead41c5e4a36d15d7e40af85729ff3.png',
'http://101.43.181.163:9001/mall-backend/8f11e372520501531d06bfce15ea97bbecead41c5e4a36d15d7e40af85729ff3.png', 'http://101.43.181.163:9001/mall-backend/8f11e372520501531d06bfce15ea97bbecead41c5e4a36d15d7e40af85729ff3.png',
], ],
name: '测试商品', name: '测试商品',
categoryId: 91, categoryId: 91,
brandId: 4, brandId: 4,
keyword: '香酥鸭,但家', keyword: '香酥鸭,但家',
deliveryTypes: [3], deliveryTypes: [3],
introduction: '但家贵阳香酥鸭现榨香酥鸭无任何添加剂香酥鸭但家贵阳香酥鸭现榨香酥鸭无任何添加剂香酥鸭' introduction: '但家贵阳香酥鸭现榨香酥鸭无任何添加剂香酥鸭但家贵阳香酥鸭现榨香酥鸭无任何添加剂香酥鸭',
}); })
const rules = { const rules = {
name: { name: {
rules: [ rules: [
{ {
required: true, required: true,
errorMessage: '请输入商品名称', errorMessage: '请输入商品名称',
}, },
], ],
}, },
picUrl: { picUrl: {
rules: [ rules: [
{ {
required: true, required: true,
errorMessage: '请上传商品封面图', errorMessage: '请上传商品封面图',
}, },
], ],
}, },
sliderPicUrls: { sliderPicUrls: {
rules: [ rules: [
{ {
required: true, required: true,
errorMessage: '请上传商品轮播图', errorMessage: '请上传商品轮播图',
}, },
], ],
}, },
categoryId: { categoryId: {
rules: [ rules: [
{ {
required: true, required: true,
errorMessage: '请选择商品分类', errorMessage: '请选择商品分类',
}, },
], ],
}, },
brandId: { brandId: {
rules: [ rules: [
{ {
required: true, required: true,
errorMessage: '请选择商品品牌', errorMessage: '请选择商品品牌',
}, },
], ],
}, },
skus: { skus: {
rules: [ rules: [
{ {
required: true, required: true,
errorMessage: '请选择商品规格', errorMessage: '请选择商品规格',
}, },
], ],
}, },
keyword: { keyword: {
rules: [ rules: [
{ {
required: true, required: true,
errorMessage: '请输入商品关键字', errorMessage: '请输入商品关键字',
}, },
], ],
}, },
introduction: { introduction: {
rules: [ rules: [
{ {
required: true, required: true,
errorMessage: '请输入商品简介', errorMessage: '请输入商品简介',
}, },
], ],
}, },
deliveryTypes: { deliveryTypes: {
rules: [ rules: [
{ {
required: true, required: true,
errorMessage: '请选择商品物流', errorMessage: '请选择商品物流',
}, },
] ],
} },
}; }
const formRef = ref(null); const formRef = ref(null)
function onSubmit() { function onSubmit() {
console.log('res', formData.value)
console.log('res', formData.value); formRef.value
.validate()
.then(async (res) => {
let tempObj = { ...res }
formRef.value if (formData.value.id) {
.validate() tempObj.id = formData.value.id
.then(async (res) => { await GoodsApi.editProduct(tempObj)
let tempObj = { ...res }; } else {
await GoodsApi.addProduct(tempObj)
}
if (formData.value.id) { })
tempObj.id = formData.value.id; .catch((err) => {
await GoodsApi.editProduct(tempObj); console.log('err', err)
} else { })
await GoodsApi.addProduct(tempObj);
}
})
.catch((err) => {
console.log('err', err);
});
} }
// //
function getGoodsInfo() { function getGoodsInfo() {}
}
onLoad((options) => { onLoad((options) => {
if (options.id) { if (options.id) {
getProduct(); getProduct()
} }
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.manage-goods { .manage-goods {
.goods-form { .goods-form {
margin: 40rpx; margin: 40rpx;
:deep() { :deep() {
.uni-easyinput__content-input { .uni-easyinput__content-input {
font-size: 28rpx !important; font-size: 28rpx !important;
color: #333333 !important; color: #333333 !important;
line-height: normal !important; line-height: normal !important;
} }
.uni-easyinput__placeholder-class { .uni-easyinput__placeholder-class {
font-size: 14px; font-size: 14px;
} }
.is-direction-left { .is-direction-left {
.uni-forms-item__label {
padding-left: 10px;
background-color: #f9f9f9;
border-radius: 10px 0 0 10px;
}
.uni-forms-item__label { uni-icons {
padding-left: 10px; margin-right: 10px;
background-color: #f9f9f9; }
border-radius: 10px 0 0 10px;
.uni-easyinput__content {
border-radius: 0 10px 10px 0;
}
}
.is-disabled {
color: #333333;
text-align: right;
}
} }
uni-icons {
margin-right: 10px;
}
.uni-easyinput__content {
border-radius: 0 10px 10px 0;
}
}
.is-disabled {
color: #333333;
text-align: right;
}
} }
}
} }
</style> </style>

View File

@ -1,49 +1,62 @@
<template> <template>
<pb-layout navbar="inner" class="wallet-wrap" iconColor="#fff" leftIcon="leftIcon" color="#fff" title="余额" <pb-layout
:bgStyle="bgStyle"> navbar="inner"
<view class="header-box ss-row-center ss-col-center"> class="wallet-wrap"
<view class="card-box ui-BG-Main ui-Shadow-Main ss-flex ss-row-between ss-col-center"> iconColor="#fff"
<view class="ss-flex ss-flex-col ss-row-between ss-col-top ss-gap-40"> leftIcon="leftIcon"
<view class="card-head ss-flex ss-col-center"> color="#fff"
<view class="card-title ss-m-r-10">账户余额</view> title="余额"
<view @tap="state.showMoney = !state.showMoney" class="ss-eye-icon" :bgStyle="bgStyle"
:class="state.showMoney ? 'cicon-eye' : 'cicon-eye-off'" /> >
</view> <view class="header-box ss-row-center ss-col-center">
<view class="card-box ss-flex ss-row-between ss-col-center">
<view class="ss-flex ss-flex-col ss-row-between ss-col-top ss-gap-40">
<view class="card-head ss-flex ss-col-center">
<view class="card-title ss-m-r-10">账户余额</view>
<view
@tap="state.showMoney = !state.showMoney"
class="ss-eye-icon"
:class="state.showMoney ? 'cicon-eye' : 'cicon-eye-off'"
/>
</view>
<view class="money-num">{{ state.showMoney ? fen2yuan(userWallet.balance) : '*****' }}</view> <view class="money-num">{{ state.showMoney ? fen2yuan(userWallet.balance) : '*****' }}</view>
</view> </view>
<button class="ss-reset-button topup-btn" @tap="peach.$router.go('/pages/user/wallet/withdraw')"> <button class="ss-reset-button topup-btn" @tap="peach.$router.go('/pages/user/wallet/withdraw')">
提现 提现
</button> </button>
</view>
</view>
<p-empty v-if="state.pagination.total === 0" :marginTop="40" text="暂无数据" icon="/static/data-empty.png" />
<!-- 钱包记录 -->
<view v-if="state.pagination.total > 0">
<view class="wallet-list ss-flex border-bottom" v-for="item in state.pagination.list" :key="item.id">
<view class="list-content">
<view class="title-box ss-flex ss-row-between ss-m-b-20">
<text class="title ss-line-1">
{{ item.title }}
</text>
<view class="money">
<text v-if="item.price >= 0" class="add">+{{ fen2yuan(item.price) }}</text>
<text v-else class="minus">{{ fen2yuan(item.price) }}</text>
</view> </view>
</view>
<text class="time">
{{ peach.$helper.timeFormat(state.createTime, 'yyyy-mm-dd hh:MM:ss') }}
</text>
</view> </view>
</view>
</view> <p-empty v-if="state.pagination.total === 0" :marginTop="40" text="暂无数据" icon="/static/data-empty.png" />
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
contentdown: '上拉加载更多', <!-- 钱包记录 -->
}" /> <view v-if="state.pagination.total > 0">
</pb-layout> <view class="wallet-list ss-flex border-bottom" v-for="item in state.pagination.list" :key="item.id">
<view class="list-content">
<view class="title-box ss-flex ss-row-between ss-m-b-20">
<text class="title ss-line-1">
{{ item.title }}
</text>
<view class="money">
<text v-if="item.price >= 0" class="add">+{{ fen2yuan(item.price) }}</text>
<text v-else class="minus">{{ fen2yuan(item.price) }}</text>
</view>
</view>
<text class="time">
{{ peach.$helper.timeFormat(state.createTime, 'yyyy-mm-dd hh:MM:ss') }}
</text>
</view>
</view>
</view>
<uni-load-more
v-if="state.pagination.total > 0"
:status="state.loadStatus"
:content-text="{
contentdown: '上拉加载更多',
}"
/>
</pb-layout>
</template> </template>
<script setup> <script setup>
@ -57,207 +70,203 @@ import { fen2yuan } from '@/peach/hooks/useGoods'
import { resetPagination } from '@/peach/utils' import { resetPagination } from '@/peach/utils'
const bgStyle = { const bgStyle = {
backgroundImage: '/static/bg-page.png', backgroundImage: '/static/bg-page.png',
imageType: 'local', imageType: 'local',
backgroundColor: '#fff', backgroundColor: '#fff',
description: '', description: '',
} }
// const headerBg = peach.$url.css('/static/img/shop/user/wallet_card_bg.png') // const headerBg = peach.$url.css('/static/img/shop/user/wallet_card_bg.png')
// //
const state = reactive({ const state = reactive({
showMoney: false, showMoney: false,
pagination: { pagination: {
list: [], list: [],
total: 0, total: 0,
pageNo: 1, pageNo: 1,
pageSize: 8, pageSize: 8,
}, },
loadStatus: '', loadStatus: '',
}) })
const userWallet = computed(() => peach.$store('user').userWallet) const userWallet = computed(() => peach.$store('user').userWallet)
// //
async function getLogList() { async function getLogList() {
state.loadStatus = 'loading' state.loadStatus = 'loading'
// const { data, code } = await PayWalletApi.getWalletTransactionPage({ // const { data, code } = await PayWalletApi.getWalletTransactionPage({
// pageNo: state.pagination.pageNo, // pageNo: state.pagination.pageNo,
// pageSize: state.pagination.pageSize, // pageSize: state.pagination.pageSize,
// }) // })
// state.pagination.list = _.concat(state.pagination.list, data.list) // state.pagination.list = _.concat(state.pagination.list, data.list)
// state.pagination.total = data.total // state.pagination.total = data.total
// state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore' // state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore'
} }
onLoad(() => { onLoad(() => {
getLogList() getLogList()
// //
// peach.$store('user').getWallet() // peach.$store('user').getWallet()
}) })
onReachBottom(() => { onReachBottom(() => {
if (state.loadStatus === 'noMore') { if (state.loadStatus === 'noMore') {
return return
} }
state.pagination.pageNo++ state.pagination.pageNo++
getLogList() getLogList()
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.header-box { .header-box {
.card-box { .card-box {
width: 100%; width: 100%;
min-height: 250rpx; min-height: 250rpx;
padding: 0 40rpx; padding: 0 40rpx;
background-size: 100% 100%; background-size: 100% 100%;
border-radius: 30rpx; border-radius: 30rpx;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
z-index: 1; z-index: 1;
box-sizing: border-box; box-sizing: border-box;
.card-head { .card-head {
color: $white; color: $white;
font-size: 30rpx; font-size: 30rpx;
} }
.ss-eye-icon { .ss-eye-icon {
font-size: 40rpx; font-size: 40rpx;
color: $white; color: $white;
} }
.money-num { .money-num {
font-size: 70rpx; font-size: 70rpx;
line-height: 70rpx; line-height: 70rpx;
font-weight: 500; font-weight: 500;
color: $white; color: $white;
font-family: OPPOSANS; font-family: OPPOSANS;
} }
.reduce-num { .reduce-num {
font-size: 26rpx; font-size: 26rpx;
font-weight: 400; font-weight: 400;
color: $white; color: $white;
} }
.topup-btn { .topup-btn {
width: 150rpx; width: 150rpx;
height: 60rpx; height: 60rpx;
line-height: 60rpx; line-height: 60rpx;
border-radius: 30px; border-radius: 30px;
font-size: 26rpx; font-size: 26rpx;
font-weight: 500; font-weight: 500;
background-color: $white; background-color: $white;
color: var(--ui-BG-Main); color: var(--ui-BG-Main);
}
} }
}
} }
// //
.filter-box { .filter-box {
height: 114rpx; height: 114rpx;
background-color: $bg-page; background-color: $bg-page;
.total-box { .total-box {
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
color: $dark-9; color: $dark-9;
} }
.date-btn { .date-btn {
background-color: $white; background-color: $white;
line-height: 54rpx; line-height: 54rpx;
border-radius: 27rpx; border-radius: 27rpx;
padding: 0 20rpx; padding: 0 20rpx;
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
color: $dark-6; color: $dark-6;
.ss-seldate-icon { .ss-seldate-icon {
font-size: 50rpx; font-size: 50rpx;
color: $dark-9; color: $dark-9;
}
} }
}
} }
// tab // tab
.wallet-tab-card { .wallet-tab-card {
.tab-item { .tab-item {
height: 80rpx; height: 80rpx;
position: relative; position: relative;
.tab-title { .tab-title {
font-size: 30rpx; font-size: 30rpx;
} }
.cur-tab-title { .cur-tab-title {
font-weight: $font-weight-bold; font-weight: $font-weight-bold;
} }
.tab-line { .tab-line {
width: 60rpx; width: 60rpx;
height: 6rpx; height: 6rpx;
border-radius: 6rpx; border-radius: 6rpx;
position: absolute; position: absolute;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
bottom: 2rpx; bottom: 2rpx;
background-color: var(--ui-BG-Main); background-color: var(--ui-BG-Main);
}
} }
}
} }
// //
.wallet-list { .wallet-list {
padding: 30rpx; padding: 30rpx;
background-color: #ffff; background-color: #ffff;
.head-img { .head-img {
width: 70rpx; width: 70rpx;
height: 70rpx; height: 70rpx;
border-radius: 50%; border-radius: 50%;
background: $gray-c; background: $gray-c;
}
.list-content {
justify-content: space-between;
align-items: flex-start;
flex: 1;
.title {
font-size: 28rpx;
color: $dark-3;
width: 400rpx;
} }
.time { .list-content {
color: $gray-c; justify-content: space-between;
font-size: 22rpx; align-items: flex-start;
} flex: 1;
}
.money { .title {
font-size: 28rpx; font-size: 28rpx;
font-weight: bold; color: $dark-3;
font-family: OPPOSANS; width: 400rpx;
}
.add { .time {
color: var(--ui-BG-Main); color: $gray-c;
font-size: 22rpx;
}
} }
.minus { .money {
color: $dark-3; font-size: 28rpx;
font-weight: bold;
font-family: OPPOSANS;
.add {
color: var(--ui-BG-Main);
}
.minus {
color: $dark-3;
}
} }
}
} }
</style> </style>

View File

@ -1,30 +1,38 @@
import request from "@/peach/request"; import request from '@/peach/request'
const GoodsApi = { const GoodsApi = {
// 商品详情 // 商品列表
getProduct: (data) => { getProductList: (data) => {
return request({ return request({
url: "/trade/order/page", url: '/product/spu/page',
method: "GET", method: 'GET',
params: data, params: data,
}); })
}, },
// 添加商品 // 商品详情 spuIds
addProduct: (data) => { getProduct: (data) => {
return request({ return request({
url: "/trade/order/page", url: '/product/spu/list',
method: "POST", method: 'GET',
data, params: data,
}); })
}, },
// 修改商品 // 添加商品
editProduct: (data) => { addProduct: (data) => {
return request({ return request({
url: "/trade/order/page", url: '/trade/order/page',
method: "POST", method: 'POST',
data, data,
}); })
}, },
}; // 修改商品
editProduct: (data) => {
return request({
url: '/trade/order/page',
method: 'POST',
data,
})
},
}
export default GoodsApi; export default GoodsApi

View File

@ -1,14 +1,23 @@
import request from "@/peach/request"; import request from '@/peach/request'
const OrderUtil = { const OrderUtil = {
// 获取订单列表 // 获取订单列表
getOrderPage: (data) => { getOrderPage: (data) => {
return request({ return request({
url: "/trade/order/page", url: '/trade/order/page',
method: "GET", method: 'GET',
params: data, params: data,
}); })
}, },
};
export default OrderUtil; // 订单详情
getOrderDetail: (data) => {
return request({
url: '/trade/order/get-detail',
method: 'GET',
params: data,
})
},
}
export default OrderUtil

View File

@ -1,176 +1,210 @@
<template> <template>
<view class="ss-goods-wrap"> <view class="ss-goods-wrap">
<view v-if="size === 'lg'" class="lg-goods-card ss-flex ss-col-stretch" :style="[elStyles]" @click="onClick"> <view v-if="size === 'lg'" class="lg-goods-card ss-flex ss-col-stretch" :style="[elStyles]" @click="onClick">
<image class="lg-img-box" :src="peach.$url.cdn(data.image || data.picUrl)" mode="aspectFill"></image> <image class="lg-img-box" :src="peach.$url.cdn(data.image || data.picUrl)" mode="aspectFill"></image>
<view class="lg-goods-content ss-flex-1 ss-flex-col ss-row-between ss-p-b-10 ss-p-t-20"> <view class="lg-goods-content ss-flex-1 ss-flex-col ss-row-between ss-p-b-10 ss-p-t-20">
<view> <view>
<view v-if="goodsFields.title?.show || goodsFields.name?.show" class="lg-goods-title ss-line-2" <view
:style="[{ color: titleColor }]"> v-if="goodsFields.title?.show || goodsFields.name?.show"
{{ data.title || data.name }} class="lg-goods-title ss-line-2"
</view> :style="[{ color: titleColor }]"
<view v-if="goodsFields.subtitle?.show || goodsFields.introduction?.show" >
class="lg-goods-subtitle ss-m-t-10 ss-line-1" {{ data.title || data.name }}
:style="[{ color: subTitleColor, background: subTitleBackground }]"> </view>
{{ data.subtitle || data.introduction }} <view
</view> v-if="goodsFields.subtitle?.show || goodsFields.introduction?.show"
</view> class="lg-goods-subtitle ss-m-t-10 ss-line-1"
<view> :style="[{ color: subTitleColor, background: subTitleBackground }]"
<view class="ss-flex ss-col-bottom ss-m-t-10"> >
<view v-if="goodsFields.price?.show" class="lg-goods-price ss-m-r-12 ss-flex ss-col-bottom font-OPPOSANS" {{ data.subtitle || data.introduction }}
:style="[{ color: goodsFields.price.color }]"> </view>
<text class="ss-font-24">{{ priceUnit }}</text> </view>
{{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }} <view>
<view class="ss-flex ss-col-bottom ss-m-t-10">
<view
v-if="goodsFields.price?.show"
class="lg-goods-price ss-m-r-12 ss-flex ss-col-bottom font-OPPOSANS"
:style="[{ color: goodsFields.price.color }]"
>
<text class="ss-font-24">{{ priceUnit }}</text>
{{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
</view>
<view
v-if="
(goodsFields.original_price?.show || goodsFields.marketPrice?.show) &&
(data.original_price > 0 || data.marketPrice > 0)
"
class="goods-origin-price ss-flex ss-col-bottom font-OPPOSANS"
:style="[{ color: originPriceColor }]"
>
<text class="price-unit ss-font-20">{{ priceUnit }}</text>
<view class="ss-m-l-8">{{ fen2yuan(data.marketPrice) }}</view>
</view>
</view>
<view class="ss-m-t-8 ss-flex ss-col-center ss-flex-wrap">
<view class="sales-text">{{ salesAndStock }}</view>
</view>
</view>
</view> </view>
<view
v-if="(goodsFields.original_price?.show || goodsFields.marketPrice?.show) && (data.original_price > 0 || data.marketPrice > 0)"
class="goods-origin-price ss-flex ss-col-bottom font-OPPOSANS" :style="[{ color: originPriceColor }]">
<text class="price-unit ss-font-20">{{ priceUnit }}</text>
<view class="ss-m-l-8">{{ fen2yuan(data.marketPrice) }}</view>
</view>
</view>
<view class="ss-m-t-8 ss-flex ss-col-center ss-flex-wrap">
<view class="sales-text">{{ salesAndStock }}</view>
</view>
</view> </view>
</view> <view class="ss-flex ss-row-around" :style="btnStyles">
<view> <button class="ss-reset-button btn-group">详情</button>
<button>详情</button> <button class="ss-reset-button btn-group">编辑</button>
<button>编辑</button> <button class="ss-reset-button btn-group btn-del">删除</button>
<button>删除</button> </view>
</view>
</view> </view>
</view>
</template> </template>
<script setup> <script setup>
import peach from '@/peach'
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import { isArray } from 'lodash'; import { isArray } from 'lodash'
import { fen2yuan, formatSales, formatStock } from '@/peach/hooks/useGoods'; import { fen2yuan, formatSales, formatStock } from '@/peach/hooks/useGoods'
const props = defineProps({ const props = defineProps({
goodsFields: { goodsFields: {
type: [Array, Object], type: [Array, Object],
default() { default() {
return { return {
price: { show: true }, price: { show: true },
stock: { show: true }, stock: { show: true },
name: { show: true }, name: { show: true },
introduction: { show: true }, introduction: { show: true },
marketPrice: { show: true }, marketPrice: { show: true },
salesCount: { show: true } salesCount: { show: true },
} }
} },
}, },
data: { data: {
type: Object, type: Object,
default: {} default: {},
}, },
size: { size: {
type: String, type: String,
default: '' default: '',
}, },
topRadius: { originPriceColor: {
type: Number, type: String,
default: 0, default: '#C4C4C4',
}, },
bottomRadius: { topRadius: {
type: Number, type: Number,
default: 0, default: 0,
}, },
priceUnit: { bottomRadius: {
type: String, type: Number,
default: '¥', default: 0,
}, },
titleColor: { priceUnit: {
type: String, type: String,
default: '#333', default: '¥',
}, },
subTitleColor: { titleColor: {
type: String, type: String,
default: '#999999', default: '#333',
}, },
subTitleBackground: { subTitleColor: {
type: String, type: String,
default: '', default: '#999999',
}, },
subTitleBackground: {
type: String,
default: '',
},
}) })
const emits = defineEmits(['click']) const emits = defineEmits(['click'])
function onClick() { function onClick() {
emits('click') emits('click')
} }
const elStyles = computed(() => { const elStyles = computed(() => {
return { return {
background: props.background, background: props.background,
'border-top-left-radius': props.topRadius + 'px', 'border-top-left-radius': props.topRadius + 'px',
'border-top-right-radius': props.topRadius + 'px', 'border-top-right-radius': props.topRadius + 'px',
'border-bottom-left-radius': props.bottomRadius + 'px', }
'border-bottom-right-radius': props.bottomRadius + 'px', })
}
const btnStyles = computed(() => {
return {
background: '#fff',
'border-bottom-left-radius': props.bottomRadius + 'px',
'border-bottom-right-radius': props.bottomRadius + 'px',
padding: '8px 0',
}
}) })
// //
const salesAndStock = computed(() => { const salesAndStock = computed(() => {
let text = []; let text = []
if (props.goodsFields.salesCount?.show) { if (props.goodsFields.salesCount?.show) {
text.push(formatSales(props.data.sales_show_type, props.data.salesCount)); text.push(formatSales(props.data.sales_show_type, props.data.salesCount))
} }
if (props.goodsFields.stock?.show) { if (props.goodsFields.stock?.show) {
text.push(formatStock(props.data.stock_show_type, props.data.stock)); text.push(formatStock(props.data.stock_show_type, props.data.stock))
} }
return text.join(' | '); return text.join(' | ')
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.lg-goods-card { .ss-goods-wrap {
overflow: hidden; .lg-goods-card {
position: relative; overflow: hidden;
z-index: 1; position: relative;
background-color: $white; z-index: 1;
height: 280rpx; background-color: $white;
height: 280rpx;
.lg-img-box { .lg-img-box {
width: 280rpx; width: 280rpx;
height: 280rpx; height: 280rpx;
margin-right: 20rpx; margin-right: 20rpx;
} }
.lg-goods-title { .lg-goods-title {
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
color: #333333; color: #333333;
// line-height: 36rpx; // line-height: 36rpx;
// width: 410rpx; // width: 410rpx;
} }
.lg-goods-subtitle { .lg-goods-subtitle {
font-size: 24rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
color: #999999; color: #999999;
// line-height: 30rpx; // line-height: 30rpx;
// width: 410rpx; // width: 410rpx;
} }
.lg-goods-price { .lg-goods-price {
font-size: 30rpx; font-size: 30rpx;
color: $red; color: $red;
line-height: 36rpx; line-height: 36rpx;
} }
.buy-box { .sales-text {
position: absolute; display: table;
bottom: 20rpx; font-size: 24rpx;
right: 20rpx; transform: scale(0.8);
z-index: 2; margin-left: 0rpx;
width: 120rpx; color: #c4c4c4;
height: 50rpx; }
background: linear-gradient(90deg, #fe8900, #ff5e00); }
border-radius: 25rpx; .btn-group {
font-size: 24rpx; width: 120rpx;
color: #ffffff; height: 50rpx;
} background: var(--ui-BG-1);
border-radius: 25rpx;
font-size: 24rpx;
color: #000;
}
.btn-del {
color: var(--ui-BG-Main);
background-color: var(--ui-BG-Main-opacity-1);
}
} }
</style> </style>

View File

@ -8,7 +8,7 @@
:style="[{ borderRadius: radius + 'rpx', marginBottom: marginBottom + 'rpx' }]" :style="[{ borderRadius: radius + 'rpx', marginBottom: marginBottom + 'rpx' }]"
> >
<view class="img-box ss-m-r-24"> <view class="img-box ss-m-r-24">
<image class="order-img" :src="sheep.$url.cdn(img)" mode="aspectFill"></image> <image class="order-img" :src="peach.$url.cdn(img)" mode="aspectFill"></image>
</view> </view>
<view <view
class="box-right ss-flex-col ss-row-between" class="box-right ss-flex-col ss-row-between"

View File

@ -1,5 +1,32 @@
import { ref } from 'vue' import { ref } from 'vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { formatDate } from '@/peach/utils'
/**
* 格式化数字
* @param {string} prefix 前缀
* @param {'exact' | string} type 格式类型exact=精确值其它=大致数量
* @param {number} num 销量
* @return {string} 格式化后的销量字符串
*/
export function formatNum(prefix, type, num) {
num = num || 0
// 情况一:精确数值
if (type === 'exact') {
return prefix + num
}
// 情况二:小于等于 10
if (num < 10) {
return `${prefix}≤10`
}
// 情况三:大于 10除第一位外其它位都显示为0
// 例如100 - 199 显示为 100+
// 9000 - 9999 显示为 9000+
const numStr = num.toString()
const first = numStr[0]
const other = '0'.repeat(numStr.length - 1)
return `${prefix}${first}${other}+`
}
/** /**
* 将分转成元 * 将分转成元
@ -32,6 +59,31 @@ export function formatStock(type, num) {
return formatNum('库存', type, num) return formatNum('库存', type, num)
} }
export function formatOrderStatusDescription(order) {
if (order.status === 0) {
if (!order.payExpireTime) {
return '当前支付已过期'
}
return `请在 ${formatDate(order.payExpireTime)} 前完成支付`
}
if (order.status === 10) {
return '商家未发货,请耐心等待'
}
if (order.status === 20) {
return '商家已发货,请耐心等待'
}
if (order.status === 30 && !order.commentStatus) {
return '已收货,快去评价一下吧'
}
if (order.status === 30 && order.commentStatus) {
return '交易完成,感谢您的支持'
}
if (order.status === 50) {
return '请及时到店核销商品'
}
return '交易关闭'
}
export function formatOrderStatus(order) { export function formatOrderStatus(order) {
if (order.status === 0) { if (order.status === 0) {
return '待付款' return '待付款'
@ -105,6 +157,14 @@ export function handleOrderButtons(order) {
} }
if (order.status === 40) { if (order.status === 40) {
// 删除订单 // 删除订单
order.buttons.push('delete') // order.buttons.push('delete')
}
if (order.status === 50) {
// 核销订单
order.buttons.push('verification')
}
if (order.status === 60) {
// 配送完成
order.buttons.push('delivery')
} }
} }

View File

@ -19,6 +19,40 @@
} }
} }
@each $value in ('', '-1', '-2', '-3', '-4') {
// 背景色 + 文字色 白色 + 默认色
.ui-BG#{$value} {
background-color: var(--ui-BG#{$value}) !important;
color: var(--ui-TC);
}
// 文字颜色
.ui-TC#{$value} {
color: var(--ui-TC#{$value}) !important;
}
// 主题色背景
.ui-BG-Main#{$value} {
background-color: var(--ui-BG-Main#{$value}) !important;
color: var(--ui-BG-Main-TC) !important;
}
// 主题色渐变横向
.ui-BG-Main-Gradient {
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)) !important;
color: var(--ui-BG-Main-TC) !important;
}
// 主题色文字
.ui-TC-Main#{$value} {
color: var(--ui-BG-Main#{$value}) !important;
}
// 主题色阴影
.ui-Shadow-Main {
box-shadow: var(--ui-Main-box-shadow) !important;
}
.ui-BG-Main-light {
background: var(----ui-BG-Main-light) !important;
color: var(--ui-BG-Main#{$value}) !important;
}
}
@each $color, $value in $colors { @each $color, $value in $colors {
.main-#{$color} { .main-#{$color} {
--ui-BG-Main: #{$value}; --ui-BG-Main: #{$value};

View File

@ -1,182 +1,181 @@
import { ref } from "vue"; import { ref } from 'vue'
import { defineStore } from "pinia"; import { defineStore } from 'pinia'
import $platform from "@/peach/platform"; import $platform from '@/peach/platform'
import $router from "@/peach/router"; import $router from '@/peach/router'
import useSysStore from "./sys"; import useSysStore from './sys'
const useAppStore = defineStore( const useAppStore = defineStore(
"app", 'app',
() => { () => {
/** /**
* @description 应用信息 * @description 应用信息
* @param string name 应用名称 * @param string name 应用名称
* @param string logo 应用logo * @param string logo 应用logo
* @param string version 应用版本 * @param string version 应用版本
* @param string copyright 版权信息 * @param string copyright 版权信息
* @param string copyrightTime 版权时间 * @param string copyrightTime 版权时间
* @param string cdnurl 静态资源域名 * @param string cdnurl 静态资源域名
* @param string filesystem 文件系统 * @param string filesystem 文件系统
*/ */
const info = ref({ const info = ref({
name: "", name: '',
logo: "", logo: '',
version: "", version: '',
copyright: "", copyright: '',
copytime: "", copytime: '',
cdnurl: "", cdnurl: '',
filesystem: "", filesystem: '',
}); })
/** /**
* @description 平台信息 * @description 平台信息
* @param Array share.methods 分享方式 * @param Array share.methods 分享方式
* @param Object share.forwardInfo 转发信息 * @param Object share.forwardInfo 转发信息
* @param Object share.posterInfo 海报信息 * @param Object share.posterInfo 海报信息
* @param string share.linkAddress 分享链接地址 * @param string share.linkAddress 分享链接地址
* @param number bindMobile 绑定手机号提醒 0: 提醒 1: 不提醒 * @param number bindMobile 绑定手机号提醒 0: 提醒 1: 不提醒
*/ */
const platform = ref({ const platform = ref({
share: { share: {
methods: [], methods: [],
forwardInfo: {}, forwardInfo: {},
posterInfo: {}, posterInfo: {},
linkAddress: "", linkAddress: '',
},
bindMobile: 0,
});
const chat = ref({});
/**
* @description 模板信息
* @param Object basic 基础模板
* @param Object tabbar 底部导航模板
*/
const template = ref({
basic: {
tabbar: {
items: [
{
activeIconUrl: "/static/a-index.png",
iconUrl: "/static/index.png",
text: "首页",
url: "/pages/index/index",
}, },
{ bindMobile: 0,
activeIconUrl: "/static/a-product.png", })
iconUrl: "/static/product.png",
text: "产品", const chat = ref({})
url: "/pages/index/product",
/**
* @description 模板信息
* @param Object basic 基础模板
* @param Object tabbar 底部导航模板
*/
const template = ref({
basic: {
tabbar: {
items: [
{
activeIconUrl: '/static/a-index.png',
iconUrl: '/static/index.png',
text: '首页',
url: '/pages/index/index',
},
{
activeIconUrl: '/static/a-product.png',
iconUrl: '/static/product.png',
text: '产品',
url: '/pages/index/product',
},
{
activeIconUrl: '/static/a-order.png',
iconUrl: '/static/order.png',
text: '订单',
url: '/pages/index/order',
},
{
activeIconUrl: '/static/a-my.png',
iconUrl: '/static/my.png',
text: '我的',
url: '/pages/index/my',
},
{
activeIconUrl: 'http://mall.yudao.iocoder.cn/static/images/4-002.png',
iconUrl: 'http://mall.yudao.iocoder.cn/static/images/4-001.png',
text: 'icons',
url: '/pages/index/icons',
},
],
style: {
activeColor: '#fc4141',
bgColor: '#fff',
bgType: 'color',
color: '#282828',
},
theme: 'red',
},
}, },
{ })
activeIconUrl: "/static/a-order.png",
iconUrl: "/static/order.png",
text: "订单",
url: "/pages/order/list",
},
{
activeIconUrl: "/static/a-my.png",
iconUrl: "/static/my.png",
text: "我的",
url: "/pages/index/my",
},
{
activeIconUrl:
"http://mall.yudao.iocoder.cn/static/images/4-002.png",
iconUrl: "http://mall.yudao.iocoder.cn/static/images/4-001.png",
text: "icons",
url: "/pages/index/icons",
},
],
style: {
activeColor: "#fc4141",
bgColor: "#fff",
bgType: "color",
color: "#282828",
},
theme: "red",
},
},
});
// 全局分享信息 // 全局分享信息
const shareInfo = ref({}); const shareInfo = ref({})
// 小程序发货信息管理 0: 没有 1 // 小程序发货信息管理 0: 没有 1
const hasWechatTradeManaged = ref(0); const hasWechatTradeManaged = ref(0)
/** /**
* @author Ankkaya * @author Ankkaya
* @description 小程序初始化 * @description 小程序初始化
* @param {Type} - * @param {Type} -
* @returns {Type} * @returns {Type}
*/ */
async function init() { async function init() {
// 检查网络 // 检查网络
const networkStatus = await $platform.checkNetwork(); const networkStatus = await $platform.checkNetwork()
if (!networkStatus) { if (!networkStatus) {
$router.error("NetworkError"); $router.error('NetworkError')
} }
if (true) { if (true) {
this.info = { this.info = {
name: "🍑商城", name: '🍑商城',
logo: "https://static.iocoder.cn/ruoyi-vue-pro-logo.png", logo: 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png',
version: "1.0.0", version: '1.0.0',
copyright: "全部开源,个人与企业可 100% 免费使用", copyright: '全部开源,个人与企业可 100% 免费使用',
copytime: "Copyright© 2018-2024", copytime: 'Copyright© 2018-2024',
cdnurl: "https://file.sheepjs.com", // 云存储域名 cdnurl: 'https://file.sheepjs.com', // 云存储域名
filesystem: "qcloud", // 云存储平台 filesystem: 'qcloud', // 云存储平台
}; }
this.platform = { this.platform = {
share: { share: {
methods: ["poster", "link"], methods: ['poster', 'link'],
linkAddress: "https://shopro.sheepjs.com/#/", linkAddress: 'https://shopro.sheepjs.com/#/',
posterInfo: { posterInfo: {
user_bg: "/static/img/shop/config/user-poster-bg.png", user_bg: '/static/img/shop/config/user-poster-bg.png',
goods_bg: "/static/img/shop/config/goods-poster-bg.png", goods_bg: '/static/img/shop/config/goods-poster-bg.png',
groupon_bg: "/static/img/shop/config/groupon-poster-bg.png", groupon_bg: '/static/img/shop/config/groupon-poster-bg.png',
}, },
}, },
bind_mobile: 0, bind_mobile: 0,
}; }
this.chat = { this.chat = {
chat_domain: "https://api.shopro.sheepjs.com/chat", chat_domain: 'https://api.shopro.sheepjs.com/chat',
room_id: "admin", room_id: 'admin',
}; }
this.has_wechat_trade_managed = 0; this.has_wechat_trade_managed = 0
// 加载主题 // 加载主题
const sysStore = useSysStore(); const sysStore = useSysStore()
sysStore.setTheme(); sysStore.setTheme()
return Promise.resolve(true); return Promise.resolve(true)
} else { } else {
$router.error("InitError", res.msg || "加载失败"); $router.error('InitError', res.msg || '加载失败')
} }
} }
return { return {
info, info,
platform, platform,
chat, chat,
template, template,
shareInfo, shareInfo,
hasWechatTradeManaged, hasWechatTradeManaged,
init, init,
}; }
},
{
persist: {
enabled: true,
strategies: [
{
key: "app-store",
},
],
}, },
} {
); persist: {
enabled: true,
strategies: [
{
key: 'app-store',
},
],
},
}
)
export default useAppStore; export default useAppStore

View File

@ -1,5 +1,30 @@
import dayjs from 'dayjs'
export function resetPagination(pagination) { export function resetPagination(pagination) {
pagination.list = [] pagination.list = []
pagination.total = 0 pagination.total = 0
pagination.pageNo = 1 pagination.pageNo = 1
} }
/**
* 时间日期转换
* @param {dayjs.ConfigType} date 当前时间new Date() 格式
* @param {string} format 需要转换的时间格式字符串
* @description format 字符串随意 `YYYY-mm、YYYY-mm-dd`
* @description format 季度"YYYY-mm-dd HH:MM:SS QQQQ"
* @description format 星期"YYYY-mm-dd HH:MM:SS WWW"
* @description format 几周"YYYY-mm-dd HH:MM:SS ZZZ"
* @description format 季度 + 星期 + 几周"YYYY-mm-dd HH:MM:SS WWW QQQQ ZZZ"
* @returns {string} 返回拼接后的时间字符串
*/
export function formatDate(date, format) {
// 日期不存在,则返回空
if (!date) {
return ''
}
// 日期存在,则进行格式化
if (format === undefined) {
format = 'YYYY-MM-DD HH:mm:ss'
}
return dayjs(date).format(format)
}

BIN
static/order/order_bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB