562 lines
12 KiB
Vue
562 lines
12 KiB
Vue
<template>
|
||
<view class="page-content">
|
||
<!-- <nut-dialog title="取消订单" content="确认取消吗?此操作不可恢复!" v-model:visible="visibleCancelOrderDialog"
|
||
@cancel="visibleCancelOrderDialog = false" @ok="onClickCancelOrder" />
|
||
|
||
|
||
<nut-dialog title="标记付款" content="确认标记吗?此操作不可恢复!" v-model:visible="visiblePayOrderDialog"
|
||
@cancel="visiblePayOrderDialog = false" @ok="onClickPayOrder" /> -->
|
||
|
||
|
||
<nut-sticky>
|
||
<!-- <nut-searchbar placeholder="请输入商品串号" clearable v-model="search_val" input-background="#eee"
|
||
@search="onSearch" @clear="onClear">
|
||
<template #rightout>
|
||
<nut-button size="small" type="primary" @click="onSearch">搜索</nut-button>
|
||
</template>
|
||
</nut-searchbar> -->
|
||
<nut-tabs v-model="current_tab_idx" background="#fff">
|
||
<template #titles>
|
||
<div class="title-list">
|
||
<view v-for="(item,idx) in tabs_config" :key="idx" class="title-item"
|
||
:class="{ 'tabs-active': idx === current_tab_idx }" @click="onChangeTab(item,idx)">
|
||
<view class="nut-tabs__titles-item__text">
|
||
{{item.title}}
|
||
</view>
|
||
<view class="item__line" />
|
||
</view>
|
||
</div>
|
||
</template>
|
||
</nut-tabs>
|
||
</nut-sticky>
|
||
|
||
<z-paging ref="paging" :fixed="false" style="height: 88vh;" class="order-list" v-model="dataList"
|
||
@query="queryList">
|
||
|
||
<view class="order-inner" v-for="(order,index) in dataList" :key="index">
|
||
<view class="order-inner-header">
|
||
<text>{{order.create_time}}</text>
|
||
<nut-tag custom-color="#1a1a1a">{{order?.status?.text}}</nut-tag>
|
||
<!-- <text>{{order.order_no}}</text> -->
|
||
</view>
|
||
|
||
<view class="goods-info-row" v-for="(goods,iidx) in order.goods" :key="iidx"
|
||
@click="navigateToDetail(order.order_id)">
|
||
<view class="left-text">
|
||
<view class="goods-name">
|
||
<nut-tag custom-color="#1a1a1a">{{goods.goods_type_name}}</nut-tag>
|
||
<text style="margin-left: 10rpx;">{{goods.goods_name}}</text>
|
||
</view>
|
||
<!-- <text class="goods-no">串号:{{goods.goods_no}}</text> -->
|
||
</view>
|
||
<view class="price">
|
||
{{goods?.goods_price}}
|
||
</view>
|
||
<view class="goods-pay-status">
|
||
{{goods?.goods_pay_status?.text}}
|
||
</view>
|
||
</view>
|
||
|
||
|
||
<view class="footer">
|
||
<!-- <view class="order-inner-price">
|
||
总计:<nut-price :price="order.total_price" size="normal" :need-symbol="true" />
|
||
</view> v-if="order.order_status.value === 10"-->
|
||
<view class="order-inner-action" >
|
||
<view style="margin-left:10rpx;">
|
||
<!-- v-if="order.pay_status.value === 10 " -->
|
||
<!-- <nut-button plain size="small" v-if="order.delivery_status.value !== 20 "
|
||
@click="visibleCancelOrderDialog = true;current_cancel_order_id=order.order_id;">
|
||
取消订单
|
||
</nut-button> -->
|
||
</view>
|
||
|
||
|
||
<view style="margin-left:10rpx;">
|
||
<!-- <nut-button type="primary" size="small"
|
||
@click="visiblePayOrderDialog = true;current_pay_order_id=order.order_id;"
|
||
v-if="order.pay_status.value === 10 && !audit">
|
||
标记付款
|
||
</nut-button> -->
|
||
</view>
|
||
|
||
|
||
<view style="margin-left:10rpx;">
|
||
<!-- <nut-button type="primary" size="small" @click="onClickDeliveryOrder(order)"
|
||
v-if="order.pay_status.value === 20 && order.delivery_status.value === 10">
|
||
去发货
|
||
</nut-button> -->
|
||
</view>
|
||
|
||
|
||
|
||
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</z-paging>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</view>
|
||
</template>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<script setup>
|
||
import {
|
||
onMounted,
|
||
reactive,
|
||
ref
|
||
} from 'vue';
|
||
import {
|
||
onLoad,
|
||
onShow
|
||
} from '@dcloudio/uni-app';
|
||
|
||
|
||
import {
|
||
navigateTo,
|
||
} from '@/utils/helper';
|
||
import {
|
||
fetchOrderList,
|
||
} from '@/api/index';
|
||
|
||
// import {
|
||
// fetchGetConfig
|
||
// } from '@/api/config';
|
||
|
||
// // 审核模式 默认开启 true
|
||
// const audit = ref(true);
|
||
|
||
// // 支付码
|
||
// const images = ref([]);
|
||
|
||
|
||
// // 展示发货弹窗
|
||
// const openDeliveryPopup = ref(false)
|
||
// // 发货订单
|
||
// const orderDetail = reactive({})
|
||
// const form = reactive({
|
||
// order_id: 0,
|
||
// express_company: '',
|
||
// express_no: '',
|
||
// })
|
||
|
||
// // 发货
|
||
// const deliveryOrder = () => {
|
||
// form.order_id = orderDetail.order_id
|
||
// console.log('form===>', form);
|
||
// fetchDeliveryOrder(form).then(res => {
|
||
// uni.showToast({
|
||
// icon: 'none',
|
||
// title: '发货成功'
|
||
// })
|
||
// onCloseDeliveryPopup()
|
||
// paging.value.reload();
|
||
// })
|
||
// }
|
||
|
||
// // 打开发货弹窗
|
||
// const onClickDeliveryOrder = (order) => {
|
||
// console.log(order);
|
||
// Object.assign(orderDetail, order)
|
||
// openDeliveryPopup.value = true
|
||
|
||
// }
|
||
|
||
// // 关闭发货弹窗
|
||
// const onCloseDeliveryPopup = () => {
|
||
// // 重置 发货订单
|
||
// Object.assign(orderDetail, {})
|
||
// Object.assign(form, {
|
||
// order_id: 0,
|
||
// express_company: '',
|
||
// express_no: '',
|
||
// })
|
||
// openDeliveryPopup.value = false
|
||
// console.log("关闭");
|
||
// };
|
||
|
||
|
||
|
||
|
||
// 默认tab
|
||
const current_tab_idx = ref(0);
|
||
// 定义tab切换
|
||
const tabs_config = [
|
||
|
||
{
|
||
title: '今日',
|
||
status: 'today'
|
||
},
|
||
{
|
||
title: '昨日',
|
||
status: 'yesterday'
|
||
},
|
||
{
|
||
title: '当月',
|
||
status: 'month'
|
||
},
|
||
{
|
||
title: '全部',
|
||
status: 'all'
|
||
},
|
||
|
||
]
|
||
// 订单列表数据
|
||
const dataList = ref([]);
|
||
// zp
|
||
const paging = ref(null);
|
||
|
||
|
||
|
||
|
||
// 取消订单弹窗
|
||
const visibleCancelOrderDialog = ref(false);
|
||
// 被取消订单id
|
||
const current_cancel_order_id = ref(0);
|
||
|
||
// 订单付款弹窗
|
||
const visiblePayOrderDialog = ref(false);
|
||
// 付款订单id
|
||
const current_pay_order_id = ref(0);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
// 搜索内容
|
||
const search_val = ref('')
|
||
// tab切换
|
||
const onChangeTab = (item, idx) => {
|
||
current_tab_idx.value = idx
|
||
paging.value.reload();
|
||
}
|
||
|
||
|
||
// 获取配置
|
||
// const getConfig = () => {
|
||
// fetchGetConfig().then(res => {
|
||
// console.log('getConfig=====>', res)
|
||
// audit.value = res.appConfig.is_audit == 1
|
||
// console.log(res.appConfig.pay_imgs);
|
||
// let pay_imgs = JSON.parse(res.appConfig.pay_imgs) || [];
|
||
// let wechat_imgs = JSON.parse(res.appConfig.wechat_imgs) || [];
|
||
// let pay_imgs_arr = pay_imgs.map(item => item.file_path) || [];
|
||
// let wechat_imgs_arr = wechat_imgs.map(item => item.file_path) || [];
|
||
// const merged_imgs_arr = pay_imgs_arr.concat(wechat_imgs_arr);
|
||
// images.value = merged_imgs_arr;
|
||
// })
|
||
// }
|
||
|
||
// // 显示支付码
|
||
// const showPayImgs = () => {
|
||
// if (images.value.length === 0) {
|
||
// uni.showToast({
|
||
// title: '暂无图片',
|
||
// icon: 'none'
|
||
// });
|
||
// return;
|
||
// }
|
||
// console.log('preview images:', images);
|
||
// uni.previewImage({
|
||
// urls: images.value
|
||
// });
|
||
// }
|
||
|
||
// 跳转详情页面
|
||
const navigateToDetail = (id) => {
|
||
console.log(id);
|
||
if (!id) {
|
||
console.warn('导航ID不能为空')
|
||
return
|
||
}
|
||
uni.navigateTo({
|
||
url: `/pages/config/shopOrder/detail?id=${encodeURIComponent(id)}`
|
||
})
|
||
}
|
||
|
||
|
||
// // 取消订单
|
||
// const onClickCancelOrder = () => {
|
||
// fetchCancelOrder(current_cancel_order_id.value).then(res => {
|
||
// uni.showToast({
|
||
// title: '取消成功',
|
||
// icon: 'none'
|
||
// })
|
||
// paging.value.reload();
|
||
// })
|
||
// }
|
||
|
||
// // 标记付款
|
||
// const onClickPayOrder = () => {
|
||
// fetchPayOrder(current_pay_order_id.value).then(res => {
|
||
// uni.showToast({
|
||
// title: '标记付款成功',
|
||
// icon: 'none'
|
||
// })
|
||
// paging.value.reload();
|
||
// })
|
||
// }
|
||
|
||
|
||
|
||
|
||
|
||
|
||
// 获取订单列表
|
||
const queryList = (pageNo = 1, pageSize = 10) => {
|
||
console.log(tabs_config[current_tab_idx.value]['status']);
|
||
const params = {
|
||
page: pageNo,
|
||
pageSize: 10,
|
||
status: tabs_config[current_tab_idx.value]['status'],
|
||
}
|
||
fetchOrderList(params).then(res => {
|
||
console.log(res);
|
||
paging.value.complete(res.list);
|
||
}).catch(res => {
|
||
paging.value.complete(false);
|
||
})
|
||
}
|
||
|
||
onLoad((options) => {
|
||
current_tab_idx.value = parseInt(options.tab)
|
||
})
|
||
|
||
|
||
/**
|
||
* 页面显示生命周期钩子
|
||
* 每次页面显示时都会执行
|
||
*/
|
||
onShow(() => {
|
||
// 获取配置
|
||
// getConfig()
|
||
if (paging.value) {
|
||
// paging.value.pageNo = 1;
|
||
paging.value.refresh();
|
||
// paging.value.refreshToPage(1)
|
||
// paging.value.reload();
|
||
}
|
||
|
||
})
|
||
|
||
// 搜索
|
||
const onSearch = () => {
|
||
console.log("搜索:", search_val.value);
|
||
paging.value.reload();
|
||
|
||
}
|
||
// 清空搜索框
|
||
const onClear = () => {
|
||
console.log("搜索:", search_val.value);
|
||
paging.value.reload();
|
||
}
|
||
|
||
|
||
|
||
// 订单状态
|
||
const getStatusText = (order) => {
|
||
if (order.order_status.value == 20) {
|
||
return order.order_status.text
|
||
} else if (order.order_status.value == 30) {
|
||
return order.order_status.text
|
||
} else if (order.order_status.value == 10) {
|
||
if (order.pay_status.value == 10) {
|
||
return order.pay_status.text
|
||
} else if (order.pay_status.value == 20) {
|
||
if (order.delivery_status.value == 10) {
|
||
return order.delivery_status.text
|
||
} else if (order.delivery_status.value == 20) {
|
||
return order.receipt_status.text
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
|
||
|
||
<style scoped lang="scss">
|
||
.page-content {
|
||
min-height: 100vh;
|
||
background-color: #f2f3f5;
|
||
}
|
||
|
||
.order-popup {
|
||
|
||
.address-inner {
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: center;
|
||
}
|
||
|
||
.total-price-inner {
|
||
width: 100%;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
|
||
// flex-direction: row;
|
||
view:nth-child(2) {
|
||
color: #fa2c19;
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
|
||
.wechat-img-inner {
|
||
margin-top: 60rpx;
|
||
padding: 0rpx 80rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex-direction: column;
|
||
// gap: 5px;
|
||
}
|
||
|
||
|
||
.order-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
width: 100%;
|
||
|
||
}
|
||
|
||
.order-inner {
|
||
display: flex;
|
||
flex-direction: column;
|
||
background: #fff;
|
||
border-radius: 15rpx;
|
||
overflow: hidden;
|
||
margin: 20rpx;
|
||
|
||
.order-inner-header {
|
||
display: flex;
|
||
align-items: center;
|
||
background-color: #dcdcdc;
|
||
color: rgba(0, 0, 0, .5);
|
||
font-size: 24rpx;
|
||
justify-content: space-between;
|
||
line-height: 45rpx;
|
||
padding: 15rpx 20rpx;
|
||
}
|
||
|
||
|
||
/* 信息行布局 */
|
||
.goods-info-row {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
padding: 20rpx;
|
||
border-bottom: 2rpx solid #f2f3f5;
|
||
|
||
/* 左侧文字样式 */
|
||
.left-text {
|
||
flex: 1;
|
||
}
|
||
|
||
.goods-name {
|
||
font-size: 28rpx;
|
||
color: #000000;
|
||
display: block;
|
||
// margin-bottom: 8rpx;
|
||
}
|
||
|
||
// .goods-no {
|
||
// font-size: 26rpx;
|
||
// color: #000000;
|
||
// display: block;
|
||
// }
|
||
|
||
/* 右侧价格样式 */
|
||
.price {
|
||
font-size: 26rpx;
|
||
margin-left: 20rpx;
|
||
align-self: center;
|
||
color: #fa2c19;
|
||
/* 垂直居中在两行文字之间 */
|
||
}
|
||
.goods-pay-status{
|
||
font-size: 26rpx;
|
||
margin-left: 20rpx;
|
||
align-self: center;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
.footer {
|
||
display: flex;
|
||
flex-direction: column;
|
||
|
||
.order-inner-price {
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
padding-top: 10rpx;
|
||
padding-right: 20rpx;
|
||
padding-bottom: 20rpx;
|
||
font-size: 24rpx;
|
||
align-items: center;
|
||
}
|
||
|
||
.order-inner-action {
|
||
display: flex;
|
||
padding-top: 10rpx;
|
||
padding-bottom: 30rpx;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
.title-list {
|
||
display: flex;
|
||
justify-content: space-around;
|
||
align-items: center;
|
||
width: 100%;
|
||
|
||
.title-item {
|
||
display: flex;
|
||
justify-content: space-around;
|
||
align-items: center;
|
||
position: relative;
|
||
}
|
||
|
||
.tabs-active {
|
||
font-weight: bold;
|
||
color: $tabs-titles-item-active-color;
|
||
opacity: $tabs-titles-item-line-opacity;
|
||
transition: width 0.3s ease;
|
||
|
||
.item__line {
|
||
position: absolute;
|
||
bottom: -10%;
|
||
left: 50%;
|
||
overflow: hidden;
|
||
content: ' ';
|
||
border-radius: $tabs-titles-item-line-border-radius;
|
||
opacity: $tabs-titles-item-line-opacity;
|
||
transition: width 0.3s ease;
|
||
transform: translate(-50%, 0);
|
||
width: $tabs-horizontal-titles-item-active-line-width;
|
||
height: 3px;
|
||
content: ' ';
|
||
background: $tabs-horizontal-tab-line-color;
|
||
}
|
||
}
|
||
}
|
||
</style> |