fix
This commit is contained in:
parent
dd8edc28fc
commit
24526bd526
2
.env
2
.env
|
@ -8,7 +8,7 @@ MALL_BASE_URL = http://api-dashboard.yudao.iocoder.cn
|
|||
MALL_DEV_BASE_URL = http://mall-backend-dev.jiandyb.cn:7001
|
||||
|
||||
# 后端接口前缀(一般不建议调整)
|
||||
MALL_API_PATH = /app-api
|
||||
MALL_API_PATH = /merchant-api
|
||||
|
||||
# 开发环境运行端口
|
||||
MALL_DEV_PORT = 3000
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"navigationBarTitleText": "订单"
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
"auth": false
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,18 +1,33 @@
|
|||
<template>
|
||||
<pb-layout title="产品" navbar="normal" tabbar="/pages/index/product" :bgStyle="bgStyle" opacityBgUi="bg-white"
|
||||
color="black">
|
||||
|
||||
<view v-if="StaticRange.pagination.total > 0" class="goods-list ss-m-t-20">
|
||||
<pb-layout
|
||||
title="产品"
|
||||
navbar="normal"
|
||||
tabbar="/pages/index/product"
|
||||
:bgStyle="bgStyle"
|
||||
opacityBgUi="bg-white"
|
||||
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" 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 })" />
|
||||
<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="StaticRange.pagination.total > 0" :status="StaticRange.loadStatus" :content-text="{
|
||||
contentdown: '上拉加载更多'
|
||||
}" @click="loadMore" />
|
||||
<p-empty v-if="StaticRange.pagination.total === 0" icon="/static/soldout-empty.png" text="暂无产品" />
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@click="loadMore"
|
||||
/>
|
||||
<p-empty v-if="state.pagination.total === 0" icon="/static/soldout-empty.png" text="暂无产品" />
|
||||
</pb-layout>
|
||||
</template>
|
||||
|
||||
|
@ -21,7 +36,7 @@ import { ref } from 'vue'
|
|||
import { onLoad, onReachBottom } from '@dcloudio/uni-app'
|
||||
import peach from '@/peach'
|
||||
import _ from 'lodash'
|
||||
import { resetPagination } from '@/peach/util'
|
||||
import { resetPagination } from '@/peach/utils'
|
||||
|
||||
const bgStyle = {
|
||||
backgroundImage: '',
|
||||
|
@ -34,8 +49,8 @@ const state = ref({
|
|||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 6
|
||||
}
|
||||
pageSize: 6,
|
||||
},
|
||||
})
|
||||
|
||||
function emptyList() {
|
||||
|
@ -47,9 +62,7 @@ function onSearch() {
|
|||
getList()
|
||||
}
|
||||
|
||||
function getList() {
|
||||
|
||||
}
|
||||
function getList() {}
|
||||
|
||||
function loadMore() {
|
||||
if (state.value.loadStatus === 'noMore') {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
<template>
|
||||
<pb-layout title="订单" navbar="nomal" tabbar="/pages/order/list" :bgStyle="bgStyle">
|
||||
<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>
|
||||
|
@ -109,7 +116,7 @@ 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/util'
|
||||
import { resetPagination } from '@/peach/utils'
|
||||
|
||||
const bgStyle = {
|
||||
backgroundColor: '#fff',
|
||||
|
@ -181,6 +188,32 @@ function onOrderDetail(id) {
|
|||
})
|
||||
}
|
||||
|
||||
// 获取订单列表
|
||||
async function getOrderList() {
|
||||
state.loadStatus = 'loading'
|
||||
// let { code, data } = await OrderApi.getOrderPage({
|
||||
// pageNo: state.pagination.pageNo,
|
||||
// pageSize: state.pagination.pageSize,
|
||||
// status: tabMaps[state.currentTab].value,
|
||||
// })
|
||||
// if (code !== 0) {
|
||||
// return
|
||||
// }
|
||||
|
||||
data.list.forEach((item) => {
|
||||
item.order.forEach((sitem) => {
|
||||
handleOrderButtons(sitem)
|
||||
})
|
||||
})
|
||||
state.pagination.list = _.concat(state.pagination.list, data.list)
|
||||
console.log(state.pagination.list)
|
||||
state.pagination.total = data.total
|
||||
let currentPageTotal = state.pagination.list.reduce((pre, cur) => {
|
||||
return pre + cur.order.length
|
||||
}, 0)
|
||||
state.loadStatus = currentPageTotal < state.pagination.total ? 'more' : 'noMore'
|
||||
}
|
||||
|
||||
onLoad(async (options) => {
|
||||
if (options.type) {
|
||||
state.value.currentTab = options.type
|
||||
|
|
|
@ -3,7 +3,7 @@ import request from '@/peach/request'
|
|||
const AuthUtil = {
|
||||
login: (data) => {
|
||||
return request({
|
||||
url: '/member/auth/login',
|
||||
url: '/particulars/member/auth/sms-login',
|
||||
method: 'POST',
|
||||
data,
|
||||
custom: {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ref } from "vue";
|
||||
import dayjs from "dayjs";
|
||||
import { ref } from 'vue'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
/**
|
||||
* 将分转成元
|
||||
|
@ -8,7 +8,7 @@ import dayjs from "dayjs";
|
|||
* @returns {string} 元,例如说 1.00 元
|
||||
*/
|
||||
export function fen2yuan(price) {
|
||||
return (price / 100.0).toFixed(2);
|
||||
return (price / 100.0).toFixed(2)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18,8 +18,8 @@ export function fen2yuan(price) {
|
|||
* @return {string} 格式化后的销量字符串
|
||||
*/
|
||||
export function formatSales(type, num) {
|
||||
let prefix = type !== "exact" && num < 10 ? "销量" : "已售";
|
||||
return formatNum(prefix, type, num);
|
||||
let prefix = type !== 'exact' && num < 10 ? '销量' : '已售'
|
||||
return formatNum(prefix, type, num)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,5 +29,82 @@ export function formatSales(type, num) {
|
|||
* @return {string} 格式化后的销量字符串
|
||||
*/
|
||||
export function formatStock(type, num) {
|
||||
return formatNum("库存", type, num);
|
||||
return formatNum('库存', type, num)
|
||||
}
|
||||
|
||||
export function formatOrderStatus(order) {
|
||||
if (order.status === 0) {
|
||||
return '待付款'
|
||||
}
|
||||
if (order.status === 10 && order.deliveryType === 1) {
|
||||
return '待发货'
|
||||
}
|
||||
if (order.status === 10 && order.deliveryType === 2) {
|
||||
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 '待核销'
|
||||
}
|
||||
if (order.status === 60) {
|
||||
return '待配送'
|
||||
}
|
||||
return '已关闭'
|
||||
}
|
||||
|
||||
export function formatOrderColor(order) {
|
||||
if (order.status === 0) {
|
||||
return 'info-color'
|
||||
}
|
||||
if (
|
||||
order.status === 10 ||
|
||||
order.status === 20 ||
|
||||
(order.status === 30 && !order.commentStatus) ||
|
||||
order.status === 50 ||
|
||||
order.status === 60
|
||||
) {
|
||||
return 'warning-color'
|
||||
}
|
||||
if (order.status === 30 && order.commentStatus) {
|
||||
return 'success-color'
|
||||
}
|
||||
|
||||
return 'danger-color'
|
||||
}
|
||||
|
||||
export function handleOrderButtons(order) {
|
||||
order.buttons = []
|
||||
if (order.type === 3) {
|
||||
// 查看拼团
|
||||
order.buttons.push('combination')
|
||||
}
|
||||
if (order.status === 20) {
|
||||
// 确认收货
|
||||
order.buttons.push('confirm')
|
||||
}
|
||||
if (order.logisticsId > 0) {
|
||||
// 查看物流
|
||||
order.buttons.push('express')
|
||||
}
|
||||
if (order.status === 0) {
|
||||
// 取消订单 / 发起支付
|
||||
order.buttons.push('cancel')
|
||||
// order.buttons.push('pay');
|
||||
}
|
||||
if (order.status === 30 && !order.commentStatus) {
|
||||
// 发起评价
|
||||
order.buttons.push('comment')
|
||||
}
|
||||
if (order.status === 40) {
|
||||
// 删除订单
|
||||
order.buttons.push('delete')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ export default {
|
|||
default: 44,
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
default: peach.$platform.navbar,
|
||||
default: peach.$platform.navBar,
|
||||
// #endif
|
||||
},
|
||||
// 是否开启吸顶功能
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
export function resetPagination(pagination) {
|
||||
pagination.list = []
|
||||
pagination.total = 0
|
||||
pagination.pageNo = 1
|
||||
}
|
Loading…
Reference in New Issue