暂存code

This commit is contained in:
hejiangming
2025-05-07 09:54:33 +08:00
parent 78270eeda0
commit 007b002b81
403 changed files with 14507 additions and 6320 deletions
+187 -149
View File
@@ -7,20 +7,20 @@
<view class="order_type_title">
<view
:class="form.type === item.id ? 'order_type_title_item order_type_title_item_sel':'order_type_title_item'"
v-for="item in orderTypeList"
v-for="(item,index) in orderTypeList"
@click="checkType(item)"
:key="item.id"
:key="index"
>
{{item.title}}
</view>
</view>
<view>
<scroll-view scroll-y="true" @scrolltolower="loadMore" style="height: calc(100vh - 300rpx);">
<view v-if="orderList && orderList.length!==0" class="order_list_warp">
<view class="order_item" v-for="item in orderList" :key="item.id">
<!-- 头部 -->
<view class="order_item_header">
<view class="order_item_header_left">
<up-image :src="item.shopLogo" width="22" height="22" bgColor="#f1f6ff00"></up-image>
<up-image :src="item.shopLogo" width="22" height="22" bgColor="#f1f6ff00" shape="circle"></up-image>
<view class="order_product_title">{{item.shopName}}</view>
</view>
<!-- 除开待付款 -->
@@ -33,36 +33,51 @@
<!-- 待付款 -->
<view v-else class="order_item_header_right order_right_due">
<view class="order_right_due_msg">等待付款</view>
<view class="order_right_due_time">{{item.expireTime}}分钟</view>
<view class="order_right_due_time">{{formatDate1(item.expireTime)}}前</view>
</view>
</view>
<!-- 产品详情 -->
<view class="order_item_content">
<view v-for="pItem in item.items" :key="pItem.id" class="content_item">
<up-image :src="pItem.mainGraph" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="content_info">
<view class="content_info_title">{{pItem.title}}</view>
<view class="content_info_tag">{{pItem.goodsSpece}}</view>
<!-- <view>
<text class="content_info_description" v-for="dItem in pItem.description">
{{dItem}}
</text>
</view> -->
<view v-for="pItem in item.items" :key="pItem.id" >
<view class="content_item" @click="jumpOrderInfo(item)">
<up-image :src="pItem.mainGraph" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="content_info">
<view class="content_info_title">{{pItem.title}}</view>
<view class="content_info_tag">{{pItem.goodsSpece}}</view>
<!-- <view>
<text class="content_info_description" v-for="dItem in pItem.description">
{{dItem}}
</text>
</view> -->
</view>
<view class="content_right">
<view class="content_right_total">¥{{pItem.goodsAmount}}</view>
<view class="content_right_quantity">x{{pItem.buyNum}}</view>
</view>
</view>
<view class="content_right">
<view class="content_right_total">¥{{pItem.goodsAmount}}</view>
<view class="content_right_quantity">x{{pItem.buyNum}}</view>
<view class="content_item_yd" v-if="pItem.expressNo">
<view>运单号:<text v-if="pItem.expressName">({{pItem.expressName}})</text>{{pItem.expressNo}}</view>
<view style="margin-left:10rpx;">
<up-image src="/static/common/copy.png" width="14" height="14" bgColor="#f1f6ff00" @click="copyData(pItem.expressNo)"></up-image>
</view>
</view>
</view>
</view>
<!-- 汇总 -->
<view class="order_item_collect">
<view class="collect_msg">共{{item.buyNum}}件,合计¥{{item.sumAmount}}</view>
<view class="collect_msg collect_msg_s" v-if="this.form.type === MINE_ORDER_TYPE.NOT_RECEIVE">
<view class="content_item_yd_msg">(快递动态跟进请复制单号至[快递100官网] 查询)</view>
<view>共{{item.buyNum}}件,合计¥{{item.sumAmount}}</view>
</view>
<view class="collect_msg" v-else>
共{{item.buyNum}}件,合计¥{{item.sumAmount}}
</view>
<view class="collect_operate">
<view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.UNSHIPPED" @click="checkCancel(true)">取消订单</view>
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.UNPAID" @click="jumpOrderInfo">去付款</view>
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.UNSHIPPED" @click="checkCancel(true)">取消订单</view> -->
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.UNPAID" @click="jumpOrderInfo(item)">去付款</view>
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.COMPLETED">申请退款</view> -->
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.NOT_RECEIVE">确认收货</view>
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.NOT_RECEIVE" @click="confirmReceiptOk(item)">确认收货</view>
<!-- <view class="operate_comm operate_but_3" v-if="item.status === ORDER_TYPE.UNSHIPPED">提醒发货</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.COMPLETED">申请售后</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.AFTER_SALE">查看售后</view> -->
@@ -76,7 +91,8 @@
<up-image src="/static/common/not_order.png" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="not_order_msg_warp">暂无相关订单</view>
</view>
</view>
<view v-if="loading" style="text-align: center;">加载中...</view>
</scroll-view>
<up-popup v-model:show="cancelShow" :round="10" :closeOnClickOverlay="false">
<view class="cancel_show_warp">
<view class="cancel_show_title_warp">
@@ -112,147 +128,75 @@
</view>
</up-popup>
<up-toast ref="uToastRef"></up-toast>
<!-- 暂未开放 -->
<up-modal :show="openShow" :showConfirmButton = "false">
<view class="slot-content">
<view class="close_warp" @click="openShow=false;">
<up-image src="/static/common/close.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
</view>
<view class="content_">
<view class="content_1">温馨提示</view>
<view class="content_2">暂未开放</view>
</view>
<view class="but_">
<view class="but_copy" @click="openShow=false;">确定</view>
</view>
</view>
</up-modal>
</view>
</template>
<script>
import { ORDER_TYPE,ORDER_STATUS,getValue } from '@/utils/enumUtils.js';
import { MINE_ORDER_TYPE,ORDER_TYPE,ORDER_STATUS,getValue } from '@/utils/enumUtils.js';
import { ORDER_STATUS_CSS } from '@/utils/enumCssUtils.js';
import { getOrderList } from '@/api/order.js';
import { getOrderList,confirmReceipt } from '@/api/order.js';
import dayjs from 'dayjs';
import { formatDate1,copyData } from '@/utils/index.js'
export default {
computed: {
ORDER_TYPE() {
return ORDER_TYPE;
MINE_ORDER_TYPE() {
return MINE_ORDER_TYPE;
},
ORDER_STATUS() {
return ORDER_STATUS;
return ORDER_STATUS;
},
ORDER_STATUS_CSS() {
return ORDER_STATUS_CSS;
}
return ORDER_STATUS_CSS;
},
ORDER_TYPE(){
return ORDER_TYPE;
}
},
data() {
return {
orderTypeList:[
{
id:ORDER_TYPE.UNPAID,
id:MINE_ORDER_TYPE.UNPAID,
title:"待支付",
},{
id:ORDER_TYPE.UNSHIPPED,
id:MINE_ORDER_TYPE.UNSHIPPED,
title:"待发货",
},{
id:ORDER_TYPE.NOT_RECEIVE,
id:MINE_ORDER_TYPE.NOT_RECEIVE,
title:"待收货",
},{
id:ORDER_TYPE.SUCCEED,
title:"待评价",
id:MINE_ORDER_TYPE.SUCCEED,
title:"已完成",
},
{
id:MINE_ORDER_TYPE.AFTER_SALE,
title:"售后",
},
],
form:{
search:null,//搜索
page:1,
pageSize:15,
type:0,// 选中的类型
pageSize:10,
type:MINE_ORDER_TYPE.UNPAID,// 选中的类型
},
orderList:[
{
id:1,
url:'/static/common/order_defal.png',
name:"哈希店铺",
status:1,
paymentTime:29,// 剩余付款时间,单位:分钟
product:[
{
id:1,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
}
],
productTotal:3599,
},
{
id:2,
url:'/static/common/order_defal.png',
name:"哈希店铺",
status:2,
product:[
{
id:1,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
},{
id:2,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
}
],
productTotal:7099.88,
},{
id:3,
url:'/static/common/order_defal.png',
name:"哈希店铺",
status:4,
product:[
{
id:1,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
}
],
productTotal:3599,
},{
id:4,
url:'/static/common/order_defal.png',
name:"哈希店铺",
status:5,
product:[
{
id:1,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
}
],
productTotal:3599,
},{
id:6,
url:'/static/common/order_defal.png',
name:"哈希店铺",
status:6,
product:[
{
id:1,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
}
],
productTotal:3599,
},
],
hasMore: true, // 是否有更多数据可以加载
orderList:[],
cancelShow:false,// 取消订单
reasonList:[
{
@@ -279,15 +223,20 @@
reason:null,
remark:null,
},
loading: false, // 加载状态标志
openShow:false,
}
},
onLoad(options) {
const type = options.type;
this.form.type = type ? parseInt(type,10) : ORDER_TYPE.UNPAID;
this.getOrderList();
this.form.type = type && type < 5 ? parseInt(type,10) : MINE_ORDER_TYPE.UNPAID;
this.loadData();
},
methods: {
dayjs,
getValue,
formatDate1,
copyData,
jumpLeft(){
uni.switchTab({
url: '/pages/mine/mine',
@@ -297,24 +246,72 @@
console.log("searchFun",val);
},
checkType(item){
this.form.page = 1;
this.form.type = item.id;
this.getOrderList();
this.orderList = [];
if(item.id!==MINE_ORDER_TYPE.AFTER_SALE){
this.loadData();
}else{
this.openShow = true;// 未开发的弹框
}
},
jumpOrderInfo(){
jumpOrderInfo(item){
uni.navigateTo({
url:"/pages/mine_order_info/mine_order_info?type="+this.type,
url:"/pages/mine_order_info/mine_order_info?id="+item.id,
})
},
async getOrderList(){
// 处理到期时间
handleExpressTime(expressTime){
let resultM=0;
if(!expressTime || expressTime === 0){
return resultM;
}
const currentTimestamp = dayjs().unix();
const time = currentTimestamp - expressTime;
resultM = dayjs(time).format('YYYY-MM-DD HH:MM:SS'); // 获取时分格式的字符串
// 如果需要将时分转换为分钟数(例如,'12:34'转换为754分钟),则需要额外计算:
// const [hours, minutes] = formattedTime.split(':').map(Number); // 分解小时和分钟为数字
// resultM = hours * 60 + minutes; // 计算总分钟数
// console.log(resultM); // 输出总分钟数,例如754
return resultM;
},
// 加载数据的方法
async loadData() {
if (this.loading) return; // 如果正在加载,则不重复加载
this.loading = true; // 设置加载状态为true
try {
// 模拟异步获取数据,实际应用中应该替换为你的数据获取逻辑,例如API调用
const newData = await this.fetchData(this.form.page, this.form.pageSize);
if(newData.entitys && newData.entitys.length !==0){
this.orderList = [...this.orderList, ...newData.entitys]; // 将新数据添加到列表中
this.form.page++; // 页码加1
}
} catch (error) {
console.error('加载数据失败:', error);
} finally {
this.loading = false; // 设置加载状态为false
}
},
// 模拟获取数据的方法,实际应用中应该替换为你的数据获取逻辑,例如从服务器获取数据
async fetchData(page, pageSize) {
const params = {
...this.form,
page,
pageSize,
}
const resp = await getOrderList(params);
console.log("resp",resp);
if(resp && resp.bizcode === 100){
this.orderList = resp.data;
const data = await getOrderList(params);
if(data && data.bizcode === 100){
return data.data
}else{
return [];
}
},
// 当滚动到底部时触发的方法
loadMore() {
this.loadData(); // 加载更多数据
},
checkCancel(status){
this.cancelShow = status;
if(!status){
@@ -324,7 +321,6 @@
}
}
},
/**
* 确认取消
*/
@@ -339,8 +335,33 @@
});
return;
}
console.log("params",params);
this.checkCancel(false);
},
/**
* 确认收货
*/
confirmReceiptOk(item){
const then = this;
uni.showModal({
title: '提示',
content: '是否确认收货?',
success: function (res) {
if (res.confirm) {
then.confirmReceiptFun(item);
}
}
});
},
async confirmReceiptFun(item){
const params = {
id:item.id,
}
const resp = await confirmReceipt(params);
if(resp && resp.bizcode === 100){
this.orderList = [];
this.form.page = 1;
this.loadData();
}
}
}
}
@@ -374,8 +395,8 @@
}
}
.order_list_warp{
height: calc(100vh - 270rpx);
overflow-y: auto;
// height: calc(100vh - 270rpx);
// overflow-y: auto;
}
.order_item{
background: #FFFFFF;
@@ -428,6 +449,10 @@
color: #666666;
text-align: right;
}
.collect_msg_s{
display: flex;
justify-content: space-between;
}
}
}
@@ -479,4 +504,17 @@
position: initial;
width: 94%;
}
.content_info_title{
width: 370rpx;
}
.content_item_yd{
font-weight: bold;
font-size: 24rpx;
display: flex;
align-items: center;
}
.content_item_yd_msg{
font-weight: bold;
font-size: 18rpx;
}
</style>